aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk
diff options
context:
space:
mode:
authorVladimir Ratnikov <vratnikov@netgate.com>2021-03-05 04:22:59 -0500
committerDamjan Marion <dmarion@me.com>2021-03-05 10:50:24 +0000
commit60c397711a4d0f694491945ccb64d3da3049557a (patch)
tree49ae2577850a95053c1c450d7b0c19554999615e /src/plugins/dpdk
parentf16e9a5507c33642ac04d4b1a8712f8fac238828 (diff)
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 <vratnikov@netgate.com> Change-Id: Ibe7da6acc91200bec33d99f580044456d8984110
Diffstat (limited to 'src/plugins/dpdk')
-rw-r--r--src/plugins/dpdk/buffer.c10
1 files changed, 9 insertions, 1 deletions
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;
}