From f823b7f5c1fade2cdd1a4196a69730a8763759d0 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Sun, 13 Jan 2019 13:28:21 -0700 Subject: [PATCH] ipsec_mb: use EXTRA_CFLAGS to point DPDK to intel-ipsec-mb submodule This allows us to remove the requirement to install intel-ipsec-mb to system directories. Signed-off-by: Jim Harris Change-Id: I579655a98b515cf148b7cd17823a9bb541ea6ad7 Reviewed-on: https://review.gerrithub.io/c/440785 Tested-by: SPDK CI Jenkins Reviewed-by: Seth Howell Reviewed-by: Darek Stojaczyk Reviewed-by: Ben Walker --- CONFIG | 3 +++ Makefile | 5 +++++ configure | 7 +------ dpdkbuild/Makefile | 8 +++++--- ipsecbuild/Makefile | 45 +++++++++++++++++++++++++++++++++++++++++++++ lib/env_dpdk/env.mk | 4 ++-- mk/spdk.common.mk | 2 ++ scripts/pkgdep.sh | 27 --------------------------- 8 files changed, 63 insertions(+), 38 deletions(-) create mode 100644 ipsecbuild/Makefile diff --git a/CONFIG b/CONFIG index 31bd63422..39f92448d 100644 --- a/CONFIG +++ b/CONFIG @@ -121,3 +121,6 @@ CONFIG_IGB_UIO_DRIVER=n # Build FTL library CONFIG_FTL=n + +# Build Intel IPSEC_MB library +CONFIG_IPSEC_MB=n diff --git a/Makefile b/Makefile index c49a85617..c6ecb9750 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,7 @@ DIRS-y += lib DIRS-$(CONFIG_SHARED) += shared_lib DIRS-y += examples app include DIRS-$(CONFIG_TESTS) += test +DIRS-$(CONFIG_IPSEC_MB) += ipsecbuild .PHONY: all clean $(DIRS-y) include/spdk/config.h mk/config.mk mk/cc.mk \ cc_version cxx_version .libs_only_other .ldflags ldflags @@ -59,6 +60,10 @@ else LIB = lib endif +ifeq ($(CONFIG_IPSEC_MB),y) +LIB += ipsecbuild +endif + all: $(DIRS-y) clean: $(DIRS-y) $(Q)rm -f mk/cc.mk diff --git a/configure b/configure index c8867b66b..08f5b33d8 100755 --- a/configure +++ b/configure @@ -378,13 +378,8 @@ if [[ "${CONFIG[CRYPTO]}" = "y" ]]; then echo Crypto requires NASM version 2.12.02 or newer. Please install echo or upgrade then re-run this script. exit 1 - else - if [[ "$(find /usr -xdev -name intel-ipsec-mb.h 2>/dev/null)" == "" ]]; then - echo "To enable crypto you must first go to the intel-ipsec-mb directory and " - echo "run 'make' then 'sudo make install' then re-run this script." - exit 1 - fi fi + CONFIG[IPSEC_MB]=y fi if [[ "${CONFIG[REDUCE]}" = "y" ]]; then diff --git a/dpdkbuild/Makefile b/dpdkbuild/Makefile index 34d11e6f4..6a48f0f26 100644 --- a/dpdkbuild/Makefile +++ b/dpdkbuild/Makefile @@ -36,14 +36,16 @@ include $(SPDK_ROOT_DIR)/mk/spdk.common.mk .PHONY: all clean install -IPSEC_OPTS=SHARED=n -INTEL_IPSEC_MB_LIB= CRYPTO_ENABLED=n +DPDK_OPTS = +DPDK_CFLAGS = + ifeq ($(CONFIG_CRYPTO),y) ifeq ($(TARGET_MACHINE),x86_64) CRYPTO_ENABLED = y DPDK_OPTS += CONFIG_RTE_LIBRTE_PMD_AESNI_MB=y +DPDK_CFLAGS += -I$(IPSEC_MB_DIR) DPDK_OPTS += CONFIG_RTE_LIBRTE_REORDER=y DPDK_OPTS += CONFIG_RTE_LIBRTE_PMD_QAT=y DPDK_OPTS += CONFIG_RTE_LIBRTE_PMD_QAT_SYM=y @@ -85,7 +87,7 @@ else DPDK_CONFIG := $(DPDK_CONFIG)-gcc endif -DPDK_CFLAGS = -fPIC +DPDK_CFLAGS += -fPIC ifeq ($(CONFIG_DEBUG),y) DPDK_CFLAGS += -O0 -g diff --git a/ipsecbuild/Makefile b/ipsecbuild/Makefile new file mode 100644 index 000000000..c9bb9308a --- /dev/null +++ b/ipsecbuild/Makefile @@ -0,0 +1,45 @@ +# +# BSD LICENSE +# +# Copyright (c) Intel Corporation. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +SPDK_ROOT_DIR := $(abspath $(CURDIR)/..) +include $(SPDK_ROOT_DIR)/mk/spdk.common.mk + +.PHONY: all clean install + +all: + $(Q)$(MAKE) -C $(SPDK_ROOT_DIR)/intel-ipsec-mb -j$(NPROC) all SHARED=n EXTRA_CFLAGS=-fPIC + +install: all + +clean: + $(Q)$(MAKE) -C $(SPDK_ROOT_DIR)/intel-ipsec-mb clean SHARED=n diff --git a/lib/env_dpdk/env.mk b/lib/env_dpdk/env.mk index 663380963..b8d2239cf 100644 --- a/lib/env_dpdk/env.mk +++ b/lib/env_dpdk/env.mk @@ -98,8 +98,8 @@ ENV_DPDK_FILE = $(call spdk_lib_list_to_static_libs,env_dpdk) ENV_LIBS = $(ENV_DPDK_FILE) $(DPDK_LIB) ENV_LINKER_ARGS = $(ENV_DPDK_FILE) -Wl,--whole-archive $(DPDK_LIB) -Wl,--no-whole-archive -ifeq ($(CONFIG_CRYPTO),y) -ENV_LINKER_ARGS += -lIPSec_MB +ifeq ($(CONFIG_IPSEC_MB),y) +ENV_LINKER_ARGS += -lIPSec_MB -L$(IPSEC_MB_DIR) endif ifneq (,$(wildcard $(DPDK_INC_DIR)/rte_config.h)) diff --git a/mk/spdk.common.mk b/mk/spdk.common.mk index 721513a2e..1e5bff5c2 100644 --- a/mk/spdk.common.mk +++ b/mk/spdk.common.mk @@ -142,6 +142,8 @@ ifeq ($(CONFIG_RDMA),y) SYS_LIBS += -libverbs -lrdmacm endif +IPSEC_MB_DIR=$(SPDK_ROOT_DIR)/intel-ipsec-mb + #Attach only if FreeBSD and RDMA is specified with configure ifeq ($(OS),FreeBSD) ifeq ($(CONFIG_RDMA),y) diff --git a/scripts/pkgdep.sh b/scripts/pkgdep.sh index 7dd6fd088..fb5074de3 100755 --- a/scripts/pkgdep.sh +++ b/scripts/pkgdep.sh @@ -11,7 +11,6 @@ function usage() echo "" echo "$0" echo " -h --help" - echo " -i --install-crypto Install ipsec dependencies" echo "" exit 0 } @@ -23,13 +22,11 @@ while getopts 'hi-:' optchar; do -) case "$OPTARG" in help) usage;; - install-crypto) INSTALL_CRYPTO=true;; *) echo "Invalid argument '$OPTARG'" usage;; esac ;; h) usage;; - i) INSTALL_CRYPTO=true;; *) echo "Invalid argument '$OPTARG'" usage;; esac @@ -111,27 +108,3 @@ else echo "pkgdep: unknown system type." exit 1 fi - -# Only crypto needs nasm and this lib but because the lib requires root to -# install we do it here - when asked. - -if $INSTALL_CRYPTO; then - - nasm_ver=$(nasm -v | sed 's/[^0-9]*//g' | awk '{print substr ($0, 0, 5)}') - if [ $nasm_ver -lt "21202" ]; then - echo Crypto requires NASM version 2.12.02 or newer. Please install - echo or upgrade and re-run this script if you are going to use Crypto. - else - ipsec="$(find /usr -xdev -name intel-ipsec-mb.h 2>/dev/null)" - if [ "$ipsec" == "" ]; then - ipsec_submodule_cloned="$(find $rootdir/intel-ipsec-mb -name intel-ipsec-mb.h 2>/dev/null)" - if [ "$ipsec_submodule_cloned" != "" ]; then - su - $SUDO_USER -c "make -C $rootdir/intel-ipsec-mb" - make -C $rootdir/intel-ipsec-mb install - else - echo "The intel-ipsec-mb submodule has not been cloned and will not be installed." - echo "To enable crypto, run 'git submodule update --init' and then run this script again." - fi - fi - fi -fi