提交 c6c13965 编写于 作者: N Nikolay Aleksandrov 提交者: David S. Miller

net: add unknown state to sysfs NIC duplex export

Currently when the NIC duplex state is DUPLEX_UNKNOWN it is exported as
full through sysfs, this patch adds support for DUPLEX_UNKNOWN. It is
handled the same way as in ethtool.
Signed-off-by: NNikolay Aleksandrov <naleksan@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 f6fe569f
...@@ -166,9 +166,21 @@ static ssize_t show_duplex(struct device *dev, ...@@ -166,9 +166,21 @@ static ssize_t show_duplex(struct device *dev,
if (netif_running(netdev)) { if (netif_running(netdev)) {
struct ethtool_cmd cmd; struct ethtool_cmd cmd;
if (!__ethtool_get_settings(netdev, &cmd)) if (!__ethtool_get_settings(netdev, &cmd)) {
ret = sprintf(buf, "%s\n", const char *duplex;
cmd.duplex ? "full" : "half"); switch (cmd.duplex) {
case DUPLEX_HALF:
duplex = "half";
break;
case DUPLEX_FULL:
duplex = "full";
break;
default:
duplex = "unknown";
break;
}
ret = sprintf(buf, "%s\n", duplex);
}
} }
rtnl_unlock(); rtnl_unlock();
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册