Commit b93da27f authored by Anton Blanchard's avatar Anton Blanchard Committed by David S. Miller

ibmveth: Fix issue with DMA mapping failure

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: default avatarAnton Blanchard <anton@samba.org>
Cc: <stable@kernel.org> # v2.6.37+
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 33a48ab1
...@@ -930,6 +930,7 @@ static netdev_tx_t ibmveth_start_xmit(struct sk_buff *skb, ...@@ -930,6 +930,7 @@ static netdev_tx_t ibmveth_start_xmit(struct sk_buff *skb,
union ibmveth_buf_desc descs[6]; union ibmveth_buf_desc descs[6];
int last, i; int last, i;
int force_bounce = 0; int force_bounce = 0;
dma_addr_t dma_addr;
/* /*
* veth handles a maximum of 6 segments including the header, so * veth handles a maximum of 6 segments including the header, so
...@@ -994,17 +995,16 @@ static netdev_tx_t ibmveth_start_xmit(struct sk_buff *skb, ...@@ -994,17 +995,16 @@ static netdev_tx_t ibmveth_start_xmit(struct sk_buff *skb,
} }
/* Map the header */ /* Map the header */
descs[0].fields.address = dma_map_single(&adapter->vdev->dev, skb->data, dma_addr = dma_map_single(&adapter->vdev->dev, skb->data,
skb_headlen(skb), skb_headlen(skb), DMA_TO_DEVICE);
DMA_TO_DEVICE); if (dma_mapping_error(&adapter->vdev->dev, dma_addr))
if (dma_mapping_error(&adapter->vdev->dev, descs[0].fields.address))
goto map_failed; goto map_failed;
descs[0].fields.flags_len = desc_flags | skb_headlen(skb); descs[0].fields.flags_len = desc_flags | skb_headlen(skb);
descs[0].fields.address = dma_addr;
/* Map the frags */ /* Map the frags */
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
unsigned long dma_addr;
skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
dma_addr = dma_map_page(&adapter->vdev->dev, frag->page, dma_addr = dma_map_page(&adapter->vdev->dev, frag->page,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment