diff options
author | Paolo Galtieri <pgaltieri@mvista.com> | 2006-01-16 18:48:02 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-01-17 07:23:36 -0500 |
commit | cb415d30048f0c1f80fd2f5340a982e8c9617d0d (patch) | |
tree | 652413a7b26def01c70e1c5296822b0258c54475 /drivers/net/mv643xx_eth.c | |
parent | 78a5e534758349fd3effc90ce1152b55368f52ee (diff) |
[PATCH] mv643xx_eth: Fix dma_map/dma_unmap relations
If you do a dma_map_single you must do dma_unmap_single and if you do
a dma_map_page you must do a dma_unmap_page.
Signed-off-by: Paolo Galtieri <pgaltieri@mvista.com>
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
mv643xx_eth.c | 51 +++++++++++++++++++++------------------------------
1 file changed, 21 insertions(+), 30 deletions(-)
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/mv643xx_eth.c')
-rw-r--r-- | drivers/net/mv643xx_eth.c | 49 |
1 files changed, 19 insertions, 30 deletions
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index a6152db82e9c..fe53fa0e3aed 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -353,27 +353,19 @@ static int mv643xx_eth_free_tx_queue(struct net_device *dev, | |||
353 | stats->tx_errors++; | 353 | stats->tx_errors++; |
354 | } | 354 | } |
355 | 355 | ||
356 | /* | 356 | if (pkt_info.cmd_sts & ETH_TX_FIRST_DESC) |
357 | * If return_info is different than 0, release the skb. | 357 | dma_unmap_single(NULL, pkt_info.buf_ptr, |
358 | * The case where return_info is not 0 is only in case | 358 | pkt_info.byte_cnt, |
359 | * when transmitted a scatter/gather packet, where only | 359 | DMA_TO_DEVICE); |
360 | * last skb releases the whole chain. | 360 | else |
361 | */ | 361 | dma_unmap_page(NULL, pkt_info.buf_ptr, |
362 | if (pkt_info.return_info) { | 362 | pkt_info.byte_cnt, |
363 | if (skb_shinfo(pkt_info.return_info)->nr_frags) | 363 | DMA_TO_DEVICE); |
364 | dma_unmap_page(NULL, pkt_info.buf_ptr, | ||
365 | pkt_info.byte_cnt, | ||
366 | DMA_TO_DEVICE); | ||
367 | else | ||
368 | dma_unmap_single(NULL, pkt_info.buf_ptr, | ||
369 | pkt_info.byte_cnt, | ||
370 | DMA_TO_DEVICE); | ||
371 | 364 | ||
365 | if (pkt_info.return_info) { | ||
372 | dev_kfree_skb_irq(pkt_info.return_info); | 366 | dev_kfree_skb_irq(pkt_info.return_info); |
373 | released = 0; | 367 | released = 0; |
374 | } else | 368 | } |
375 | dma_unmap_page(NULL, pkt_info.buf_ptr, | ||
376 | pkt_info.byte_cnt, DMA_TO_DEVICE); | ||
377 | } | 369 | } |
378 | 370 | ||
379 | spin_unlock(&mp->lock); | 371 | spin_unlock(&mp->lock); |
@@ -1024,20 +1016,17 @@ static void mv643xx_tx(struct net_device *dev) | |||
1024 | struct pkt_info pkt_info; | 1016 | struct pkt_info pkt_info; |
1025 | 1017 | ||
1026 | while (eth_tx_return_desc(mp, &pkt_info) == ETH_OK) { | 1018 | while (eth_tx_return_desc(mp, &pkt_info) == ETH_OK) { |
1027 | if (pkt_info.return_info) { | 1019 | if (pkt_info.cmd_sts & ETH_TX_FIRST_DESC) |
1028 | if (skb_shinfo(pkt_info.return_info)->nr_frags) | 1020 | dma_unmap_single(NULL, pkt_info.buf_ptr, |
1029 | dma_unmap_page(NULL, pkt_info.buf_ptr, | 1021 | pkt_info.byte_cnt, |
1030 | pkt_info.byte_cnt, | 1022 | DMA_TO_DEVICE); |
1031 | DMA_TO_DEVICE); | 1023 | else |
1032 | else | 1024 | dma_unmap_page(NULL, pkt_info.buf_ptr, |
1033 | dma_unmap_single(NULL, pkt_info.buf_ptr, | 1025 | pkt_info.byte_cnt, |
1034 | pkt_info.byte_cnt, | 1026 | DMA_TO_DEVICE); |
1035 | DMA_TO_DEVICE); | ||
1036 | 1027 | ||
1028 | if (pkt_info.return_info) | ||
1037 | dev_kfree_skb_irq(pkt_info.return_info); | 1029 | dev_kfree_skb_irq(pkt_info.return_info); |
1038 | } else | ||
1039 | dma_unmap_page(NULL, pkt_info.buf_ptr, | ||
1040 | pkt_info.byte_cnt, DMA_TO_DEVICE); | ||
1041 | } | 1030 | } |
1042 | 1031 | ||
1043 | if (netif_queue_stopped(dev) && | 1032 | if (netif_queue_stopped(dev) && |