* [PATCH] fec: fix FEC driver packet transmission breakage
@ 2009-08-07 3:58 Greg Ungerer
2009-08-10 4:51 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Greg Ungerer @ 2009-08-07 3:58 UTC (permalink / raw)
To: netdev; +Cc: gerg, s.hauer
fec: fix FEC driver packet transmission breakage
Commit f0b3fbeae11a526c3d308b691684589ee37c359b breaks transmission of
packets where the skb data buffer is not memory aligned according to
FEC_ALIGNMENT. It incorrectly passes to dma_sync_single() the buffer
address directly from the skb, instead of the address calculated for
use (which may be the skb address or one of the bounce buffers).
It seems there is no use converting the cpu address of the buffer to
a physical either, since dma_map_single() expects the cpu address and
will return the dma address to use in the descriptor. So remove the use
of __pa() on the buffer address as well.
This patch is against 2.6.30-rc5. This breakage is a regression over
2.6.30, which does not have this problem.
Signed-off-by: Greg Ungerer <gerg@uclinux.org>
---
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 0d2ab43..a32230b 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -285,6 +285,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct fec_enet_private *fep = netdev_priv(dev);
struct bufdesc *bdp;
+ void *bufaddr;
unsigned short status;
unsigned long flags;
@@ -312,7 +313,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
status &= ~BD_ENET_TX_STATS;
/* Set buffer length and buffer pointer */
- bdp->cbd_bufaddr = __pa(skb->data);
+ bufaddr = skb->data;
bdp->cbd_datlen = skb->len;
/*
@@ -320,11 +321,11 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
* 4-byte boundaries. Use bounce buffers to copy data
* and get it aligned. Ugh.
*/
- if (bdp->cbd_bufaddr & FEC_ALIGNMENT) {
+ if (((unsigned long) bufaddr) & FEC_ALIGNMENT) {
unsigned int index;
index = bdp - fep->tx_bd_base;
memcpy(fep->tx_bounce[index], (void *)skb->data, skb->len);
- bdp->cbd_bufaddr = __pa(fep->tx_bounce[index]);
+ bufaddr = fep->tx_bounce[index];
}
/* Save skb pointer */
@@ -336,7 +337,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* Push the data cache so the CPM does not get stale memory
* data.
*/
- bdp->cbd_bufaddr = dma_map_single(&dev->dev, skb->data,
+ bdp->cbd_bufaddr = dma_map_single(&dev->dev, bufaddr,
FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE);
/* Send it on its way. Tell FEC it's ready, interrupt when done,
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] fec: fix FEC driver packet transmission breakage
2009-08-07 3:58 [PATCH] fec: fix FEC driver packet transmission breakage Greg Ungerer
@ 2009-08-10 4:51 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-08-10 4:51 UTC (permalink / raw)
To: gerg; +Cc: netdev, gerg, s.hauer
From: Greg Ungerer <gerg@snapgear.com>
Date: Fri, 7 Aug 2009 13:58:18 +1000
> fec: fix FEC driver packet transmission breakage
>
> Commit f0b3fbeae11a526c3d308b691684589ee37c359b
In the future, when referencing commits, please also provide the
commit message header line text, in parenthesis, and in quotes, like
this ("the commit message header line"), right after the SHA1 ID.
I've fixed up your commit message, in that way, this time. But
next time I'm going to simply shoot this back to you.
> breaks transmission of
> packets where the skb data buffer is not memory aligned according to
> FEC_ALIGNMENT. It incorrectly passes to dma_sync_single() the buffer
> address directly from the skb, instead of the address calculated for
> use (which may be the skb address or one of the bounce buffers).
>
> It seems there is no use converting the cpu address of the buffer to
> a physical either, since dma_map_single() expects the cpu address and
> will return the dma address to use in the descriptor. So remove the use
> of __pa() on the buffer address as well.
>
> This patch is against 2.6.30-rc5. This breakage is a regression over
> 2.6.30, which does not have this problem.
>
> Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-08-10 4:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-07 3:58 [PATCH] fec: fix FEC driver packet transmission breakage Greg Ungerer
2009-08-10 4:51 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox