From 1168be00778a98eee7e15a811652ea6645051a56 Mon Sep 17 00:00:00 2001 From: Hemant Agrawal Date: Tue, 19 May 2020 16:22:57 +0530 Subject: [PATCH] metrics: fix library cleanup metrics_initialized shall be reset in deinit function. This is currently causing issue in running metrics_autotest multiple times. Fixes: 07c1b6925b65 ("telemetry: invert dependency on metrics library") Signed-off-by: Hemant Agrawal Acked-by: David Marchand --- lib/librte_metrics/rte_metrics.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/librte_metrics/rte_metrics.c b/lib/librte_metrics/rte_metrics.c index e07670219f..e2a0fbeda8 100644 --- a/lib/librte_metrics/rte_metrics.c +++ b/lib/librte_metrics/rte_metrics.c @@ -85,6 +85,7 @@ rte_metrics_deinit(void) { struct rte_metrics_data_s *stats; const struct rte_memzone *memzone; + int ret; if (rte_eal_process_type() != RTE_PROC_PRIMARY) return -EINVAL; @@ -96,8 +97,10 @@ rte_metrics_deinit(void) stats = memzone->addr; memset(stats, 0, sizeof(struct rte_metrics_data_s)); - return rte_memzone_free(memzone); - + ret = rte_memzone_free(memzone); + if (ret == 0) + metrics_initialized = 0; + return ret; } int -- 2.20.1