From patchwork Tue May 19 10:52:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 186928 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp3723844ilb; Tue, 19 May 2020 03:55:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbSowmnUn3rp94eUCXpd7y7d/MLRBVn2i0rP7mAyQyUX08z8tEwjTcQXOdQ2gMfbt8sxVR X-Received: by 2002:a1c:3b87:: with SMTP id i129mr5079506wma.38.1589885737341; Tue, 19 May 2020 03:55:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589885737; cv=none; d=google.com; s=arc-20160816; b=rbfUA8hLHtw/qrCx24Jf70OLrBrhCqAzX0oPb8dv6hZz49xSUaBBPluAXfFMrEpHQK sc9AbQAH5FOpSkanvNhYYrbE2Bp17Kvu0PtQKL0YTgxmn1BMbcLkNug4wTZTdCvrrSz/ StOUSYQRZKqrQwpKImYwNoe5fXSkzVFJ/l9DtMJvdNU4kam6TslYZynntiqRpZqtvf7u hqQ76O/mNTk2mapYux56IqJb+ntFdmLcCQejkoMfS2SBNDHk5JqRCS831+4Tuz7Yt03+ 1heGehzriXDa6CpNra9ElYQ58MI1S6zljeiAL84yu6RmGEf8JfFzJIu9RffF0OnIbHHM 1JUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:cc:to:from; bh=6uAukTzx+viFoo5PrQisgrPzt9R/N4LPd0FXPxMTuAE=; b=i9He922znpdRJXjMzPCQPPG8hvKhWDNHYOVO9a8T48tqsYDq/zC9JDX8JXgvDPI4T9 oAOM+U1NzioUHVSebQiogc/CgzUAxKlEc7C+UhyzFxeTFbeFBpD5gCObysVNCSXrShe3 uad/jrUI1sXI5+UEABarkfs3QYKXAHdaTbpOrgvJsP2EmArHPLGAf7k4qr3TR67L2BHa i6B7yT4ZIszydYTejxcq+LJ6jh4amTHJVvcVG5KUW44TYTYtiXG97BoAhdQy/uWtn8Nq Y7hv+in1fN3FqSg2WRhFSIVOsNBaISAg5/olt8pxhpHfALEjdz0zR4DBpXXdLw/bb5Hh w8gQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id m25si534088wrb.498.2020.05.19.03.55.37; Tue, 19 May 2020 03:55:37 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com 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(-) -- 2.17.1 Acked-by: David Marchand 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 From patchwork Tue May 19 10:52:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 186929 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp3723902ilb; Tue, 19 May 2020 03:55:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRdnx2DIdKMDRCNcCT5Zrb8hD0vxcdMBzuAVW8aCszc2KA8nqUF7bmz4mP4aGkZXX8Q/j+ X-Received: by 2002:a5d:40c2:: with SMTP id b2mr24253824wrq.13.1589885745057; Tue, 19 May 2020 03:55:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589885745; cv=none; d=google.com; s=arc-20160816; b=zpC5sV4iOw7YEmv706ickUMJnJ7qSBjWFSR/MayB1m95VgRS2yf91WXxggjZ303kGB gwFL3VfajzTbJaKYsvKPs50ZswjJwYhQhUkB1WgPREmmmGVVuDSnBhWHldqglBny4Q/v 5I4u7R/pm7LyY/rmA4wIWz6GMEGCTBiviOpL2v5XdamRxCzQrZYjosWVaCLGf36Blic+ e8SH0zZLcdIB0ja37b80TVybKRjZv65DP3+65KT7Bgil7jlsStuJ/xbV+gZd+yjXS/5Y AOpovoqGUPhfEGYEq7VIZwrY/SP05z77mNzeQK95Xh7hF/hqJ9rQHyr+D4vMMgiAP1Q0 pj2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:cc:to:from; bh=esfrZDUAqE2/z9TBZQLcxiy7Z0TWzNcAQU9oLwDNFvs=; b=nsXA/n2EwbezcgE866Xzpgf2yof757kOJpwdcT0rkRrQDdFquZji6tBwVonsKc3Gty nW95InsjKqzOvMNjkQ76ncHmuNbSMdst4gkrwW1Qy6r5aznibEDTDz9Y+N8phf9k92nD Jl+ud5MfYsoWnF1LfyKT/c7IjOqy3ISho5wLAfNXVFQhm1deBRuOg+R1EEyzerCy24P/ BQE0GUjSwrcQVxHmpmguibyLVdawF2Pr0CKWLnfEnNf+rgYr5P5UjN6LmVEtQJHEV90m p5TYMLx4A4OxK/7dHPbRjbmfbhVtsYpNWdYtG0IBpr4Djh+WElsWPd1ONUIVrG7181D9 /E0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id j186si2614274wma.144.2020.05.19.03.55.44; Tue, 19 May 2020 03:55:45 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 143A01D5DC; Tue, 19 May 2020 12:55:40 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id 458911D17E for ; Tue, 19 May 2020 12:55:35 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id CFE9720008C; 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 inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 2DAA4200049; Tue, 19 May 2020 12:55:33 +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 9D840402B4; Tue, 19 May 2020 18:55:30 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org, david.marchand@redhat.com Cc: Hemant Agrawal Date: Tue, 19 May 2020 16:22:58 +0530 Message-Id: <20200519105258.31426-2-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200519105258.31426-1-hemant.agrawal@nxp.com> References: <20200513103629.8436-1-hemant.agrawal@nxp.com> <20200519105258.31426-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v2 2/2] test: support cleanup in bitrate and latency test 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" both bitratestats_autotest latency test initializes the metrics library. It should be cleaned during exit. Signed-off-by: Hemant Agrawal --- app/test/test_bitratestats.c | 14 ++++++++++++++ app/test/test_latencystats.c | 3 +++ 2 files changed, 17 insertions(+) -- 2.17.1 diff --git a/app/test/test_bitratestats.c b/app/test/test_bitratestats.c index 3a7d9c037a..39d7f734d4 100644 --- a/app/test/test_bitratestats.c +++ b/app/test/test_bitratestats.c @@ -32,6 +32,18 @@ test_stats_bitrate_create(void) return TEST_SUCCESS; } +/* To test free the resources from bitrate_reg test */ +static int +test_stats_bitrate_free(void) +{ + int ret = 0; + + ret = rte_metrics_deinit(); + TEST_ASSERT(ret >= 0, "Test Failed: rte_metrics_deinit failed"); + + return TEST_SUCCESS; +} + /* To test bit rate registration */ static int test_stats_bitrate_reg(void) @@ -214,6 +226,8 @@ unit_test_suite bitratestats_testsuite = { */ TEST_CASE_ST(test_bit_packet_forward, NULL, test_stats_bitrate_calc), + /* TEST CASE 9: Test to do the cleanup w.r.t create */ + TEST_CASE(test_stats_bitrate_free), TEST_CASES_END() } }; diff --git a/app/test/test_latencystats.c b/app/test/test_latencystats.c index 968e0bc470..427339904d 100644 --- a/app/test/test_latencystats.c +++ b/app/test/test_latencystats.c @@ -60,6 +60,9 @@ static int test_latency_uninit(void) ret = rte_latencystats_uninit(); TEST_ASSERT(ret >= 0, "Test Failed: rte_latencystats_uninit failed"); + ret = rte_metrics_deinit(); + TEST_ASSERT(ret >= 0, "Test Failed: rte_metrics_deinit failed"); + return TEST_SUCCESS; }