env_dpdk: fix --legacy-mem checks

opts->env_context could have more options specified
than just --legacy-mem.  So strcmp() is not a valid
comparison operator - we need to use strstr instead.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ie4c8cbcbe7c141693a07a11648d6673ec8c012e5

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477087
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Jim Harris 2019-12-06 16:45:16 -07:00 committed by Tomasz Zawadzki
parent 6d6052ac96
commit b3d982036a

View File

@ -343,7 +343,7 @@ 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) {
if (!opts->env_context || strstr(opts->env_context, "--legacy-mem") != NULL) {
args = spdk_push_arg(args, &argcount, _sprintf_alloc("--legacy-mem"));
if (args == NULL) {
return -1;
@ -445,7 +445,7 @@ 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) {
if (!opts->env_context || strstr(opts->env_context, "--legacy-mem") == NULL) {
args = spdk_push_arg(args, &argcount, _sprintf_alloc("%s", "--match-allocations"));
if (args == NULL) {
return -1;