Skip to content

Commit c19be73

Browse files
fleitnerdavem330
authored andcommitted
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>
1 parent 6dc6964 commit c19be73

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

drivers/net/dummy.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
#include <net/rtnetlink.h>
3939
#include <linux/u64_stats_sync.h>
4040

41+
#define DRV_NAME "dummy"
42+
#define DRV_VERSION "1.0"
43+
4144
static int numdummies = 1;
4245

4346
/* fake multicast ability */
@@ -120,12 +123,24 @@ static const struct net_device_ops dummy_netdev_ops = {
120123
.ndo_change_carrier = dummy_change_carrier,
121124
};
122125

126+
static void dummy_get_drvinfo(struct net_device *dev,
127+
struct ethtool_drvinfo *info)
128+
{
129+
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
130+
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
131+
}
132+
133+
static const struct ethtool_ops dummy_ethtool_ops = {
134+
.get_drvinfo = dummy_get_drvinfo,
135+
};
136+
123137
static void dummy_setup(struct net_device *dev)
124138
{
125139
ether_setup(dev);
126140

127141
/* Initialize the device structure. */
128142
dev->netdev_ops = &dummy_netdev_ops;
143+
dev->ethtool_ops = &dummy_ethtool_ops;
129144
dev->destructor = free_netdev;
130145

131146
/* Fill in device structure with ethernet-generic values. */
@@ -150,7 +165,7 @@ static int dummy_validate(struct nlattr *tb[], struct nlattr *data[])
150165
}
151166

152167
static struct rtnl_link_ops dummy_link_ops __read_mostly = {
153-
.kind = "dummy",
168+
.kind = DRV_NAME,
154169
.setup = dummy_setup,
155170
.validate = dummy_validate,
156171
};
@@ -209,4 +224,4 @@ static void __exit dummy_cleanup_module(void)
209224
module_init(dummy_init_module);
210225
module_exit(dummy_cleanup_module);
211226
MODULE_LICENSE("GPL");
212-
MODULE_ALIAS_RTNL_LINK("dummy");
227+
MODULE_ALIAS_RTNL_LINK(DRV_NAME);

0 commit comments

Comments
 (0)