Commit 3c4199d6 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Darek Stojaczyk
Browse files

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: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/448263


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 8228a208
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -273,10 +273,12 @@ 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. */
	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

	if (opts->num_pci_addr) {
@@ -329,10 +331,12 @@ 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)
	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

	if (opts->shm_id < 0) {