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 <james.r.harris@intel.com>
Change-Id: I579655a98b515cf148b7cd17823a9bb541ea6ad7

Reviewed-on: https://review.gerrithub.io/c/440785
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Jim Harris 2019-01-13 13:28:21 -07:00 committed by Ben Walker
parent 972b78802c
commit f823b7f5c1
8 changed files with 63 additions and 38 deletions

3
CONFIG
View File

@ -121,3 +121,6 @@ CONFIG_IGB_UIO_DRIVER=n
# Build FTL library
CONFIG_FTL=n
# Build Intel IPSEC_MB library
CONFIG_IPSEC_MB=n

View File

@ -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

7
configure vendored
View File

@ -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

View File

@ -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

45
ipsecbuild/Makefile Normal file
View File

@ -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

View File

@ -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))

View File

@ -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)

View File

@ -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