diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2014-02-11 17:27:35 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-02-12 19:08:19 -0500 |
commit | 766d1d388e6e6bfda99a00d68ac9247a1c25a0d9 (patch) | |
tree | ab481375732fa9675efb476a0a22ae4048438822 | |
parent | df40cc887924f64810e2dc8bd810aec5b37061c9 (diff) |
net: phy: display human readable PHY speed settings
Use a convenience function: phy_speed_to_str() which will display human
readable speeds.
Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/phy/phy.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 8ae22603b1b1..36fc6e16b569 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -38,6 +38,26 @@ #include <asm/irq.h> +static const char *phy_speed_to_str(int speed) +{ + switch (speed) { + case SPEED_10: + return "10Mbps"; + case SPEED_100: + return "100Mbps"; + case SPEED_1000: + return "1Gbps"; + case SPEED_2500: + return "2.5Gbps"; + case SPEED_10000: + return "10Gbps"; + case SPEED_UNKNOWN: + return "Unknown"; + default: + return "Unsupported (update phy.c)"; + } +} + /** * phy_print_status - Convenience function to print out the current phy status * @phydev: the phy_device struct @@ -46,8 +66,8 @@ void phy_print_status(struct phy_device *phydev) { if (phydev->link) { netdev_info(phydev->attached_dev, - "Link is Up - %d/%s - flow control %s\n", - phydev->speed, + "Link is Up - %s/%s - flow control %s\n", + phy_speed_to_str(phydev->speed), DUPLEX_FULL == phydev->duplex ? "Full" : "Half", phydev->pause ? "rx/tx" : "off"); } else { |