1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* Copyright (c) 2020 Facebook */ 3 #ifndef _BPF_TESTMOD_H 4 #define _BPF_TESTMOD_H 5 6 #include <linux/types.h> 7 8 struct task_struct; 9 10 struct bpf_testmod_test_read_ctx { 11 char *buf; 12 loff_t off; 13 size_t len; 14 }; 15 16 struct bpf_testmod_test_write_ctx { 17 char *buf; 18 loff_t off; 19 size_t len; 20 }; 21 22 struct bpf_testmod_test_writable_ctx { 23 bool early_ret; 24 int val; 25 }; 26 27 /* BPF iter that returns *value* *n* times in a row */ 28 struct bpf_iter_testmod_seq { 29 s64 value; 30 int cnt; 31 }; 32 33 struct bpf_testmod_ops { 34 int (*test_1)(void); 35 void (*test_2)(int a, int b); 36 /* Used to test nullable arguments. */ 37 int (*test_maybe_null)(int dummy, struct task_struct *task); 38 int (*unsupported_ops)(void); 39 40 /* The following fields are used to test shadow copies. */ 41 char onebyte; 42 struct { 43 int a; 44 int b; 45 } unsupported; 46 int data; 47 48 /* The following pointers are used to test the maps having multiple 49 * pages of trampolines. 50 */ 51 int (*tramp_1)(int value); 52 int (*tramp_2)(int value); 53 int (*tramp_3)(int value); 54 int (*tramp_4)(int value); 55 int (*tramp_5)(int value); 56 int (*tramp_6)(int value); 57 int (*tramp_7)(int value); 58 int (*tramp_8)(int value); 59 int (*tramp_9)(int value); 60 int (*tramp_10)(int value); 61 int (*tramp_11)(int value); 62 int (*tramp_12)(int value); 63 int (*tramp_13)(int value); 64 int (*tramp_14)(int value); 65 int (*tramp_15)(int value); 66 int (*tramp_16)(int value); 67 int (*tramp_17)(int value); 68 int (*tramp_18)(int value); 69 int (*tramp_19)(int value); 70 int (*tramp_20)(int value); 71 int (*tramp_21)(int value); 72 int (*tramp_22)(int value); 73 int (*tramp_23)(int value); 74 int (*tramp_24)(int value); 75 int (*tramp_25)(int value); 76 int (*tramp_26)(int value); 77 int (*tramp_27)(int value); 78 int (*tramp_28)(int value); 79 int (*tramp_29)(int value); 80 int (*tramp_30)(int value); 81 int (*tramp_31)(int value); 82 int (*tramp_32)(int value); 83 int (*tramp_33)(int value); 84 int (*tramp_34)(int value); 85 int (*tramp_35)(int value); 86 int (*tramp_36)(int value); 87 int (*tramp_37)(int value); 88 int (*tramp_38)(int value); 89 int (*tramp_39)(int value); 90 int (*tramp_40)(int value); 91 }; 92 93 struct bpf_testmod_ops2 { 94 int (*test_1)(void); 95 }; 96 97 struct st_ops_args { 98 u64 a; 99 }; 100 101 struct bpf_testmod_st_ops { 102 int (*test_prologue)(struct st_ops_args *args); 103 int (*test_epilogue)(struct st_ops_args *args); 104 int (*test_pro_epilogue)(struct st_ops_args *args); 105 struct module *owner; 106 }; 107 108 #endif /* _BPF_TESTMOD_H */ 109