๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #7658

Re: [PATCH net v2 1/4] net: phy: as21xxx: handle corner case with link and autoneg complete

#7658
From: netdev-bot+sashiko
Date: Mon, 26 Oct 2026 23:07
66 lines
10299 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 for "net: phy: as21xxx: handle corner case
  with link and autoneg complete" describes the wrong condition.

--

net: phy: as21xxx: handle corner case with link and autoneg complete

This commit makes as21xxx_read_link() store the autoneg complete bit
from MDIO_STAT1 in phydev->autoneg_complete. When autoneg is enabled
but has not completed, it reports the link as down. This is the same
approach genphy_update_link() takes.

> Add missing case in custom read_link, when autoneg is started, autoneg
> complete bit is reset but link is still not up.

[Severity: Low]
Is this the condition the new code actually handles?

If the link is not up, MDIO_STAT1_LSTATUS is already clear. That means
phydev->link is already 0 before the new check runs:

	phydev->link = !!(status & MDIO_STAT1_LSTATUS);
	phydev->autoneg_complete = !!(status & MDIO_AN_STAT1_COMPLETE);
	...
	if (phydev->autoneg == AUTONEG_ENABLE && !phydev->autoneg_complete)
		phydev->link = 0;

The check only changes anything when MDIO_STAT1_LSTATUS is still set
and MDIO_AN_STAT1_COMPLETE has already been cleared. The in-code
comment, copied from genphy_update_link(), describes it that way:

	/* Consider the case that autoneg was started and "aneg complete"
	 * bit has been reset, but "link up" bit not yet.
	 */

Could the commit message be reworded to match? The case being handled
is that the link up bit has not been reset yet, not that the link is
not up.

It could also help stable backporters to state the user-visible effect.
Without this check, as21xxx_read_status() can move from link down to
link up while genphy_c45_read_lpa() is taking its
!MDIO_AN_STAT1_COMPLETE branch:

	if (!(val & MDIO_AN_STAT1_COMPLETE)) {
		linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
				   phydev->lp_advertising);
		mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, 0);
		mii_adv_mod_linkmode_adv_t(phydev->lp_advertising, 0);
		...
		return 0;
	}

In that case phy_resolve_aneg_linkmode() resolves speed and duplex
after the base page and 10G link partner bits have been cleared. The
link can then be reported up with an unknown or stale speed.

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261022222955.698722-1-ansuelsmth%40gmail.com
Technical Details
Message-ID: <179305602406.3134.12536030010913078225@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352106-linux-kernel-netdev=dewy.ru
References: <20261022222955.698722-1-ansuelsmth@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352106-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v2 1/4] net: phy: as21xxx: handle corner case with
 link and autoneg complete
Date: Mon, 26 Oct 2026 23:07:04 +0000
Organization: Usenet Network
Message-ID: <179305602406.3134.12536030010913078225@kernel.org>
References: <20261022222955.698722-1-ansuelsmth@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1418617"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:CdwHf72FrasVxZFiSp2hAsauiKc= sha256:/0UZn3Re8AgUg5N1jGw3thkVtSpm+lXo/+nfW+a3djQ=
	sha1:quH+UrMXBBdgVv3suPbz+NWvsJc= sha256:3vI+oe4uZsrmSzkwZulyrN74JX4KvAGO91vaD+WWB3I=
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 17F38125BD5; Tue, 27 Oct 2026 02:09:25 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.739
X-Spam-Status: No, score=-3.739 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.339, 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 aykUNzl74Nw2;
	Tue, 27 Oct 2026 02:09:21 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-352106-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 4E1B8125BD4; Tue, 27 Oct 2026 02:09:13 +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 B93342B503; Mon, 26 Oct 2026 23:07:06 +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=1793056026;
	b=B1WQxTxml/t1PtalV5CTIN2KJbFNwWE5/TsuyW2nSlxVXNzS3bXbpgez6NAMAGC1tA3D
	 Seg4aCvmKLGEAyWhqAyJE21aHZqb7vTq8FuT/P8l5BMPAw/yG6Zhv9ZhbPUVJ2IiD3+NF
	 LpGvmueNTCL+6rt4pPAqen0OY/9TPm2F2av5nrwX/nMrkrLzmDVKsZbD9KQB9HEHf1nmS
	 +M6UMAjk+pPNYlRE63Vj1V7PCJccUlHrYcvbvbqkaNNNIQeVVxmjwICXENHeTmNrc+8le
	 jSS7dr0gLBj9Kdq2tfzzuTsytKvx47Jt+ssUe24+AIvNwvZgNHhlvIRendWO8ZJ5a1Q==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793056026;
	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=oPD5SqKlTZOC0NnEMGcHJVShraHtb9hDhDLXr3wErmU=;
	b=Fq6dU/VNbZr1DSbAyOgkVBXFLJuNOGc5p8hJ/Fox49Sjk088OY5YdiU7Ihdr5s8IXnK9
	 mGjrMWQa5Kba7BJicRNifpyL0vr6lLo+AVWo8NjHR6kWlvRuHEVlJzBkqmqoIfO4NWOKk
	 KKFGul53iNCqj/jyX/EtTAzfnex24r+lE0RcDZdwMiMARsK7765wU9p+IgblKJ6zo24wO
	 8PyVPJdBeB0h2cKUxVmUxdRhIfKHaP3wliLHGueyMrgV2NuQg4ttYMCBpQkvNCeeiZUie
	 6IsOHXX+1GgD9oEfCpX+m862cp0rIXtDe5cwOXNumO4yDtkOMUtp1x5ElPX4SY5ZwKw==
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="mz/ypiZT";
	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 8FC82606A323;
	Mon, 26 Oct 2026 23:07:06 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=mz/ypiZT
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=1793056025;
	b=BkOhwIML2gtr+jVXOXlw2EBQbweCOCcro29k+g37TkCimP8BUWu1x4qYsw88Wr+c4z+h
	 /PGhpLwt6ylUPOUAkb2dGWLNEnZsezYivFy1qXzijP/xwx/f1VVfOZt9Kz7unKRNu01vi
	 gD4N2uAgt2HUgc3//PShcciHScUwj6bAMNHU9CftmN4K/oBPBnseQQTLl05NuLYizWAOL
	 L3CK3/a86nrskj7ClKNzMwJAEjNb8P06zPQtjDwLFoTDS8p1Yz9Hm4KCWLVQ2jTzJh2RI
	 GpOIwmMrxL9TV+7HzvsTFOPKdt+tNyxgqwobr0Cb9XEWr+B5oUYDEM3S+RshNGXe2lQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793056025;
	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=oPD5SqKlTZOC0NnEMGcHJVShraHtb9hDhDLXr3wErmU=;
	b=NXX9K45gaCahflBMIQXrGXSVx4UG2IW0YZsdnsnEveYK6p7YxjeWvWedWVmaM3qkJPWy
	 2cQ4lC/G7Cqa5KaNhS7wdbIq4rWXZibr7qdmdskEPgIU4Q51gT7Y/K1KELkEHD1Gm9TeZ
	 +ahkjBqTjkq5oNhpXR3SN67htT+8GXxuQ7e53yuIX0uAozGb0eQj7zYQfSlKUapP2CVca
	 sgQQjjyy7uE0brDguj8F4PFTFwCU8iE2yyeAvG0viy+hbmuNqo4rmyQlsCLrA2ExuBX6F
	 mnZeGg8c4BabWa+mO9mtN707vogmcF7ki3bKM166uZcAqPzmsztCVntrjc7kt97j4Kw==
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="mz/ypiZT";
	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 72E43606A322;
	Mon, 26 Oct 2026 23:07:05 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 787EB1F031E1;
	Mon, 26 Oct 2026 23:07:04 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793056025;
	bh=oPD5SqKlTZOC0NnEMGcHJVShraHtb9hDhDLXr3wErmU=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=mz/ypiZTINTy1u8SRMIn/2UCfkCCeTs6Ki6fA97t4Vz0KTe9Z1aEIG84Ad2KXwE5f
	 E3wQ3P4IhKoNZzN1ZMgEZvLboEHEvDJ07CS2JsRv+DYQfcUwNB9vEEbA7lPu8eqiD+
	 XRXVLLKO6v80TFKmIOYGhh6yziDTJrHi/AKVlrjUca8e/i9VcL7pObgzeT3O0nCKGs
	 aCBSSH/hPhtAluQvlFpqTowdQTD00w6FKu9UJsAlgLD1TWF3nR1eSn6MhF6rifc6oo
	 4Z6kPmcKrVcI/fB16MsNfVcyzCp3Z1Ecs4jFylLR60cd+X5sNwmophUjGufEe1nXEZ
	 O9U/pQlmAm51g==
X-Cc: andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk,
 davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 netdev@vger.kernel.org, linux-kernel@vger.kernel.org
X-In-Reply-To: <20261022222955.698722-1-ansuelsmth@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