[dpdk-dev,v4,2/2] test/test: support default mempool autotest
Checks
Commit Message
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(+)
Comments
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>
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
@@ -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;
}