From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796089859; b=vqcrjAE0f4+Yj9FWeepoa46tBrGEHFMCdr1C3Rt8QSriuWWL8jdfzmNY5hxtm57cmOCl 7ZgLW1OrxyOCu/ngF59RirKrcAM5RbrZ+rPxpVhNhSw060qQV/uchEK/cxb9JUXzeQVRp dGoBKJ58YyC5Sa7QGxhmGMjCC83DmokErHW4AT7wq6gkWwOgQQrGKFYQhINJZi31Sl4Zt z+VBMWTd5ImV8CxALjr3sOmn95qulAinuvDdoZLQdFw6lJI8AMnzgWzFa2oc4G3XFdJS+ 5iX08DOHyqL32QyBdmOGOjefVilk1KvHZjMbTLF5ptY0uqRtV/JL2j5oCg7Ud7dgSUQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796089859; 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=kM+7QbZ2CeF6cG0IgYOKVyk3RyB4RHDnI4OP3SIIycc=; b=toMl0m84DELlnDAXW5TtmE32JOKWsEDVRsNevVMk7+/fHL3scJ3IHEWwsZx5gDAVHTBS a14+IvklQHUc/xuwlnihu0tzYBxEBa9iErqJ90M8pMMSUZ+hahd1DIjWDTIvlasTpYtgG 6xljXM4uhFXH2HZOi964uRHygFwmKhuXxHyPM8xBBhrypkCALk5xWUXqYcwbZnpgmaX25 3aopcGnas4dAr0DYerQpIG5ZqjLv3HayCYh1DijDIex5TPg8PRXtYmgVuobRiwjEo8gUe QdDNxlCjXHQZxSNPOQ8b793011iVx3B5aJHco56oSFiD7UK6tRkZW7b5mlm6EJ4xyYQ== 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=GVJNagRr; arc=none smtp.remote-ip=100.103.45.18 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 8A559606A33E for ; Tue, 1 Dec 2026 01:50:59 +0000 (UTC) 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=GVJNagRr Received: by smtp.kernel.org (Postfix) with ESMTPSA id C63F51F00898; Tue, 1 Dec 2026 01:50:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796089859; bh=kM+7QbZ2CeF6cG0IgYOKVyk3RyB4RHDnI4OP3SIIycc=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=GVJNagRr8tldSKxG83F1kuTi5l/z1cgEaYW896xzvFZbnYSbCgg29V8btT2dsj71U 8UhoJRwQKRiY547RUjkESiY/t1ODR06MCdyJQswnXYj0QTdEmXqVPH67xtn/OEpb5z Xj+29tXyml6E0g0ethhWnzP7LwgKAoO4kAULW09Og/PVwgSFynfU8rWQn4QlfuJzE4 Sh95YHh/gFYAE5Bzk9lLeIV4WetNTxQkFLmgjvT9MybFXWTijp7y+VoGTnMgQ1wWy3 L1oVTi/ffXEg82BzqHBAdh753GI91JrSK9PdXT+IGYC0JX2Mt4abVzBq1h2QpJHstA gc7R3X3cuUVcw== Subject: Re: [PATCH net 11/14] net: phy: as21xxx: Read 10/100/1000 link modes from C22 advertisement From: netdev-bot+sashiko@kernel.org To: cristian.ciocaltea@collabora.com 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 Date: Tue, 01 Dec 2026 01:50:58 +0000 Message-ID: <179608985834.3146.6893473863100169136@kernel.org> In-Reply-To: <20261130-as21xxx-fixes-v1-11-1bd2eae6ccbc@collabora.com> References: <20261130-as21xxx-fixes-v1-11-1bd2eae6ccbc@collabora.com> X-sashiko-severity: High Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider. Critical: 0 · High: 1 · Medium: 0 · 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). - [High] The commit message promises something the code does not deliver: "The PHY is reset when the driver is unbound, so it reports the… - [Low] as21xxx_get_features() falls back to the C45-derived modes when either register lacks the relevant bits: `!(adv & ADVERTISE_ALL) ||… -- net: phy: as21xxx: Read 10/100/1000 link modes from C22 advertisement This adds an as21xxx_get_features() callback. It reads the 2.5G, 5G and 10G abilities from the Clause 45 registers, then takes the 10/100/1000 link modes from the C22 ADVERTISE and CTRL1000 registers mapped in the AN MMD. If those registers do not have the expected bits set, the Clause 45 derived modes are kept. > diff --git a/drivers/net/phy/as21xxx.c b/drivers/net/phy/as21xxx.c > index 1c4a808bf01e9..3423448a0cb1c 100644 > --- a/drivers/net/phy/as21xxx.c > +++ b/drivers/net/phy/as21xxx.c > @@ -644,6 +644,61 @@ static int as21xxx_probe(struct phy_device *phydev) > return aeon_dpc_ra_enable(phydev); > } > > +static int as21xxx_get_features(struct phy_device *phydev) > +{ > + int ret, adv, ctrl1000; > + [ ... ] > + adv = phy_read_mmd(phydev, MDIO_MMD_AN, > + AS21XXX_MDIO_AN_C22 + MII_ADVERTISE); > + if (adv < 0) > + return adv; > + > + ctrl1000 = phy_read_mmd(phydev, MDIO_MMD_AN, > + AS21XXX_MDIO_AN_C22 + MII_CTRL1000); > + if (ctrl1000 < 0) > + return ctrl1000; [Severity: High] Does this always sample the firmware defaults? The commit message says: The PHY is reset when the driver is unbound, so it reports the generic pre-firmware ID again and the firmware is reloaded from .match_phy_device() before the next probe. Hence .get_features() always samples the firmware defaults. as21xxx has no .remove or .soft_reset callback. The only reset on unbind is the one in phy_remove(): drivers/net/phy/phy_device.c:phy_remove() { ... /* Assert the reset signal */ phy_device_reset(phydev, 1); ... } That call ends in mdio_device_reset(), which returns immediately when the board describes no reset line: drivers/net/phy/mdio_device.c:mdio_device_reset() { ... if (!mdiodev->reset_gpio && !mdiodev->reset_ctrl) return; ... } On those boards the firmware keeps running across a sysfs unbind/bind or a module reload. On rebind, as21xxx_match_phy_device() reads the post-firmware ID and returns early without reloading the firmware: if (phy_id != PHY_ID_AS21XXX) return phy_id == phydrv->phy_id; as21xxx_get_features() then reads ADVERTISE and CTRL1000 in whatever state the previous session left them. The commit message itself says these registers mirror the current advertisement. The later patch in this series, "net: phy: as21xxx: Configure autoneg advertisement via IPC", changes that advertisement through aeon_set_top_speed(). Suppose the previous session limited it to 100M, for example with "ethtool -s ethX advertise 100baseT/Full", which selects IPC_CU_AN_TOP_SPD_100. CTRL1000 then reads back with no 1000 bits and the fallback below is taken. That leaves 10baseT/Half and 100baseT/Half set in phydev->supported again. Doesn't that bring back the problem this patch is meant to fix? In the final series, as21xxx_resolve_duplex() uses those Half bits to report DUPLEX_HALF on parallel detection. The same thing can happen if a bootloader loaded the firmware and changed the advertisement before Linux probes. Boards with a reset line have a separate problem at this commit: match runs while the PHY is still held in reset, because phy_probe() deasserts reset only after the bus match. The last patch in the series, "net: phy: as21xxx: Release reset before reading ID in match", fixes that case. Its own commit message says the deassert "does nothing when the PHY has no reset described", though, so the case without a reset line is still open at the end of the series. Could the default top speed be restored before these registers are read? Alternatively, the firmware could be reset or reloaded on unbind, or the modes could come from a fixed capability source. Either way, the commit message would need to be corrected. > + > + /* If the firmware defaults are not available, keep the C45-derived > + * modes rather than dropping all 10/100/1000 link modes. > + */ > + if (!(adv & ADVERTISE_ALL) || > + !(ctrl1000 & (ADVERTISE_1000HALF | ADVERTISE_1000FULL))) { > + phydev_warn(phydev, > + "Empty C22 advertisement, using C45 abilities\n"); > + return 0; > + } [Severity: Low] This isn't a bug, but the check here ORs the two registers, while the commit message says the fallback happens only "If the advertisement reads back empty". Take the case where ADVERTISE has valid 10/100 bits but CTRL1000 has no 1000 bits, which is the state an advertisement limited to 100M leaves behind. The advertisement is not empty. Even so, the valid 10/100 data is thrown away, the C45 modes with both duplexes are kept, and the warning says "Empty C22 advertisement". Could the two registers be handled separately, with ADVERTISE used for 10/100 and C45 or CTRL1000 used for 1G? If not, could the commit message and the warning text describe the condition the code actually checks? [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-as21xxx-fixes-v1-0-1bd2eae6ccbc%40collabora.com