diff options
author | Oleksij Rempel <o.rempel@pengutronix.de> | 2023-02-22 06:50:42 +0100 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2023-02-23 13:43:23 +0100 |
commit | 3eeca4e199cee2066c65b872391cecee5cbbbb81 (patch) | |
tree | 18faab62dcc3daefd05a9a371a5377e4c8a50dcd /drivers/net/phy/phy-c45.c | |
parent | net: phy: c45: add genphy_c45_an_config_eee_aneg() function (diff) | |
download | linux-3eeca4e199cee2066c65b872391cecee5cbbbb81.tar.xz linux-3eeca4e199cee2066c65b872391cecee5cbbbb81.zip |
net: phy: do not force EEE support
With following patches:
commit 9b01c885be36 ("net: phy: c22: migrate to genphy_c45_write_eee_adv()")
commit 5827b168125d ("net: phy: c45: migrate to genphy_c45_write_eee_adv()")
we set the advertisement to potentially supported values. This behavior
may introduce new regressions on systems where EEE was disabled by
default (BIOS or boot loader configuration or by other ways.)
At same time, with this patches, we would overwrite EEE advertisement
configuration made over ethtool.
To avoid this issues, we need to cache initial and ethtool advertisement
configuration and store it for later use.
Fixes: 9b01c885be36 ("net: phy: c22: migrate to genphy_c45_write_eee_adv()")
Fixes: 5827b168125d ("net: phy: c45: migrate to genphy_c45_write_eee_adv()")
Fixes: 022c3f87f88e ("net: phy: add genphy_c45_ethtool_get/set_eee() support")
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'drivers/net/phy/phy-c45.c')
-rw-r--r-- | drivers/net/phy/phy-c45.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c index 784868e818a7..8717c122e2f3 100644 --- a/drivers/net/phy/phy-c45.c +++ b/drivers/net/phy/phy-c45.c @@ -721,8 +721,7 @@ int genphy_c45_write_eee_adv(struct phy_device *phydev, unsigned long *adv) * @phydev: target phy_device struct * @adv: the linkmode advertisement status */ -static int genphy_c45_read_eee_adv(struct phy_device *phydev, - unsigned long *adv) +int genphy_c45_read_eee_adv(struct phy_device *phydev, unsigned long *adv) { int val; @@ -864,7 +863,13 @@ EXPORT_SYMBOL_GPL(genphy_c45_read_eee_abilities); */ int genphy_c45_an_config_eee_aneg(struct phy_device *phydev) { - return genphy_c45_write_eee_adv(phydev, phydev->supported_eee); + if (!phydev->eee_enabled) { + __ETHTOOL_DECLARE_LINK_MODE_MASK(adv) = {}; + + return genphy_c45_write_eee_adv(phydev, adv); + } + + return genphy_c45_write_eee_adv(phydev, phydev->advertising_eee); } /** @@ -1430,17 +1435,22 @@ EXPORT_SYMBOL(genphy_c45_ethtool_get_eee); int genphy_c45_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data) { - __ETHTOOL_DECLARE_LINK_MODE_MASK(adv) = {}; int ret; if (data->eee_enabled) { if (data->advertised) - adv[0] = data->advertised; + ethtool_convert_legacy_u32_to_link_mode(phydev->advertising_eee, + data->advertised); else - linkmode_copy(adv, phydev->supported_eee); + linkmode_copy(phydev->advertising_eee, + phydev->supported_eee); + + phydev->eee_enabled = true; + } else { + phydev->eee_enabled = false; } - ret = genphy_c45_write_eee_adv(phydev, adv); + ret = genphy_c45_an_config_eee_aneg(phydev); if (ret < 0) return ret; if (ret > 0) |