aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/net-sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/core/net-sysfs.c')
-rw-r--r--net/core/net-sysfs.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 72607174ea5..bcf02f608cb 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -166,9 +166,21 @@ static ssize_t show_duplex(struct device *dev,
166 166
167 if (netif_running(netdev)) { 167 if (netif_running(netdev)) {
168 struct ethtool_cmd cmd; 168 struct ethtool_cmd cmd;
169 if (!__ethtool_get_settings(netdev, &cmd)) 169 if (!__ethtool_get_settings(netdev, &cmd)) {
170 ret = sprintf(buf, "%s\n", 170 const char *duplex;
171 cmd.duplex ? "full" : "half"); 171 switch (cmd.duplex) {
172 case DUPLEX_HALF:
173 duplex = "half";
174 break;
175 case DUPLEX_FULL:
176 duplex = "full";
177 break;
178 default:
179 duplex = "unknown";
180 break;
181 }
182 ret = sprintf(buf, "%s\n", duplex);
183 }
172 } 184 }
173 rtnl_unlock(); 185 rtnl_unlock();
174 return ret; 186 return ret;