Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dummy: add support for ethtool get_drvinfo

The command 'ethtool -i' is useful to find details
about the interface like the device driver being used.
This was missing for dummy driver.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Flavio Leitner and committed by
David S. Miller
c19be735 6dc69640

+17 -2
+17 -2
drivers/net/dummy.c
··· 38 38 #include <net/rtnetlink.h> 39 39 #include <linux/u64_stats_sync.h> 40 40 41 + #define DRV_NAME "dummy" 42 + #define DRV_VERSION "1.0" 43 + 41 44 static int numdummies = 1; 42 45 43 46 /* fake multicast ability */ ··· 123 120 .ndo_change_carrier = dummy_change_carrier, 124 121 }; 125 122 123 + static void dummy_get_drvinfo(struct net_device *dev, 124 + struct ethtool_drvinfo *info) 125 + { 126 + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); 127 + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); 128 + } 129 + 130 + static const struct ethtool_ops dummy_ethtool_ops = { 131 + .get_drvinfo = dummy_get_drvinfo, 132 + }; 133 + 126 134 static void dummy_setup(struct net_device *dev) 127 135 { 128 136 ether_setup(dev); 129 137 130 138 /* Initialize the device structure. */ 131 139 dev->netdev_ops = &dummy_netdev_ops; 140 + dev->ethtool_ops = &dummy_ethtool_ops; 132 141 dev->destructor = free_netdev; 133 142 134 143 /* Fill in device structure with ethernet-generic values. */ ··· 165 150 } 166 151 167 152 static struct rtnl_link_ops dummy_link_ops __read_mostly = { 168 - .kind = "dummy", 153 + .kind = DRV_NAME, 169 154 .setup = dummy_setup, 170 155 .validate = dummy_validate, 171 156 }; ··· 224 209 module_init(dummy_init_module); 225 210 module_exit(dummy_cleanup_module); 226 211 MODULE_LICENSE("GPL"); 227 - MODULE_ALIAS_RTNL_LINK("dummy"); 212 + MODULE_ALIAS_RTNL_LINK(DRV_NAME);