From: netdev-bot+sashiko@kernel.org
To: james.hilliard1@gmail.com
Cc: linux@armlinux.org.uk, andrew@lunn.ch, hkallweit1@gmail.com,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, qiangqing.zhang@nxp.com,
rmk+kernel@armlinux.org.uk, maxime.chevallier@bootlin.com,
andrew+netdev@lunn.ch, mcoquelin.stm32@gmail.com,
alexandre.torgue@foss.st.com, ansuelsmth@gmail.com,
yangtiezhu@loongson.cn, chenhuacai@kernel.org, ast@kernel.org,
daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com,
sdf@fomichev.me, richard.genoud@bootlin.com,
alastair@d-silva.org, mripard@kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org, bpf@vger.kernel.org
Subject: Re: [PATCH net v2 1/2] net: phylink: allow stopping a suspended instance
Date: Sun, 27 Sep 2026 00:29:26 +0000 [thread overview]
Message-ID: <179046896605.2160803.3111812936943364050@kernel.org> (raw)
In-Reply-To: <20260922-submit-stmmac-reset-fixes-v1-v2-1-d92e609be996@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] phylink_stop() (drivers/net/phy/phylink.c:2506-2508) now
returns early when PHYLINK_DISABLE_STOPPED is already set.
--
net: phylink: allow stopping a suspended instance
This commit lets phylink_stop() handle an instance that is still
suspended by phylink_suspend(), for example after a driver's resume
failed. Without MAC WoL it returns early, since phylink_suspend() already
called phylink_stop(). With MAC WoL it finishes the deferred
mac_link_down() and clears PHYLINK_DISABLE_MAC_WOL.
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index a1458da8111b6..df520d77fdedd 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -2495,11 +2495,18 @@ EXPORT_SYMBOL_GPL(phylink_start);
[ ... ]
> void phylink_stop(struct phylink *pl)
> {
> ASSERT_RTNL();
>
> + /* phylink_suspend() already stops the link without MAC WoL. */
> + if (test_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state))
> + return;
> +
[Severity: Medium]
Does this early return leave the PHY speed-down from phylink_suspend() in
place?
phylink_suspend() does this after its own phylink_stop():
drivers/net/phy/phylink.c:phylink_suspend() {
...
} else {
phylink_stop(pl);
}
if (phylink_phy_pm_speed_ctrl(pl))
phylink_speed_down(pl, false);
}
In phylink, only the phylink_speed_up() call in phylink_resume() undoes
this. With this patch, stopping a suspended instance leaves
phydev->advertising reduced and the saved adv_old still pending. Phylink
still treats the instance as cleanly stopped.
With stmmac, which sets wol_phy_speed_ctrl, this looks reachable with
PHY-only WoL (wolopts_mac == 0 and phy_may_wakeup() true):
1. stmmac_resume() fails before it reaches phylink_resume(). Examples are
a failure in plat->resume, stmmac_legacy_serdes_power_up() or
stmmac_hw_setup().
2. The interface is closed while device_may_wakeup(priv->device) is true.
stmmac_release() then calls phylink_speed_down() a second time:
if (device_may_wakeup(priv->device))
phylink_speed_down(priv->phylink, false);
phy_speed_down() always overwrites adv_old, before it checks whether
anything changed:
linkmode_copy(adv_tmp, phydev->advertising);
ret = phy_speed_down_core(phydev);
...
linkmode_copy(phydev->adv_old, adv_tmp);
This replaces the saved full advertisement with the reduced one.
__stmmac_release() then calls phylink_stop(), which returns early here.
phylink_disconnect_phy() runs next.
3. On reopen, phylink_bringup_phy() copies the reduced phy->advertising
into pl->link_config.advertising. The phylink_speed_up() call in
stmmac_open() can only restore the reduced adv_old.
Would the link then negotiate only the lowest common speed, for example
10 Mbps instead of 1 Gbps? This would last through later close/open and
suspend/resume cycles until the advertisement is reset with ethtool -s.
The commit message says:
the driver still decides whether to retry resume or wait for an ordinary
administrative down/up cycle.
In this case the down/up cycle does not appear to restore the speed. If
device_may_wakeup() is false, the phylink_speed_up() call in stmmac_open()
does restore the advertisement. That fix comes from the driver, though,
and not from the new suspend-to-stop transition in phylink.
Should the suspend-to-stop path in phylink_stop() also call
phylink_speed_up() when phylink_phy_pm_speed_ctrl(pl) is true?
> if (pl->sfp_bus)
> sfp_upstream_stop(pl->sfp_bus);
> if (pl->phydev)
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260922-submit-stmmac-reset-fixes-v1-v2-0-d92e609be996%40gmail.com
next prev parent reply other threads:[~2026-09-27 0:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 23:27 [PATCH net v2 0/2] net: stmmac: fix failed MTU reopening and hardware resume James Hilliard
2026-09-22 23:27 ` [PATCH net v2 1/2] net: phylink: allow stopping a suspended instance James Hilliard
2026-09-23 0:40 ` Andrew Lunn
2026-09-27 0:29 ` netdev-bot+sashiko [this message]
2026-09-22 23:27 ` [PATCH net v2 2/2] net: stmmac: keep datapath state coherent after reinitialization failure James Hilliard
2026-09-23 0:47 ` Andrew Lunn
2026-09-27 0:29 ` netdev-bot+sashiko
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=179046896605.2160803.3111812936943364050@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=alastair@d-silva.org \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=ansuelsmth@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=chenhuacai@kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=hkallweit1@gmail.com \
--cc=james.hilliard1@gmail.com \
--cc=john.fastabend@gmail.com \
--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=linux@armlinux.org.uk \
--cc=maxime.chevallier@bootlin.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=mripard@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=qiangqing.zhang@nxp.com \
--cc=richard.genoud@bootlin.com \
--cc=rmk+kernel@armlinux.org.uk \
--cc=sdf@fomichev.me \
--cc=yangtiezhu@loongson.cn \
/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
all inboxes | Powered by JetHome®