diff options
author | Flavio Leitner <fbl@redhat.com> | 2014-12-05 19:13:24 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-12-09 16:06:49 -0500 |
commit | c19be735c99e221e00157c6db475fe007c056638 (patch) | |
tree | 3323d19a4ee2ab2f5c78c569c6c96d6fe7b2c6d9 | |
parent | 6dc696401a819d01428301bb0236f47ab14b7cda (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.c | 19 |
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 | |||
41 | static int numdummies = 1; | 44 | static 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 | ||
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 | |||
123 | static void dummy_setup(struct net_device *dev) | 137 | static 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 | ||
152 | static struct rtnl_link_ops dummy_link_ops __read_mostly = { | 167 | static 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) | |||
209 | module_init(dummy_init_module); | 224 | module_init(dummy_init_module); |
210 | module_exit(dummy_cleanup_module); | 225 | module_exit(dummy_cleanup_module); |
211 | MODULE_LICENSE("GPL"); | 226 | MODULE_LICENSE("GPL"); |
212 | MODULE_ALIAS_RTNL_LINK("dummy"); | 227 | MODULE_ALIAS_RTNL_LINK(DRV_NAME); |