summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio/device.c
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2022-09-14 11:25:54 +0000
committerBeno�t Ganne <bganne@cisco.com>2022-09-16 16:16:53 +0000
commitdd0144a4563212e193b517d05b231350d58fa53e (patch)
treee4634fcf73ab639292aebebd22f76fa9e5928c9a /src/vnet/devices/virtio/device.c
parentc795b8836d83b4b062aa21423f842aa765269c2c (diff)
virtio: add support for per queue packet counter
Type: improvement Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: I21a701a556b88a9d81f0e074a59fa34b3746b1d9
Diffstat (limited to 'src/vnet/devices/virtio/device.c')
-rw-r--r--src/vnet/devices/virtio/device.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/vnet/devices/virtio/device.c b/src/vnet/devices/virtio/device.c
index 0ae41141a5a..ec5cdbd7bdd 100644
--- a/src/vnet/devices/virtio/device.c
+++ b/src/vnet/devices/virtio/device.c
@@ -63,13 +63,31 @@ format_virtio_device (u8 * s, va_list * args)
u32 dev_instance = va_arg (*args, u32);
int verbose = va_arg (*args, int);
u32 indent = format_get_indent (s);
+ virtio_main_t *vim = &virtio_main;
+ virtio_if_t *vif = vec_elt_at_index (vim->interfaces, dev_instance);
+ vnet_virtio_vring_t *vring = 0;
s = format (s, "VIRTIO interface");
if (verbose)
{
s = format (s, "\n%U instance %u", format_white_space, indent + 2,
dev_instance);
+ s = format (s, "\n%U RX QUEUE : Total Packets", format_white_space,
+ indent + 4);
+ vec_foreach (vring, vif->rxq_vrings)
+ {
+ s = format (s, "\n%U %8u : %llu", format_white_space, indent + 4,
+ RX_QUEUE_ACCESS (vring->queue_id), vring->total_packets);
+ }
+ s = format (s, "\n%U TX QUEUE : Total Packets", format_white_space,
+ indent + 4);
+ vec_foreach (vring, vif->txq_vrings)
+ {
+ s = format (s, "\n%U %8u : %llu", format_white_space, indent + 4,
+ TX_QUEUE_ACCESS (vring->queue_id), vring->total_packets);
+ }
}
+
return s;
}
@@ -408,6 +426,7 @@ add_buffer_to_slot (vlib_main_t *vm, vlib_node_runtime_t *node,
clib_memset_u8 (hdr, 0, hdr_sz);
+ vring->total_packets++;
if (b->flags & VNET_BUFFER_F_GSO)
{
if (do_gso)
@@ -614,6 +633,8 @@ add_buffer_to_slot_packed (vlib_main_t *vm, vlib_node_runtime_t *node,
clib_memset (hdr, 0, hdr_sz);
+ vring->total_packets++;
+
if (b->flags & VNET_BUFFER_F_GSO)
{
if (do_gso)