[PATCH 10/11] cxgb3: fix DMA sync_single length error

Stephen Hemminger
2010-01-20T21:23:00Z

[-- Attachment #1: sge.patch --]
[-- Type: text/plain, Size: 975 bytes --]

The DMA api requires that the full mapping be sync'd when
copying frame. First found by Jarek on sky2.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/cxgb3/sge.c 2010-01-20 11:57:01.479387584 -0800
+++ b/drivers/net/cxgb3/sge.c 2010-01-20 11:59:02.740012122 -0800
@@ -788,12 +788,15 @@ static struct sk_buff *get_packet(struct
if (likely(skb != NULL)) {
__skb_put(skb, len);
pci_dma_sync_single_for_cpu(adap->pdev,
- pci_unmap_addr(sd, dma_addr), len,
- PCI_DMA_FROMDEVICE);
+ pci_unmap_addr(sd, dma_addr),
+ fl->alloc_size,
+
+ PCI_DMA_FROMDEVICE);
memcpy(skb->data, sd->skb->data, len);
pci_dma_sync_single_for_device(adap->pdev,
- pci_unmap_addr(sd, dma_addr), len,
- PCI_DMA_FROMDEVICE);
+ pci_unmap_addr(sd, dma_addr),
+ fl->alloc_size,
+ PCI_DMA_FROMDEVICE);
} else if (!drop_thres)
goto use_orig_buf;
recycle:

--