]> Git Repo - J-linux.git/blob - tools/testing/selftests/bpf/progs/kfunc_call_test_subprog.c
Merge tag 'vfs-6.13-rc7.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
[J-linux.git] / tools / testing / selftests / bpf / progs / kfunc_call_test_subprog.c
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2021 Facebook */
3 #include "../bpf_testmod/bpf_testmod_kfunc.h"
4
5 extern const int bpf_prog_active __ksym;
6 int active_res = -1;
7 int sk_state_res = -1;
8
9 int __noinline f1(struct __sk_buff *skb)
10 {
11         struct bpf_sock *sk = skb->sk;
12         int *active;
13
14         if (!sk)
15                 return -1;
16
17         sk = bpf_sk_fullsock(sk);
18         if (!sk)
19                 return -1;
20
21         active = (int *)bpf_per_cpu_ptr(&bpf_prog_active,
22                                         bpf_get_smp_processor_id());
23         if (active)
24                 active_res = *active;
25
26         sk_state_res = bpf_kfunc_call_test3((struct sock *)sk)->__sk_common.skc_state;
27
28         return (__u32)bpf_kfunc_call_test1((struct sock *)sk, 1, 2, 3, 4);
29 }
30
31 SEC("tc")
32 int kfunc_call_test1(struct __sk_buff *skb)
33 {
34         return f1(skb);
35 }
36
37 char _license[] SEC("license") = "GPL";
This page took 0.027905 seconds and 4 git commands to generate.