๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #17187

Re: [PATCH net v2 11/12] net: au1000: keep the MAC stopped until the PHY link is ready

#17187
From: netdev-bot+sashiko
Date: Mon, 16 Nov 2026 13:50
114 lines
11728 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit message and comments in this patch don't match the
  code.

--

net: au1000: keep the MAC stopped until the PHY link is ready

This patch stops the MAC when the PHY reports link-down. On open, it now
calls phy_resume() before au1000_init(). It also keeps MAC RX/TX disabled
in au1000_init() until au1000_adjust_link() has seen a link-up.

> diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c
> index 8b7a88ceb3c5e..d60430a3795ed 100644
> --- a/drivers/net/ethernet/amd/au1000_eth.c
> +++ b/drivers/net/ethernet/amd/au1000_eth.c

[ ... ]

> @@ -691,8 +692,8 @@ static u32 au1000_rx_mode(struct net_device *dev, u32 reg);
>   * When the device powers up, the clocks are disabled and the
>   * mac is in reset state.  When the interface is closed, we
>   * do the same -- reset the device and disable the clocks to
> - * conserve power. Thus, whenever au1000_init() is called,
> - * the device should already be in reset state.
> + * conserve power. The device must be stopped before au1000_init() is
> + * called, but may be out of reset for MDIO accesses while resuming the PHY.
>   */
>  static int au1000_init(struct net_device *dev)
>  {

[ ... ]

> @@ -928,11 +934,25 @@ static int au1000_open(struct net_device *dev)
>  		return retval;
>  	}
>  

[ ... ]

> +	/* Restore the MII clocks without starting the PHY state machine. */
> +	if (dev->phydev) {
> +		retval = phy_resume(dev->phydev);
> +		if (retval)
> +			goto err_reset;
> +	}
> +
>  	retval = au1000_init(dev);
>  	if (retval) {
>  		netdev_err(dev, "error in au1000_init\n");
> -		free_irq(dev->irq, dev);
> -		return retval;
> +		if (dev->phydev)
> +			phy_suspend(dev->phydev);
> +		goto err_reset;
>  	}

[Severity: Low]

Can this error branch in au1000_open() ever run? au1000_init() has only
one return statement:

drivers/net/ethernet/amd/au1000_eth.c:au1000_init() {
	...
	spin_unlock_irqrestore(&aup->lock, flags);
	netif_addr_unlock_bh(dev);
	return 0;
}

au1000_enable_mac() returns void, so nothing in au1000_init() can fail.
That makes the new phy_suspend() rollback look like dead code, even
though the commit message describes it as:

    if initialization fails, suspend the PHY again before cleanup.

The commit message also says:

    Initialize the MAC before phy_start() so the PHY worker cannot access
    MDIO or enable traffic during setup.

Didn't au1000_open() already call au1000_init() before phy_start() before
this patch? The diff shows that order as unchanged context.

The actual changes seem to be the new phy_resume() call before
au1000_init(), and making RX/TX depend on aup->old_link. Could the commit
message describe those changes instead?

Separately, the au1000_init() header comment now says the device "may be
out of reset for MDIO accesses while resuming the PHY". The comment in
au1000_probe() was not changed and still says:

	/*
	 * The boot code uses the ethernet controller, so reset it to start
	 * fresh.  au1000_init() expects that the device is in reset state.
	 */

Should these two comments be reconciled? They now give conflicting
preconditions for au1000_init(). Neither is strictly accurate, because
au1000_init() always forces a reset itself through
au1000_enable_mac(dev, 1).

>  
>  	if (dev->phydev)

[ ... ]

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112045301.3669532-1-f.fainelli%40gmail.com
Technical Details
Message-ID: <179483704995.3136.5707920157509018990@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364359-linux-kernel-netdev=dewy.ru
References: <20261112045301.3669532-12-f.fainelli@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364359-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v2 11/12] net: au1000: keep the MAC stopped until the
 PHY link is ready
Date: Mon, 16 Nov 2026 13:50:49 +0000
Organization: Usenet Network
Message-ID: <179483704995.3136.5707920157509018990@kernel.org>
References: <20261112045301.3669532-12-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="2076525"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:EcYLeqFpxCT0jTezFofs6cSIKPc= sha256:n77gYQI7WHOiM/nO/cELy/ysyylDcAEYAVGrkRf581Q=
	sha1:MlwKAxOKDh4AuNXAtKMpMTnWPKI= sha256:OOZnCYT0ZZmCaDFyDX5N2HHzJWuhHwTCDDd9xBySfhE=
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 C81DA114C35; Mon, 16 Nov 2026 16:51:44 +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 a3idScclHYyy;
	Mon, 16 Nov 2026 16:51:40 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-364359-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id DBAE8114C32; Mon, 16 Nov 2026 16:51:31 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 83CF221521; Mon, 16 Nov 2026 13:51:29 +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=1794837057;
	b=0XkoRsF+2ErAHDCu1i/4/kzQAhckfgBL+1fJmCRI1bOSeJDFPDU6VSTGzTl8lfzsf4QF
	 KUyGyeD6xE7Dbynlliet2GtSb2P8HopPWIE9Wf1ePRSQW3Oz9o05AKGQ8VLJeIRPIAcs6
	 uo1+oec592u6yQ8vu3Bb18rE5Gkp1STSYlRzGDfQ7u8QwblguRN6IPSXouZVW9nbVEX4c
	 5n8aaULRY+63ninG8nh8ZirTNuhiEpDkcEceq/9F6xyCieHikXl037f/vzNeraNoBrzIw
	 YFjEyX7hLhCyTl2vLlIS4+tDoi6INsrhGnCSgkVXXKoEafncmPmDz/EdzYcPNwE2MVw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794837057;
	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=EeDl7bbI7LCiKb5h7E9ZI6fEwc5/yvL/KpqTYXXHOMw=;
	b=mTaRIjmruGH5+IetiyHxJyg7A0mw4O606Yff5F4mYq0u4pv419k+bNSroHQaDKeNIPDO
	 vBwI/XUZ1es03SX94M0lbll2sBB9Z9mhtUFz1sl76tfPgOTsIC2WYfKSiTsnLHiEvLd24
	 QfaEkoFLwJarzpviw4c9t42HDW887hVZtXMyUcT7qy2RyQCZE0TSaufsE6B0MlsVtCIgo
	 p3tHdqULSt3jc5xs1wvAz4XSfBFdhfgxXRnq3w/L3uZvuLB9Bo+2s60/Hww3l4vhv3d7j
	 Jui8IhuovNb311ROh8Xi+rtTStklImG6OD5HeJr5P6hbIHSaY6sM5WjeedWEngW4FFg==
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=Oj4HjDXH;
	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 B4D5260A381A;
	Mon, 16 Nov 2026 13:50:57 +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=Oj4HjDXH
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=1794837051;
	b=fjzjoIKVge56ltIU4aJsPdNS9VHU1hd0BkNs+UAAtD1br0J/5NYCWPMELJ2TjpaAJfl2
	 C4/t8ukdRILYv58y+b9pkEa/Uqgrtb5Shi+nAKpjCOeoTDKi56dagYoudrq1oxekUIQ5V
	 itdLddGQHyXbUQPElNAe+HEE8KVIREZ4V1KBmwkJsLyJgwwEarG6Sk3DjVYsFaOwPr5lo
	 y8jAsMUqiEvYBOVrMzOcT0l5TOgk7DXOq19QfD1RdwmOTkZfnLlXV00PLkTNQsPrSch0s
	 VRFNOOtR9mavqvFJI95IddRBd80KegxNCnn7Z37nri6eOmnNQQ9YNOnsPn69tL4hRlg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794837051;
	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=EeDl7bbI7LCiKb5h7E9ZI6fEwc5/yvL/KpqTYXXHOMw=;
	b=uiCCWV/2uNVJB2S/qgsugFndMCYBZbWsMyMprrd0KERQThkXavQTaPQMhwDpCAsXq9ob
	 2ifPrCWyHlKzAj8FeYdBi/uGb+mfDR5mH8fk1/xt91jjP8EHMKOv7q2DZvZD5j7HStgc8
	 pblwVrbi92WBlhb2yTwhkMFZE0VkVm4aBWckaXsL4OEbsqxXKG1/7hBv6Xd6lE8+dNkUj
	 8H3vr5CoYnWufdQpJnWbS4tPErvybXLboVrrOg9vYx7W8tWnpSNOjTgk/gk9dvMVQKJoh
	 pwQZqyiDxushwLEiLLIoKVAXfFIYILs/8ouJAQ3Rd0msBGcfeFn9BhY11RsA4L7JnKw==
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=Oj4HjDXH;
	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 D41D060A262A;
	Mon, 16 Nov 2026 13:50:51 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DDD31F0182D;
	Mon, 16 Nov 2026 13:50:50 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794837051;
	bh=EeDl7bbI7LCiKb5h7E9ZI6fEwc5/yvL/KpqTYXXHOMw=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=Oj4HjDXHhFsZ5UxPZYFtazBHZTpjYPeQRgPrAt3SO/FK0/ZD+/oHcw2KdHoKs8NUe
	 Uyl11iJBxfwXcYT4uVhg1r9XqE2Ht2cMTSxHbXkoi72Sj7dpquUyBPL/swBFYiH+Ys
	 evNFkf35AZ1vXhtF9WFfUS0JevDdAt9dB9843g2MT7ed7SS54fyLDYNrOYNkH6h87C
	 xIReujsr6tv3O2+WHx9VZCJiubBd1WAbqFW0Efosx4fXqYkeNntLaqBijkg5qCRfl4
	 e/P4Ax6xqR5HBYnRfmK4/lSrYV5nhDji5WaolbbPwGyG4EswO4d4BRinfHzLsxDFjA
	 yDK+7AzR3xxpQ==
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, jeff@garzik.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: <20261112045301.3669532-12-f.fainelli@gmail.com>
X-sashiko-severity: Low
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