[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eb0d1b55-307b-4b51-953f-fdcc1a8fbe27@bootlin.com>
Date: Wed, 22 Oct 2025 16:28:19 +0200
From: Maxime Chevallier <maxime.chevallier@...tlin.com>
To: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>,
Andrew Lunn <andrew@...n.ch>, Heiner Kallweit <hkallweit1@...il.com>
Cc: Alexandre Torgue <alexandre.torgue@...s.st.com>,
Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, linux-arm-kernel@...ts.infradead.org,
linux-stm32@...md-mailman.stormreply.com,
Maxime Coquelin <mcoquelin.stm32@...il.com>, netdev@...r.kernel.org,
Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH net-next 4/6] net: phylink: add phylink managed
wake-on-lan PHY speed control
Hi Russell,
On 17/10/2025 14:04, Russell King (Oracle) wrote:
> Some drivers, e.g. stmmac, use the speed_up()/speed_down() APIs to
> gain additional power saving during Wake-on-LAN where the PHY is
> managing the state.
>
> Add support to phylink for this, which can be enabled by the MAC
> driver. Only change the PHY speed if the PHY is configured for
> wake-up, but without any wake-up on the MAC side, as MAC side
> means changing the configuration once the negotiation has
> completed.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>
> ---
> drivers/net/phy/phylink.c | 12 ++++++++++++
> include/linux/phylink.h | 2 ++
> 2 files changed, 14 insertions(+)
>
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index 939438a6d6f5..26bd4b7619dd 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -2576,6 +2576,12 @@ static bool phylink_phy_supports_wol(struct phylink *pl,
> return phydev && (pl->config->wol_phy_legacy || phy_can_wakeup(phydev));
> }
>
> +static bool phylink_phy_pm_speed_ctrl(struct phylink *pl)
> +{
> + return pl->config->wol_phy_speed_ctrl && !pl->wolopts_mac &&
> + pl->phydev && phy_may_wakeup(pl->phydev);
> +}
> +
> /**
> * phylink_suspend() - handle a network device suspend event
> * @pl: a pointer to a &struct phylink returned from phylink_create()
> @@ -2625,6 +2631,9 @@ void phylink_suspend(struct phylink *pl, bool mac_wol)
> } else {
> phylink_stop(pl);
> }
> +
> + if (phylink_phy_pm_speed_ctrl(pl))
> + phy_speed_down(pl->phydev, false);
Should this rather be phylink_speed_down, to take into account the fact
that the PHY might be on SFP ? either here or directly in
phylink_phy_pm_speed_ctrl() above ?
Maxime
Powered by blists - more mailing lists