X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=acinclude.m4;h=435685c93d8f6a79e9f73ff6e6d2e28320785f87;hb=HEAD;hp=dabbffd01cf726eb5297d2a6081859ac1feff651;hpb=5519e384f6a17f564fef4c5eb39e471e16c77235;p=mirror_ovs.git diff --git a/acinclude.m4 b/acinclude.m4 index dabbffd01..435685c93 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -14,6 +14,22 @@ # See the License for the specific language governing permissions and # limitations under the License. +dnl Set OVS DPCLS Autovalidator as default subtable search at compile time? +dnl This enables automatically running all unit tests with all DPCLS +dnl implementations. +AC_DEFUN([OVS_CHECK_DPCLS_AUTOVALIDATOR], [ + AC_ARG_ENABLE([autovalidator], + [AC_HELP_STRING([--enable-autovalidator], [Enable DPCLS autovalidator as default subtable search implementation.])], + [autovalidator=yes],[autovalidator=no]) + AC_MSG_CHECKING([whether DPCLS Autovalidator is default implementation]) + if test "$autovalidator" != yes; then + AC_MSG_RESULT([no]) + else + OVS_CFLAGS="$OVS_CFLAGS -DDPCLS_AUTOVALIDATOR_DEFAULT" + AC_MSG_RESULT([yes]) + fi +]) + dnl OVS_ENABLE_WERROR AC_DEFUN([OVS_ENABLE_WERROR], [AC_ARG_ENABLE( @@ -61,6 +77,7 @@ AC_DEFUN([OVS_CHECK_LINUX], [ if test X"$with_linux" != X; then KBUILD=$with_linux + AC_MSG_WARN([--with-linux is deprecated and kernel support is limited to 5.8 and below]) elif test X"$with_l26" != X; then KBUILD=$with_l26 AC_MSG_WARN([--with-l26 is deprecated, please use --with-linux instead]) @@ -151,10 +168,10 @@ AC_DEFUN([OVS_CHECK_LINUX], [ AC_MSG_RESULT([$kversion]) if test "$version" -ge 5; then - if test "$version" = 5 && test "$patchlevel" -le 5; then + if test "$version" = 5 && test "$patchlevel" -le 8; then : # Linux 5.x else - AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version newer than 5.5.x is not supported (please refer to the FAQ for advice)]) + AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version newer than 5.8.x is not supported (please refer to the FAQ for advice)]) fi elif test "$version" = 4; then : # Linux 4.x @@ -250,6 +267,18 @@ AC_DEFUN([OVS_CHECK_LINUX_SCTP_CT], [ [Define to 1 if SCTP_CONNTRACK_HEARTBEAT_SENT is available.])]) ]) +dnl OVS_CHECK_LINUX_VIRTIO_TYPES +dnl +dnl Checks for kernels that need virtio_types definition. +AC_DEFUN([OVS_CHECK_LINUX_VIRTIO_TYPES], [ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([#include ], [ + __virtio16 x = 0; + ])], + [AC_DEFINE([HAVE_VIRTIO_TYPES], [1], + [Define to 1 if __virtio16 is available.])]) +]) + dnl OVS_FIND_DEPENDENCY(FUNCTION, SEARCH_LIBS, NAME_TO_PRINT) dnl dnl Check for a function in a library list. @@ -306,8 +335,9 @@ dnl dnl Configure DPDK source tree AC_DEFUN([OVS_CHECK_DPDK], [ AC_ARG_WITH([dpdk], - [AC_HELP_STRING([--with-dpdk=/path/to/dpdk], - [Specify the DPDK build directory])], + [AC_HELP_STRING([--with-dpdk=static|shared|yes], + [Specify "static" or "shared" depending on the + DPDK libraries to use])], [have_dpdk=true]) AC_MSG_CHECKING([whether dpdk is enabled]) @@ -317,35 +347,41 @@ AC_DEFUN([OVS_CHECK_DPDK], [ else AC_MSG_RESULT([yes]) case "$with_dpdk" in - yes) - DPDK_AUTO_DISCOVER="true" - PKG_CHECK_MODULES_STATIC([DPDK], [libdpdk], [ - DPDK_INCLUDE="$DPDK_CFLAGS" - DPDK_LIB="$DPDK_LIBS"], [ - DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk" - DPDK_LIB="-ldpdk"]) - ;; - *) - DPDK_AUTO_DISCOVER="false" - DPDK_INCLUDE_PATH="$with_dpdk/include" - # If 'with_dpdk' is passed install directory, point to headers - # installed in $DESTDIR/$prefix/include/dpdk - if test -e "$DPDK_INCLUDE_PATH/rte_config.h"; then - DPDK_INCLUDE="-I$DPDK_INCLUDE_PATH" - elif test -e "$DPDK_INCLUDE_PATH/dpdk/rte_config.h"; then - DPDK_INCLUDE="-I$DPDK_INCLUDE_PATH/dpdk" - fi - DPDK_LIB_DIR="$with_dpdk/lib" - DPDK_LIB="-ldpdk" - ;; + "shared") + PKG_CHECK_MODULES([DPDK], [libdpdk], [ + DPDK_INCLUDE="$DPDK_CFLAGS" + DPDK_LIB="$DPDK_LIBS"]) + ;; + "static" | "yes") + PKG_CHECK_MODULES_STATIC([DPDK], [libdpdk], [ + DPDK_INCLUDE="$DPDK_CFLAGS" + DPDK_LIB="$DPDK_LIBS"]) + + dnl Statically linked private DPDK objects of form + dnl -l:file.a must be positioned between + dnl --whole-archive ... --no-whole-archive linker parameters. + dnl Old pkg-config versions misplace --no-whole-archive parameter + dnl and put it next to --whole-archive. + AC_MSG_CHECKING([for faulty pkg-config version]) + echo "$DPDK_LIB" | grep -q 'whole-archive.*l:lib.*no-whole-archive' + status=$? + case $status in + 0) + AC_MSG_RESULT([no]) + ;; + 1) + AC_MSG_RESULT([yes]) + AC_MSG_ERROR([Please upgrade pkg-config]) + ;; + *) + AC_MSG_ERROR([grep exited with status $status]) + ;; + esac esac ovs_save_CFLAGS="$CFLAGS" ovs_save_LDFLAGS="$LDFLAGS" CFLAGS="$CFLAGS $DPDK_INCLUDE" - if test "$DPDK_AUTO_DISCOVER" = "false"; then - LDFLAGS="$LDFLAGS -L${DPDK_LIB_DIR}" - fi AC_CHECK_HEADERS([rte_config.h], [], [ AC_MSG_ERROR([unable to find rte_config.h in $with_dpdk]) @@ -368,7 +404,6 @@ AC_DEFUN([OVS_CHECK_DPDK], [ ], [], [[#include ]]) AC_CHECK_DECL([RTE_LIBRTE_MLX5_PMD], [dnl found - OVS_FIND_DEPENDENCY([mnl_attr_put], [mnl], [libmnl]) AC_CHECK_DECL([RTE_IBVERBS_LINK_DLOPEN], [], [dnl not found OVS_FIND_DEPENDENCY([mlx5dv_create_wq], [mlx5], [libmlx5]) OVS_FIND_DEPENDENCY([verbs_init_cq], [ibverbs], [libibverbs]) @@ -395,20 +430,24 @@ AC_DEFUN([OVS_CHECK_DPDK], [ [AC_MSG_RESULT([yes]) DPDKLIB_FOUND=true], [AC_MSG_RESULT([no]) - if test "$DPDK_AUTO_DISCOVER" = "true"; then - AC_MSG_ERROR(m4_normalize([ - Could not find DPDK library in default search path, Use --with-dpdk - to specify the DPDK library installed in non-standard location])) - else - AC_MSG_ERROR([Could not find DPDK libraries in $DPDK_LIB_DIR]) - fi + AC_MSG_ERROR(m4_normalize([ + Could not find DPDK library in default search path, update + PKG_CONFIG_PATH for pkg-config to find the .pc file in + non-standard location])) ]) CFLAGS="$ovs_save_CFLAGS" LDFLAGS="$ovs_save_LDFLAGS" - if test "$DPDK_AUTO_DISCOVER" = "false"; then - OVS_LDFLAGS="$OVS_LDFLAGS -L$DPDK_LIB_DIR" - fi + # Stripping out possible instruction set specific configuration that DPDK + # forces in pkg-config since this could override user-specified options. + # It's enough to have -mssse3 to build with DPDK headers. + DPDK_INCLUDE=$(echo "$DPDK_INCLUDE" | sed 's/-march=[[^ ]]*//g') + # Also stripping out '-mno-avx512f'. Support for AVX512 will be disabled + # if OVS will detect that it's broken. OVS could be built with a + # completely different toolchain that correctly supports AVX512, flags + # forced by DPDK only breaks our feature detection mechanism and leads to + # build failures: https://github.com/openvswitch/ovs-issues/issues/201 + DPDK_INCLUDE=$(echo "$DPDK_INCLUDE" | sed 's/-mno-avx512f//g') OVS_CFLAGS="$OVS_CFLAGS $DPDK_INCLUDE" OVS_ENABLE_OPTION([-mssse3]) @@ -417,17 +456,15 @@ AC_DEFUN([OVS_CHECK_DPDK], [ # This happens because the rest of the DPDK code doesn't use any symbol in # the pmd driver objects, and the drivers register themselves using an # __attribute__((constructor)) function. - # - # These options are specified inside a single -Wl directive to prevent - # autotools from reordering them. - # - # OTOH newer versions of dpdk pkg-config (generated with Meson) - # will already have flagged just the right set of libs with - # --whole-archive - in those cases do not wrap it once more. - case "$DPDK_LIB" in - *whole-archive*) DPDK_vswitchd_LDFLAGS=$DPDK_LIB;; - *) DPDK_vswitchd_LDFLAGS=-Wl,--whole-archive,$DPDK_LIB,--no-whole-archive - esac + # Wrap the DPDK libraries inside a single -Wl directive + # after comma separation to prevent autotools from reordering them. + DPDK_vswitchd_LDFLAGS=$(echo "$DPDK_LIB"| tr -s ' ' ',' | sed 's/-Wl,//g') + # Replace -pthread with -lpthread for LD and remove the last extra comma. + DPDK_vswitchd_LDFLAGS=$(echo "$DPDK_vswitchd_LDFLAGS"| sed 's/,$//' | \ + sed 's/-pthread/-lpthread/g') + # Prepend "-Wl,". + DPDK_vswitchd_LDFLAGS="-Wl,$DPDK_vswitchd_LDFLAGS" + AC_SUBST([DPDK_vswitchd_LDFLAGS]) AC_DEFINE([DPDK_NETDEV], [1], [System uses the DPDK module.]) fi @@ -587,6 +624,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ OVS_GREP_IFELSE([$KSRC/include/net/ip6_fib.h], [rt6_get_cookie], [OVS_DEFINE([HAVE_RT6_GET_COOKIE])]) + OVS_FIND_FIELD_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_stub], + [dst_entry]) OVS_GREP_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_dst_lookup.*net], [OVS_DEFINE([HAVE_IPV6_DST_LOOKUP_NET])]) OVS_GREP_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_dst_lookup_flow.*net], @@ -602,6 +641,9 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ [OVS_DEFINE([HAVE_UPSTREAM_STATIC_KEY])]) OVS_GREP_IFELSE([$KSRC/include/linux/jump_label.h], [DEFINE_STATIC_KEY_FALSE], [OVS_DEFINE([HAVE_DEFINE_STATIC_KEY])]) + OVS_GREP_IFELSE([$KSRC/include/linux/jump_label.h], + [DECLARE_STATIC_KEY_FALSE], + [OVS_DEFINE([HAVE_DECLARE_STATIC_KEY])]) OVS_GREP_IFELSE([$KSRC/include/linux/etherdevice.h], [eth_hw_addr_random]) OVS_GREP_IFELSE([$KSRC/include/linux/etherdevice.h], [ether_addr_copy]) @@ -788,6 +830,10 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ [prandom_u32[[\(]]], [OVS_DEFINE([HAVE_PRANDOM_U32])]) OVS_GREP_IFELSE([$KSRC/include/linux/random.h], [prandom_u32_max]) + OVS_GREP_IFELSE([$KSRC/include/linux/prandom.h], + [prandom_u32[[\(]]], + [OVS_DEFINE([HAVE_PRANDOM_U32])]) + OVS_GREP_IFELSE([$KSRC/include/linux/prandom.h], [prandom_u32_max]) OVS_GREP_IFELSE([$KSRC/include/net/rtnetlink.h], [get_link_net]) OVS_GREP_IFELSE([$KSRC/include/net/rtnetlink.h], [name_assign_type]) @@ -841,8 +887,6 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_clear_hash]) OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [int.skb_zerocopy(], [OVS_DEFINE([HAVE_SKB_ZEROCOPY])]) - OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [u8.*l4_rxhash], - [OVS_DEFINE([HAVE_L4_RXHASH])]) OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_ensure_writable]) OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_vlan_pop]) OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [__skb_vlan_pop]) @@ -939,8 +983,6 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ OVS_GREP_IFELSE([$KSRC/include/net/sock.h], [sk_no_check_tx]) OVS_GREP_IFELSE([$KSRC/include/linux/udp.h], [no_check6_tx]) - OVS_GREP_IFELSE([$KSRC/include/linux/utsrelease.h], [el6], - [OVS_DEFINE([HAVE_RHEL6_PER_CPU])]) OVS_FIND_PARAM_IFELSE([$KSRC/include/net/protocol.h], [udp_add_offload], [net], [OVS_DEFINE([HAVE_UDP_ADD_OFFLOAD_TAKES_NET])]) @@ -1101,6 +1143,10 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ OVS_FIND_OP_PARAM_IFELSE([$KSRC/include/net/rtnetlink.h], [validate], [extack], [OVS_DEFINE([HAVE_RTNLOP_VALIDATE_WITH_EXTACK])]) + OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], + [__skb_set_hash]) + OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [sw_hash]) + OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_get_hash_raw]) if cmp -s datapath/linux/kcompat.h.new \ datapath/linux/kcompat.h >/dev/null 2>&1; then @@ -1326,11 +1372,11 @@ AC_DEFUN([OVS_ENABLE_SPARSE], dnl OVS_CTAGS_IDENTIFIERS dnl -dnl ctags ignores symbols with extras identifiers. This builds a list of -dnl specially handled identifiers to be ignored. +dnl ctags ignores symbols with extras identifiers. This is a list of +dnl specially handled identifiers to be ignored. [ctags(1) -I ]. AC_DEFUN([OVS_CTAGS_IDENTIFIERS], AC_SUBST([OVS_CTAGS_IDENTIFIERS_LIST], - [`printf %s '-I "'; sed -n 's/^#define \(OVS_[A-Z_]\+\)(\.\.\.)$/\1+/p' ${srcdir}/include/openvswitch/compiler.h | tr \\\n ' ' ; printf '"'`] )) + ["OVS_LOCKABLE OVS_NO_THREAD_SAFETY_ANALYSIS OVS_REQ_RDLOCK+ OVS_ACQ_RDLOCK+ OVS_REQ_WRLOCK+ OVS_ACQ_WRLOCK+ OVS_REQUIRES+ OVS_ACQUIRES+ OVS_TRY_WRLOCK+ OVS_TRY_RDLOCK+ OVS_TRY_LOCK+ OVS_GUARDED_BY+ OVS_EXCLUDED+ OVS_RELEASES+ OVS_ACQ_BEFORE+ OVS_ACQ_AFTER+"])) dnl OVS_PTHREAD_SET_NAME dnl