summaryrefslogtreecommitdiff
path: root/net/ethtool/common.c
diff options
context:
space:
mode:
authorMichal Kubecek <mkubecek@suse.cz>2019-12-27 15:56:23 +0100
committerDavid S. Miller <davem@davemloft.net>2019-12-27 16:40:02 -0800
commit3d2b847fb99cf2b28aa046e486636e555bc6ed1c (patch)
tree216f898fac0e7de4b289a93f5f491492254eeb53 /net/ethtool/common.c
parent1b1b1847c8505df2e1dd8804838526bed22a8bd4 (diff)
ethtool: provide link state with LINKSTATE_GET request
Implement LINKSTATE_GET netlink request to get link state information. At the moment, only link up flag as provided by ETHTOOL_GLINK ioctl command is returned. LINKSTATE_GET request can be used with NLM_F_DUMP (without device identification) to request the information for all devices in current network namespace providing the data. Signed-off-by: Michal Kubecek <mkubecek@suse.cz> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ethtool/common.c')
-rw-r--r--net/ethtool/common.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/ethtool/common.c b/net/ethtool/common.c
index 1d4a0aeff2cb..e621b1694d2f 100644
--- a/net/ethtool/common.c
+++ b/net/ethtool/common.c
@@ -217,3 +217,11 @@ convert_legacy_settings_to_link_ksettings(
= legacy_settings->eth_tp_mdix_ctrl;
return retval;
}
+
+int __ethtool_get_link(struct net_device *dev)
+{
+ if (!dev->ethtool_ops->get_link)
+ return -EOPNOTSUPP;
+
+ return netif_running(dev) && dev->ethtool_ops->get_link(dev);
+}