net8139: fix a race at the end of NAPI
authorFigo.zhang <zhangtianfei@leadcoretech.com>
Mon, 7 Jun 2010 21:13:22 +0000 (21:13 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 11 Jun 2010 06:14:08 +0000 (23:14 -0700)
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>

Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/8139cp.c
drivers/net/8139too.c

index 9c149750e2bf9754518941e9233e94800d45b889..284a5f4a63ac8a48c955125c64e67ae8b89e16f9 100644 (file)
@@ -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);
        }
 
index 80cd074d3817944bf65751482fc9cb0fc331f088..97d8068b372b228d6764055ad1d0529439c940af 100644 (file)
@@ -2089,8 +2089,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);