From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiner Kallweit Subject: [PATCH net] r8169: fix broken Wake-on-LAN from S5 (poweroff) Date: Thu, 25 Oct 2018 18:40:19 +0200 Message-ID: <6a3d4915-1d27-89b2-953a-66ec6d82b846@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: "netdev@vger.kernel.org" , Neil MacLeod To: David Miller , Realtek linux nic maintainers Return-path: Received: from mail-wm1-f68.google.com ([209.85.128.68]:50726 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727363AbeJZBN7 (ORCPT ); Thu, 25 Oct 2018 21:13:59 -0400 Received: by mail-wm1-f68.google.com with SMTP id i8-v6so2198228wmg.0 for ; Thu, 25 Oct 2018 09:40:25 -0700 (PDT) Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: It was reported that WoL from S5 is broken (WoL from S3 works) and the analysis showed that during system shutdown the network interface was brought down already when the actual kernel shutdown started. Therefore netif_running() returned false and as a consequence the PHY was suspended. Obviously WoL wasn't working then. To fix this the original patch needs to be effectively reverted. A side effect is that when normally bringing down the interface and WoL is enabled the PHY will remain powered on (like it was before the original patch). Fixes: fe87bef01f9b ("r8169: don't check WoL when powering down PHY and interface is down") Reported-by: Neil MacLeod Signed-off-by: Heiner Kallweit --- drivers/net/ethernet/realtek/r8169.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 0d8070adc..987fedeee 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c @@ -4162,10 +4162,15 @@ static void rtl_wol_suspend_quirk(struct rtl8169_private *tp) static bool rtl_wol_pll_power_down(struct rtl8169_private *tp) { - if (!netif_running(tp->dev) || !__rtl8169_get_wol(tp)) + struct phy_device *phydev; + + if (!__rtl8169_get_wol(tp)) return false; - phy_speed_down(tp->dev->phydev, false); + /* phydev may not be attached to netdevice */ + phydev = mdiobus_get_phy(tp->mii_bus, 0); + + phy_speed_down(phydev, false); rtl_wol_suspend_quirk(tp); return true; -- 2.19.1