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: John Levon <john.levon@nutanix.com>
Change-Id: I38cc54bfcd356f3176cde7848e592525f9231e3d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7933
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
John Levon 2021-05-18 11:59:38 +00:00 committed by Tomasz Zawadzki
parent f0f57a3fe1
commit 342001e1ea

View File

@ -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) {