[v3,05/11] net: calxedaxgmac: update ring buffer tx_head after barriers

Submitted by Rob Herring on Aug. 30, 2013, 9:49 p.m.


Message ID 1377899369-23252-5-git-send-email-robherring2@gmail.com
State Accepted
Delegated to: David Miller
Headers show

Commit Message

Rob Herring Aug. 30, 2013, 9:49 p.m.
From: Rob Herring <rob.herring@calxeda.com>

Ensure that the descriptor writes are visible before the ring buffer head
is updated. Since writel is a barrier, we can simply update the head after
the writel.

Reported-by: Lennert Buytenhek <buytenh@wantstofly.org>
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
 drivers/net/ethernet/calxeda/xgmac.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
index 64854ad..f630855 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -1121,9 +1121,10 @@  static netdev_tx_t xgmac_xmit(struct sk_buff *skb, struct net_device *dev)
 	desc_set_tx_owner(first, desc_flags | TXDESC_FIRST_SEG);
+	writel(1, priv->base + XGMAC_DMA_TX_POLL);
 	priv->tx_head = dma_ring_incr(entry, DMA_TX_RING_SZ);
-	writel(1, priv->base + XGMAC_DMA_TX_POLL);
 	if (dma_ring_space(priv->tx_head, priv->tx_tail, DMA_TX_RING_SZ) <