net: stmmac: make EEE depend on phy->enable_tx_lpi
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Wed, 8 Jan 2025 16:47:54 +0000 (16:47 +0000)
committerJakub Kicinski <kuba@kernel.org>
Sat, 11 Jan 2025 01:51:01 +0000 (17:51 -0800)
Make stmmac EEE depend on phylib's evaluation of user settings and PHY
negotiation, as indicated by phy->enable_tx_lpi. This will ensure when
phylib has evaluated that the user has disabled LPI, phy_init_eee()
will not be called, and priv->eee_active will be false, causing LPI/EEE
to be disabled.

This is an interim measure - phy_init_eee() will be removed in a later
patch.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Choong Yong Liang <yong.liang.choong@linux.intel.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1tVZDm-0002K9-9w@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index 136839165cd54eaa829a840c4f5caa57533fd2e9..51799eb672f7038ccb96a5ac36c8d45e63f65d9c 100644 (file)
@@ -1083,7 +1083,7 @@ static void stmmac_mac_link_up(struct phylink_config *config,
 
        stmmac_mac_set(priv, priv->ioaddr, true);
        if (phy && priv->dma_cap.eee) {
-               priv->eee_active =
+               priv->eee_active = phy->enable_tx_lpi &&
                        phy_init_eee(phy, !(priv->plat->flags &
                                STMMAC_FLAG_RX_CLK_RUNS_IN_LPI)) >= 0;
                priv->tx_lpi_timer = phy->eee_cfg.tx_lpi_timer;