Skip to content

Commit 6ad5690

Browse files
khfengdavem330
authored andcommitted
r8169: Clear RTL_FLAG_TASK_*_PENDING when clearing RTL_FLAG_TASK_ENABLED
After system suspend, sometimes the r8169 doesn't work when ethernet cable gets pluggued. This issue happens because rtl_reset_work() doesn't get called from rtl8169_runtime_resume(), after system suspend. In rtl_task(), RTL_FLAG_TASK_* only gets cleared if this condition is met: if (!netif_running(dev) || !test_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags)) ... If RTL_FLAG_TASK_ENABLED was cleared during system suspend while RTL_FLAG_TASK_RESET_PENDING was set, the next rtl_schedule_task() won't schedule task as the flag is still there. So in addition to clearing RTL_FLAG_TASK_ENABLED, also clears other flags. Cc: Heiner Kallweit <[email protected]> Signed-off-by: Kai-Heng Feng <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 51dc63e commit 6ad5690

File tree

1 file changed

+6
-3
lines changed
  • drivers/net/ethernet/realtek

1 file changed

+6
-3
lines changed

drivers/net/ethernet/realtek/r8169.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ struct rtl8169_tc_offsets {
631631
};
632632

633633
enum rtl_flag {
634-
RTL_FLAG_TASK_ENABLED,
634+
RTL_FLAG_TASK_ENABLED = 0,
635635
RTL_FLAG_TASK_SLOW_PENDING,
636636
RTL_FLAG_TASK_RESET_PENDING,
637637
RTL_FLAG_MAX
@@ -6655,7 +6655,8 @@ static int rtl8169_close(struct net_device *dev)
66556655
rtl8169_update_counters(tp);
66566656

66576657
rtl_lock_work(tp);
6658-
clear_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags);
6658+
/* Clear all task flags */
6659+
bitmap_zero(tp->wk.flags, RTL_FLAG_MAX);
66596660

66606661
rtl8169_down(dev);
66616662
rtl_unlock_work(tp);
@@ -6838,7 +6839,9 @@ static void rtl8169_net_suspend(struct net_device *dev)
68386839

68396840
rtl_lock_work(tp);
68406841
napi_disable(&tp->napi);
6841-
clear_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags);
6842+
/* Clear all task flags */
6843+
bitmap_zero(tp->wk.flags, RTL_FLAG_MAX);
6844+
68426845
rtl_unlock_work(tp);
68436846

68446847
rtl_pll_power_down(tp);

0 commit comments

Comments
 (0)