Skip to content

Commit

Permalink
dummy: add support for ethtool get_drvinfo
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Flavio Leitner authored and David S. Miller committed Dec 9, 2014
1 parent 6dc6964 commit c19be73
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions drivers/net/dummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
#include <net/rtnetlink.h>
#include <linux/u64_stats_sync.h>

#define DRV_NAME "dummy"
#define DRV_VERSION "1.0"

static int numdummies = 1;

/* fake multicast ability */
Expand Down Expand Up @@ -120,12 +123,24 @@ static const struct net_device_ops dummy_netdev_ops = {
.ndo_change_carrier = dummy_change_carrier,
};

static void dummy_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
}

static const struct ethtool_ops dummy_ethtool_ops = {
.get_drvinfo = dummy_get_drvinfo,
};

static void dummy_setup(struct net_device *dev)
{
ether_setup(dev);

/* Initialize the device structure. */
dev->netdev_ops = &dummy_netdev_ops;
dev->ethtool_ops = &dummy_ethtool_ops;
dev->destructor = free_netdev;

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

static struct rtnl_link_ops dummy_link_ops __read_mostly = {
.kind = "dummy",
.kind = DRV_NAME,
.setup = dummy_setup,
.validate = dummy_validate,
};
Expand Down Expand Up @@ -209,4 +224,4 @@ static void __exit dummy_cleanup_module(void)
module_init(dummy_init_module);
module_exit(dummy_cleanup_module);
MODULE_LICENSE("GPL");
MODULE_ALIAS_RTNL_LINK("dummy");
MODULE_ALIAS_RTNL_LINK(DRV_NAME);

0 comments on commit c19be73

Please sign in to comment.