Skip to content

Commit

Permalink
net: phylink: fix ksettings_set() ethtool call
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Russell King (Oracle) authored and davem330 committed May 15, 2023
1 parent d1b2777 commit df0acdc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/net/phy/phylink.c
Original file line number Diff line number Diff line change
Expand Up @@ -2225,6 +2225,10 @@ int phylink_ethtool_ksettings_set(struct phylink *pl,

ASSERT_RTNL();

/* Mask out unsupported advertisements */
linkmode_and(config.advertising, kset->link_modes.advertising,
pl->supported);

if (pl->phydev) {
/* We can rely on phylib for this update; we also do not need
* to update the pl->link_config settings:
Expand All @@ -2249,10 +2253,6 @@ int phylink_ethtool_ksettings_set(struct phylink *pl,

config = pl->link_config;

/* Mask out unsupported advertisements */
linkmode_and(config.advertising, kset->link_modes.advertising,
pl->supported);

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

0 comments on commit df0acdc

Please sign in to comment.