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(-) > [...]