diff --git a/CONFIG b/CONFIG index 5f552fe81d..d5e05a654c 100644 --- a/CONFIG +++ b/CONFIG @@ -195,3 +195,6 @@ CONFIG_USDT=n # Build with IDXD kernel support. # In this mode, SPDK shares the DSA device with the kernel. CONFIG_IDXD_KERNEL=n + +# Is DPDK using libbsd? +CONFIG_HAVE_LIBBSD=n diff --git a/configure b/configure index b8be360ae2..14164d418e 100755 --- a/configure +++ b/configure @@ -319,6 +319,9 @@ for i in "$@"; do CONFIG[DPDK_LIB_DIR]=$dpdk_libdir CONFIG[DPDK_INC_DIR]=$dpdk_incdir CONFIG[DPDK_PKG_CONFIG]=y + if pkg-config --print-requires libdpdk | grep "libbsd" > /dev/null 2>&1; then + CONFIG[HAVE_LIBBSD]=y + fi CFLAGS="${CFLAGS:+$CFLAGS }$(pkg-config --cflags libdpdk)" else echo "libdpdk.pc not found, aborting" @@ -341,9 +344,18 @@ for i in "$@"; do echo "ERROR: do you have another DPDK installed in the system?" exit 1 fi - + dpdk_reqs=$(PKG_CONFIG_PATH="$dpdk_libdir/pkgconfig" pkg-config --print-requires libdpdk) + if echo $dpdk_reqs | grep "libbsd" > /dev/null 2>&1; then + CONFIG[HAVE_LIBBSD]=y + fi CFLAGS="${CFLAGS:+$CFLAGS }$(PKG_CONFIG_PATH="$dpdk_libdir/pkgconfig" pkg-config --cflags libdpdk)" dpdk_incdir=$(PKG_CONFIG_PATH="$dpdk_libdir/pkgconfig" pkg-config --variable=includedir libdpdk) + else + echo "Using $dpdk_incdir/rte_build_config.h for additional libs..." + + if grep -F "define RTE_USE_LIBBSD 1" $dpdk_incdir/rte_build_config.h > /dev/null 2>&1; then + CONFIG[HAVE_LIBBSD]=y + fi fi echo "DPDK libraries: $dpdk_libdir" echo "DPDK includes: $dpdk_incdir" diff --git a/lib/env_dpdk/env.mk b/lib/env_dpdk/env.mk index 66a42ab05c..88ae22094a 100644 --- a/lib/env_dpdk/env.mk +++ b/lib/env_dpdk/env.mk @@ -144,6 +144,10 @@ ifeq ($(CONFIG_IPSEC_MB),y) DPDK_PRIVATE_LINKER_ARGS += -lIPSec_MB -L$(IPSEC_MB_DIR) endif +ifeq ($(CONFIG_HAVE_LIBBSD),y) +DPDK_PRIVATE_LINKER_ARGS += -lbsd +endif + ifeq ($(CONFIG_REDUCE),y) DPDK_PRIVATE_LINKER_ARGS += -lisal -L$(ISAL_DIR)/.libs ifeq ($(CONFIG_REDUCE_MLX5),y) diff --git a/mk/spdk.nvmecli.mk b/mk/spdk.nvmecli.mk index dbde972bda..6c10b3dfca 100644 --- a/mk/spdk.nvmecli.mk +++ b/mk/spdk.nvmecli.mk @@ -73,6 +73,10 @@ override LDFLAGS += \ -Wl,--no-whole-archive \ -ldl -pthread -lrt -lrdmacm -lnuma -libverbs +ifeq ($(CONFIG_HAVE_LIBBSD),y) +override LDFLAGS += -lbsd +endif + ifeq ($(CONFIG_ISAL), y) ISAL_DIR=$(SPDK_ROOT_DIR)/isa-l override LDFLAGS += -L$(ISAL_DIR)/.libs -lisal