🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24893

Re: [PATCH net 05/14] net: phy: as21xxx: Correct the 10M speed status value

#24893
From: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 01:50
128 lines
12837 bytes
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · 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] This patch only works together with the commit before it,
  "net: phy: as21xxx: Use the correct mask for the speed status".
- [Medium] (Baseline decision: discard, because it is resolved later in
  the series; kept here only because requires_validation=true.) The…
- [Low] The commit message says the failing switch is in
  `aeon_read_status()`.

--

net: phy: as21xxx: Correct the 10M speed status value

This commit changes VEND1_SPEED_10 from 0x0 to 0x40, the value the PHY
reports for a 10M link. The commit message says the wrong value was
hidden because the speed status was masked with VEND1_SPEED_STATUS
instead of VEND1_SPEED_MASK.

> Attempting to force a 10M link would therefore match no case of the
> switch in aeon_read_status() and make it fail with -EINVAL, generating
> the following splat:

[Severity: Low]
This isn't a bug, but there is no aeon_read_status() in drivers/net/phy/.

Should this say as21xxx_read_status()? That is the name the companion
patch "net: phy: as21xxx: Use the correct mask for the speed status"
uses.

> diff --git a/drivers/net/phy/as21xxx.c b/drivers/net/phy/as21xxx.c
> index ff6c2005c442a..8d46fdfc279a7 100644
> --- a/drivers/net/phy/as21xxx.c
> +++ b/drivers/net/phy/as21xxx.c
> @@ -47,7 +47,7 @@
>  #define   VEND1_SPEED_2500		FIELD_PREP_CONST(VEND1_SPEED_MASK, 0x9)
>  #define   VEND1_SPEED_1000		FIELD_PREP_CONST(VEND1_SPEED_MASK, 0x10)
>  #define   VEND1_SPEED_100		FIELD_PREP_CONST(VEND1_SPEED_MASK, 0x20)
> -#define   VEND1_SPEED_10		FIELD_PREP_CONST(VEND1_SPEED_MASK, 0x0)
> +#define   VEND1_SPEED_10		FIELD_PREP_CONST(VEND1_SPEED_MASK, 0x40)

[Severity: Medium]
Does this patch only work when the previous one, "net: phy: as21xxx: Use
the correct mask for the speed status", is also applied?

Both patches carry only:

    Fixes: 830877d89edc ("net: phy: Add support for Aeonsemi AS21xxx PHYs")

At 830877d89edc, as21xxx_read_status() does:

    switch (speed & VEND1_SPEED_STATUS) {

VEND1_SPEED_STATUS is 0x4002, so 0x40 & 0x4002 is 0x0, which matched the
old VEND1_SPEED_10. The commit message says forced 10M was reported
correctly there. If so, the splat quoted above can't happen at
830877d89edc.

The splat seems to come from the mask patch instead. Once the switch uses
VEND1_SPEED_MASK, 0x40 no longer matches VEND1_SPEED_10 (still 0x0), and
as21xxx_read_status() falls into:

        default:
            return -EINVAL;

That leaves a bisect hole for forced 10M between the two patches, for
example with "ethtool -s <if> speed 10 duplex full autoneg off".

The opposite case looks worse. Stable could pick up only this patch on
top of 830877d89edc based on the Fixes: tag. The switch would then still
mask with 0x4002, so the masked value could only be 0x0, 0x2, 0x4000 or
0x4002. None of these match 0x3, 0x5, 0x9, 0x10, 0x20 or 0x40.

Wouldn't every forced speed then hit the default case, return -EINVAL and
put the PHY into PHY_ERROR?

The mask and the 10M value were both wrong in 830877d89edc, and the fix
only works when both change. Could the two patches be squashed, or could
the dependency at least be stated explicitly?

[Severity: Medium]
Can an all-zero speed field now make as21xxx_read_status() fail while a
forced-mode link is down?

At this commit, the forced branch decodes the speed status without
checking phydev->link:

    } else {
        ...
        speed = phy_read_mmd(phydev, MDIO_MMD_VEND1,
                             VEND1_SPEED_STATUS);
        ...
        switch (speed & VEND1_SPEED_MASK) {
        ...
        default:
            return -EINVAL;
        }

That includes an unplugged cable, and the case where as21xxx_read_link()
returns early on BMCR_ANRESTART:

    if (*bmcr & BMCR_ANRESTART) {
        phydev->link = 0;
        return 0;
    }

Before this patch, VEND1_SPEED_10 was the only case that matched 0x0. The
firmware might report 0x0, or another unlisted value, while the link is
down or the speed is not yet resolved. Every poll would then return
-EINVAL, and phylib would move the PHY to PHY_ERROR. Without a datasheet,
it isn't clear what the firmware reports in that state.

A later patch in the series, "net: phy: as21xxx: Fix speed and duplex
reporting", appears to fix this. There, the forced branch only calls
as21xxx_read_speed() when phydev->link is set. Its default case sets
SPEED_UNKNOWN with dev_warn_once() instead of returning -EINVAL.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-as21xxx-fixes-v1-0-1bd2eae6ccbc%40collabora.com
Technical Details
Message-ID: <179608985188.3146.1203400149585184164@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374614-linux-kernel-netdev=dewy.ru
References: <20261130-as21xxx-fixes-v1-5-1bd2eae6ccbc@collabora.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374614-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 05/14] net: phy: as21xxx: Correct the 10M speed status value
Date: Tue, 01 Dec 2026 01:50:51 +0000
Organization: Usenet Network
Message-ID: <179608985188.3146.1203400149585184164@kernel.org>
References: <20261130-as21xxx-fixes-v1-5-1bd2eae6ccbc@collabora.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1586766"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:nHCroDfiyK9RuJsSzMdGSS1UR3M= sha256:sFdwSvaYKf57P8hF+ZQqY/X9unJC+8rDwWIesYqPS4w=
	sha1:WveTKDvd72Mp0Q6NN4YqIFggJAg= sha256:vynbryXk4dDxpZ2/O/3Pk4Eb5RU2SbjN8USWOWLIchA=
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 26B111171F5; Tue,  1 Dec 2026 04:51:14 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.5
X-Spam-Status: No, score=-3.5 tagged_above=-9999 required=6.31
	tests=[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 y-uj3lMMwlUq;
	Tue,  1 Dec 2026 04:51:06 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-374614-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 390841171ED; Tue,  1 Dec 2026 04:50:56 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 4613E601B40; Tue,  1 Dec 2026 01:50:56 +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=1796089854;
	b=aNkaYW4V2Im+fWHWVasZz0RVbbsjO5eo1Ug+yPWl96Fg6gIPa8tUMCyt7eSHviYqsOso
	 GfTZRM+SmBP8cU/P9inZBWBIxQi7YTfNjlUytwYi8b/L7eCdqBo+t2MbAfsJUH+mraxAV
	 KmurSv+GW0iboPHapzBES42KDvs7/Nse+eVlueg+MvE6iN3XAZZZvnaBflVes9zOtG1OI
	 PeoirEDRVLtkgNQxtc00QwxPC3fD51op9M2u4oEbZcHDmkGLkaFn/J0MCs/JLTt5wbVs7
	 YjOfk7a2UdJL0fUPazGW35lp1XQEdcg5auxVDI2apBa8FAaHTNYUZun82I6SjW92v6g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796089854;
	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=Kp9qv61D0oY3OF1pU7C3fUM7flDYCR5uJcMnrfsnBB4=;
	b=pypvM4EB51D347g9hnnvWhyC2SXP1sR8fPtfYUokQvYv0fWT1Uc4Vbb96uxz4j/z8B8p
	 xzmt/2SWawBsZM0KNkHZE8FhX/1rA0+ycLoBg9SiQCRWgwMw4Kfyoy4tBI2LlG9cdj7Mx
	 mNCyHspB7zUYb6Iv9oI24HAzrR3rZ+kn9ULKxBQV8FGyI1zYwZ2ERFRFJM22vH8xNLm0o
	 c+cbrk22ls2ycjMJxLrwUxsPVnQka47hd35L5ipZixiXW2I1eWs/ISNidUP9uGHs1Ykcr
	 6vc0sv1CS9xgacTd0yPnkX3b98c6VWDLDH4nkhE1k3rmSVxa8Nb1U8e3/BGWdapqYvw==
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=lrYffNxI;
	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 4FA3D606A32C;
	Tue,  1 Dec 2026 01:50:54 +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=lrYffNxI
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=1796089853;
	b=xEPQaY/WYkmrGf5nFQCL79Da9bElJKxXkegyH+PmJ4YwIl3F5iTIMJbAKgR+jLCVU3Bf
	 bZ7wpaptFBzJ/fGf6ymTWshtTFSM/Rl9lhV4HYShE+tG5AmTdrQyPfEGbJ2P1YeVs42C5
	 ag0fOvWo1U6vVBaxlxebXFxQGHghLO5qh0iXXKC0gvPycI1d9GehTuo/VrEfyYHj6d+Ff
	 D2dMSmvKaN8sstQFr9gsLyfkFV03/jzGbi3Ekft7Y+8+WjTHKLRadCh5o/8+OozIeLPdc
	 rNjmc0VkLwbtAjySkPBrhLMmzebaJTWANfTQibau0W/81RCMRlcGcwX4EnSKgFCJPIQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796089853;
	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=Kp9qv61D0oY3OF1pU7C3fUM7flDYCR5uJcMnrfsnBB4=;
	b=yn4tWfoARw/vPopI45epyFAKL8Gy0lJOfjhYknQRgF4bFmFvM7otyNyIr2ukhyJrpwDp
	 YhaBtqSh358JJ0UCEyVZZKnmdRP4kjUhXdaF+U8dszkpHQtb9EmMPFVJkbm8wOwDkNgUT
	 x+8Ve1Rb5V2lJhsy3IVVchHzCPEISskmQMSjfbmuDPOuqBk38jlixacrW0l/RX6gCBgHU
	 IJXPL3PS5Ye7OH5/0iiJPscpZ+92kCCKPtQ10YFPuqfL6GWtVoN6LFoNbc2CLOp4de7tS
	 4nqhZ541AOs47by8LfkKJciiembZvaMGK7sSx+RgGwtEMihfe48MyH2PORbyzhl/5FQ==
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=lrYffNxI;
	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 6C336606A31A
	for <netdev@vger.kernel.org>; Tue,  1 Dec 2026 01:50:53 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 673A31F000C1;
	Tue,  1 Dec 2026 01:50:52 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796089853;
	bh=Kp9qv61D0oY3OF1pU7C3fUM7flDYCR5uJcMnrfsnBB4=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=lrYffNxItX7yipYXk/OYpvBH2YbjaU0CpRQCdbJC6j30FhdV22wnGR+INkZEk2jn3
	 enT5AIJVn9kReX5lrM7B9sZZW0Jkhn0lzfjtsvT0N8rhtB7BqlEYATrkdIUBcTfBEz
	 2BFT8mR2+k7JcASl0hip/lhORQsCkIKZckwJWhMakSRGVvc24CdYQAlB7JVDehTgon
	 lCRv8jlrjWhaQinSjmCG4MPRELIC1nB3tndpzWRcz553KRhYWZPhb8o3qxwwptD+se
	 Z5YJqeMWDywZS3G8HVofCbM+EtvOMkmN6sDbq4NKKh7oUKTbux4fJLLJsRZZUD7Lg3
	 50KngCEsEY21Q==
X-Cc: ansuelsmth@gmail.com, andrew@lunn.ch, hkallweit1@gmail.com,
 linux@armlinux.org.uk, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, pabeni@redhat.com, kernel@collabora.com,
 netdev@vger.kernel.org
X-In-Reply-To: <20261130-as21xxx-fixes-v1-5-1bd2eae6ccbc@collabora.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