diff options
author | Pantelis Antoniou <pantelis.antoniou@gmail.com> | 2005-10-29 18:22:40 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-10-29 18:20:30 -0400 |
commit | 34e30d612f54e959a9953a62143f9f8402207b35 (patch) | |
tree | a530f8f311ec36de89d8435cc116011d84f7f1ba /drivers | |
parent | 4689a6b1d4970779bf53bd62917df7ad7ad7c704 (diff) |
[PATCH] fs_enet: Fix dma_unmap_single calls
The following patches fixes a bug with erroneous calling of
dma_unmap_single. It never triggered because on normal ppc32
the calls is a NOP. Out of tree drivers need this fix however.
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/fs_enet/fs_enet-main.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index 44fac737328..9342d5bc7bb 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
@@ -130,7 +130,7 @@ static int fs_enet_rx_napi(struct net_device *dev, int *budget) | |||
130 | 130 | ||
131 | skb = fep->rx_skbuff[curidx]; | 131 | skb = fep->rx_skbuff[curidx]; |
132 | 132 | ||
133 | dma_unmap_single(fep->dev, skb->data, | 133 | dma_unmap_single(fep->dev, CBDR_BUFADDR(bdp), |
134 | L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), | 134 | L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), |
135 | DMA_FROM_DEVICE); | 135 | DMA_FROM_DEVICE); |
136 | 136 | ||
@@ -144,7 +144,7 @@ static int fs_enet_rx_napi(struct net_device *dev, int *budget) | |||
144 | 144 | ||
145 | skb = fep->rx_skbuff[curidx]; | 145 | skb = fep->rx_skbuff[curidx]; |
146 | 146 | ||
147 | dma_unmap_single(fep->dev, skb->data, | 147 | dma_unmap_single(fep->dev, CBDR_BUFADDR(bdp), |
148 | L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), | 148 | L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), |
149 | DMA_FROM_DEVICE); | 149 | DMA_FROM_DEVICE); |
150 | 150 | ||
@@ -268,7 +268,7 @@ static int fs_enet_rx_non_napi(struct net_device *dev) | |||
268 | 268 | ||
269 | skb = fep->rx_skbuff[curidx]; | 269 | skb = fep->rx_skbuff[curidx]; |
270 | 270 | ||
271 | dma_unmap_single(fep->dev, skb->data, | 271 | dma_unmap_single(fep->dev, CBDR_BUFADDR(bdp), |
272 | L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), | 272 | L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), |
273 | DMA_FROM_DEVICE); | 273 | DMA_FROM_DEVICE); |
274 | 274 | ||
@@ -278,7 +278,7 @@ static int fs_enet_rx_non_napi(struct net_device *dev) | |||
278 | 278 | ||
279 | skb = fep->rx_skbuff[curidx]; | 279 | skb = fep->rx_skbuff[curidx]; |
280 | 280 | ||
281 | dma_unmap_single(fep->dev, skb->data, | 281 | dma_unmap_single(fep->dev, CBDR_BUFADDR(bdp), |
282 | L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), | 282 | L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), |
283 | DMA_FROM_DEVICE); | 283 | DMA_FROM_DEVICE); |
284 | 284 | ||
@@ -399,7 +399,8 @@ static void fs_enet_tx(struct net_device *dev) | |||
399 | fep->stats.collisions++; | 399 | fep->stats.collisions++; |
400 | 400 | ||
401 | /* unmap */ | 401 | /* unmap */ |
402 | dma_unmap_single(fep->dev, skb->data, skb->len, DMA_TO_DEVICE); | 402 | dma_unmap_single(fep->dev, CBDR_BUFADDR(bdp), |
403 | skb->len, DMA_TO_DEVICE); | ||
403 | 404 | ||
404 | /* | 405 | /* |
405 | * Free the sk buffer associated with this last transmit. | 406 | * Free the sk buffer associated with this last transmit. |
@@ -547,17 +548,19 @@ void fs_cleanup_bds(struct net_device *dev) | |||
547 | { | 548 | { |
548 | struct fs_enet_private *fep = netdev_priv(dev); | 549 | struct fs_enet_private *fep = netdev_priv(dev); |
549 | struct sk_buff *skb; | 550 | struct sk_buff *skb; |
551 | cbd_t *bdp; | ||
550 | int i; | 552 | int i; |
551 | 553 | ||
552 | /* | 554 | /* |
553 | * Reset SKB transmit buffers. | 555 | * Reset SKB transmit buffers. |
554 | */ | 556 | */ |
555 | for (i = 0; i < fep->tx_ring; i++) { | 557 | for (i = 0, bdp = fep->tx_bd_base; i < fep->tx_ring; i++, bdp++) { |
556 | if ((skb = fep->tx_skbuff[i]) == NULL) | 558 | if ((skb = fep->tx_skbuff[i]) == NULL) |
557 | continue; | 559 | continue; |
558 | 560 | ||
559 | /* unmap */ | 561 | /* unmap */ |
560 | dma_unmap_single(fep->dev, skb->data, skb->len, DMA_TO_DEVICE); | 562 | dma_unmap_single(fep->dev, CBDR_BUFADDR(bdp), |
563 | skb->len, DMA_TO_DEVICE); | ||
561 | 564 | ||
562 | fep->tx_skbuff[i] = NULL; | 565 | fep->tx_skbuff[i] = NULL; |
563 | dev_kfree_skb(skb); | 566 | dev_kfree_skb(skb); |
@@ -566,12 +569,12 @@ void fs_cleanup_bds(struct net_device *dev) | |||
566 | /* | 569 | /* |
567 | * Reset SKB receive buffers | 570 | * Reset SKB receive buffers |
568 | */ | 571 | */ |
569 | for (i = 0; i < fep->rx_ring; i++) { | 572 | for (i = 0, bdp = fep->rx_bd_base; i < fep->rx_ring; i++, bdp++) { |
570 | if ((skb = fep->rx_skbuff[i]) == NULL) | 573 | if ((skb = fep->rx_skbuff[i]) == NULL) |
571 | continue; | 574 | continue; |
572 | 575 | ||
573 | /* unmap */ | 576 | /* unmap */ |
574 | dma_unmap_single(fep->dev, skb->data, | 577 | dma_unmap_single(fep->dev, CBDR_BUFADDR(bdp), |
575 | L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), | 578 | L1_CACHE_ALIGN(PKT_MAXBUF_SIZE), |
576 | DMA_FROM_DEVICE); | 579 | DMA_FROM_DEVICE); |
577 | 580 | ||