aports/community/spdk/isal.patch
2024-06-19 05:56:41 +00:00

293 lines
10 KiB
Diff

diff -Nurp a/CONFIG b/CONFIG
--- a/CONFIG 2024-05-24 12:55:52.000000000 +0000
+++ b/CONFIG 2024-06-09 08:11:14.996885093 +0000
@@ -170,9 +170,15 @@ CONFIG_CUSTOMOCF=n
# Build ISA-L library
CONFIG_ISAL=y
+CONFIG_ISAL_INC_DIR=
+CONFIG_ISAL_LIB_DIR=
+CONFIG_ISAL_PKG_CONFIG=n
# Build ISA-L-crypto library
CONFIG_ISAL_CRYPTO=y
+CONFIG_ISAL_CRYPTO_INC_DIR=
+CONFIG_ISAL_CRYPTO_LIB_DIR=
+CONFIG_ISAL_CRYPTO_PKG_CONFIG=n
# Build with IO_URING support
CONFIG_URING=n
diff -Nurp a/Makefile b/Makefile
--- a/Makefile 2024-05-24 12:55:52.000000000 +0000
+++ b/Makefile 2024-06-09 08:14:21.760219479 +0000
@@ -18,8 +18,10 @@ DIRS-$(CONFIG_EXAMPLES) += examples
DIRS-$(CONFIG_APPS) += app
DIRS-y += test
DIRS-$(CONFIG_IPSEC_MB) += ipsecbuild
+ifneq ($(CONFIG_ISAL_PKG_CONFIG),y)
DIRS-$(CONFIG_ISAL) += isalbuild
DIRS-$(CONFIG_ISAL_CRYPTO) += isalcryptobuild
+endif
DIRS-$(CONFIG_VFIO_USER) += vfiouserbuild
DIRS-$(CONFIG_SMA) += proto
DIRS-$(CONFIG_XNVME) += xnvmebuild
@@ -32,7 +34,6 @@ DIRS-y += python
# Workaround for ninja. See dpdkbuild/Makefile
export MAKE_PID := $(shell echo $$PPID)
-
ifeq ($(SPDK_ROOT_DIR)/lib/env_dpdk,$(CONFIG_ENV))
ifeq ($(CURDIR)/dpdk/build,$(CONFIG_DPDK_DIR))
ifneq ($(SKIP_DPDK_BUILD),1)
@@ -62,10 +63,12 @@ LIB += ipsecbuild
DPDK_DEPS += ipsecbuild
endif
+ifneq ($(CONFIG_ISAL_PKG_CONFIG),y)
ifeq ($(CONFIG_ISAL),y)
ISALBUILD = isalbuild
LIB += isalbuild
DPDK_DEPS += isalbuild
+endif
ifeq ($(CONFIG_ISAL_CRYPTO),y)
ISALCRYPTOBUILD = isalcryptobuild
LIB += isalcryptobuild
diff -Nurp a/configure b/configure
--- a/configure 2024-05-24 12:55:52.000000000 +0000
+++ b/configure 2024-06-15 17:06:45.281969948 +0000
@@ -60,6 +60,8 @@ function usage() {
echo " Implies --without-dpdk."
echo " --with-idxd Build the IDXD library and accel framework plug-in module."
echo " --without-idxd Disabled while experimental. Only built for x86 when enabled."
+ echo " --with-system-isal Build against a system isa-l version. By default, the isa-l"
+ echo " submodule in spdk tree will be used."
echo " --with-crypto Build isa-l-crypto and vbdev crypto module. No path required."
echo " --without-crypto Disable isa-l-crypto and vbdev crypto module."
echo " --with-fio[=DIR] Build fio_plugin."
@@ -444,6 +446,34 @@ for i in "$@"; do
--without-dpdk)
CONFIG[DPDK_DIR]=
;;
+ --with-system-isal)
+ # Can we use pkg-config?
+ if command -v "pkg-config" > /dev/null 2>&1 && pkg-config --exists libisal; then
+ isal_libdir=$(pkg-config --variable=libdir libisal)
+ isal_libdir=$(readlink -f $isal_libdir)
+ isal_incdir=$(pkg-config --variable=includedir libisal)
+ echo "Using isa-l lib dir $isal_libdir"
+ CONFIG[ISAL_LIB_DIR]=$isal_libdir
+ CONFIG[ISAL_INC_DIR]=$isal_incdir
+ CONFIG[ISAL_PKG_CONFIG]=y
+ CFLAGS="${CFLAGS:+$CFLAGS }$(pkg-config --cflags libisal)"
+ else
+ echo "libisal.pc not found, aborting"
+ exit 1
+ fi
+ if command -v "pkg-config" > /dev/null 2>&1 && pkg-config --exists libisal_crypto; then
+ isal_crypto_libdir=$(pkg-config --variable=libdir libisal_crypto)
+ isal_crypto_libdir=$(readlink -f $isal_crypto_libdir)
+ isal_crypto_incdir=$(pkg-config --variable=includedir libisal_crypto)
+ echo "Using isa-l_crypto lib dir $isal_crypto_libdir"
+ CONFIG[ISAL_CRYPTO_LIB_DIR]=$isal_crypto_libdir
+ CONFIG[ISAL_CRYPTO_INC_DIR]=$isal_crypto_incdir
+ CONFIG[ISAL_CRYPTO_PKG_CONFIG]=y
+ CFLAGS="${CFLAGS:+$CFLAGS }$(pkg-config --cflags libisal_crypto)"
+ else
+ echo "libisal_crypto.pc not found"
+ fi
+ ;;
--with-wpdk=*)
check_dir "$i"
CONFIG[WPDK_DIR]=$(readlink -f ${i#*=})
@@ -936,7 +966,7 @@ fi
function dpdk_version() {
# Check DPDK version to determine if mlx5_pci driver is supported
- local dpdk_ver="none"
+local dpdk_ver="none"
if [[ "${CONFIG[DPDK_DIR]}" == "$rootdir/dpdk/build" ]]; then
# DPDK_DIR points at our submodule so ./build may not exist yet. Use
# absolute path to lookup the version.
@@ -1219,6 +1249,9 @@ if [[ "${CONFIG[FUZZER]}" = "y" && "$CC_
fi
if [[ $arch == x86_64* ]] || [[ $arch == aarch64* ]]; then
+ if [[ "${CONFIG[ISAL_PKG_CONFIG]}" = "y" ]]; then
+ echo "Using system ISA-L"
+ else
CONFIG[ISAL]=y
# make sure the submodule is initialized
if [ ! -f "$rootdir"/isa-l/autogen.sh ]; then
@@ -1249,6 +1282,7 @@ if [[ $arch == x86_64* ]] || [[ $arch ==
ISAL_CRYPTO_OPTS+=("--disable-sve2")
fi
fi
+ fi
else
# for PPC
CONFIG[ISAL]=n
@@ -1256,7 +1290,8 @@ else
fi
# now either configure ISA-L or disable unavailable features
-if [[ "${CONFIG[ISAL]}" = "y" ]]; then
+if [[ "${CONFIG[ISAL_PKG_CONFIG]}" = "n" ]]; then
+ if [[ "${CONFIG[ISAL]}" = "y" ]]; then
cd $rootdir/isa-l
ISAL_LOG=$rootdir/.spdk-isal.log
if [[ -n "${CONFIG[CROSS_PREFIX]}" ]]; then
@@ -1275,16 +1310,17 @@ if [[ "${CONFIG[ISAL]}" = "y" ]]; then
./configure CFLAGS="-fPIC -g -O2 -fuse-ld=$LD_TYPE -Wno-unused-command-line-argument" "${ISAL_OPTS[@]}" --enable-shared=no >> $ISAL_LOG 2>&1
echo "done."
cd $rootdir
-else
+ else
echo "Without ISA-L, there is no software support for crypto or compression,"
echo "so these features will be disabled."
CONFIG[CRYPTO]=n
CONFIG[VBDEV_COMPRESS]=n
CONFIG[DPDK_COMPRESSDEV]=n
+ fi
fi
-
# ISA-L-crypto complements ISA-L functionality, it is only enabled together with ISA-L
if [[ "${CONFIG[ISAL]}" = "y" ]]; then
+ if [[ "${CONFIG[ISAL_PKG_CONFIG]}" = "n" ]]; then
if [ ! -f "$rootdir"/isa-l-crypto/autogen.sh ]; then
echo "ISA-L-crypto is required but was not found, please init the submodule with:"
echo " git submodule update --init"
@@ -1309,6 +1345,7 @@ if [[ "${CONFIG[ISAL]}" = "y" ]]; then
echo "done."
cd $rootdir
CONFIG[ISAL_CRYPTO]=y
+ fi
else
CONFIG[ISAL_CRYPTO]=n
fi
diff -Nurp a/lib/accel/accel_sw.c b/lib/accel/accel_sw.c
--- a/lib/accel/accel_sw.c 2024-05-24 12:55:52.000000000 +0000
+++ b/lib/accel/accel_sw.c 2024-06-15 16:55:25.391332472 +0000
@@ -20,9 +20,9 @@
#include "spdk/dif.h"
#ifdef SPDK_CONFIG_ISAL
-#include "../isa-l/include/igzip_lib.h"
-#ifdef SPDK_CONFIG_ISAL_CRYPTO
-#include "../isa-l-crypto/include/aes_xts.h"
+#include "isa-l/igzip_lib.h"
+#if defined(SPDK_CONFIG_ISAL_CRYPTO)
+#include "isa-l_crypto/aes_xts.h"
#endif
#endif
diff -Nurp a/lib/util/crc16.c b/lib/util/crc16.c
--- a/lib/util/crc16.c 2024-05-24 12:55:52.000000000 +0000
+++ b/lib/util/crc16.c 2024-06-09 07:49:39.812740782 +0000
@@ -11,7 +11,7 @@
*/
#ifdef SPDK_CONFIG_ISAL
-#include "isa-l/include/crc.h"
+#include "isa-l/crc.h"
uint16_t
spdk_crc16_t10dif(uint16_t init_crc, const void *buf, size_t len)
diff -Nurp a/lib/util/crc64.c b/lib/util/crc64.c
--- a/lib/util/crc64.c 2024-05-24 12:55:52.000000000 +0000
+++ b/lib/util/crc64.c 2024-06-09 07:49:39.812740782 +0000
@@ -7,7 +7,7 @@
#include "spdk/crc64.h"
#ifdef SPDK_CONFIG_ISAL
-#include "isa-l/include/crc64.h"
+#include "isa-l/crc64.h"
uint64_t
spdk_crc64_nvme(const void *buf, size_t len, uint64_t crc)
diff -Nurp a/lib/util/crc_internal.h b/lib/util/crc_internal.h
--- a/lib/util/crc_internal.h 2024-05-24 12:55:52.000000000 +0000
+++ b/lib/util/crc_internal.h 2024-06-09 07:49:39.813740795 +0000
@@ -10,7 +10,7 @@
#ifdef SPDK_CONFIG_ISAL
#define SPDK_HAVE_ISAL
-#include <isa-l/include/crc.h>
+#include <isa-l/crc.h>
#elif defined(__aarch64__) && defined(__ARM_FEATURE_CRC32)
#define SPDK_HAVE_ARM_CRC
#include <arm_acle.h>
diff -Nurp a/lib/util/xor.c b/lib/util/xor.c
--- a/lib/util/xor.c 2024-05-24 12:55:52.000000000 +0000
+++ b/lib/util/xor.c 2024-06-09 07:49:39.813740795 +0000
@@ -85,7 +85,7 @@ xor_gen_basic(void *dest, void **sources
}
#ifdef SPDK_CONFIG_ISAL
-#include "isa-l/include/raid.h"
+#include "isa-l/raid.h"
#define SPDK_XOR_BUF_ALIGN 32
diff -Nurp a/mk/spdk.common.mk b/mk/spdk.common.mk
--- a/mk/spdk.common.mk 2024-05-24 12:55:52.000000000 +0000
+++ b/mk/spdk.common.mk 2024-06-09 07:50:33.966415127 +0000
@@ -184,7 +184,6 @@ ifeq ($(CONFIG_ISAL), y)
COMMON_CFLAGS += -I$(ISAL_DIR)/.. -I$(ISAL_BUILD_DIR)
ifeq ($(CONFIG_SHARED),y)
SYS_LIBS += -L$(ISAL_DIR)/.libs -lisal
-LDFLAGS += -Wl,-rpath=$(ISAL_DIR)/.libs
else
SYS_LIBS += $(ISAL_DIR)/.libs/libisal.a
endif
@@ -192,7 +191,6 @@ ifeq ($(CONFIG_ISAL_CRYPTO), y)
COMMON_CFLAGS += -I$(ISAL_CRYPTO_DIR)/.. -I$(ISAL_CRYPTO_BUILD_DIR)
ifeq ($(CONFIG_SHARED),y)
SYS_LIBS += -L$(ISAL_CRYPTO_DIR)/.libs -lisal_crypto
-LDFLAGS += -Wl,-rpath=$(ISAL_CRYPTO_DIR)/.libs
else
SYS_LIBS += $(ISAL_CRYPTO_DIR)/.libs/libisal_crypto.a
endif
@@ -416,7 +414,6 @@ LINK_CXX=\
# Provide function to ease build of a shared lib
define spdk_build_realname_shared_lib
$(1) -o $@ -shared $(CFLAGS) $(LDFLAGS) \
- -Wl,-rpath=$(DESTDIR)/$(libdir) \
-Wl,--soname,$(notdir $@) \
-Wl,--whole-archive $(2) -Wl,--no-whole-archive \
-Wl,--version-script=$(3) \
diff -Nurp a/module/bdev/aio/bdev_aio.c b/module/bdev/aio/bdev_aio.c
--- a/module/bdev/aio/bdev_aio.c 2024-05-24 12:55:52.000000000 +0000
+++ b/module/bdev/aio/bdev_aio.c 2024-06-15 16:59:56.578777701 +0000
@@ -26,6 +26,9 @@
#ifndef __FreeBSD__
#include <libaio.h>
#endif
+#if !defined(CONFIG_FALLOCATE_ZERO_RANGE)
+#include <linux/falloc.h>
+#endif
struct bdev_aio_io_channel {
uint64_t io_inflight;
diff -Nurp a/scripts/perf/pm/common b/scripts/perf/pm/common
--- a/scripts/perf/pm/common 2024-05-24 12:55:52.000000000 +0000
+++ b/scripts/perf/pm/common 2024-06-15 17:20:37.816601974 +0000
@@ -78,11 +78,13 @@ SUDO[0]="" SUDO[1]="sudo -E"
MONITOR_RESOURCES=(collect-cpu-load collect-vmstat)
if [[ $PM_OS == FreeBSD ]]; then
MONITOR_RESOURCES=(collect-vmstat)
-elif [[ $PM_OS == Linux && $(< /sys/class/dmi/id/chassis_vendor) != QEMU && ! -e /.dockerenv ]]; then
- # These are dedicated for the PHY platforms. Skip VMs and systems which identifies as
- # a docker containers (latter is specific to our CI's use-case).
- MONITOR_RESOURCES+=(collect-cpu-temp)
- MONITOR_RESOURCES+=(collect-bmc-pm)
+elif [[ -f /sys/class/dmi/id/chassis_vendor ]]; then
+ if [[ $PM_OS == Linux && $(< /sys/class/dmi/id/chassis_vendor) != QEMU && ! -e /.dockerenv ]]; then
+ # These are dedicated for the PHY platforms. Skip VMs and systems which identifies as
+ # a docker containers (latter is specific to our CI's use-case).
+ MONITOR_RESOURCES+=(collect-cpu-temp)
+ MONITOR_RESOURCES+=(collect-bmc-pm)
+ fi
fi
if [[ ! -d $PM_OUTPUTDIR ]]; then