diff mbox

[2/3,net-next] bnx2: Add missing memory barrier in bnx2_start_xmit()

Message ID 1328491480-13030-2-git-send-email-mchan@broadcom.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Michael Chan Feb. 6, 2012, 1:24 a.m. UTC
From: Vlad Zolotarov <vlad@scalemp.com>

Sync DMA descriptor before hitting the TX mailbox for weak memory model
CPUs.

There has been discussions several years ago about this.  Some believe
that writel() should guarantee ordering.  Others want explicit barriers
if necessary.  Today writel() does not have the ordering guarantee and
many other drivers use explicit barriers.

Signed-off-by: Vlad Zolotarov <vlad@scalemp.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Comments

David Miller Feb. 6, 2012, 3:46 a.m. UTC | #1
From: "Michael Chan" <mchan@broadcom.com>
Date: Sun, 5 Feb 2012 17:24:39 -0800

> From: Vlad Zolotarov <vlad@scalemp.com>
> 
> Sync DMA descriptor before hitting the TX mailbox for weak memory model
> CPUs.
> 
> There has been discussions several years ago about this.  Some believe
> that writel() should guarantee ordering.  Others want explicit barriers
> if necessary.  Today writel() does not have the ordering guarantee and
> many other drivers use explicit barriers.
> 
> Signed-off-by: Vlad Zolotarov <vlad@scalemp.com>
> Signed-off-by: Michael Chan <mchan@broadcom.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index 2ab31da..7105989 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -6565,6 +6565,9 @@  bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	}
 	txbd->tx_bd_vlan_tag_flags |= TX_BD_FLAGS_END;
 
+	/* Sync BD data before updating TX mailbox */
+	wmb();
+
 	netdev_tx_sent_queue(txq, skb->len);
 
 	prod = NEXT_TX_BD(prod);