[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211125163049.84970-1-xiangxia.m.yue@gmail.com>
Date: Fri, 26 Nov 2021 00:30:49 +0800
From: xiangxia.m.yue@...il.com
To: netdev@...r.kernel.org
Cc: Tonghao Zhang <xiangxia.m.yue@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Leon Romanovsky <leon@...nel.org>,
Arnd Bergmann <arnd@...db.de>,
Hao Chen <chenhao288@...ilicon.com>,
Heiner Kallweit <hkallweit1@...il.com>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Danielle Ratson <danieller@...dia.com>,
Andrew Lunn <andrew@...n.ch>,
Leon Romanovsky <leonro@...dia.com>
Subject: [net-next v3] net: ethtool: set a default driver name
From: Tonghao Zhang <xiangxia.m.yue@...il.com>
The netdev (e.g. ifb, bareudp), which not support ethtool ops
(e.g. .get_drvinfo), we can use the rtnl kind as a default name.
ifb netdev may be created by others prefix, not ifbX.
Cc: "David S. Miller" <davem@...emloft.net>
Cc: Jakub Kicinski <kuba@...nel.org>
Cc: Leon Romanovsky <leon@...nel.org>
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Hao Chen <chenhao288@...ilicon.com>
Cc: Heiner Kallweit <hkallweit1@...il.com>
Cc: "Gustavo A. R. Silva" <gustavoars@...nel.org>
Cc: Danielle Ratson <danieller@...dia.com>
Cc: Andrew Lunn <andrew@...n.ch>
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@...il.com>
Reviewed-by: Leon Romanovsky <leonro@...dia.com>
---
v2: remove unnecessary white line
v1: https://lore.kernel.org/all/20211124181858.6c4668db@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com/
---
net/ethtool/ioctl.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c
index af2d4e022076..3d7bff407580 100644
--- a/net/ethtool/ioctl.c
+++ b/net/ethtool/ioctl.c
@@ -734,6 +734,9 @@ ethtool_get_drvinfo(struct net_device *dev, struct ethtool_devlink_compat *rsp)
sizeof(rsp->info.bus_info));
strlcpy(rsp->info.driver, dev->dev.parent->driver->name,
sizeof(rsp->info.driver));
+ } else if (dev->rtnl_link_ops) {
+ strlcpy(rsp->info.driver, dev->rtnl_link_ops->kind,
+ sizeof(rsp->info.driver));
} else {
return -EOPNOTSUPP;
}
--
2.27.0
Powered by blists - more mailing lists