Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: cbc1bb1e4689 ("net: phylink: simplify phy case for ksettings_set method")
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Russell King (Oracle) and committed by
David S. Miller
df0acdc5 d1b2777d

+4 -4
+4 -4
drivers/net/phy/phylink.c
··· 2225 2225 2226 2226 ASSERT_RTNL(); 2227 2227 2228 + /* Mask out unsupported advertisements */ 2229 + linkmode_and(config.advertising, kset->link_modes.advertising, 2230 + pl->supported); 2231 + 2228 2232 if (pl->phydev) { 2229 2233 /* We can rely on phylib for this update; we also do not need 2230 2234 * to update the pl->link_config settings: ··· 2252 2248 } 2253 2249 2254 2250 config = pl->link_config; 2255 - 2256 - /* Mask out unsupported advertisements */ 2257 - linkmode_and(config.advertising, kset->link_modes.advertising, 2258 - pl->supported); 2259 2251 2260 2252 /* FIXME: should we reject autoneg if phy/mac does not support it? */ 2261 2253 switch (kset->base.autoneg) {