Message ID | cover.1592600985.git.rdna@fb.com |
---|---|
Headers | show |
Series | bpf: Support access to bpf map fields | expand |
On Fri, Jun 19, 2020 at 02:11:40PM -0700, Andrey Ignatov wrote: > v1->v2: > - move btf id cache to a new bpf_map_ops.map_btf_id field (Martin, Andrii); > - don't check btf names for collisions (Martin); > - drop btf_find_by_name_kind_next() patch since it was needed only for > collision check; > - don't fall back to `struct bpf_map` if a map type doesn't specify both > map_btf_name and map_btf_id; > > This patch set adds support to access bpf map fields from bpf programs > using btf_struct_access(). Acked-by: Martin KaFai Lau <kafai@fb.com>
On 6/19/20 11:11 PM, Andrey Ignatov wrote: > v1->v2: > - move btf id cache to a new bpf_map_ops.map_btf_id field (Martin, Andrii); > - don't check btf names for collisions (Martin); > - drop btf_find_by_name_kind_next() patch since it was needed only for > collision check; > - don't fall back to `struct bpf_map` if a map type doesn't specify both > map_btf_name and map_btf_id; > > This patch set adds support to access bpf map fields from bpf programs > using btf_struct_access(). > > That way a program can cast a pointer to map to either `struct bpf_map *` > or map type specific struct pointer such as `struct bpf_array *` or > `struct bpf_htab *`, and access necessary fields, e.g. map->max_entries. > > The fields, in turn, should be defined by a user provided struct with > preserve_access_index attribute or included from vmlinux.h. > > Please see patch 3 for more details on the feature and use-cases. > > Other patches: > > Patch 1 is refactoring to simplify btf_parse_vmlinux(). > Patch 2 is a rename to avoid having two different `struct bpf_htab`. > > Patch 4 enables access to map fields for all map types. > Patch 5 adds selftests. > Applied, thanks!