From: Sasha Levin <Alexander.Levin@microsoft.com>
To: "stable@vger.kernel.org" <stable@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
"David S . Miller" <davem@davemloft.net>,
Sasha Levin <Alexander.Levin@microsoft.com>
Subject: [PATCH AUTOSEL 4.4 12/17] r8169: Clear RTL_FLAG_TASK_*_PENDING when clearing RTL_FLAG_TASK_ENABLED
Date: Mon, 1 Oct 2018 00:41:32 +0000 [thread overview]
Message-ID: <20181001004122.147276-12-alexander.levin@microsoft.com> (raw)
In-Reply-To: <20181001004122.147276-1-alexander.levin@microsoft.com>
From: Kai-Heng Feng <kai.heng.feng@canonical.com>
[ Upstream commit 6ad569019999300afd8e614d296fdc356550b77f ]
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>
---
drivers/net/ethernet/realtek/r8169.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 8b4069ea52ce..c6782ebd35e1 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -759,7 +759,7 @@ struct rtl8169_tc_offsets {
};
enum rtl_flag {
- RTL_FLAG_TASK_ENABLED,
+ RTL_FLAG_TASK_ENABLED = 0,
RTL_FLAG_TASK_SLOW_PENDING,
RTL_FLAG_TASK_RESET_PENDING,
RTL_FLAG_TASK_PHY_PENDING,
@@ -7618,7 +7618,8 @@ static int rtl8169_close(struct net_device *dev)
rtl8169_update_counters(dev);
rtl_lock_work(tp);
- clear_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags);
+ /* Clear all task flags */
+ bitmap_zero(tp->wk.flags, RTL_FLAG_MAX);
rtl8169_down(dev);
rtl_unlock_work(tp);
@@ -7795,7 +7796,9 @@ static void rtl8169_net_suspend(struct net_device *dev)
rtl_lock_work(tp);
napi_disable(&tp->napi);
- clear_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags);
+ /* Clear all task flags */
+ bitmap_zero(tp->wk.flags, RTL_FLAG_MAX);
+
rtl_unlock_work(tp);
rtl_pll_power_down(tp);
--
2.17.1
next prev parent reply other threads:[~2018-10-01 0:44 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-01 0:41 [PATCH AUTOSEL 4.4 01/17] usb: gadget: fotg210-udc: Fix memory leak of fotg210->ep[i] Sasha Levin
2018-10-01 0:41 ` [PATCH AUTOSEL 4.4 03/17] perf probe powerpc: Ignore SyS symbols irrespective of endianness Sasha Levin
2018-10-01 0:41 ` [PATCH AUTOSEL 4.4 02/17] pinctrl: msm: Really mask level interrupts to prevent latching Sasha Levin
2018-10-01 0:41 ` [PATCH AUTOSEL 4.4 04/17] RDMA/ucma: check fd type in ucma_migrate_id() Sasha Levin
2018-10-01 0:41 ` [PATCH AUTOSEL 4.4 05/17] USB: yurex: Check for truncation in yurex_read() Sasha Levin
2018-10-01 0:41 ` [PATCH AUTOSEL 4.4 06/17] drm/nouveau/TBDdevinit: don't fail when PMU/PRE_OS is missing from VBIOS Sasha Levin
2018-10-01 0:41 ` [PATCH AUTOSEL 4.4 07/17] fs/cifs: suppress a string overflow warning Sasha Levin
2018-10-01 0:41 ` [PATCH AUTOSEL 4.4 08/17] dm thin metadata: try to avoid ever aborting transactions Sasha Levin
2018-10-01 0:41 ` [PATCH AUTOSEL 4.4 09/17] arch/hexagon: fix kernel/dma.c build warning Sasha Levin
2018-10-01 0:41 ` [PATCH AUTOSEL 4.4 10/17] hexagon: modify ffs() and fls() to return int Sasha Levin
2018-10-01 0:41 ` [PATCH AUTOSEL 4.4 11/17] arm64: jump_label.h: use asm_volatile_goto macro instead of "asm goto" Sasha Levin
2018-10-01 0:41 ` [PATCH AUTOSEL 4.4 13/17] s390/qeth: don't dump past end of unknown HW header Sasha Levin
2018-10-01 0:41 ` Sasha Levin [this message]
2018-10-01 0:41 ` [PATCH AUTOSEL 4.4 14/17] cifs: read overflow in is_valid_oplock_break() Sasha Levin
2018-10-01 0:41 ` [PATCH AUTOSEL 4.4 15/17] xen/manage: don't complain about an empty value in control/sysrq node Sasha Levin
2018-10-01 0:41 ` [PATCH AUTOSEL 4.4 16/17] xen: avoid crash in disable_hotplug_cpu Sasha Levin
2018-10-01 0:41 ` [PATCH AUTOSEL 4.4 17/17] xen: fix GCC warning and remove duplicate EVTCHN_ROW/EVTCHN_COL usage Sasha Levin
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=20181001004122.147276-12-alexander.levin@microsoft.com \
--to=alexander.levin@microsoft.com \
--cc=davem@davemloft.net \
--cc=hkallweit1@gmail.com \
--cc=kai.heng.feng@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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
all inboxes | Powered by JetHome®