Re: [PATCH net v3 09/10] net: au1000: keep the MAC stopped until the PHY link is ready
From: netdev-bot+sashiko
Date: Fri Nov 20 2026 - 05:33:10 EST
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · Low: 1
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).
- [High] The fix stops MAC RX/TX in only one place: the link-down branch
of au1000_adjust_link()…
- [Low] The new au1000_hard_stop(dev) call in the link-down branch of
au1000_adjust_link() (au1000_eth.c:460) runs inside…
--
net: au1000: keep the MAC stopped until the PHY link is ready
This patch stops MAC RX/TX in the link-down branch of
au1000_adjust_link(). In au1000_open() it resumes the PHY synchronously
before au1000_init(). It also changes au1000_init() to leave RX/TX
disabled until au1000_adjust_link() has acknowledged a link.
> diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c
> index cb2f3333ba9fd..98a75aba92e1a 100644
> --- a/drivers/net/ethernet/amd/au1000_eth.c
> +++ b/drivers/net/ethernet/amd/au1000_eth.c
> @@ -456,7 +456,8 @@ au1000_adjust_link(struct net_device *dev)
> /* link state changed */
>
> if (!phydev->link) {
> - /* link went down */
> + /* Stop the MAC before the PHY can remove its clocks. */
> + au1000_hard_stop(dev);
[Severity: High]
This covers phy_stop() on close. Is there a path that powers the PHY down
without ever calling adjust_link, though?
During system sleep, mdio_bus_phy_suspend() only skips the PHY when
mac_managed_pm is set, and au1000_eth never sets it:
drivers/net/phy/phy_device.c:mdio_bus_phy_suspend() {
...
if (phydev->mac_managed_pm)
return 0;
...
if (phy_uses_state_machine(phydev))
phy_stop_machine(phydev);
...
return phy_suspend(phydev);
}
phy_stop_machine() only cancels the work and moves the state to PHY_UP,
so it never reaches the PHY_HALTED path that calls phy_link_down():
drivers/net/phy/phy.c:phy_stop_machine() {
cancel_delayed_work_sync(&phydev->state_queue);
mutex_lock(&phydev->lock);
if (phy_is_started(phydev))
phydev->state = PHY_UP;
...
}
On MTX-1 the LAN83C183 then gets genphy_suspend(), which sets BMCR_PDOWN.
au1000_eth_driver has no .driver.pm callbacks. With the interface up and
the link up, the MAC appears to keep MAC_RX_ENABLE | MAC_TX_ENABLE set for
the whole sleep.
On resume, mdio_bus_phy_resume()->lan83c183_resume() waits 500 ms, and
the MAC is still running during that wait.
Those are the two conditions the commit message describes: "MTX-1 can
hang when the MAC runs while its MII clocks are absent or still
recovering."
This looks reachable on MTX-1 itself through s2idle, because
pm_states_init() always offers "freeze" even without platform
suspend_ops. Alchemy db1x boards can also reach it through suspend-to-mem,
via the db1x_pm_ops registered in arch/mips/alchemy/devboards/pm.c.
The last patch in the series ("net: au1000: reject frames larger than the
TX bounce buffer") only touches au1000_tx(), so this gap is still there
at the end of the series.
Would it make sense to add MAC-side suspend/resume handling here? Another
option is to set mac_managed_pm and stop and start the MAC explicitly.
[Severity: Low]
This call runs inside the spin_lock_irqsave(&aup->lock, flags) region of
au1000_adjust_link(), and au1000_hard_stop() ends with a busy-wait:
au1000_hard_stop() {
...
writel(reg, &aup->mac->control);
wmb(); /* drain writebuffer */
mdelay(10);
}
Doesn't this mean every link-down event now spins for 10 ms with local
interrupts disabled? Before this change the link-down branch did no MMIO
and had no delay.
On close the wait also seems to happen twice. phy_stop() leads to
phy_link_down()->au1000_adjust_link(), which does the first hard stop.
au1000_close() then takes aup->lock with irqsave and calls
au1000_reset_mac_unlocked(). Since MDIO accesses have re-enabled the MAC,
mac_enabled is still 1, so au1000_hard_stop() runs again with RX/TX
already cleared:
au1000_reset_mac_unlocked() {
...
if (aup->mac_enabled) {
au1000_hard_stop(dev);
...
}
The delay is only there so the MAC can quiesce before phylib suspends the
PHY, and that suspend happens after adjust_link returns.
Could the register write stay under the lock, with the mdelay() moved
after spin_unlock_irqrestore()?
> aup->old_speed = 0;
> aup->old_duplex = -1;
> }
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117193223.2795612-1-f.fainelli%40gmail.com