715-15-v6.4-net-phylink-fix-ksettings_set-ethtool-call.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. From cc73de0411f7d3cdd157564a78f7a39058420ff8 Mon Sep 17 00:00:00 2001
  2. From: "Russell King (Oracle)" <[email protected]>
  3. Date: Sat, 13 May 2023 22:03:45 +0100
  4. Subject: [PATCH 13/21] net: phylink: fix ksettings_set() ethtool call
  5. While testing a Fiberstore SFP-10G-T module (which uses 10GBASE-R with
  6. rate adaption) in a Clearfog platform (which can't do that) it was
  7. found that the PHYs advertisement was not limited according to the
  8. hosts capabilities when using ethtool to change it.
  9. Fix this by ensuring that we mask the advertisement with the computed
  10. support mask as the very first thing we do.
  11. Fixes: cbc1bb1e4689 ("net: phylink: simplify phy case for ksettings_set method")
  12. Signed-off-by: Russell King (Oracle) <[email protected]>
  13. Signed-off-by: David S. Miller <[email protected]>
  14. ---
  15. drivers/net/phy/phylink.c | 8 ++++----
  16. 1 file changed, 4 insertions(+), 4 deletions(-)
  17. --- a/drivers/net/phy/phylink.c
  18. +++ b/drivers/net/phy/phylink.c
  19. @@ -2226,6 +2226,10 @@ int phylink_ethtool_ksettings_set(struct
  20. ASSERT_RTNL();
  21. + /* Mask out unsupported advertisements */
  22. + linkmode_and(config.advertising, kset->link_modes.advertising,
  23. + pl->supported);
  24. +
  25. if (pl->phydev) {
  26. /* We can rely on phylib for this update; we also do not need
  27. * to update the pl->link_config settings:
  28. @@ -2250,10 +2254,6 @@ int phylink_ethtool_ksettings_set(struct
  29. config = pl->link_config;
  30. - /* Mask out unsupported advertisements */
  31. - linkmode_and(config.advertising, kset->link_modes.advertising,
  32. - pl->supported);
  33. -
  34. /* FIXME: should we reject autoneg if phy/mac does not support it? */
  35. switch (kset->base.autoneg) {
  36. case AUTONEG_DISABLE: