]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Implement common macros/helpers for target iterators
authorYonghong Song <yhs@fb.com>
Sat, 9 May 2020 17:59:07 +0000 (10:59 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 10 May 2020 00:05:26 +0000 (17:05 -0700)
commitdddd3836f33efbb92ecfd5c74f24925f20851731
tree7297cfe0ea166ab5064887fd9af91c9e52bdfc83
parentf062f359c535bed9e03f59aaa0b0cafa92493bb7
bpf: Implement common macros/helpers for target iterators

Macro DEFINE_BPF_ITER_FUNC is implemented so target
can define an init function to capture the BTF type
which represents the target.

The bpf_iter_meta is a structure holding meta data, common
to all targets in the bpf program.

Additional marker functions are called before or after
bpf_seq_read() show()/next()/stop() callback functions
to help calculate precise seq_num and whether call bpf_prog
inside stop().

Two functions, bpf_iter_get_info() and bpf_iter_run_prog(),
are implemented so target can get needed information from
bpf_iter infrastructure and can run the program.

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200509175907.2475956-1-yhs@fb.com
include/linux/bpf.h
kernel/bpf/bpf_iter.c