Patchwork [1/1] ibmveth: Fix DMA unmap error

login
register
mail settings
Submitter Brian King
Date Sept. 7, 2011, 9:37 p.m.
Message ID <201109072137.p87LbV51024857@d01av04.pok.ibm.com>
Download mbox | patch
Permalink /patch/113840/
State Superseded
Delegated to: David Miller
Headers show

Comments

Brian King - Sept. 7, 2011, 9:37 p.m.
Commit 6e8ab30ec677925e8999a9f5bdb028736d22d48c introduced a DMA mapping
API inconsistency resulting in dma_unmap_page getting called on memory
mapped via dma_map_single. This was seen when CONFIG_DMA_API_DEBUG was
enabled. Fix up this API usage inconsistency.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
---

 drivers/net/ibmveth.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Patch

diff -puN drivers/net/ibmveth.c~ibmveth_fix_mapping_issue drivers/net/ibmveth.c
--- linux-2.6/drivers/net/ibmveth.c~ibmveth_fix_mapping_issue	2011-09-07 16:28:19.000000000 -0500
+++ linux-2.6-bjking1/drivers/net/ibmveth.c	2011-09-07 16:28:19.000000000 -0500
@@ -1026,7 +1026,12 @@  retry_bounce:
 		netdev->stats.tx_bytes += skb->len;
 	}
 
-	for (i = 0; i < skb_shinfo(skb)->nr_frags + 1; i++)
+	dma_unmap_single(&adapter->vdev->dev,
+			 descs[0].fields.address,
+			 descs[0].fields.flags_len & IBMVETH_BUF_LEN_MASK,
+			 DMA_TO_DEVICE);
+
+	for (i = 1; i < skb_shinfo(skb)->nr_frags + 1; i++)
 		dma_unmap_page(&adapter->vdev->dev, descs[i].fields.address,
 			       descs[i].fields.flags_len & IBMVETH_BUF_LEN_MASK,
 			       DMA_TO_DEVICE);