1 /* SPDX-License-Identifier: GPL-2.0 */
3 #ifndef _BPF_TESTMOD_KFUNC_H
4 #define _BPF_TESTMOD_KFUNC_H
8 #include <bpf/bpf_helpers.h>
11 struct prog_test_member1 {
15 struct prog_test_member {
16 struct prog_test_member1 m;
20 struct prog_test_ref_kfunc {
23 struct prog_test_member memb;
24 struct prog_test_ref_kfunc *next;
29 struct prog_test_pass1 {
42 struct prog_test_pass2 {
47 unsigned long arr3[8];
51 struct prog_test_fail1 {
56 struct prog_test_fail2 {
58 struct prog_test_pass1 x;
61 struct prog_test_fail3 {
67 struct init_sock_args {
73 char addr[sizeof(struct __kernel_sockaddr_storage)];
78 struct addr_args addr;
83 struct prog_test_ref_kfunc *
84 bpf_kfunc_call_test_acquire(unsigned long *scalar_ptr) __ksym;
85 void bpf_kfunc_call_test_release(struct prog_test_ref_kfunc *p) __ksym;
86 void bpf_kfunc_call_test_ref(struct prog_test_ref_kfunc *p) __ksym;
88 void bpf_kfunc_call_test_mem_len_pass1(void *mem, int len) __ksym;
89 int *bpf_kfunc_call_test_get_rdwr_mem(struct prog_test_ref_kfunc *p, const int rdwr_buf_size) __ksym;
90 int *bpf_kfunc_call_test_get_rdonly_mem(struct prog_test_ref_kfunc *p, const int rdonly_buf_size) __ksym;
91 int *bpf_kfunc_call_test_acq_rdonly_mem(struct prog_test_ref_kfunc *p, const int rdonly_buf_size) __ksym;
92 void bpf_kfunc_call_int_mem_release(int *p) __ksym;
94 /* The bpf_kfunc_call_test_static_unused_arg is defined as static,
95 * but bpf program compilation needs to see it as global symbol.
98 u32 bpf_kfunc_call_test_static_unused_arg(u32 arg, u32 unused) __ksym;
101 void bpf_testmod_test_mod_kfunc(int i) __ksym;
103 __u64 bpf_kfunc_call_test1(struct sock *sk, __u32 a, __u64 b,
104 __u32 c, __u64 d) __ksym;
105 int bpf_kfunc_call_test2(struct sock *sk, __u32 a, __u32 b) __ksym;
106 struct sock *bpf_kfunc_call_test3(struct sock *sk) __ksym;
107 long bpf_kfunc_call_test4(signed char a, short b, int c, long d) __ksym;
109 void bpf_kfunc_call_test_pass_ctx(struct __sk_buff *skb) __ksym;
110 void bpf_kfunc_call_test_pass1(struct prog_test_pass1 *p) __ksym;
111 void bpf_kfunc_call_test_pass2(struct prog_test_pass2 *p) __ksym;
112 void bpf_kfunc_call_test_mem_len_fail2(__u64 *mem, int len) __ksym;
114 void bpf_kfunc_call_test_destructive(void) __ksym;
115 void bpf_kfunc_call_test_sleepable(void) __ksym;
117 void bpf_kfunc_call_test_offset(struct prog_test_ref_kfunc *p);
118 struct prog_test_member *bpf_kfunc_call_memb_acquire(void);
119 void bpf_kfunc_call_memb1_release(struct prog_test_member1 *p);
120 void bpf_kfunc_call_test_fail1(struct prog_test_fail1 *p);
121 void bpf_kfunc_call_test_fail2(struct prog_test_fail2 *p);
122 void bpf_kfunc_call_test_fail3(struct prog_test_fail3 *p);
123 void bpf_kfunc_call_test_mem_len_fail1(void *mem, int len);
125 void bpf_kfunc_common_test(void) __ksym;
127 int bpf_kfunc_init_sock(struct init_sock_args *args) __ksym;
128 void bpf_kfunc_close_sock(void) __ksym;
129 int bpf_kfunc_call_kernel_connect(struct addr_args *args) __ksym;
130 int bpf_kfunc_call_kernel_bind(struct addr_args *args) __ksym;
131 int bpf_kfunc_call_kernel_listen(void) __ksym;
132 int bpf_kfunc_call_kernel_sendmsg(struct sendmsg_args *args) __ksym;
133 int bpf_kfunc_call_sock_sendmsg(struct sendmsg_args *args) __ksym;
134 int bpf_kfunc_call_kernel_getsockname(struct addr_args *args) __ksym;
135 int bpf_kfunc_call_kernel_getpeername(struct addr_args *args) __ksym;
137 #endif /* _BPF_TESTMOD_KFUNC_H */