Patchwork [03/11] skge: fix DMA sync_single length error

login
register
mail settings
Submitter stephen hemminger
Date Jan. 20, 2010, 8:45 p.m.
Message ID <20100120204558.969768450@vyatta.com>
Download mbox | patch
Permalink /patch/43370/
State Rejected
Delegated to: David Miller
Headers show

Comments

stephen hemminger - Jan. 20, 2010, 8:45 p.m.
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>

Patch

--- a/drivers/net/skge.c	2010-01-20 10:10:29.538786102 -0800
+++ b/drivers/net/skge.c	2010-01-20 10:11:18.443974883 -0800
@@ -3078,11 +3078,13 @@  static struct sk_buff *skge_rx_get(struc
 
 		pci_dma_sync_single_for_cpu(skge->hw->pdev,
 					    pci_unmap_addr(e, mapaddr),
-					    len, PCI_DMA_FROMDEVICE);
+					    pci_unmap_len(e, maplen),
+					    PCI_DMA_FROMDEVICE);
 		skb_copy_from_linear_data(e->skb, skb->data, len);
 		pci_dma_sync_single_for_device(skge->hw->pdev,
 					       pci_unmap_addr(e, mapaddr),
-					       len, PCI_DMA_FROMDEVICE);
+					       pci_unmap_len(e, maplen),
+					       PCI_DMA_FROMDEVICE);
 		skge_rx_reuse(e, skge->rx_buf_size);
 	} else {
 		struct sk_buff *nskb;