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 v2 1/4] r8152: avoid start_xmit to call napi_schedule during autosuspend
Date: Wed, 25 Jan 2017 16:13:18 +0800 [thread overview]
Message-ID: <1394712342-15778-243-Taiwan-albertk@realtek.com> (raw)
In-Reply-To: <1394712342-15778-242-Taiwan-albertk@realtek.com>
Adjust the setting of the flag of SELECTIVE_SUSPEND to prevent start_xmit()
from calling napi_schedule() directly during runtime suspend.
After calling napi_disable() or clearing the flag of WORK_ENABLE,
scheduling the napi is useless.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
drivers/net/usb/r8152.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index e1466b4..23bef8e 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -3585,10 +3585,15 @@ static int rtl8152_rumtime_suspend(struct r8152 *tp)
struct net_device *netdev = tp->netdev;
int ret = 0;
+ set_bit(SELECTIVE_SUSPEND, &tp->flags);
+ smp_mb__after_atomic();
+
if (netif_running(netdev) && test_bit(WORK_ENABLE, &tp->flags)) {
u32 rcr = 0;
if (delay_autosuspend(tp)) {
+ clear_bit(SELECTIVE_SUSPEND, &tp->flags);
+ smp_mb__after_atomic();
ret = -EBUSY;
goto out1;
}
@@ -3605,6 +3610,8 @@ static int rtl8152_rumtime_suspend(struct r8152 *tp)
if (!(ocp_data & RXFIFO_EMPTY)) {
rxdy_gated_en(tp, false);
ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, rcr);
+ clear_bit(SELECTIVE_SUSPEND, &tp->flags);
+ smp_mb__after_atomic();
ret = -EBUSY;
goto out1;
}
@@ -3624,8 +3631,6 @@ static int rtl8152_rumtime_suspend(struct r8152 *tp)
}
}
- set_bit(SELECTIVE_SUSPEND, &tp->flags);
-
out1:
return ret;
}
@@ -3681,12 +3686,13 @@ static int rtl8152_resume(struct usb_interface *intf)
if (netif_running(tp->netdev) && tp->netdev->flags & IFF_UP) {
if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) {
tp->rtl_ops.autosuspend_en(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);
+ clear_bit(SELECTIVE_SUSPEND, &tp->flags);
+ smp_mb__after_atomic();
} else {
tp->rtl_ops.up(tp);
netif_carrier_off(tp->netdev);
--
2.7.4
next prev parent reply other threads:[~2017-01-25 8:13 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 ` Hayes Wang [this message]
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 ` [PATCH net v3 2/4] r8152: avoid start_xmit to schedule napi when napi is disabled Hayes Wang
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-243-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).