diff --git a/lib/env_dpdk/init.c b/lib/env_dpdk/init.c index 55452b77b..d712bb18d 100644 --- a/lib/env_dpdk/init.c +++ b/lib/env_dpdk/init.c @@ -273,9 +273,11 @@ spdk_build_eal_cmdline(const struct spdk_env_opts *opts) #if RTE_VERSION >= RTE_VERSION_NUM(18, 05, 0, 0) && RTE_VERSION < RTE_VERSION_NUM(18, 5, 1, 0) /* Dynamic memory management is buggy in DPDK 18.05.0. Don't use it. */ - args = spdk_push_arg(args, &argcount, _sprintf_alloc("--legacy-mem")); - if (args == NULL) { - return -1; + if (!opts->env_context || strcmp(opts->env_context, "--legacy-mem") != 0) { + args = spdk_push_arg(args, &argcount, _sprintf_alloc("--legacy-mem")); + if (args == NULL) { + return -1; + } } #endif @@ -329,9 +331,11 @@ spdk_build_eal_cmdline(const struct spdk_env_opts *opts) * the memory for a buffer over two allocations meaning the buffer will be split over a memory region. */ #if RTE_VERSION >= RTE_VERSION_NUM(19, 02, 0, 0) - args = spdk_push_arg(args, &argcount, _sprintf_alloc("%s", "--match-allocations")); - if (args == NULL) { - return -1; + if (!opts->env_context || strcmp(opts->env_context, "--legacy-mem") != 0) { + args = spdk_push_arg(args, &argcount, _sprintf_alloc("%s", "--match-allocations")); + if (args == NULL) { + return -1; + } } #endif