summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMonendra Singh Kushwaha <kmonendra@marvell.com>2024-05-21 03:26:49 +0530
committerMonendra Singh Kushwaha <kmonendra@marvell.com>2024-06-11 10:28:09 +0000
commit55457075d9bc9ec76ae11874aceffc75f98e0f64 (patch)
treefb407fb76b6affcf34aad3e7cf5b6fde07b2d3c7 /src
parent4c872e9f75deeb9626badde3db9b5cfadec4592a (diff)
octeon: add clear counters for port and queuesv24.06-rc2
Type: feature Change-Id: Ie36be41694e7bd5341b4239dcba2ae6834c4a73f Signed-off-by: Monendra Singh Kushwaha <kmonendra@marvell.com> (cherry picked from commit 68b8125dbfc2c5ba7703d8af1c02585fd1263b37)
Diffstat (limited to 'src')
-rw-r--r--src/plugins/dev_octeon/counter.c42
-rw-r--r--src/plugins/dev_octeon/init.c3
-rw-r--r--src/plugins/dev_octeon/octeon.h3
3 files changed, 48 insertions, 0 deletions
diff --git a/src/plugins/dev_octeon/counter.c b/src/plugins/dev_octeon/counter.c
index 5763237d105..dd73684c386 100644
--- a/src/plugins/dev_octeon/counter.c
+++ b/src/plugins/dev_octeon/counter.c
@@ -294,3 +294,45 @@ oct_txq_get_stats (vlib_main_t *vm, vnet_dev_port_t *port,
return VNET_DEV_OK;
}
+
+void
+oct_port_clear_counters (vlib_main_t *vm, vnet_dev_port_t *port)
+{
+ vnet_dev_t *dev = port->dev;
+ oct_device_t *cd = vnet_dev_get_data (dev);
+ struct roc_nix *nix = cd->nix;
+ int rrv;
+
+ if ((rrv = roc_nix_stats_reset (nix)))
+ oct_roc_err (dev, rrv, "roc_nix_stats_reset() failed");
+}
+
+void
+oct_rxq_clear_counters (vlib_main_t *vm, vnet_dev_rx_queue_t *rxq)
+{
+ oct_rxq_t *crq = vnet_dev_get_rx_queue_data (rxq);
+ vnet_dev_t *dev = rxq->port->dev;
+ oct_device_t *cd = vnet_dev_get_data (dev);
+ struct roc_nix *nix = cd->nix;
+ int rrv;
+
+ if ((rrv = roc_nix_stats_queue_reset (nix, crq->rq.qid, 1)))
+ oct_roc_err (dev, rrv,
+ "roc_nix_stats_queue_reset() failed for rx queue %u",
+ rxq->queue_id);
+}
+
+void
+oct_txq_clear_counters (vlib_main_t *vm, vnet_dev_tx_queue_t *txq)
+{
+ oct_txq_t *ctq = vnet_dev_get_tx_queue_data (txq);
+ vnet_dev_t *dev = txq->port->dev;
+ oct_device_t *cd = vnet_dev_get_data (dev);
+ struct roc_nix *nix = cd->nix;
+ int rrv;
+
+ if ((rrv = roc_nix_stats_queue_reset (nix, ctq->sq.qid, 0)))
+ oct_roc_err (dev, rrv,
+ "roc_nix_stats_queue_reset() failed for tx queue %u",
+ txq->queue_id);
+}
diff --git a/src/plugins/dev_octeon/init.c b/src/plugins/dev_octeon/init.c
index aacc18415c2..87ed8317277 100644
--- a/src/plugins/dev_octeon/init.c
+++ b/src/plugins/dev_octeon/init.c
@@ -141,6 +141,7 @@ oct_init_nix (vlib_main_t *vm, vnet_dev_t *dev)
.config_change_validate = oct_port_cfg_change_validate,
.format_status = format_oct_port_status,
.format_flow = format_oct_port_flow,
+ .clear_counters = oct_port_clear_counters,
},
.data_size = sizeof (oct_port_t),
.initial_data = &oct_port,
@@ -159,6 +160,7 @@ oct_init_nix (vlib_main_t *vm, vnet_dev_t *dev)
.alloc = oct_rx_queue_alloc,
.free = oct_rx_queue_free,
.format_info = format_oct_rxq_info,
+ .clear_counters = oct_rxq_clear_counters,
},
},
.tx_queue = {
@@ -173,6 +175,7 @@ oct_init_nix (vlib_main_t *vm, vnet_dev_t *dev)
.alloc = oct_tx_queue_alloc,
.free = oct_tx_queue_free,
.format_info = format_oct_txq_info,
+ .clear_counters = oct_txq_clear_counters,
},
},
};
diff --git a/src/plugins/dev_octeon/octeon.h b/src/plugins/dev_octeon/octeon.h
index 4926f1afe79..a87a5e3e1ed 100644
--- a/src/plugins/dev_octeon/octeon.h
+++ b/src/plugins/dev_octeon/octeon.h
@@ -149,6 +149,9 @@ vnet_dev_rv_t oct_flow_query (vlib_main_t *, vnet_dev_port_t *, u32, uword,
/* counter.c */
void oct_port_add_counters (vlib_main_t *, vnet_dev_port_t *);
+void oct_port_clear_counters (vlib_main_t *, vnet_dev_port_t *);
+void oct_rxq_clear_counters (vlib_main_t *, vnet_dev_rx_queue_t *);
+void oct_txq_clear_counters (vlib_main_t *, vnet_dev_tx_queue_t *);
vnet_dev_rv_t oct_port_get_stats (vlib_main_t *, vnet_dev_port_t *);
vnet_dev_rv_t oct_rxq_get_stats (vlib_main_t *, vnet_dev_port_t *,
vnet_dev_rx_queue_t *);