]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: ethtool: set a default driver name
authorTonghao Zhang <xiangxia.m.yue@gmail.com>
Thu, 25 Nov 2021 16:30:49 +0000 (00:30 +0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 27 Nov 2021 00:44:53 +0000 (16:44 -0800)
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: Arnd Bergmann <arnd@arndb.de>
Cc: Hao Chen <chenhao288@hisilicon.com>
Cc: Heiner Kallweit <hkallweit1@gmail.com>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: Danielle Ratson <danieller@nvidia.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Link: https://lore.kernel.org/r/20211125163049.84970-1-xiangxia.m.yue@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ethtool/ioctl.c

index 06d3866c69b4120779ec53ca99db131629c91e6b..fa8aa5ec19ba1cfff611a159c5b8bcd02f74c5ca 100644 (file)
@@ -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;
        }