Commit 26afec39 authored by hayeswang's avatar hayeswang Committed by David S. Miller

r8152: avoid start_xmit to call napi_schedule during autosuspend

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: default avatarHayes Wang <hayeswang@realtek.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f154be24
...@@ -3585,10 +3585,15 @@ static int rtl8152_rumtime_suspend(struct r8152 *tp) ...@@ -3585,10 +3585,15 @@ static int rtl8152_rumtime_suspend(struct r8152 *tp)
struct net_device *netdev = tp->netdev; struct net_device *netdev = tp->netdev;
int ret = 0; int ret = 0;
set_bit(SELECTIVE_SUSPEND, &tp->flags);
smp_mb__after_atomic();
if (netif_running(netdev) && test_bit(WORK_ENABLE, &tp->flags)) { if (netif_running(netdev) && test_bit(WORK_ENABLE, &tp->flags)) {
u32 rcr = 0; u32 rcr = 0;
if (delay_autosuspend(tp)) { if (delay_autosuspend(tp)) {
clear_bit(SELECTIVE_SUSPEND, &tp->flags);
smp_mb__after_atomic();
ret = -EBUSY; ret = -EBUSY;
goto out1; goto out1;
} }
...@@ -3605,6 +3610,8 @@ static int rtl8152_rumtime_suspend(struct r8152 *tp) ...@@ -3605,6 +3610,8 @@ static int rtl8152_rumtime_suspend(struct r8152 *tp)
if (!(ocp_data & RXFIFO_EMPTY)) { if (!(ocp_data & RXFIFO_EMPTY)) {
rxdy_gated_en(tp, false); rxdy_gated_en(tp, false);
ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, rcr); ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, rcr);
clear_bit(SELECTIVE_SUSPEND, &tp->flags);
smp_mb__after_atomic();
ret = -EBUSY; ret = -EBUSY;
goto out1; goto out1;
} }
...@@ -3624,8 +3631,6 @@ static int rtl8152_rumtime_suspend(struct r8152 *tp) ...@@ -3624,8 +3631,6 @@ static int rtl8152_rumtime_suspend(struct r8152 *tp)
} }
} }
set_bit(SELECTIVE_SUSPEND, &tp->flags);
out1: out1:
return ret; return ret;
} }
...@@ -3681,12 +3686,13 @@ static int rtl8152_resume(struct usb_interface *intf) ...@@ -3681,12 +3686,13 @@ static int rtl8152_resume(struct usb_interface *intf)
if (netif_running(tp->netdev) && tp->netdev->flags & IFF_UP) { if (netif_running(tp->netdev) && tp->netdev->flags & IFF_UP) {
if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) {
tp->rtl_ops.autosuspend_en(tp, false); tp->rtl_ops.autosuspend_en(tp, false);
clear_bit(SELECTIVE_SUSPEND, &tp->flags);
napi_disable(&tp->napi); napi_disable(&tp->napi);
set_bit(WORK_ENABLE, &tp->flags); set_bit(WORK_ENABLE, &tp->flags);
if (netif_carrier_ok(tp->netdev)) if (netif_carrier_ok(tp->netdev))
rtl_start_rx(tp); rtl_start_rx(tp);
napi_enable(&tp->napi); napi_enable(&tp->napi);
clear_bit(SELECTIVE_SUSPEND, &tp->flags);
smp_mb__after_atomic();
} else { } else {
tp->rtl_ops.up(tp); tp->rtl_ops.up(tp);
netif_carrier_off(tp->netdev); netif_carrier_off(tp->netdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment