Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · 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).
- [Medium] au1000_resume() (drivers/net/ethernet/amd/au1000_eth.c) calls
phy_init_hw() and phy_resume() on the attached PHY before it checks…
- [Low] net: au1000: missing discovery and runtime test context in
changelog
--
net: au1000: keep the MAC stopped until the PHY link is ready
This patch keeps au1000 MAC RX/TX disabled until phylib reports link up
and stops the MAC on link-down. au1000_open() now resumes the PHY
synchronously before MAC initialization. The patch also adds system
sleep PM ops that manage PHY power from the MAC driver, and marks every
PHY on the MDIO bus as mac_managed_pm.
> diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c
> index ec28ed33bf698..5bfafe52020f6 100644
> --- a/drivers/net/ethernet/amd/au1000_eth.c
> +++ b/drivers/net/ethernet/amd/au1000_eth.c
[ ... ]
> +static int au1000_resume(struct device *device)
> +{
> + struct net_device *dev = dev_get_drvdata(device);
> + struct au1000_private *aup = netdev_priv(dev);
> + unsigned long flags;
> + int ret = 0;
> +
> + rtnl_lock();
> + spin_lock_irqsave(&aup->lock, flags);
> + aup->old_link = 0;
> + aup->old_speed = 0;
> + aup->old_duplex = -1;
> + spin_unlock_irqrestore(&aup->lock, flags);
> +
> + if (dev->phydev) {
> + ret = phy_init_hw(dev->phydev);
> + if (ret)
> + goto err_reset;
> + ret = phy_resume(dev->phydev);
> + if (ret)
> + goto err_reset;
> + }
> +
> + if (!netif_running(dev)) {
> + /* PHY reinitialization may have enabled the MAC for MDIO. */
> + au1000_reset_mac(dev);
> + netif_device_attach(dev);
> + goto out;
> + }
[Severity: Low]
The changelog explains the mechanism in detail, but it still doesn't
say how these problems were found or which of them were seen on real
hardware.
On v4 you replied that the open/close/open hang on MTX-1 was hit
during hardware testing, and that the other issues were found by code
inspection. Jakub asked for that to be recorded in the changelog when
the series was reposted:
https://lore.kernel.org/r/2026…@kernel.org
This patch now bundles several separate changes:
- the link-down MAC stop in au1000_adjust_link()
- the phy_init_hw()/phy_resume() ordering before au1000_init() in
au1000_open()
- the new au1000_suspend()/au1000_resume() PM ops
- setting mac_managed_pm on every PHY on the bus for the address 31
alias
- the failed-resume recovery through au1000_close()
>From your v4 reply, only the reopen hang appears to have been
reproduced. A reader of the v5 log can't tell that.
Could you add a short paragraph that says which changes fix the
reproduced MTX-1 reopen hang and which ones come from inspection or
review? Please also say whether the system sleep paths and the alias
handling were exercised on MTX-1 at all. That would make it much
easier to judge the Fixes: tag and the risk of backporting this to
stable.
[Severity: Medium]
Does this power up the PHY of a down interface again after every
system resume?
Here is the sequence. First ifup, then ifdown. au1000_close() calls
phy_stop(), and phylib suspends the PHY: genphy_suspend() sets
BMCR_PDOWN and phydev->suspended becomes 1. On system suspend,
au1000_suspend() takes the non-running branch. phy_suspend() returns
early there because the PHY is already suspended.
On resume, phy_init_hw() and phy_resume() run before netif_running()
is checked. On MTX-1 this reaches lan83c183_resume():
drivers/net/phy/smsc.c:lan83c183_resume() {
ret = phy_modify_changed(phydev, MII_BMCR, BMCR_PDOWN, 0);
...
if (ret)
msleep(500);
}
The !netif_running() branch then only resets the MAC and returns. The
PHY stays powered, autonegotiates and shows link to the partner while
the host interface is administratively down. phydev->state stays
PHY_HALTED with suspended cleared until the next ifup/ifdown or system
suspend. On MTX-1, each down interface also adds 500 ms to system
resume.
Before this patch, phylib's MDIO bus PM handled the PHY.
mdio_bus_phy_may_suspend() returns !phydev->suspended, which is false
for a PHY that phy_stop() has already powered down. So
mdio_bus_phy_resume() took the no_resume path and the close-time
power-down survived sleep. That looks like the behaviour introduced by
be9dad1f9f26, the commit this patch names in its Fixes: tag.
The commit message says:
Reinitialize and resume the attached PHY even when the interface is
down across sleep, then reset the MAC again to gate the clock enabled
by MDIO.
It doesn't give a reason. au1000_open() now calls phy_init_hw() and
phy_resume() itself, so is the resume needed here at all? It also
seems to conflict with au1000_suspend(), which treats a non-running
interface as one whose PHY should be suspended.
Could the !netif_running() branch call phy_suspend() after the PHY is
reinitialized and before au1000_reset_mac()?
Two error paths appear to leave a similar gap. In au1000_open(), a
phy_init_hw() or phy_resume() failure only resets the MAC, even if
phy_init_hw() has already powered the PHY up:
err_reset:
au1000_reset_mac(dev);
free_irq(dev->irq, dev);
return retval;
In au1000_close(), after a failed system resume the state is already
PHY_HALTED, so phy_stop() is skipped:
if (dev->phydev && dev->phydev->state != PHY_HALTED)
phy_stop(dev->phydev);
phy_init_hw() may have reset and powered up the PHY on that failed
resume path. In both cases nothing puts the PHY back into power-down.
Should these paths also call phy_suspend()?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40gmail.com