Skip to contentSkip to conversation

examples/ntb: fix mempool ops setting issue

PATCH In review Xiaoyun Li 2 participants 2 messages Dec 25, 2019 – Jan 20, 2020

lore
Share & tools
lore

Xiaoyun Li

author
#0 lore raw

PATCH 1/1 examples/ntb: fix mempool ops setting issue

Mempool ops may register in different order when compiling. The default ops index is always zero but the wanted ops is ring_mp_mc. This patch sets best mempool ops before generating mbuf pool to fix this issue.

Fixes 5194299d6ef5 ("examples/ntb: support more functions")
---
 examples/ntb/ntb_fwd.c | 6 ++++++
 1 file changed, 6 insertions(+)
examples/ntb/ntb_fwd.c +6 -0
index c914256dd..17eedcf0b 100644
@@ -19,6 +19,7 @@
 #include <rte_lcore.h>
 #include <rte_cycles.h>
 #include <rte_pmd_ntb.h>
+#include <rte_mbuf_pool_ops.h>
 
 /* Per-port statistics struct */
 struct ntb_port_statistics {
@@ -1256,6 +1257,11 @@ ntb_mbuf_pool_create(uint16_t mbuf_seg_size, uint32_t nb_mbuf,
 	if (mp == NULL)
 		return NULL;
 
+	if (rte_mempool_set_ops_byname(mp, rte_mbuf_best_mempool_ops(), NULL)) {
+		printf("error setting mempool handler\n");
+		goto fail;
+	}
+
 	memset(&mbp_priv, 0, sizeof(mbp_priv));
 	mbp_priv.mbuf_data_room_size = mbuf_seg_size;
 	mbp_priv.mbuf_priv_size = 0;
Signature · 1 line
2.17.1
#1 lore raw

25/12/2019 10:09, Xiaoyun Li:

Quoted 8 lines

Mempool ops may register in different order when compiling. The default ops index is always zero but the wanted ops is ring_mp_mc. This patch sets best mempool ops before generating mbuf pool to fix this issue.

Fixes 5194299d6ef5 ("examples/ntb: support more functions")

Not sure I understand the explanation, but
Applied