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
Subject: Re: [PATCH net 11/14] net: phy: as21xxx: Read 10/100/1000 link modes from C22 advertisement
Date: Tue, 01 Dec 2026 01:50:58 +0000 [thread overview]
Message-ID: <179608985834.3146.6893473863100169136@kernel.org> (raw)
In-Reply-To: <20261130-as21xxx-fixes-v1-11-1bd2eae6ccbc@collabora.com>
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
next prev parent reply other threads:[~2026-12-01 1:50 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 0:55 [PATCH net 00/14] net: phy: as21xxx: Fix a batch of driver issues Cristian Ciocaltea
2026-11-30 0:55 ` [PATCH net 01/14] net: phy: as21xxx: handle stale link status during autoneg Cristian Ciocaltea
2026-11-30 0:55 ` [PATCH net 02/14] net: phy: as21xxx: handle odd firmware on loading Cristian Ciocaltea
2026-11-30 0:55 ` [PATCH net 03/14] net: phy: as21xxx: Fix LED index bounds check Cristian Ciocaltea
2026-11-30 2:37 ` Andrew Lunn
2026-11-30 10:35 ` Cristian Ciocaltea
2026-11-30 0:55 ` [PATCH net 04/14] net: phy: as21xxx: Use the correct mask for the speed status Cristian Ciocaltea
2026-11-30 2:39 ` Andrew Lunn
2026-11-30 0:55 ` [PATCH net 05/14] net: phy: as21xxx: Correct the 10M speed status value Cristian Ciocaltea
2026-11-30 2:40 ` Andrew Lunn
2026-12-01 1:50 ` netdev-bot+sashiko
2026-11-30 0:55 ` [PATCH net 06/14] net: phy: as21xxx: Do not write the IPC reply to a NULL buffer Cristian Ciocaltea
2026-11-30 2:49 ` Andrew Lunn
2026-11-30 10:53 ` Cristian Ciocaltea
2026-12-01 1:50 ` netdev-bot+sashiko
2026-11-30 0:55 ` [PATCH net 07/14] net: phy: as21xxx: Write IPC payload under ipc_lock Cristian Ciocaltea
2026-11-30 2:53 ` Andrew Lunn
2026-11-30 11:09 ` Cristian Ciocaltea
2026-12-01 1:50 ` netdev-bot+sashiko
2026-11-30 0:55 ` [PATCH net 08/14] net: phy: as21xxx: Handle IPC payload write errors Cristian Ciocaltea
2026-11-30 2:54 ` Andrew Lunn
2026-11-30 0:55 ` [PATCH net 09/14] net: phy: as21xxx: Reject odd IPC payload lengths Cristian Ciocaltea
2026-11-30 2:55 ` Andrew Lunn
2026-12-01 1:50 ` netdev-bot+sashiko
2026-11-30 0:55 ` [PATCH net 10/14] net: phy: as21xxx: Fix LED hw control set for unsupported rules Cristian Ciocaltea
2026-11-30 3:01 ` Andrew Lunn
2026-11-30 11:29 ` Cristian Ciocaltea
2026-11-30 13:37 ` Andrew Lunn
2026-12-01 1:50 ` netdev-bot+sashiko
2026-11-30 0:55 ` [PATCH net 11/14] net: phy: as21xxx: Read 10/100/1000 link modes from C22 advertisement Cristian Ciocaltea
2026-11-30 3:34 ` Andrew Lunn
2026-11-30 11:53 ` Cristian Ciocaltea
2026-11-30 13:39 ` Andrew Lunn
2026-12-01 1:50 ` netdev-bot+sashiko [this message]
2026-11-30 0:55 ` [PATCH net 12/14] net: phy: as21xxx: Configure autoneg advertisement via IPC Cristian Ciocaltea
2026-11-30 3:43 ` Andrew Lunn
2026-11-30 12:05 ` Cristian Ciocaltea
2026-12-01 1:50 ` netdev-bot+sashiko
2026-11-30 0:55 ` [PATCH net 13/14] net: phy: as21xxx: Fix speed and duplex reporting Cristian Ciocaltea
2026-11-30 3:50 ` Andrew Lunn
2026-11-30 12:21 ` Cristian Ciocaltea
2026-11-30 14:01 ` Andrew Lunn
2026-12-01 1:51 ` netdev-bot+sashiko
2026-11-30 0:55 ` [PATCH net 14/14] net: phy: as21xxx: Release reset before reading ID in match Cristian Ciocaltea
2026-11-30 3:53 ` Andrew Lunn
2026-11-30 12:22 ` Cristian Ciocaltea
2026-12-01 1:51 ` netdev-bot+sashiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179608985834.3146.6893473863100169136@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew@lunn.ch \
--cc=ansuelsmth@gmail.com \
--cc=cristian.ciocaltea@collabora.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=hkallweit1@gmail.com \
--cc=kernel@collabora.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox