summaryrefslogtreecommitdiffstats
path: root/src/vnet/dev/port.c
diff options
context:
space:
mode:
authorMonendra Singh Kushwaha <kmonendra@marvell.com>2024-05-21 03:18:26 +0530
committerMonendra Singh Kushwaha <kmonendra@marvell.com>2024-06-11 10:27:12 +0000
commit4c872e9f75deeb9626badde3db9b5cfadec4592a (patch)
tree06aa4cca81d59023eab6c1a7b870d880f3e37912 /src/vnet/dev/port.c
parent6e0f70a035e2d2d0db75e4bfa4ceb748a3c2259e (diff)
dev: add port and queue counter clear operation
Type: feature Change-Id: Ibd876c5251fc2f9d87816d235fff2de22be4b21c Signed-off-by: Monendra Singh Kushwaha <kmonendra@marvell.com> (cherry picked from commit 2ea1e2c36124be4120e36a3385f5e27c7606597d)
Diffstat (limited to 'src/vnet/dev/port.c')
-rw-r--r--src/vnet/dev/port.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/vnet/dev/port.c b/src/vnet/dev/port.c
index 8a6df54cbc8..5b4b8cdc7b8 100644
--- a/src/vnet/dev/port.c
+++ b/src/vnet/dev/port.c
@@ -733,16 +733,26 @@ vnet_dev_port_if_remove (vlib_main_t *vm, vnet_dev_port_t *port)
void
vnet_dev_port_clear_counters (vlib_main_t *vm, vnet_dev_port_t *port)
{
- if (port->counter_main)
+ if (port->port_ops.clear_counters)
+ port->port_ops.clear_counters (vm, port);
+ else if (port->counter_main)
vnet_dev_counters_clear (vm, port->counter_main);
foreach_vnet_dev_port_rx_queue (q, port)
- if (q->counter_main)
- vnet_dev_counters_clear (vm, q->counter_main);
+ {
+ if (port->rx_queue_ops.clear_counters)
+ port->rx_queue_ops.clear_counters (vm, q);
+ else if (q->counter_main)
+ vnet_dev_counters_clear (vm, q->counter_main);
+ }
foreach_vnet_dev_port_tx_queue (q, port)
- if (q->counter_main)
- vnet_dev_counters_clear (vm, q->counter_main);
+ {
+ if (port->tx_queue_ops.clear_counters)
+ port->tx_queue_ops.clear_counters (vm, q);
+ else if (q->counter_main)
+ vnet_dev_counters_clear (vm, q->counter_main);
+ }
log_notice (port->dev, "counters cleared on port %u", port->port_id);
}