Commit 3811e275 authored by Quentin Monnet's avatar Quentin Monnet Committed by Andrii Nakryiko
Browse files

bpftool: Update the lists of names for maps and prog-attach types



To support the different BPF map or attach types, bpftool must remain
up-to-date with the types supported by the kernel. Let's update the
lists, by adding the missing Bloom filter map type and the perf_event
attach type.

Both missing items were found with test_bpftool_synctypes.py.

Signed-off-by: default avatarQuentin Monnet <quentin@isovalent.com>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211110114632.24537-6-quentin@isovalent.com
parent 986dec18
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ MAP COMMANDS
|		| **devmap** | **devmap_hash** | **sockmap** | **cpumap** | **xskmap** | **sockhash**
|		| **cgroup_storage** | **reuseport_sockarray** | **percpu_cgroup_storage**
|		| **queue** | **stack** | **sk_storage** | **struct_ops** | **ringbuf** | **inode_storage**
		| **task_storage** }
|		| **task_storage** | **bloom_filter** }

DESCRIPTION
===========
+2 −1
Original line number Diff line number Diff line
@@ -710,7 +710,8 @@ _bpftool()
                                hash_of_maps devmap devmap_hash sockmap cpumap \
                                xskmap sockhash cgroup_storage reuseport_sockarray \
                                percpu_cgroup_storage queue stack sk_storage \
                                struct_ops inode_storage task_storage ringbuf'
                                struct_ops ringbuf inode_storage task_storage \
                                bloom_filter'
                            COMPREPLY=( $( compgen -W "$BPFTOOL_MAP_CREATE_TYPES" -- "$cur" ) )
                            return 0
                            ;;
+1 −0
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ const char * const attach_type_name[__MAX_BPF_ATTACH_TYPE] = {
	[BPF_XDP]			= "xdp",
	[BPF_SK_REUSEPORT_SELECT]	= "sk_skb_reuseport_select",
	[BPF_SK_REUSEPORT_SELECT_OR_MIGRATE]	= "sk_skb_reuseport_select_or_migrate",
	[BPF_PERF_EVENT]		= "perf_event",
};

void p_err(const char *fmt, ...)
+2 −1
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ const char * const map_type_name[] = {
	[BPF_MAP_TYPE_RINGBUF]			= "ringbuf",
	[BPF_MAP_TYPE_INODE_STORAGE]		= "inode_storage",
	[BPF_MAP_TYPE_TASK_STORAGE]		= "task_storage",
	[BPF_MAP_TYPE_BLOOM_FILTER]		= "bloom_filter",
};

const size_t map_type_name_size = ARRAY_SIZE(map_type_name);
@@ -1477,7 +1478,7 @@ static int do_help(int argc, char **argv)
		"                 devmap | devmap_hash | sockmap | cpumap | xskmap | sockhash |\n"
		"                 cgroup_storage | reuseport_sockarray | percpu_cgroup_storage |\n"
		"                 queue | stack | sk_storage | struct_ops | ringbuf | inode_storage |\n"
		"                 task_storage }\n"
		"                 task_storage | bloom_filter }\n"
		"       " HELP_SPEC_OPTIONS " |\n"
		"                    {-f|--bpffs} | {-n|--nomount} }\n"
		"",