Commit 342001e1 authored by John Levon's avatar John Levon Committed by Tomasz Zawadzki
Browse files

env/dpdk: support additional core mask options

Currently, the SPDK "core_mask" environment option only supports setting either
"-l" or "-c". Allow applications to specify more complicated options by sniffing
for a leading "-", and passing that string through unchanged. This allows, for
example, --lcores to be used as described here:

https://doc.dpdk.org/guides/linux_gsg/linux_eal_parameters.html



Signed-off-by: default avatarJohn Levon <john.levon@nutanix.com>
Change-Id: I38cc54bfcd356f3176cde7848e592525f9231e3d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7933


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarZiye Yang <ziye.yang@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
parent f0f57a3f
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -267,10 +267,21 @@ build_eal_cmdline(const struct spdk_env_opts *opts)
		}
	}

	/* set the coremask */
	/* NOTE: If coremask starts with '[' and ends with ']' it is a core list
	/*
	 * Set the coremask:
	 *
	 * - if it starts with '-', we presume it's literal EAL arguments such
	 *   as --lcores.
	 *
	 * - if it starts with '[', we presume it's a core list to use with the
	 *   -l option.
	 *
	 * - otherwise, it's a CPU mask of the form "0xff.." as expected by the
	 *   -c option.
	 */
	if (opts->core_mask[0] == '[') {
	if (opts->core_mask[0] == '-') {
		args = push_arg(args, &argcount, _sprintf_alloc("%s", opts->core_mask));
	} else if (opts->core_mask[0] == '[') {
		char *l_arg = _sprintf_alloc("-l %s", opts->core_mask + 1);

		if (l_arg != NULL) {