🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26607

Re: [PATCH net v5 09/10] net: au1000: keep the MAC stopped until the PHY link is ready

#26607
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 23:41
165 lines
14138 bytes
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/20261121103844.2c27eba4@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/20261202224957.3043478-1-f.fainelli%40gmail.com
Technical Details
Message-ID: <179634127950.3146.17178958985267882353@kernel.org>
Path: mbox-mo1.pugleaf.net!news-fra.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376906-linux-kernel-netdev=dewy.ru
References: <20261202224957.3043478-10-f.fainelli@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-fra.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376906-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v5 09/10] net: au1000: keep the MAC stopped until the PHY link is ready
Date: Thu, 03 Dec 2026 23:41:19 +0000
Organization: Usenet Network
Message-ID: <179634127950.3146.17178958985267882353@kernel.org>
References: <20261202224957.3043478-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="2630002"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:6g579Iox/txh/NJk8ihQglzt3eE= sha256:M9CgA0AupxmcQqYOAxk/TtXJd5g1Oi2FxBElSI9zeFA= sha1:OA8V0pQ1Q41/hdZpZ5fPf/4GGF4= sha256:BPEfrycKITng2m5TdYl/yq29Mtf9ACBiMn2u9n9RIbw=
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 4D333117A70; Fri,  4 Dec 2026 02:41:46 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.64
X-Spam-Status: No, score=-3.64 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.24, 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] 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 7kgGTn599n3V; Fri,  4 Dec 2026 02:41:43 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376906-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 15CDD117971; Fri,  4 Dec 2026 02:41:32 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 683672A256; Thu,  3 Dec 2026 23:41:22 +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=1796341282; b=PDNyVHGPaWIh+CmrEhohFZTwBUs1bCHKdEOFDQzQfY6OfpEc9f5A2i18HGZLyKOF3vBP 3Okg8V2TLmbrsItydLseEcVYQU84JJMqM3HCnRz8TUGqnYKsvOtEf9dnrLk0lKyZ/A50k Dq9NMgMLJtP90Mov2QD6XMNqv9YzZG01DopPbu6Y1JD0nMnLGgHEDuxmUgzFEjxpalVPb t2i4klYjf/xhTEef0Fc6P2WHDte3bRWSYapF3xCWIwVTYfcVRmaIp2jbOk3Q7N6+Iwe77 a5tDzZytRYL27Suu0ElITVNfBWNo9adS+x9RPllWrrB7YV9DSnKy+8zUZumpNh0bL8w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796341282; 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=rnYmp5x/rTsPcZyu0cOMIWEbuJtgD+ypy0xa5iof2Bw=; b=JLRDhubBHNQ2JCZbyKeYjnbfkyxMOFVRdBQKkYxqQ2hd1yRHwYIVZIipkD0UJWE49Z8g yj4ME5gH8sBe+6aafrlqOlhIbU4fSxaVS4a+6YwVwq/Rb5dD2HBUbwoqlzB6OaNzMnsxp ixV+6SsnVtC4oKchd/PubzAZ6WOwevM/Nr3Gjm2EPevt0grCuTCpVw9wAcjS+Wkn24ERy ZaZskIOTVKwV9NVLWO3tavDycf4rXl1pdolAhcjmHIxOvuQ+TF8Yz+/N3y61hWgNfrvgT zBxmxaWNHhnvGVyobt2UqfyNGIYa/QCkpl/8vjYWwqJt1EbcBH4j0WicBrpyYLIXLOw==
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=UoYaYErd; 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 327C3606A332; Thu,  3 Dec 2026 23:41:22 +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=UoYaYErd
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=1796341281; b=X1Z4GnszKEu3BmzmcCqUQUnzW/izsshDvSZ3fwpzrAvMTZE+TwnRE5uDtjg2BDEZ1IH9 7RqdZLG2/OXeI/qaNGZ8SiMgNuGD/Rhf5wPebjxkQ7Y6C4Otdd4pnqpRXrYcTWA/MsAs8 5CQDhjol12G+pv706M1rCCDqXVG+UmuhmuTBS7ezx5ux2z/o17b90lKtx9OfpOhFOq0tx LKLF5Uc2lLhcY38LMTKgOUERH/CDZSY4dQ5MbTXI3AYZwemP9ZzPAe1UYh1wdVvvmSYOr HnhA0DGmx+K7wO+kW0EWTdxphxshvS11epBW3gIIz2X02WMFnNAp5D0enxLjIgOvyGg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796341281; 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=rnYmp5x/rTsPcZyu0cOMIWEbuJtgD+ypy0xa5iof2Bw=; b=ikWBVQiW45P2FnY8z4g1ugFvvGYwLDDxPge47aw1zCic+uLm1ooxms6MoPLlRBBmPh/i oyLnac1NNeA0q73o1RpefaWzI29t3VuozpTrt5oOx7n13+4Ls5wagBle3wuTNN6m+qIzk fN5xjweLopUOPVmaf4JVQPzTo/xoxUIzZ8frlVPyd7j+yJ6O5D0RJYF6PXooWtBln1jY0 8Qrm7BfrujlDC35W4Pk/PyrD1HQ+o/bfgLiVKXrNoO8r5SwDeoTMhObizDPvInMDKHq29 oy4GOxRhxIqGKffXKk/nOSvcg37l+ejVFFrzr8GSNDNPGDn3CSSnaRWXBD/y1uQAukQ==
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=UoYaYErd; 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 501C5606A32F; Thu,  3 Dec 2026 23:41:21 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC9E71F00931; Thu,  3 Dec 2026 23:41:19 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796341281; bh=rnYmp5x/rTsPcZyu0cOMIWEbuJtgD+ypy0xa5iof2Bw=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=UoYaYErd7sY1gOsbspSgWyxgIiG3xzZ7XH/mV8M3Igs6mpOc7veHPIe5PoFdpoTfD 0c0C1Xs37LjsKkoVUaGEcgrtUKkEYji5igkJG116tR2dPpgKpv8t5UEii9rcRO6Wpb LMaqzr3K+ZakcPzyUUyC/HfP+H+3plI+KHRrRzXMizlQDP4iJXbmgMYmnJEpQfEN/L cnqACRiw6ew5udNMvLZ4Cf43UZjpvQeCuI/+pomfvV/GcZgyUF8U96xwAh2tijGqE+ zxaS/wSNmnvk894jLDBNdL0bP2yDathO+FGe1+gu4LNA+tQxorDGLmvySheNllyC7e 4zQtG3igj+ATA==
X-Cc: netdev@vger.kernel.org, horms@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, 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: <20261202224957.3043478-10-f.fainelli@gmail.com>
X-sashiko-severity: Medium
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