Commit e6c4ace
committed
net: phy: fix EEE advertisement not restored after eee off/on toggle
When EEE is disabled via 'ethtool --set-eee eth0 eee off' and then
re-enabled with 'ethtool --set-eee eth0 eee on' (without explicitly
specifying advertised modes), the advertised EEE link modes are lost,
showing "Not reported" instead of being restored to the supported
modes.
The bug is a state ordering issue in phy_ethtool_set_eee():
genphy_c45_ethtool_set_eee(phydev, data); // uses OLD eee_cfg
eee_to_eeecfg(&phydev->eee_cfg, data); // updates eee_cfg AFTER
genphy_c45_ethtool_set_eee() correctly restores advertising_eee from
supported_eee when re-enabling, but then calls
genphy_c45_an_config_eee_aneg() which checks phydev->eee_cfg.eee_enabled
-- still false from the previous 'eee off'. This causes it to write
empty modes to the PHY, overriding the just-restored advertisement.
Fix by updating eee_cfg.eee_enabled before calling
genphy_c45_ethtool_set_eee(), and restoring it on error.
Fixes: 49168d1 ("net: phy: Add phy_support_eee library function")
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>1 parent 294ebe6 commit e6c4ace
1 file changed
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1763 | 1763 | | |
1764 | 1764 | | |
1765 | 1765 | | |
| 1766 | + | |
1766 | 1767 | | |
1767 | 1768 | | |
1768 | 1769 | | |
1769 | 1770 | | |
1770 | 1771 | | |
1771 | 1772 | | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
1772 | 1783 | | |
1773 | 1784 | | |
1774 | 1785 | | |
1775 | 1786 | | |
1776 | 1787 | | |
| 1788 | + | |
| 1789 | + | |
1777 | 1790 | | |
1778 | 1791 | | |
1779 | 1792 | | |
| |||
0 commit comments