Thread (20 messages) 20 messages, 6 authors, 2009-12-01

Re: [RFC PATCH 07/10] bnx2: remove skb_dma_map/unmap calls from driver

From: "Michael Chan" <mchan@broadcom.com>
Date: 2009-11-30 10:26:52

Alexander Duyck wrote:
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 <redacted>
Thanks Alexander.  Sorry for the late response, I just got back
from vacation.  It looks ok except in bnx2_free_tx_skbs():
quoted hunk ↗ jump to hunk
@@ -5295,18 +5303,30 @@ bnx2_free_tx_skbs(struct bnx2 *bp)
              for (j = 0; j < TX_DESC_CNT; ) {
                      struct sw_tx_bd *tx_buf = &txr->tx_buf_ring[j];
                      struct sk_buff *skb = tx_buf->skb;
+                     int k, last;

                      if (skb == NULL) {
                              j++;
                              continue;
                      }

-                     skb_dma_unmap(&bp->pdev->dev, skb,
DMA_TO_DEVICE);
+                     pci_unmap_single(bp->pdev,
+                                      pci_unmap_addr(tx_buf,
mapping),
+                                      skb_headlen(skb),
+                                      PCI_DMA_TODEVICE);

                      tx_buf->skb = NULL;

-                     j += skb_shinfo(skb)->nr_frags + 1;
+                     last = skb_shinfo(skb)->nr_frags;
+                     for (k = 0; k < last; k++) {
+                             tx_buf = &txr->tx_buf_ring[j + k + 1];
j + k + 1 can go beyond the ring when the ring wraps around.
I'll send an updated patch tomorrow.
+                             pci_unmap_page(bp->pdev,
+                                     pci_unmap_addr(tx_buf, mapping),
+                                     skb_shinfo(skb)->frags[j].size,
+                                     PCI_DMA_TODEVICE);
+                     }
                      dev_kfree_skb(skb);
+                     j += k + 1;
              }
      }
 }
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help