public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org, ast@kernel.org,
	daniel@iogearbox.net, andrii@kernel.org, davem@davemloft.net,
	kuba@kernel.org, hawk@kernel.org, pabeni@redhat.com,
	edumazet@google.com, toke@redhat.com, memxor@gmail.com,
	alardam@gmail.com, saeedm@nvidia.com, anthony.l.nguyen@intel.com,
	gospo@broadcom.com, vladimir.oltean@nxp.com, nbd@nbd.name,
	john@phrozen.org, leon@kernel.org, simon.horman@corigine.com,
	aelior@marvell.com, christophe.jaillet@wanadoo.fr,
	ecree.xilinx@gmail.com, grygorii.strashko@ti.com, mst@redhat.com,
	bjorn@kernel.org, magnus.karlsson@intel.com,
	maciej.fijalkowski@intel.com, intel-wired-lan@lists.osuosl.org,
	lorenzo.bianconi@redhat.com
Subject: Re: [RFC bpf-next 6/8] libbpf: add API to get XDP/XSK supported features
Date: Tue, 10 Jan 2023 18:26:45 +0100	[thread overview]
Message-ID: <Y72f1U2/dw8jo0/0@lore-desk> (raw)
In-Reply-To: <CAEf4BzbOF-S3kjbNVXCZR-K=TGarfi06ZwG1cbNF=HSSodwEfg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2924 bytes --]

> On Mon, Dec 19, 2022 at 7:42 AM Lorenzo Bianconi <lorenzo@kernel.org> wrote:
> >
> > From: Kumar Kartikeya Dwivedi <memxor@gmail.com>
> >
> > Add functions to get XDP/XSK supported function of netdev over route
> > netlink interface. These functions provide functionalities that are
> > going to be used in upcoming change.
> >
> > The newly added bpf_xdp_query_features takes a fflags_cnt parameter,
> > which denotes the number of elements in the output fflags array. This
> > must be at least 1 and maybe greater than XDP_FEATURES_WORDS. The
> > function only writes to words which is min of fflags_cnt and
> > XDP_FEATURES_WORDS.
> >
> > Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> > Co-developed-by: Marek Majtyka <alardam@gmail.com>
> > Signed-off-by: Marek Majtyka <alardam@gmail.com>
> > Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
> > ---
> >  tools/lib/bpf/libbpf.h   |  1 +
> >  tools/lib/bpf/libbpf.map |  1 +
> >  tools/lib/bpf/netlink.c  | 62 ++++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 64 insertions(+)
> >
> > diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
> > index eee883f007f9..9d102eb5007e 100644
> > --- a/tools/lib/bpf/libbpf.h
> > +++ b/tools/lib/bpf/libbpf.h
> > @@ -967,6 +967,7 @@ LIBBPF_API int bpf_xdp_detach(int ifindex, __u32 flags,
> >                               const struct bpf_xdp_attach_opts *opts);
> >  LIBBPF_API int bpf_xdp_query(int ifindex, int flags, struct bpf_xdp_query_opts *opts);
> >  LIBBPF_API int bpf_xdp_query_id(int ifindex, int flags, __u32 *prog_id);
> > +LIBBPF_API int bpf_xdp_query_features(int ifindex, __u32 *fflags, __u32 *fflags_cnt);
> 
> no need to add new API, just extend bpf_xdp_query()?

Hi Andrii,

AFAIK libbpf supports just NETLINK_ROUTE protocol. In order to connect with the
genl family code shared by Jakub we need to add NETLINK_GENERIC protocol support
to libbf. Is it ok to introduce a libmnl or libnl dependency in libbpf or do you
prefer to add open code to just what we need?
I guess we should have a dedicated API to dump xdp features in this case since
all the other code relies on NETLINK_ROUTE protocol. What do you think?

Regards,
Lorenzo

> 
> >
> >  /* TC related API */
> >  enum bpf_tc_attach_point {
> > diff --git a/tools/lib/bpf/libbpf.map b/tools/lib/bpf/libbpf.map
> > index 71bf5691a689..9c2abb58fa4b 100644
> > --- a/tools/lib/bpf/libbpf.map
> > +++ b/tools/lib/bpf/libbpf.map
> > @@ -362,6 +362,7 @@ LIBBPF_1.0.0 {
> >                 bpf_program__set_autoattach;
> >                 btf__add_enum64;
> >                 btf__add_enum64_value;
> > +               bpf_xdp_query_features;
> >                 libbpf_bpf_attach_type_str;
> >                 libbpf_bpf_link_type_str;
> >                 libbpf_bpf_map_type_str;
> 
> [...]

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2023-01-10 17:26 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-19 15:41 [RFC bpf-next 0/8] xdp: introduce xdp-feature support Lorenzo Bianconi
2022-12-19 15:41 ` [RFC bpf-next 1/8] tools: uapi: align if_link.h Lorenzo Bianconi
2022-12-19 15:41 ` [RFC bpf-next 2/8] net: introduce XDP features flag Lorenzo Bianconi
2022-12-19 20:03   ` sdf
     [not found]     ` <CAAOQfrFGArAYPyBX_kw4ZvFrTjKXf-jG-2F2y69nOs-oQ8Onwg@mail.gmail.com>
2022-12-20  0:20       ` Stanislav Fomichev
2022-12-20 10:11         ` Lorenzo Bianconi
2022-12-20 18:03           ` Stanislav Fomichev
2022-12-20 22:25             ` Lorenzo Bianconi
2022-12-20 23:36               ` Stanislav Fomichev
2022-12-21 10:39                 ` Lorenzo Bianconi
2022-12-21 17:50                   ` Stanislav Fomichev
2022-12-20  1:13   ` Jakub Kicinski
2022-12-20  9:20     ` Lorenzo Bianconi
2022-12-20 22:51       ` Marek Majtyka
2022-12-20 23:39         ` Jakub Kicinski
2022-12-21  4:41           ` Jakub Kicinski
2022-12-21 10:47             ` Lorenzo Bianconi
2022-12-19 15:41 ` [RFC bpf-next 3/8] drivers: net: turn on XDP features Lorenzo Bianconi
2022-12-19 15:41 ` [RFC bpf-next 4/8] xsk: add usage of XDP features flags Lorenzo Bianconi
2022-12-19 15:41 ` [RFC bpf-next 5/8] xsk: add check for full support of XDP in bind Lorenzo Bianconi
2022-12-19 15:41 ` [RFC bpf-next 6/8] libbpf: add API to get XDP/XSK supported features Lorenzo Bianconi
2022-12-21  0:18   ` Andrii Nakryiko
2023-01-10 17:26     ` Lorenzo Bianconi [this message]
2023-01-13 18:22       ` Andrii Nakryiko
2023-01-14 15:33         ` Lorenzo Bianconi
2022-12-19 15:41 ` [RFC bpf-next 7/8] bpf: devmap: check XDP features in bpf_map_update_elem and __xdp_enqueue Lorenzo Bianconi
2022-12-19 15:41 ` [RFC bpf-next 8/8] selftests/bpf: introduce XDP compliance test tool Lorenzo Bianconi

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=Y72f1U2/dw8jo0/0@lore-desk \
    --to=lorenzo@kernel.org \
    --cc=aelior@marvell.com \
    --cc=alardam@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=anthony.l.nguyen@intel.com \
    --cc=ast@kernel.org \
    --cc=bjorn@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=ecree.xilinx@gmail.com \
    --cc=edumazet@google.com \
    --cc=gospo@broadcom.com \
    --cc=grygorii.strashko@ti.com \
    --cc=hawk@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=john@phrozen.org \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=memxor@gmail.com \
    --cc=mst@redhat.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=simon.horman@corigine.com \
    --cc=toke@redhat.com \
    --cc=vladimir.oltean@nxp.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