net: phy: remove disabled EEE modes from advertising_eee in phy_probe

A PHY driver may populate eee_disabled_modes in its probe or get_features
callback, therefore filter the EEE advertisement read from the PHY.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/493f3e2e-9cfc-445d-adbe-58d9c117a489@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Heiner Kallweit 2025-02-16 22:17:48 +01:00 committed by Jakub Kicinski
parent a9b6a860d7
commit 7f33fea6bb

View File

@ -3580,23 +3580,22 @@ static int phy_probe(struct device *dev)
if (err)
goto out;
/* Get the EEE modes we want to prohibit. */
of_set_phy_eee_broken(phydev);
/* Some PHYs may advertise, by default, not support EEE modes. So,
* we need to clean them. In addition remove all disabled EEE modes.
*/
linkmode_and(phydev->advertising_eee, phydev->supported_eee,
phydev->advertising_eee);
linkmode_andnot(phydev->advertising_eee, phydev->advertising_eee,
phydev->eee_disabled_modes);
/* There is no "enabled" flag. If PHY is advertising, assume it is
* kind of enabled.
*/
phydev->eee_cfg.eee_enabled = !linkmode_empty(phydev->advertising_eee);
/* Some PHYs may advertise, by default, not support EEE modes. So,
* we need to clean them.
*/
if (phydev->eee_cfg.eee_enabled)
linkmode_and(phydev->advertising_eee, phydev->supported_eee,
phydev->advertising_eee);
/* Get the EEE modes we want to prohibit. We will ask
* the PHY stop advertising these mode later on
*/
of_set_phy_eee_broken(phydev);
/* Get master/slave strap overrides */
of_set_phy_timing_role(phydev);