Skip to content

Commit 176eaa5

Browse files
mtdcrdavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ed4cb13 commit 176eaa5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/net/8139too.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1723,13 +1723,18 @@ static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev)
17231723
}
17241724

17251725
spin_lock_irqsave(&tp->lock, flags);
1726+
/*
1727+
* Writing to TxStatus triggers a DMA transfer of the data
1728+
* copied to tp->tx_buf[entry] above. Use a memory barrier
1729+
* to make sure that the device sees the updated data.
1730+
*/
1731+
wmb();
17261732
RTL_W32_F (TxStatus0 + (entry * sizeof (u32)),
17271733
tp->tx_flag | max(len, (unsigned int)ETH_ZLEN));
17281734

17291735
dev->trans_start = jiffies;
17301736

17311737
tp->cur_tx++;
1732-
wmb();
17331738

17341739
if ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx)
17351740
netif_stop_queue (dev);

0 commit comments

Comments
 (0)