diff mbox

[net-next,6/7] r8169: missing barriers.

Message ID 20120127205843.GF24507@electric-eye.fr.zoreil.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Francois Romieu Jan. 27, 2012, 8:58 p.m. UTC
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Hayes Wang <hayeswang@realtek.com>
---
 drivers/net/ethernet/realtek/r8169.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

Comments

Eric Dumazet Jan. 28, 2012, 9:06 a.m. UTC | #1
Le vendredi 27 janvier 2012 à 21:58 +0100, Francois Romieu a écrit :
> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
> Cc: Hayes Wang <hayeswang@realtek.com>
> ---
>  drivers/net/ethernet/realtek/r8169.c |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
> index 610f4b3..8dd13f5 100644
> --- a/drivers/net/ethernet/realtek/r8169.c
> +++ b/drivers/net/ethernet/realtek/r8169.c
> @@ -5552,7 +5552,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
>  
>  	if (TX_BUFFS_AVAIL(tp) < MAX_SKB_FRAGS) {
>  		netif_stop_queue(dev);
> -		smp_rmb();
> +		smp_mb();
>  		if (TX_BUFFS_AVAIL(tp) >= MAX_SKB_FRAGS)
>  			netif_wake_queue(dev);
>  	}
> @@ -5653,7 +5653,7 @@ static void rtl8169_tx_interrupt(struct net_device *dev,
>  
>  	if (tp->dirty_tx != dirty_tx) {
>  		tp->dirty_tx = dirty_tx;
> -		smp_wmb();
> +		smp_mb();
>  		if (netif_queue_stopped(dev) &&
>  		    (TX_BUFFS_AVAIL(tp) >= MAX_SKB_FRAGS)) {
>  			netif_wake_queue(dev);
> @@ -5664,7 +5664,6 @@ static void rtl8169_tx_interrupt(struct net_device *dev,
>  		 * of start_xmit activity is detected (if it is not detected,
>  		 * it is slow enough). -- FR
>  		 */
> -		smp_rmb();
>  		if (tp->cur_tx != dirty_tx)
>  			RTL_W8(TxPoll, NPQ);
>  	}

It would be good changelog explains the rationale, or you add comments
in the code.



--
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
Francois Romieu Jan. 28, 2012, 12:07 p.m. UTC | #2
Eric Dumazet <eric.dumazet@gmail.com> :
[...]
> It would be good changelog explains the rationale, or you add comments
> in the code.

Something like :
----------------8<----------------------------------------------------------
rtl8169_tx_interrupt must see the updated queue status from
rtl8169_start_xmit while rtl8169_start_xmit still has to see the
updated dirty index from rtl8169_tx_interrupt.

The window for the TxPoll hack is widened: it should not make much
difference when the last TxPoll request in a close serie of xmit fails as
long as the Tx napi method runs late enough after the last successful xmit.
------------------------------------------>8--------------------------------

Your comments are welcome.
diff mbox

Patch

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 610f4b3..8dd13f5 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -5552,7 +5552,7 @@  static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
 
 	if (TX_BUFFS_AVAIL(tp) < MAX_SKB_FRAGS) {
 		netif_stop_queue(dev);
-		smp_rmb();
+		smp_mb();
 		if (TX_BUFFS_AVAIL(tp) >= MAX_SKB_FRAGS)
 			netif_wake_queue(dev);
 	}
@@ -5653,7 +5653,7 @@  static void rtl8169_tx_interrupt(struct net_device *dev,
 
 	if (tp->dirty_tx != dirty_tx) {
 		tp->dirty_tx = dirty_tx;
-		smp_wmb();
+		smp_mb();
 		if (netif_queue_stopped(dev) &&
 		    (TX_BUFFS_AVAIL(tp) >= MAX_SKB_FRAGS)) {
 			netif_wake_queue(dev);
@@ -5664,7 +5664,6 @@  static void rtl8169_tx_interrupt(struct net_device *dev,
 		 * of start_xmit activity is detected (if it is not detected,
 		 * it is slow enough). -- FR
 		 */
-		smp_rmb();
 		if (tp->cur_tx != dirty_tx)
 			RTL_W8(TxPoll, NPQ);
 	}