From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EAD4FA0093; Tue, 19 May 2020 12:55:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AD4DE1D5C9; Tue, 19 May 2020 12:55:36 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id AA39C1D17E for ; Tue, 19 May 2020 12:55:34 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 45B171A014E; Tue, 19 May 2020 12:55:34 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 8DB501A015E; Tue, 19 May 2020 12:55:32 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id E98AE402B3; Tue, 19 May 2020 18:55:29 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org, david.marchand@redhat.com Cc: Hemant Agrawal Date: Tue, 19 May 2020 16:22:57 +0530 Message-Id: <20200519105258.31426-1-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200513103629.8436-1-hemant.agrawal@nxp.com> References: <20200513103629.8436-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v2 1/2] lib/metrics: fix to reset the init flag X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" metrics_initialized shall be reset in deinit function This is currently causing issue in running metrics_autotest mulutiple times Fixes: 07c1b6925b65 ("telemetry: invert dependency on metrics library") Signed-off-by: Hemant Agrawal --- 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..dba6409c27 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 = 0; 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.17.1