Add ethtool -g support to virtio_net
Subsystems (4)
PATCH 1/1 Add ethtool -g support to virtio_net
From: Rick Jones <[email protected]>
Add support for reporting ring sizes via ethtool -g to the virtio_net driver.
---
Tested briefly in a single guest:
raj@raj-ubuntu-guest:~$ ethtool -g eth0 Ring parameters for eth0: Pre-set maximums: RX: 256 RX Mini: 0 RX Jumbo: 0 TX: 256 Current hardware settings: RX: 256 RX Mini: 0 RX Jumbo: 0 TX: 256
drivers/net/virtio_net.c +13 -0
@@ -880,8 +880,21 @@ static void virtnet_vlan_rx_kill_vid(struct net_device *dev, u16 vid)dev_warn (&dev->dev,"Failed to kill VLAN ID %d.\n" , vid); } +static void virtnet_get_ringparam (struct net_device *dev, +struct ethtool_ringparam *ring) +{ +struct virtnet_info *vi =netdev_priv (dev); + + ring->rx_max_pending =virtqueue_get_vring_size (vi->rvq); + ring->tx_max_pending =virtqueue_get_vring_size (vi->svq); + ring->rx_pending = ring->rx_max_pending; + ring->tx_pending = ring->tx_max_pending; + +} +static const struct ethtool_ops virtnet_ethtool_ops = { .get_link = ethtool_op_get_link, + .get_ringparam = virtnet_get_ringparam, };#define MIN_MTU 68
drivers/virtio/virtio_ring.c +10 -0
@@ -529,4 +529,14 @@ void vring_transport_features(struct virtio_device *vdev) }EXPORT_SYMBOL_GPL (vring_transport_features); +/* return the size of the vring within the virtqueue */ +unsigned int virtqueue_get_vring_size (struct virtqueue *_vq) +{ + +struct vring_virtqueue *vq =to_vvq (_vq); + +return vq->vring.num; +} +EXPORT_SYMBOL_GPL (virtqueue_get_vring_size); +MODULE_LICENSE ("GPL" );
include/linux/virtio.h +5 -0
@@ -61,6 +61,9 @@ struct virtqueue {* virtqueue_detach_unused_buf: detach first unused buffer * vq: the struct virtqueue we're talking about. * Returns NULL or the "data" token handed to add_buf +* virtqueue_get_vring_size: return the size of the virtqueue's vring +* vq: the struct virtqueue containing the vring of interest. +* Returns the size of the vring. * * Locking rules are straightforward: the driver is responsible for * locking. No two operations may be invoked simultaneously, with the exception
@@ -97,6 +100,8 @@ bool virtqueue_enable_cb_delayed(struct virtqueue *vq);void *virtqueue_detach_unused_buf (struct virtqueue *vq); +unsigned int virtqueue_get_vring_size (struct virtqueue *vq); +/** * virtio_device - representation of a device using virtio * @index: unique position on the virtio bus
Quoted 6 lines · On Wed, 19 Oct 2011 11:10:59 -0700 (PDT), [email protected] (Rick Jones)…
From: Rick Jones <[email protected]>
Add support for reporting ring sizes via ethtool -g to the
virtio_netdriver.Signed-off-by Rick Jones <[email protected]>
MST, want me to take this, or do you?
Cheers,
Rusty.
David Miller
maintainerFrom: Rusty Russell <[email protected]>
Date: Thu, 20 Oct 2011 18:25:24 +1030
Quoted 11 lines · On Wed, 19 Oct 2011 11:10:59 -0700 (PDT), [email protected] (Rick Jones)…
Quoted 6 lines
From: Rick Jones <[email protected]>
Add support for reporting ring sizes via ethtool -g to the
virtio_netdriver.Signed-off-by Rick Jones <[email protected]>Acked-by Rusty Russell <[email protected]>MST, want me to take this, or do you?
I can also take it directly, just let me know.
Quoted 9 lines · David Miller
From: Rusty Russell <[email protected]>
Date: Thu, 20 Oct 2011 18:25:24 +1030Quoted 6 lines · On Wed, 19 Oct 2011 11:10:59 -0700 (PDT), [email protected] (Rick Jones)…
Quoted 5 lines
From: Rick Jones <[email protected]>
Add support for reporting ring sizes via ethtool -g to the
virtio_netdriver.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Rick Jones <[email protected]>Acked-by Rusty Russell <[email protected]>MST, want me to take this, or do you?
I can also take it directly, just let me know.
Please do, thanks very much.
Signature · 1 line
MST
David Miller
maintainerFrom: "Michael S. Tsirkin" <[email protected]>
Date: Mon, 24 Oct 2011 07:31:05 +0200
Quoted 14 lines · David Miller
Quoted 13 lines
From: Rusty Russell <[email protected]>
Date: Thu, 20 Oct 2011 18:25:24 +1030Quoted 10 lines · On Wed, 19 Oct 2011 11:10:59 -0700 (PDT), [email protected] (Rick Jones)…
Quoted 6 lines
From: Rick Jones <[email protected]>
Add support for reporting ring sizes via ethtool -g to the
virtio_netdriver.Signed-off-by Rick Jones <[email protected]>Acked-by Rusty Russell <[email protected]>
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
MST, want me to take this, or do you?
I can also take it directly, just let me know.
Please do, thanks very much.
Done.
Quoted 9 lines · David Miller
From: Rusty Russell <[email protected]>
Date: Thu, 20 Oct 2011 18:25:24 +1030Quoted 6 lines · On Wed, 19 Oct 2011 11:10:59 -0700 (PDT), [email protected] (Rick Jones)…
Quoted 5 lines
From: Rick Jones <[email protected]>
Add support for reporting ring sizes via ethtool -g to the
virtio_netdriver.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Rick Jones <[email protected]>Acked-by Rusty Russell <[email protected]>MST, want me to take this, or do you?
I can also take it directly, just let me know.
I'm happy with that.
Thanks,
Rusty.