On 6/27/23 12:11, Frode Nordahl wrote:
> Build the upstream Open vSwitch deb package with AF_XDP datapath

s/datapath/ports/

> enabled when required dependencies are available.
> 
> Signed-off-by: Frode Nordahl <[email protected]>
> ---
>  Documentation/intro/install/debian.rst | 13 ++++++++
>  debian/automake.mk                     | 45 ++++++++++++++++++--------
>  debian/control.in                      |  2 ++
>  debian/rules                           |  8 +++--
>  4 files changed, 52 insertions(+), 16 deletions(-)
> 
> diff --git a/Documentation/intro/install/debian.rst 
> b/Documentation/intro/install/debian.rst
> index 6d2687830..428a45307 100644
> --- a/Documentation/intro/install/debian.rst
> +++ b/Documentation/intro/install/debian.rst
> @@ -63,6 +63,14 @@ You do not need to be the superuser to build the Debian 
> packages.
>  
>  4. Prepare the package source.
>  
> +   In order to support building the package across a diverse set of
> +   Debian/Ubuntu versions, parts of the package source needs to be generated
> +   before a package can be built.
> +
> +   This process is influenced by the OVS build
> +   system, guided by the available dependencies on the system and arguments
> +   to the configure script.
> +
>     If you want to build the package with DPDK support execute the following
>     command::
>  
> @@ -72,6 +80,11 @@ You do not need to be the superuser to build the Debian 
> packages.
>  
>         $ ./boot.sh && ./configure && make debian
>  
> +   If you want to build the package without AF_XDP support execute the
> +   following command::
> +
> +       $ ./boot.sh && ./configure --disable-afxdp && make debian
> +
>  Check your work by running ``dpkg-checkbuilddeps`` in the top level of your 
> OVS
>  directory. If you've installed all the dependencies properly,
>  ``dpkg-checkbuilddeps`` will exit without printing anything. If you forgot to
> diff --git a/debian/automake.mk b/debian/automake.mk
> index 7b2afafae..414b092a1 100644
> --- a/debian/automake.mk
> +++ b/debian/automake.mk
> @@ -94,18 +94,36 @@ debian/copyright: AUTHORS.rst debian/copyright.in
>  CLEANFILES += debian/copyright
>  
>  
> +DEB_BUILD_OPTIONS = nocheck parallel=`nproc`
> +
>  if DPDK_NETDEV
> -update_deb_control = \
> -     $(AM_V_GEN) sed -e 's/^\# DPDK_NETDEV //' \
> -             < $(srcdir)/debian/control.in > debian/control
> +update_deb_control_dpdk = \
> +     $(AM_V_GEN) sed -i 's/^\# DPDK_NETDEV //' \
> +             $(srcdir)/debian/control
> +else
> +update_deb_control_dpdk = \
> +     $(AM_V_GEN) sed -i '/^\# DPDK_NETDEV /d' \
> +             $(srcdir)/debian/control
> +DEB_BUILD_OPTIONS += nodpdk
> +endif
> +
> +if HAVE_AF_XDP

These should probably be guarded with HAVE_LIBXDP instead.
The issue is that OVS can build with older libbpf and without
libxdp available.  HAVE_AF_XDP will be set in this case,
but the debian package requires libxdp and we will fail to
build it.

Is that correct?

> +update_deb_control_afxdp = \
> +     $(AM_V_GEN) sed -i 's/^\# HAVE_AF_XDP //' \
> +             $(srcdir)/debian/control
>  else
> -update_deb_control = \
> -     $(AM_V_GEN) grep -v '^\# DPDK_NETDEV' \
> -             < $(srcdir)/debian/control.in > debian/control
> +update_deb_control_afxdp = \
> +     $(AM_V_GEN) sed -i '/^\# HAVE_AF_XDP /d' \
> +             $(srcdir)/debian/control
> +DEB_BUILD_OPTIONS += noafxdp
>  endif
>  
>  debian/control: $(srcdir)/debian/control.in Makefile
> -     $(update_deb_control)
> +     cp $(srcdir)/debian/control.in $(srcdir)/debian/control
> +     ## Order is significant here as we are modifying the file in-place and
> +     ## a DPDK enabled binary may support both DPDK and AFXDP.
> +     $(update_deb_control_dpdk)
> +     $(update_deb_control_afxdp)
>  
>  CLEANFILES += debian/control
>  
> @@ -120,13 +138,12 @@ debian-deb: debian
>               exit 1;                                                         
> \
>       fi
>       $(MAKE) distclean
> +     cp $(srcdir)/debian/control.in $(srcdir)/debian/control
>       $(update_deb_copyright)
> -     $(update_deb_control)
> +     ## Order is significant here as we are modifying the file in-place and
> +     ## a DPDK enabled binary may support both DPDK and AFXDP.
> +     $(update_deb_control_dpdk)
> +     $(update_deb_control_afxdp)
>       $(AM_V_GEN) fakeroot debian/rules clean
> -if DPDK_NETDEV
> -     $(AM_V_GEN) DEB_BUILD_OPTIONS="nocheck parallel=`nproc`" \
> -             fakeroot debian/rules binary
> -else
> -     $(AM_V_GEN) DEB_BUILD_OPTIONS="nocheck parallel=`nproc` nodpdk" \
> +     $(AM_V_GEN) DEB_BUILD_OPTIONS="$(DEB_BUILD_OPTIONS)" \
>               fakeroot debian/rules binary
> -endif
> diff --git a/debian/control.in b/debian/control.in
> index 19f590d06..d2711deaa 100644
> --- a/debian/control.in
> +++ b/debian/control.in
> @@ -19,6 +19,7 @@ Build-Depends:
>   dh-sequence-sphinxdoc,
>   graphviz,
>   iproute2,
> +# HAVE_AF_XDP  libbpf-dev,
>   libcap-ng-dev,
>   libdbus-1-dev [amd64 i386 ppc64el arm64],
>  # DPDK_NETDEV  libdpdk-dev (>= 22.11) [amd64 i386 ppc64el arm64],
> @@ -27,6 +28,7 @@ Build-Depends:
>   libssl-dev,
>   libtool,
>   libunbound-dev,
> +# HAVE_AF_XDP  libxdp-dev (>= 1.2.9~) [!alpha !arc !hppa !ia64 !m68k !sh4],
>   openssl,
>   pkg-config,
>   procps,
> diff --git a/debian/rules b/debian/rules
> index 28c249d07..4e09e52b6 100755
> --- a/debian/rules
> +++ b/debian/rules
> @@ -19,13 +19,17 @@ endif
>  PYTHON3S:=$(shell py3versions -vr)
>  DEB_HOST_ARCH?=$(shell dpkg-architecture -qDEB_HOST_ARCH)
>  
> +ifneq (,$(filter noafxdp, $(DEB_BUILD_OPTIONS)))
> +AFXDP:=--disable-afxdp
> +endif
> +
>  override_dh_auto_configure:
>       test -d _debian || mkdir _debian
>       cd _debian && ( \
>               test -e Makefile || \
>               ../configure --prefix=/usr --localstatedir=/var \
>                                       --enable-ssl \
> -                                     --disable-afxdp \
> +                                     $(AFXDP) \
>                                       --sysconfdir=/etc \
>                                       $(DATAPATH_CONFIGURE_OPTS) \
>                                       $(EXTRA_CONFIGURE_OPTS) \
> @@ -37,7 +41,7 @@ ifeq (,$(filter nodpdk, $(DEB_BUILD_OPTIONS)))
>               test -e Makefile || \
>               ../configure --prefix=/usr --localstatedir=/var \
>                                       --enable-ssl \
> -                                     --disable-afxdp \
> +                                     $(AFXDP) \
>                                       --with-dpdk=shared \
>                                       --sysconfdir=/etc \
>                                       $(DATAPATH_CONFIGURE_OPTS) \

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to