xref: /linux/tools/testing/selftests/bpf/progs/kfunc_module_order.c (revision a3f143c461444c0b56360bbf468615fa814a8372)
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/bpf.h>
3 #include <bpf/bpf_helpers.h>
4 
5 extern int bpf_test_modorder_retx(void) __ksym;
6 extern int bpf_test_modorder_rety(void) __ksym;
7 
8 SEC("classifier")
9 int call_kfunc_xy(struct __sk_buff *skb)
10 {
11 	int ret1, ret2;
12 
13 	ret1 = bpf_test_modorder_retx();
14 	ret2 = bpf_test_modorder_rety();
15 
16 	return ret1 == 'x' && ret2 == 'y' ? 0 : -1;
17 }
18 
19 SEC("classifier")
20 int call_kfunc_yx(struct __sk_buff *skb)
21 {
22 	int ret1, ret2;
23 
24 	ret1 = bpf_test_modorder_rety();
25 	ret2 = bpf_test_modorder_retx();
26 
27 	return ret1 == 'y' && ret2 == 'x' ? 0 : -1;
28 }
29 
30 char _license[] SEC("license") = "GPL";
31