From: "Loftus, Ciara" <ciara.loftus@intel.com>
To: "Richardson, Bruce" <bruce.richardson@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "Yigit, Ferruh" <ferruh.yigit@intel.com>
Subject: RE: [PATCH v2] net/af_xdp: use libxdp if available
Date: Thu, 27 Jan 2022 08:42:09 +0000 [thread overview]
Message-ID: <PH0PR11MB4791AA0D699AC26FDA68304E8E219@PH0PR11MB4791.namprd11.prod.outlook.com> (raw)
In-Reply-To: <Ye/CmFgIB3N4ARyi@bricha3-MOBL.ger.corp.intel.com>
>
> On Tue, Jan 25, 2022 at 07:20:43AM +0000, Ciara Loftus wrote:
> > AF_XDP support is deprecated in libbpf since v0.7.0 [1]. The
> > libxdp library now provides the functionality which once was in
> > libbpf and which the AF_XDP PMD relies on. This commit updates the
> > AF_XDP meson build to use the libxdp library if a version >= v1.2.2 is
> > available. If it is not available, only versions of libbpf prior to v0.7.0
> > are allowed, as they still contain the required AF_XDP functionality.
> >
> > libbpf still remains a dependency even if libxdp is present, as we
> > use libbpf APIs for program loading.
> >
> > The minimum required kernel version for libxdp for use with AF_XDP is
> v5.3.
> > For the library to be fully-featured, a kernel v5.10 or newer is
> > recommended. The full compatibility information can be found in the
> libxdp
> > README.
> >
> > v1.2.2 of libxdp includes an important fix required for linking with
> > DPDK which is why this version or greater is required. Meson uses
> > pkg-config to verify the version of libxdp on the system, so it is
> > necessary that the library is discoverable using pkg-config in order for
> > the PMD to use it. To verify this, you can run:
> > pkg-config --modversion libxdp
> >
> > [1] https://github.com/libbpf/libbpf/commit/277846bc6c15
> >
> > Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
>
> Hi Ciara,
>
> couple of comments inline below.
>
> /Bruce
>
> > ---
> > v2:
> > * Set minimum libxdp version at v1.2.2
> >
> > RFC -> v1:
> > * Set minimum libxdp version at v1.3.0
> > * Don't provide alternative to discovery via pkg-config
> > * Add missing newline to end of file
> > ---
> > doc/guides/nics/af_xdp.rst | 6 ++--
> > doc/guides/rel_notes/release_22_03.rst | 4 +++
> > drivers/net/af_xdp/compat.h | 4 +++
> > drivers/net/af_xdp/meson.build | 39 +++++++++++++++++++++-----
> > drivers/net/af_xdp/rte_eth_af_xdp.c | 1 -
> > 5 files changed, 42 insertions(+), 12 deletions(-)
> >
> > diff --git a/doc/guides/nics/af_xdp.rst b/doc/guides/nics/af_xdp.rst
> > index c9d0e1ad6c..db02ea1984 100644
> > --- a/doc/guides/nics/af_xdp.rst
> > +++ b/doc/guides/nics/af_xdp.rst
> > @@ -43,9 +43,7 @@ Prerequisites
> > This is a Linux-specific PMD, thus the following prerequisites apply:
> >
> > * A Linux Kernel (version > v4.18) with XDP sockets configuration enabled;
> > -* libbpf (within kernel version > v5.1-rc4) with latest af_xdp support
> installed,
> > - User can install libbpf via `make install_lib` && `make install_headers` in
> > - <kernel src tree>/tools/lib/bpf;
> > +* Both libxdp >=v1.2.2 and libbpf libraries installed, or, libbpf <=v0.6.0
> > * A Kernel bound interface to attach to;
> > * For need_wakeup feature, it requires kernel version later than v5.3-rc1;
> > * For PMD zero copy, it requires kernel version later than v5.4-rc1;
> > @@ -143,4 +141,4 @@ Limitations
> > NAPI context from a watchdog timer instead of from softirqs. More
> information
> > on this feature can be found at [1].
> >
> > - [1] https://lwn.net/Articles/837010/
> > \ No newline at end of file
> > + [1] https://lwn.net/Articles/837010/
> > diff --git a/doc/guides/rel_notes/release_22_03.rst
> b/doc/guides/rel_notes/release_22_03.rst
> > index 8a202ec4f4..ad7283df65 100644
> > --- a/doc/guides/rel_notes/release_22_03.rst
> > +++ b/doc/guides/rel_notes/release_22_03.rst
> > @@ -55,6 +55,10 @@ New Features
> > Also, make sure to start the actual text at the margin.
> > =======================================================
> >
> > +* **Update AF_XDP PMD**
> > +
> > + * Added support for libxdp >=v1.2.2.
> > +
> >
> > Removed Items
> > -------------
> > diff --git a/drivers/net/af_xdp/compat.h b/drivers/net/af_xdp/compat.h
> > index 3880dc7dd7..245df1b109 100644
> > --- a/drivers/net/af_xdp/compat.h
> > +++ b/drivers/net/af_xdp/compat.h
> > @@ -2,7 +2,11 @@
> > * Copyright(c) 2020 Intel Corporation.
> > */
> >
> > +#ifdef RTE_LIBRTE_AF_XDP_PMD_LIBXDP
>
> This is a really long macro name. With meson builds we have largely moved
> away from using "RTE_LIBRTE_" as a prefix, and also have dropped "PMD"
> from
> names too. The global enable macro for AF_XDP driver is now
> "RTE_NET_AF_XDP" so I'd suggest this macro could be shortened to
> "RTE_NET_AF_XDP_LIBXDP".
+1
>
> > +#include <xdp/xsk.h>
> > +#else
> > #include <bpf/xsk.h>
> > +#endif
> > #include <linux/version.h>
> > #include <poll.h>
> >
> > diff --git a/drivers/net/af_xdp/meson.build
> b/drivers/net/af_xdp/meson.build
> > index 3ed2b29784..981d4c6087 100644
> > --- a/drivers/net/af_xdp/meson.build
> > +++ b/drivers/net/af_xdp/meson.build
> > @@ -9,19 +9,44 @@ endif
> >
> > sources = files('rte_eth_af_xdp.c')
> >
> > +xdp_dep = dependency('libxdp', version : '>=1.2.2', required: false,
> method: 'pkg-config')
> > bpf_dep = dependency('libbpf', required: false, method: 'pkg-config')
> > if not bpf_dep.found()
> > bpf_dep = cc.find_library('bpf', required: false)
> > endif
> >
> > -if bpf_dep.found() and cc.has_header('bpf/xsk.h') and
> cc.has_header('linux/if_xdp.h')
> > - ext_deps += bpf_dep
> > - bpf_ver_dep = dependency('libbpf', version : '>=0.2.0',
> > - required: false, method: 'pkg-config')
> > - if bpf_ver_dep.found()
> > - dpdk_conf.set('RTE_LIBRTE_AF_XDP_PMD_SHARED_UMEM', 1)
> > +if cc.has_header('linux/if_xdp.h')
> > + if xdp_dep.found() and cc.has_header('xdp/xsk.h')
> > + if bpf_dep.found() and cc.has_header('bpf/bpf.h')
> > + dpdk_conf.set('RTE_LIBRTE_AF_XDP_PMD_LIBXDP', 1)
> > + dpdk_conf.set('RTE_LIBRTE_AF_XDP_PMD_SHARED_UMEM', 1)
>
> Do these defines need to be exposed to the end user, or are they for
> internal use only? If they don't need to be exposed to the user, I'd
> suggest changing them to cflags, rather than writing them to the build
> config. As well as reducing the info we show to the end user, not having
> them in the build config means that if they change, only this driver needs
> a rebuild, rather than the whole of DPDK. [Every DPDK file includes the
> build config, so a change there requires everything rebuild]
These don't need to be exposed to the end user. Thanks for the suggestion,
it definitely makes more sense to use cflags instead. I'll add that in the v3.
Thanks,
Ciara
>
> > + ext_deps += xdp_dep
> > + ext_deps += bpf_dep
> > + else
> > + build = false
> > + reason = 'missing dependency, libbpf'
> > + endif
> <snip>
next prev parent reply other threads:[~2022-01-27 8:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-10 10:58 [RFC PATCH] " Ciara Loftus
2022-01-12 13:07 ` [PATCH] " Ciara Loftus
2022-01-25 7:20 ` [PATCH v2] " Ciara Loftus
2022-01-25 9:27 ` Bruce Richardson
2022-01-27 8:42 ` Loftus, Ciara [this message]
2022-01-28 9:50 ` [PATCH v3] " Ciara Loftus
2022-01-31 17:59 ` Ferruh Yigit
2022-01-31 18:05 ` Bruce Richardson
2022-02-01 10:06 ` Ferruh Yigit
2022-02-01 10:11 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=PH0PR11MB4791AA0D699AC26FDA68304E8E219@PH0PR11MB4791.namprd11.prod.outlook.com \
--to=ciara.loftus@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).