136-phylink-add-ethtool-nway_reset-support.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. From d6bd25b692378ec17bdb1023d398c03c45829947 Mon Sep 17 00:00:00 2001
  2. From: Russell King <rmk+kernel@arm.linux.org.uk>
  3. Date: Thu, 1 Oct 2015 20:27:19 +0100
  4. Subject: [PATCH 724/744] phylink: add ethtool nway_reset support
  5. Add ethtool nway_reset support to phylink, to allow userspace to
  6. request a re-negotiation of the link.
  7. Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
  8. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  9. ---
  10. drivers/net/phy/phylink.c | 14 ++++++++++++++
  11. include/linux/phylink.h | 1 +
  12. 2 files changed, 15 insertions(+)
  13. --- a/drivers/net/phy/phylink.c
  14. +++ b/drivers/net/phy/phylink.c
  15. @@ -687,6 +687,20 @@ int phylink_ethtool_set_settings(struct
  16. }
  17. EXPORT_SYMBOL_GPL(phylink_ethtool_set_settings);
  18. +int phylink_ethtool_nway_reset(struct phylink *pl)
  19. +{
  20. + int ret = 0;
  21. +
  22. + mutex_lock(&pl->config_mutex);
  23. + if (pl->phydev)
  24. + ret = genphy_restart_aneg(pl->phydev);
  25. + phylink_mac_an_restart(pl);
  26. + mutex_unlock(&pl->config_mutex);
  27. +
  28. + return ret;
  29. +}
  30. +EXPORT_SYMBOL_GPL(phylink_ethtool_nway_reset);
  31. +
  32. /* This emulates MII registers for a fixed-mode phy operating as per the
  33. * passed in state. "aneg" defines if we report negotiation is possible.
  34. *
  35. --- a/include/linux/phylink.h
  36. +++ b/include/linux/phylink.h
  37. @@ -65,6 +65,7 @@ void phylink_stop(struct phylink *);
  38. int phylink_ethtool_get_settings(struct phylink *, struct ethtool_cmd *);
  39. int phylink_ethtool_set_settings(struct phylink *, struct ethtool_cmd *);
  40. +int phylink_ethtool_nway_reset(struct phylink *);
  41. int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);
  42. void phylink_set_link_port(struct phylink *pl, u32 support, u8 port);