./configure: add 'detect' value to --max-lcores

This patch adds suport for 'detect' option in SPDK's
./configure, allowing configuring of DPDK to detect
current number of cores during SPDK compilation.
This is done by providing --max-lcores=detect as
a parameter to ./configure, which triggers setting
of '-Dmax_lcores=detect' in DPDK_OPTS passed to
dpdkbuild/Makefile.
DPDK then do detection of number of cores in the
system during compilation, and sets RTE_MAX_LCORE
to that value. Meson build system also generates
a message displaying information about number of
cores detected. E.g. for my system:
"
Message: Found 72 cores
"

Example usages:
1) use default value for RTE_MAX_LCORE:
	./configure
2) detect the core number:
	./configure --max-lcores=detect
3) Set RTE_MAX_LCORE to 256:
	./configure --max-lcores=256

Change-Id: I2103c2d917f210aee4d1ef43584b1bd40dbfe43b
Signed-off-by: Marcin Spiewak <marcin.spiewak@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17555
Community-CI: Mellanox Build Bot
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Marcin Spiewak 2023-04-12 13:01:41 +00:00 committed by Konrad Sztyber
parent 962671f711
commit 73293d73eb

11
configure vendored
View File

@ -28,8 +28,10 @@ function usage() {
echo " --cross-prefix=prefix Prefix for cross compilation (default: none)"
echo " example: aarch64-linux-gnu"
echo " --libdir=path Configure installation path for the libraries (default: \$prefix/lib)"
echo " --max-lcores=VAL DPDK configuration. Maximum number of lcores supported by EAL."
echo ""
echo " --max-lcores=VAL DPDK configuration. VAL defines maximum number of lcores supported"
echo " by EAL, or enables autodetection if set to 'detect'. When 'detect'"
echo " is specified, DPDK will detect number of cores in the system during"
echo " compilation, and will set maximum number of lcores to this value"
echo " --enable-debug Configure for debug builds"
echo " --enable-werror Treat compiler warnings as errors"
echo " --enable-asan Enable address sanitizer"
@ -659,6 +661,7 @@ for i in "$@"; do
;;
--max-lcores=*)
CONFIG[MAX_LCORES]="${i#*=}"
CONFIG["MAX_LCORES"]=${CONFIG["MAX_LCORES"],,}
;;
--)
break
@ -1260,8 +1263,8 @@ if [[ "${CONFIG[AVAHI]}" = "y" ]]; then
fi
if [[ -n ${CONFIG[MAX_LCORES]} ]]; then
if [[ ! ${CONFIG[MAX_LCORES]} =~ ^[1-9][0-9]*$ ]] || ((CONFIG[MAX_LCORES] > 1024)); then
echo "ERROR: Max number of lcores must be a decimal number in range [1..1024] (given: ${CONFIG[MAX_LCORES]})"
if [[ ! ${CONFIG[MAX_LCORES]} =~ ^([1-9][0-9]*|detect)$ ]] || ((CONFIG[MAX_LCORES] > 1024)); then
echo "ERROR: Max number of lcores must be a decimal number in range [1..1024] or 'detect' (given: ${CONFIG[MAX_LCORES]})"
exit 1
fi
fi