diff options
Diffstat (limited to 'drivers/net/fs_enet')
-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 44fac7373289..9342d5bc7bb4 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 | ||