Files
xdp-project-bpf-examples/AF_XDP-interaction
Ederson de Souza 34ef433573 Proposed: Helpers to access XDP hints based on BTF definitions
Based on:
 Subj: libbpf: Helpers to access XDP hints based on BTF definitions
  https://lore.kernel.org/all/20210803010331.39453-15-ederson.desouza@intel.com/
 From: Ederson de Souza <ederson.desouza@intel.com>

Ederson says:

 A new set of functions to help get the BTF definition of XDP hints
 structure and get the information based on it.

 `xsk_umem__btf_id` helps retrieve the BTF id of XDP metadata.
 `xsk_btf__init` sets up a context based on the BTF, including a hashmap,
 so that subsequent queries are faster.
 `xsk_btf__read` returns a pointer to the position in the XDP metadata
 containing a given field.
 `xsk_btf__has_field` checks the presence of a field in the BTF.
 `xsk_btf__free` frees up the context.

 Besides those, a macro `XSK_BTF_READ_INTO` acts as a convenient helper
 to read the field contents into a given variable.

 Note that currently, the hashmap used to speed-up offset location into
 the BTF doesn't use the field name as a string as key to the hashmap. It
 directly uses the pointer value instead, as it is expected that most of
 time, field names will be addressed by a shared constant string residing
 on read-only memory, thus saving some time. If this assumption is not
 entirely true, this optimisation needs to be rethought (or discarded
 altogether).

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2021-11-03 12:23:56 +01:00
..