Skip to content

Commit 03c44a2

Browse files
Russell King (Oracle)kuba-moo
authored andcommitted
net: phylink: actually fix ksettings_set() ethtool call
Raju Lakkaraju reported that the below commit caused a regression with Lan743x drivers and a 2.5G SFP. Sadly, this is because the commit was utterly wrong. Let's fix this properly by not moving the linkmode_and(), but instead copying the link ksettings and then modifying the advertising mask before passing the modified link ksettings to phylib. Fixes: df0acdc ("net: phylink: fix ksettings_set() ethtool call") Signed-off-by: Russell King (Oracle) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 3696e14 commit 03c44a2

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

drivers/net/phy/phylink.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2225,11 +2225,13 @@ int phylink_ethtool_ksettings_set(struct phylink *pl,
22252225

22262226
ASSERT_RTNL();
22272227

2228-
/* Mask out unsupported advertisements */
2229-
linkmode_and(config.advertising, kset->link_modes.advertising,
2230-
pl->supported);
2231-
22322228
if (pl->phydev) {
2229+
struct ethtool_link_ksettings phy_kset = *kset;
2230+
2231+
linkmode_and(phy_kset.link_modes.advertising,
2232+
phy_kset.link_modes.advertising,
2233+
pl->supported);
2234+
22332235
/* We can rely on phylib for this update; we also do not need
22342236
* to update the pl->link_config settings:
22352237
* - the configuration returned via ksettings_get() will come
@@ -2248,10 +2250,13 @@ int phylink_ethtool_ksettings_set(struct phylink *pl,
22482250
* the presence of a PHY, this should not be changed as that
22492251
* should be determined from the media side advertisement.
22502252
*/
2251-
return phy_ethtool_ksettings_set(pl->phydev, kset);
2253+
return phy_ethtool_ksettings_set(pl->phydev, &phy_kset);
22522254
}
22532255

22542256
config = pl->link_config;
2257+
/* Mask out unsupported advertisements */
2258+
linkmode_and(config.advertising, kset->link_modes.advertising,
2259+
pl->supported);
22552260

22562261
/* FIXME: should we reject autoneg if phy/mac does not support it? */
22572262
switch (kset->base.autoneg) {

0 commit comments

Comments
 (0)