netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hayes Wang <hayeswang@realtek.com>
To: <netdev@vger.kernel.org>
Cc: <nic_swsd@realtek.com>, <linux-kernel@vger.kernel.org>,
	<linux-usb@vger.kernel.org>, Hayes Wang <hayeswang@realtek.com>
Subject: [PATCH net 3/3] r8152: don't enable napi before rx ready
Date: Thu, 23 Jul 2015 15:09:07 +0800	[thread overview]
Message-ID: <1394712342-15778-151-Taiwan-albertk@realtek.com> (raw)
In-Reply-To: <1394712342-15778-148-Taiwan-albertk@realtek.com>

Adjust napi_disable() and napi_enable() to avoid r8152_poll() start
working before rx ready. Otherwise, it may have race condition for
rx_agg.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
 drivers/net/usb/r8152.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index eff1f25..fe2cd8a 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -2075,7 +2075,6 @@ static int rtl_start_rx(struct r8152 *tp)
 {
 	int i, ret = 0;
 
-	napi_disable(&tp->napi);
 	INIT_LIST_HEAD(&tp->rx_done);
 	for (i = 0; i < RTL8152_MAX_RX; i++) {
 		INIT_LIST_HEAD(&tp->rx_info[i].list);
@@ -2083,7 +2082,6 @@ static int rtl_start_rx(struct r8152 *tp)
 		if (ret)
 			break;
 	}
-	napi_enable(&tp->napi);
 
 	if (ret && ++i < RTL8152_MAX_RX) {
 		struct list_head rx_queue;
@@ -2944,8 +2942,10 @@ static void set_carrier(struct r8152 *tp)
 		if (!netif_carrier_ok(netdev)) {
 			tp->rtl_ops.enable(tp);
 			set_bit(RTL8152_SET_RX_MODE, &tp->flags);
+			napi_disable(&tp->napi);
 			netif_carrier_on(netdev);
 			rtl_start_rx(tp);
+			napi_enable(&tp->napi);
 		}
 	} else {
 		if (netif_carrier_ok(netdev)) {
@@ -3388,9 +3388,11 @@ static int rtl8152_resume(struct usb_interface *intf)
 		if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) {
 			rtl_runtime_suspend_enable(tp, false);
 			clear_bit(SELECTIVE_SUSPEND, &tp->flags);
+			napi_disable(&tp->napi);
 			set_bit(WORK_ENABLE, &tp->flags);
 			if (netif_carrier_ok(tp->netdev))
 				rtl_start_rx(tp);
+			napi_enable(&tp->napi);
 		} else {
 			tp->rtl_ops.up(tp);
 			rtl8152_set_speed(tp, AUTONEG_ENABLE,
-- 
2.4.2

  parent reply	other threads:[~2015-07-23  7:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-23  7:09 [PATCH net 0/3] r8152: issues fix Hayes Wang
2015-07-23  7:09 ` [PATCH net 1/3] r8152: fix the issue about U1/U2 Hayes Wang
2015-07-23  7:09 ` [PATCH net 2/3] r8152: fix remote wakeup Hayes Wang
     [not found]   ` <1394712342-15778-150-Taiwan-albertk-Rasf1IRRPZFBDgjK7y7TUQ@public.gmane.org>
2015-07-23  8:30     ` Oliver Neukum
     [not found]       ` <1437640258.4377.6.camel-IBi9RG/b67k@public.gmane.org>
2015-07-23  9:55         ` Hayes Wang
2015-07-23 10:27           ` Oliver Neukum
     [not found]             ` <1437647246.4377.33.camel-IBi9RG/b67k@public.gmane.org>
2015-07-23 11:30               ` Hayes Wang
2015-07-23  7:09 ` Hayes Wang [this message]
2015-07-24  5:54 ` [PATCH net v2 0/3] r8152: issues fix Hayes Wang
2015-07-24  5:54   ` [PATCH net v2 1/3] r8152: fix the issue about U1/U2 Hayes Wang
2015-07-24  5:54   ` [PATCH net v2 2/3] r8152: fix wakeup settings Hayes Wang
2015-07-24  5:54   ` [PATCH net v2 3/3] r8152: don't enable napi before rx ready Hayes Wang
2015-07-27  7:56   ` [PATCH net v2 0/3] r8152: issues fix 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=1394712342-15778-151-Taiwan-albertk@realtek.com \
    --to=hayeswang@realtek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    /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).