139-net-mvneta-add-flow-control-support-via-phylink.patch 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. From 7bd34822b9922beb22a6384d9190646105d259d8 Mon Sep 17 00:00:00 2001
  2. From: Russell King <rmk+kernel@arm.linux.org.uk>
  3. Date: Thu, 1 Oct 2015 17:41:44 +0100
  4. Subject: [PATCH 727/744] net: mvneta: add flow control support via phylink
  5. Add flow control support to mvneta, including the ethtool hooks. This
  6. uses the phylink code to calculate the result of autonegotiation where
  7. a phy is attached, and to handle the ethtool settings.
  8. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  9. ---
  10. drivers/net/ethernet/marvell/mvneta.c | 22 +++++++++++++++++++++-
  11. 1 file changed, 21 insertions(+), 1 deletion(-)
  12. --- a/drivers/net/ethernet/marvell/mvneta.c
  13. +++ b/drivers/net/ethernet/marvell/mvneta.c
  14. @@ -3208,6 +3208,8 @@ static void mvneta_mac_config(struct net
  15. if (state->advertising & ADVERTISED_Pause)
  16. new_an |= MVNETA_GMAC_ADVERT_SYM_FLOW_CTRL;
  17. + if (state->pause & MLO_PAUSE_TXRX_MASK)
  18. + new_an |= MVNETA_GMAC_CONFIG_FLOW_CTRL;
  19. switch (mode) {
  20. case MLO_AN_SGMII:
  21. @@ -3232,7 +3234,7 @@ static void mvneta_mac_config(struct net
  22. /* The MAC only supports FD mode */
  23. MVNETA_GMAC_CONFIG_FULL_DUPLEX;
  24. - if (state->an_enabled)
  25. + if (state->pause & MLO_PAUSE_AN && state->an_enabled)
  26. new_an |= MVNETA_GMAC_AN_FLOW_CTRL_EN;
  27. break;
  28. @@ -3685,6 +3687,22 @@ static int mvneta_ethtool_set_ringparam(
  29. return 0;
  30. }
  31. +static void mvneta_ethtool_get_pauseparam(struct net_device *dev,
  32. + struct ethtool_pauseparam *pause)
  33. +{
  34. + struct mvneta_port *pp = netdev_priv(dev);
  35. +
  36. + phylink_ethtool_get_pauseparam(pp->phylink, pause);
  37. +}
  38. +
  39. +static int mvneta_ethtool_set_pauseparam(struct net_device *dev,
  40. + struct ethtool_pauseparam *pause)
  41. +{
  42. + struct mvneta_port *pp = netdev_priv(dev);
  43. +
  44. + return phylink_ethtool_set_pauseparam(pp->phylink, pause);
  45. +}
  46. +
  47. static void mvneta_ethtool_get_strings(struct net_device *netdev, u32 sset,
  48. u8 *data)
  49. {
  50. @@ -3866,6 +3884,8 @@ const struct ethtool_ops mvneta_eth_tool
  51. .get_drvinfo = mvneta_ethtool_get_drvinfo,
  52. .get_ringparam = mvneta_ethtool_get_ringparam,
  53. .set_ringparam = mvneta_ethtool_set_ringparam,
  54. + .get_pauseparam = mvneta_ethtool_get_pauseparam,
  55. + .set_pauseparam = mvneta_ethtool_set_pauseparam,
  56. .get_strings = mvneta_ethtool_get_strings,
  57. .get_ethtool_stats = mvneta_ethtool_get_stats,
  58. .get_sset_count = mvneta_ethtool_get_sset_count,