Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b45d5511 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

perf bpf: Add bpf_map() helper

To make the declaration of maps more compact, the following patches will
make use of it.

Standardizing on it will allow to add the BTF details, i.e.
BPF_ANNOTATE_KV_PAIR() (tools/testing/selftests/bpf/bpf_helpers.h)
transparently.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
Cc: Martin KaFai Lau <kafai@fb.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Yonghong Song <yhs@fb.com>
Link: https://lkml.kernel.org/n/tip-h3q9rxxkbzetgnbro5rclqft@git.kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 35ea7e4b
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -18,6 +18,14 @@ struct bpf_map {
        unsigned int numa_node;
};

#define bpf_map(name, _type, type_key, type_val, _max_entries)	\
struct bpf_map SEC("maps") name = {				\
	.type	     = BPF_MAP_TYPE_##_type,			\
	.key_size    = sizeof(type_key),			\
	.value_size  = sizeof(type_val),			\
	.max_entries = _max_entries,				\
}

/*
 * FIXME: this should receive .max_entries as a parameter, as careful
 *	  tuning of these limits is needed to avoid hitting limits that