From 60c397711a4d0f694491945ccb64d3da3049557a Mon Sep 17 00:00:00 2001 From: Vladimir Ratnikov Date: Fri, 5 Mar 2021 04:22:59 -0500 Subject: [PATCH] dpdk: fix rte mempool for rx_queues Change dpdk_ops_vpp_get_count() return value from 0 to actual available pool size; For some drivers/envs(azure,vmbus) rx_queue size will be zero and the only 1 element will be created (0 + 1) When more than one packet will arrive, it will cause SEGFAULT Type: fix Signed-off-by: Vladimir Ratnikov Change-Id: Ibe7da6acc91200bec33d99f580044456d8984110 --- src/plugins/dpdk/buffer.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/plugins/dpdk/buffer.c b/src/plugins/dpdk/buffer.c index 575660ba7f5..97184519428 100644 --- a/src/plugins/dpdk/buffer.c +++ b/src/plugins/dpdk/buffer.c @@ -414,7 +414,15 @@ dpdk_ops_vpp_dequeue_no_cache (struct rte_mempool *mp, void **obj_table, static unsigned dpdk_ops_vpp_get_count (const struct rte_mempool *mp) { - clib_warning (""); + vlib_main_t *vm = vlib_get_main (); + if (mp) + { + vlib_buffer_pool_t *pool = vlib_get_buffer_pool (vm, mp->pool_id); + if (pool) + { + return pool->n_avail; + } + } return 0; } -- 2.16.6