Skip to content

Commit 7598b34

Browse files
Zhu Yanjundavem330
authored andcommitted
forcedeth: replace pci_map_single with dma_map_single functions
pci_map_single functions are obsolete. So replace them with dma_map_single functions. Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5416953 commit 7598b34

File tree

1 file changed

+36
-34
lines changed

1 file changed

+36
-34
lines changed

drivers/net/ethernet/nvidia/forcedeth.c

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1813,12 +1813,12 @@ static int nv_alloc_rx(struct net_device *dev)
18131813
struct sk_buff *skb = netdev_alloc_skb(dev, np->rx_buf_sz + NV_RX_ALLOC_PAD);
18141814
if (skb) {
18151815
np->put_rx_ctx->skb = skb;
1816-
np->put_rx_ctx->dma = pci_map_single(np->pci_dev,
1816+
np->put_rx_ctx->dma = dma_map_single(&np->pci_dev->dev,
18171817
skb->data,
18181818
skb_tailroom(skb),
1819-
PCI_DMA_FROMDEVICE);
1820-
if (pci_dma_mapping_error(np->pci_dev,
1821-
np->put_rx_ctx->dma)) {
1819+
DMA_FROM_DEVICE);
1820+
if (dma_mapping_error(&np->pci_dev->dev,
1821+
np->put_rx_ctx->dma)) {
18221822
kfree_skb(skb);
18231823
goto packet_dropped;
18241824
}
@@ -1854,12 +1854,12 @@ static int nv_alloc_rx_optimized(struct net_device *dev)
18541854
struct sk_buff *skb = netdev_alloc_skb(dev, np->rx_buf_sz + NV_RX_ALLOC_PAD);
18551855
if (skb) {
18561856
np->put_rx_ctx->skb = skb;
1857-
np->put_rx_ctx->dma = pci_map_single(np->pci_dev,
1857+
np->put_rx_ctx->dma = dma_map_single(&np->pci_dev->dev,
18581858
skb->data,
18591859
skb_tailroom(skb),
1860-
PCI_DMA_FROMDEVICE);
1861-
if (pci_dma_mapping_error(np->pci_dev,
1862-
np->put_rx_ctx->dma)) {
1860+
DMA_FROM_DEVICE);
1861+
if (dma_mapping_error(&np->pci_dev->dev,
1862+
np->put_rx_ctx->dma)) {
18631863
kfree_skb(skb);
18641864
goto packet_dropped;
18651865
}
@@ -1977,9 +1977,9 @@ static void nv_unmap_txskb(struct fe_priv *np, struct nv_skb_map *tx_skb)
19771977
{
19781978
if (tx_skb->dma) {
19791979
if (tx_skb->dma_single)
1980-
pci_unmap_single(np->pci_dev, tx_skb->dma,
1980+
dma_unmap_single(&np->pci_dev->dev, tx_skb->dma,
19811981
tx_skb->dma_len,
1982-
PCI_DMA_TODEVICE);
1982+
DMA_TO_DEVICE);
19831983
else
19841984
pci_unmap_page(np->pci_dev, tx_skb->dma,
19851985
tx_skb->dma_len,
@@ -2047,10 +2047,10 @@ static void nv_drain_rx(struct net_device *dev)
20472047
}
20482048
wmb();
20492049
if (np->rx_skb[i].skb) {
2050-
pci_unmap_single(np->pci_dev, np->rx_skb[i].dma,
2050+
dma_unmap_single(&np->pci_dev->dev, np->rx_skb[i].dma,
20512051
(skb_end_pointer(np->rx_skb[i].skb) -
2052-
np->rx_skb[i].skb->data),
2053-
PCI_DMA_FROMDEVICE);
2052+
np->rx_skb[i].skb->data),
2053+
DMA_FROM_DEVICE);
20542054
dev_kfree_skb(np->rx_skb[i].skb);
20552055
np->rx_skb[i].skb = NULL;
20562056
}
@@ -2224,10 +2224,11 @@ static netdev_tx_t nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
22242224
prev_tx = put_tx;
22252225
prev_tx_ctx = np->put_tx_ctx;
22262226
bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size;
2227-
np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt,
2228-
PCI_DMA_TODEVICE);
2229-
if (pci_dma_mapping_error(np->pci_dev,
2230-
np->put_tx_ctx->dma)) {
2227+
np->put_tx_ctx->dma = dma_map_single(&np->pci_dev->dev,
2228+
skb->data + offset, bcnt,
2229+
DMA_TO_DEVICE);
2230+
if (dma_mapping_error(&np->pci_dev->dev,
2231+
np->put_tx_ctx->dma)) {
22312232
/* on DMA mapping error - drop the packet */
22322233
dev_kfree_skb_any(skb);
22332234
u64_stats_update_begin(&np->swstats_tx_syncp);
@@ -2373,10 +2374,11 @@ static netdev_tx_t nv_start_xmit_optimized(struct sk_buff *skb,
23732374
prev_tx = put_tx;
23742375
prev_tx_ctx = np->put_tx_ctx;
23752376
bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size;
2376-
np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt,
2377-
PCI_DMA_TODEVICE);
2378-
if (pci_dma_mapping_error(np->pci_dev,
2379-
np->put_tx_ctx->dma)) {
2377+
np->put_tx_ctx->dma = dma_map_single(&np->pci_dev->dev,
2378+
skb->data + offset, bcnt,
2379+
DMA_TO_DEVICE);
2380+
if (dma_mapping_error(&np->pci_dev->dev,
2381+
np->put_tx_ctx->dma)) {
23802382
/* on DMA mapping error - drop the packet */
23812383
dev_kfree_skb_any(skb);
23822384
u64_stats_update_begin(&np->swstats_tx_syncp);
@@ -2810,9 +2812,9 @@ static int nv_rx_process(struct net_device *dev, int limit)
28102812
* TODO: check if a prefetch of the first cacheline improves
28112813
* the performance.
28122814
*/
2813-
pci_unmap_single(np->pci_dev, np->get_rx_ctx->dma,
2814-
np->get_rx_ctx->dma_len,
2815-
PCI_DMA_FROMDEVICE);
2815+
dma_unmap_single(&np->pci_dev->dev, np->get_rx_ctx->dma,
2816+
np->get_rx_ctx->dma_len,
2817+
DMA_FROM_DEVICE);
28162818
skb = np->get_rx_ctx->skb;
28172819
np->get_rx_ctx->skb = NULL;
28182820

@@ -2916,9 +2918,9 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit)
29162918
* TODO: check if a prefetch of the first cacheline improves
29172919
* the performance.
29182920
*/
2919-
pci_unmap_single(np->pci_dev, np->get_rx_ctx->dma,
2920-
np->get_rx_ctx->dma_len,
2921-
PCI_DMA_FROMDEVICE);
2921+
dma_unmap_single(&np->pci_dev->dev, np->get_rx_ctx->dma,
2922+
np->get_rx_ctx->dma_len,
2923+
DMA_FROM_DEVICE);
29222924
skb = np->get_rx_ctx->skb;
29232925
np->get_rx_ctx->skb = NULL;
29242926

@@ -5070,11 +5072,11 @@ static int nv_loopback_test(struct net_device *dev)
50705072
ret = 0;
50715073
goto out;
50725074
}
5073-
test_dma_addr = pci_map_single(np->pci_dev, tx_skb->data,
5075+
test_dma_addr = dma_map_single(&np->pci_dev->dev, tx_skb->data,
50745076
skb_tailroom(tx_skb),
5075-
PCI_DMA_FROMDEVICE);
5076-
if (pci_dma_mapping_error(np->pci_dev,
5077-
test_dma_addr)) {
5077+
DMA_FROM_DEVICE);
5078+
if (dma_mapping_error(&np->pci_dev->dev,
5079+
test_dma_addr)) {
50785080
dev_kfree_skb_any(tx_skb);
50795081
goto out;
50805082
}
@@ -5129,9 +5131,9 @@ static int nv_loopback_test(struct net_device *dev)
51295131
}
51305132
}
51315133

5132-
pci_unmap_single(np->pci_dev, test_dma_addr,
5133-
(skb_end_pointer(tx_skb) - tx_skb->data),
5134-
PCI_DMA_TODEVICE);
5134+
dma_unmap_single(&np->pci_dev->dev, test_dma_addr,
5135+
(skb_end_pointer(tx_skb) - tx_skb->data),
5136+
DMA_TO_DEVICE);
51355137
dev_kfree_skb_any(tx_skb);
51365138
out:
51375139
/* stop engines */

0 commit comments

Comments
 (0)