Skip to content

Commit

Permalink
net: phy: c45: improve handling of disabled EEE modes in generic etht…
Browse files Browse the repository at this point in the history
…ool functions

Currently disabled EEE modes are shown as supported in ethtool.
Change this by filtering them out when populating data->supported
in genphy_c45_ethtool_get_eee.
Disabled EEE modes are silently filtered out by genphy_c45_write_eee_adv.
This is planned to be removed, therefore ensure in
genphy_c45_ethtool_set_eee that disabled EEE modes are removed from the
user space provided EEE advertisement. For now keep the current behavior
to do this silently.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://patch.msgid.link/5187c86d-9a5a-482c-974f-cc103ce9738c@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Heiner Kallweit authored and Jakub Kicinski committed Feb 15, 2025
1 parent c2ddb61 commit 0025fa4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/net/phy/phy-c45.c
Original file line number Diff line number Diff line change
Expand Up @@ -1525,8 +1525,8 @@ int genphy_c45_ethtool_get_eee(struct phy_device *phydev,
return ret;

data->eee_active = phydev->eee_active;
linkmode_copy(data->supported, phydev->supported_eee);

linkmode_andnot(data->supported, phydev->supported_eee,
phydev->eee_disabled_modes);
return 0;
}
EXPORT_SYMBOL(genphy_c45_ethtool_get_eee);
Expand Down Expand Up @@ -1559,7 +1559,9 @@ int genphy_c45_ethtool_set_eee(struct phy_device *phydev,
phydev_warn(phydev, "At least some EEE link modes are not supported.\n");
return -EINVAL;
}
linkmode_copy(phydev->advertising_eee, adv);

linkmode_andnot(phydev->advertising_eee, adv,
phydev->eee_disabled_modes);
} else if (linkmode_empty(phydev->advertising_eee)) {
phy_advertise_eee_all(phydev);
}
Expand Down

0 comments on commit 0025fa4

Please sign in to comment.