From cb9cadad578297ffd78fa8a33670bdf1ab669e7e Mon Sep 17 00:00:00 2001 From: Ed Warnicke Date: Tue, 8 Dec 2015 15:45:58 -0700 Subject: Initial commit of vpp code. Change-Id: Ib246f1fbfce93274020ee93ce461e3d8bd8b9f17 Signed-off-by: Ed Warnicke --- build-data/packages/sample-plugin.mk | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 build-data/packages/sample-plugin.mk (limited to 'build-data/packages/sample-plugin.mk') diff --git a/build-data/packages/sample-plugin.mk b/build-data/packages/sample-plugin.mk new file mode 100644 index 00000000..4532817c --- /dev/null +++ b/build-data/packages/sample-plugin.mk @@ -0,0 +1,41 @@ +sample-plugin_configure_depend = \ + vppinfra-install \ + dpdk-install \ + svm-install \ + vlib-api-install \ + vlib-install \ + vnet-install \ + vpp-install \ + vpp-api-test-install + +# +sample-plugin_configure_args = --with-q-platform=$(PLATFORM) --with-dpdk + +sample-plugin_CPPFLAGS = $(call installed_includes_fn, \ + vppinfra \ + dpdk \ + openssl \ + svm \ + vlib \ + vlib-api \ + vnet \ + vpp \ + vpp-api-test) + +sample-plugin_LDFLAGS = $(call installed_libs_fn, \ + vppinfra \ + dpdk \ + openssl \ + svm \ + vlib \ + vlib-api \ + vnet \ + vpp \ + vpp-api-test) + +sample-plugin_post_install = \ + mkdir -p $(PACKAGE_INSTALL_DIR)/$(arch_lib_dir)/vlib_plugins ; \ + cp $(PACKAGE_INSTALL_DIR)/$(arch_lib_dir)/*.so \ + $(PACKAGE_INSTALL_DIR)/$(arch_lib_dir)/vlib_plugins + +sample-plugin_image_include = echo $(arch_lib_dir)/vlib_plugins -- cgit 1.2.3-korg From 61efa140b1f44e0c568697fbc31cf3f430131ab2 Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Fri, 22 Jan 2016 08:23:09 -0500 Subject: aarch64 CPU arch / ThunderX platform initial support Change-Id: Ia2edd3cee2c25c26c7c47a9023744b97226434c7 Signed-off-by: Dave Barach --- build-data/packages/cavium-dpdk.mk | 55 +++++++++++++ build-data/packages/sample-plugin.mk | 2 +- build-data/packages/vlib-api-cavium-dpdk.mk | 6 ++ build-data/packages/vlib-api.mk | 2 - build-data/packages/vlib-cavium-dpdk.mk | 7 ++ build-data/packages/vnet-cavium-dpdk.mk | 29 +++++++ build-data/packages/vpp-api-test-cavium-dpdk.mk | 32 ++++++++ build-data/packages/vpp-api-test-no-dpdk.mk | 3 +- build-data/packages/vpp-api-test.mk | 27 +++---- build-data/packages/vpp-cavium-dpdk.mk | 30 +++++++ build-data/packages/vpp-no-dpdk.mk | 25 +++--- build-data/packages/vpp.mk | 3 +- build-data/platforms/thunder.mk | 36 +++++++++ build-root/Makefile | 17 +++- vnet/Makefile.am | 12 ++- vnet/configure.ac | 24 ++++++ vnet/vnet/classify/vnet_classify.h | 21 +++++ vnet/vnet/devices/dpdk/dpdk.h | 1 + vnet/vnet/devices/dpdk/init.c | 17 ++++ vnet/vnet/devices/dpdk/node.c | 12 +++ vnet/vnet/map/map.c | 2 +- vnet/vnet/plugin/p1.c | 12 ++- vpp-japi/m4/libtool.m4 | 79 ++++++++++-------- vpp/Makefile.am | 8 +- vpp/api/api.c | 21 ++++- vpp/api/test_client.c | 1 - vpp/configure.ac | 39 +++++---- vpp/vnet/main.c | 41 +++++++++- vppinfra/vppinfra/bihash_24_8.h | 11 +-- vppinfra/vppinfra/byte_order.h | 2 +- vppinfra/vppinfra/longjmp.S | 103 ++++++++++++++++++++++++ vppinfra/vppinfra/longjmp.h | 2 + vppinfra/vppinfra/test_longjmp.c | 2 +- vppinfra/vppinfra/time.c | 5 ++ vppinfra/vppinfra/time.h | 12 ++- vppinfra/vppinfra/types.h | 2 +- vppinfra/vppinfra/vector.h | 4 + 37 files changed, 592 insertions(+), 115 deletions(-) create mode 100644 build-data/packages/cavium-dpdk.mk create mode 100644 build-data/packages/vlib-api-cavium-dpdk.mk create mode 100644 build-data/packages/vlib-cavium-dpdk.mk create mode 100644 build-data/packages/vnet-cavium-dpdk.mk create mode 100644 build-data/packages/vpp-api-test-cavium-dpdk.mk create mode 100644 build-data/packages/vpp-cavium-dpdk.mk create mode 100644 build-data/platforms/thunder.mk (limited to 'build-data/packages/sample-plugin.mk') diff --git a/build-data/packages/cavium-dpdk.mk b/build-data/packages/cavium-dpdk.mk new file mode 100644 index 00000000..ce8ee228 --- /dev/null +++ b/build-data/packages/cavium-dpdk.mk @@ -0,0 +1,55 @@ +# Temporary until Cavium upstreams their work + +cavium-dpdk_configure = \ + src_dir=$(call find_source_fn,$(PACKAGE_SOURCE)) ; \ + dst_dir=$(PACKAGE_BUILD_DIR) ; \ + tar -C $${src_dir} -cf - . | tar -C $${dst_dir} -xf - ; \ + cd $${dst_dir} ; \ + : colossal hemorrhoid to configure headroom ; \ + if [ x$($(PACKAGE)_configure_args_$(PLATFORM)) = "x" ] ; then \ + HR=256 ; \ + else \ + dpdk_configure_args=$($(PACKAGE)_configure_args_$(PLATFORM)) ; \ + if [ $$dpdk_configure_args = "--with-headroom=256" ] ; then \ + HR=256 ; \ + elif [ $$dpdk_configure_args = "--with-headroom=384" ] ; then \ + HR=384 ; \ + else \ + HR=256 ; \ + fi ; \ + fi ; \ + env HR=$$HR \ + spp -o \ + $(PACKAGE_BUILD_DIR)/config/common_linuxapp \ + $(PACKAGE_BUILD_DIR)/config/common_linuxapp.spp \ + ; \ + env $(CONFIGURE_ENV) \ + make config T=arm64-thunderx-linuxapp-gcc RTE_ARCH=arm64 \ + CC=aarch64-thunderx-linux-gnu-gcc V=0 \ + RTE_SDK=$(PACKAGE_BUILD_DIR) \ + RTE_TARGET=arm-default-linuxapp-gcc + +# Note: add e.g. "-O0" to EXTRA_CFLAGS if desired: EXTRA_CFLAGS='-g -O0' + +cavium-dpdk_make_args = install T=arm64-thunderx-linuxapp-gcc RTE_ARCH=arm64 \ + CC=aarch64-thunderx-linux-gnu-gcc V=0 \ + RTE_SDK=$(PACKAGE_BUILD_DIR) \ + RTE_TARGET=arm-default-linuxapp-gcc + +cavium-dpdk_install = \ + src_dir=$(PACKAGE_BUILD_DIR) ; \ + dst_dir=$(PACKAGE_INSTALL_DIR) ; \ + tar -h -C $${src_dir}/arm64-thunderx-linuxapp-gcc -cf - . \ + | tar -C $${dst_dir} -xf - + +# dpdk libraries end up in .../lib not .../lib64. Fix it. +cavium-dpdk_post_install = \ + if [ "$(arch_lib_dir)" != "lib" ] ; then \ + mkdir -p $(PACKAGE_INSTALL_DIR)/$(arch_lib_dir) ; \ + cd $(PACKAGE_INSTALL_DIR)/lib ; \ + tar cf - . | ( cd $(PACKAGE_INSTALL_DIR)/$(arch_lib_dir); tar xf - ) ; \ + fi + +# nothing to install, all static libraries +cavium-dpdk_image_include = echo + diff --git a/build-data/packages/sample-plugin.mk b/build-data/packages/sample-plugin.mk index 4532817c..e9f2789a 100644 --- a/build-data/packages/sample-plugin.mk +++ b/build-data/packages/sample-plugin.mk @@ -9,7 +9,7 @@ sample-plugin_configure_depend = \ vpp-api-test-install # -sample-plugin_configure_args = --with-q-platform=$(PLATFORM) --with-dpdk +sample-plugin_configure_args = --with-dpdk sample-plugin_CPPFLAGS = $(call installed_includes_fn, \ vppinfra \ diff --git a/build-data/packages/vlib-api-cavium-dpdk.mk b/build-data/packages/vlib-api-cavium-dpdk.mk new file mode 100644 index 00000000..7a4fe2cd --- /dev/null +++ b/build-data/packages/vlib-api-cavium-dpdk.mk @@ -0,0 +1,6 @@ +vlib-api-cavium-dpdk_source = vlib-api + +vlib-api-cavium-dpdk_configure_depend = vppinfra-install svm-install vlib-cavium-dpdk-install + +vlib-api-cavium-dpdk_CPPFLAGS = $(call installed_includes_fn, vppinfra svm vlib-cavium-dpdk) +vlib-api-cavium-dpdk_LDFLAGS = $(call installed_libs_fn, vppinfra svm vlib-cavium-dpdk) diff --git a/build-data/packages/vlib-api.mk b/build-data/packages/vlib-api.mk index f4bd67d9..29b0d17d 100644 --- a/build-data/packages/vlib-api.mk +++ b/build-data/packages/vlib-api.mk @@ -2,5 +2,3 @@ vlib-api_configure_depend = vppinfra-install svm-install vlib-install vlib-api_CPPFLAGS = $(call installed_includes_fn, vppinfra svm vlib) vlib-api_LDFLAGS = $(call installed_libs_fn, vppinfra svm vlib) - -vlib-api_top_srcdir = $(call find_source_fn,vlib-api) diff --git a/build-data/packages/vlib-cavium-dpdk.mk b/build-data/packages/vlib-cavium-dpdk.mk new file mode 100644 index 00000000..0f2f132d --- /dev/null +++ b/build-data/packages/vlib-cavium-dpdk.mk @@ -0,0 +1,7 @@ +vlib-cavium-dpdk_source = vlib +vlib-cavium-dpdk_configure_depend = vppinfra-install cavium-dpdk-install + +vlib-cavium-dpdk_configure_args += --with-dpdk + +vlib-cavium-dpdk_CPPFLAGS = $(call installed_includes_fn, vppinfra cavium-dpdk) +vlib-cavium-dpdk_LDFLAGS = $(call installed_libs_fn, vppinfra cavium-dpdk) diff --git a/build-data/packages/vnet-cavium-dpdk.mk b/build-data/packages/vnet-cavium-dpdk.mk new file mode 100644 index 00000000..4c35b04d --- /dev/null +++ b/build-data/packages/vnet-cavium-dpdk.mk @@ -0,0 +1,29 @@ +vnet-cavium-dpdk_source = vnet + +vnet-cavium-dpdk_configure_depend = \ + vppinfra-install \ + cavium-dpdk-install \ + svm-install \ + vlib-api-cavium-dpdk-install \ + vlib-cavium-dpdk-install + + +vnet-cavium-dpdk_CPPFLAGS = $(call installed_includes_fn, \ + vppinfra \ + cavium-dpdk \ + openssl \ + svm \ + vlib-cavium-dpdk \ + vlib-api-cavium-dpdk) + +vnet-cavium-dpdk_LDFLAGS = $(call installed_libs_fn, \ + vppinfra \ + cavium-dpdk \ + openssl \ + svm \ + vlib-cavium-dpdk \ + vlib-api-cavium-dpdk) + +# Platform dependent configure flags +vnet-cavium-dpdk_configure_args += $(vnet-cavium-dpdk_configure_args_$(PLATFORM)) + diff --git a/build-data/packages/vpp-api-test-cavium-dpdk.mk b/build-data/packages/vpp-api-test-cavium-dpdk.mk new file mode 100644 index 00000000..e352317f --- /dev/null +++ b/build-data/packages/vpp-api-test-cavium-dpdk.mk @@ -0,0 +1,32 @@ +vpp-api-test-cavium-dpdk_source = vpp-api-test + +vpp-api-test-cavium-dpdk_configure_depend = \ + vppinfra-install \ + cavium-dpdk-install \ + svm-install \ + vlib-api-cavium-dpdk-install \ + vlib-cavium-dpdk-install \ + vnet-cavium-dpdk-install \ + vpp-cavium-dpdk-install + +# +vpp-api-test-cavium-dpdk_configure_args = --with-dpdk + +vpp-api-test-cavium-dpdk_CPPFLAGS = $(call installed_includes_fn, \ + vppinfra \ + cavium-dpdk \ + svm \ + vlib-cavium-dpdk \ + vlib-api-cavium-dpdk \ + vnet-cavium-dpdk \ + vpp-cavium-dpdk) + +vpp-api-test-cavium-dpdk_LDFLAGS = $(call installed_libs_fn, \ + vppinfra \ + cavium-dpdk \ + svm \ + vlib-cavium-dpdk \ + vlib-api-cavium-dpdk \ + vnet-cavium-dpdk \ + vpp-cavium-dpdk) + diff --git a/build-data/packages/vpp-api-test-no-dpdk.mk b/build-data/packages/vpp-api-test-no-dpdk.mk index b511f2ca..7aab11c3 100644 --- a/build-data/packages/vpp-api-test-no-dpdk.mk +++ b/build-data/packages/vpp-api-test-no-dpdk.mk @@ -9,8 +9,7 @@ vpp-api-test-no-dpdk_configure_depend = \ vpp-no-dpdk-install # -vpp-api-test-no-dpdk_configure_args = --with-q-platform=$(PLATFORM) \ - --with-q-plugin-prefix=$(MU_BUILD_ROOT_DIR)/packages-$(PLATFORM) +vpp-api-test-no-dpdk_configure_args = vpp-api-test-no-dpdk_CPPFLAGS = $(call installed_includes_fn, \ vppinfra \ diff --git a/build-data/packages/vpp-api-test.mk b/build-data/packages/vpp-api-test.mk index eb7f466a..6ad70bc5 100644 --- a/build-data/packages/vpp-api-test.mk +++ b/build-data/packages/vpp-api-test.mk @@ -8,24 +8,23 @@ vpp-api-test_configure_depend = \ vpp-install # -vpp-api-test_configure_args = --with-q-platform=$(PLATFORM) --with-dpdk \ - --with-q-plugin-prefix=$(MU_BUILD_ROOT_DIR)/packages-$(PLATFORM) +vpp-api-test_configure_args = --with-dpdk vpp-api-test_CPPFLAGS = $(call installed_includes_fn, \ - vppinfra \ - dpdk \ - svm \ - vlib \ - vlib-api \ - vnet \ + vppinfra \ + dpdk \ + svm \ + vlib \ + vlib-api \ + vnet \ vpp) vpp-api-test_LDFLAGS = $(call installed_libs_fn, \ - vppinfra \ - dpdk \ - svm \ - vlib \ - vlib-api \ - vnet \ + vppinfra \ + dpdk \ + svm \ + vlib \ + vlib-api \ + vnet \ vpp) diff --git a/build-data/packages/vpp-cavium-dpdk.mk b/build-data/packages/vpp-cavium-dpdk.mk new file mode 100644 index 00000000..704e3a95 --- /dev/null +++ b/build-data/packages/vpp-cavium-dpdk.mk @@ -0,0 +1,30 @@ +vpp-cavium-dpdk_source = vpp + +vpp-cavium-dpdk_configure_depend = \ + vppinfra-install \ + cavium-dpdk-install \ + svm-install \ + vlib-api-cavium-dpdk-install \ + vlib-cavium-dpdk-install \ + vnet-cavium-dpdk-install + +# Platform dependent configure flags +vpp-cavium-dpdk_configure_args += $(vpp-cavium-dpdk_configure_args_$(PLATFORM)) + +vpp-cavium-dpdk_CPPFLAGS = $(call installed_includes_fn, \ + vppinfra \ + cavium-dpdk \ + openssl \ + svm \ + vlib-cavium-dpdk \ + vlib-api-cavium-dpdk \ + vnet-cavium-dpdk) + +vpp-cavium-dpdk_LDFLAGS = $(call installed_libs_fn, \ + vppinfra \ + cavium-dpdk \ + openssl \ + svm \ + vlib-cavium-dpdk \ + vlib-api-cavium-dpdk \ + vnet-cavium-dpdk) diff --git a/build-data/packages/vpp-no-dpdk.mk b/build-data/packages/vpp-no-dpdk.mk index f509bdf3..81f3f75a 100644 --- a/build-data/packages/vpp-no-dpdk.mk +++ b/build-data/packages/vpp-no-dpdk.mk @@ -1,33 +1,32 @@ vpp-no-dpdk_source = vpp -vpp-no-dpdk_configure_depend = \ +vpp-no-dpdk_configure_depend = \ vppinfra-install \ - openssl-install \ + openssl-install \ svm-install \ - vlib-api-no-dpdk-install \ - vlib-no-dpdk-install \ - vnet-no-dpdk-install \ + vlib-api-no-dpdk-install \ + vlib-no-dpdk-install \ + vnet-no-dpdk-install # -vpp-no-dpdk_configure_args = --with-q-platform=$(PLATFORM) \ - --with-q-plugin-prefix=$(MU_BUILD_ROOT_DIR)/packages-$(PLATFORM) +vpp-no-dpdk_configure_args = # Platform dependent configure flags vpp-no-dpdk_configure_args += $(vpp-no-dpdk_configure_args_$(PLATFORM)) vpp-no-dpdk_CPPFLAGS = $(call installed_includes_fn, \ - vppinfra \ - openssl \ - svm \ + vppinfra \ + openssl \ + svm \ vlib-no-dpdk \ vlib-api-no-dpdk \ vnet-no-dpdk) -vpp-no-dpdk_LDFLAGS = $(call installed_libs_fn, \ +vpp-no-dpdk_LDFLAGS = $(call installed_libs_fn, \ vppinfra \ openssl \ svm \ - vlib-no-dpdk \ - vlib-api-no-dpdk \ + vlib-no-dpdk \ + vlib-api-no-dpdk \ vnet-no-dpdk) diff --git a/build-data/packages/vpp.mk b/build-data/packages/vpp.mk index ff2c5519..02aca4e6 100644 --- a/build-data/packages/vpp.mk +++ b/build-data/packages/vpp.mk @@ -7,8 +7,7 @@ vpp_configure_depend = \ vnet-install \ # -vpp_configure_args = --with-q-platform=$(PLATFORM) \ - --with-q-plugin-prefix=$(MU_BUILD_ROOT_DIR)/packages-$(PLATFORM) +vpp_configure_args = # Platform dependent configure flags vpp_configure_args += $(vpp_configure_args_$(PLATFORM)) diff --git a/build-data/platforms/thunder.mk b/build-data/platforms/thunder.mk new file mode 100644 index 00000000..8fb00456 --- /dev/null +++ b/build-data/platforms/thunder.mk @@ -0,0 +1,36 @@ +# Override OS so we can use the sdk toolchain instead of building one +thunder_os = thunderx-linux-gnu + +# Override CROSS_LDFLAGS so we can use +# /lib/aarch64-linux-gnu/ld-linux-aarch64.so.1 instead of building glibc +thunder_cross_ldflags = \ + -Wl,--dynamic-linker=/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1 \ + -Wl,-rpath -Wl,$(lots_of_slashes_to_pad_names)$(TOOL_INSTALL_LIB_DIR) + +thunder_arch = aarch64 +# suppress -march=foo, the cross compiler doesn't understand it +thunder_march = " " + +thunder_root_packages = vppinfra vlib-cavium-dpdk vnet-cavium-dpdk cavium-dpdk \ + vpp-cavium-dpdk vpp-api-test-cavium-dpdk + +vnet-cavium-dpdk_configure_args_thunder = \ + --with-dpdk --without-ipsec --without-vcgn --without-ipv6sr + +vpp-cavium-dpdk_configure_args_thunder = \ + --with-dpdk --without-ipsec --without-vcgn --without-ipv6sr + +cavium-dpdk_configure_args_thunder = --with-headroom=256 + +vlib-cavium-dpdk_configure_args_thunder = --with-pre-data=128 + +# native tool chain additions for this platform +thunder_native_tools = vppapigen + +thunder_debug_TAG_CFLAGS = -g -O0 -DCLIB_DEBUG +thunder_debug_TAG_LDFLAGS = -g -O0 -DCLIB_DEBUG + +thunder_TAG_CFLAGS = -g -O2 +thunder_TAG_LDFLAGS = -g -O2 + + diff --git a/build-root/Makefile b/build-root/Makefile index ed25a0cc..aa50255b 100644 --- a/build-root/Makefile +++ b/build-root/Makefile @@ -172,7 +172,12 @@ native_libdir = $($(NATIVE_ARCH)_libdir) arch_lib_dir = lib$($(BASIC_ARCH)_libdir) # OS to configure for. configure --host will be set to $(ARCH)-$(OS) -OS = mu-linux +# Allow per-platform overrides + +OS = $(strip $($(PLATFORM)_os)) +ifeq ($(OS),) + OS = mu-linux +endif spu_target = spu native_target = @@ -506,9 +511,13 @@ DYNAMIC_LINKER=${shell cd $(TOOL_INSTALL_LIB_DIR); echo ld*.so.*} lots_of_slashes_to_pad_names = "/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////" # When PLATFORM != native we *always* use our own versions of GLIBC and dynamic linker -CROSS_LDFLAGS = \ - -Wl,--dynamic-linker=$(lots_of_slashes_to_pad_names)$(TOOL_INSTALL_LIB_DIR)/$(DYNAMIC_LINKER) \ - -Wl,-rpath -Wl,$(lots_of_slashes_to_pad_names)$(TOOL_INSTALL_LIB_DIR) +# Allow per-platform overrides +CROSS_LDFLAGS = $(strip $($(PLATFORM)_cross_ldflags)) +ifeq ($(CROSS_LDFLAGS),) + CROSS_LDFLAGS = \ + -Wl,--dynamic-linker=$(lots_of_slashes_to_pad_names)$(TOOL_INSTALL_LIB_DIR)/$(DYNAMIC_LINKER) \ + -Wl,-rpath -Wl,$(lots_of_slashes_to_pad_names)$(TOOL_INSTALL_LIB_DIR) +endif cross_ldflags = $(if $(is_native)$(is_build_tool),,$(CROSS_LDFLAGS) ) diff --git a/vnet/Makefile.am b/vnet/Makefile.am index a0c20e9e..81cc012f 100644 --- a/vnet/Makefile.am +++ b/vnet/Makefile.am @@ -13,7 +13,7 @@ AUTOMAKE_OPTIONS = foreign subdir-objects -AM_CFLAGS = -Wall @DPDK@ @VIRL@ +AM_CFLAGS = -Wall @DPDK@ @VIRL@ @IPSEC@ @VCGN@ @IPV6SR@ libvnet_la_SOURCES = libvnetplugin_la_SOURCES = @@ -278,7 +278,7 @@ nobase_include_HEADERS += \ ######################################## # Layer 3 protocol: IPSec ######################################## -if WITH_DPDK +if WITH_IPSEC libvnet_la_SOURCES += \ vnet/ipsec/ipsec.c \ vnet/ipsec/ipsec_cli.c \ @@ -295,13 +295,13 @@ libvnet_la_SOURCES += \ vnet/ipsec/ikev2_cli.c \ vnet/ipsec/ikev2_payload.c \ vnet/ipsec/ikev2_format.c +endif nobase_include_HEADERS += \ vnet/ipsec/ipsec.h \ vnet/ipsec/esp.h \ vnet/ipsec/ikev2.h \ vnet/ipsec/ikev2_priv.h -endif ######################################## # Layer 3 protocol: osi @@ -441,8 +441,11 @@ nobase_include_HEADERS += \ ######################################## # ipv6 segment routing ######################################## + +if WITH_IPV6SR libvnet_la_SOURCES += \ vnet/sr/sr.c +endif nobase_include_HEADERS += \ vnet/sr/sr_packet.h \ @@ -452,6 +455,8 @@ nobase_include_HEADERS += \ ######################################## # CGN ######################################### + +if WITH_VCGN libvnet_la_SOURCES += \ vnet/vcgn/cnat_bulk_port.c \ vnet/vcgn/cnat_config.c \ @@ -480,6 +485,7 @@ libvnet_la_SOURCES += \ vnet/vcgn/index_list.c \ vnet/vcgn/spp_platform_trace_log.c \ vnet/vcgn/vcgn_classify.c +endif ######################################## # DHCPv6 proxy diff --git a/vnet/configure.ac b/vnet/configure.ac index a570389e..cc55dc3b 100644 --- a/vnet/configure.ac +++ b/vnet/configure.ac @@ -17,10 +17,34 @@ AC_ARG_WITH(virl, [with_virl=1], [with_virl=0]) +AC_ARG_WITH(ipsec, + AC_HELP_STRING([--without-ipsec],[Disable ipsec]), + [with_ipsec=0], + [with_ipsec=1]) + +AC_ARG_WITH(vcgn, + AC_HELP_STRING([--without-vcgn],[Disable vcgn]), + [with_vcgn=0], + [with_vcgn=1]) + +AC_ARG_WITH(ipv6sr, + AC_HELP_STRING([--without-ipv6sr],[Disable ipv6sr]), + [with_ipv6sr=0], + [with_ipv6sr=1]) + AM_CONDITIONAL(WITH_DPDK, test "$with_dpdk" = "1") AC_SUBST(DPDK,[-DDPDK=${with_dpdk}]) AM_CONDITIONAL(WITH_VIRL, test "$with_virl" = "1") AC_SUBST(VIRL,[-DVIRL=${with_virl}]) +AM_CONDITIONAL(WITH_IPSEC, test "$with_ipsec" = "1") +AC_SUBST(IPSEC,[-DIPSEC=${with_ipsec}]) + +AM_CONDITIONAL(WITH_VCGN, test "$with_vcgn" = "1") +AC_SUBST(VCGN,[-DVCGN=${with_vcgn}]) + +AM_CONDITIONAL(WITH_IPV6SR, test "$with_ipv6sr" = "1") +AC_SUBST(IPV6SR,[-DIPV6SR=${with_ipv6sr}]) + AC_OUTPUT([Makefile]) diff --git a/vnet/vnet/classify/vnet_classify.h b/vnet/vnet/classify/vnet_classify.h index 03271ad2..3e93ba34 100644 --- a/vnet/vnet/classify/vnet_classify.h +++ b/vnet/vnet/classify/vnet_classify.h @@ -294,7 +294,9 @@ vnet_classify_find_entry_inline (vnet_classify_table_t * t, u32x4 result __attribute__((aligned(sizeof(u32x4)))); vnet_classify_bucket_t * b; u32 value_index; +#ifndef __aarch64__ u32 result_mask; +#endif u32 bucket_index; int i; @@ -357,6 +359,7 @@ vnet_classify_find_entry_inline (vnet_classify_table_t * t, abort(); } +#ifndef __aarch64__ result_mask = u32x4_zero_byte_mask (result); if (result_mask == 0xffff) { @@ -367,6 +370,24 @@ vnet_classify_find_entry_inline (vnet_classify_table_t * t, } return (v); } +#else + { + typedef union {u32x4 as_u32x4; u64 as_u64[2];} u64u_t; + u64u_t u; + u.as_u32x4 = result; + + if (u.as_u64[0] == 0 && u.as_u64[1] == 0) + { + if (PREDICT_TRUE(now)) + { + v->hits++; + v->last_heard = now; + } + return (v); + } + } +#endif + v = vnet_classify_entry_at_index (t, v, 1); } return 0; diff --git a/vnet/vnet/devices/dpdk/dpdk.h b/vnet/vnet/devices/dpdk/dpdk.h index fd984e4d..bb3ef4ff 100644 --- a/vnet/vnet/devices/dpdk/dpdk.h +++ b/vnet/vnet/devices/dpdk/dpdk.h @@ -75,6 +75,7 @@ typedef enum { } dpdk_device_type_t; #define foreach_dpdk_pmd \ + _ ("rte_nicvf_pmd", THUNDERX) \ _ ("rte_em_pmd", E1000EM) \ _ ("rte_igb_pmd", IGB) \ _ ("rte_igbvf_pmd", IGBVF) \ diff --git a/vnet/vnet/devices/dpdk/init.c b/vnet/vnet/devices/dpdk/init.c index a4b0f014..a8e84949 100644 --- a/vnet/vnet/devices/dpdk/init.c +++ b/vnet/vnet/devices/dpdk/init.c @@ -341,6 +341,7 @@ dpdk_lib_init (dpdk_main_t * dm) /* 10G adapters */ case VNET_DPDK_PMD_IXGBE: case VNET_DPDK_PMD_IXGBEVF: + case VNET_DPDK_PMD_THUNDERX: xd->port_type = VNET_DPDK_PORT_TYPE_ETH_10G; xd->nb_rx_desc = DPDK_NB_RX_DESC_10GE; xd->nb_tx_desc = DPDK_NB_TX_DESC_10GE; @@ -1684,6 +1685,22 @@ do { \ _(pmd_af_packet_drv) #endif +#undef _ + +/* + * At the moment, the ThunderX NIC driver doesn't have + * an entry point named "devinitfn_rte_xxx_driver" + */ +#define _(d) \ +do { \ + void d(void); \ + __attribute__((unused)) void (* volatile pf)(void); \ + pf = d; \ +} while(0); + +#ifdef RTE_LIBRTE_THUNDERVNIC_PMD +_(rte_nicvf_pmd_init) +#endif #undef _ dm->vlib_main = vm; diff --git a/vnet/vnet/devices/dpdk/node.c b/vnet/vnet/devices/dpdk/node.c index f05c37fe..770af2a0 100644 --- a/vnet/vnet/devices/dpdk/node.c +++ b/vnet/vnet/devices/dpdk/node.c @@ -541,6 +541,7 @@ static inline u32 dpdk_device_input ( dpdk_main_t * dm, u32 n_trace, trace_cnt __attribute__((unused)); vlib_buffer_free_list_t * fl; u8 efd_discard_burst = 0; + u16 ip_align_offset = 0; if (xd->admin_up == 0) return 0; @@ -559,6 +560,9 @@ static inline u32 dpdk_device_input ( dpdk_main_t * dm, return 0; } + if (xd->pmd == VNET_DPDK_PMD_THUNDERX) + ip_align_offset = 6; + vec_reset_length (xd->d_trace_buffers); trace_cnt = n_trace = vlib_get_trace_count (vm, node); @@ -706,6 +710,14 @@ static inline u32 dpdk_device_input ( dpdk_main_t * dm, b0->current_data = l3_offset0; b0->current_length = mb->data_len - l3_offset0; + + if (PREDICT_FALSE (ip_align_offset != 0)) + { + if (next0 == DPDK_RX_NEXT_IP4_INPUT || + next0 == DPDK_RX_NEXT_IP6_INPUT) + b0->current_data += ip_align_offset; + } + b0->flags = VLIB_BUFFER_TOTAL_LENGTH_VALID; if (VMWARE_LENGTH_BUG_WORKAROUND) diff --git a/vnet/vnet/map/map.c b/vnet/vnet/map/map.c index 3cf5e692..b55c4c2e 100644 --- a/vnet/vnet/map/map.c +++ b/vnet/vnet/map/map.c @@ -17,7 +17,7 @@ #include "map.h" -#ifdef __powerpc64__ +#if defined(__powerpc64__) || defined(__aarch64__) #include static inline u32 diff --git a/vnet/vnet/plugin/p1.c b/vnet/vnet/plugin/p1.c index 6ede7938..9029f130 100644 --- a/vnet/vnet/plugin/p1.c +++ b/vnet/vnet/plugin/p1.c @@ -51,8 +51,6 @@ _(format_ip6_address_and_length) \ _(udp_register_dst_port) \ _(ethernet_register_input_type) \ _(ethernet_set_flags) \ -_(vnet_register_sr_app_callback) \ -_(format_ip6_sr_header) \ _(format_ip6_address) \ _(unformat_ip6_address) \ _(ip6_main) \ @@ -101,9 +99,18 @@ _(efd_config) #define foreach_dpdk_plugin_reference #endif +#if IPV6SR > 0 +#define foreach_ip6_sr_plugin_reference \ +_(vnet_register_sr_app_callback) \ +_(format_ip6_sr_header) +#else +#define foreach_ip6_sr_plugin_reference +#endif + #define _(a) void a (void); foreach_plugin_reference foreach_dpdk_plugin_reference +foreach_ip6_sr_plugin_reference #undef _ void *vnet_library_plugin_references[] = @@ -111,6 +118,7 @@ void *vnet_library_plugin_references[] = #define _(a) &a, foreach_plugin_reference foreach_dpdk_plugin_reference + foreach_ip6_sr_plugin_reference #undef _ }; diff --git a/vpp-japi/m4/libtool.m4 b/vpp-japi/m4/libtool.m4 index 44e0ecff..d7c043f4 100644 --- a/vpp-japi/m4/libtool.m4 +++ b/vpp-japi/m4/libtool.m4 @@ -1312,7 +1312,7 @@ ia64-*-hpux*) rm -rf conftest* ;; -x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext @@ -1324,9 +1324,19 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - LD="${LD-ld} -m elf_i386" + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac + ;; + powerpc64le-*) + LD="${LD-ld} -m elf32lppclinux" ;; - ppc64-*linux*|powerpc64-*linux*) + powerpc64-*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) @@ -1345,7 +1355,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; - ppc*-*linux*|powerpc*-*linux*) + powerpcle-*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc-*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) @@ -1688,7 +1701,8 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else @@ -2512,17 +2526,6 @@ freebsd* | dragonfly*) esac ;; -gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no @@ -2639,7 +2642,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no @@ -2684,6 +2687,18 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu) dynamic_linker='GNU/Linux ld.so' ;; +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + netbsd*) version_type=sunos need_lib_prefix=no @@ -3243,10 +3258,6 @@ freebsd* | dragonfly*) fi ;; -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - haiku*) lt_cv_deplibs_check_method=pass_all ;; @@ -3285,11 +3296,11 @@ irix5* | irix6* | nonstopux*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; -netbsd*) +netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else @@ -4037,7 +4048,7 @@ m4_if([$1], [CXX], [ ;; esac ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler @@ -4101,7 +4112,7 @@ m4_if([$1], [CXX], [ ;; esac ;; - netbsd*) + netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise @@ -4336,7 +4347,7 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -4578,6 +4589,9 @@ m4_if([$1], [CXX], [ ;; esac ;; + linux* | k*bsd*-gnu | gnu*) + _LT_TAGVAR(link_all_deplibs, $1)=no + ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; @@ -4640,6 +4654,9 @@ dnl Note also adjust exclude_expsyms for C++ above. openbsd*) with_gnu_ld=no ;; + linux* | k*bsd*-gnu | gnu*) + _LT_TAGVAR(link_all_deplibs, $1)=no + ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes @@ -4861,7 +4878,7 @@ _LT_EOF fi ;; - netbsd*) + netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= @@ -5038,6 +5055,7 @@ _LT_EOF if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi + _LT_TAGVAR(link_all_deplibs, $1)=no else # not using gcc if test "$host_cpu" = ia64; then @@ -5342,7 +5360,7 @@ _LT_EOF _LT_TAGVAR(link_all_deplibs, $1)=yes ;; - netbsd*) + netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else @@ -6222,9 +6240,6 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(ld_shlibs, $1)=yes ;; - gnu*) - ;; - haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes @@ -6386,7 +6401,7 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(inherit_rpath, $1)=yes ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler diff --git a/vpp/Makefile.am b/vpp/Makefile.am index 5103646c..73e01b79 100644 --- a/vpp/Makefile.am +++ b/vpp/Makefile.am @@ -13,7 +13,7 @@ AUTOMAKE_OPTIONS = foreign subdir-objects -AM_CFLAGS = -Wall @Q_PLATFORM_DEFINE@ @Q_PLATFORM_PLUGPATH@ @DPDK@ +AM_CFLAGS = -Wall @DPDK@ @IPSEC@ @VCGN@ @IPV6SR@ noinst_PROGRAMS = BUILT_SOURCES = @@ -75,9 +75,11 @@ if WITH_DPDK vpp_LDADD += -l:libdpdk.a endif -# These go last +vpp_LDADD += -lvppinfra -lm -lpthread -ldl -vpp_LDADD += -lvppinfra -lm -lpthread -lcrypto -ldl +if WITH_IPV6SR + vpp_LDADD += -lcrypto +endif SUFFIXES = .api.h .api diff --git a/vpp/api/api.c b/vpp/api/api.c index fe926791..9f3da214 100644 --- a/vpp/api/api.c +++ b/vpp/api/api.c @@ -52,7 +52,9 @@ #include #include #include +#if IPV6SR > 0 #include +#endif #include #include #include @@ -73,7 +75,9 @@ #include #if DPDK > 0 +#if IPSEC > 0 #include +#endif /* IPSEC */ #include #endif @@ -3276,6 +3280,9 @@ static void vl_api_set_arp_neighbor_limit_t_handler (vl_api_set_arp_neighbor_lim static void vl_api_sr_tunnel_add_del_t_handler (vl_api_sr_tunnel_add_del_t *mp) { +#if IPV6SR == 0 + clib_warning ("unimplemented"); +#else ip6_sr_add_del_tunnel_args_t _a, *a=&_a; int rv = 0; vl_api_sr_tunnel_add_del_reply_t * rmp; @@ -3319,6 +3326,7 @@ static void vl_api_sr_tunnel_add_del_t_handler out: REPLY_MACRO(VL_API_SR_TUNNEL_ADD_DEL_REPLY); +#endif } #define foreach_classify_add_del_table_field \ @@ -4509,6 +4517,10 @@ static void vl_api_input_acl_set_interface_t_handler static void vl_api_ipsec_spd_add_del_t_handler (vl_api_ipsec_spd_add_del_t * mp) { +#if IPSEC == 0 + clib_warning ("unimplemented"); +#else + vlib_main_t *vm __attribute__((unused)) = vlib_get_main(); vl_api_ipsec_spd_add_del_reply_t * rmp; int rv; @@ -4520,6 +4532,7 @@ static void vl_api_ipsec_spd_add_del_t_handler #endif REPLY_MACRO(VL_API_IPSEC_SPD_ADD_DEL_REPLY); +#endif } static void vl_api_ipsec_interface_add_del_spd_t_handler @@ -4536,7 +4549,7 @@ static void vl_api_ipsec_interface_add_del_spd_t_handler VALIDATE_SW_IF_INDEX(mp); -#if DPDK > 0 +#if IPSEC > 0 rv = ipsec_set_interface_spd(vm, sw_if_index, spd_id, mp->is_add); #else rv = VNET_API_ERROR_UNIMPLEMENTED; @@ -4554,7 +4567,7 @@ static void vl_api_ipsec_spd_add_del_entry_t_handler vl_api_ipsec_spd_add_del_entry_reply_t * rmp; int rv; -#if DPDK > 0 +#if IPSEC > 0 ipsec_policy_t p; p.id = ntohl(mp->spd_id); @@ -4604,7 +4617,7 @@ static void vl_api_ipsec_sad_add_del_entry_t_handler vlib_main_t *vm __attribute__((unused)) = vlib_get_main(); vl_api_ipsec_sad_add_del_entry_reply_t * rmp; int rv; -#if DPDK > 0 +#if IPSEC > 0 ipsec_sa_t sa; sa.id = ntohl(mp->sad_id); @@ -4830,7 +4843,7 @@ static void vl_api_ipsec_sa_set_key_t_handler vlib_main_t *vm __attribute__((unused)) = vlib_get_main(); vl_api_ipsec_sa_set_key_reply_t *rmp; int rv; -#if DPDK > 0 +#if IPSEC > 0 ipsec_sa_t sa; sa.id = ntohl(mp->sa_id); sa.crypto_key_len = mp->crypto_key_length; diff --git a/vpp/api/test_client.c b/vpp/api/test_client.c index b635f04f..cfb133c7 100644 --- a/vpp/api/test_client.c +++ b/vpp/api/test_client.c @@ -42,7 +42,6 @@ #include #include -#include #include #include #include diff --git a/vpp/configure.ac b/vpp/configure.ac index 8c7beb4d..f2756a30 100644 --- a/vpp/configure.ac +++ b/vpp/configure.ac @@ -7,27 +7,36 @@ AM_PROG_AS AC_PROG_CC AM_PROG_CC_C_O -AC_ARG_WITH(q-plugin-prefix, - AC_HELP_STRING([--with-q-plugin-prefix],[vlib plugin prefix]), - [case $with_q_plugin_prefix in - *) ;; - esac]) - -AC_ARG_WITH(q-platform, - AC_HELP_STRING([--with-q-platform],[Build version for given platform (qnative)]), - [case $with_q_platform in - qnative) ;; - *) with_q_platform=qnative;; - esac]) - AC_ARG_WITH(dpdk, AC_HELP_STRING([--with-dpdk],[Use the Intel dpdk]), [with_dpdk=1], [with_dpdk=0]) +AC_ARG_WITH(ipsec, + AC_HELP_STRING([--without-ipsec],[Disable ipsec]), + [with_ipsec=0], + [with_ipsec=1]) + +AC_ARG_WITH(vcgn, + AC_HELP_STRING([--without-vcgn],[Disable vcgn]), + [with_vcgn=0], + [with_vcgn=1]) + +AC_ARG_WITH(ipv6sr, + AC_HELP_STRING([--without-ipv6sr],[Disable ipv6sr]), + [with_ipv6sr=0], + [with_ipv6sr=1]) + AM_CONDITIONAL(WITH_DPDK, test "$with_dpdk" = "1") -AC_SUBST(Q_PLATFORM_DEFINE,[-DQ_PLATFORM_${with_q_platform}]) -AC_SUBST(Q_PLATFORM_PLUGPATH,[-DQ_PLUGIN_PREFIX=${with_q_plugin_prefix}]) AC_SUBST(DPDK,[-DDPDK=${with_dpdk}]) +AM_CONDITIONAL(WITH_IPSEC, test "$with_ipsec" = "1") +AC_SUBST(IPSEC,[-DIPSEC=${with_ipsec}]) + +AM_CONDITIONAL(WITH_VCGN, test "$with_vcgn" = "1") +AC_SUBST(VCGN,[-DVCGN=${with_vcgn}]) + +AM_CONDITIONAL(WITH_IPV6SR, test "$with_ipv6sr" = "1") +AC_SUBST(IPV6SR,[-DIPV6SR=${with_ipv6sr}]) + AC_OUTPUT([Makefile]) diff --git a/vpp/vnet/main.c b/vpp/vnet/main.c index d60b489e..1dffa7c2 100644 --- a/vpp/vnet/main.c +++ b/vpp/vnet/main.c @@ -52,8 +52,6 @@ vpe_main_init (vlib_main_t * vm) return error; if ((error = vlib_call_init_function (vm, ethernet_arp_init))) return error; - if ((error = vlib_call_init_function (vm, sr_init))) - return error; if ((error = vlib_call_init_function (vm, map_init))) return error; if ((error = vlib_call_init_function (vm, sixrd_init))) @@ -72,8 +70,10 @@ vpe_main_init (vlib_main_t * vm) return error; if ((error = vlib_call_init_function (vm, vhost_user_init))) return error; +#if IPSEC > 0 if ((error = vlib_call_init_function (vm, ipsec_init))) return error; +#endif /* IPSEC */ #endif if ((error = vlib_call_init_function (vm, vlibmemory_init))) return error; @@ -102,16 +102,20 @@ vpe_main_init (vlib_main_t * vm) return error; if ((error = vlib_call_init_function (vm, tuntap_init))) return error; +#if IPV6SR > 0 if ((error = vlib_call_init_function (vm, sr_init))) return error; +#endif if ((error = vlib_call_init_function (vm, l2_classify_init))) return error; if ((error = vlib_call_init_function (vm, policer_init))) return error; if ((error = vlib_call_init_function (vm, vxlan_init))) return error; +#if VCGN > 0 if ((error = vlib_call_init_function (vm, vcgn_init))) return error; +#endif if ((error = vlib_call_init_function (vm, li_init))) return error; @@ -339,6 +343,39 @@ u32 vlib_app_num_thread_stacks_needed (void) return 1; } +/* + * Depending on the configuration selected above, + * it may be necessary to generate stub graph nodes. + * It is never OK to ignore "node 'x' refers to unknown node 'y' + * messages! + */ + +#if IPV6SR == 0 +#define foreach_ipv6_sr_stub_node \ +_(ipsec-output, ipsec_output) +#else +#define foreach_ipv6_sr_stub_node +#endif + +#define _(n,m) \ +static uword \ +m##_node_fn (vlib_main_t *vm, \ + vlib_node_runtime_t *node, \ + vlib_frame_t *frame) \ +{ \ + clib_warning("unimplemented, leaking buffers..."); \ + return 0; \ +} \ + \ +VLIB_REGISTER_NODE(m##_node) = { \ + .function = m##_node_fn, \ + .name = #n, \ + .vector_size = sizeof(u32), \ + .type = VLIB_NODE_TYPE_INTERNAL, \ +}; +foreach_ipv6_sr_stub_node; +#undef _ + #if CLIB_DEBUG > 0 static clib_error_t * diff --git a/vppinfra/vppinfra/bihash_24_8.h b/vppinfra/vppinfra/bihash_24_8.h index c789c980..c0dff8cc 100644 --- a/vppinfra/vppinfra/bihash_24_8.h +++ b/vppinfra/vppinfra/bihash_24_8.h @@ -50,14 +50,6 @@ crc_u32(u32 data, u32 value) static inline u64 clib_bihash_hash_24_8 (clib_bihash_kv_24_8_t *v) { -#if 0 - u64 * dp = (u64 *) &v->key[0]; - u64 value = 0; - - value __builtin_ia32_crc32di (dp[0], value); - value __builtin_ia32_crc32di (dp[1], value); - value __builtin_ia32_crc32di (dp[2], value); -#endif u32 * dp = (u32 *) &v->key[0]; u32 value = 0; @@ -70,8 +62,7 @@ static inline u64 clib_bihash_hash_24_8 (clib_bihash_kv_24_8_t *v) return value; } - -#else +#else static inline u64 clib_bihash_hash_24_8 (clib_bihash_kv_24_8_t *v) { u64 tmp = v->key[0] ^ v->key[1] ^ v->key[2]; diff --git a/vppinfra/vppinfra/byte_order.h b/vppinfra/vppinfra/byte_order.h index 9c556327..4f385f15 100644 --- a/vppinfra/vppinfra/byte_order.h +++ b/vppinfra/vppinfra/byte_order.h @@ -40,7 +40,7 @@ #include -#if defined(__x86_64__) || defined(i386) +#if defined(__x86_64__) || defined(i386) || defined(__aarch64__) #define CLIB_ARCH_IS_BIG_ENDIAN (0) #define CLIB_ARCH_IS_LITTLE_ENDIAN (1) #else diff --git a/vppinfra/vppinfra/longjmp.S b/vppinfra/vppinfra/longjmp.S index ac138a96..9ba237d4 100644 --- a/vppinfra/vppinfra/longjmp.S +++ b/vppinfra/vppinfra/longjmp.S @@ -580,6 +580,109 @@ clib_longjmp: clib_calljmp: 1: B .S1 1b +#elif defined (__aarch64__) +/* + Copyright (c) 2011, 2012 ARM Ltd + All rights reserved. + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. 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. + 3. The name of the company may not be used to endorse or promote + products derived from this software without specific prior written + permission. + THIS SOFTWARE IS PROVIDED BY ARM LTD ``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 ARM LTD 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. + */ +#define GPR_LAYOUT \ + REG_PAIR (x19, x20, 0); \ + REG_PAIR (x21, x22, 16); \ + REG_PAIR (x23, x24, 32); \ + REG_PAIR (x25, x26, 48); \ + REG_PAIR (x27, x28, 64); \ + REG_PAIR (x29, x30, 80); \ + REG_ONE (x16, 96) +#define FPR_LAYOUT \ + REG_PAIR ( d8, d9, 112); \ + REG_PAIR (d10, d11, 128); \ + REG_PAIR (d12, d13, 144); \ + REG_PAIR (d14, d15, 160); +// int clib_setjmp (jmp_buf) + .global clib_setjmp + .type clib_setjmp, %function +clib_setjmp: + mov x16, sp +#define REG_PAIR(REG1, REG2, OFFS) stp REG1, REG2, [x0, OFFS] +#define REG_ONE(REG1, OFFS) str REG1, [x0, OFFS] + GPR_LAYOUT + FPR_LAYOUT +#undef REG_PAIR +#undef REG_ONE + mov x0, x1 + ret + .size clib_setjmp, .-clib_setjmp +// void clib_longjmp (jmp_buf, int) __attribute__ ((noreturn)) + .global clib_longjmp + .type clib_longjmp, %function +clib_longjmp: +#define REG_PAIR(REG1, REG2, OFFS) ldp REG1, REG2, [x0, OFFS] +#define REG_ONE(REG1, OFFS) ldr REG1, [x0, OFFS] + GPR_LAYOUT + FPR_LAYOUT +#undef REG_PAIR +#undef REG_ONE + mov sp, x16 + mov x0, x1 + // cmp w1, #0 + // cinc w0, w1, eq + // use br not ret, as ret is guaranteed to mispredict + br x30 + .size clib_longjmp, .-clib_longjmp + + +// void clib_calljmp (x0=function, x1=arg, x2=new_stack) + .global clib_calljmp + .type clib_calljmp, %function +clib_calljmp: + // save fn ptr + mov x3, x0 + // set up fn arg + mov x0, x1 + // switch stacks + mov x4, sp + + // space for saved sp, lr on new stack + sub x2, x2, #16 + mov sp, x2 + + // save old sp and link register on new stack + str x4, [sp] + str x30,[sp,#8] + mov x4, sp + + // go there + blr x3 + + // restore old sp and link register + mov x4, sp + + ldr x3, [x4] + ldr x30,[x4, #8] + mov sp, x3 + ret + .size clib_calljmp, .-clib_calljmp #else #error "unknown machine" #endif diff --git a/vppinfra/vppinfra/longjmp.h b/vppinfra/vppinfra/longjmp.h index a28b20cd..7252aa3c 100644 --- a/vppinfra/vppinfra/longjmp.h +++ b/vppinfra/vppinfra/longjmp.h @@ -91,6 +91,8 @@ /* setjmp/longjmp not supported for the moment. */ #define CLIB_ARCH_LONGJMP_REGS 0 +#elif defined(__aarch64__) +#define CLIB_ARCH_LONGJMP_REGS (22) #else #error "unknown machine" #endif diff --git a/vppinfra/vppinfra/test_longjmp.c b/vppinfra/vppinfra/test_longjmp.c index 40b14408..299de258 100644 --- a/vppinfra/vppinfra/test_longjmp.c +++ b/vppinfra/vppinfra/test_longjmp.c @@ -92,7 +92,7 @@ static uword f3 (uword arg) static void test_calljmp (unformat_input_t * input) { - static u8 stack[32*1024]; + static u8 stack[32*1024] __attribute__((aligned(16))); uword v; v = clib_calljmp (f3, 0, stack + sizeof (stack)); diff --git a/vppinfra/vppinfra/time.c b/vppinfra/vppinfra/time.c index 0da469eb..9af599ac 100644 --- a/vppinfra/vppinfra/time.c +++ b/vppinfra/vppinfra/time.c @@ -78,6 +78,11 @@ static f64 clock_frequency_from_proc_filesystem (void) int fd; unformat_input_t input; +/* $$$$ aarch64 kernel doesn't report "cpu MHz" */ +#if defined(__aarch64__) + return 0.0; +#endif + cpu_freq = 0; fd = open ("/proc/cpuinfo", 0); if (fd < 0) diff --git a/vppinfra/vppinfra/time.h b/vppinfra/vppinfra/time.h index 524eff6c..3c481082 100644 --- a/vppinfra/vppinfra/time.h +++ b/vppinfra/vppinfra/time.h @@ -143,8 +143,18 @@ always_inline u64 clib_cpu_time_now (void) return ((u64)h << 32) | l; } -#else +#elif defined (__aarch64__) +always_inline u64 clib_cpu_time_now (void) +{ + u64 tsc; + + /* Works on Cavium ThunderX. Other platforms: YMMV */ + asm volatile("mrs %0, cntvct_el0" : "=r" (tsc)); + return tsc; +} + +#else #error "don't know how to read CPU time stamp" #endif diff --git a/vppinfra/vppinfra/types.h b/vppinfra/vppinfra/types.h index d43e9613..d5ad6ba1 100644 --- a/vppinfra/vppinfra/types.h +++ b/vppinfra/vppinfra/types.h @@ -77,7 +77,7 @@ typedef unsigned long long u64; #define log2_uword_bits 6 #define clib_address_bits _MIPS_SZPTR -#elif defined(alpha) || defined(__x86_64__) || defined (__powerpc64__) +#elif defined(alpha) || defined(__x86_64__) || defined (__powerpc64__) || defined (__aarch64__) typedef int i32; typedef long i64; diff --git a/vppinfra/vppinfra/vector.h b/vppinfra/vppinfra/vector.h index b3019333..84c52a28 100644 --- a/vppinfra/vppinfra/vector.h +++ b/vppinfra/vppinfra/vector.h @@ -61,6 +61,10 @@ #define _vector_size(n) __attribute__ ((vector_size (n))) +#if defined (__aarch64__) +typedef unsigned int u32x4 _vector_size (16); +#endif + #ifdef CLIB_HAVE_VEC64 /* Signed 64 bit. */ typedef char i8x8 _vector_size (8); -- cgit 1.2.3-korg From 1d49c98f7f8f97fff0d638e439af2246f34fc2b9 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Fri, 25 Mar 2016 21:20:03 +0100 Subject: vpp-api-test and sample-plugin should depend on dpdk conditionally Change-Id: Ie26340141fdbd3256e305ab37f4baa817081bf46 Signed-off-by: Damjan Marion --- build-data/packages/sample-plugin.mk | 13 +++++++------ build-data/packages/vpp-api-test.mk | 12 ++++++------ 2 files changed, 13 insertions(+), 12 deletions(-) (limited to 'build-data/packages/sample-plugin.mk') diff --git a/build-data/packages/sample-plugin.mk b/build-data/packages/sample-plugin.mk index e9f2789a..58d46325 100644 --- a/build-data/packages/sample-plugin.mk +++ b/build-data/packages/sample-plugin.mk @@ -1,6 +1,5 @@ sample-plugin_configure_depend = \ vppinfra-install \ - dpdk-install \ svm-install \ vlib-api-install \ vlib-install \ @@ -8,12 +7,8 @@ sample-plugin_configure_depend = \ vpp-install \ vpp-api-test-install -# -sample-plugin_configure_args = --with-dpdk - sample-plugin_CPPFLAGS = $(call installed_includes_fn, \ vppinfra \ - dpdk \ openssl \ svm \ vlib \ @@ -24,7 +19,6 @@ sample-plugin_CPPFLAGS = $(call installed_includes_fn, \ sample-plugin_LDFLAGS = $(call installed_libs_fn, \ vppinfra \ - dpdk \ openssl \ svm \ vlib \ @@ -39,3 +33,10 @@ sample-plugin_post_install = \ $(PACKAGE_INSTALL_DIR)/$(arch_lib_dir)/vlib_plugins sample-plugin_image_include = echo $(arch_lib_dir)/vlib_plugins + +ifneq ($($(PLATFORM)_uses_dpdk),no) +sample-plugin_configure_args = --with-dpdk +sample-plugin_configure_depend += dpdk-install +sample-plugin_CPPFLAGS += $(call installed_includes_fn, dpdk) +sample-plugin_LDFLAGS += $(call installed_libs_fn, dpdk) +endif diff --git a/build-data/packages/vpp-api-test.mk b/build-data/packages/vpp-api-test.mk index 6ad70bc5..e26c2e76 100644 --- a/build-data/packages/vpp-api-test.mk +++ b/build-data/packages/vpp-api-test.mk @@ -1,18 +1,13 @@ vpp-api-test_configure_depend = \ vppinfra-install \ - dpdk-install \ svm-install \ vlib-api-install \ vlib-install \ vnet-install \ vpp-install -# -vpp-api-test_configure_args = --with-dpdk - vpp-api-test_CPPFLAGS = $(call installed_includes_fn, \ vppinfra \ - dpdk \ svm \ vlib \ vlib-api \ @@ -21,10 +16,15 @@ vpp-api-test_CPPFLAGS = $(call installed_includes_fn, \ vpp-api-test_LDFLAGS = $(call installed_libs_fn, \ vppinfra \ - dpdk \ svm \ vlib \ vlib-api \ vnet \ vpp) +ifneq ($($(PLATFORM)_uses_dpdk),no) +vpp-api-test_configure_args = --with-dpdk +vpp-api-test_configure_depend += dpdk-install +vpp-api-test_CPPFLAGS += $(call installed_includes_fn, dpdk) +vpp-api-test_LDFLAGS += $(call installed_libs_fn, dpdk) +endif -- cgit 1.2.3-korg From 28e3db9dd617324a3196f369788d62cc72b5903b Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Fri, 1 Apr 2016 12:35:17 +0200 Subject: Add options to link with external DPDK tree By uncommenting following lines in the build-data/platforms/vpp.mk VPP links nicely with packaged DPDK 2.2 distributed with Ubuntu 16.04 LTS. vpp_uses_external_dpdk = yes vpp_dpdk_inc_dir = /usr/include/dpdk vpp_dpdk_lib_dir = /usr/lib vpp_dpdk_shared_lib = yes Change-Id: Id5b7d95bac6aa60341933b92e86d949a9abf1a5d Signed-off-by: Damjan Marion --- build-data/packages/sample-plugin.mk | 5 +++++ build-data/packages/vlib.mk | 7 ++++++- build-data/packages/vnet.mk | 5 +++++ build-data/packages/vpp-api-test.mk | 5 +++++ build-data/packages/vpp.mk | 11 ++++++++++- build-data/platforms/vpp.mk | 7 ++++++- 6 files changed, 37 insertions(+), 3 deletions(-) (limited to 'build-data/packages/sample-plugin.mk') diff --git a/build-data/packages/sample-plugin.mk b/build-data/packages/sample-plugin.mk index 58d46325..047a26f5 100644 --- a/build-data/packages/sample-plugin.mk +++ b/build-data/packages/sample-plugin.mk @@ -36,7 +36,12 @@ sample-plugin_image_include = echo $(arch_lib_dir)/vlib_plugins ifneq ($($(PLATFORM)_uses_dpdk),no) sample-plugin_configure_args = --with-dpdk +ifeq ($($(PLATFORM)_uses_external_dpdk),yes) +sample-plugin_CPPFLAGS += -I$($(PLATFORM)_dpdk_inc_dir) +sample-plugin_LDFLAGS += -L$($(PLATFORM)_dpdk_lib_dir) +else sample-plugin_configure_depend += dpdk-install sample-plugin_CPPFLAGS += $(call installed_includes_fn, dpdk) sample-plugin_LDFLAGS += $(call installed_libs_fn, dpdk) endif +endif diff --git a/build-data/packages/vlib.mk b/build-data/packages/vlib.mk index 9c361282..2172708d 100644 --- a/build-data/packages/vlib.mk +++ b/build-data/packages/vlib.mk @@ -4,8 +4,13 @@ vlib_CPPFLAGS = $(call installed_includes_fn, vppinfra) vlib_LDFLAGS = $(call installed_libs_fn, vppinfra) ifneq ($($(PLATFORM)_uses_dpdk),no) -vlib_configure_depend += dpdk-install vlib_configure_args += --with-dpdk +ifeq ($($(PLATFORM)_uses_external_dpdk),yes) +vlib_CPPFLAGS += -I$($(PLATFORM)_dpdk_inc_dir) +vlib_LDFLAGS += -L$($(PLATFORM)_dpdk_lib_dir) +else +vlib_configure_depend += dpdk-install vlib_CPPFLAGS += $(call installed_includes_fn, dpdk) vlib_LDFLAGS += $(call installed_libs_fn, dpdk) endif +endif diff --git a/build-data/packages/vnet.mk b/build-data/packages/vnet.mk index 0486b4e8..2ff9034a 100644 --- a/build-data/packages/vnet.mk +++ b/build-data/packages/vnet.mk @@ -22,7 +22,12 @@ vnet_LDFLAGS = $(call installed_libs_fn, \ vnet_configure_args += $(vnet_configure_args_$(PLATFORM)) ifneq ($($(PLATFORM)_uses_dpdk),no) +ifeq ($($(PLATFORM)_uses_external_dpdk),yes) +vnet_CPPFLAGS += -I$($(PLATFORM)_dpdk_inc_dir) +vnet_LDFLAGS += -L$($(PLATFORM)_dpdk_lib_dir) +else vnet_configure_depend += dpdk-install vnet_CPPFLAGS += $(call installed_includes_fn, dpdk) vnet_LDFLAGS += $(call installed_libs_fn, dpdk) endif +endif diff --git a/build-data/packages/vpp-api-test.mk b/build-data/packages/vpp-api-test.mk index e26c2e76..38edb5bc 100644 --- a/build-data/packages/vpp-api-test.mk +++ b/build-data/packages/vpp-api-test.mk @@ -24,7 +24,12 @@ vpp-api-test_LDFLAGS = $(call installed_libs_fn, \ ifneq ($($(PLATFORM)_uses_dpdk),no) vpp-api-test_configure_args = --with-dpdk +ifeq ($($(PLATFORM)_uses_external_dpdk),yes) +vpp-api-test_CPPFLAGS += -I$($(PLATFORM)_dpdk_inc_dir) +vpp-api-test_LDFLAGS += -L$($(PLATFORM)_dpdk_lib_dir) +else vpp-api-test_configure_depend += dpdk-install vpp-api-test_CPPFLAGS += $(call installed_includes_fn, dpdk) vpp-api-test_LDFLAGS += $(call installed_libs_fn, dpdk) endif +endif diff --git a/build-data/packages/vpp.mk b/build-data/packages/vpp.mk index 9ccf6901..f96235f4 100644 --- a/build-data/packages/vpp.mk +++ b/build-data/packages/vpp.mk @@ -6,7 +6,11 @@ vpp_configure_depend = \ vnet-install \ # -vpp_configure_args = +ifeq ($($(PLATFORM)_dpdk_shared_lib),yes) +vpp_configure_args = --enable-dpdk-shared +else +vpp_configure_args = +endif # Platform dependent configure flags vpp_configure_args += $(vpp_configure_args_$(PLATFORM)) @@ -29,7 +33,12 @@ vpp_LDFLAGS = $(call installed_libs_fn, \ vnet) ifneq ($($(PLATFORM)_uses_dpdk),no) +ifeq ($($(PLATFORM)_uses_external_dpdk),yes) +vpp_CPPFLAGS += -I$($(PLATFORM)_dpdk_inc_dir) +vpp_LDFLAGS += -L$($(PLATFORM)_dpdk_lib_dir) +else vpp_configure_depend += dpdk-install vpp_CPPFLAGS += $(call installed_includes_fn, dpdk) vpp_LDFLAGS += $(call installed_libs_fn, dpdk) endif +endif diff --git a/build-data/platforms/vpp.mk b/build-data/platforms/vpp.mk index 50c85dcc..9b4a78c8 100644 --- a/build-data/platforms/vpp.mk +++ b/build-data/platforms/vpp.mk @@ -17,7 +17,7 @@ vpp_native_tools = vppapigen vpp_uses_dpdk = yes -vpp_root_packages = vpp vlib vlib-api vnet svm dpdk vpp-api-test \ +vpp_root_packages = vpp vlib vlib-api vnet svm vpp-api-test \ vpp-japi gmod vpp_configure_args_vpp = --with-dpdk @@ -26,6 +26,11 @@ vnet_configure_args_vpp = --with-dpdk # Set these parameters carefully. The vlib_buffer_t is 128 bytes, i.e. vlib_configure_args_vpp = --with-pre-data=128 +# DPDK configuration parameters +# vpp_uses_external_dpdk = yes +# vpp_dpdk_inc_dir = /usr/include/dpdk +# vpp_dpdk_lib_dir = /usr/lib +# vpp_dpdk_shared_lib = yes vpp_debug_TAG_CFLAGS = -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -march=$(MARCH) \ -fstack-protector-all -fPIC -Werror -- cgit 1.2.3-korg From 3535222f979742d65c28a312d415aa6831f816d6 Mon Sep 17 00:00:00 2001 From: Pierre Pfister Date: Fri, 27 May 2016 10:30:13 +0100 Subject: VPP-94: Add build-data directory for plugins and Makefile target Commit e36af5f3153 moved sample-plugin a dedicated directory. The build system could not find sources for sample-plugin-* targets. This commit adds a dedicated build-data/packages directory for plugins and moves sample-plugin.mk there. Change-Id: I9e3ee8858580e86ff6d4f7317300df0a5e239a01 Signed-off-by: Pierre Pfister --- Makefile | 8 ++++- build-data/packages/sample-plugin.mk | 47 ---------------------------- build-root/bootstrap.sh | 2 +- plugins/build-data/packages/sample-plugin.mk | 47 ++++++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 49 deletions(-) delete mode 100644 build-data/packages/sample-plugin.mk create mode 100644 plugins/build-data/packages/sample-plugin.mk (limited to 'build-data/packages/sample-plugin.mk') diff --git a/Makefile b/Makefile index 2dd38fdd..d3088d24 100644 --- a/Makefile +++ b/Makefile @@ -106,7 +106,7 @@ ifeq ($(OS_ID),ubuntu) fi ; \ exit 0 endif - @echo "SOURCE_PATH = $(WS_ROOT)" > $(BR)/build-config.mk + @echo "SOURCE_PATH = $(WS_ROOT) $(WS_ROOT)/plugins"> $(BR)/build-config.mk @echo "#!/bin/bash\n" > $(BR)/path_setup @echo 'export PATH=$(BR)/tools/ccache-bin:$$PATH' >> $(BR)/path_setup @echo 'export PATH=$(BR)/tools/bin:$$PATH' >> $(BR)/path_setup @@ -162,6 +162,12 @@ wipe-release: $(BR)/.bootstrap.ok rebuild-release: wipe-release build-release +plugins: $(BR)/.bootstrap.ok + $(call make,$(PLATFORM)_debug,sample-plugin-install) + +plugins-release: $(BR)/.bootstrap.ok + $(call make,$(PLATFORM),sample-plugin-install) + STARTUP_DIR ?= $(PWD) ifeq ("$(wildcard $(STARTUP_CONF))","") define run diff --git a/build-data/packages/sample-plugin.mk b/build-data/packages/sample-plugin.mk deleted file mode 100644 index 047a26f5..00000000 --- a/build-data/packages/sample-plugin.mk +++ /dev/null @@ -1,47 +0,0 @@ -sample-plugin_configure_depend = \ - vppinfra-install \ - svm-install \ - vlib-api-install \ - vlib-install \ - vnet-install \ - vpp-install \ - vpp-api-test-install - -sample-plugin_CPPFLAGS = $(call installed_includes_fn, \ - vppinfra \ - openssl \ - svm \ - vlib \ - vlib-api \ - vnet \ - vpp \ - vpp-api-test) - -sample-plugin_LDFLAGS = $(call installed_libs_fn, \ - vppinfra \ - openssl \ - svm \ - vlib \ - vlib-api \ - vnet \ - vpp \ - vpp-api-test) - -sample-plugin_post_install = \ - mkdir -p $(PACKAGE_INSTALL_DIR)/$(arch_lib_dir)/vlib_plugins ; \ - cp $(PACKAGE_INSTALL_DIR)/$(arch_lib_dir)/*.so \ - $(PACKAGE_INSTALL_DIR)/$(arch_lib_dir)/vlib_plugins - -sample-plugin_image_include = echo $(arch_lib_dir)/vlib_plugins - -ifneq ($($(PLATFORM)_uses_dpdk),no) -sample-plugin_configure_args = --with-dpdk -ifeq ($($(PLATFORM)_uses_external_dpdk),yes) -sample-plugin_CPPFLAGS += -I$($(PLATFORM)_dpdk_inc_dir) -sample-plugin_LDFLAGS += -L$($(PLATFORM)_dpdk_lib_dir) -else -sample-plugin_configure_depend += dpdk-install -sample-plugin_CPPFLAGS += $(call installed_includes_fn, dpdk) -sample-plugin_LDFLAGS += $(call installed_libs_fn, dpdk) -endif -endif diff --git a/build-root/bootstrap.sh b/build-root/bootstrap.sh index f83734fd..2419b6ae 100755 --- a/build-root/bootstrap.sh +++ b/build-root/bootstrap.sh @@ -12,7 +12,7 @@ ADD_TO_PATH="$build_root/tools/ccache-bin:$build_root/tools/bin" # Construct build-config.mk cd $build_root -echo SOURCE_PATH = $wsroot > build-config.mk +echo SOURCE_PATH = $wsroot $wsroot/plugins/ > build-config.mk echo echo Saving PATH settings in `pwd`/path_setup echo Source this file later, as needed diff --git a/plugins/build-data/packages/sample-plugin.mk b/plugins/build-data/packages/sample-plugin.mk new file mode 100644 index 00000000..047a26f5 --- /dev/null +++ b/plugins/build-data/packages/sample-plugin.mk @@ -0,0 +1,47 @@ +sample-plugin_configure_depend = \ + vppinfra-install \ + svm-install \ + vlib-api-install \ + vlib-install \ + vnet-install \ + vpp-install \ + vpp-api-test-install + +sample-plugin_CPPFLAGS = $(call installed_includes_fn, \ + vppinfra \ + openssl \ + svm \ + vlib \ + vlib-api \ + vnet \ + vpp \ + vpp-api-test) + +sample-plugin_LDFLAGS = $(call installed_libs_fn, \ + vppinfra \ + openssl \ + svm \ + vlib \ + vlib-api \ + vnet \ + vpp \ + vpp-api-test) + +sample-plugin_post_install = \ + mkdir -p $(PACKAGE_INSTALL_DIR)/$(arch_lib_dir)/vlib_plugins ; \ + cp $(PACKAGE_INSTALL_DIR)/$(arch_lib_dir)/*.so \ + $(PACKAGE_INSTALL_DIR)/$(arch_lib_dir)/vlib_plugins + +sample-plugin_image_include = echo $(arch_lib_dir)/vlib_plugins + +ifneq ($($(PLATFORM)_uses_dpdk),no) +sample-plugin_configure_args = --with-dpdk +ifeq ($($(PLATFORM)_uses_external_dpdk),yes) +sample-plugin_CPPFLAGS += -I$($(PLATFORM)_dpdk_inc_dir) +sample-plugin_LDFLAGS += -L$($(PLATFORM)_dpdk_lib_dir) +else +sample-plugin_configure_depend += dpdk-install +sample-plugin_CPPFLAGS += $(call installed_includes_fn, dpdk) +sample-plugin_LDFLAGS += $(call installed_libs_fn, dpdk) +endif +endif -- cgit 1.2.3-korg From 686c1c8454803e48d45428a720f129f24dc981f7 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Wed, 19 Apr 2017 14:09:07 +0200 Subject: Extend ebuild to specify "configure" subdir, enable verify for sample-plugin Change-Id: I2056e5d19bc3713e7a13e015dabf3b2431800973 Signed-off-by: Damjan Marion --- Makefile | 2 ++ build-data/packages/sample-plugin.mk | 5 +++++ build-root/Makefile | 6 ++++-- src/examples/sample-plugin/sample/sample_test.c | 2 -- 4 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 build-data/packages/sample-plugin.mk (limited to 'build-data/packages/sample-plugin.mk') diff --git a/Makefile b/Makefile index 44ae20e4..f9a90d49 100644 --- a/Makefile +++ b/Makefile @@ -423,6 +423,8 @@ ifeq ($(OS_ID)-$(OS_VERSION_ID),ubuntu-16.04) $(call banner,"Building for PLATFORM=vpp using clang") @make -C build-root CC=clang PLATFORM=vpp TAG=vpp_clang wipe-all install-packages endif + $(call banner,"Building sample-plugin") + @make -C build-root PLATFORM=vpp TAG=vpp sample-plugin-install $(call banner,"Building $(PKG) packages") @make pkg-$(PKG) @make test diff --git a/build-data/packages/sample-plugin.mk b/build-data/packages/sample-plugin.mk new file mode 100644 index 00000000..fd1ee321 --- /dev/null +++ b/build-data/packages/sample-plugin.mk @@ -0,0 +1,5 @@ +sample-plugin_source = src +sample-plugin_configure_subdir = examples/sample-plugin +sample-plugin_configure_depend = vpp-install +sample-plugin_CPPFLAGS = $(call installed_includes_fn, vpp) +sample-plugin_LDFLAGS = $(call installed_libs_fn, vpp) diff --git a/build-root/Makefile b/build-root/Makefile index 8b83990e..f2f77804 100644 --- a/build-root/Makefile +++ b/build-root/Makefile @@ -579,7 +579,7 @@ image_extra_dependencies = $($(PLATFORM)_image_extra_dependencies) ### dbarach configure_package_gnu = \ - s=$(call find_source_fn,$(PACKAGE_SOURCE)) ; \ + s=$(call find_source_fn,$(PACKAGE_SOURCE))$(PACKAGE_SUBDIR) ; \ if [ ! -f $$s/configure ] ; then \ autoreconf -i -f $$s ; \ fi ; \ @@ -635,7 +635,8 @@ configure_check_timestamp = \ mkdir -p $(PACKAGE_INSTALL_DIR) ; \ conf="$(TIMESTAMP_DIR)/$(CONFIGURE_TIMESTAMP)" ; \ dirs="$(call package_mk_fn,$(PACKAGE)) \ - $(wildcard $(call find_source_fn,$(PACKAGE_SOURCE))/configure) \ + $(wildcard $(call find_source_fn, \ + $(PACKAGE_SOURCE))$(PACKAGE_SUBDIR)/configure) \ $(MU_BUILD_ROOT_DIR)/config.site" ; \ if [[ $(call find_newer_fn, $${conf}, $${dirs}, $?) ]]; then \ $(configure_package) ; \ @@ -747,6 +748,7 @@ GIT = git # Multiple packages may use a single source tree. # For example, gcc-bootstrap package shares gcc source. PACKAGE_SOURCE = $(if $($(PACKAGE)_source),$($(PACKAGE)_source),$(PACKAGE)) +PACKAGE_SUBDIR = $(if $($(PACKAGE)_configure_subdir),/$($(PACKAGE)_configure_subdir),) # Use git to download source if directory is not found find_source_for_package = \ diff --git a/src/examples/sample-plugin/sample/sample_test.c b/src/examples/sample-plugin/sample/sample_test.c index b3e71c76..2298675b 100644 --- a/src/examples/sample-plugin/sample/sample_test.c +++ b/src/examples/sample-plugin/sample/sample_test.c @@ -92,9 +92,7 @@ _(SAMPLE_MACSWAP_ENABLE_DISABLE_REPLY, sample_macswap_enable_disable_reply) static int api_sample_macswap_enable_disable (vat_main_t * vam) { - sample_test_main_t * sm = &sample_test_main; unformat_input_t * i = vam->input; - f64 timeout; int enable_disable = 1; u32 sw_if_index = ~0; vl_api_sample_macswap_enable_disable_t * mp; -- cgit 1.2.3-korg