mirror of
https://github.com/openvswitch/ovs
synced 2025-08-30 13:58:14 +00:00
acinclude.m4: Build with AF_XDP support by default if possible.
With this change we will try to detect all the netdev-afxdp dependencies and enable AF_XDP support by default if they are present at the build time. Configuration script behaves in a following way: - ./configure --enable-afxdp Will check for AF_XDP dependencies and fail if they are not available. - ./configure --disable-afxdp Disables checking for AF_XDP. Build will not support AF_XDP even if all dependencies are installed. - Just ./configure or ./configure --enable-afxdp=auto Will check for AF_XDP dependencies. Will print a warning if they are not available, but will continue without AF_XDP support. If dependencies are available in a system, this option is equal to --enable-afxdp. '--disable-afxdp' added to the debian and fedora package builds to keep predictable behavior. Acked-by: Eelco Chaudron <echaudro@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
parent
771a55825f
commit
e44e803431
@ -30,8 +30,7 @@ This document describes how to build and install Open vSwitch using
|
|||||||
AF_XDP netdev.
|
AF_XDP netdev.
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
The AF_XDP support of Open vSwitch is considered 'experimental',
|
The AF_XDP support of Open vSwitch is considered 'experimental'.
|
||||||
and it is not compiled in by default.
|
|
||||||
|
|
||||||
|
|
||||||
Introduction
|
Introduction
|
||||||
@ -137,6 +136,9 @@ bootstrap/configure the package::
|
|||||||
|
|
||||||
./boot.sh && ./configure --enable-afxdp
|
./boot.sh && ./configure --enable-afxdp
|
||||||
|
|
||||||
|
``--enable-afxdp`` here is optional, but it will ensure that all dependencies
|
||||||
|
are available at the build time.
|
||||||
|
|
||||||
Finally, build and install OVS::
|
Finally, build and install OVS::
|
||||||
|
|
||||||
make && make install
|
make && make install
|
||||||
|
3
NEWS
3
NEWS
@ -4,6 +4,9 @@ Post-v3.0.0
|
|||||||
of handler and revalidator threads if necessary.
|
of handler and revalidator threads if necessary.
|
||||||
- AF_XDP:
|
- AF_XDP:
|
||||||
* Added support for building with libxdp and libbpf >= 0.7.
|
* Added support for building with libxdp and libbpf >= 0.7.
|
||||||
|
* Support for AF_XDP is now enabled by default if all dependencies are
|
||||||
|
available at the build time. Use --disable-afxdp to disable.
|
||||||
|
Use --enable-afxdp to fail the build if dependencies are not present.
|
||||||
- ovs-appctl:
|
- ovs-appctl:
|
||||||
* "ovs-appctl ofproto/trace" command can now display port names with the
|
* "ovs-appctl ofproto/trace" command can now display port names with the
|
||||||
"--names" option.
|
"--names" option.
|
||||||
|
78
acinclude.m4
78
acinclude.m4
@ -253,46 +253,70 @@ dnl OVS_CHECK_LINUX_AF_XDP
|
|||||||
dnl
|
dnl
|
||||||
dnl Check both Linux kernel AF_XDP and libbpf/libxdp support
|
dnl Check both Linux kernel AF_XDP and libbpf/libxdp support
|
||||||
AC_DEFUN([OVS_CHECK_LINUX_AF_XDP], [
|
AC_DEFUN([OVS_CHECK_LINUX_AF_XDP], [
|
||||||
AC_ARG_ENABLE([afxdp],
|
AC_ARG_ENABLE(
|
||||||
[AS_HELP_STRING([--enable-afxdp], [Enable AF-XDP support])],
|
[afxdp],
|
||||||
[], [enable_afxdp=no])
|
[AS_HELP_STRING([--disable-afxdp], [Disable AF-XDP support])],
|
||||||
|
[case "${enableval}" in
|
||||||
|
(yes | no | auto) ;;
|
||||||
|
(*) AC_MSG_ERROR([bad value ${enableval} for --enable-afxdp]) ;;
|
||||||
|
esac],
|
||||||
|
[enable_afxdp=auto])
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether AF_XDP is enabled])
|
AC_MSG_CHECKING([whether AF_XDP is enabled])
|
||||||
if test "$enable_afxdp" != yes; then
|
if test "$enable_afxdp" == no; then
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
AF_XDP_ENABLE=false
|
AF_XDP_ENABLE=false
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([$enable_afxdp])
|
||||||
AF_XDP_ENABLE=true
|
AF_XDP_ENABLE=true
|
||||||
|
failed_dep=none
|
||||||
|
dnl Saving libs to restore in case we will end up not building with AF_XDP.
|
||||||
|
save_LIBS=$LIBS
|
||||||
|
|
||||||
AC_CHECK_HEADER([bpf/libbpf.h], [],
|
AC_CHECK_HEADER([bpf/libbpf.h], [], [failed_dep="bpf/libbpf.h"])
|
||||||
[AC_MSG_ERROR([unable to find bpf/libbpf.h for AF_XDP support])])
|
|
||||||
|
|
||||||
AC_CHECK_HEADER([linux/if_xdp.h], [],
|
if test "$failed_dep" = none; then
|
||||||
[AC_MSG_ERROR([unable to find linux/if_xdp.h for AF_XDP support])])
|
AC_CHECK_HEADER([linux/if_xdp.h], [], [failed_dep="linux/if_xdp.h"])
|
||||||
|
|
||||||
OVS_FIND_DEPENDENCY([libbpf_strerror], [bpf], [libbpf])
|
|
||||||
AC_CHECK_FUNCS([bpf_xdp_query_id bpf_xdp_detach])
|
|
||||||
|
|
||||||
if test "x$ac_cv_func_bpf_xdp_detach" = xyes; then
|
|
||||||
dnl We have libbpf >= 0.7. Look for libxdp as xsk functions
|
|
||||||
dnl were moved into this library.
|
|
||||||
OVS_FIND_DEPENDENCY([libxdp_strerror], [xdp], [libxdp])
|
|
||||||
AC_CHECK_HEADER([xdp/xsk.h],
|
|
||||||
AC_DEFINE([HAVE_LIBXDP], [1], [xsk.h is supplied with libxdp]),
|
|
||||||
AC_MSG_ERROR([unable to find xdp/xsk.h for AF_XDP support]))
|
|
||||||
else
|
|
||||||
dnl libbpf < 0.7 contains all the necessary functionality.
|
|
||||||
AC_CHECK_HEADER([bpf/xsk.h], [],
|
|
||||||
[AC_MSG_ERROR([unable to find bpf/xsk.h for AF_XDP support])])
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CHECK_FUNCS([pthread_spin_lock], [],
|
if test "$failed_dep" = none; then
|
||||||
[AC_MSG_ERROR([unable to find pthread_spin_lock for AF_XDP support])])
|
AC_SEARCH_LIBS([libbpf_strerror], [bpf], [], [failed_dep="libbpf"])
|
||||||
|
AC_CHECK_FUNCS([bpf_xdp_query_id bpf_xdp_detach])
|
||||||
|
fi
|
||||||
|
|
||||||
OVS_FIND_DEPENDENCY([numa_alloc_onnode], [numa], [libnuma])
|
if test "$failed_dep" = none -a "x$ac_cv_func_bpf_xdp_detach" = xyes; then
|
||||||
|
dnl We have libbpf >= 0.7. Look for libxdp as xsk functions
|
||||||
|
dnl were moved into this library.
|
||||||
|
AC_SEARCH_LIBS([libxdp_strerror], [xdp],
|
||||||
|
AC_CHECK_HEADER([xdp/xsk.h],
|
||||||
|
AC_DEFINE([HAVE_LIBXDP], [1], [xsk.h is supplied with libxdp]),
|
||||||
|
[failed_dep="xdp/xsk.h"]),
|
||||||
|
[failed_dep="libxdp"])
|
||||||
|
elif test "$failed_dep" = none; then
|
||||||
|
dnl libbpf < 0.7 contains all the necessary functionality.
|
||||||
|
AC_CHECK_HEADER([bpf/xsk.h], [], [failed_dep="bpf/xsk.h"])
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$failed_dep" = none; then
|
||||||
|
AC_CHECK_FUNCS([pthread_spin_lock], [], [failed_dep="pthread_spin_lock"])
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$failed_dep" = none; then
|
||||||
|
AC_SEARCH_LIBS([numa_alloc_onnode], [numa], [], [failed_dep="libnuma"])
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$failed_dep" = none; then
|
||||||
AC_DEFINE([HAVE_AF_XDP], [1],
|
AC_DEFINE([HAVE_AF_XDP], [1],
|
||||||
[Define to 1 if AF_XDP support is available and enabled.])
|
[Define to 1 if AF_XDP support is available and enabled.])
|
||||||
|
elif test "$enable_afxdp" = yes; then
|
||||||
|
AC_MSG_ERROR([Missing $failed_dep dependency for AF_XDP support])
|
||||||
|
else
|
||||||
|
AC_MSG_WARN(m4_normalize(
|
||||||
|
[Cannot find $failed_dep, netdev-afxdp will not be supported
|
||||||
|
(use --disable-afxdp to suppress this warning).]))
|
||||||
|
AF_XDP_ENABLE=false
|
||||||
|
LIBS=$save_LIBS
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
AM_CONDITIONAL([HAVE_AF_XDP], test "$AF_XDP_ENABLE" = true)
|
AM_CONDITIONAL([HAVE_AF_XDP], test "$AF_XDP_ENABLE" = true)
|
||||||
])
|
])
|
||||||
|
11
debian/rules
vendored
11
debian/rules
vendored
@ -23,7 +23,9 @@ override_dh_auto_configure:
|
|||||||
test -d _debian || mkdir _debian
|
test -d _debian || mkdir _debian
|
||||||
cd _debian && ( \
|
cd _debian && ( \
|
||||||
test -e Makefile || \
|
test -e Makefile || \
|
||||||
../configure --prefix=/usr --localstatedir=/var --enable-ssl \
|
../configure --prefix=/usr --localstatedir=/var \
|
||||||
|
--enable-ssl \
|
||||||
|
--disable-afxdp \
|
||||||
--sysconfdir=/etc \
|
--sysconfdir=/etc \
|
||||||
$(DATAPATH_CONFIGURE_OPTS) \
|
$(DATAPATH_CONFIGURE_OPTS) \
|
||||||
$(EXTRA_CONFIGURE_OPTS) \
|
$(EXTRA_CONFIGURE_OPTS) \
|
||||||
@ -33,8 +35,11 @@ ifeq (,$(filter nodpdk, $(DEB_BUILD_OPTIONS)))
|
|||||||
test -d _dpdk || mkdir _dpdk
|
test -d _dpdk || mkdir _dpdk
|
||||||
cd _dpdk && ( \
|
cd _dpdk && ( \
|
||||||
test -e Makefile || \
|
test -e Makefile || \
|
||||||
../configure --prefix=/usr --localstatedir=/var --enable-ssl \
|
../configure --prefix=/usr --localstatedir=/var \
|
||||||
--with-dpdk=shared --sysconfdir=/etc \
|
--enable-ssl \
|
||||||
|
--disable-afxdp \
|
||||||
|
--with-dpdk=shared \
|
||||||
|
--sysconfdir=/etc \
|
||||||
$(DATAPATH_CONFIGURE_OPTS) \
|
$(DATAPATH_CONFIGURE_OPTS) \
|
||||||
$(EXTRA_CONFIGURE_OPTS) \
|
$(EXTRA_CONFIGURE_OPTS) \
|
||||||
)
|
)
|
||||||
|
@ -171,6 +171,8 @@ This package provides IPsec tunneling support for OVS tunnels.
|
|||||||
%endif
|
%endif
|
||||||
%if %{with afxdp}
|
%if %{with afxdp}
|
||||||
--enable-afxdp \
|
--enable-afxdp \
|
||||||
|
%else
|
||||||
|
--disable-afxdp \
|
||||||
%endif
|
%endif
|
||||||
--enable-ssl \
|
--enable-ssl \
|
||||||
--disable-static \
|
--disable-static \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user