Article View: linux.kernel.netdev
Article #22225Re: [PATCH net v4 09/10] net: au1000: keep the MAC stopped until the PHY link is ready
From: netdev-bot+sashiko
Date: Wed, 25 Nov 2026 01:28
Date: Wed, 25 Nov 2026 01:28
232 lines
15714 bytes
15714 bytes
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 ยท High: 1 ยท Medium: 2 ยท 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).
- [High] net: au1000: unattached PHYs on aup->mii_bus lack mac_managed_pm
- [Medium] Setting `phydev->mac_managed_pm = true` in au1000_mii_probe()
turns off phylib's MDIO-bus system-sleep handling.
- [Medium] When au1000_resume() fails, the interface is left in a state
it cannot leave once it is closed.
--
net: au1000: keep the MAC stopped until the PHY link is ready
The patch keeps MAC RX/TX disabled until au1000_adjust_link() acknowledges
link up. It also stops the MAC on link-down and resumes the PHY
synchronously in au1000_open() before au1000_init(). Finally, it adds
system sleep callbacks that manage PHY and MAC power transitions, and sets
mac_managed_pm so phylib's MDIO bus PM is skipped.
> diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c
> index ec28ed33bf698..aa5fa318b23e2 100644
> --- a/drivers/net/ethernet/amd/au1000_eth.c
> +++ b/drivers/net/ethernet/amd/au1000_eth.c
[ ... ]
> @@ -553,6 +567,7 @@ static int au1000_mii_probe(struct net_device *dev)
> }
>
> phy_set_max_speed(phydev, SPEED_100);
> + phydev->mac_managed_pm = true;
>
> aup->old_link = 0;
> aup->old_speed = 0;
[Severity: High]
Does this cover every phy_device on aup->mii_bus, or only the one that
gets connected?
mdiobus_register() in au1000_probe() creates a phy_device for every
address that answers. However, au1000_mii_probe() only sets
mac_managed_pm on the one it passes to phy_connect().
On MTX-1, mtx1_au1000_eth0_pdata sets phy_search_highest_addr because
the LAN83C183 answers at address 0 as well as at address 31. Both
instances bind to the PHY driver, and the loop in au1000_mii_probe()
picks address 31. That leaves the address 0 alias unattached with
mac_managed_pm clear.
For an unattached PHY with a bound driver, mdio_bus_phy_may_suspend()
falls through to returning !phydev->suspended. The MDIO bus PM
callbacks therefore still act on the alias.
The phy_device instances are added to the PM list after the platform
device, so mdio_bus_phy_suspend() on address 0 runs before
au1000_suspend(). Its phy_suspend() powers down the same physical PHY
through the alias. That removes the MII clocks while MAC RX/TX are
still enabled. Isn't that the MTX-1 hang this patch is trying to
prevent?
On the way back up, mdio_bus_phy_resume() on the alias runs after
au1000_resume(). Its phy_init_hw() and phy_resume() go through
au1000_mdiobus_read() and au1000_mdiobus_write(), which call
au1000_enable_mac(dev, 0).
For a down interface, that leaves the MAC clocked and out of reset
again. This undoes the au1000_reset_mac() done in au1000_suspend().
For a running interface, it reinitializes the PHY behind the back of
the state machine that au1000_resume() has just restarted with
phy_start().
Would it be better to set mac_managed_pm on every phy_device found on
aup->mii_bus? Alternatively, could the alias be kept from being
registered at all through mii_bus->phy_mask on boards that set
phy_search_highest_addr?
[ ... ]
> @@ -972,6 +1003,81 @@ static int au1000_close(struct net_device *dev)
> return 0;
> }
>
> +static int au1000_suspend(struct device *device)
> +{
[ ... ]
> + rtnl_lock();
> + if (netif_running(dev)) {
> + if (!netif_device_present(dev))
> + goto out;
> + netif_device_detach(dev);
> + netif_tx_disable(dev);
> + disable_irq(dev->irq);
> + /* Do not depend on phylib delivering a link-down callback. */
> + spin_lock_irqsave(&aup->lock, flags);
> + if (aup->mac_enabled)
> + au1000_disable_rx_tx(dev);
> + spin_unlock_irqrestore(&aup->lock, flags);
> + usleep_range(10000, 11000);
> + if (dev->phydev)
> + phy_stop(dev->phydev);
> + } else if (dev->phydev) {
> + ret = phy_suspend(dev->phydev);
> + }
[ ... ]
> +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();
> + if (!netif_running(dev))
> + goto out;
[Severity: Medium]
Can the PHY miss its re-initialization when the interface is down across
system sleep?
Setting mac_managed_pm in au1000_mii_probe() makes mdio_bus_phy_resume()
return early:
drivers/net/phy/phy_device.c:mdio_bus_phy_resume() {
if (phydev->mac_managed_pm)
return 0;
...
ret = phy_init_hw(phydev);
...
ret = phy_resume(phydev);
...
}
Before this patch, a PHY that phy_connect() had attached but that was never
opened stayed resumed after phy_attach_direct(). The MDIO bus PM path then
suspended it and ran phy_init_hw() followed by phy_resume() on wakeup.
Now, if the interface is down, au1000_suspend() calls phy_suspend() and
au1000_resume() returns here without touching the PHY. The next
au1000_open() only calls phy_resume() and phy_start(), never phy_init_hw().
If the PHY loses register state over suspend-to-RAM, does it come up after
the next ifup without its soft_reset, fixups, config_init (for example
smsc_phy_config_init() on LAN87xx parts) and config_intr re-applied? The
LAN83C183 on MTX-1 has no config_init or soft_reset, but other Au1x00
boards use PHYs that do.
The running-interface path below does call phy_init_hw(). Should the
inactive path do the same, either here or in au1000_open()?
> +
> + spin_lock_irqsave(&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;
> + }
> +
> + au1000_init(dev);
> + enable_irq(dev->irq);
> + if (dev->phydev)
> + phy_start(dev->phydev);
> + netif_device_attach(dev);
> + goto out;
> +
> +err_reset:
> + au1000_reset_mac(dev);
> +out:
> + rtnl_unlock();
> + return ret;
> +}
[Severity: Medium]
What state is the interface left in if phy_init_hw() or phy_resume() fails
here, for example with -ETIMEDOUT from au1000_mdio_read() or
au1000_mdio_write()?
The err_reset path only resets the MAC. The PHY stays in PHY_HALTED from
the phy_stop() in au1000_suspend(), the IRQ stays disabled and the netdev
stays detached, while netif_running() is still true.
If the interface is then brought down, au1000_close() calls phy_stop()
unconditionally. PHY_HALTED fails the check at the top of phy_stop():
drivers/net/phy/phy.c:phy_stop() {
if (!phy_is_started(phydev) && phydev->state != PHY_DOWN &&
phydev->state != PHY_ERROR) {
WARN(1, "called from state %s\n",
phy_state_to_str(phydev->state));
return;
}
...
}
A later ifup then fails because the device is still detached:
net/core/dev.c:__dev_open() {
if (!netif_device_present(dev)) {
...
if (!netif_device_present(dev))
return -ENODEV;
}
...
}
Another suspend/resume cycle does not recover it either. With
netif_running() false, au1000_resume() takes the early goto out above and
never calls netif_device_attach().
Does this turn a possibly transient MDIO error during resume into an
interface that cannot be used again until the driver is rebound?
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261121004809.1690280-1-f.fainelli%40gmail.com
Technical Details
Message-ID:
<179557011468.3135.5568658065903608607@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370943-linux-kernel-netdev=dewy.ruReferences:
<20261121004809.1690280-10-f.fainelli@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370943-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v4 09/10] net: au1000: keep the MAC stopped until the PHY link is ready Date: Wed, 25 Nov 2026 01:28:34 +0000 Organization: Usenet Network Message-ID: <179557011468.3135.5568658065903608607@kernel.org> References: <20261121004809.1690280-10-f.fainelli@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="81949"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Es8Ijubb3aN3q9KmYdc8H1aQybY= sha256:GMtfBrLvkhJkGgBasb22yC9xNRJrAR0qrE8EMTuYdCI= sha1:iobM8jH3oTkPyn53PWriBxSp6C8= sha256:uAK4CHw+qQwp8uW9y5pFlkC/n07VAyJn8NxrqO62T6E= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id C6F37125E3A; Wed, 25 Nov 2026 04:29:02 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mdiHDKPAMjOx; Wed, 25 Nov 2026 04:28:58 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-370943-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id B0B64125E39; Wed, 25 Nov 2026 04:28:50 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 3ACEE37EDD; Wed, 25 Nov 2026 01:28:45 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795570118; b=VYt1HrmZnfLVyrIW+3F5G4rgJ7xwP/V0bF6jRBGboHBc3F5SJ/qdFdrUyi5FjJo/Ip4C GbxxnbqpZU+VA1YPsbRz4UPzm9zcB3hIJymr7mfgJha/iYzZmyHNWgNNnZMxq70OgtKRy 4d1NOe2gIiLxdTwJYfXg/R4WezRFWplV9ysL5wr9XG4ti1ooiBuZOe40NyW+MtujoFQJK sRQPHoDoOTpPrOO9/c4sTiXHqlSdsFxZBwe8SR/7LOwu0hfW0qs32afZUVwmUw3APaQ+F bg/lCBjdSXEXUQ+wwa3XmQ4SZOwltHsD5HS2+7nfc3lUA/TO7YBw5fQFKkG4la0XRlQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795570118; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=E8359OUvmn7QJKn1lJO3S5uy8iyHhl5y1lBMxhcGp/4=; b=hfDhBex/QLb4ZrewkZ0PAZEPRt6Pyt0uOQTlF6PslPXSjy9pmxUlkP6RZO1j+LkIpify nY/gHMEssPjlH60ejRHcEYhGA5+CEYfpSPlqJk/By3jTP7N6lTLDtXuVTKlkWt50dDHKm HyJK3hZYYUAMbphbBY9LeBBH8+KXvoPi116hozRanhXxtf9+bbpaJF2z8UW2Sjz5QAoiL a4T2xKfdhzxT8/+XjwLnlt93E2zq7jSbvf5kOPYlMYNNIHo5NTTGdgr9cmzhYlGWcoXHT IasWquNM8Sn9dJGi/0BVMkWCTzMuEe7fSFVdytHpiD0uE98lBKFD6c0ENZL60nkSaVQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Tu1YX3Ns; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E7E32606A69E; Wed, 25 Nov 2026 01:28:37 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Tu1YX3Ns X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795570117; b=mNKVL/4L9nocLMrDak2ewk5Pv78t6qVsf8ldI0UXwc1iXjgxX8JdK5cyJ45drcD5PJ2k wS6r7XgFxkbWS4alh3CqZ0xloUoQvic+1g+kW1tfaht2ZOgGqrZ2TdWUEny9aj1928Lca OGq44l2iUga7B82ybHJIfMaTWIIb9pSzH36mj4LNo+xNgWiU2F3eGZ3AdGsSWF2g+uula hA1kd+0XBH3IOol4xcAqCLUDUPCFCFO6+V11oxckqxIyUtS4+aBogijvXLTpog/8Grqyl p6m3AMjNPswQrbVzjVZ3eLgr53R0geJPTfWoy4MIqClpO/zo2MHVsqlcyF4XBMJ6n2g== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795570117; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=E8359OUvmn7QJKn1lJO3S5uy8iyHhl5y1lBMxhcGp/4=; b=lK14d6iamIKXwAMIXwZWbAb6bZk4IdPBVfJ5ajx+eyL1Jpu0XLArIrYk6nKGZS+23wp5 ssoy6aDHe2Rzw5XLyOBnqE9MBDGtk0KCni/6EVwRQN88Bqu1g5JOMtwVQIcz2VzQx5C4h Ol1CF84nstT7Wznfwh2q1vWdLrnLSgZ/aSHOTb2i2ZOTPNrIAO9IFUQDY6eeqiTOOpYxm 488xiBdJVvaAuGzmcpj6pNCpn/ET83Fkrr1n86qXVTu09j9yaaaa5MCx7HbBXhAIGRg6z iUmtu6kcAI/8JvozImWBwS663o44q4pCKWlSGqpf5cB8KCzqvCsi/qZDSk9VBUZkHog== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Tu1YX3Ns; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 167B0606A32D; Wed, 25 Nov 2026 01:28:36 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CEF81F000EF; Wed, 25 Nov 2026 01:28:35 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795570116; bh=E8359OUvmn7QJKn1lJO3S5uy8iyHhl5y1lBMxhcGp/4=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=Tu1YX3NsWqx7GZVhU/x/EWi9ykddxSU0vLi4YUtN2CR/Few1OGJMm8eJeRsUrzZ9b F0KK80u38ALLMkT2UX5H5Kc8LZMtZdOlIWwJILa8pcEuWLt1mOyYgb7N6AGUAA/N5q zBcpNdJjZEOgfGoBoxHZNSL8yuNEfmZcpknSPQg5lzaE6FNv7oGz/o0VcsTzr+B6OZ pZXOBg0SNntd0QhtwdJkUOuwo+grnAmY1G08VupkPpuzREl0pIe9as+/D82A6wqsZr HTI/ccGQEqLYl01bJoPu5vy7HPZiTzls7hhn1o5JFXMYW22wokTvdjNj9+YDA3e5uc HvKI+01x6piJQ== X-Cc: netdev@vger.kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, hkallweit1@gmail.com, linux@armlinux.org.uk, shaojijie@huawei.com, horms@kernel.org, runyu.xiao@seu.edu.cn, mmyangfl@gmail.com, hvr@gnu.org, danny.kukawka@bisect.de, mugunthanvnm@ti.com, sebastian.hesselbarth@gmail.com, linux-kernel@vger.kernel.org, manuel.lauss@gmail.com X-In-Reply-To: <20261121004809.1690280-10-f.fainelli@gmail.com> X-sashiko-severity: High X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list