From 3c4199d6c6311e73446b9d15b3336d2cf4313fa9 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Fri, 22 Mar 2019 15:27:07 +0900 Subject: [PATCH] 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 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/448263 Tested-by: SPDK CI Jenkins Reviewed-by: Darek Stojaczyk Reviewed-by: Ben Walker --- lib/env_dpdk/init.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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