From 342001e1ea35dfe9861fde1b502291594693ed30 Mon Sep 17 00:00:00 2001 From: John Levon Date: Tue, 18 May 2021 11:59:38 +0000 Subject: [PATCH] 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 Change-Id: I38cc54bfcd356f3176cde7848e592525f9231e3d Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7933 Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot Reviewed-by: Ziye Yang Reviewed-by: Changpeng Liu Reviewed-by: Ben Walker Reviewed-by: Aleksey Marchuk --- lib/env_dpdk/init.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/env_dpdk/init.c b/lib/env_dpdk/init.c index e6464c93c..9c8962eaa 100644 --- a/lib/env_dpdk/init.c +++ b/lib/env_dpdk/init.c @@ -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) {