]> www.infradead.org Git - users/jedix/linux-maple.git/commit
net: phy: fix phy_ethtool_set_eee() incorrectly enabling LPI
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Sat, 23 Nov 2024 14:50:12 +0000 (14:50 +0000)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 28 Nov 2024 08:26:13 +0000 (09:26 +0100)
commite2668c34b7e1a2288ea0a97ccf3cd12e2870ca18
tree2f84727dccf723964fc13f838efca2d9a28322e7
parent8d5c1b8c3e716e8f45ab7b65e8c3929cad2beb81
net: phy: fix phy_ethtool_set_eee() incorrectly enabling LPI

When phy_ethtool_set_eee_noneg() detects a change in the LPI
parameters, it attempts to update phylib state and trigger the link
to cycle so the MAC sees the updated parameters.

However, in doing so, it sets phydev->enable_tx_lpi depending on
whether the EEE configuration allows the MAC to generate LPI without
taking into account the result of negotiation.

This can be demonstrated with a 1000base-T FD interface by:

 # ethtool --set-eee eno0 advertise 8   # cause EEE to be not negotiated
 # ethtool --set-eee eno0 tx-lpi off
 # ethtool --set-eee eno0 tx-lpi on

This results in being true, despite EEE not having been negotiated and:
 # ethtool --show-eee eno0
EEE status: enabled - inactive
Tx LPI: 250 (us)
Supported EEE link modes:  100baseT/Full
                           1000baseT/Full
Advertised EEE link modes:  100baseT/Full
                                         1000baseT/Full

Fix this by keeping track of whether EEE was negotiated via a new
eee_active member in struct phy_device, and include this state in
the decision whether phydev->enable_tx_lpi should be set.

Fixes: 3e43b903da04 ("net: phy: Immediately call adjust_link if only tx_lpi_enabled changes")
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1tErSe-005RhB-2R@rmk-PC.armlinux.org.uk
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/phy/phy-c45.c
drivers/net/phy/phy.c
include/linux/phy.h