Patchwork fix a race at the end of NAPI

login
register
mail settings
Submitter Figo.zhang
Date June 8, 2010, 6:48 a.m.
Message ID <1275979719.1927.4.camel@myhost>
Download mbox | patch
Permalink /patch/54936/
State Superseded
Delegated to: David Miller
Headers show

Comments

Figo.zhang - June 8, 2010, 6:48 a.m.
fix a race at the end of NAPI complete processing. it had better do __napi_complete() 
first before re-enable interrupt.

Signed-off-by: Figo.zhang <figo1802@gmail.com>
--- 
 drivers/net/8139cp.c  |    2 +-
 drivers/net/8139too.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)



--
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
Eric Dumazet - June 8, 2010, 7:07 a.m.
Le mardi 08 juin 2010 à 14:48 +0800, Figo.zhang a écrit :
> fix a race at the end of NAPI complete processing. it had better do __napi_complete() 
> first before re-enable interrupt.
> 
> Signed-off-by: Figo.zhang <figo1802@gmail.com>

Patch title is misleading

> --- 
>  drivers/net/8139cp.c  |    2 +-
>  drivers/net/8139too.c |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
> old mode 100644
> new mode 100755

Why do you change file modes ?

> index 9c14975..284a5f4
> --- a/drivers/net/8139cp.c
> +++ b/drivers/net/8139cp.c
> @@ -598,8 +598,8 @@ rx_next:
>  			goto rx_status_loop;
>  
>  		spin_lock_irqsave(&cp->lock, flags);
> -		cpw16_f(IntrMask, cp_intr_mask);
>  		__napi_complete(napi);
> +		cpw16_f(IntrMask, cp_intr_mask);
>  		spin_unlock_irqrestore(&cp->lock, flags);
>  	}
>  
> diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
> old mode 100644
> new mode 100755
> index 4ba7293..a7bca8c
> --- a/drivers/net/8139too.c
> +++ b/drivers/net/8139too.c
> @@ -2088,8 +2088,8 @@ static int rtl8139_poll(struct napi_struct *napi, int budget)
>  		 * again when we think we are done.
>  		 */
>  		spin_lock_irqsave(&tp->lock, flags);
> -		RTL_W16_F(IntrMask, rtl8139_intr_mask);
>  		__napi_complete(napi);
> +		RTL_W16_F(IntrMask, rtl8139_intr_mask);
>  		spin_unlock_irqrestore(&tp->lock, flags);
>  	}
>  	spin_unlock(&tp->rx_lock);
> 
> 


--
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

Patch

diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
old mode 100644
new mode 100755
index 9c14975..284a5f4
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -598,8 +598,8 @@  rx_next:
 			goto rx_status_loop;
 
 		spin_lock_irqsave(&cp->lock, flags);
-		cpw16_f(IntrMask, cp_intr_mask);
 		__napi_complete(napi);
+		cpw16_f(IntrMask, cp_intr_mask);
 		spin_unlock_irqrestore(&cp->lock, flags);
 	}
 
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
old mode 100644
new mode 100755
index 4ba7293..a7bca8c
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -2088,8 +2088,8 @@  static int rtl8139_poll(struct napi_struct *napi, int budget)
 		 * again when we think we are done.
 		 */
 		spin_lock_irqsave(&tp->lock, flags);
-		RTL_W16_F(IntrMask, rtl8139_intr_mask);
 		__napi_complete(napi);
+		RTL_W16_F(IntrMask, rtl8139_intr_mask);
 		spin_unlock_irqrestore(&tp->lock, flags);
 	}
 	spin_unlock(&tp->rx_lock);