Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 3 · 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] as21xxx_config_aneg() (drivers/net/phy/as21xxx.c, from line 914) is now the driver's .config_aneg, so phy_config_aneg()… - [Medium] In as21xxx_config_aneg() (drivers/net/phy/as21xxx.c), aeon_set_top_speed() (line 970) changes the firmware's top speed… - [Medium] The commit message says the IPC top-speed command makes the firmware advertise 'every slower speed the PHY supports', and that the… - [Low] Both the comment in as21xxx_config_init() (drivers/net/phy/as21xxx.c line 906-909) and the commit message say… -- net: phy: as21xxx: Configure autoneg advertisement via IPC This adds a .config_aneg callback for the AS21xxx PHYs. It sends the highest advertised BASE-T speed to the firmware over IPC instead of using genphy_c45_config_aneg(). The top speed is cached so autoneg only restarts when it changes, and the slower speeds that the firmware advertises along with it are added to phydev->advertising.
> diff --git a/drivers/net/phy/as21xxx.c b/drivers/net/phy/as21xxx.c > index 3423448a0cb1c..967ff3020814e 100644 > --- a/drivers/net/phy/as21xxx.c > +++ b/drivers/net/phy/as21xxx.c
[ ... ]
> +static int as21xxx_config_init(struct phy_device *phydev) > +{ > + struct as21xxx_priv *priv = phydev->priv; > + > + /* The firmware might have lost the top speed, e.g. across a > + * suspend/resume cycle, make sure the next .config_aneg sends it. > + */ > + priv->top_spd = 0;
[Severity: Low] Does this cover suspend/resume on systems where the MAC manages PM? On resume, .config_init is only reached through mdio_bus_phy_resume() -> phy_init_hw(), and mdio_bus_phy_resume() returns early: drivers/net/phy/phy_device.c:mdio_bus_phy_resume() { ... if (phydev->mac_managed_pm) return 0; ... } phylink_bringup_phy() sets phy->mac_managed_pm when the MAC config asks for it, and stmmac always asks. Neither phylink_resume() nor the stmmac resume path calls phy_init_hw(), so priv->top_spd survives resume on those systems. If the firmware really did forget the top speed, the next as21xxx_config_aneg() would take the top_spd == priv->top_spd early return and not resend it. Would clearing the cache from a .suspend or .resume callback cover both PM models? As written, the comment and the commit message seem to promise more than the code does.
> + > + return 0; > +}
[ ... ]
> + top_spd = aeon_top_speeds[i].top_spd; > + > + /* Let the advertisement reflect the slower speeds which go on the > + * wire along with the highest one. > + */ > + for (i = 0; i < ARRAY_SIZE(aeon_top_speeds); i++) > + if (aeon_top_speeds[i].top_spd <= top_spd && > + linkmode_test_bit(aeon_top_speeds[i].linkmode, > + phydev->supported)) > + linkmode_set_bit(aeon_top_speeds[i].linkmode, > + phydev->advertising);
[Severity: Medium] Can phydev->advertising still differ from what is on the wire? The commit message says the firmware advertises "every slower speed the PHY supports". It also says this loop makes phydev->advertising "reflect what is actually advertised on the wire". But the loop filters on phydev->supported, and MAC drivers can make that narrower than what the firmware advertises. Several non-phylink MAC drivers (ravb, rswitch, rtsn, tsnep, xgene, icssg and others) call phy_remove_link_mode() to drop half duplex or 10M modes. phy_set_max_speed() also narrows supported. The IPC can't describe a subset, so the firmware still advertises those modes, but they never appear in phydev->advertising. Phylink MACs are not affected this way, because phylink_bringup_phy() narrows phy->advertising rather than phy->supported. The later patch "net: phy: as21xxx: Fix speed and duplex reporting" relies on this claim. Its as21xxx_resolve_duplex() ANDs lp_advertising with phydev->advertising. Suppose the MAC removed 100baseT_Half and the link comes up at 100M with a half-only partner. No duplex bit is common, so this fallback runs: phydev->duplex = phydev->speed != SPEED_1000 && linkmode_test_bit(half, phydev->supported) ? DUPLEX_HALF : DUPLEX_FULL; Wouldn't that report DUPLEX_FULL and configure the MAC for full duplex while the wire runs half duplex?
> + > + /* Restarting autoneg takes the link down, so only do it when the > + * advertisement changed, or has to be sent again. > + */ > + if (top_spd == priv->top_spd) > + return 0;
[Severity: Medium] Now that .config_aneg is set, phy_config_aneg() no longer calls genphy_c45_config_aneg() for these PHYs. Does that drop the EEE and pause advertisement writes? The generic path wrote them from genphy_c45_an_config_aneg(): ret = genphy_c45_an_config_eee_aneg(phydev); ... ret = phy_modify_mmd_changed(phydev, MDIO_MMD_AN, MDIO_AN_ADVERTISE, ADVERTISE_ALL | ADVERTISE_100BASE4 | ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM, adv); It also ran genphy_c45_an_setup_master_slave(), which is now skipped as well. Phylib still tracks this state in software: - phy_probe() trims advertising_eee by supported_eee and by the DT eee-broken-* modes. - phy_disable_eee() zeroes advertising_eee. It is used for MACs without LPI support, including phylink's mac_supports_eee_ops path: linkmode_zero(phydev->advertising_eee); phydev->eee_cfg.tx_lpi_enabled = false; phydev->eee_cfg.eee_enabled = false; Both depend on config_aneg to push the state to the hardware. After this patch, the only code that writes MDIO_AN_EEE_ADV is genphy_c45_ethtool_set_eee(), and that only runs on an explicit ethtool --set-eee. Could MDIO_AN_EEE_ADV keep the firmware default at bring-up even when phylib thinks EEE is disabled? Pause changes look affected too. phy_set_asym_pause() does: linkmode_set_pause(phydev->advertising, tx, rx); if (!linkmode_equal(oldadv, phydev->advertising) && phydev->autoneg) phy_start_aneg(phydev); as21xxx_config_aneg() never writes the pause bits. Since the BASE-T top speed hasn't changed, it returns 0 at the check above and autoneg is not restarted. phydev->advertising then shows a pause advertisement that the hardware may not be sending. The commit message only says the C45 AN registers aren't "properly" supported, and all its examples are about speed bits. Does the firmware also ignore MDIO_AN_EEE_ADV and the pause bits in MDIO_AN_ADVERTISE? If not, should this function still write them?
> + > + ret = aeon_set_top_speed(phydev, top_spd); > + if (ret) > + return ret; > + > + if (!priv->top_spd) { > + /* genphy_c45_pma_setup_forced() clears MDIO_AN_CTRL1_ENABLE, > + * which restarting autoneg over the IPC doesn't set back. > + */ > + ret = phy_set_bits_mmd(phydev, MDIO_MMD_AN, MDIO_CTRL1, > + MDIO_AN_CTRL1_ENABLE); > + if (ret) > + return ret; > + } > + > + ret = aeon_restart_aneg(phydev); > + if (ret) > + return ret; > + > + priv->top_spd = top_spd;
[Severity: Medium] Can priv->top_spd go stale if aeon_restart_aneg() fails? By this point aeon_set_top_speed() has already changed the firmware's top speed. The error return leaves priv->top_spd at the old non-zero value, although the struct comment defines it as the "Top speed last handed to the firmware, 0 when it has to be sent again". For example, take a cache value of IPC_CU_AN_TOP_SPD_2500: 1. A 10G request sends IPC_CU_AN_TOP_SPD_10000. 2. aeon_restart_aneg() fails with an IPC error status or an MDIO error. 3. phy_ethtool_ksettings_set() ignores the _phy_start_aneg() error when the PHY isn't started. 4. The user goes back to 2500. The top_spd == priv->top_spd check matches, so nothing is sent. The firmware keeps the 10000 top speed and uses it at the next renegotiation that the driver doesn't trigger, such as a cable replug or a partner restart. Meanwhile phydev->advertising and the cache both say 2500. The phy_set_bits_mmd() error path is only taken while priv->top_spd is already 0, so it still gets resent. Should priv->top_spd be reset to 0 on any error after aeon_set_top_speed() succeeds?
> + > + return 0; > +}
-- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40collabora.com