public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Anton Blanchard <anton@samba•org>
To: Santiago Leon <santil@linux•vnet.ibm.com>,
	brking@linux•vnet.ibm.com, rcj@linux•vnet.ibm.com
Cc: netdev@vger•kernel.org
Subject: [PATCH 2/4] ibmveth: Fix issue with DMA mapping failure
Date: Thu, 08 Sep 2011 10:41:04 +1000	[thread overview]
Message-ID: <20110908004121.669225190@samba.org> (raw)
In-Reply-To: 20110908004102.355674129@samba.org

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

descs[].fields.address is 32bit which truncates any dma mapping
errors so dma_mapping_error() fails to catch it.

Use a dma_addr_t to do the comparison. With this patch I was able
to transfer many gigabytes of data with IOMMU fault injection set
at 10% probability.

Signed-off-by: Anton Blanchard <anton@samba•org>
Cc: <stable@kernel•org> # v2.6.37+
---

Index: linux-build/drivers/net/ibmveth.c
===================================================================
--- linux-build.orig/drivers/net/ibmveth.c	2011-09-01 15:01:18.066844039 +1000
+++ linux-build/drivers/net/ibmveth.c	2011-09-01 15:03:34.299079796 +1000
@@ -930,6 +930,7 @@ static netdev_tx_t ibmveth_start_xmit(st
 	union ibmveth_buf_desc descs[6];
 	int last, i;
 	int force_bounce = 0;
+	dma_addr_t dma_addr;
 
 	/*
 	 * veth handles a maximum of 6 segments including the header, so
@@ -994,17 +995,16 @@ retry_bounce:
 	}
 
 	/* Map the header */
-	descs[0].fields.address = dma_map_single(&adapter->vdev->dev, skb->data,
-						 skb_headlen(skb),
-						 DMA_TO_DEVICE);
-	if (dma_mapping_error(&adapter->vdev->dev, descs[0].fields.address))
+	dma_addr = dma_map_single(&adapter->vdev->dev, skb->data,
+				  skb_headlen(skb), DMA_TO_DEVICE);
+	if (dma_mapping_error(&adapter->vdev->dev, dma_addr))
 		goto map_failed;
 
 	descs[0].fields.flags_len = desc_flags | skb_headlen(skb);
+	descs[0].fields.address = dma_addr;
 
 	/* Map the frags */
 	for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
-		unsigned long dma_addr;
 		skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
 
 		dma_addr = dma_map_page(&adapter->vdev->dev, frag->page,

  parent reply	other threads:[~2011-09-08  0:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-08  0:41 [PATCH 0/4] ibmveth fixes Anton Blanchard
2011-09-08  0:41 ` [PATCH 1/4] ibmveth: Fix DMA unmap error Anton Blanchard
2011-09-08  0:41 ` Anton Blanchard [this message]
2011-09-08  0:41 ` [PATCH 3/4] ibmveth: Checksum offload is always disabled Anton Blanchard
2011-09-08  0:41 ` [PATCH 4/4] ibmveth: Fix checksum offload failure handling Anton Blanchard
2011-09-16 19:28 ` [PATCH 0/4] ibmveth fixes David Miller
2011-09-16 20:51   ` Anton Blanchard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110908004121.669225190@samba.org \
    --to=anton@samba$(echo .)org \
    --cc=brking@linux$(echo .)vnet.ibm.com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=rcj@linux$(echo .)vnet.ibm.com \
    --cc=santil@linux$(echo .)vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox