Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider. Critical: 0 · High: 1 · Medium: 0 · Low: 2 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] Forced mode: as21xxx_read_status() can still leave phydev->speed = SPEED_UNKNOWN, which is the failure this patch says it removes. - [Low] The LPA_1000MSFAIL check in as21xxx_read_lpa() now only runs once the link is up: as21xxx_read_status() returns early at 'if… - [Low] The commit message justifies the duplex resolution with 'Since aeon_config_aneg() makes phydev->advertising reflect what the firmware… -- net: phy: as21xxx: Fix speed and duplex reporting With autoneg enabled, this patch takes the speed from VEND1_SPEED_STATUS instead of resolving the advertisements. Duplex and pause are then resolved from the link partner abilities, which are read from the mapped C22 registers and the 10GBASE-T status register. With autoneg disabled, it reports the PMA-programmed settings via genphy_c45_read_pma(), and overrides the speed from VEND1_SPEED_STATUS once the link is up.
> Use VEND1_SPEED_STATUS, the authoritative source, on the autoneg path > too. Since aeon_config_aneg() makes phydev->advertising reflect what > the firmware puts on the wire, it is still reliable for picking the > duplex mode at that speed: resolve duplex from the link partner
[Severity: Low] There is no aeon_config_aneg() in drivers/net/phy/as21xxx.c. Should this be as21xxx_config_aneg()? That function and its advertising expansion ("Let the advertisement reflect the slower speeds which go on the wire along with the highest one") come from the preceding patch, "net: phy: as21xxx: Configure autoneg advertisement via IPC". The baseline driver has no config_aneg callback at all. Both patches carry only the Fixes: 830877d89edc tag, with no dependency note. If this patch is backported alone, as21xxx_resolve_duplex() would run this line without the implicitly advertised slower modes in phydev->advertising: linkmode_and(common, phydev->lp_advertising, phydev->advertising); Could a partner that negotiated full duplex below the advertised maximum speed then fall into the parallel detection fallback and be reported as half duplex? Would it be worth stating the dependency for stable?
> diff --git a/drivers/net/phy/as21xxx.c b/drivers/net/phy/as21xxx.c > index 967ff3020814e..5eea6baa75bfc 100644 > --- a/drivers/net/phy/as21xxx.c > +++ b/drivers/net/phy/as21xxx.c
[ ... ]
> @@ -781,15 +781,107 @@ static int as21xxx_read_c22_lpa(struct phy_device *phydev)
[ ... ]
> +static int as21xxx_read_speed(struct phy_device *phydev) > +{ > + int val; > + > + val = phy_read_mmd(phydev, MDIO_MMD_VEND1, VEND1_SPEED_STATUS); > + if (val < 0) > + return val; > + > + switch (val & VEND1_SPEED_MASK) {
[ ... ]
> + default: > + dev_warn_once(&phydev->mdio.dev, > + "Unknown speed status 0x%04x\n", val); > + phydev->speed = SPEED_UNKNOWN; > + break; > + } > + > + return 0; > +}
[ ... ]
> @@ -797,64 +889,54 @@ static int as21xxx_read_status(struct phy_device *phydev) > if (phydev->autoneg == AUTONEG_ENABLE && old_link && phydev->link) > return 0; > > - phydev->speed = SPEED_UNKNOWN; > - phydev->duplex = DUPLEX_UNKNOWN; > phydev->pause = 0; > phydev->asym_pause = 0; > > - if (phydev->autoneg == AUTONEG_ENABLE) { > - ret = genphy_c45_read_lpa(phydev); > + if (phydev->autoneg == AUTONEG_DISABLE) { > + ret = genphy_c45_read_pma(phydev); > if (ret) > return ret; > > - ret = as21xxx_read_c22_lpa(phydev); > - if (ret) > - return ret; > + if (phydev->link) { > + ret = as21xxx_read_speed(phydev); > > - phy_resolve_aneg_linkmode(phydev); > - } else { > - int speed; > + /* Hold the link down until the speed status settles */ > + if (!ret && phydev->speed == SPEED_UNKNOWN) > + phydev->link = 0; > + }
[Severity: High] Can this branch still leave phydev->speed set to SPEED_UNKNOWN in forced mode? genphy_c45_read_pma() sets phydev->speed from PMA CTRL1, which holds the forced speed the user configured. If the link bit is up while VEND1_SPEED_STATUS reads an unrecognised code, the default case in as21xxx_read_speed() overwrites phydev->speed with SPEED_UNKNOWN. Only the link is held down, and the PMA speed is not restored. In forced mode, phydev->speed is also the configuration. PHY_HALTED does not reset speed when autoneg is disabled, so if phy_stop() lands in this window, the next phy_start() goes through: phy_start() _phy_start_aneg() phy_sanitize_settings() phy_caps_lookup(SPEED_UNKNOWN, DUPLEX_FULL, supported, false) as21xxx_config_aneg() genphy_c45_pma_setup_forced() When speed is -1, phy_caps_lookup() finds no entry with lcap->speed <= speed and returns the slowest supported capability. If 10baseT_Half is in phydev->supported, the result is 10/HALF. genphy_c45_pma_setup_forced() returns -EINVAL for anything other than full duplex, so the PHY goes to PHY_ERROR, and every later restart retries the same sanitized setting. If 10baseT_Half is not supported, the slowest full duplex speed is written into PMA CTRL1 instead, and the forced speed is lost. Isn't this the same problem the commit message says is being fixed? "Otherwise phy_sanitize_settings() sees unknown values on the next autoneg restart with the link down and falls back to the slowest mode." Could as21xxx_read_speed() return the speed in a local variable, or leave phydev->speed untouched in its default case, so that the PMA-derived speed is kept?
> - linkmode_zero(phydev->lp_advertising); > + return ret; > + }
[ ... ]
> + phydev->speed = SPEED_UNKNOWN; > + phydev->duplex = DUPLEX_UNKNOWN; > + linkmode_zero(phydev->lp_advertising);
[ ... ]
> + /* as21xxx_read_link() reports link up only once autoneg completed */ > + if (!phydev->link) > + return 0;
[Severity: Low] Because of this early return, as21xxx_read_lpa() is only reached once the link is up. Before this patch, as21xxx_read_c22_lpa() ran on every autoneg read_status where the link was not already up, including while the link was down. A 1000BASE-T master/slave configuration fault keeps the link down. Does that mean the LPA_1000MSFAIL check in as21xxx_read_lpa(), and its "Master/Slave resolution failed" message, are no longer reached in the case they exist for? If the check is reached with the link up, for example through a latched fault bit, it still returns -ENOLINK. That moves the PHY to PHY_ERROR while the link is actually up. Should this follow the hold-the-link-down approach used here for an unrecognised speed status instead? The commit message says partner abilities are now read only once the link is up, but it does not mention the lost diagnostic. [ ... ]
-- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40collabora.com