Просмотр исходного кода

[mtnic] Switch to malloc_dma() and free_dma()

alloc_memblock() and free_memblock() are internal.

Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Piotr Jaroszyński 14 лет назад
Родитель
Сommit
b1fa4378d1
1 измененных файлов: 29 добавлений и 29 удалений
  1. 29
    29
      src/drivers/net/mtnic.c

+ 29
- 29
src/drivers/net/mtnic.c Просмотреть файл

@@ -76,7 +76,7 @@ FILE_LICENCE ( GPL2_ONLY );
76 76
 static int
77 77
 mtnic_alloc_aligned(unsigned int size, void **va, unsigned long *pa, unsigned int alignment)
78 78
 {
79
-	*va = alloc_memblock(size, alignment);
79
+	*va = malloc_dma(size, alignment);
80 80
 	if (!*va) {
81 81
 		return -EADDRINUSE;
82 82
 	}
@@ -212,7 +212,7 @@ mtnic_alloc_ring(struct mtnic_port *priv, struct mtnic_ring *ring,
212 212
 					  (void *)&ring->db, &ring->db_dma, 32);
213 213
 		if (err) {
214 214
 			DBG("Failed allocating Rx ring doorbell record\n");
215
-			free_memblock(ring->buf, ring->buf_size);
215
+			free_dma(ring->buf, ring->buf_size);
216 216
 			return -EADDRINUSE;
217 217
 		}
218 218
 
@@ -230,7 +230,7 @@ mtnic_alloc_ring(struct mtnic_port *priv, struct mtnic_ring *ring,
230 230
 		err = mtnic_alloc_iobuf ( priv, ring, DEF_IOBUF_SIZE );
231 231
 		if (err) {
232 232
 			DBG("ERROR Allocating io buffer\n");
233
-			free_memblock(ring->buf, ring->buf_size);
233
+			free_dma(ring->buf, ring->buf_size);
234 234
 			return -EADDRINUSE;
235 235
 		}
236 236
 
@@ -251,7 +251,7 @@ mtnic_alloc_ring(struct mtnic_port *priv, struct mtnic_ring *ring,
251 251
 					priv->mtnic->fw.txcq_db_offset, PAGE_SIZE);
252 252
 		if (!ring->txcq_db) {
253 253
 			DBG("Couldn't map txcq doorbell, aborting...\n");
254
-			free_memblock(ring->buf, ring->buf_size);
254
+			free_dma(ring->buf, ring->buf_size);
255 255
 			return -EADDRINUSE;
256 256
 		}
257 257
 	}
@@ -296,7 +296,7 @@ mtnic_alloc_cq(struct net_device *dev, int num, struct mtnic_cq *cq,
296 296
 				  (void *)&cq->buf, &cq->dma, PAGE_SIZE);
297 297
 	if (err) {
298 298
 		DBG("Failed allocating CQ buffer\n");
299
-		free_memblock(cq->db, sizeof(struct mtnic_cq_db_record));
299
+		free_dma(cq->db, sizeof(struct mtnic_cq_db_record));
300 300
 		return -EADDRINUSE;
301 301
 	}
302 302
 	memset(cq->buf, 0, cq->buf_size);
@@ -370,16 +370,16 @@ mtnic_alloc_resources(struct net_device *dev)
370 370
 	return 0;
371 371
 
372 372
 cq1_error:
373
-	free_memblock(priv->cq[1].buf, priv->cq[1].buf_size);
374
-	free_memblock(priv->cq[1].db, sizeof(struct mtnic_cq_db_record));
373
+	free_dma(priv->cq[1].buf, priv->cq[1].buf_size);
374
+	free_dma(priv->cq[1].db, sizeof(struct mtnic_cq_db_record));
375 375
 
376 376
 rx_error:
377
-	free_memblock(priv->rx_ring.buf, priv->rx_ring.buf_size);
378
-	free_memblock(priv->rx_ring.db, sizeof(struct mtnic_cq_db_record));
377
+	free_dma(priv->rx_ring.buf, priv->rx_ring.buf_size);
378
+	free_dma(priv->rx_ring.db, sizeof(struct mtnic_cq_db_record));
379 379
 	mtnic_free_io_buffers(&priv->rx_ring);
380 380
 cq0_error:
381
-	free_memblock(priv->cq[0].buf, priv->cq[0].buf_size);
382
-	free_memblock(priv->cq[0].db, sizeof(struct mtnic_cq_db_record));
381
+	free_dma(priv->cq[0].buf, priv->cq[0].buf_size);
382
+	free_dma(priv->cq[0].db, sizeof(struct mtnic_cq_db_record));
383 383
 
384 384
 	return -EADDRINUSE;
385 385
 }
@@ -1159,7 +1159,7 @@ int mtnic_init_card(struct mtnic *mtnic)
1159 1159
 
1160 1160
 eq_error:
1161 1161
 	iounmap(mtnic->eq_db);
1162
-	free_memblock(mtnic->eq.buf, mtnic->eq.buf_size);
1162
+	free_dma(mtnic->eq.buf, mtnic->eq.buf_size);
1163 1163
 map_extra_error:
1164 1164
 	ufree((intptr_t)mtnic->fw.extra_pages.buf);
1165 1165
 map_fw_error:
@@ -1167,7 +1167,7 @@ map_fw_error:
1167 1167
 
1168 1168
 cmd_error:
1169 1169
 	iounmap(mtnic->hcr);
1170
-	free_memblock(mtnic->cmd.buf, PAGE_SIZE);
1170
+	free_dma(mtnic->cmd.buf, PAGE_SIZE);
1171 1171
 
1172 1172
 	return -EADDRINUSE;
1173 1173
 }
@@ -1465,14 +1465,14 @@ cq_error:
1465 1465
 
1466 1466
 allocation_error:
1467 1467
 
1468
-	free_memblock(priv->tx_ring.buf, priv->tx_ring.buf_size);
1468
+	free_dma(priv->tx_ring.buf, priv->tx_ring.buf_size);
1469 1469
 	iounmap(priv->tx_ring.txcq_db);
1470
-	free_memblock(priv->cq[1].buf, priv->cq[1].buf_size);
1471
-	free_memblock(priv->cq[1].db, sizeof(struct mtnic_cq_db_record));
1472
-	free_memblock(priv->rx_ring.buf, priv->rx_ring.buf_size);
1473
-	free_memblock(priv->rx_ring.db, sizeof(struct mtnic_cq_db_record));
1474
-	free_memblock(priv->cq[0].buf, priv->cq[0].buf_size);
1475
-	free_memblock(priv->cq[0].db, sizeof(struct mtnic_cq_db_record));
1470
+	free_dma(priv->cq[1].buf, priv->cq[1].buf_size);
1471
+	free_dma(priv->cq[1].db, sizeof(struct mtnic_cq_db_record));
1472
+	free_dma(priv->rx_ring.buf, priv->rx_ring.buf_size);
1473
+	free_dma(priv->rx_ring.db, sizeof(struct mtnic_cq_db_record));
1474
+	free_dma(priv->cq[0].buf, priv->cq[0].buf_size);
1475
+	free_dma(priv->cq[0].db, sizeof(struct mtnic_cq_db_record));
1476 1476
 
1477 1477
 	mtnic_free_io_buffers(&priv->rx_ring);
1478 1478
 
@@ -1625,14 +1625,14 @@ mtnic_close(struct net_device *dev)
1625 1625
 		mdelay ( 10 );
1626 1626
 
1627 1627
 		/* free memory */
1628
-		free_memblock(priv->tx_ring.buf, priv->tx_ring.buf_size);
1628
+		free_dma(priv->tx_ring.buf, priv->tx_ring.buf_size);
1629 1629
 		iounmap(priv->tx_ring.txcq_db);
1630
-		free_memblock(priv->cq[1].buf, priv->cq[1].buf_size);
1631
-		free_memblock(priv->cq[1].db, sizeof(struct mtnic_cq_db_record));
1632
-		free_memblock(priv->rx_ring.buf, priv->rx_ring.buf_size);
1633
-		free_memblock(priv->rx_ring.db, sizeof(struct mtnic_cq_db_record));
1634
-		free_memblock(priv->cq[0].buf, priv->cq[0].buf_size);
1635
-		free_memblock(priv->cq[0].db, sizeof(struct mtnic_cq_db_record));
1630
+		free_dma(priv->cq[1].buf, priv->cq[1].buf_size);
1631
+		free_dma(priv->cq[1].db, sizeof(struct mtnic_cq_db_record));
1632
+		free_dma(priv->rx_ring.buf, priv->rx_ring.buf_size);
1633
+		free_dma(priv->rx_ring.db, sizeof(struct mtnic_cq_db_record));
1634
+		free_dma(priv->cq[0].buf, priv->cq[0].buf_size);
1635
+		free_dma(priv->cq[0].db, sizeof(struct mtnic_cq_db_record));
1636 1636
 
1637 1637
 		/* Free RX buffers */
1638 1638
 		mtnic_free_io_buffers(&priv->rx_ring);
@@ -1682,11 +1682,11 @@ mtnic_disable(struct pci_device *pci)
1682 1682
 		DBG("Error Releasing resources %d\n", err);
1683 1683
 	}
1684 1684
 
1685
-	free_memblock(mtnic->cmd.buf, PAGE_SIZE);
1685
+	free_dma(mtnic->cmd.buf, PAGE_SIZE);
1686 1686
 	iounmap(mtnic->hcr);
1687 1687
 	ufree((intptr_t)mtnic->fw.fw_pages.buf);
1688 1688
 	ufree((intptr_t)mtnic->fw.extra_pages.buf);
1689
-	free_memblock(mtnic->eq.buf, mtnic->eq.buf_size);
1689
+	free_dma(mtnic->eq.buf, mtnic->eq.buf_size);
1690 1690
 	iounmap(mtnic->eq_db);
1691 1691
 
1692 1692
 

Загрузка…
Отмена
Сохранить