summaryrefslogtreecommitdiff
path: root/drivers/net/8139too.c
diff options
context:
space:
mode:
authorAndreas Oberritter <obi@linuxtv.org>2008-10-08 10:14:16 +0400
committerDavid S. Miller <davem@davemloft.net>2008-10-09 04:12:57 +0400
commit176eaa589b3d242f25f24e472883fcce5f196777 (patch)
tree5b6f51c49accccc5690aaeba7754cf150dd25c43 /drivers/net/8139too.c
parented4cb1337b7c23b91a0f01f661c3f004fc3d3c1a (diff)
downloadlinux-176eaa589b3d242f25f24e472883fcce5f196777.tar.xz
8139too: move wmb before TX DMA start
The write barrier should be used before starting a DMA transfer. This fixes a problem, where almost all packets received on another machine had garbled content. Tested with an RTL8100C on a MIPS machine. Signed-off-by: Andreas Oberritter <obi@linuxtv.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/8139too.c')
-rw-r--r--drivers/net/8139too.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index 32e66f0d4344..0daf8c15e381 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -1723,13 +1723,18 @@ static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev)
}
spin_lock_irqsave(&tp->lock, flags);
+ /*
+ * Writing to TxStatus triggers a DMA transfer of the data
+ * copied to tp->tx_buf[entry] above. Use a memory barrier
+ * to make sure that the device sees the updated data.
+ */
+ wmb();
RTL_W32_F (TxStatus0 + (entry * sizeof (u32)),
tp->tx_flag | max(len, (unsigned int)ETH_ZLEN));
dev->trans_start = jiffies;
tp->cur_tx++;
- wmb();
if ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx)
netif_stop_queue (dev);