[dpdk-dev] test/mempool: improve default mempool ops selection

Message ID 20171117180703.4085-1-jerin.jacob@caviumnetworks.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers

Checks

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

Commit Message

Jerin Jacob Nov. 17, 2017, 6:07 p.m. UTC
  Use of rte_eal_mbuf_default_mempool_ops() API will
allow to override pool handler through "--mbuf-pool-ops-name"
eal command line argument.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 test/test/test_mempool.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Olivier Matz Dec. 12, 2017, 2:21 p.m. UTC | #1
Hi Jerin,

On Fri, Nov 17, 2017 at 11:37:03PM +0530, Jerin Jacob wrote:
> Use of rte_eal_mbuf_default_mempool_ops() API will
> allow to override pool handler through "--mbuf-pool-ops-name"
> eal command line argument.
> 
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> ---
>  test/test/test_mempool.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/test/test/test_mempool.c b/test/test/test_mempool.c
> index 37ead503b..46eb5ce06 100644
> --- a/test/test/test_mempool.c
> +++ b/test/test/test_mempool.c
> @@ -565,7 +565,7 @@ test_mempool(void)
>  
>  	/* Create a mempool based on Default handler */
>  	printf("Testing %s mempool handler\n",
> -	       RTE_MBUF_DEFAULT_MEMPOOL_OPS);
> +	       rte_eal_mbuf_default_mempool_ops());
>  	default_pool = rte_mempool_create_empty("default_pool",
>  						MEMPOOL_SIZE,
>  						MEMPOOL_ELT_SIZE,
> @@ -577,7 +577,7 @@ test_mempool(void)
>  		goto err;
>  	}
>  	if (rte_mempool_set_ops_byname(default_pool,
> -				RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL) < 0) {
> +				rte_eal_mbuf_default_mempool_ops(), NULL) < 0) {
>  		printf("cannot set %s handler\n",
>  			RTE_MBUF_DEFAULT_MEMPOOL_OPS);

The error printf should also be modified (there is another one below).
Since all uses are in the same function, it's worth putting it in a local
variable.

Regards,
Olivier
  
Santosh Shukla Dec. 12, 2017, 3:10 p.m. UTC | #2
On Friday 17 November 2017 11:37 PM, Jerin Jacob wrote:
> Use of rte_eal_mbuf_default_mempool_ops() API will
> allow to override pool handler through "--mbuf-pool-ops-name"
> eal command line argument.
>
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> ---
>  test/test/test_mempool.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/test/test/test_mempool.c b/test/test/test_mempool.c
> index 37ead503b..46eb5ce06 100644
> --- a/test/test/test_mempool.c
> +++ b/test/test/test_mempool.c
> @@ -565,7 +565,7 @@ test_mempool(void)
>  
>  	/* Create a mempool based on Default handler */
>  	printf("Testing %s mempool handler\n",
> -	       RTE_MBUF_DEFAULT_MEMPOOL_OPS);
> +	       rte_eal_mbuf_default_mempool_ops());
>  	default_pool = rte_mempool_create_empty("default_pool",
>  						MEMPOOL_SIZE,
>  						MEMPOOL_ELT_SIZE,
> @@ -577,7 +577,7 @@ test_mempool(void)
>  		goto err;
>  	}
>  	if (rte_mempool_set_ops_byname(default_pool,
> -				RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL) < 0) {
> +				rte_eal_mbuf_default_mempool_ops(), NULL) < 0) {
>  		printf("cannot set %s handler\n",
>  			RTE_MBUF_DEFAULT_MEMPOOL_OPS);

Pl. replace error printf _ops with _mbuf_default_mempool_ops.
With that:
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>

Thanks.
  

Patch

diff --git a/test/test/test_mempool.c b/test/test/test_mempool.c
index 37ead503b..46eb5ce06 100644
--- a/test/test/test_mempool.c
+++ b/test/test/test_mempool.c
@@ -565,7 +565,7 @@  test_mempool(void)
 
 	/* Create a mempool based on Default handler */
 	printf("Testing %s mempool handler\n",
-	       RTE_MBUF_DEFAULT_MEMPOOL_OPS);
+	       rte_eal_mbuf_default_mempool_ops());
 	default_pool = rte_mempool_create_empty("default_pool",
 						MEMPOOL_SIZE,
 						MEMPOOL_ELT_SIZE,
@@ -577,7 +577,7 @@  test_mempool(void)
 		goto err;
 	}
 	if (rte_mempool_set_ops_byname(default_pool,
-				RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL) < 0) {
+				rte_eal_mbuf_default_mempool_ops(), NULL) < 0) {
 		printf("cannot set %s handler\n",
 			RTE_MBUF_DEFAULT_MEMPOOL_OPS);
 		goto err;