Re: r8169 Wake-on-LAN causes immediate ACPI GPE wakeup

From: Daniel Drake
Date: Thu Oct 05 2017 - 22:36:17 EST


On Fri, Oct 6, 2017 at 8:16 AM, Francois Romieu <romieu@xxxxxxxxxxxxx> wrote:
> Daniel Drake <drake@xxxxxxxxxxxx> :
> [...]
>> Also, is there a standard behaviour defined for ethernet drivers
>> regarding wake-on-LAN? r8169 appears to enable wake-on-LAN by default
>> if it believes the hardware is capable of it,
>
> If so it isn't its designed behavior.
>
> The r8169 driver does not enable specific WoL event source (unicast packet,
> link, etc.). It should keep the current settings unless one of those holds:
> - explicit wol config from userspace (obviously :o) )
> - runtime pm requires different settings to resume. The change should
> be temporary (save before suspend, restore after resume).
>
> The device is supposed to require both an event source + Config1.PMEnable.
>
> A problem may happen if some event source bit is already set while
> Config1.PMEnable is not. The driver has been forcing Config1.PMEnable
> since 5d06a99f543e734ceb53bbc9e550537be97f0c49. One may thus experience
> transition from inconsistent wol settings to enabled ones (if you want
> to dig it, check beforehand if Config1.PMEnable is really read-write or
> hardwired to 1).

The code in question here is in rtl_init_one():

device_set_wakeup_enable(&pdev->dev, tp->features & RTL_FEATURE_WOL);

This enables wakeups regardless of current WOL settings, as long as
the hardware supports the WOL feature.
Should we remove this line? rtl8169_set_wol() looks like it will do
the right thing here if WOL is later enabled.

Daniel