diff mbox

[2/4] bnx2x: remove not necessary compiler barrier

Message ID 1268153703-4186-2-git-send-email-sgruszka@redhat.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Stanislaw Gruszka March 9, 2010, 4:55 p.m. UTC
Access to fp->tx_bd_prod is protected by __netif_tx_lock, so we do not
need any barrier for that.

Update of fp->tx_bd_cons in bnx2x_tx_int() is not protected by lock, but
barrier() nor smb_mb() in bnx2x_tx_avail() not guarantee we will see
values that is written on other cpu. Ordering issues between
netif_tx_stop_queue(), netif_tx_queue_stopped(), fp->tx_bd_cons = bd_cons
and bnx2x_tx_avail() are already handled by smp_mb() in bnx2x_tx_int()
and bnx2x_start_xmit().

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/bnx2x_main.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

Comments

Eilon Greenstein March 10, 2010, 4 p.m. UTC | #1
On Tue, 2010-03-09 at 08:55 -0800, Stanislaw Gruszka wrote:
> Access to fp->tx_bd_prod is protected by __netif_tx_lock, so we do not
> need any barrier for that.
> 
> Update of fp->tx_bd_cons in bnx2x_tx_int() is not protected by lock, but
> barrier() nor smb_mb() in bnx2x_tx_avail() not guarantee we will see
> values that is written on other cpu. Ordering issues between
> netif_tx_stop_queue(), netif_tx_queue_stopped(), fp->tx_bd_cons = bd_cons
> and bnx2x_tx_avail() are already handled by smp_mb() in bnx2x_tx_int()
> and bnx2x_start_xmit().
> 
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>


--
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
David Miller March 15, 2010, 10:47 p.m. UTC | #2
From: "Eilon Greenstein" <eilong@broadcom.com>
Date: Wed, 10 Mar 2010 18:00:57 +0200

> On Tue, 2010-03-09 at 08:55 -0800, Stanislaw Gruszka wrote:
>> Access to fp->tx_bd_prod is protected by __netif_tx_lock, so we do not
>> need any barrier for that.
>> 
>> Update of fp->tx_bd_cons in bnx2x_tx_int() is not protected by lock, but
>> barrier() nor smb_mb() in bnx2x_tx_avail() not guarantee we will see
>> values that is written on other cpu. Ordering issues between
>> netif_tx_stop_queue(), netif_tx_queue_stopped(), fp->tx_bd_cons = bd_cons
>> and bnx2x_tx_avail() are already handled by smp_mb() in bnx2x_tx_int()
>> and bnx2x_start_xmit().
>> 
>> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> Signed-off-by: Eilon Greenstein <eilong@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/bnx2x_main.c b/drivers/net/bnx2x_main.c
index 9fc0f6a..ae62b67 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -893,7 +893,6 @@  static inline u16 bnx2x_tx_avail(struct bnx2x_fastpath *fp)
 	u16 prod;
 	u16 cons;
 
-	barrier(); /* Tell compiler that prod and cons can change */
 	prod = fp->tx_bd_prod;
 	cons = fp->tx_bd_cons;