Commit b3d98203 authored by Jim Harris's avatar Jim Harris Committed by Tomasz Zawadzki
Browse files

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: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: Ie4c8cbcbe7c141693a07a11648d6673ec8c012e5

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477087


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarAlexey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 6d6052ac
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;