diff mbox series

[ovs-dev,v4,1/2] debian: Build package with AF_XDP.

Message ID 20230627101104.72417-1-frode.nordahl@canonical.com
State Changes Requested
Headers show
Series [ovs-dev,v4,1/2] debian: Build package with AF_XDP. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/intel-ovs-compilation success test: success
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Frode Nordahl June 27, 2023, 10:11 a.m. UTC
Build the upstream Open vSwitch deb package with AF_XDP datapath
enabled when required dependencies are available.

Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
---
 Documentation/intro/install/debian.rst | 13 ++++++++
 debian/automake.mk                     | 45 ++++++++++++++++++--------
 debian/control.in                      |  2 ++
 debian/rules                           |  8 +++--
 4 files changed, 52 insertions(+), 16 deletions(-)

Comments

Ilya Maximets July 12, 2023, 8:07 p.m. UTC | #1
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 <frode.nordahl@canonical.com>
> ---
>  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) \
Frode Nordahl July 14, 2023, 8:17 a.m. UTC | #2
On Wed, Jul 12, 2023 at 10:06 PM Ilya Maximets <i.maximets@ovn.org> wrote:
>
> On 6/27/23 12:11, Frode Nordahl wrote:
> > Build the upstream Open vSwitch deb package with AF_XDP datapath
>
> s/datapath/ports/

Ack.

> > enabled when required dependencies are available.
> >
> > Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
> > ---
> >  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?

Yes, that makes sense, and thank you for pointing that out, I missed
the delineation, will fix it!
diff mbox series

Patch

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
+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) \