netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Figo.zhang" <zhangtianfei@leadcoretech.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev <netdev@vger.kernel.org>
Subject: [PATCH v2] net8139: fix a race at the end of NAPI
Date: Tue, 08 Jun 2010 15:13:22 +0800	[thread overview]
Message-ID: <1275981202.1927.6.camel@myhost> (raw)
In-Reply-To: <1275979719.1927.4.camel@myhost>

 
fix a race at the end of NAPI complete processing, it had
better do __napi_complete() first before re-enable interrupt.

in v2, i motify it using vim.

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

diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index 9c14975..284a5f4 100644
--- 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
index 4ba7293..a7bca8c 100644
--- 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);



  parent reply	other threads:[~2010-06-08  7:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-08  6:48 [PATCH] fix a race at the end of NAPI Figo.zhang
2010-06-08  7:07 ` Eric Dumazet
2010-06-08  7:13 ` Figo.zhang [this message]
2010-06-11  6:17   ` [PATCH v2] net8139: " David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1275981202.1927.6.camel@myhost \
    --to=zhangtianfei@leadcoretech.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).