From f1a7f9599446951a81c0d53d2cf6ad3c51b0e9ad Mon Sep 17 00:00:00 2001 From: "Russell King (Oracle)" Date: Thu, 1 Jun 2023 09:48:20 +0100 Subject: net: phylink allow EEE management for SFPs without PHYs Allow EEE management for SFPs without accessible PHYs. Signed-off-by: Russell King (Oracle) --- drivers/net/phy/phylink.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index d1d7dfbf19dc..a88bdf685ea8 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -2907,6 +2907,8 @@ int phylink_init_eee(struct phylink *pl, bool clk_stop_enable) if (pl->phydev) ret = phy_init_eee(pl->phydev, clk_stop_enable); + else if (pl->sfp_bus && phylink_mac_supports_eee(pl)) + ret = 0; return ret; } @@ -2923,8 +2925,13 @@ int phylink_ethtool_get_eee(struct phylink *pl, struct ethtool_eee *eee) ASSERT_RTNL(); - if (pl->phydev) + if (pl->phydev) { ret = phy_ethtool_get_eee(pl->phydev, eee); + } else if (pl->sfp_bus && phylink_mac_supports_eee(pl)) { + /* For optical SFPs, ensure that eee->supported is nonzero. */ + eee->supported = SUPPORTED_FIBRE; + ret = 0; + } if (!ret && phylink_mac_supports_eee(pl)) { /* Overwrite phylib's interpretation of configuration */ @@ -2964,6 +2971,8 @@ int phylink_ethtool_set_eee(struct phylink *pl, struct ethtool_eee *eee) if (pl->phydev) ret = phy_ethtool_set_eee(pl->phydev, eee); + else if (pl->sfp_bus && phylink_mac_supports_eee(pl)) + ret = 0; if (!ret && mac_eee) { bool can_lpi, old_can_lpi; -- cgit