aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/ethtool.c
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2019-01-31 10:50:47 -0800
committerDavid S. Miller <davem@davemloft.net>2019-02-01 15:30:31 -0800
commitddb6e99e2db14d4b3c22a0dbddc6a09234856bb7 (patch)
tree1195e6f3629b6a30cd3ee4716e8de2a08a5a4c73 /net/core/ethtool.c
parentnfp: devlink: report the running and flashed versions (diff)
downloadlinux-dev-ddb6e99e2db14d4b3c22a0dbddc6a09234856bb7.tar.xz
linux-dev-ddb6e99e2db14d4b3c22a0dbddc6a09234856bb7.zip
ethtool: add compat for devlink info
If driver did not fill the fw_version field, try to call into the new devlink get_info op and collect the versions that way. We assume ethtool was always reporting running versions. v4: - use IS_REACHABLE() to avoid problems with DEVLINK=m (kbuildbot). v3 (Jiri): - do a dump and then parse it instead of special handling; - concatenate all versions (well, all that fit :)). Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--net/core/ethtool.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 3fe6e9da3579..45c0a6e3d6ad 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -27,6 +27,7 @@
#include <linux/rtnetlink.h>
#include <linux/sched/signal.h>
#include <linux/net.h>
+#include <net/devlink.h>
#include <net/xdp_sock.h>
/*
@@ -803,6 +804,12 @@ static noinline_for_stack int ethtool_get_drvinfo(struct net_device *dev,
if (ops->get_eeprom_len)
info.eedump_len = ops->get_eeprom_len(dev);
+ rtnl_unlock();
+ if (!info.fw_version[0])
+ devlink_compat_running_version(dev, info.fw_version,
+ sizeof(info.fw_version));
+ rtnl_lock();
+
if (copy_to_user(useraddr, &info, sizeof(info)))
return -EFAULT;
return 0;