]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Introduce BPF_TRACE_x helper for the tracing tests
authorMartin KaFai Lau <kafai@fb.com>
Sat, 23 Nov 2019 20:25:04 +0000 (12:25 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 25 Nov 2019 01:12:11 +0000 (17:12 -0800)
commit4d7eb9f3b7512c3e07b7e5a4cf25797e24d7e457
tree9db74c8c6aaa198f2d163d066abe228f24bb22d5
parent0ce6ce2c5f8b6b32160cf010a1c712ac6214604c
bpf: Introduce BPF_TRACE_x helper for the tracing tests

For BPF_PROG_TYPE_TRACING, the bpf_prog's ctx is an array of u64.
This patch borrows the idea from BPF_CALL_x in filter.h to
convert a u64 to the arg type of the traced function.

The new BPF_TRACE_x has an arg to specify the return type of a bpf_prog.
It will be used in the future TCP-ops bpf_prog that may return "void".

The new macros are defined in the new header file "bpf_trace_helpers.h".
It is under selftests/bpf/ for now.  It could be moved to libbpf later
after seeing more upcoming non-tracing use cases.

The tests are changed to use these new macros also.  Hence,
the k[s]u8/16/32/64 are no longer needed and they are removed
from the bpf_helpers.h.

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20191123202504.1502696-1-kafai@fb.com
tools/lib/bpf/bpf_helpers.h
tools/testing/selftests/bpf/bpf_trace_helpers.h [new file with mode: 0644]
tools/testing/selftests/bpf/progs/fentry_test.c
tools/testing/selftests/bpf/progs/fexit_bpf2bpf.c
tools/testing/selftests/bpf/progs/fexit_test.c
tools/testing/selftests/bpf/progs/kfree_skb.c
tools/testing/selftests/bpf/progs/test_overhead.c