From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Florian Fainelli <florian.fainelli@broadcom.com>,
Gatien Chevallier <gatien.chevallier@foss.st.com>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Christophe Roullier <christophe.roullier@foss.st.com>,
Conor Dooley <conor+dt@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
devicetree@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>,
Rob Herring <robh@kernel.org>, Simon Horman <horms@kernel.org>,
Tristram Ha <Tristram.Ha@microchip.com>
Subject: Re: [PATCH RFC net-next 3/6] net: phylink: add phylink managed MAC Wake-on-Lan support
Date: Sun, 28 Sep 2025 10:32:20 +0100 [thread overview]
Message-ID: <aNkApFc9wsnabXFW@shell.armlinux.org.uk> (raw)
In-Reply-To: <E1v2nFI-00000007jXV-1BYa@rmk-PC.armlinux.org.uk>
On Sun, Sep 28, 2025 at 09:59:04AM +0100, Russell King (Oracle) wrote:
> Add core phylink Wake-on-Lan support.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> drivers/net/phy/phylink.c | 77 +++++++++++++++++++++++++++++++++++++--
> include/linux/phylink.h | 26 +++++++++++++
> 2 files changed, 99 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index 9d7799ea1c17..9a3783e719bc 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -93,6 +93,9 @@ struct phylink {
> u8 sfp_port;
>
> struct eee_config eee_cfg;
> +
> + u32 wolopts_mac;
> + u8 wol_sopass[SOPASS_MAX];
> };
>
> #define phylink_printk(level, pl, fmt, ...) \
> @@ -2575,11 +2578,17 @@ EXPORT_SYMBOL_GPL(phylink_rx_clk_stop_unblock);
> * can also bring down the link between the MAC and PHY.
> * - If Wake-on-Lan is active, but being handled by the MAC, the MAC
> * still needs to receive packets, so we can not bring the link down.
> + *
> + * Note: when phylink managed Wake-on-Lan is in use, @mac_wol is ignored.
> + * (struct phylink_mac_ops.mac_set_wol populated.)
> */
> void phylink_suspend(struct phylink *pl, bool mac_wol)
> {
> ASSERT_RTNL();
>
> + if (phylink_mac_supports_wol(pl))
> + mac_wol = !!pl->wolopts_mac;
> +
> if (mac_wol && (!pl->netdev || pl->netdev->ethtool->wol_enabled)) {
> /* Wake-on-Lan enabled, MAC handling */
> mutex_lock(&pl->state_mutex);
> @@ -2673,6 +2682,17 @@ void phylink_resume(struct phylink *pl)
> }
> EXPORT_SYMBOL_GPL(phylink_resume);
>
> +static bool phylink_mac_supports_wol(struct phylink *pl)
> +{
> + return !!pl->mac_ops->mac_wol_set;
> +}
> +
> +static bool phylink_phy_supports_wol(struct phylink *pl,
> + struct phy_device *phydev)
> +{
> + return phydev && (pl->config->wol_phy_legacy || phy_can_wakeup(phydev));
> +}
> +
Yes, these need to be earlier.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2025-09-28 9:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-28 8:55 [PATCH RFC net-next 0/6] net: add phylink managed WoL and convert stmmac Russell King (Oracle)
2025-09-28 8:58 ` [PATCH RFC net-next 1/6] net: phy: add phy_can_wakeup() Russell King (Oracle)
2025-09-28 8:58 ` [PATCH RFC net-next 2/6] net: phy: add phy_may_wakeup() Russell King (Oracle)
2025-09-30 9:04 ` Gatien CHEVALLIER
2025-09-30 10:53 ` Russell King (Oracle)
2025-09-28 8:59 ` [PATCH RFC net-next 3/6] net: phylink: add phylink managed MAC Wake-on-Lan support Russell King (Oracle)
2025-09-28 9:32 ` Russell King (Oracle) [this message]
2025-09-28 8:59 ` [PATCH RFC net-next 4/6] net: phylink: add phylink managed wake-on-lan PHY speed control Russell King (Oracle)
2025-09-28 8:59 ` [PATCH RFC net-next 5/6] net: stmmac: convert to phylink-managed Wake-on-Lan Russell King (Oracle)
2025-09-28 8:59 ` [PATCH RFC net-next 6/6] net: stmmac: convert to phylink managed WoL PHY speed Russell King (Oracle)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aNkApFc9wsnabXFW@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=Tristram.Ha@microchip.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=christophe.roullier@foss.st.com \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=florian.fainelli@broadcom.com \
--cc=gatien.chevallier@foss.st.com \
--cc=hkallweit1@gmail.com \
--cc=horms@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).