From patchwork Thu May 14 09:30:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 186703 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp1221874ilb; Thu, 14 May 2020 02:32:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylYWAoEEtwBu/+wXixCqa5YOnQ/6bDO7Eg5Tt7tLG/JrAvdtu1M+t4ahDUv4t/2gQnHCgx X-Received: by 2002:a1c:7e4f:: with SMTP id z76mr3797437wmc.177.1589448748711; Thu, 14 May 2020 02:32:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589448748; cv=none; d=google.com; s=arc-20160816; b=soYRTILJ+Y2eVN39TmxnUZ+H8RLjg8JmhEsbH1aNIxCKiU274es8WrUVQxuSlrSJNj 4KICwjwTS7jCk7I5rwIGtpmXcOFARGLwlDnQa2Uy1xemnu9wIdyM4kDpoZS2pEzUeaQr iLR+djNvH0CCmnznixEUHE42I3LEv31xd806ewcIgRB7cJSNxF+fOwfh4mWANUgcV0L+ 8qtJiyCIpDOGFswGvsLhf0tnJkg1z5ycA/JJmRMAfo248m/I+fiHkaPYrKENwZGd7UQ7 0nUrWml4sSTqjGojJpHQLhiUnfkodNtlBhv7HeexhBb0fW7y/2pqe11QTIuLN+SIyT3p We3A== 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=OHfrRy2eF4xy7wYXfSpWXZ35/srp7eKALP0dyG7YTlQ=; b=O3rHNC610X91Kaaik16pN68xnnNgD9fJKgYMEVWDbIpQ4boPVc2Ah5CWg6PH389A/m CKwB+hfAhodT+wuxOvM1UfjIG4/weUCLEmccm7+7P7+qSHoM/pLOIkDCTVPtDgW8+Is+ Oc81ZbaPZLHuJsvB382jPRaAs5xjoy2dwE3ia0Hi6Srxy9bUDbeEiDOyWXKyXj3k64m5 dVDHMC61dWSJOzvgNPg7FLcatbUDgVnUaLgQ1U0bRsawcFGGUOHUJcOVSqCimbs4Vbgc LIEC3Q/iqD7Vt7RkX7VUIsC3v3IdyqJ/HOuoaAnmGnJGGqUW/T7tfdE4SUaAx53jmBzr TM8g== 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 u13si2056045wrw.220.2020.05.14.02.32.28; Thu, 14 May 2020 02:32:28 -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 B82F71D703; Thu, 14 May 2020 11:32:27 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id 2465B1D6FE for ; Thu, 14 May 2020 11:32:25 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 90C14200294; Thu, 14 May 2020 11:32:25 +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 477952002A1; Thu, 14 May 2020 11:32:24 +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 72CE540245; Thu, 14 May 2020 17:32:22 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org Cc: Hemant Agrawal Date: Thu, 14 May 2020 15:00:00 +0530 Message-Id: <20200514093001.12007-1-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] [PATCHv2 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 | 11 ++++++++++- lib/librte_bitratestats/rte_bitratestats_version.map | 6 ++++++ 3 files changed, 24 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/lib/librte_bitratestats/rte_bitrate.c b/lib/librte_bitratestats/rte_bitrate.c index d18152365e..1d4715d6c0 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 ef10f22ff3..0e5b625b79 100644 --- a/lib/librte_bitratestats/rte_bitrate.h +++ b/lib/librte_bitratestats/rte_bitrate.h @@ -27,12 +27,21 @@ 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_bitrate_create() + */ +__rte_experimental +int rte_stats_bitrate_free(struct rte_stats_bitrates *bitrate_data); /** * Register bitrate statistics with the metric library. * * @param bitrate_data - * Pointer allocated by rte_stats_create() + * Pointer allocated by rte_stats_bitrate_create() * * @return * Zero on success diff --git a/lib/librte_bitratestats/rte_bitratestats_version.map b/lib/librte_bitratestats/rte_bitratestats_version.map index 88fc2912db..85522a05d5 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 Thu May 14 09:30:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 186704 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp1221968ilb; Thu, 14 May 2020 02:32:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfpJ0LdmESy0xNPZe1ppCAhS9aD1++zqDWlUcyLOog6k+hXx3WYhMJHpjb++Gmnu4mRN7W X-Received: by 2002:a1c:32c5:: with SMTP id y188mr3657802wmy.16.1589448755815; Thu, 14 May 2020 02:32:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589448755; cv=none; d=google.com; s=arc-20160816; b=lRuFflOUxgvtXuWxqtFGfjG7GIJ9XhZb1tItp896JEvonePcqIoRt+xPkGkTfJ4/93 knKV7B0oiefI2xu3NW1iN/wmaWPctNg2azJOBVsxx0QR/0xzKk6jK6LDQj3tYZlpUuKi akbA0pXLFLOnyuKRNgXX/YH/pvPjGdLsl+4xCSwrbsOh7Hqj7AwY52XNfjWZCsiSqJ6P lut0Bi6mCk2E/kxbgtZPqEY8rGK5P/M9p6Nb4HlcIAdEKMSEuqH7BsxJ+MtaGW04pmP6 UcY0iF6sIm2yM/HSorf9flkjjSZGwQ+ChgRvQHxlBztmqOFZOAnFOj09d6udnh/qqiy7 UANQ== 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=nw89kdaVC2rtEY4uHkn9haukusqbITJH5PwmDmvzH+8=; b=PoXvEfL6zhDDpSf3yo20iIWz06TBs+3bZQGhX05/pussYmEc2iyJbE41yOFDw0dzdY LiSgaZB/rN1VsM2UdvqYpOdk15Ra6A/DPAQb5igbN8F6Em/LY5GQy2lgej8CTRQxjTkx XiR9F80khgcWJ9HYZCToHa/EN6oaPk+pWyglkTqUvdCJBAXcOiyIzTYxGxEaeMzaGPZ6 DxNzAHjO8jmd5BNP0UqP541+uz0SPOw39g5IXX9uo9cRshk1/5z81EvfsHD+GGgLJzgP dyTdpM5aDMwqYrtr/0rgLGqTgz4gT84gToZEO6znjsKZwPQFtXNBspiG6cnUVR1++Uvy P1Tw== 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 p15si22933094wmc.64.2020.05.14.02.32.35; Thu, 14 May 2020 02:32:35 -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 407E21D718; Thu, 14 May 2020 11:32:29 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 29CF91D6FE for ; Thu, 14 May 2020 11:32:27 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id B78011A0286; Thu, 14 May 2020 11:32:26 +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 6BA0B1A026F; Thu, 14 May 2020 11:32:25 +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 2E760402DF; Thu, 14 May 2020 17:32:23 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org Cc: Hemant Agrawal Date: Thu, 14 May 2020 15:00:01 +0530 Message-Id: <20200514093001.12007-2-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200514093001.12007-1-hemant.agrawal@nxp.com> References: <20200513113822.8681-1-hemant.agrawal@nxp.com> <20200514093001.12007-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCHv2 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 --- This patch depends on : https://patches.dpdk.org/patch/70155/ 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 39d7f734d4..c14d32e037 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");