From a938f0b814c3578d9608be02ef72b45d2b10cf4b Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Sun, 19 Dec 2021 22:57:52 +0100 Subject: sys/linux: support per-map-type extra fields for MAP_CREATE The structure used for BPF map creation now has an additional field, map_extra, introduced in [1] upstream. The definition of that field depends on the map type being created and is only used by bloom filter maps for now. For bloom filter maps, the 4 lower bits define the number of hash functions to use. 1 - https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9330986c03006 Signed-off-by: Paul Chaignon --- sys/linux/bpf.txt | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'sys/linux') diff --git a/sys/linux/bpf.txt b/sys/linux/bpf.txt index 30fecac48..57034afb7 100644 --- a/sys/linux/bpf.txt +++ b/sys/linux/bpf.txt @@ -69,7 +69,12 @@ bpf$LINK_GET_NEXT_ID(cmd const[BPF_LINK_GET_NEXT_ID], arg ptr[inout, bpf_link_ge bpf$LINK_DETACH(cmd const[BPF_LINK_DETACH], arg ptr[in, fd_bpf_link], size len[arg]) bpf$PROG_BIND_MAP(cmd const[BPF_PROG_BIND_MAP], arg ptr[in, bpf_prog_bind_map_arg], size len[arg]) -bpf_map_create_arg { +bpf_map_create_arg [ + base bpf_map_create_arg_base + bloom_filter bpf_map_create_arg_bf +] + +bpf_map_create_arg_base { type flags[bpf_map_type, int32] ksize int32 vsize int32 @@ -83,6 +88,24 @@ bpf_map_create_arg { btf_key_type_id btf_opt_type_id btf_value_type_id btf_opt_type_id btf_vmlinux_type_id btf_opt_type_id + map_extra const[0, int64] +} + +bpf_map_create_arg_bf { + type const[BPF_MAP_TYPE_BLOOM_FILTER, int32] + ksize int32 + vsize int32 + max int32 + flags flags[map_flags, int32] + inner fd_bpf_map[opt] + node int32 + map_name array[const[0, int8], BPF_OBJ_NAME_LEN] + map_ifindex ifindex[opt] + btf_fd fd_btf[opt] + btf_key_type_id btf_opt_type_id + btf_value_type_id btf_opt_type_id + btf_vmlinux_type_id btf_opt_type_id + map_extra int64[0:15] } bpf_map_get_fd_by_id_arg { -- cgit mrf-deployment