r8169: fix broken Wake-on-LAN from S5 (poweroff)
authorHeiner Kallweit <hkallweit1@gmail.com>
Thu, 25 Oct 2018 16:40:19 +0000 (18:40 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 25 Oct 2018 23:15:23 +0000 (16:15 -0700)
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 <neil@nmacleod.com>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

index 006b0aa8cec3bf11a18042affc7b4b450e6c2584..1fd01688d37bdd9c7e09e2444034c0ccb286ea19 100644 (file)
@@ -4161,10 +4161,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);
        return true;