[dpdk-dev] app/test: add mempool walk

Message ID 1475528313-7759-1-git-send-email-thomas.monjalon@6wind.com
State Accepted, archived
Delegated to: Thomas Monjalon
Headers show

Commit Message

Thomas Monjalon Oct. 3, 2016, 8:58 p.m.
The mempool function rte_mempool_walk was not tested.
It will print the name of all mempools.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 app/test/test_mempool.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Olivier Matz Oct. 5, 2016, 12:22 p.m. | #1
Hi Thomas,

On 10/03/2016 10:58 PM, Thomas Monjalon wrote:
> The mempool function rte_mempool_walk was not tested.
> It will print the name of all mempools.
> 
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>

Acked-by: Olivier Matz <olivier.matz@6wind.com>
Thomas Monjalon Oct. 13, 2016, 1:51 p.m. | #2
2016-10-05 14:22, Olivier Matz:
> Hi Thomas,
> 
> On 10/03/2016 10:58 PM, Thomas Monjalon wrote:
> > The mempool function rte_mempool_walk was not tested.
> > It will print the name of all mempools.
> > 
> > Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> 
> Acked-by: Olivier Matz <olivier.matz@6wind.com>

Applied

Patch

diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c
index fffbf8d..b9880b3 100644
--- a/app/test/test_mempool.c
+++ b/app/test/test_mempool.c
@@ -500,6 +500,12 @@  test_mempool_xmem_misc(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)
 {
@@ -561,6 +567,9 @@  test_mempool(void)
 		goto err;
 	}
 
+	printf("Walk into mempools:\n");
+	rte_mempool_walk(walk_cb, NULL);
+
 	rte_mempool_list_dump(stdout);
 
 	/* basic tests without cache */