[dpdk-dev] eal: fix default mempool ops returning NULL

Message ID 20180130155747.12501-1-pbhagavatula@caviumnetworks.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Pavan Nikhilesh Jan. 30, 2018, 3:57 p.m. UTC
  If '--mbuf-pool-ops' is not passed to EAL as command line argument then
rte_eal_mbuf_default_mempool_ops will return NULL.

Instead check if internal_config.user_mbuf_pool_ops_name is NULL and
return compile time RTE_MBUF_DEFAULT_MEMPOOL_OPS.

Fixes: 8b0f7f43413 ("mbuf: maintain user and compile time mempool ops name")

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---

 Currently, test/test/test_mempool_autotest is broken as it relies on
 rte_eal_mbuf_default_mempool_ops().

 lib/librte_eal/bsdapp/eal/eal.c   | 3 +++
 lib/librte_eal/linuxapp/eal/eal.c | 3 +++
 2 files changed, 6 insertions(+)

--
2.16.0
  

Comments

Thomas Monjalon Jan. 30, 2018, 11:58 p.m. UTC | #1
30/01/2018 16:57, Pavan Nikhilesh:
> If '--mbuf-pool-ops' is not passed to EAL as command line argument then
> rte_eal_mbuf_default_mempool_ops will return NULL.
> 
> Instead check if internal_config.user_mbuf_pool_ops_name is NULL and
> return compile time RTE_MBUF_DEFAULT_MEMPOOL_OPS.
> 
> Fixes: 8b0f7f43413 ("mbuf: maintain user and compile time mempool ops name")
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>

Applied, thanks
  

Patch

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index ba1811a00..07b229fc7 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -115,6 +115,9 @@  int rte_cycles_vmware_tsc_map;
 const char *
 rte_eal_mbuf_default_mempool_ops(void)
 {
+	if (internal_config.user_mbuf_pool_ops_name == NULL)
+		return RTE_MBUF_DEFAULT_MEMPOOL_OPS;
+
 	return internal_config.user_mbuf_pool_ops_name;
 }

diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 66f7585a3..ddcdb6e1f 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -125,6 +125,9 @@  int rte_cycles_vmware_tsc_map;
 const char *
 rte_eal_mbuf_default_mempool_ops(void)
 {
+	if (internal_config.user_mbuf_pool_ops_name == NULL)
+		return RTE_MBUF_DEFAULT_MEMPOOL_OPS;
+
 	return internal_config.user_mbuf_pool_ops_name;
 }