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

env_dpdk: tokenize env_context



DPDK requires each command line parameter to be
passed as a separate string in the args array.  So
we need to tokenize opts.env_context to handle the
case where a user passes multiple arguments in the
env_context string.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: Ifc72a7c25b31f1296d3aba3a3f7664ad8edf128f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9132


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
parent 33acbe9c
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -401,10 +401,19 @@ build_eal_cmdline(const struct spdk_env_opts *opts)
	}

	if (opts->env_context) {
		args = push_arg(args, &argcount, strdup(opts->env_context));
		if (args == NULL) {
			return -1;
		char *ptr = strdup(opts->env_context);
		char *tok = strtok(ptr, " \t");

		/* DPDK expects each argument as a separate string in the argv
		 * array, so we need to tokenize here in case the caller
		 * passed multiple arguments in the env_context string.
		 */
		while (tok != NULL) {
			args = push_arg(args, &argcount, strdup(tok));
			tok = strtok(NULL, " \t");
		}

		free(ptr);
	}

#ifdef __linux__