]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit - net/core/ptp_classifier.c
bpf: Refactor BPF_PROG_RUN into a function
authorAndrii Nakryiko <andrii@kernel.org>
Sun, 15 Aug 2021 07:05:54 +0000 (00:05 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 16 Aug 2021 22:45:07 +0000 (00:45 +0200)
commitfb7dd8bca0139fd73d3f4a6cd257b11731317ded
tree9006ce2d61e9cd8c9fa353e5cff61d5f6da09031
parent1bda52f80471260bcc7391f4e6919effedfc88d8
bpf: Refactor BPF_PROG_RUN into a function

Turn BPF_PROG_RUN into a proper always inlined function. No functional and
performance changes are intended, but it makes it much easier to understand
what's going on with how BPF programs are actually get executed. It's more
obvious what types and callbacks are expected. Also extra () around input
parameters can be dropped, as well as `__` variable prefixes intended to avoid
naming collisions, which makes the code simpler to read and write.

This refactoring also highlighted one extra issue. BPF_PROG_RUN is both
a macro and an enum value (BPF_PROG_RUN == BPF_PROG_TEST_RUN). Turning
BPF_PROG_RUN into a function causes naming conflict compilation error. So
rename BPF_PROG_RUN into lower-case bpf_prog_run(), similar to
bpf_prog_run_xdp(), bpf_prog_run_pin_on_cpu(), etc. All existing callers of
BPF_PROG_RUN, the macro, are switched to bpf_prog_run() explicitly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20210815070609.987780-2-andrii@kernel.org
20 files changed:
Documentation/networking/filter.rst
drivers/media/rc/bpf-lirc.c
drivers/net/ppp/ppp_generic.c
drivers/net/team/team_mode_loadbalance.c
include/linux/bpf.h
include/linux/filter.h
kernel/bpf/bpf_iter.c
kernel/bpf/cgroup.c
kernel/bpf/core.c
kernel/bpf/trampoline.c
kernel/bpf/verifier.c
kernel/events/core.c
kernel/trace/bpf_trace.c
lib/test_bpf.c
net/bpf/test_run.c
net/core/filter.c
net/core/ptp_classifier.c
net/netfilter/xt_bpf.c
net/sched/act_bpf.c
net/sched/cls_bpf.c