Skip to content

Commit ad29789

Browse files
Kai-Heng Fenggregkh
authored andcommitted
r8169: Clear RTL_FLAG_TASK_*_PENDING when clearing RTL_FLAG_TASK_ENABLED
[ Upstream commit 6ad5690 ] 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 <hkallweit1@gmail.com> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f7b86fa commit ad29789

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

  • drivers/net/ethernet/realtek

drivers/net/ethernet/realtek/r8169.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ struct rtl8169_tc_offsets {
760760
};
761761

762762
enum rtl_flag {
763-
RTL_FLAG_TASK_ENABLED,
763+
RTL_FLAG_TASK_ENABLED = 0,
764764
RTL_FLAG_TASK_SLOW_PENDING,
765765
RTL_FLAG_TASK_RESET_PENDING,
766766
RTL_FLAG_TASK_PHY_PENDING,
@@ -7657,7 +7657,8 @@ static int rtl8169_close(struct net_device *dev)
76577657
rtl8169_update_counters(dev);
76587658

76597659
rtl_lock_work(tp);
7660-
clear_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags);
7660+
/* Clear all task flags */
7661+
bitmap_zero(tp->wk.flags, RTL_FLAG_MAX);
76617662

76627663
rtl8169_down(dev);
76637664
rtl_unlock_work(tp);
@@ -7838,7 +7839,9 @@ static void rtl8169_net_suspend(struct net_device *dev)
78387839

78397840
rtl_lock_work(tp);
78407841
napi_disable(&tp->napi);
7841-
clear_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags);
7842+
/* Clear all task flags */
7843+
bitmap_zero(tp->wk.flags, RTL_FLAG_MAX);
7844+
78427845
rtl_unlock_work(tp);
78437846

78447847
rtl_pll_power_down(tp);

0 commit comments

Comments
 (0)