diff options
author | Rick Jones <rick.jones2@hp.com> | 2011-11-14 09:17:08 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-11-16 17:26:46 -0500 |
commit | 66846048f55c6c05a4c46c2daabb773173f8f28d (patch) | |
tree | 21fdef9bb249056f7f334e67fbbc05a61b0cf9ce /drivers/net/virtio_net.c | |
parent | 64882709ef07f3eae29c7afc5aa8b84d12733a72 (diff) |
enable virtio_net to return bus_info in ethtool -i consistent with emulated NICs
Add a new .bus_name to virtio_config_ops then modify virtio_net to
call through to it in an ethtool .get_drvinfo routine to report
bus_info in ethtool -i output which is consistent with other
emulated NICs and the output of lspci.
Signed-off-by: Rick Jones <rick.jones2@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r-- | drivers/net/virtio_net.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 6ee8410443c4..4dc9d842a7a3 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -39,6 +39,7 @@ module_param(gso, bool, 0444); | |||
39 | #define GOOD_COPY_LEN 128 | 39 | #define GOOD_COPY_LEN 128 |
40 | 40 | ||
41 | #define VIRTNET_SEND_COMMAND_SG_MAX 2 | 41 | #define VIRTNET_SEND_COMMAND_SG_MAX 2 |
42 | #define VIRTNET_DRIVER_VERSION "1.0.0" | ||
42 | 43 | ||
43 | struct virtnet_stats { | 44 | struct virtnet_stats { |
44 | struct u64_stats_sync syncp; | 45 | struct u64_stats_sync syncp; |
@@ -889,7 +890,21 @@ static void virtnet_get_ringparam(struct net_device *dev, | |||
889 | 890 | ||
890 | } | 891 | } |
891 | 892 | ||
893 | |||
894 | static void virtnet_get_drvinfo(struct net_device *dev, | ||
895 | struct ethtool_drvinfo *info) | ||
896 | { | ||
897 | struct virtnet_info *vi = netdev_priv(dev); | ||
898 | struct virtio_device *vdev = vi->vdev; | ||
899 | |||
900 | strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); | ||
901 | strlcpy(info->version, VIRTNET_DRIVER_VERSION, sizeof(info->version)); | ||
902 | strlcpy(info->bus_info, virtio_bus_name(vdev), sizeof(info->bus_info)); | ||
903 | |||
904 | } | ||
905 | |||
892 | static const struct ethtool_ops virtnet_ethtool_ops = { | 906 | static const struct ethtool_ops virtnet_ethtool_ops = { |
907 | .get_drvinfo = virtnet_get_drvinfo, | ||
893 | .get_link = ethtool_op_get_link, | 908 | .get_link = ethtool_op_get_link, |
894 | .get_ringparam = virtnet_get_ringparam, | 909 | .get_ringparam = virtnet_get_ringparam, |
895 | }; | 910 | }; |