From patchwork Wed May 13 11:38:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 186592 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp377129ilb; Wed, 13 May 2020 04:40:49 -0700 (PDT) X-Google-Smtp-Source: APiQypK/K4ueLIy+xieO7AN6GQKlbOhl3fDsvnqBSenFQ3S/jioi97pIPV3G94yfTPr2gHXT3ceg X-Received: by 2002:a1c:2d14:: with SMTP id t20mr43822169wmt.28.1589370049272; Wed, 13 May 2020 04:40:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589370049; cv=none; d=google.com; s=arc-20160816; b=ZGzurEZoeIlZgfpX4Fq3L6DxgH0+7d+szrwPda4QE/YkCpkgacOBh/H2ce6kP5/3ed LFXPJtX/oomT5MdSH73UnSAyEVEmRS9nuRKyPKoQroew7YR8TfI0jXgThBnHpfKx3DtL mrVJeiDOsoLVsbEWCaGoi+lSYH5vnhE1fvMmkNEUEQE5GDTqX6MU1LGprtIM7XMVYVqw tU2rYJ0PGjAAMcmRpOMvY1M1Ve0ZBJTx/8KHAXQeSsu5cLvYuyWDSoFHaTG8Df4FMFfH c6aRvYn3jYk4k+KWhwNS5E0Qfq6kSR04zNYSPbMNonjXyLN73daSDzGTp+Kzj/zEai9f 2thg== 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:message-id:date:cc:to :from; bh=T89XcHNigmwJFhXC2Sieln6APgtH4Aw5NnKGhg1Zp8Y=; b=Wz0Z9bEmjBwJQPzYT3/rcPkb2XgT0xdnooaIbGYuwdl4wnm9YQMbNqiS1sxJef+BOY sVF4ZyRBpe6dAmnOwYojwwGHRteasrWDpj06kvHKx6xulG3pJw788Ul/mTvdraJI8+iy 41p0VLpx2s03LSM925vhN/A9mshPJSI1vrUikR5KXYhUJhI+7MsNOe7iqONbF7xqncxi 8iQFltMLBxbh5QnQzRKG7Vkg6p1iNnIzwH2DU24flh3tEosNUwN3OXzEdfbajd9lYsyz z0ULsMHWQI5URXU0ai5WFICwsIH9E438S+U3Y3iqqoj5xOdXQ5JYdzPVQ7ImQzAXsbA1 hGKg== 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 d13si15129569wrw.463.2020.05.13.04.40.49; Wed, 13 May 2020 04:40:49 -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 9FDEA1D546; Wed, 13 May 2020 13:40:47 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id DE4271D544 for ; Wed, 13 May 2020 13:40:45 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 4A451201332; Wed, 13 May 2020 13:40:45 +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 0140A201326; Wed, 13 May 2020 13:40:44 +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 4DE7C402B4; Wed, 13 May 2020 19:40:42 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org Cc: Hemant Agrawal Date: Wed, 13 May 2020 17:08:21 +0530 Message-Id: <20200513113822.8681-1-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 1/2] bitratestats: add support for free 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" This patch adds support for free funnction. Signed-off-by: Hemant Agrawal --- lib/librte_bitratestats/rte_bitrate.c | 8 ++++++++ lib/librte_bitratestats/rte_bitrate.h | 9 +++++++++ lib/librte_bitratestats/rte_bitratestats_version.map | 6 ++++++ 3 files changed, 23 insertions(+) -- 2.17.1 diff --git a/lib/librte_bitratestats/rte_bitrate.c b/lib/librte_bitratestats/rte_bitrate.c index d18152365..1d4715d6c 100644 --- a/lib/librte_bitratestats/rte_bitrate.c +++ b/lib/librte_bitratestats/rte_bitrate.c @@ -35,6 +35,14 @@ rte_stats_bitrate_create(void) RTE_CACHE_LINE_SIZE); } +int +rte_stats_bitrate_free(struct rte_stats_bitrates *bitrate_data) +{ + if (bitrate_data) + rte_free(bitrate_data); + return 0; +} + int rte_stats_bitrate_reg(struct rte_stats_bitrates *bitrate_data) { diff --git a/lib/librte_bitratestats/rte_bitrate.h b/lib/librte_bitratestats/rte_bitrate.h index ef10f22ff..b2d532b95 100644 --- a/lib/librte_bitratestats/rte_bitrate.h +++ b/lib/librte_bitratestats/rte_bitrate.h @@ -27,6 +27,15 @@ struct rte_stats_bitrates; */ struct rte_stats_bitrates *rte_stats_bitrate_create(void); +/** + * Free bitrate statistics structure + * + * + * @param bitrate_data + * Pointer allocated by rte_stats_create() + */ +__rte_experimental +int rte_stats_bitrate_free(struct rte_stats_bitrates *bitrate_data); /** * Register bitrate statistics with the metric library. diff --git a/lib/librte_bitratestats/rte_bitratestats_version.map b/lib/librte_bitratestats/rte_bitratestats_version.map index 88fc2912d..85522a05d 100644 --- a/lib/librte_bitratestats/rte_bitratestats_version.map +++ b/lib/librte_bitratestats/rte_bitratestats_version.map @@ -7,3 +7,9 @@ DPDK_20.0 { local: *; }; + +EXPERIMENTAL { + global: + + rte_stats_bitrate_free; +}; From patchwork Wed May 13 11:38:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 186593 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp377200ilb; Wed, 13 May 2020 04:40:55 -0700 (PDT) X-Google-Smtp-Source: APiQypJXDcDzXxZfGfHUqY487Xg1Zrzn3tOWIlHNpQJGo6JQt0QYZ2PjkYkpf2gC48gTOFBiWUaa X-Received: by 2002:adf:fa91:: with SMTP id h17mr30273383wrr.111.1589370055711; Wed, 13 May 2020 04:40:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589370055; cv=none; d=google.com; s=arc-20160816; b=jdl1Knzvpxuehcj+ic5HS8uCkNL4T3PQBUSi7jRd/P56WNqp9qpG92aAbbvlo++Hfz HAKgz8nwazjUzT/DSJAl85rpO+NRFVdmnFdbzq3RUwsn51dokBxRc0BXZMrPMVgEbRPj H3g7U5iviToac090eud7ntsJwiKTbcQ5Opsu86lCEA8D5qOiZdV50681RiZpcnyhtPhu VejugCmUdIHeWIs5oBvKlc9t1pROTCqG0lnnpXJpPE2SW4tbdWj+xrwDF/82Nbncz8Kp O3Tt92D2q0dEmZYNUZIMA+bZw8vMdEoe+menuyw57batbIleaT1nQRfGd9Lf8kVejF03 WEig== 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=HgcnRQVf09MKaezTBnb/ZPHsGrWWIX95VRti85X4MMw=; b=LMaVOG75onp6w3GMzhvHM2eDh71r1ObK+l1EeHyJnSwPQr7OzTEDHhZ+ON1X99uByK lj2+aKB81nnQ07dUKM/+IqaTCcFQM6XPwzerCfud+t8UPPm7haHZAwhpZnDspIOZdfCM lW4l9QWLutVrflKrWnoTBkXtktazSh/pg3LxXctUPY4kpAcfw6lnek6oviInrlQSujTI 2pn0Mav1rZ9mQxyd8muJE3jpvJ4JaSgSqLrOxIShG3jhKi0aGeZs3gvYC9hZ8hkgc+iT NhWdJr8uozD/1qfWe57h8cGrf3nxlGbq8aoJjTzCj2AKES880jBodiQmjGzGLmwf2Shu WSpQ== 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 b15si6257682wrp.74.2020.05.13.04.40.55; Wed, 13 May 2020 04:40:55 -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 37C531D54D; Wed, 13 May 2020 13:40:49 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id 8A9091D544 for ; Wed, 13 May 2020 13:40:46 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 34CB320133A; Wed, 13 May 2020 13:40:46 +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 DF867201335; Wed, 13 May 2020 13:40:44 +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 CB756402E1; Wed, 13 May 2020 19:40:42 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org Cc: Hemant Agrawal Date: Wed, 13 May 2020 17:08:22 +0530 Message-Id: <20200513113822.8681-2-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200513113822.8681-1-hemant.agrawal@nxp.com> References: <20200513113822.8681-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 2/2] test: add support for testing bitrate stats free 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" This patch adds support to test rte_stats_bitrate_free Signed-off-by: Hemant Agrawal --- app/test/test_bitratestats.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/app/test/test_bitratestats.c b/app/test/test_bitratestats.c index 39d7f734d..c14d32e03 100644 --- a/app/test/test_bitratestats.c +++ b/app/test/test_bitratestats.c @@ -32,12 +32,15 @@ test_stats_bitrate_create(void) return TEST_SUCCESS; } -/* To test free the resources from bitrate_reg test */ +/* To test free the resources from bitrate_create test */ static int test_stats_bitrate_free(void) { int ret = 0; + ret = rte_stats_bitrate_free(bitrate_data); + TEST_ASSERT(ret >= 0, "rte_stats_bitrate_free failed"); + ret = rte_metrics_deinit(); TEST_ASSERT(ret >= 0, "Test Failed: rte_metrics_deinit failed");