From patchwork Mon Nov 19 22:10:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fiona Trahe X-Patchwork-Id: 48190 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7DBDC532C; Mon, 19 Nov 2018 23:10:30 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 410D84F9A for ; Mon, 19 Nov 2018 23:10:28 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Nov 2018 14:10:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,254,1539673200"; d="scan'208";a="109890224" Received: from sivswdev01.ir.intel.com (HELO localhost.localdomain) ([10.237.217.45]) by orsmga002.jf.intel.com with ESMTP; 19 Nov 2018 14:10:25 -0800 From: Fiona Trahe To: dev@dpdk.org Cc: akhil.goyal@nxp.com, tomaszx.jozwiak@intel.com, shally.verma@caviumnetworks.com, ashish.gupta@caviumnetworks.com, lee.daly@intel.com, fiona.trahe@intel.com Date: Mon, 19 Nov 2018 22:10:10 +0000 Message-Id: <1542665411-23489-2-git-send-email-fiona.trahe@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1542665411-23489-1-git-send-email-fiona.trahe@intel.com> References: <1542665411-23489-1-git-send-email-fiona.trahe@intel.com> Subject: [dpdk-dev] [PATCH 1/2] compressdev: add api to bulk free ops 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" There's an API to bulk allocate operations, this adds a corresponding bulk free API. Signed-off-by: Fiona Trahe Acked-by: Shally Verma --- lib/librte_compressdev/rte_comp.c | 12 ++++++++++++ lib/librte_compressdev/rte_comp.h | 14 ++++++++++++++ lib/librte_compressdev/rte_compressdev_version.map | 1 + 3 files changed, 27 insertions(+) diff --git a/lib/librte_compressdev/rte_comp.c b/lib/librte_compressdev/rte_comp.c index 4634c12..06e3d44 100644 --- a/lib/librte_compressdev/rte_comp.c +++ b/lib/librte_compressdev/rte_comp.c @@ -213,3 +213,15 @@ rte_comp_op_free(struct rte_comp_op *op) if (op != NULL && op->mempool != NULL) rte_mempool_put(op->mempool, op); } + +void __rte_experimental +rte_comp_op_bulk_free(struct rte_comp_op **ops, uint16_t nb_ops) +{ + uint16_t i; + + for (i = 0; i < nb_ops; i++) { + if (ops[i] != NULL && ops[i]->mempool != NULL) + rte_mempool_put(ops[i]->mempool, ops[i]); + ops[i] = NULL; + } +} diff --git a/lib/librte_compressdev/rte_comp.h b/lib/librte_compressdev/rte_comp.h index 395ce29..c2b3de8 100644 --- a/lib/librte_compressdev/rte_comp.h +++ b/lib/librte_compressdev/rte_comp.h @@ -467,6 +467,20 @@ void __rte_experimental rte_comp_op_free(struct rte_comp_op *op); /** + * Bulk free operation structures + * If operations have been allocated from an rte_mempool, then the operations + * will be returned to the mempool. + * The array entry will be cleared. + * + * @param ops + * Array of Compress operations + * @param nb_ops + * Number of operations to free + */ +void __rte_experimental +rte_comp_op_bulk_free(struct rte_comp_op **ops, uint16_t nb_ops); + +/** * Get the name of a compress service feature flag * * @param flag diff --git a/lib/librte_compressdev/rte_compressdev_version.map b/lib/librte_compressdev/rte_compressdev_version.map index 6f900b6..13a047e 100644 --- a/lib/librte_compressdev/rte_compressdev_version.map +++ b/lib/librte_compressdev/rte_compressdev_version.map @@ -32,6 +32,7 @@ EXPERIMENTAL { rte_comp_get_feature_name; rte_comp_op_alloc; rte_comp_op_bulk_alloc; + rte_comp_op_bulk_free; rte_comp_op_free; rte_comp_op_pool_create; From patchwork Mon Nov 19 22:10:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fiona Trahe X-Patchwork-Id: 48191 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1DA2F5699; Mon, 19 Nov 2018 23:10:37 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 3BF245323 for ; Mon, 19 Nov 2018 23:10:35 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Nov 2018 14:10:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,254,1539673200"; d="scan'208";a="109890236" Received: from sivswdev01.ir.intel.com (HELO localhost.localdomain) ([10.237.217.45]) by orsmga002.jf.intel.com with ESMTP; 19 Nov 2018 14:10:32 -0800 From: Fiona Trahe To: dev@dpdk.org Cc: akhil.goyal@nxp.com, tomaszx.jozwiak@intel.com, shally.verma@caviumnetworks.com, ashish.gupta@caviumnetworks.com, lee.daly@intel.com, fiona.trahe@intel.com Date: Mon, 19 Nov 2018 22:10:11 +0000 Message-Id: <1542665411-23489-3-git-send-email-fiona.trahe@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1542665411-23489-1-git-send-email-fiona.trahe@intel.com> References: <1542665411-23489-1-git-send-email-fiona.trahe@intel.com> Subject: [dpdk-dev] [PATCH 2/2] test/compress: use bulk free operations api 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" Use the new rte_comp_op_bulk_free API. Add trace to catch any mempool elements not freed at test end. Signed-off-by: Fiona Trahe Acked-by: Shally Verma --- test/test/test_compressdev.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test/test/test_compressdev.c b/test/test/test_compressdev.c index 5d5e519..3ea726d 100644 --- a/test/test/test_compressdev.c +++ b/test/test/test_compressdev.c @@ -69,6 +69,13 @@ testsuite_teardown(void) { struct comp_testsuite_params *ts_params = &testsuite_params; + if (rte_mempool_in_use_count(ts_params->large_mbuf_pool)) + RTE_LOG(ERR, USER1, "Large mbuf pool still has unfreed bufs\n"); + if (rte_mempool_in_use_count(ts_params->small_mbuf_pool)) + RTE_LOG(ERR, USER1, "Small mbuf pool still has unfreed bufs\n"); + if (rte_mempool_in_use_count(ts_params->op_pool)) + RTE_LOG(ERR, USER1, "op pool still has unfreed ops\n"); + rte_mempool_free(ts_params->large_mbuf_pool); rte_mempool_free(ts_params->small_mbuf_pool); rte_mempool_free(ts_params->op_pool); @@ -731,6 +738,7 @@ test_deflate_comp_decomp(const char * const test_bufs[], goto exit; } + for (i = 0; i < num_bufs; i++) { ops[i]->m_src = uncomp_bufs[i]; ops[i]->m_dst = comp_bufs[i]; @@ -961,12 +969,9 @@ test_deflate_comp_decomp(const char * const test_bufs[], /* * Free the previous compress operations, - * as it is not needed anymore + * as they are not needed anymore */ - for (i = 0; i < num_bufs; i++) { - rte_comp_op_free(ops_processed[i]); - ops_processed[i] = NULL; - } + rte_comp_op_bulk_free(ops_processed, num_bufs); /* Decompress data (either with Zlib API or compressdev API */ if (zlib_dir == ZLIB_DECOMPRESS || zlib_dir == ZLIB_ALL) {