aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/virtio_config.h
diff options
context:
space:
mode:
authorRick Jones <rick.jones2@hp.com>2011-11-14 09:17:08 -0500
committerDavid S. Miller <davem@davemloft.net>2011-11-16 17:26:46 -0500
commit66846048f55c6c05a4c46c2daabb773173f8f28d (patch)
tree21fdef9bb249056f7f334e67fbbc05a61b0cf9ce /include/linux/virtio_config.h
parent64882709ef07f3eae29c7afc5aa8b84d12733a72 (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 'include/linux/virtio_config.h')
-rw-r--r--include/linux/virtio_config.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index add4790b21fe..63f98d0a8efa 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -100,6 +100,10 @@
100 * vdev: the virtio_device 100 * vdev: the virtio_device
101 * This gives the final feature bits for the device: it can change 101 * This gives the final feature bits for the device: it can change
102 * the dev->feature bits if it wants. 102 * the dev->feature bits if it wants.
103 * @bus_name: return the bus name associated with the device
104 * vdev: the virtio_device
105 * This returns a pointer to the bus name a la pci_name from which
106 * the caller can then copy.
103 */ 107 */
104typedef void vq_callback_t(struct virtqueue *); 108typedef void vq_callback_t(struct virtqueue *);
105struct virtio_config_ops { 109struct virtio_config_ops {
@@ -117,6 +121,7 @@ struct virtio_config_ops {
117 void (*del_vqs)(struct virtio_device *); 121 void (*del_vqs)(struct virtio_device *);
118 u32 (*get_features)(struct virtio_device *vdev); 122 u32 (*get_features)(struct virtio_device *vdev);
119 void (*finalize_features)(struct virtio_device *vdev); 123 void (*finalize_features)(struct virtio_device *vdev);
124 const char *(*bus_name)(struct virtio_device *vdev);
120}; 125};
121 126
122/* If driver didn't advertise the feature, it will never appear. */ 127/* If driver didn't advertise the feature, it will never appear. */
@@ -182,5 +187,14 @@ struct virtqueue *virtio_find_single_vq(struct virtio_device *vdev,
182 return ERR_PTR(err); 187 return ERR_PTR(err);
183 return vq; 188 return vq;
184} 189}
190
191static inline
192const char *virtio_bus_name(struct virtio_device *vdev)
193{
194 if (!vdev->config->bus_name)
195 return "virtio";
196 return vdev->config->bus_name(vdev);
197}
198
185#endif /* __KERNEL__ */ 199#endif /* __KERNEL__ */
186#endif /* _LINUX_VIRTIO_CONFIG_H */ 200#endif /* _LINUX_VIRTIO_CONFIG_H */