Re: [[RFC xdp-hints] 16/16] samples/bpf: Show XDP hints usage

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

 



On Mon, Aug 2, 2021 at 6:05 PM Ederson de Souza
<ederson.desouza@xxxxxxxxx> wrote:
>
> An example of how to retrieve XDP hints/metadata from an XDP frame. To
> get the xdp_hints struct, one can use:
>
> $ bpftool net xdp show
>   xdp:
>   enp6s0(2) md_btf_id(44) md_btf_enabled(0)
>
> To get the BTF id, and then:
>
> $ bpftool btf dump id 44 format c > btf.h
>
> But, in this example, to demonstrate BTF and CORE features, a simpler
> struct was defined, containing the only field used by the sample.
>
> A lowpoint is that it's not currently possible to use some CORE features
> from "samples/bpf" directory, as those samples are currently built
> without using "clang -target bpf". This way, it was not possible to use
> "bpf_core_field_exists" macro to check, in runtime, the presence of a
> given XDP hints field.
> ---

FYI, Kumar Kartikeya Dwivedi is adding vmlinux.h and CO-RE support to
samples/bpf in [0].

  [0] https://lore.kernel.org/bpf/20210728165552.435050-1-memxor@xxxxxxxxx/


>  samples/bpf/xdp_sample_pkts_kern.c | 21 +++++++++++++++++++++
>  samples/bpf/xdp_sample_pkts_user.c |  4 +++-
>  2 files changed, 24 insertions(+), 1 deletion(-)
>

[...]



[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