2015-12-08 15:45:58 -07:00
|
|
|
# Copyright (c) 2015 Cisco and/or its affiliates.
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at:
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
# Scripts require non-POSIX parts of bash
|
|
|
|
SHELL := /bin/bash
|
|
|
|
|
|
|
|
DPDK_BUILD_DIR ?= $(CURDIR)/_build
|
|
|
|
DPDK_INSTALL_DIR ?= $(CURDIR)/_install
|
2016-03-24 17:17:47 +01:00
|
|
|
DPDK_PKTMBUF_HEADROOM ?= 128
|
2015-12-08 15:45:58 -07:00
|
|
|
DPDK_DOWNLOAD_DIR ?= $(HOME)/Downloads
|
|
|
|
DPDK_MARCH ?= native
|
2016-05-11 23:07:18 +02:00
|
|
|
DPDK_TUNE ?= generic
|
2015-12-08 15:45:58 -07:00
|
|
|
DPDK_DEBUG ?= n
|
2016-12-23 22:42:41 +01:00
|
|
|
DPDK_CRYPTO_PMD ?= n
|
|
|
|
DPDK_MLX5_PMD ?= n
|
2015-12-08 15:45:58 -07:00
|
|
|
|
|
|
|
B := $(DPDK_BUILD_DIR)
|
|
|
|
I := $(DPDK_INSTALL_DIR)
|
2016-11-08 20:39:21 +01:00
|
|
|
DPDK_VERSION ?= 16.11
|
2016-06-02 14:52:32 +02:00
|
|
|
DPDK_BASE_URL ?= http://fast.dpdk.org/rel
|
|
|
|
DPDK_TARBALL := dpdk-$(DPDK_VERSION).tar.xz
|
2016-03-29 16:43:58 +02:00
|
|
|
DPDK_TAR_URL := $(DPDK_BASE_URL)/$(DPDK_TARBALL)
|
2016-08-02 11:35:48 +05:30
|
|
|
DPDK_16.07_TARBALL_MD5_CKSUM := 690a2bb570103e58d12f9806e8bf21be
|
2016-11-14 21:45:20 +01:00
|
|
|
DPDK_16.11_TARBALL_MD5_CKSUM := 06c1c577795360719d0b4fafaeee21e9
|
2015-12-08 15:45:58 -07:00
|
|
|
DPDK_SOURCE := $(B)/dpdk-$(DPDK_VERSION)
|
2016-04-26 14:54:57 +02:00
|
|
|
|
|
|
|
ifneq (,$(findstring clang,$(CC)))
|
|
|
|
DPDK_CC=clang
|
|
|
|
else
|
|
|
|
DPDK_CC=gcc
|
|
|
|
endif
|
|
|
|
|
2016-05-11 08:40:33 +00:00
|
|
|
|
|
|
|
ifeq (,$(DPDK_TARGET))
|
2016-04-26 14:54:57 +02:00
|
|
|
DPDK_TARGET := x86_64-native-linuxapp-$(DPDK_CC)
|
2016-05-11 08:40:33 +00:00
|
|
|
endif
|
|
|
|
|
2015-12-08 15:45:58 -07:00
|
|
|
JOBS := $(shell grep processor /proc/cpuinfo | wc -l)
|
|
|
|
|
|
|
|
# compiler/linker custom arguments
|
|
|
|
DPDK_CPU_CFLAGS := -pie -fPIC
|
dpdk: fix link error
/usr/bin/ld: -f may not be used without -shared
collect2: error: ld returned 1 exit status
Indeed an extra "-fPIC" is given to ld, see the -Wl,-fPIC below:
gcc -pie -fPIC -pthread -march=native -DRTE_MACHINE_CPUFLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3 -DRTE_MACHINE_CPUFLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1 -DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHINE_CPUFLAG_AES -DRTE_MACHINE_CPUFLAG_PCLMULQDQ -DRTE_MACHINE_CPUFLAG_AVX -DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_AES,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX -I/home/jmg/dev/vpp/build-root/install-vpp_debug-native/dpdk/include -include /home/jmg/dev/vpp/build-root/install-vpp_debug-native/dpdk/include/rte_config.h -O3 -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wpointer-arith -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral -Wformat-security -Wundef -Wwrite-strings -D_GNU_SOURCE -Wl,-Map=test.map,--cref -o test commands.o test.o test_pci.o test_prefetch.o test_byteorder.o test_per_lcore.o test_atomic.o test_malloc.o test_cycles.o test_spinlock.o test_memory.o test_memzone.o test_ring.o test_ring_perf.o test_pmd_perf.o test_rwlock.o test_mempool.o test_mempool_perf.o test_mbuf.o test_logs.o test_memcpy.o test_memcpy_perf.o test_hash.o test_thash.o test_hash_perf.o test_hash_functions.o test_hash_scaling.o test_debug.o test_errno.o test_tailq.o test_string_fns.o test_cpuflags.o test_mp_secondary.o test_eal_flags.o test_eal_fs.o test_alarm.o test_interrupts.o test_version.o test_func_reentrancy.o test_cmdline.o test_cmdline_num.o test_cmdline_etheraddr.o test_cmdline_portlist.o test_cmdline_ipaddr.o test_cmdline_cirbuf.o test_cmdline_string.o test_cmdline_lib.o test_red.o test_sched.o test_meter.o test_kni.o test_common.o test_devargs.o virtual_pmd.o packet_burst_generator.o test_link_bonding.o test_link_bonding_mode4.o test_link_bonding_rssconf.o test_pmd_ring.o test_pmd_ring_perf.o test_cryptodev_perf.o test_cryptodev.o test_kvargs.o -Wl,-pie -Wl,-fPIC -Wl,--no-as-needed -Wl,-export-dynamic -L/home/jmg/dev/vpp/build-root/install-vpp_debug-native/dpdk/lib -Wl,-g -L/home/jmg/dev/vpp/build-root/install-vpp_debug-native/dpdk/lib -Wl,--whole-archive -Wl,-ldpdk -Wl,--start-group -Wl,-lrt -Wl,-lm -Wl,-ldl -Wl,--end-group -Wl,--no-whole-archive
Fixed by unsetting the flags -pie -fPIC out of LDFLAGS, these are not
options for the linker.
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.3.1-10ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.3.1 20160225 (Ubuntu 5.3.1-10ubuntu2)
Change-Id: Iffbebfbb625e8831822ec092bea88dea42f12930
Signed-off-by: Jean-Mickael Guerin <jean-mickael.guerin@6wind.com>
2016-03-02 19:05:05 +01:00
|
|
|
DPDK_CPU_LDFLAGS :=
|
2015-12-08 15:45:58 -07:00
|
|
|
DPDK_EXTRA_LDFLAGS := -g
|
|
|
|
|
|
|
|
ifeq ($(DPDK_DEBUG),n)
|
2016-05-11 23:07:18 +02:00
|
|
|
DPDK_EXTRA_CFLAGS := -g -mtune=$(DPDK_TUNE)
|
2015-12-08 15:45:58 -07:00
|
|
|
else
|
2016-04-26 14:54:57 +02:00
|
|
|
DPDK_EXTRA_CFLAGS := -g -O0
|
2015-12-08 15:45:58 -07:00
|
|
|
endif
|
|
|
|
|
|
|
|
# translate gcc march values to DPDK arch
|
|
|
|
ifeq ($(DPDK_MARCH),native)
|
|
|
|
DPDK_MACHINE:=native # autodetect host CPU
|
|
|
|
else ifeq ($(DPDK_MARCH),corei7)
|
|
|
|
DPDK_MACHINE:=nhm # Nehalem / Westmere
|
|
|
|
else ifeq ($(DPDK_MARCH),corei7-avx)
|
|
|
|
DPDK_MACHINE:=snb # Sandy Bridge
|
|
|
|
else ifeq ($(DPDK_MARCH),core-avx-i)
|
|
|
|
DPDK_MACHINE:=ivb # Ivy Bridge
|
|
|
|
else ifeq ($(DPDK_MARCH),core-avx2)
|
|
|
|
DPDK_MACHINE:=hsw # Haswell
|
2016-05-11 08:40:33 +00:00
|
|
|
else ifeq ($(DPDK_MARCH),armv7a)
|
|
|
|
DPDK_MACHINE:=armv7a # ARMv7
|
|
|
|
else ifeq ($(DPDK_MARCH),armv8a)
|
|
|
|
DPDK_MACHINE:=armv8a # ARMv8
|
2015-12-08 15:45:58 -07:00
|
|
|
else
|
|
|
|
$(error Unknown DPDK_MARCH)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# assemble DPDK make arguments
|
|
|
|
DPDK_MAKE_ARGS := -C $(DPDK_SOURCE) -j $(JOBS) \
|
|
|
|
T=$(DPDK_TARGET) \
|
|
|
|
RTE_CONFIG_TEMPLATE=../custom-config \
|
|
|
|
RTE_OUTPUT=$(I) \
|
|
|
|
EXTRA_CFLAGS="$(DPDK_EXTRA_CFLAGS)" \
|
|
|
|
EXTRA_LDFLAGS="$(DPDK_EXTRA_LDFLAGS)" \
|
|
|
|
CPU_CFLAGS="$(DPDK_CPU_CFLAGS)" \
|
2016-05-11 08:40:33 +00:00
|
|
|
CPU_LDFLAGS="$(DPDK_CPU_LDFLAGS)" \
|
|
|
|
$(DPDK_MAKE_EXTRA_ARGS)
|
2015-12-08 15:45:58 -07:00
|
|
|
|
|
|
|
DPDK_SOURCE_FILES := $(shell [ -e $(DPDK_SOURCE) ] && find $(DPDK_SOURCE) -name "*.[chS]")
|
|
|
|
|
|
|
|
define set
|
|
|
|
@if grep -q CONFIG_$1 $@ ; \
|
|
|
|
then sed -i -e 's/.*\(CONFIG_$1=\).*/\1$2/' $@ ; \
|
|
|
|
else echo CONFIG_$1=$2 >> $@ ; \
|
|
|
|
fi
|
|
|
|
endef
|
|
|
|
|
|
|
|
all: build
|
|
|
|
|
|
|
|
$(B)/custom-config: $(B)/.patch.ok Makefile
|
2016-04-26 10:44:28 +02:00
|
|
|
@echo --- generating custom config from $(DPDK_SOURCE)/config/defconfig_$(DPDK_TARGET) ---
|
|
|
|
@cpp -undef -ffreestanding -x assembler-with-cpp $(DPDK_SOURCE)/config/defconfig_$(DPDK_TARGET) $@
|
2015-12-08 15:45:58 -07:00
|
|
|
$(call set,RTE_MACHINE,$(DPDK_MACHINE))
|
|
|
|
@# modify options
|
2016-02-05 06:44:54 -08:00
|
|
|
$(call set,RTE_MAX_LCORE,256)
|
2015-12-08 15:45:58 -07:00
|
|
|
$(call set,RTE_PKTMBUF_HEADROOM,$(DPDK_PKTMBUF_HEADROOM))
|
|
|
|
$(call set,RTE_LIBEAL_USE_HPET,y)
|
|
|
|
$(call set,RTE_BUILD_COMBINE_LIBS,y)
|
|
|
|
$(call set,RTE_LIBRTE_I40E_16BYTE_RX_DESC,y)
|
2016-06-26 20:12:40 +02:00
|
|
|
$(call set,RTE_PCI_CONFIG,y)
|
|
|
|
$(call set,RTE_PCI_EXTENDED_TAG,"on")
|
|
|
|
$(call set,RTE_PCI_MAX_READ_REQUEST_SIZE,4096)
|
2015-12-08 15:45:58 -07:00
|
|
|
@# enable debug init for device drivers
|
|
|
|
$(call set,RTE_LIBRTE_I40E_DEBUG_INIT,$(DPDK_DEBUG))
|
|
|
|
$(call set,RTE_LIBRTE_IXGBE_DEBUG_INIT,$(DPDK_DEBUG))
|
|
|
|
$(call set,RTE_LIBRTE_E1000_DEBUG_INIT,$(DPDK_DEBUG))
|
|
|
|
$(call set,RTE_LIBRTE_VIRTIO_DEBUG_INIT,$(DPDK_DEBUG))
|
|
|
|
$(call set,RTE_LIBRTE_VMXNET3_DEBUG_INIT,$(DPDK_DEBUG))
|
Add support of Ethernet link bonding utilizing DPDK link bonding
poll mode driver library. The bonded interfaces to be created on
VPP startup is specified in the dpdk section of startup.conf
or qn.conf, using DPDK EAL command. Following is an example of a
dpdk section white listing PCI addressses of 4 ethernet interfacess
to be under VPP control plus two bonded interface and the PCI addresses
of the slaves in each:
dpdk { socket-mem 1024,1024
dev 0000:0f:00.0 dev 0000:10:00.0 dev 0000:11:00.0 dev 0000:12:00.0
vdev eth_bond0,mode=2,slave=0000:0f:00.0,slave=0000:11:00.0,xmit_policy=l34
vdev eth_bond1,mode=2,slave=0000:10:00.0,slave=0000:12:00.0,xmit_policy=l34
}
Note that only balance XOR (mode 2) is supported and "xmit_policy=l34"
specifies to use layer 3 SIP/DIP and layer 4 Sport/Dport for load
balance. Using "xmit_policy=l2" for SMAC/DMAC or "xmit_policy=l23" for
SMAC/DMAC and SIP/DIP should also work.
Change-Id: Iaf6438686fa20cce893cb5a823b76e2886b4360b
Signed-off-by: John Lo <loj@cisco.com>
2016-02-25 11:17:55 -05:00
|
|
|
$(call set,RTE_LIBRTE_PMD_BOND,y)
|
|
|
|
$(call set,RTE_LIBRTE_IP_FRAG,y)
|
2016-11-25 13:36:12 +00:00
|
|
|
$(call set,RTE_LIBRTE_PMD_AESNI_MB,$(DPDK_CRYPTO_PMD))
|
|
|
|
$(call set,RTE_LIBRTE_PMD_AESNI_GCM,$(DPDK_CRYPTO_PMD))
|
|
|
|
$(call set,RTE_LIBRTE_PMD_QAT,$(DPDK_CRYPTO_PMD))
|
2016-12-23 22:42:41 +01:00
|
|
|
$(call set,RTE_LIBRTE_MLX5_PMD,$(DPDK_MLX5_PMD))
|
2015-12-08 15:45:58 -07:00
|
|
|
@# not needed
|
|
|
|
$(call set,RTE_LIBRTE_TIMER,n)
|
|
|
|
$(call set,RTE_LIBRTE_CFGFILE,n)
|
|
|
|
$(call set,RTE_LIBRTE_LPM,n)
|
|
|
|
$(call set,RTE_LIBRTE_ACL,n)
|
|
|
|
$(call set,RTE_LIBRTE_POWER,n)
|
|
|
|
$(call set,RTE_LIBRTE_DISTRIBUTOR,n)
|
|
|
|
$(call set,RTE_LIBRTE_REORDER,n)
|
|
|
|
$(call set,RTE_LIBRTE_PORT,n)
|
|
|
|
$(call set,RTE_LIBRTE_TABLE,n)
|
|
|
|
$(call set,RTE_LIBRTE_PIPELINE,n)
|
|
|
|
$(call set,RTE_KNI_KMOD,n)
|
2017-01-01 16:53:22 +01:00
|
|
|
$(call set,RTE_EAL_IGB_UIO,n)
|
2015-12-08 15:45:58 -07:00
|
|
|
@rm -f .config.ok
|
|
|
|
|
|
|
|
$(CURDIR)/$(DPDK_TARBALL):
|
|
|
|
@mkdir -p $(B)
|
|
|
|
@if [ -e $(DPDK_DOWNLOAD_DIR)/$(DPDK_TARBALL) ] ; \
|
|
|
|
then cp $(DPDK_DOWNLOAD_DIR)/$(DPDK_TARBALL) $(CURDIR) ; \
|
|
|
|
else curl -o $(CURDIR)/$(DPDK_TARBALL) -LO $(DPDK_TAR_URL) ; \
|
|
|
|
fi
|
|
|
|
@rm -f $(B)/.download.ok
|
|
|
|
|
|
|
|
$(B)/.download.ok: $(CURDIR)/$(DPDK_TARBALL)
|
|
|
|
@openssl md5 $< | cut -f 2 -d " " - > $(B)/$(DPDK_TARBALL).md5sum
|
2015-12-16 04:27:37 +01:00
|
|
|
@([ "$$(<$(B)/$(DPDK_TARBALL).md5sum)" = "$(DPDK_$(DPDK_VERSION)_TARBALL_MD5_CKSUM)" ] || \
|
2015-12-08 15:45:58 -07:00
|
|
|
( echo "Bad Checksum! Please remove $< and retry" && \
|
|
|
|
rm $(B)/$(DPDK_TARBALL).md5sum && false ))
|
|
|
|
@touch $@
|
|
|
|
|
|
|
|
.PHONY: download
|
|
|
|
download: $(B)/.download.ok
|
|
|
|
|
|
|
|
$(B)/.extract.ok: $(B)/.download.ok
|
|
|
|
@echo --- extracting $(DPDK_TARBALL) ---
|
2016-06-02 14:52:32 +02:00
|
|
|
@tar --directory $(B) --extract --file $(CURDIR)/$(DPDK_TARBALL)
|
2015-12-08 15:45:58 -07:00
|
|
|
@touch $@
|
|
|
|
|
|
|
|
.PHONY: extract
|
|
|
|
extract: $(B)/.extract.ok
|
|
|
|
|
|
|
|
$(B)/.patch.ok: $(B)/.extract.ok
|
2016-03-29 22:37:02 +02:00
|
|
|
ifneq ($(wildcard $(CURDIR)/dpdk-$(DPDK_VERSION)_patches/*.patch),)
|
2015-12-08 15:45:58 -07:00
|
|
|
@echo --- patching ---
|
|
|
|
for f in $(CURDIR)/dpdk-$(DPDK_VERSION)_patches/*.patch ; do \
|
|
|
|
echo Applying patch: $$(basename $$f) ; \
|
|
|
|
patch -p1 -d $(DPDK_SOURCE) < $$f ; \
|
|
|
|
done
|
2016-03-29 22:37:02 +02:00
|
|
|
endif
|
2015-12-08 15:45:58 -07:00
|
|
|
@touch $@
|
|
|
|
|
|
|
|
.PHONY: patch
|
|
|
|
patch: $(B)/.patch.ok
|
|
|
|
|
|
|
|
$(B)/.config.ok: $(B)/.patch.ok $(B)/custom-config
|
|
|
|
@make $(DPDK_MAKE_ARGS) config
|
|
|
|
@touch $@
|
|
|
|
|
|
|
|
.PHONY: config
|
|
|
|
config: $(B)/.config.ok
|
|
|
|
|
|
|
|
$(B)/.build.ok: $(DPDK_SOURCE_FILES)
|
|
|
|
@if [ ! -e $(B)/.config.ok ] ; then echo 'Please run "make config" first' && false ; fi
|
|
|
|
@make $(DPDK_MAKE_ARGS) install
|
|
|
|
@dkms/create_deb_manifest.sh $(DPDK_VERSION) $(subst $(realpath ..)/,,$(B))
|
|
|
|
@touch $@
|
|
|
|
|
|
|
|
.PHONY: build
|
|
|
|
build: $(B)/.build.ok
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
@rm -rf $(B) $(I)
|
|
|
|
|