Re: [RFC bpf-next 6/8] libbpf: add API to get XDP/XSK supported features

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 19, 2022 at 7:42 AM Lorenzo Bianconi <lorenzo@xxxxxxxxxx> wrote:
>
> From: Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx>
>
> 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@xxxxxxxxxx>
> Signed-off-by: Lorenzo Bianconi <lorenzo@xxxxxxxxxx>
> Co-developed-by: Marek Majtyka <alardam@xxxxxxxxx>
> Signed-off-by: Marek Majtyka <alardam@xxxxxxxxx>
> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx>
> ---
>  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()?

>
>  /* 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;

[...]



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux