• Heiner Kallweit's avatar
    r8169: improve WoL handling · fa6821cb
    Heiner Kallweit authored
    WoL handling for the RTL8168 family is a little bit tricky because of
    different types of broken BIOS and/or chip quirks.
    
    Two known issues:
    1. Network properly resumes from suspend only if WoL is enabled in the chip.
    2. Some notebooks wake up immediately if system is suspended and network
       device is wakeup-enabled.
    
    Few patches tried to deal with this:
    7edf6d31 ("r8169: disable WOL per default")
    18041b52 ("r8169: restore previous behavior to accept BIOS WoL
    settings")
    
    Currently we have the situation that the chip WoL settings as set by
    the BIOS are respected (to prevent issue 1), but the device doesn't get
    wakeup-enabled (to prevent issue 2).
    
    This leads to another issue:
    If systemd is told to set WoL it first checks whether the requested
    settings are active already (and does nothing if yes). Due to the chip
    WoL flags being set properly systemd assumes that WoL is configured
    properly in our case. Result is that device doesn't get wakeup-enabled
    and WoL doesn't work (until it's set e.g. by ethtool).
    
    This patch now:
    - leaves the chip WoL settings as is (to prevent issue 1)
    - keeps the behavior to not wakeup-enable the device initially
      (to prevent issue 2)
    - In addition we report WoL as being disabled in get_wol, matching
      that device isn't wakeup-enabled. If systemd is told to enable WoL,
      it will therefore detect that it has to do something and will
      call set_wol.
    
    Of course the user still has the option to override this with
    e.g. ethtool.
    
    v2:
    - Don't just exclude __rtl8169_get_wol() from compiling, remove it.
    v3:
    - adjust commit message
    Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    fa6821cb
r8169.c 183 KB