aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vnet/devices/virtio/device.c21
-rw-r--r--src/vnet/devices/virtio/node.c1
-rw-r--r--src/vnet/devices/virtio/pci.c4
-rw-r--r--src/vnet/devices/virtio/virtio.c1
-rw-r--r--src/vnet/devices/virtio/virtio.h1
5 files changed, 28 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)
diff --git a/src/vnet/devices/virtio/node.c b/src/vnet/devices/virtio/node.c
index 551651ed372..a022ee5eacc 100644
--- a/src/vnet/devices/virtio/node.c
+++ b/src/vnet/devices/virtio/node.c
@@ -390,6 +390,7 @@ virtio_device_input_gso_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
}
vring->last_used_idx = last;
+ vring->total_packets += n_rx_packets;
vlib_increment_combined_counter (vnm->interface_main.combined_sw_if_counters
+ VNET_INTERFACE_COUNTER_RX, thread_index,
vif->sw_if_index, n_rx_packets,
diff --git a/src/vnet/devices/virtio/pci.c b/src/vnet/devices/virtio/pci.c
index 07744c20301..f678c3960bf 100644
--- a/src/vnet/devices/virtio/pci.c
+++ b/src/vnet/devices/virtio/pci.c
@@ -642,6 +642,7 @@ virtio_pci_control_vring_packed_init (vlib_main_t * vm, virtio_if_t * vif,
vring->device_event->off_wrap = 0;
vring->device_event->flags = 0;
+ vring->total_packets = 0;
vring->queue_id = queue_num;
vring->queue_size = queue_size;
vring->avail_wrap_counter = 1;
@@ -694,6 +695,7 @@ virtio_pci_control_vring_split_init (vlib_main_t * vm, virtio_if_t * vif,
clib_memset (ptr, 0, i);
vnet_virtio_vring_init (vring, queue_size, ptr, VNET_VIRTIO_PCI_VRING_ALIGN);
vring->queue_id = queue_num;
+ vring->total_packets = 0;
ASSERT (vring->buffers == 0);
virtio_log_debug (vif, "control-queue: number %u, size %u", queue_num,
@@ -765,6 +767,7 @@ virtio_pci_vring_split_init (vlib_main_t * vm, virtio_if_t * vif,
vring->queue_id = queue_num;
vring->avail->flags = VIRTIO_RING_FLAG_MASK_INT;
vring->flow_table = 0;
+ vring->total_packets = 0;
ASSERT (vring->buffers == 0);
vec_validate_aligned (vring->buffers, queue_size, CLIB_CACHE_LINE_BYTES);
@@ -854,6 +857,7 @@ virtio_pci_vring_packed_init (vlib_main_t * vm, virtio_if_t * vif,
vring->avail_wrap_counter = 1;
vring->used_wrap_counter = 1;
+ vring->total_packets = 0;
ASSERT (vring->buffers == 0);
vec_validate_aligned (vring->buffers, queue_size, CLIB_CACHE_LINE_BYTES);
diff --git a/src/vnet/devices/virtio/virtio.c b/src/vnet/devices/virtio/virtio.c
index ee149350a70..33af8b8c455 100644
--- a/src/vnet/devices/virtio/virtio.c
+++ b/src/vnet/devices/virtio/virtio.c
@@ -116,6 +116,7 @@ virtio_vring_init (vlib_main_t * vm, virtio_if_t * vif, u16 idx, u16 sz)
else
vring->call_fd = eventfd (0, EFD_NONBLOCK | EFD_CLOEXEC);
+ vring->total_packets = 0;
vring->queue_size = sz;
vring->kick_fd = eventfd (0, EFD_NONBLOCK | EFD_CLOEXEC);
virtio_log_debug (vif, "vring %u size %u call_fd %d kick_fd %d", idx,
diff --git a/src/vnet/devices/virtio/virtio.h b/src/vnet/devices/virtio/virtio.h
index e12198c3bf8..431b1d25c26 100644
--- a/src/vnet/devices/virtio/virtio.h
+++ b/src/vnet/devices/virtio/virtio.h
@@ -110,6 +110,7 @@ typedef struct
vnet_hw_if_rx_mode mode;
virtio_vring_buffering_t *buffering;
gro_flow_table_t *flow_table;
+ u64 total_packets;
} vnet_virtio_vring_t;
typedef union