Skip to content

Commit df0acdc

Browse files
Russell King (Oracle)davem330
authored andcommitted
net: phylink: fix ksettings_set() ethtool call
While testing a Fiberstore SFP-10G-T module (which uses 10GBASE-R with rate adaption) in a Clearfog platform (which can't do that) it was found that the PHYs advertisement was not limited according to the hosts capabilities when using ethtool to change it. Fix this by ensuring that we mask the advertisement with the computed support mask as the very first thing we do. Fixes: cbc1bb1 ("net: phylink: simplify phy case for ksettings_set method") Signed-off-by: Russell King (Oracle) <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d1b2777 commit df0acdc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/net/phy/phylink.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2225,6 +2225,10 @@ 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+
22282232
if (pl->phydev) {
22292233
/* We can rely on phylib for this update; we also do not need
22302234
* to update the pl->link_config settings:
@@ -2249,10 +2253,6 @@ int phylink_ethtool_ksettings_set(struct phylink *pl,
22492253

22502254
config = pl->link_config;
22512255

2252-
/* Mask out unsupported advertisements */
2253-
linkmode_and(config.advertising, kset->link_modes.advertising,
2254-
pl->supported);
2255-
22562256
/* FIXME: should we reject autoneg if phy/mac does not support it? */
22572257
switch (kset->base.autoneg) {
22582258
case AUTONEG_DISABLE:

0 commit comments

Comments
 (0)