aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlavio Leitner <fbl@redhat.com>2014-12-05 19:13:24 -0500
committerDavid S. Miller <davem@davemloft.net>2014-12-09 16:06:49 -0500
commitc19be735c99e221e00157c6db475fe007c056638 (patch)
tree3323d19a4ee2ab2f5c78c569c6c96d6fe7b2c6d9
parent6dc696401a819d01428301bb0236f47ab14b7cda (diff)
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>
-rw-r--r--drivers/net/dummy.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c
index ff435fbd1ad0..413ca4f73997 100644
--- a/drivers/net/dummy.c
+++ b/drivers/net/dummy.c
@@ -38,6 +38,9 @@
38#include <net/rtnetlink.h> 38#include <net/rtnetlink.h>
39#include <linux/u64_stats_sync.h> 39#include <linux/u64_stats_sync.h>
40 40
41#define DRV_NAME "dummy"
42#define DRV_VERSION "1.0"
43
41static int numdummies = 1; 44static int numdummies = 1;
42 45
43/* fake multicast ability */ 46/* fake multicast ability */
@@ -120,12 +123,24 @@ static const struct net_device_ops dummy_netdev_ops = {
120 .ndo_change_carrier = dummy_change_carrier, 123 .ndo_change_carrier = dummy_change_carrier,
121}; 124};
122 125
126static 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
133static const struct ethtool_ops dummy_ethtool_ops = {
134 .get_drvinfo = dummy_get_drvinfo,
135};
136
123static void dummy_setup(struct net_device *dev) 137static void dummy_setup(struct net_device *dev)
124{ 138{
125 ether_setup(dev); 139 ether_setup(dev);
126 140
127 /* Initialize the device structure. */ 141 /* Initialize the device structure. */
128 dev->netdev_ops = &dummy_netdev_ops; 142 dev->netdev_ops = &dummy_netdev_ops;
143 dev->ethtool_ops = &dummy_ethtool_ops;
129 dev->destructor = free_netdev; 144 dev->destructor = free_netdev;
130 145
131 /* Fill in device structure with ethernet-generic values. */ 146 /* Fill in device structure with ethernet-generic values. */
@@ -150,7 +165,7 @@ static int dummy_validate(struct nlattr *tb[], struct nlattr *data[])
150} 165}
151 166
152static struct rtnl_link_ops dummy_link_ops __read_mostly = { 167static struct rtnl_link_ops dummy_link_ops __read_mostly = {
153 .kind = "dummy", 168 .kind = DRV_NAME,
154 .setup = dummy_setup, 169 .setup = dummy_setup,
155 .validate = dummy_validate, 170 .validate = dummy_validate,
156}; 171};
@@ -209,4 +224,4 @@ static void __exit dummy_cleanup_module(void)
209module_init(dummy_init_module); 224module_init(dummy_init_module);
210module_exit(dummy_cleanup_module); 225module_exit(dummy_cleanup_module);
211MODULE_LICENSE("GPL"); 226MODULE_LICENSE("GPL");
212MODULE_ALIAS_RTNL_LINK("dummy"); 227MODULE_ALIAS_RTNL_LINK(DRV_NAME);