Skip to content

Commit

Permalink
virtio-net: fix total qstat values
Browse files Browse the repository at this point in the history
NIPA tests report that the interface statistics reported
via qstat are lower than those reported via ip link.
Looks like this is because some tests flip the queue
count up and down, and we end up with some of the traffic
accounted on disabled queues.

Add up counters from disabled queues.

Fixes: d888f04 ("virtio-net: support queue stat")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Link: https://patch.msgid.link/20250507003221.823267-3-kuba@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Jakub Kicinski authored and Paolo Abeni committed May 8, 2025
1 parent 23fa6a2 commit 001160e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/net/virtio_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -5678,6 +5678,10 @@ static void virtnet_get_base_stats(struct net_device *dev,

if (vi->device_stats_cap & VIRTIO_NET_STATS_TYPE_TX_SPEED)
tx->hw_drop_ratelimits = 0;

netdev_stat_queue_sum(dev,
dev->real_num_rx_queues, vi->max_queue_pairs, rx,
dev->real_num_tx_queues, vi->max_queue_pairs, tx);
}

static const struct netdev_stat_ops virtnet_stat_ops = {
Expand Down

0 comments on commit 001160e

Please sign in to comment.