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 v3 2/4] r8152: avoid start_xmit to schedule napi when napi is disabled
Date: Thu, 26 Jan 2017 09:38:32 +0800 [thread overview]
Message-ID: <1394712342-15778-249-Taiwan-albertk@realtek.com> (raw)
In-Reply-To: <1394712342-15778-247-Taiwan-albertk@realtek.com>
Stop the tx when the napi is disabled to prevent napi_schedule() is
called.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
drivers/net/usb/r8152.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 23bef8e..ec882be 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -3155,10 +3155,13 @@ 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);
+ netif_stop_queue(netdev);
napi_disable(&tp->napi);
netif_carrier_on(netdev);
rtl_start_rx(tp);
napi_enable(&tp->napi);
+ netif_wake_queue(netdev);
+ netif_info(tp, link, netdev, "carrier on\n");
}
} else {
if (netif_carrier_ok(netdev)) {
@@ -3166,6 +3169,7 @@ static void set_carrier(struct r8152 *tp)
napi_disable(&tp->napi);
tp->rtl_ops.disable(tp);
napi_enable(&tp->napi);
+ netif_info(tp, link, netdev, "carrier off\n");
}
}
}
@@ -3515,12 +3519,12 @@ static int rtl8152_pre_reset(struct usb_interface *intf)
if (!netif_running(netdev))
return 0;
+ netif_stop_queue(netdev);
napi_disable(&tp->napi);
clear_bit(WORK_ENABLE, &tp->flags);
usb_kill_urb(tp->intr_urb);
cancel_delayed_work_sync(&tp->schedule);
if (netif_carrier_ok(netdev)) {
- netif_stop_queue(netdev);
mutex_lock(&tp->control);
tp->rtl_ops.disable(tp);
mutex_unlock(&tp->control);
@@ -3548,10 +3552,10 @@ static int rtl8152_post_reset(struct usb_interface *intf)
rtl_start_rx(tp);
rtl8152_set_rx_mode(netdev);
mutex_unlock(&tp->control);
- netif_wake_queue(netdev);
}
napi_enable(&tp->napi);
+ netif_wake_queue(netdev);
usb_submit_urb(tp->intr_urb, GFP_KERNEL);
return 0;
--
2.7.4
next prev parent reply other threads:[~2017-01-26 1:39 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-25 2:50 [PATCH net 0/4] r8152: fix scheduling napi Hayes Wang
2017-01-25 2:50 ` [PATCH net 1/4] r8152: avoid start_xmit to call napi_schedule during autosuspend Hayes Wang
2017-01-25 5:02 ` Stephen Hemminger
2017-01-25 2:50 ` [PATCH net 2/4] r8152: avoid start_xmit to schedule napi when napi is disabled Hayes Wang
2017-01-25 2:50 ` [PATCH net 3/4] r8152: re-schedule napi for tx Hayes Wang
2017-01-25 2:50 ` [PATCH net 4/4] r8152: check rx after napi is enabled Hayes Wang
2017-01-25 8:13 ` [PATCH net v2 0/4] r8152: fix scheduling napi Hayes Wang
2017-01-25 8:13 ` [PATCH net v2 1/4] r8152: avoid start_xmit to call napi_schedule during autosuspend Hayes Wang
2017-01-25 8:13 ` [PATCH net v2 2/4] r8152: avoid start_xmit to schedule napi when napi is disabled Hayes Wang
2017-01-25 8:13 ` [PATCH net v2 3/4] r8152: re-schedule napi for tx Hayes Wang
2017-01-25 13:57 ` Eric Dumazet
2017-01-26 1:22 ` Hayes Wang
2017-01-25 8:13 ` [PATCH net v2 4/4] r8152: check rx after napi is enabled Hayes Wang
2017-01-25 19:31 ` [PATCH net v2 0/4] r8152: fix scheduling napi David Miller
2017-01-26 3:04 ` Hayes Wang
2017-01-26 3:46 ` David Miller
2017-01-26 1:38 ` [PATCH net v3 " Hayes Wang
2017-01-26 1:38 ` [PATCH net v3 1/4] r8152: avoid start_xmit to call napi_schedule during autosuspend Hayes Wang
2017-01-26 1:38 ` Hayes Wang [this message]
2017-01-26 1:38 ` [PATCH net v3 3/4] r8152: re-schedule napi for tx Hayes Wang
2017-01-26 1:38 ` [PATCH net v3 4/4] r8152: check rx after napi is enabled Hayes Wang
2017-01-26 3:47 ` [PATCH net v3 0/4] r8152: fix scheduling napi David Miller
2017-01-26 3:52 ` Hayes Wang
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-249-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).