env_dpdk: Run DPDK in legacy memory mode through spdk_env_opts

Some customized SPDK application needs DPDK to run legacy memory mode,
but it is  unusual. So this patch uses env_context, the opaque option
variable in the struct spdk_env_opts, and if the application sets
"--legacy-mem" to it, spdk_env_opts_init() skips adding
"--match-allocations" for DPDK 19.02 or later and skips adding
"--legacy-mem" for DPDK 18.05 or before.

Change-Id: I6f40c726c66c29f0aabfeeaecd00611954dc774f
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/448263
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-03-22 15:27:07 +09:00 committed by Darek Stojaczyk
parent 8228a208a6
commit 3c4199d6c6

View File

@ -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) #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. */ /* 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 (!opts->env_context || strcmp(opts->env_context, "--legacy-mem") != 0) {
if (args == NULL) { args = spdk_push_arg(args, &argcount, _sprintf_alloc("--legacy-mem"));
return -1; if (args == NULL) {
return -1;
}
} }
#endif #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. * 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) #if RTE_VERSION >= RTE_VERSION_NUM(19, 02, 0, 0)
args = spdk_push_arg(args, &argcount, _sprintf_alloc("%s", "--match-allocations")); if (!opts->env_context || strcmp(opts->env_context, "--legacy-mem") != 0) {
if (args == NULL) { args = spdk_push_arg(args, &argcount, _sprintf_alloc("%s", "--match-allocations"));
return -1; if (args == NULL) {
return -1;
}
} }
#endif #endif