From: Eli Britstein <[email protected]>

New appctl 'dpdk/get-mempool-stats' implemented to get result of
'rte_mempool_dump()' function.

Could be used for debugging.

Signed-off-by: Eli Britstein <[email protected]>
Acked-by: Roi Dayan <[email protected]>
---
 lib/dpdk.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/lib/dpdk.c b/lib/dpdk.c
index b7516257c5e4..aaf0b2ed8046 100644
--- a/lib/dpdk.c
+++ b/lib/dpdk.c
@@ -305,11 +305,25 @@ dpdk_unixctl_log_set(struct unixctl_conn *conn, int argc, 
const char *argv[],
 }
 
 static void
-malloc_dump_stats_wrapper(FILE *stream)
+malloc_dump_malloc_stats_wrapper(FILE *stream)
 {
     rte_malloc_dump_stats(stream, NULL);
 }
 
+static void
+dump_mempool_stats(struct rte_mempool *mp, void *arg)
+{
+    FILE *stream = arg;
+
+    rte_mempool_dump(stream, mp);
+}
+
+static void
+malloc_dump_mempool_stats_wrapper(FILE *stream)
+{
+    rte_mempool_walk(dump_mempool_stats, stream);
+}
+
 static bool
 dpdk_init__(const struct smap *ovs_other_config)
 {
@@ -436,7 +450,10 @@ dpdk_init__(const struct smap *ovs_other_config)
                              INT_MAX, dpdk_unixctl_log_set, NULL);
     unixctl_command_register("dpdk/get-malloc-stats", "", 0, 0,
                              dpdk_unixctl_mem_stream,
-                             malloc_dump_stats_wrapper);
+                             malloc_dump_malloc_stats_wrapper);
+    unixctl_command_register("dpdk/get-mempool-stats", "", 0, 0,
+                             dpdk_unixctl_mem_stream,
+                             malloc_dump_mempool_stats_wrapper);
 
     /* We are called from the main thread here */
     RTE_PER_LCORE(_lcore_id) = NON_PMD_CORE_ID;
-- 
2.47.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to