]> git.baikalelectronics.ru Git - kernel.git/commitdiff
bpf: Allow calling bpf_prog_test kfuncs in tracing programs
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Tue, 9 Aug 2022 21:30:31 +0000 (23:30 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 10 Aug 2022 01:46:11 +0000 (18:46 -0700)
In addition to TC hook, enable these in tracing programs so that they
can be used in selftests.

Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20220809213033.24147-2-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
net/bpf/test_run.c

index cbc9cd5058cbe87ee5ba76cc686ad2a81a12d8e5..d11209367dd0066c7b6bd3977f6b8f79bdfd9a05 100644 (file)
@@ -1628,6 +1628,7 @@ static int __init bpf_prog_test_run_init(void)
        int ret;
 
        ret = register_btf_kfunc_id_set(BPF_PROG_TYPE_SCHED_CLS, &bpf_prog_test_kfunc_set);
+       ret = ret ?: register_btf_kfunc_id_set(BPF_PROG_TYPE_TRACING, &bpf_prog_test_kfunc_set);
        return ret ?: register_btf_id_dtor_kfuncs(bpf_prog_test_dtor_kfunc,
                                                  ARRAY_SIZE(bpf_prog_test_dtor_kfunc),
                                                  THIS_MODULE);