* Re: [dpdk-dev] [RFC PATCH] test/test: support default mempool autotest
2017-03-31 10:17 [dpdk-dev] [RFC PATCH] test/test: support default mempool autotest Shreyansh Jain
@ 2017-03-31 13:59 ` Olivier Matz
2017-03-31 14:11 ` Hemant Agrawal
2017-03-31 15:11 ` Santosh Shukla
2017-04-03 9:00 ` [dpdk-dev] [PATCH v2 1/2] test/test: free mempool on exit Hemant Agrawal
2 siblings, 1 reply; 17+ messages in thread
From: Olivier Matz @ 2017-03-31 13:59 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, hemant.agrawal
Hi Shreyansh,
On Fri, 31 Mar 2017 15:47:49 +0530, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> Mempool test currently supports:
> * ring_mp_mc
> * stack
>
> In case a new mempool handler is added, there are multiple options
> for supporting that in the mempool autotest:
> 1. Like the patch below, adding a new default pool options
> So, ring* + stack + default (which can be 'stack' or 'ring')
> * This way, whatever the value of RTE_MBUF_DEFAULT_MEMPOOL_OPS is set,
> it would be verified.
> * even if that means duplicating some test (for example when "stack" is
> set as default and it already part of standard test)
>
> 2. Removing stack handler as standard, and moving only to one specified
> by RTE_MBUF_DEFAULT_MEMPOOL_OPS (+ existing ring*)
> * It still leaves space for duplication of ring_mp_mc in case that is
> set to default (as in case of master tree)
>
> 3. Iterating over the list of mempool handlers and performing a set
> or predefined tests
> * reqiures quite a lot of rewrite of mempool autotest
> * specially, allowing some special tests (cache/no-cache) cases when
> a set of variables in loop are being used, would be tricky
>
> 4. only checking the default pool set by RTE_* macro
> * In case a user has build DPDK using a configured value, probably it
> expected that application (or custom applications) would use that
> default handler.
> * would also mean that non-default (non RTE_* value) would not be tested
> even though they are being used.
>
> The decision above would impact how new mempool handlers are added and
> how their testing (API verification) can be done without impacting the
> mempool_autotest file everytime.
>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
I'd prefer 3-, it looks to be the most complete.
But I think 1- is ok for now.
>
> ---
> test/test/test_mempool.c | 35 +++++++++++++++++++++++++++++++++--
> 1 file changed, 33 insertions(+), 2 deletions(-)
>
> diff --git a/test/test/test_mempool.c b/test/test/test_mempool.c
> index b9880b3..aefbf80 100644
> --- a/test/test/test_mempool.c
> +++ b/test/test/test_mempool.c
> @@ -509,9 +509,11 @@ walk_cb(struct rte_mempool *mp, void *userdata __rte_unused)
> static int
> test_mempool(void)
> {
> + int ret = -1;
> struct rte_mempool *mp_cache = NULL;
> struct rte_mempool *mp_nocache = NULL;
> struct rte_mempool *mp_stack = NULL;
> + struct rte_mempool *default_pool = NULL;
>
> rte_atomic32_init(&synchro);
>
> @@ -561,6 +563,30 @@ test_mempool(void)
> }
> rte_mempool_obj_iter(mp_stack, my_obj_init, NULL);
>
> + /* Create a mempool based on Default handler, if not "stack" */
> + printf("Testing %s mempool handler\n",
> + RTE_MBUF_DEFAULT_MEMPOOL_OPS);
> + default_pool = rte_mempool_create_empty("default_pool",
> + MEMPOOL_SIZE,
> + MEMPOOL_ELT_SIZE,
> + RTE_MEMPOOL_CACHE_MAX_SIZE, 0,
> + SOCKET_ID_ANY, 0);
> +
> + if (default_pool == NULL) {
> + printf("cannot allocate default mempool\n");
> + goto err;
> + }
> + if (rte_mempool_set_ops_byname(default_pool,
> + RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL) < 0) {
> + printf("cannot set default handler\n");
> + goto err;
> + }
> + if (rte_mempool_populate_default(default_pool) < 0) {
> + printf("cannot populate default mempool\n");
> + goto err;
> + }
> + rte_mempool_obj_iter(default_pool, my_obj_init, NULL);
> +
> /* retrieve the mempool from its name */
> if (rte_mempool_lookup("test_nocache") != mp_nocache) {
> printf("Cannot lookup mempool from its name\n");
> @@ -605,15 +631,20 @@ test_mempool(void)
> if (test_mempool_basic(mp_stack, 1) < 0)
> goto err;
>
> + if (test_mempool_basic(default_pool, 1) < 0)
> + goto err;
> +
> rte_mempool_list_dump(stdout);
>
> - return 0;
> + ret = 0;
looks it also fixes a memory leak :)
Can you please move the fix in another patch?
Thanks,
Olivier
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [RFC PATCH] test/test: support default mempool autotest
2017-03-31 13:59 ` Olivier Matz
@ 2017-03-31 14:11 ` Hemant Agrawal
0 siblings, 0 replies; 17+ messages in thread
From: Hemant Agrawal @ 2017-03-31 14:11 UTC (permalink / raw)
To: Olivier Matz, Shreyansh Jain; +Cc: dev
HI Olivier,
> -----Original Message-----
> From: Olivier Matz [mailto:olivier.matz@6wind.com]
> Sent: Friday, March 31, 2017 7:30 PM
> To: Shreyansh Jain <shreyansh.jain@nxp.com>
> Cc: dev@dpdk.org; Hemant Agrawal <hemant.agrawal@nxp.com>
> Subject: Re: [RFC PATCH] test/test: support default mempool autotest
>
> Hi Shreyansh,
[Hemant] I will just proxy him for his next few off days 😊
> On Fri, 31 Mar 2017 15:47:49 +0530, Shreyansh Jain <shreyansh.jain@nxp.com>
> wrote:
> > Mempool test currently supports:
> > * ring_mp_mc
> > * stack
> >
> > In case a new mempool handler is added, there are multiple options for
> > supporting that in the mempool autotest:
> > 1. Like the patch below, adding a new default pool options
> > So, ring* + stack + default (which can be 'stack' or 'ring')
> > * This way, whatever the value of RTE_MBUF_DEFAULT_MEMPOOL_OPS is
> set,
> > it would be verified.
> > * even if that means duplicating some test (for example when "stack" is
> > set as default and it already part of standard test)
> >
> > 2. Removing stack handler as standard, and moving only to one specified
> > by RTE_MBUF_DEFAULT_MEMPOOL_OPS (+ existing ring*)
> > * It still leaves space for duplication of ring_mp_mc in case that is
> > set to default (as in case of master tree)
> >
> > 3. Iterating over the list of mempool handlers and performing a set
> > or predefined tests
> > * reqiures quite a lot of rewrite of mempool autotest
> > * specially, allowing some special tests (cache/no-cache) cases when
> > a set of variables in loop are being used, would be tricky
> >
> > 4. only checking the default pool set by RTE_* macro
> > * In case a user has build DPDK using a configured value, probably it
> > expected that application (or custom applications) would use that
> > default handler.
> > * would also mean that non-default (non RTE_* value) would not be tested
> > even though they are being used.
> >
> > The decision above would impact how new mempool handlers are added and
> > how their testing (API verification) can be done without impacting the
> > mempool_autotest file everytime.
> >
> > Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>
> I'd prefer 3-, it looks to be the most complete.
> But I think 1- is ok for now.
[Hemant] Thanks for quick review, We will send patch for #1 now, and try to attempt #3 next.
>
> >
> > ---
> > test/test/test_mempool.c | 35 +++++++++++++++++++++++++++++++++--
> > 1 file changed, 33 insertions(+), 2 deletions(-)
> >
> > diff --git a/test/test/test_mempool.c b/test/test/test_mempool.c index
> > b9880b3..aefbf80 100644
> > --- a/test/test/test_mempool.c
> > +++ b/test/test/test_mempool.c
> > @@ -509,9 +509,11 @@ walk_cb(struct rte_mempool *mp, void *userdata
> > __rte_unused) static int
> > test_mempool(void)
> > {
> > + int ret = -1;
> > struct rte_mempool *mp_cache = NULL;
> > struct rte_mempool *mp_nocache = NULL;
> > struct rte_mempool *mp_stack = NULL;
> > + struct rte_mempool *default_pool = NULL;
> >
> > rte_atomic32_init(&synchro);
> >
> > @@ -561,6 +563,30 @@ test_mempool(void)
> > }
> > rte_mempool_obj_iter(mp_stack, my_obj_init, NULL);
> >
> > + /* Create a mempool based on Default handler, if not "stack" */
> > + printf("Testing %s mempool handler\n",
> > + RTE_MBUF_DEFAULT_MEMPOOL_OPS);
> > + default_pool = rte_mempool_create_empty("default_pool",
> > + MEMPOOL_SIZE,
> > + MEMPOOL_ELT_SIZE,
> > + RTE_MEMPOOL_CACHE_MAX_SIZE, 0,
> > + SOCKET_ID_ANY, 0);
> > +
> > + if (default_pool == NULL) {
> > + printf("cannot allocate default mempool\n");
> > + goto err;
> > + }
> > + if (rte_mempool_set_ops_byname(default_pool,
> > + RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL) < 0) {
> > + printf("cannot set default handler\n");
> > + goto err;
> > + }
> > + if (rte_mempool_populate_default(default_pool) < 0) {
> > + printf("cannot populate default mempool\n");
> > + goto err;
> > + }
> > + rte_mempool_obj_iter(default_pool, my_obj_init, NULL);
> > +
> > /* retrieve the mempool from its name */
> > if (rte_mempool_lookup("test_nocache") != mp_nocache) {
> > printf("Cannot lookup mempool from its name\n"); @@ -605,15
> +631,20
> > @@ test_mempool(void)
> > if (test_mempool_basic(mp_stack, 1) < 0)
> > goto err;
> >
> > + if (test_mempool_basic(default_pool, 1) < 0)
> > + goto err;
> > +
> > rte_mempool_list_dump(stdout);
> >
> > - return 0;
> > + ret = 0;
>
> looks it also fixes a memory leak :)
> Can you please move the fix in another patch?
[Hemant] OK.
>
>
> Thanks,
> Olivier
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [RFC PATCH] test/test: support default mempool autotest
2017-03-31 10:17 [dpdk-dev] [RFC PATCH] test/test: support default mempool autotest Shreyansh Jain
2017-03-31 13:59 ` Olivier Matz
@ 2017-03-31 15:11 ` Santosh Shukla
2017-04-03 9:27 ` Hemant Agrawal
2017-04-03 9:00 ` [dpdk-dev] [PATCH v2 1/2] test/test: free mempool on exit Hemant Agrawal
2 siblings, 1 reply; 17+ messages in thread
From: Santosh Shukla @ 2017-03-31 15:11 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: olivier.matz, dev, hemant.agrawal
On Fri, Mar 31, 2017 at 03:47:49PM +0530, Shreyansh Jain wrote:
> Mempool test currently supports:
> * ring_mp_mc
> * stack
>
> In case a new mempool handler is added, there are multiple options
> for supporting that in the mempool autotest:
> 1. Like the patch below, adding a new default pool options
> So, ring* + stack + default (which can be 'stack' or 'ring')
> * This way, whatever the value of RTE_MBUF_DEFAULT_MEMPOOL_OPS is set,
> it would be verified.
> * even if that means duplicating some test (for example when "stack" is
> set as default and it already part of standard test)
>
> 2. Removing stack handler as standard, and moving only to one specified
> by RTE_MBUF_DEFAULT_MEMPOOL_OPS (+ existing ring*)
> * It still leaves space for duplication of ring_mp_mc in case that is
> set to default (as in case of master tree)
>
> 3. Iterating over the list of mempool handlers and performing a set
> or predefined tests
> * reqiures quite a lot of rewrite of mempool autotest
> * specially, allowing some special tests (cache/no-cache) cases when
> a set of variables in loop are being used, would be tricky
>
> 4. only checking the default pool set by RTE_* macro
> * In case a user has build DPDK using a configured value, probably it
> expected that application (or custom applications) would use that
> default handler.
> * would also mean that non-default (non RTE_* value) would not be tested
> even though they are being used.
>
> The decision above would impact how new mempool handlers are added and
> how their testing (API verification) can be done without impacting the
> mempool_autotest file everytime.
>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>
> ---
> test/test/test_mempool.c | 35 +++++++++++++++++++++++++++++++++--
> 1 file changed, 33 insertions(+), 2 deletions(-)
>
I am too using option-2) for my ext-mempool driver and Yes, there is a chance
of 'ring_mp_mc' duplication if left as default.
BTW: we need similar changes at mempool_perf test too, right?
Are you planning to send, if not then I will propose one. Let me know.
Thanks.
> diff --git a/test/test/test_mempool.c b/test/test/test_mempool.c
> index b9880b3..aefbf80 100644
> --- a/test/test/test_mempool.c
> +++ b/test/test/test_mempool.c
> @@ -509,9 +509,11 @@ walk_cb(struct rte_mempool *mp, void *userdata __rte_unused)
> static int
> test_mempool(void)
> {
> + int ret = -1;
> struct rte_mempool *mp_cache = NULL;
> struct rte_mempool *mp_nocache = NULL;
> struct rte_mempool *mp_stack = NULL;
> + struct rte_mempool *default_pool = NULL;
>
> rte_atomic32_init(&synchro);
>
> @@ -561,6 +563,30 @@ test_mempool(void)
> }
> rte_mempool_obj_iter(mp_stack, my_obj_init, NULL);
>
> + /* Create a mempool based on Default handler, if not "stack" */
> + printf("Testing %s mempool handler\n",
> + RTE_MBUF_DEFAULT_MEMPOOL_OPS);
> + default_pool = rte_mempool_create_empty("default_pool",
> + MEMPOOL_SIZE,
> + MEMPOOL_ELT_SIZE,
> + RTE_MEMPOOL_CACHE_MAX_SIZE, 0,
> + SOCKET_ID_ANY, 0);
> +
> + if (default_pool == NULL) {
> + printf("cannot allocate default mempool\n");
> + goto err;
> + }
> + if (rte_mempool_set_ops_byname(default_pool,
> + RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL) < 0) {
> + printf("cannot set default handler\n");
> + goto err;
> + }
> + if (rte_mempool_populate_default(default_pool) < 0) {
> + printf("cannot populate default mempool\n");
> + goto err;
> + }
> + rte_mempool_obj_iter(default_pool, my_obj_init, NULL);
> +
> /* retrieve the mempool from its name */
> if (rte_mempool_lookup("test_nocache") != mp_nocache) {
> printf("Cannot lookup mempool from its name\n");
> @@ -605,15 +631,20 @@ test_mempool(void)
> if (test_mempool_basic(mp_stack, 1) < 0)
> goto err;
>
> + if (test_mempool_basic(default_pool, 1) < 0)
> + goto err;
> +
> rte_mempool_list_dump(stdout);
>
> - return 0;
> + ret = 0;
>
> err:
> rte_mempool_free(mp_nocache);
> rte_mempool_free(mp_cache);
> rte_mempool_free(mp_stack);
> - return -1;
> + rte_mempool_free(default_pool);
> +
> + return ret;
> }
>
> REGISTER_TEST_COMMAND(mempool_autotest, test_mempool);
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [RFC PATCH] test/test: support default mempool autotest
2017-03-31 15:11 ` Santosh Shukla
@ 2017-04-03 9:27 ` Hemant Agrawal
0 siblings, 0 replies; 17+ messages in thread
From: Hemant Agrawal @ 2017-04-03 9:27 UTC (permalink / raw)
To: Santosh Shukla, Shreyansh Jain; +Cc: olivier.matz, dev
On 3/31/2017 8:41 PM, Santosh Shukla wrote:
> On Fri, Mar 31, 2017 at 03:47:49PM +0530, Shreyansh Jain wrote:
>> Mempool test currently supports:
>> * ring_mp_mc
>> * stack
>>
>> In case a new mempool handler is added, there are multiple options
>> for supporting that in the mempool autotest:
>> 1. Like the patch below, adding a new default pool options
>> So, ring* + stack + default (which can be 'stack' or 'ring')
>> * This way, whatever the value of RTE_MBUF_DEFAULT_MEMPOOL_OPS is set,
>> it would be verified.
>> * even if that means duplicating some test (for example when "stack" is
>> set as default and it already part of standard test)
>>
>> 2. Removing stack handler as standard, and moving only to one specified
>> by RTE_MBUF_DEFAULT_MEMPOOL_OPS (+ existing ring*)
>> * It still leaves space for duplication of ring_mp_mc in case that is
>> set to default (as in case of master tree)
>>
>> 3. Iterating over the list of mempool handlers and performing a set
>> or predefined tests
>> * reqiures quite a lot of rewrite of mempool autotest
>> * specially, allowing some special tests (cache/no-cache) cases when
>> a set of variables in loop are being used, would be tricky
>>
>> 4. only checking the default pool set by RTE_* macro
>> * In case a user has build DPDK using a configured value, probably it
>> expected that application (or custom applications) would use that
>> default handler.
>> * would also mean that non-default (non RTE_* value) would not be tested
>> even though they are being used.
>>
>> The decision above would impact how new mempool handlers are added and
>> how their testing (API verification) can be done without impacting the
>> mempool_autotest file everytime.
>>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>>
>> ---
>> test/test/test_mempool.c | 35 +++++++++++++++++++++++++++++++++--
>> 1 file changed, 33 insertions(+), 2 deletions(-)
>>
>
> I am too using option-2) for my ext-mempool driver and Yes, there is a chance
> of 'ring_mp_mc' duplication if left as default.
>
> BTW: we need similar changes at mempool_perf test too, right?
> Are you planning to send, if not then I will propose one. Let me know.
Please propose patch for mempool_perf.
>
> Thanks.
>
>> diff --git a/test/test/test_mempool.c b/test/test/test_mempool.c
>> index b9880b3..aefbf80 100644
>> --- a/test/test/test_mempool.c
>> +++ b/test/test/test_mempool.c
>> @@ -509,9 +509,11 @@ walk_cb(struct rte_mempool *mp, void *userdata __rte_unused)
>> static int
>> test_mempool(void)
>> {
>> + int ret = -1;
>> struct rte_mempool *mp_cache = NULL;
>> struct rte_mempool *mp_nocache = NULL;
>> struct rte_mempool *mp_stack = NULL;
>> + struct rte_mempool *default_pool = NULL;
>>
>> rte_atomic32_init(&synchro);
>>
>> @@ -561,6 +563,30 @@ test_mempool(void)
>> }
>> rte_mempool_obj_iter(mp_stack, my_obj_init, NULL);
>>
>> + /* Create a mempool based on Default handler, if not "stack" */
>> + printf("Testing %s mempool handler\n",
>> + RTE_MBUF_DEFAULT_MEMPOOL_OPS);
>> + default_pool = rte_mempool_create_empty("default_pool",
>> + MEMPOOL_SIZE,
>> + MEMPOOL_ELT_SIZE,
>> + RTE_MEMPOOL_CACHE_MAX_SIZE, 0,
>> + SOCKET_ID_ANY, 0);
>> +
>> + if (default_pool == NULL) {
>> + printf("cannot allocate default mempool\n");
>> + goto err;
>> + }
>> + if (rte_mempool_set_ops_byname(default_pool,
>> + RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL) < 0) {
>> + printf("cannot set default handler\n");
>> + goto err;
>> + }
>> + if (rte_mempool_populate_default(default_pool) < 0) {
>> + printf("cannot populate default mempool\n");
>> + goto err;
>> + }
>> + rte_mempool_obj_iter(default_pool, my_obj_init, NULL);
>> +
>> /* retrieve the mempool from its name */
>> if (rte_mempool_lookup("test_nocache") != mp_nocache) {
>> printf("Cannot lookup mempool from its name\n");
>> @@ -605,15 +631,20 @@ test_mempool(void)
>> if (test_mempool_basic(mp_stack, 1) < 0)
>> goto err;
>>
>> + if (test_mempool_basic(default_pool, 1) < 0)
>> + goto err;
>> +
>> rte_mempool_list_dump(stdout);
>>
>> - return 0;
>> + ret = 0;
>>
>> err:
>> rte_mempool_free(mp_nocache);
>> rte_mempool_free(mp_cache);
>> rte_mempool_free(mp_stack);
>> - return -1;
>> + rte_mempool_free(default_pool);
>> +
>> + return ret;
>> }
>>
>> REGISTER_TEST_COMMAND(mempool_autotest, test_mempool);
>> --
>> 2.7.4
>>
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [dpdk-dev] [PATCH v2 1/2] test/test: free mempool on exit
2017-03-31 10:17 [dpdk-dev] [RFC PATCH] test/test: support default mempool autotest Shreyansh Jain
2017-03-31 13:59 ` Olivier Matz
2017-03-31 15:11 ` Santosh Shukla
@ 2017-04-03 9:00 ` Hemant Agrawal
2017-04-03 9:00 ` [dpdk-dev] [PATCH v2 2/2] test/test: support default mempool autotest Hemant Agrawal
2017-04-04 5:57 ` [dpdk-dev] [PATCH v3 1/2] test/test: free mempool on exit Hemant Agrawal
2 siblings, 2 replies; 17+ messages in thread
From: Hemant Agrawal @ 2017-04-03 9:00 UTC (permalink / raw)
To: olivier.matz; +Cc: dev, shreyansh.jain, santosh.shukla, stable
From: Shreyansh Jain <shreyansh.jain@nxp.com>
mempool autotest was not freeing the mempools.
Fixes: 8ef772ae ("app/test: rework mempool tes")
Cc: stable@dpdk.org
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
test/test/test_mempool.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/test/test/test_mempool.c b/test/test/test_mempool.c
index b9880b3..d863885 100644
--- a/test/test/test_mempool.c
+++ b/test/test/test_mempool.c
@@ -500,15 +500,10 @@ static int test_mempool_single_consumer(void)
return 0;
}
-static void
-walk_cb(struct rte_mempool *mp, void *userdata __rte_unused)
-{
- printf("\t%s\n", mp->name);
-}
-
static int
test_mempool(void)
{
+ int ret = -1;
struct rte_mempool *mp_cache = NULL;
struct rte_mempool *mp_nocache = NULL;
struct rte_mempool *mp_stack = NULL;
@@ -567,9 +562,6 @@ static int test_mempool_single_consumer(void)
goto err;
}
- printf("Walk into mempools:\n");
- rte_mempool_walk(walk_cb, NULL);
-
rte_mempool_list_dump(stdout);
/* basic tests without cache */
@@ -607,13 +599,14 @@ static int test_mempool_single_consumer(void)
rte_mempool_list_dump(stdout);
- return 0;
+ ret = 0;
err:
rte_mempool_free(mp_nocache);
rte_mempool_free(mp_cache);
rte_mempool_free(mp_stack);
- return -1;
+
+ return ret;
}
REGISTER_TEST_COMMAND(mempool_autotest, test_mempool);
--
1.9.1
^ permalink raw reply [flat|nested] 17+ messages in thread
* [dpdk-dev] [PATCH v2 2/2] test/test: support default mempool autotest
2017-04-03 9:00 ` [dpdk-dev] [PATCH v2 1/2] test/test: free mempool on exit Hemant Agrawal
@ 2017-04-03 9:00 ` Hemant Agrawal
2017-04-04 5:57 ` [dpdk-dev] [PATCH v3 1/2] test/test: free mempool on exit Hemant Agrawal
1 sibling, 0 replies; 17+ messages in thread
From: Hemant Agrawal @ 2017-04-03 9:00 UTC (permalink / raw)
To: olivier.matz; +Cc: dev, shreyansh.jain, santosh.shukla
From: Shreyansh Jain <shreyansh.jain@nxp.com>
Mempool test currently supports:
* ring_mp_mc
* stack
Adding a new default pool options. So, ring* + stack + default
(which can be 'stack' or 'ring')
* This way, whatever the value of RTE_MBUF_DEFAULT_MEMPOOL_OPS is set,
it would be verified.
* even if that means duplicating some test (for example when "stack" is
set as default and it already part of standard test)
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
test/test/test_mempool.c | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/test/test/test_mempool.c b/test/test/test_mempool.c
index d863885..aefbf80 100644
--- a/test/test/test_mempool.c
+++ b/test/test/test_mempool.c
@@ -500,6 +500,12 @@ static int test_mempool_single_consumer(void)
return 0;
}
+static void
+walk_cb(struct rte_mempool *mp, void *userdata __rte_unused)
+{
+ printf("\t%s\n", mp->name);
+}
+
static int
test_mempool(void)
{
@@ -507,6 +513,7 @@ static int test_mempool_single_consumer(void)
struct rte_mempool *mp_cache = NULL;
struct rte_mempool *mp_nocache = NULL;
struct rte_mempool *mp_stack = NULL;
+ struct rte_mempool *default_pool = NULL;
rte_atomic32_init(&synchro);
@@ -556,12 +563,39 @@ static int test_mempool_single_consumer(void)
}
rte_mempool_obj_iter(mp_stack, my_obj_init, NULL);
+ /* Create a mempool based on Default handler, if not "stack" */
+ printf("Testing %s mempool handler\n",
+ RTE_MBUF_DEFAULT_MEMPOOL_OPS);
+ default_pool = rte_mempool_create_empty("default_pool",
+ MEMPOOL_SIZE,
+ MEMPOOL_ELT_SIZE,
+ RTE_MEMPOOL_CACHE_MAX_SIZE, 0,
+ SOCKET_ID_ANY, 0);
+
+ if (default_pool == NULL) {
+ printf("cannot allocate default mempool\n");
+ goto err;
+ }
+ if (rte_mempool_set_ops_byname(default_pool,
+ RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL) < 0) {
+ printf("cannot set default handler\n");
+ goto err;
+ }
+ if (rte_mempool_populate_default(default_pool) < 0) {
+ printf("cannot populate default mempool\n");
+ goto err;
+ }
+ rte_mempool_obj_iter(default_pool, my_obj_init, NULL);
+
/* retrieve the mempool from its name */
if (rte_mempool_lookup("test_nocache") != mp_nocache) {
printf("Cannot lookup mempool from its name\n");
goto err;
}
+ printf("Walk into mempools:\n");
+ rte_mempool_walk(walk_cb, NULL);
+
rte_mempool_list_dump(stdout);
/* basic tests without cache */
@@ -597,6 +631,9 @@ static int test_mempool_single_consumer(void)
if (test_mempool_basic(mp_stack, 1) < 0)
goto err;
+ if (test_mempool_basic(default_pool, 1) < 0)
+ goto err;
+
rte_mempool_list_dump(stdout);
ret = 0;
@@ -605,6 +642,7 @@ static int test_mempool_single_consumer(void)
rte_mempool_free(mp_nocache);
rte_mempool_free(mp_cache);
rte_mempool_free(mp_stack);
+ rte_mempool_free(default_pool);
return ret;
}
--
1.9.1
^ permalink raw reply [flat|nested] 17+ messages in thread
* [dpdk-dev] [PATCH v3 1/2] test/test: free mempool on exit
2017-04-03 9:00 ` [dpdk-dev] [PATCH v2 1/2] test/test: free mempool on exit Hemant Agrawal
2017-04-03 9:00 ` [dpdk-dev] [PATCH v2 2/2] test/test: support default mempool autotest Hemant Agrawal
@ 2017-04-04 5:57 ` Hemant Agrawal
2017-04-04 5:57 ` [dpdk-dev] [PATCH v3 2/2] test/test: support default mempool autotest Hemant Agrawal
` (2 more replies)
1 sibling, 3 replies; 17+ messages in thread
From: Hemant Agrawal @ 2017-04-04 5:57 UTC (permalink / raw)
To: olivier.matz; +Cc: dev, shreyansh.jain, santosh.shukla
From: Shreyansh Jain <shreyansh.jain@nxp.com>
mempool autotest was not freeing the mempools.
Fixes: 8ef772ae ("app/test: rework mempool tes")
Cc: stable@dpdk.org
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
v3: fix the incorrect split
v2: separte the bug fix from change
test/test/test_mempool.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/test/test/test_mempool.c b/test/test/test_mempool.c
index b9880b3..715b250 100644
--- a/test/test/test_mempool.c
+++ b/test/test/test_mempool.c
@@ -509,6 +509,7 @@ static int test_mempool_single_consumer(void)
static int
test_mempool(void)
{
+ int ret = -1;
struct rte_mempool *mp_cache = NULL;
struct rte_mempool *mp_nocache = NULL;
struct rte_mempool *mp_stack = NULL;
@@ -607,13 +608,13 @@ static int test_mempool_single_consumer(void)
rte_mempool_list_dump(stdout);
- return 0;
+ ret = 0;
err:
rte_mempool_free(mp_nocache);
rte_mempool_free(mp_cache);
rte_mempool_free(mp_stack);
- return -1;
+ return ret;
}
REGISTER_TEST_COMMAND(mempool_autotest, test_mempool);
--
1.9.1
^ permalink raw reply [flat|nested] 17+ messages in thread
* [dpdk-dev] [PATCH v3 2/2] test/test: support default mempool autotest
2017-04-04 5:57 ` [dpdk-dev] [PATCH v3 1/2] test/test: free mempool on exit Hemant Agrawal
@ 2017-04-04 5:57 ` Hemant Agrawal
2017-04-05 7:02 ` santosh
2017-04-04 15:28 ` [dpdk-dev] [PATCH v3 1/2] test/test: free mempool on exit santosh
2017-04-05 9:35 ` [dpdk-dev] [PATCH v4 " Shreyansh Jain
2 siblings, 1 reply; 17+ messages in thread
From: Hemant Agrawal @ 2017-04-04 5:57 UTC (permalink / raw)
To: olivier.matz; +Cc: dev, shreyansh.jain, santosh.shukla
From: Shreyansh Jain <shreyansh.jain@nxp.com>
Mempool test currently supports:
* ring_mp_mc
* stack
Adding a new default pool options. So, ring* + stack + default
(which can be 'stack' or 'ring')
* This way, whatever the value of RTE_MBUF_DEFAULT_MEMPOOL_OPS is set,
it would be verified.
* even if that means duplicating some test (for example when "stack" is
set as default and it already part of standard test)
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
v3: fix the incorrect split
v2: split the fix from change
test/test/test_mempool.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/test/test/test_mempool.c b/test/test/test_mempool.c
index 715b250..6f0ca84 100644
--- a/test/test/test_mempool.c
+++ b/test/test/test_mempool.c
@@ -513,6 +513,7 @@ static int test_mempool_single_consumer(void)
struct rte_mempool *mp_cache = NULL;
struct rte_mempool *mp_nocache = NULL;
struct rte_mempool *mp_stack = NULL;
+ struct rte_mempool *default_pool = NULL;
rte_atomic32_init(&synchro);
@@ -562,6 +563,30 @@ static int test_mempool_single_consumer(void)
}
rte_mempool_obj_iter(mp_stack, my_obj_init, NULL);
+ /* Create a mempool based on Default handler, if not "stack" */
+ printf("Testing %s mempool handler\n",
+ RTE_MBUF_DEFAULT_MEMPOOL_OPS);
+ default_pool = rte_mempool_create_empty("default_pool",
+ MEMPOOL_SIZE,
+ MEMPOOL_ELT_SIZE,
+ RTE_MEMPOOL_CACHE_MAX_SIZE, 0,
+ SOCKET_ID_ANY, 0);
+
+ if (default_pool == NULL) {
+ printf("cannot allocate default mempool\n");
+ goto err;
+ }
+ if (rte_mempool_set_ops_byname(default_pool,
+ RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL) < 0) {
+ printf("cannot set default handler\n");
+ goto err;
+ }
+ if (rte_mempool_populate_default(default_pool) < 0) {
+ printf("cannot populate default mempool\n");
+ goto err;
+ }
+ rte_mempool_obj_iter(default_pool, my_obj_init, NULL);
+
/* retrieve the mempool from its name */
if (rte_mempool_lookup("test_nocache") != mp_nocache) {
printf("Cannot lookup mempool from its name\n");
@@ -606,6 +631,9 @@ static int test_mempool_single_consumer(void)
if (test_mempool_basic(mp_stack, 1) < 0)
goto err;
+ if (test_mempool_basic(default_pool, 1) < 0)
+ goto err;
+
rte_mempool_list_dump(stdout);
ret = 0;
@@ -614,6 +642,8 @@ static int test_mempool_single_consumer(void)
rte_mempool_free(mp_nocache);
rte_mempool_free(mp_cache);
rte_mempool_free(mp_stack);
+ rte_mempool_free(default_pool);
+
return ret;
}
--
1.9.1
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [PATCH v3 2/2] test/test: support default mempool autotest
2017-04-04 5:57 ` [dpdk-dev] [PATCH v3 2/2] test/test: support default mempool autotest Hemant Agrawal
@ 2017-04-05 7:02 ` santosh
2017-04-05 7:21 ` Shreyansh Jain
0 siblings, 1 reply; 17+ messages in thread
From: santosh @ 2017-04-05 7:02 UTC (permalink / raw)
To: Hemant Agrawal, olivier.matz; +Cc: dev, shreyansh.jain
On Tuesday 04 April 2017 11:27 AM, Hemant Agrawal wrote:
> From: Shreyansh Jain <shreyansh.jain@nxp.com>
>
> Mempool test currently supports:
> * ring_mp_mc
> * stack
>
> Adding a new default pool options. So, ring* + stack + default
> (which can be 'stack' or 'ring')
> * This way, whatever the value of RTE_MBUF_DEFAULT_MEMPOOL_OPS is set,
> it would be verified.
> * even if that means duplicating some test (for example when "stack" is
> set as default and it already part of standard test)
>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
> v3: fix the incorrect split
> v2: split the fix from change
>
> test/test/test_mempool.c | 30 ++++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
>
> diff --git a/test/test/test_mempool.c b/test/test/test_mempool.c
> index 715b250..6f0ca84 100644
> --- a/test/test/test_mempool.c
> +++ b/test/test/test_mempool.c
> @@ -513,6 +513,7 @@ static int test_mempool_single_consumer(void)
> struct rte_mempool *mp_cache = NULL;
> struct rte_mempool *mp_nocache = NULL;
> struct rte_mempool *mp_stack = NULL;
> + struct rte_mempool *default_pool = NULL;
>
> rte_atomic32_init(&synchro);
>
> @@ -562,6 +563,30 @@ static int test_mempool_single_consumer(void)
> }
> rte_mempool_obj_iter(mp_stack, my_obj_init, NULL);
>
> + /* Create a mempool based on Default handler, if not "stack" */
> + printf("Testing %s mempool handler\n",
> + RTE_MBUF_DEFAULT_MEMPOOL_OPS);
> + default_pool = rte_mempool_create_empty("default_pool",
> + MEMPOOL_SIZE,
> + MEMPOOL_ELT_SIZE,
> + RTE_MEMPOOL_CACHE_MAX_SIZE, 0,
> + SOCKET_ID_ANY, 0);
> +
> + if (default_pool == NULL) {
> + printf("cannot allocate default mempool\n");
> + goto err;
> + }
> + if (rte_mempool_set_ops_byname(default_pool,
> + RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL) < 0) {
> + printf("cannot set default handler\n");
Few nits:
printf("cannot allocate %s mempool\n",
RTE_MBUF_DEFAULT_MEMPOOL_OPS)
> + goto err;
> + }
> + if (rte_mempool_populate_default(default_pool) < 0) {
> + printf("cannot populate default mempool\n");
ditto..
> + goto err;
> + }
> + rte_mempool_obj_iter(default_pool, my_obj_init, NULL);
> +
> /* retrieve the mempool from its name */
> if (rte_mempool_lookup("test_nocache") != mp_nocache) {
> printf("Cannot lookup mempool from its name\n");
> @@ -606,6 +631,9 @@ static int test_mempool_single_consumer(void)
> if (test_mempool_basic(mp_stack, 1) < 0)
> goto err;
>
> + if (test_mempool_basic(default_pool, 1) < 0)
> + goto err;
> +
> rte_mempool_list_dump(stdout);
>
> ret = 0;
> @@ -614,6 +642,8 @@ static int test_mempool_single_consumer(void)
> rte_mempool_free(mp_nocache);
> rte_mempool_free(mp_cache);
> rte_mempool_free(mp_stack);
> + rte_mempool_free(default_pool);
> +
Rest looks okay to me:
Reviewed-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
> return ret;
> }
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [PATCH v3 2/2] test/test: support default mempool autotest
2017-04-05 7:02 ` santosh
@ 2017-04-05 7:21 ` Shreyansh Jain
0 siblings, 0 replies; 17+ messages in thread
From: Shreyansh Jain @ 2017-04-05 7:21 UTC (permalink / raw)
To: santosh; +Cc: Hemant Agrawal, olivier.matz, dev
Hi Santosh,
On Wednesday 05 April 2017 12:32 PM, santosh wrote:
> On Tuesday 04 April 2017 11:27 AM, Hemant Agrawal wrote:
>
>> From: Shreyansh Jain <shreyansh.jain@nxp.com>
>>
>> Mempool test currently supports:
>> * ring_mp_mc
>> * stack
>>
>> Adding a new default pool options. So, ring* + stack + default
>> (which can be 'stack' or 'ring')
>> * This way, whatever the value of RTE_MBUF_DEFAULT_MEMPOOL_OPS is set,
>> it would be verified.
>> * even if that means duplicating some test (for example when "stack" is
>> set as default and it already part of standard test)
>>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> ---
>> v3: fix the incorrect split
>> v2: split the fix from change
>>
>> test/test/test_mempool.c | 30 ++++++++++++++++++++++++++++++
>> 1 file changed, 30 insertions(+)
>>
>> diff --git a/test/test/test_mempool.c b/test/test/test_mempool.c
>> index 715b250..6f0ca84 100644
>> --- a/test/test/test_mempool.c
>> +++ b/test/test/test_mempool.c
>> @@ -513,6 +513,7 @@ static int test_mempool_single_consumer(void)
>> struct rte_mempool *mp_cache = NULL;
>> struct rte_mempool *mp_nocache = NULL;
>> struct rte_mempool *mp_stack = NULL;
>> + struct rte_mempool *default_pool = NULL;
>>
>> rte_atomic32_init(&synchro);
>>
>> @@ -562,6 +563,30 @@ static int test_mempool_single_consumer(void)
>> }
>> rte_mempool_obj_iter(mp_stack, my_obj_init, NULL);
>>
>> + /* Create a mempool based on Default handler, if not "stack" */
>> + printf("Testing %s mempool handler\n",
>> + RTE_MBUF_DEFAULT_MEMPOOL_OPS);
>> + default_pool = rte_mempool_create_empty("default_pool",
>> + MEMPOOL_SIZE,
>> + MEMPOOL_ELT_SIZE,
>> + RTE_MEMPOOL_CACHE_MAX_SIZE, 0,
>> + SOCKET_ID_ANY, 0);
>> +
>> + if (default_pool == NULL) {
>> + printf("cannot allocate default mempool\n");
>> + goto err;
>> + }
>> + if (rte_mempool_set_ops_byname(default_pool,
>> + RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL) < 0) {
>> + printf("cannot set default handler\n");
>
> Few nits:
>
> printf("cannot allocate %s mempool\n",
> RTE_MBUF_DEFAULT_MEMPOOL_OPS)
Ok. I will change this.
>
>> + goto err;
>> + }
>> + if (rte_mempool_populate_default(default_pool) < 0) {
>> + printf("cannot populate default mempool\n");
>
> ditto..
ok
>
>> + goto err;
>> + }
>> + rte_mempool_obj_iter(default_pool, my_obj_init, NULL);
>> +
>> /* retrieve the mempool from its name */
>> if (rte_mempool_lookup("test_nocache") != mp_nocache) {
>> printf("Cannot lookup mempool from its name\n");
>> @@ -606,6 +631,9 @@ static int test_mempool_single_consumer(void)
>> if (test_mempool_basic(mp_stack, 1) < 0)
>> goto err;
>>
>> + if (test_mempool_basic(default_pool, 1) < 0)
>> + goto err;
>> +
>> rte_mempool_list_dump(stdout);
>>
>> ret = 0;
>> @@ -614,6 +642,8 @@ static int test_mempool_single_consumer(void)
>> rte_mempool_free(mp_nocache);
>> rte_mempool_free(mp_cache);
>> rte_mempool_free(mp_stack);
>> + rte_mempool_free(default_pool);
>> +
>
> Rest looks okay to me:
> Reviewed-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Thanks. I will send v4 of this.
>
>> return ret;
>> }
>>
>
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/2] test/test: free mempool on exit
2017-04-04 5:57 ` [dpdk-dev] [PATCH v3 1/2] test/test: free mempool on exit Hemant Agrawal
2017-04-04 5:57 ` [dpdk-dev] [PATCH v3 2/2] test/test: support default mempool autotest Hemant Agrawal
@ 2017-04-04 15:28 ` santosh
2017-04-05 9:35 ` [dpdk-dev] [PATCH v4 " Shreyansh Jain
2 siblings, 0 replies; 17+ messages in thread
From: santosh @ 2017-04-04 15:28 UTC (permalink / raw)
To: Hemant Agrawal, olivier.matz; +Cc: dev, shreyansh.jain
Hi Hemant,
[Noticed that my first reply couldn't reach out to ML so re-sending]
On Tuesday 04 April 2017 11:27 AM, Hemant Agrawal wrote:
> From: Shreyansh Jain <shreyansh.jain@nxp.com>
>
> mempool autotest was not freeing the mempools.
>
> Fixes: 8ef772ae ("app/test: rework mempool tes")
> Cc: stable@dpdk.org
>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
> v3: fix the incorrect split
> v2: separte the bug fix from change
>
> test/test/test_mempool.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Reviewed-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
> diff --git a/test/test/test_mempool.c b/test/test/test_mempool.c
> index b9880b3..715b250 100644
> --- a/test/test/test_mempool.c
> +++ b/test/test/test_mempool.c
> @@ -509,6 +509,7 @@ static int test_mempool_single_consumer(void)
> static int
> test_mempool(void)
> {
> + int ret = -1;
> struct rte_mempool *mp_cache = NULL;
> struct rte_mempool *mp_nocache = NULL;
> struct rte_mempool *mp_stack = NULL;
> @@ -607,13 +608,13 @@ static int test_mempool_single_consumer(void)
>
> rte_mempool_list_dump(stdout);
>
> - return 0;
> + ret = 0;
>
> err:
> rte_mempool_free(mp_nocache);
> rte_mempool_free(mp_cache);
> rte_mempool_free(mp_stack);
> - return -1;
> + return ret;
> }
>
> REGISTER_TEST_COMMAND(mempool_autotest, test_mempool);
^ permalink raw reply [flat|nested] 17+ messages in thread
* [dpdk-dev] [PATCH v4 1/2] test/test: free mempool on exit
2017-04-04 5:57 ` [dpdk-dev] [PATCH v3 1/2] test/test: free mempool on exit Hemant Agrawal
2017-04-04 5:57 ` [dpdk-dev] [PATCH v3 2/2] test/test: support default mempool autotest Hemant Agrawal
2017-04-04 15:28 ` [dpdk-dev] [PATCH v3 1/2] test/test: free mempool on exit santosh
@ 2017-04-05 9:35 ` Shreyansh Jain
2017-04-05 9:35 ` [dpdk-dev] [PATCH v4 2/2] test/test: support default mempool autotest Shreyansh Jain
2017-04-07 15:42 ` [dpdk-dev] [PATCH v4 1/2] test/test: free mempool on exit Olivier Matz
2 siblings, 2 replies; 17+ messages in thread
From: Shreyansh Jain @ 2017-04-05 9:35 UTC (permalink / raw)
To: olivier.matz; +Cc: dev, santosh.shukla, hemant.agrawal, Shreyansh Jain, stable
mempool autotest was not freeing the mempools.
Fixes: 8ef772ae ("app/test: rework mempool tes")
Cc: stable@dpdk.org
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Reviewed-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
---
v4: rebased over 27c270bc
v3: fix the incorrect split
v2: separte the bug fix from change
test/test/test_mempool.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/test/test/test_mempool.c b/test/test/test_mempool.c
index b9880b3..715b250 100644
--- a/test/test/test_mempool.c
+++ b/test/test/test_mempool.c
@@ -509,6 +509,7 @@ walk_cb(struct rte_mempool *mp, void *userdata __rte_unused)
static int
test_mempool(void)
{
+ int ret = -1;
struct rte_mempool *mp_cache = NULL;
struct rte_mempool *mp_nocache = NULL;
struct rte_mempool *mp_stack = NULL;
@@ -607,13 +608,13 @@ test_mempool(void)
rte_mempool_list_dump(stdout);
- return 0;
+ ret = 0;
err:
rte_mempool_free(mp_nocache);
rte_mempool_free(mp_cache);
rte_mempool_free(mp_stack);
- return -1;
+ return ret;
}
REGISTER_TEST_COMMAND(mempool_autotest, test_mempool);
--
2.7.4
^ permalink raw reply [flat|nested] 17+ messages in thread
* [dpdk-dev] [PATCH v4 2/2] test/test: support default mempool autotest
2017-04-05 9:35 ` [dpdk-dev] [PATCH v4 " Shreyansh Jain
@ 2017-04-05 9:35 ` Shreyansh Jain
2017-04-07 15:42 ` Olivier Matz
2017-04-07 15:42 ` [dpdk-dev] [PATCH v4 1/2] test/test: free mempool on exit Olivier Matz
1 sibling, 1 reply; 17+ messages in thread
From: Shreyansh Jain @ 2017-04-05 9:35 UTC (permalink / raw)
To: olivier.matz; +Cc: dev, santosh.shukla, hemant.agrawal, Shreyansh Jain
Mempool test currently supports:
* ring_mp_mc
* stack
Adding a new default pool options. So, ring* + stack + default
(which can be 'stack' or 'ring')
* This way, whatever the value of RTE_MBUF_DEFAULT_MEMPOOL_OPS is set,
it would be verified.
* even if that means duplicating some test (for example when "stack" is
set as default and it already part of standard test)
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Reviewed-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
---
v4: rebased over 27c270bc
pool name as variable in print message
v3: fix the incorrect split
v2: split the fix from change
test/test/test_mempool.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/test/test/test_mempool.c b/test/test/test_mempool.c
index 715b250..0a44239 100644
--- a/test/test/test_mempool.c
+++ b/test/test/test_mempool.c
@@ -513,6 +513,7 @@ test_mempool(void)
struct rte_mempool *mp_cache = NULL;
struct rte_mempool *mp_nocache = NULL;
struct rte_mempool *mp_stack = NULL;
+ struct rte_mempool *default_pool = NULL;
rte_atomic32_init(&synchro);
@@ -562,6 +563,32 @@ test_mempool(void)
}
rte_mempool_obj_iter(mp_stack, my_obj_init, NULL);
+ /* Create a mempool based on Default handler */
+ printf("Testing %s mempool handler\n",
+ RTE_MBUF_DEFAULT_MEMPOOL_OPS);
+ default_pool = rte_mempool_create_empty("default_pool",
+ MEMPOOL_SIZE,
+ MEMPOOL_ELT_SIZE,
+ RTE_MEMPOOL_CACHE_MAX_SIZE, 0,
+ SOCKET_ID_ANY, 0);
+
+ if (default_pool == NULL) {
+ printf("cannot allocate default mempool\n");
+ goto err;
+ }
+ if (rte_mempool_set_ops_byname(default_pool,
+ RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL) < 0) {
+ printf("cannot set %s handler\n",
+ RTE_MBUF_DEFAULT_MEMPOOL_OPS);
+ goto err;
+ }
+ if (rte_mempool_populate_default(default_pool) < 0) {
+ printf("cannot populate %s mempool\n",
+ RTE_MBUF_DEFAULT_MEMPOOL_OPS);
+ goto err;
+ }
+ rte_mempool_obj_iter(default_pool, my_obj_init, NULL);
+
/* retrieve the mempool from its name */
if (rte_mempool_lookup("test_nocache") != mp_nocache) {
printf("Cannot lookup mempool from its name\n");
@@ -606,6 +633,9 @@ test_mempool(void)
if (test_mempool_basic(mp_stack, 1) < 0)
goto err;
+ if (test_mempool_basic(default_pool, 1) < 0)
+ goto err;
+
rte_mempool_list_dump(stdout);
ret = 0;
@@ -614,6 +644,8 @@ test_mempool(void)
rte_mempool_free(mp_nocache);
rte_mempool_free(mp_cache);
rte_mempool_free(mp_stack);
+ rte_mempool_free(default_pool);
+
return ret;
}
--
2.7.4
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [PATCH v4 2/2] test/test: support default mempool autotest
2017-04-05 9:35 ` [dpdk-dev] [PATCH v4 2/2] test/test: support default mempool autotest Shreyansh Jain
@ 2017-04-07 15:42 ` Olivier Matz
2017-04-19 13:10 ` Thomas Monjalon
0 siblings, 1 reply; 17+ messages in thread
From: Olivier Matz @ 2017-04-07 15:42 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, santosh.shukla, hemant.agrawal
On Wed, 5 Apr 2017 15:05:34 +0530, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> Mempool test currently supports:
> * ring_mp_mc
> * stack
>
> Adding a new default pool options. So, ring* + stack + default
> (which can be 'stack' or 'ring')
> * This way, whatever the value of RTE_MBUF_DEFAULT_MEMPOOL_OPS is set,
> it would be verified.
> * even if that means duplicating some test (for example when "stack" is
> set as default and it already part of standard test)
>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> Reviewed-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [PATCH v4 2/2] test/test: support default mempool autotest
2017-04-07 15:42 ` Olivier Matz
@ 2017-04-19 13:10 ` Thomas Monjalon
0 siblings, 0 replies; 17+ messages in thread
From: Thomas Monjalon @ 2017-04-19 13:10 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, Olivier Matz, santosh.shukla, hemant.agrawal
07/04/2017 17:42, Olivier Matz:
> On Wed, 5 Apr 2017 15:05:34 +0530, Shreyansh Jain <shreyansh.jain@nxp.com>
wrote:
> > Mempool test currently supports:
> > * ring_mp_mc
> > * stack
> >
> > Adding a new default pool options. So, ring* + stack + default
> > (which can be 'stack' or 'ring')
> >
> > * This way, whatever the value of RTE_MBUF_DEFAULT_MEMPOOL_OPS is set,
> >
> > it would be verified.
> >
> > * even if that means duplicating some test (for example when "stack" is
> >
> > set as default and it already part of standard test)
> >
> > Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> > Reviewed-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
>
> Acked-by: Olivier Matz <olivier.matz@6wind.com>
Series applied, thanks
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [PATCH v4 1/2] test/test: free mempool on exit
2017-04-05 9:35 ` [dpdk-dev] [PATCH v4 " Shreyansh Jain
2017-04-05 9:35 ` [dpdk-dev] [PATCH v4 2/2] test/test: support default mempool autotest Shreyansh Jain
@ 2017-04-07 15:42 ` Olivier Matz
1 sibling, 0 replies; 17+ messages in thread
From: Olivier Matz @ 2017-04-07 15:42 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, santosh.shukla, hemant.agrawal, stable
On Wed, 5 Apr 2017 15:05:33 +0530, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
> mempool autotest was not freeing the mempools.
>
> Fixes: 8ef772ae ("app/test: rework mempool tes")
> Cc: stable@dpdk.org
>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> Reviewed-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
^ permalink raw reply [flat|nested] 17+ messages in thread