aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2014-02-11 20:27:35 -0500
committerDavid S. Miller <davem@davemloft.net>2014-02-12 19:08:19 -0500
commit766d1d388e6e6bfda99a00d68ac9247a1c25a0d9 (patch)
treeab481375732fa9675efb476a0a22ae4048438822 /drivers/net
parentdf40cc887924f64810e2dc8bd810aec5b37061c9 (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>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/phy/phy.c24
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 @@
38 38
39#include <asm/irq.h> 39#include <asm/irq.h>
40 40
41static const char *phy_speed_to_str(int speed)
42{
43 switch (speed) {
44 case SPEED_10:
45 return "10Mbps";
46 case SPEED_100:
47 return "100Mbps";
48 case SPEED_1000:
49 return "1Gbps";
50 case SPEED_2500:
51 return "2.5Gbps";
52 case SPEED_10000:
53 return "10Gbps";
54 case SPEED_UNKNOWN:
55 return "Unknown";
56 default:
57 return "Unsupported (update phy.c)";
58 }
59}
60
41/** 61/**
42 * phy_print_status - Convenience function to print out the current phy status 62 * phy_print_status - Convenience function to print out the current phy status
43 * @phydev: the phy_device struct 63 * @phydev: the phy_device struct
@@ -46,8 +66,8 @@ void phy_print_status(struct phy_device *phydev)
46{ 66{
47 if (phydev->link) { 67 if (phydev->link) {
48 netdev_info(phydev->attached_dev, 68 netdev_info(phydev->attached_dev,
49 "Link is Up - %d/%s - flow control %s\n", 69 "Link is Up - %s/%s - flow control %s\n",
50 phydev->speed, 70 phy_speed_to_str(phydev->speed),
51 DUPLEX_FULL == phydev->duplex ? "Full" : "Half", 71 DUPLEX_FULL == phydev->duplex ? "Full" : "Half",
52 phydev->pause ? "rx/tx" : "off"); 72 phydev->pause ? "rx/tx" : "off");
53 } else { 73 } else {