diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2009-12-02 11:48:18 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-12-02 22:57:14 -0500 |
commit | a73b796ed85483a2b999d74d197f31f887ffa82d (patch) | |
tree | 8025110c29ebbefed6bfc0111527832122e29754 | |
parent | e95524a726904a1d2b91552f0577838f67d53c6c (diff) |
be2net: remove use of skb_dma_map/unmap
Due to the fact that skb_dma_map/unmap do not work correctly when a HW
IOMMU is enabled it has been recommended to go about removing the calls
from the network device drivers.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
CC: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/benet/be_main.c | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index e291b1b87532..f24ac4b5ce8f 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -394,15 +394,11 @@ static int make_tx_wrbs(struct be_adapter *adapter, | |||
394 | atomic_add(wrb_cnt, &txq->used); | 394 | atomic_add(wrb_cnt, &txq->used); |
395 | queue_head_inc(txq); | 395 | queue_head_inc(txq); |
396 | 396 | ||
397 | if (skb_dma_map(&pdev->dev, skb, DMA_TO_DEVICE)) { | ||
398 | dev_err(&pdev->dev, "TX DMA mapping failed\n"); | ||
399 | return 0; | ||
400 | } | ||
401 | |||
402 | if (skb->len > skb->data_len) { | 397 | if (skb->len > skb->data_len) { |
403 | int len = skb->len - skb->data_len; | 398 | int len = skb->len - skb->data_len; |
399 | busaddr = pci_map_single(pdev, skb->data, len, | ||
400 | PCI_DMA_TODEVICE); | ||
404 | wrb = queue_head_node(txq); | 401 | wrb = queue_head_node(txq); |
405 | busaddr = skb_shinfo(skb)->dma_head; | ||
406 | wrb_fill(wrb, busaddr, len); | 402 | wrb_fill(wrb, busaddr, len); |
407 | be_dws_cpu_to_le(wrb, sizeof(*wrb)); | 403 | be_dws_cpu_to_le(wrb, sizeof(*wrb)); |
408 | queue_head_inc(txq); | 404 | queue_head_inc(txq); |
@@ -412,8 +408,9 @@ static int make_tx_wrbs(struct be_adapter *adapter, | |||
412 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 408 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
413 | struct skb_frag_struct *frag = | 409 | struct skb_frag_struct *frag = |
414 | &skb_shinfo(skb)->frags[i]; | 410 | &skb_shinfo(skb)->frags[i]; |
415 | 411 | busaddr = pci_map_page(pdev, frag->page, | |
416 | busaddr = skb_shinfo(skb)->dma_maps[i]; | 412 | frag->page_offset, |
413 | frag->size, PCI_DMA_TODEVICE); | ||
417 | wrb = queue_head_node(txq); | 414 | wrb = queue_head_node(txq); |
418 | wrb_fill(wrb, busaddr, frag->size); | 415 | wrb_fill(wrb, busaddr, frag->size); |
419 | be_dws_cpu_to_le(wrb, sizeof(*wrb)); | 416 | be_dws_cpu_to_le(wrb, sizeof(*wrb)); |
@@ -986,23 +983,41 @@ static struct be_eth_tx_compl *be_tx_compl_get(struct be_queue_info *tx_cq) | |||
986 | static void be_tx_compl_process(struct be_adapter *adapter, u16 last_index) | 983 | static void be_tx_compl_process(struct be_adapter *adapter, u16 last_index) |
987 | { | 984 | { |
988 | struct be_queue_info *txq = &adapter->tx_obj.q; | 985 | struct be_queue_info *txq = &adapter->tx_obj.q; |
986 | struct be_eth_wrb *wrb; | ||
989 | struct sk_buff **sent_skbs = adapter->tx_obj.sent_skb_list; | 987 | struct sk_buff **sent_skbs = adapter->tx_obj.sent_skb_list; |
990 | struct sk_buff *sent_skb; | 988 | struct sk_buff *sent_skb; |
989 | u64 busaddr; | ||
991 | u16 cur_index, num_wrbs = 0; | 990 | u16 cur_index, num_wrbs = 0; |
992 | 991 | ||
993 | cur_index = txq->tail; | 992 | cur_index = txq->tail; |
994 | sent_skb = sent_skbs[cur_index]; | 993 | sent_skb = sent_skbs[cur_index]; |
995 | BUG_ON(!sent_skb); | 994 | BUG_ON(!sent_skb); |
996 | sent_skbs[cur_index] = NULL; | 995 | sent_skbs[cur_index] = NULL; |
996 | wrb = queue_tail_node(txq); | ||
997 | be_dws_le_to_cpu(wrb, sizeof(*wrb)); | ||
998 | busaddr = ((u64)wrb->frag_pa_hi << 32) | (u64)wrb->frag_pa_lo; | ||
999 | if (busaddr != 0) { | ||
1000 | pci_unmap_single(adapter->pdev, busaddr, | ||
1001 | wrb->frag_len, PCI_DMA_TODEVICE); | ||
1002 | } | ||
1003 | num_wrbs++; | ||
1004 | queue_tail_inc(txq); | ||
997 | 1005 | ||
998 | do { | 1006 | while (cur_index != last_index) { |
999 | cur_index = txq->tail; | 1007 | cur_index = txq->tail; |
1008 | wrb = queue_tail_node(txq); | ||
1009 | be_dws_le_to_cpu(wrb, sizeof(*wrb)); | ||
1010 | busaddr = ((u64)wrb->frag_pa_hi << 32) | (u64)wrb->frag_pa_lo; | ||
1011 | if (busaddr != 0) { | ||
1012 | pci_unmap_page(adapter->pdev, busaddr, | ||
1013 | wrb->frag_len, PCI_DMA_TODEVICE); | ||
1014 | } | ||
1000 | num_wrbs++; | 1015 | num_wrbs++; |
1001 | queue_tail_inc(txq); | 1016 | queue_tail_inc(txq); |
1002 | } while (cur_index != last_index); | 1017 | } |
1003 | 1018 | ||
1004 | atomic_sub(num_wrbs, &txq->used); | 1019 | atomic_sub(num_wrbs, &txq->used); |
1005 | skb_dma_unmap(&adapter->pdev->dev, sent_skb, DMA_TO_DEVICE); | 1020 | |
1006 | kfree_skb(sent_skb); | 1021 | kfree_skb(sent_skb); |
1007 | } | 1022 | } |
1008 | 1023 | ||