diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2019-05-05 19:03:51 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-05-07 12:40:39 -0700 |
commit | 23bfaa594002f4bba085e0a1ae3c9847b988d816 (patch) | |
tree | a5259dc7c4aa3ffca48965b8169cc19a6d562bbd | |
parent | 5db9c74042e3c2168b1f1104d691063f5b662a8b (diff) | |
download | linux-23bfaa594002f4bba085e0a1ae3c9847b988d816.tar.gz linux-23bfaa594002f4bba085e0a1ae3c9847b988d816.tar.bz2 linux-23bfaa594002f4bba085e0a1ae3c9847b988d816.zip |
net: phy: improve pause mode reporting in phy_print_status
So far we report symmetric pause only, and we don't consider the local
pause capabilities. Let's properly consider local and remote
capabilities, and report also asymmetric pause.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/phy/phy.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 1a146c5c5036..e8885429293a 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -60,6 +60,32 @@ static void phy_link_down(struct phy_device *phydev, bool do_carrier) phy_led_trigger_change_speed(phydev); } +static const char *phy_pause_str(struct phy_device *phydev) +{ + bool local_pause, local_asym_pause; + + if (phydev->autoneg == AUTONEG_DISABLE) + goto no_pause; + + local_pause = linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT, + phydev->advertising); + local_asym_pause = linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, + phydev->advertising); + + if (local_pause && phydev->pause) + return "rx/tx"; + + if (local_asym_pause && phydev->asym_pause) { + if (local_pause) + return "rx"; + if (phydev->pause) + return "tx"; + } + +no_pause: + return "off"; +} + /** * phy_print_status - Convenience function to print out the current phy status * @phydev: the phy_device struct @@ -71,7 +97,7 @@ void phy_print_status(struct phy_device *phydev) "Link is Up - %s/%s - flow control %s\n", phy_speed_to_str(phydev->speed), phy_duplex_to_str(phydev->duplex), - phydev->pause ? "rx/tx" : "off"); + phy_pause_str(phydev)); } else { netdev_info(phydev->attached_dev, "Link is Down\n"); } |