[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <48ECDC58.1020603@linuxtv.org>
Date: Wed, 08 Oct 2008 18:14:16 +0200
From: Andreas Oberritter <obi@...uxtv.org>
To: Ben Hutchings <bhutchings@...arflare.com>
CC: Jeff Garzik <jgarzik@...ox.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v2] 8139too: move wmb before TX DMA start
From: Andreas Oberritter <obi@...uxtv.org>
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@...uxtv.org>
---
Added a comment on Ben's request explaining the reason for the barrier.
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index 53bd903..3c5fac6 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -1716,13 +1716,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);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists