提交 766d1d38 编写于 作者: F Florian Fainelli 提交者: David S. Miller

net: phy: display human readable PHY speed settings

Use a convenience function: phy_speed_to_str() which will display human
readable speeds.
Suggested-by: NJoe Perches <joe@perches.com>
Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 df40cc88
...@@ -38,6 +38,26 @@ ...@@ -38,6 +38,26 @@
#include <asm/irq.h> #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 * phy_print_status - Convenience function to print out the current phy status
* @phydev: the phy_device struct * @phydev: the phy_device struct
...@@ -46,8 +66,8 @@ void phy_print_status(struct phy_device *phydev) ...@@ -46,8 +66,8 @@ void phy_print_status(struct phy_device *phydev)
{ {
if (phydev->link) { if (phydev->link) {
netdev_info(phydev->attached_dev, netdev_info(phydev->attached_dev,
"Link is Up - %d/%s - flow control %s\n", "Link is Up - %s/%s - flow control %s\n",
phydev->speed, phy_speed_to_str(phydev->speed),
DUPLEX_FULL == phydev->duplex ? "Full" : "Half", DUPLEX_FULL == phydev->duplex ? "Full" : "Half",
phydev->pause ? "rx/tx" : "off"); phydev->pause ? "rx/tx" : "off");
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册