From: Hemant Agrawal Date: Tue, 19 May 2020 10:52:57 +0000 (+0530) Subject: metrics: fix library cleanup X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=1168be00778a98eee7e15a811652ea6645051a56;p=dpdk.git 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 --- 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