[dpdk-dev,v3,1/7] eal: prefix mbuf pool ops name with user defined
Checks
Commit Message
This patch prefix the mbuf pool ops name with "user" to indicate
that it is user defined.
This patch also 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>
---
lib/librte_eal/bsdapp/eal/eal.c | 4 ++--
lib/librte_eal/common/eal_common_options.c | 2 +-
lib/librte_eal/common/eal_internal_cfg.h | 3 ++-
lib/librte_eal/linuxapp/eal/eal.c | 4 ++--
lib/librte_mbuf/rte_mbuf.c | 2 ++
5 files changed, 9 insertions(+), 6 deletions(-)
Comments
On Thu, Jan 18, 2018 at 06:56:26PM +0530, Hemant Agrawal wrote:
> This patch prefix the mbuf pool ops name with "user" to indicate
> that it is user defined.
>
> This patch also 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.
The patch itself looks good to me, but I think it deserves to be split
in 2 patches.
@@ -114,7 +114,7 @@ int rte_cycles_vmware_tsc_map;
const char *
rte_eal_mbuf_default_mempool_ops(void)
{
- return internal_config.mbuf_pool_ops_name;
+ return internal_config.user_mbuf_pool_ops_name;
}
/* Return a pointer to the configuration structure */
@@ -397,7 +397,7 @@ eal_parse_args(int argc, char **argv)
switch (opt) {
case OPT_MBUF_POOL_OPS_NAME_NUM:
- internal_config.mbuf_pool_ops_name = optarg;
+ internal_config.user_mbuf_pool_ops_name = optarg;
break;
case 'h':
eal_usage(prgname);
@@ -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->mbuf_pool_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS;
+ internal_cfg->user_mbuf_pool_ops_name = NULL;
}
static int
@@ -52,7 +52,8 @@ struct internal_config {
volatile enum rte_intr_mode vfio_intr_mode;
const char *hugefile_prefix; /**< the base filename of hugetlbfs files */
const char *hugepage_dir; /**< specific hugetlbfs directory to use */
- const char *mbuf_pool_ops_name; /**< mbuf pool ops name */
+ const char *user_mbuf_pool_ops_name;
+ /**< user defined mbuf pool ops name */
unsigned num_hugepage_sizes; /**< how many sizes on this system */
struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
};
@@ -124,7 +124,7 @@ int rte_cycles_vmware_tsc_map;
const char *
rte_eal_mbuf_default_mempool_ops(void)
{
- return internal_config.mbuf_pool_ops_name;
+ return internal_config.user_mbuf_pool_ops_name;
}
/* Return a pointer to the configuration structure */
@@ -609,7 +609,7 @@ eal_parse_args(int argc, char **argv)
break;
case OPT_MBUF_POOL_OPS_NAME_NUM:
- internal_config.mbuf_pool_ops_name = optarg;
+ internal_config.user_mbuf_pool_ops_name = optarg;
break;
default:
@@ -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");