Re: [PATCH net-next 1/3] net: phy: Let drivers check Wake-on-LAN status

From: Andrew Lunn
Date: Mon May 08 2023 - 15:03:12 EST


On Mon, May 08, 2023 at 11:43:07AM -0700, Florian Fainelli wrote:
> A few PHY drivers are currently attempting to not suspend the PHY when
> Wake-on-LAN is enabled, however that code is not currently executing at
> all due to an early check in phy_suspend().
>
> This prevents PHY drivers from making an appropriate decisions and put
> the hardware into a low power state if desired.
>
> In order to allow the PHY framework to always call into the PHY driver's
> ->suspend routine whether Wake-on-LAN is enabled or not, provide a
> phydev::wol_enabled boolean that tracks whether the PHY or the attached
> MAC has Wake-on-LAN enabled.
>
> If phydev::wol_enabled then the PHY shall not prevent its own
> Wake-on-LAN detection logic from working and shall not prevent the
> Ethernet MAC from receiving packets for matching.

Hi Florian

Did you look at using late_suspend for this? Then there would not be
any need to change all these drivers which are happy as they are.

It actually looks like late_suspend is what you want anyway, when you
say you want to turn the matching hardware on as late as possible.

Andrew