[2/2] test/compress: use bulk free operations api

Message ID 1542665411-23489-3-git-send-email-fiona.trahe@intel.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series compressdev: add bulk op free API |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Fiona Trahe Nov. 19, 2018, 10:10 p.m. UTC
  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 <fiona.trahe@intel.com>
---
 test/test/test_compressdev.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
  

Comments

Verma, Shally Nov. 20, 2018, 5:20 a.m. UTC | #1
>-----Original Message-----
>From: Fiona Trahe <fiona.trahe@intel.com>
>Sent: 20 November 2018 03:40
>To: dev@dpdk.org
>Cc: akhil.goyal@nxp.com; tomaszx.jozwiak@intel.com; Verma, Shally <Shally.Verma@cavium.com>; Gupta, Ashish
><Ashish.Gupta@cavium.com>; lee.daly@intel.com; fiona.trahe@intel.com
>Subject: [PATCH 2/2] test/compress: use bulk free operations api
>
>External Email
>
>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 <fiona.trahe@intel.com>
>---
> 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) {
>--
>2.7.4
Acked-by: Shally Verma <shally.verma@caviumnetworks.com>
  
Daly, Lee Nov. 22, 2018, 10:45 a.m. UTC | #2
> -----Original Message-----
> From: Trahe, Fiona
> Sent: Monday, November 19, 2018 10:10 PM
> To: dev@dpdk.org
> Cc: akhil.goyal@nxp.com; Jozwiak, TomaszX <tomaszx.jozwiak@intel.com>;
> shally.verma@caviumnetworks.com; ashish.gupta@caviumnetworks.com;
> Daly, Lee <lee.daly@intel.com>; Trahe, Fiona <fiona.trahe@intel.com>
> Subject: [PATCH 2/2] test/compress: use bulk free operations api
> 
> 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 <fiona.trahe@intel.com>
> ---
>  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) {
> --
> 2.7.4

Series Acked-by: Lee Daly <lee.daly@intel.com>
  

Patch

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) {