Re: [PATCH net-next v21 02/13] phylib: Add support for PHYs with broken forced mode

From: netdev-bot+sashiko

Date: Sun Nov 15 2026 - 21:07:01 EST


Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The concern: PHY_BROKEN_FORCED (include/linux/phy.h:67) has no
user at this commit, so the checks in phy_ethtool_ksettings_set()…

--

phylib: Add support for PHYs with broken forced mode

This adds a PHY_BROKEN_FORCED driver flag. With it set,
phy_ethtool_ksettings_set() and phy_mii_ioctl() return -EOPNOTSUPP when
someone asks for a forced speed/duplex mode. The aim is to avoid the
warning in the PHY state machine when config_aneg() rejects forced mode.

> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index fce9bc7be3304..079c53516f424 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c

[ ... ]

> @@ -1190,6 +1193,10 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev,
> duplex != DUPLEX_FULL)))
> return -EINVAL;
>
> + if (autoneg == AUTONEG_DISABLE && phydev->drv &&
> + (phydev->drv->flags & PHY_BROKEN_FORCED))
> + return -EOPNOTSUPP;
> +

[Severity: Low]
No driver sets PHY_BROKEN_FORCED at this commit. Doesn't that mean this
check, and the matching one in phy_mii_ioctl(), can't trigger yet?

The commit message says:

This prevents a kernel warning and stack-trace within the
phy_state_machine when PHYs return -EOPNOTSUPP from config_aneg()

Later in the series, "ax88796b: Add support for AX88772D, AX88179A and
AX88279" sets the flag on the AX88279 entry. That driver's
asix_ax88279_config_aneg() returns -EOPNOTSUPP when autoneg is disabled,
so the description is accurate once that patch is applied.

Would it help to say in the commit message that the first user comes
later in the series?

Separately, two existing drivers already reject forced mode in
config_aneg(), but they return -EINVAL:

drivers/net/phy/bcm84881.c:bcm84881_config_aneg() {
...
/* disabled autoneg doesn't seem to work with this PHY */
if (phydev->autoneg == AUTONEG_DISABLE)
return -EINVAL;
...
}

drivers/net/phy/air_en8811h.c:en8811h_config_aneg() {
...
if (phydev->autoneg == AUTONEG_DISABLE) {
phydev_warn(phydev, "Disabling autoneg is not supported\n");
return -EINVAL;
}
...
}

These two still reach the warning through
_phy_state_machine()->_phy_start_aneg()->phy_error_precise(). This
patch didn't cause that, and converting them could be a separate
follow-up.

Would these two drivers be good candidates for the new flag?

--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261114-ax88179a-v21-0-c2d34410bcbe%40birger-koblitz.de