xref: /linux/tools/testing/selftests/bpf/progs/tracing_struct_many_args.c (revision a1ff5a7d78a036d6c2178ee5acd6ba4946243800)
1 // SPDX-License-Identifier: GPL-2.0
2 #include <vmlinux.h>
3 #include <bpf/bpf_tracing.h>
4 #include <bpf/bpf_helpers.h>
5 
6 struct bpf_testmod_struct_arg_4 {
7 	u64 a;
8 	int b;
9 };
10 
11 struct bpf_testmod_struct_arg_5 {
12 	char a;
13 	short b;
14 	int c;
15 	long d;
16 };
17 
18 long t7_a, t7_b, t7_c, t7_d, t7_e, t7_f_a, t7_f_b, t7_ret;
19 long t8_a, t8_b, t8_c, t8_d, t8_e, t8_f_a, t8_f_b, t8_g, t8_ret;
20 long t9_a, t9_b, t9_c, t9_d, t9_e, t9_f, t9_g, t9_h_a, t9_h_b, t9_h_c, t9_h_d, t9_i, t9_ret;
21 
22 SEC("fentry/bpf_testmod_test_struct_arg_7")
BPF_PROG2(test_struct_many_args_1,__u64,a,void *,b,short,c,int,d,void *,e,struct bpf_testmod_struct_arg_4,f)23 int BPF_PROG2(test_struct_many_args_1, __u64, a, void *, b, short, c, int, d,
24 	      void *, e, struct bpf_testmod_struct_arg_4, f)
25 {
26 	t7_a = a;
27 	t7_b = (long)b;
28 	t7_c = c;
29 	t7_d = d;
30 	t7_e = (long)e;
31 	t7_f_a = f.a;
32 	t7_f_b = f.b;
33 	return 0;
34 }
35 
36 SEC("fexit/bpf_testmod_test_struct_arg_7")
BPF_PROG2(test_struct_many_args_2,__u64,a,void *,b,short,c,int,d,void *,e,struct bpf_testmod_struct_arg_4,f,int,ret)37 int BPF_PROG2(test_struct_many_args_2, __u64, a, void *, b, short, c, int, d,
38 	      void *, e, struct bpf_testmod_struct_arg_4, f, int, ret)
39 {
40 	t7_ret = ret;
41 	return 0;
42 }
43 
44 SEC("fentry/bpf_testmod_test_struct_arg_8")
BPF_PROG2(test_struct_many_args_3,__u64,a,void *,b,short,c,int,d,void *,e,struct bpf_testmod_struct_arg_4,f,int,g)45 int BPF_PROG2(test_struct_many_args_3, __u64, a, void *, b, short, c, int, d,
46 	      void *, e, struct bpf_testmod_struct_arg_4, f, int, g)
47 {
48 	t8_a = a;
49 	t8_b = (long)b;
50 	t8_c = c;
51 	t8_d = d;
52 	t8_e = (long)e;
53 	t8_f_a = f.a;
54 	t8_f_b = f.b;
55 	t8_g = g;
56 	return 0;
57 }
58 
59 SEC("fexit/bpf_testmod_test_struct_arg_8")
BPF_PROG2(test_struct_many_args_4,__u64,a,void *,b,short,c,int,d,void *,e,struct bpf_testmod_struct_arg_4,f,int,g,int,ret)60 int BPF_PROG2(test_struct_many_args_4, __u64, a, void *, b, short, c, int, d,
61 	      void *, e, struct bpf_testmod_struct_arg_4, f, int, g,
62 	      int, ret)
63 {
64 	t8_ret = ret;
65 	return 0;
66 }
67 
68 SEC("fentry/bpf_testmod_test_struct_arg_9")
BPF_PROG2(test_struct_many_args_5,__u64,a,void *,b,short,c,int,d,void *,e,char,f,short,g,struct bpf_testmod_struct_arg_5,h,long,i)69 int BPF_PROG2(test_struct_many_args_5, __u64, a, void *, b, short, c, int, d, void *, e,
70 	      char, f, short, g, struct bpf_testmod_struct_arg_5, h, long, i)
71 {
72 	t9_a = a;
73 	t9_b = (long)b;
74 	t9_c = c;
75 	t9_d = d;
76 	t9_e = (long)e;
77 	t9_f = f;
78 	t9_g = g;
79 	t9_h_a = h.a;
80 	t9_h_b = h.b;
81 	t9_h_c = h.c;
82 	t9_h_d = h.d;
83 	t9_i = i;
84 	return 0;
85 }
86 
87 SEC("fexit/bpf_testmod_test_struct_arg_9")
BPF_PROG2(test_struct_many_args_6,__u64,a,void *,b,short,c,int,d,void *,e,char,f,short,g,struct bpf_testmod_struct_arg_5,h,long,i,int,ret)88 int BPF_PROG2(test_struct_many_args_6, __u64, a, void *, b, short, c, int, d, void *, e,
89 	      char, f, short, g, struct bpf_testmod_struct_arg_5, h, long, i, int, ret)
90 {
91 	t9_ret = ret;
92 	return 0;
93 }
94 
95 char _license[] SEC("license") = "GPL";
96