diff mbox series

[v6,2/7] mbuf: maintain user and compile time mempool ops name

Message ID 1516629083-13967-3-git-send-email-hemant.agrawal@nxp.com
State Superseded
Headers show
Series Dynamic HW Mempool Detection Support | expand

Commit Message

Hemant Agrawal Jan. 22, 2018, 1:51 p.m. UTC
This patch change the logic to maintain the value of
user defined and compile time i.e. RTE_MBUF_DEFAULT_MEMPOOL_OPS.

The pktmbuf_create_pool is updated to reflect the same.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

Acked-by: Olivier Matz <olivier.matz@6wind.com>

---
 lib/librte_eal/common/eal_common_options.c | 2 +-
 lib/librte_mbuf/rte_mbuf.c                 | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

-- 
2.7.4

Comments

Thomas Monjalon Jan. 25, 2018, 10:02 p.m. UTC | #1
22/01/2018 14:51, Hemant Agrawal:
> This patch change the logic to maintain the value of

> user defined and compile time i.e. RTE_MBUF_DEFAULT_MEMPOOL_OPS.

> 

> The pktmbuf_create_pool is updated to reflect the same.


I cannot understand this text.
Hemant Agrawal Jan. 26, 2018, 5:10 a.m. UTC | #2
> -----Original Message-----

> From: Thomas Monjalon [mailto:thomas@monjalon.net]

> 

> 22/01/2018 14:51, Hemant Agrawal:

> > This patch change the logic to maintain the value of user defined and

> > compile time i.e. RTE_MBUF_DEFAULT_MEMPOOL_OPS.

> >

> > The pktmbuf_create_pool is updated to reflect the same.

> 

> I cannot understand this text.


[Hemant] I will rephrase it
Internel_config based mempool ops name is initialized with compile time default mempool ops. 
 In Original code the user configured command line mempool ops name overwrite it.

This patch avoid the overwriting and make changes in pktmbuf_create_pool to choose compile time, if user has not defined one.
diff mbox series

Patch

diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 7a40414..b6d2762 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -218,7 +218,7 @@  eal_reset_internal_config(struct internal_config *internal_cfg)
 #endif
 	internal_cfg->vmware_tsc_map = 0;
 	internal_cfg->create_uio_dev = 0;
-	internal_cfg->user_mbuf_pool_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
+	internal_cfg->user_mbuf_pool_ops_name = NULL;
 }
 
 static int
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 937fd70..c085c37 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -177,6 +177,8 @@  rte_pktmbuf_pool_create(const char *name, unsigned n,
 		return NULL;
 
 	mp_ops_name = rte_eal_mbuf_default_mempool_ops();
+	if (mp_ops_name == NULL)
+		mp_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
 	ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL);
 	if (ret != 0) {
 		RTE_LOG(ERR, MBUF, "error setting mempool handler\n");