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/2026…%40collabora.com