summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Maximets <i.maximets@ovn.org>2021-08-03 19:36:39 +0200
committerIlya Maximets <i.maximets@ovn.org>2021-08-05 11:46:33 +0200
commita3bd383e94a9ecfeeeed7b1b09cd5fee2328bf9c (patch)
tree60009994222e11e178c356a003ce24ca2a2ba3aa
parente21e9dcec24101648918e49e0b609106048e0850 (diff)
downloadopenvswitch-a3bd383e94a9ecfeeeed7b1b09cd5fee2328bf9c.tar.gz
acinclude: Don't set AVX512-related configuration via CFLAGS.
The correct way to pass configuration options is to define them inside the config.h. Additionally, few long lines wrapped and fixed the unnecessary double check for -mavx512f. Fixes: abb807e27dd4 ("dpif-netdev: Add command to switch dpif implementation.") Fixes: 5324b54e606a ("dpif-netdev: Add configure to enable autovalidator at build time.") Fixes: e90e115a01af ("dpif-netdev: implement subtable lookup validation.") Fixes: 352b6c7116cd ("dpif-lookup: add avx512 gather implementation.") Signed-off-by: Ilya Maximets <i.maximets@ovn.org> Acked-by: Cian Ferriter <cian.ferriter@intel.com>
-rw-r--r--acinclude.m436
-rw-r--r--configure.ac4
-rw-r--r--m4/openvswitch.m45
3 files changed, 35 insertions, 10 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 5a48f0335..dba365ea1 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -19,13 +19,16 @@ dnl This enables automatically running all unit tests with all MFEX
dnl implementations.
AC_DEFUN([OVS_CHECK_MFEX_AUTOVALIDATOR], [
AC_ARG_ENABLE([mfex-default-autovalidator],
- [AC_HELP_STRING([--enable-mfex-default-autovalidator], [Enable MFEX autovalidator as default miniflow_extract implementation.])],
+ [AC_HELP_STRING([--enable-mfex-default-autovalidator],
+ [Enable MFEX autovalidator as default
+ miniflow_extract implementation.])],
[autovalidator=yes],[autovalidator=no])
AC_MSG_CHECKING([whether MFEX Autovalidator is default implementation])
if test "$autovalidator" != yes; then
AC_MSG_RESULT([no])
else
- OVS_CFLAGS="$OVS_CFLAGS -DMFEX_AUTOVALIDATOR_DEFAULT"
+ AC_DEFINE([MFEX_AUTOVALIDATOR_DEFAULT], [1],
+ [Autovalidator for miniflow_extract is a default implementation.])
AC_MSG_RESULT([yes])
fi
])
@@ -35,13 +38,17 @@ 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.])],
+ [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_DEFINE([DPCLS_AUTOVALIDATOR_DEFAULT], [1],
+ [Autovalidator for the userspace datapath classifier is a
+ default implementation.])
AC_MSG_RESULT([yes])
fi
])
@@ -50,17 +57,34 @@ dnl Set OVS DPIF default implementation at configure time for running the unit
dnl tests on the whole codebase without modifying tests per DPIF impl
AC_DEFUN([OVS_CHECK_DPIF_AVX512_DEFAULT], [
AC_ARG_ENABLE([dpif-default-avx512],
- [AC_HELP_STRING([--enable-dpif-default-avx512], [Enable DPIF AVX512 implementation as default.])],
+ [AC_HELP_STRING([--enable-dpif-default-avx512],
+ [Enable DPIF AVX512 implementation as default.])],
[dpifavx512=yes],[dpifavx512=no])
AC_MSG_CHECKING([whether DPIF AVX512 is default implementation])
if test "$dpifavx512" != yes; then
AC_MSG_RESULT([no])
else
- OVS_CFLAGS="$OVS_CFLAGS -DDPIF_AVX512_DEFAULT"
+ AC_DEFINE([DPIF_AVX512_DEFAULT], [1],
+ [DPIF AVX512 is a default implementation of the userspace
+ datapath interface.])
AC_MSG_RESULT([yes])
fi
])
+dnl OVS_CHECK_AVX512
+dnl
+dnl Checks if compiler and binutils supports AVX512.
+AC_DEFUN([OVS_CHECK_AVX512], [
+ OVS_CHECK_BINUTILS_AVX512
+ OVS_CHECK_CC_OPTION(
+ [-mavx512f], [ovs_have_cc_mavx512f=yes], [ovs_have_cc_mavx512f=no])
+ AM_CONDITIONAL([HAVE_AVX512F], [test $ovs_have_cc_mavx512f = yes])
+ if test "$ovs_have_cc_mavx512f" = yes; then
+ AC_DEFINE([HAVE_AVX512F], [1],
+ [Define to 1 if compiler supports AVX512.])
+ fi
+])
+
dnl OVS_ENABLE_WERROR
AC_DEFUN([OVS_ENABLE_WERROR],
[AC_ARG_ENABLE(
diff --git a/configure.ac b/configure.ac
index 8ba09de21..eaa9bf7ee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -179,15 +179,13 @@ OVS_ENABLE_OPTION([-Wno-null-pointer-arithmetic])
OVS_ENABLE_OPTION([-Warray-bounds-pointer-arithmetic])
OVS_CONDITIONAL_CC_OPTION([-Wno-unused], [HAVE_WNO_UNUSED])
OVS_CONDITIONAL_CC_OPTION([-Wno-unused-parameter], [HAVE_WNO_UNUSED_PARAMETER])
-OVS_CONDITIONAL_CC_OPTION([-mavx512f], [HAVE_AVX512F])
-OVS_CHECK_CC_OPTION([-mavx512f], [CFLAGS="$CFLAGS -DHAVE_AVX512F"])
OVS_ENABLE_WERROR
OVS_ENABLE_SPARSE
OVS_CTAGS_IDENTIFIERS
OVS_CHECK_DPCLS_AUTOVALIDATOR
OVS_CHECK_DPIF_AVX512_DEFAULT
OVS_CHECK_MFEX_AUTOVALIDATOR
-OVS_CHECK_BINUTILS_AVX512
+OVS_CHECK_AVX512
AC_ARG_VAR(KARCH, [Kernel Architecture String])
AC_SUBST(KARCH)
diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
index 244ea0fba..772825a71 100644
--- a/m4/openvswitch.m4
+++ b/m4/openvswitch.m4
@@ -412,7 +412,6 @@ AC_DEFUN([OVS_CHECK_BINUTILS_AVX512],
if ($CC -dumpmachine | grep x86_64) >/dev/null 2>&1; then
if (objdump -d --no-show-raw-insn $OBJFILE | grep -q $GATHER_PARAMS) >/dev/null 2>&1; then
ovs_cv_binutils_avx512_good=yes
- CFLAGS="$CFLAGS -DHAVE_LD_AVX512_GOOD"
else
ovs_cv_binutils_avx512_good=no
dnl Explicitly disallow avx512f to stop compiler auto-vectorizing
@@ -424,6 +423,10 @@ AC_DEFUN([OVS_CHECK_BINUTILS_AVX512],
ovs_cv_binutils_avx512_good=no
fi])
rm $OBJFILE
+ if test "$ovs_cv_binutils_avx512_good" = yes; then
+ AC_DEFINE([HAVE_LD_AVX512_GOOD], [1],
+ [Define to 1 if binutils correctly supports AVX512.])
+ fi
AM_CONDITIONAL([HAVE_LD_AVX512_GOOD],
[test "$ovs_cv_binutils_avx512_good" = yes])])