diff options
author | Rick Jones <rick.jones2@hp.com> | 2011-10-19 04:10:59 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-10-24 02:07:21 -0400 |
commit | 8f9f4668b37bcc877156dd525a856055735c8d24 (patch) | |
tree | a9d0a7cc6729884564f5d2bfb8edbdcc678b3f1c /drivers/net/virtio_net.c | |
parent | ca35a0ef85e8ed6df6d5ab01fb6c3530cca0c469 (diff) |
Add ethtool -g support to virtio_net
Add support for reporting ring sizes via ethtool -g to the virtio_net
driver.
Signed-off-by: Rick Jones <rick.jones2@hp.com>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Michael S. Tsirkin <mst@redhat.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 | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 765ab9ac9d17..91039ab16728 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -877,8 +877,21 @@ static void virtnet_vlan_rx_kill_vid(struct net_device *dev, u16 vid) | |||
877 | dev_warn(&dev->dev, "Failed to kill VLAN ID %d.\n", vid); | 877 | dev_warn(&dev->dev, "Failed to kill VLAN ID %d.\n", vid); |
878 | } | 878 | } |
879 | 879 | ||
880 | static void virtnet_get_ringparam(struct net_device *dev, | ||
881 | struct ethtool_ringparam *ring) | ||
882 | { | ||
883 | struct virtnet_info *vi = netdev_priv(dev); | ||
884 | |||
885 | ring->rx_max_pending = virtqueue_get_vring_size(vi->rvq); | ||
886 | ring->tx_max_pending = virtqueue_get_vring_size(vi->svq); | ||
887 | ring->rx_pending = ring->rx_max_pending; | ||
888 | ring->tx_pending = ring->tx_max_pending; | ||
889 | |||
890 | } | ||
891 | |||
880 | static const struct ethtool_ops virtnet_ethtool_ops = { | 892 | static const struct ethtool_ops virtnet_ethtool_ops = { |
881 | .get_link = ethtool_op_get_link, | 893 | .get_link = ethtool_op_get_link, |
894 | .get_ringparam = virtnet_get_ringparam, | ||
882 | }; | 895 | }; |
883 | 896 | ||
884 | #define MIN_MTU 68 | 897 | #define MIN_MTU 68 |