713-v5.2-net-phylink-avoid-reducing-support-mask.patch 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. From 8ac1d3e5cf7d277769ba3403d99f643fab1e3fae Mon Sep 17 00:00:00 2001
  2. From: Russell King <[email protected]>
  3. Date: Sat, 23 Nov 2019 14:19:54 +0000
  4. Subject: [PATCH 611/660] net: phylink: avoid reducing support mask
  5. Avoid reducing the support mask as a result of the interface type
  6. selected for SFP modules, or when setting the link settings through
  7. ethtool - this should only change when the supported link modes of
  8. the hardware combination change.
  9. Signed-off-by: Russell King <[email protected]>
  10. Signed-off-by: David S. Miller <[email protected]>
  11. ---
  12. drivers/net/phy/phylink.c | 13 +++++++++----
  13. 1 file changed, 9 insertions(+), 4 deletions(-)
  14. --- a/drivers/net/phy/phylink.c
  15. +++ b/drivers/net/phy/phylink.c
  16. @@ -1137,6 +1137,7 @@ EXPORT_SYMBOL_GPL(phylink_ethtool_ksetti
  17. int phylink_ethtool_ksettings_set(struct phylink *pl,
  18. const struct ethtool_link_ksettings *kset)
  19. {
  20. + __ETHTOOL_DECLARE_LINK_MODE_MASK(support);
  21. struct ethtool_link_ksettings our_kset;
  22. struct phylink_link_state config;
  23. int ret;
  24. @@ -1147,11 +1148,12 @@ int phylink_ethtool_ksettings_set(struct
  25. kset->base.autoneg != AUTONEG_ENABLE)
  26. return -EINVAL;
  27. + linkmode_copy(support, pl->supported);
  28. config = pl->link_config;
  29. /* Mask out unsupported advertisements */
  30. linkmode_and(config.advertising, kset->link_modes.advertising,
  31. - pl->supported);
  32. + support);
  33. /* FIXME: should we reject autoneg if phy/mac does not support it? */
  34. if (kset->base.autoneg == AUTONEG_DISABLE) {
  35. @@ -1161,7 +1163,7 @@ int phylink_ethtool_ksettings_set(struct
  36. * duplex.
  37. */
  38. s = phy_lookup_setting(kset->base.speed, kset->base.duplex,
  39. - pl->supported,
  40. + support,
  41. __ETHTOOL_LINK_MODE_MASK_NBITS, false);
  42. if (!s)
  43. return -EINVAL;
  44. @@ -1191,7 +1193,7 @@ int phylink_ethtool_ksettings_set(struct
  45. __set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, config.advertising);
  46. }
  47. - if (phylink_validate(pl, pl->supported, &config))
  48. + if (phylink_validate(pl, support, &config))
  49. return -EINVAL;
  50. /* If autonegotiation is enabled, we must have an advertisement */
  51. @@ -1633,6 +1635,7 @@ static int phylink_sfp_module_insert(voi
  52. {
  53. struct phylink *pl = upstream;
  54. __ETHTOOL_DECLARE_LINK_MODE_MASK(support) = { 0, };
  55. + __ETHTOOL_DECLARE_LINK_MODE_MASK(support1);
  56. struct phylink_link_state config;
  57. phy_interface_t iface;
  58. int ret = 0;
  59. @@ -1660,6 +1663,8 @@ static int phylink_sfp_module_insert(voi
  60. return ret;
  61. }
  62. + linkmode_copy(support1, support);
  63. +
  64. iface = sfp_select_interface(pl->sfp_bus, id, config.advertising);
  65. if (iface == PHY_INTERFACE_MODE_NA) {
  66. netdev_err(pl->netdev,
  67. @@ -1669,7 +1674,7 @@ static int phylink_sfp_module_insert(voi
  68. }
  69. config.interface = iface;
  70. - ret = phylink_validate(pl, support, &config);
  71. + ret = phylink_validate(pl, support1, &config);
  72. if (ret) {
  73. netdev_err(pl->netdev, "validation of %s/%s with support %*pb failed: %d\n",
  74. phylink_an_mode_str(MLO_AN_INBAND),