diff options
Diffstat (limited to 'tools/testing/selftests/bpf/bpf_helpers.h')
-rw-r--r-- | tools/testing/selftests/bpf/bpf_helpers.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/bpf_helpers.h b/tools/testing/selftests/bpf/bpf_helpers.h index 5f6f9e7aba2a..e6d243b7cd74 100644 --- a/tools/testing/selftests/bpf/bpf_helpers.h +++ b/tools/testing/selftests/bpf/bpf_helpers.h | |||
@@ -8,6 +8,14 @@ | |||
8 | */ | 8 | */ |
9 | #define SEC(NAME) __attribute__((section(NAME), used)) | 9 | #define SEC(NAME) __attribute__((section(NAME), used)) |
10 | 10 | ||
11 | /* helper macro to print out debug messages */ | ||
12 | #define bpf_printk(fmt, ...) \ | ||
13 | ({ \ | ||
14 | char ____fmt[] = fmt; \ | ||
15 | bpf_trace_printk(____fmt, sizeof(____fmt), \ | ||
16 | ##__VA_ARGS__); \ | ||
17 | }) | ||
18 | |||
11 | /* helper functions called from eBPF programs written in C */ | 19 | /* helper functions called from eBPF programs written in C */ |
12 | static void *(*bpf_map_lookup_elem)(void *map, const void *key) = | 20 | static void *(*bpf_map_lookup_elem)(void *map, const void *key) = |
13 | (void *) BPF_FUNC_map_lookup_elem; | 21 | (void *) BPF_FUNC_map_lookup_elem; |
@@ -216,6 +224,7 @@ static void *(*bpf_sk_storage_get)(void *map, struct bpf_sock *sk, | |||
216 | (void *) BPF_FUNC_sk_storage_get; | 224 | (void *) BPF_FUNC_sk_storage_get; |
217 | static int (*bpf_sk_storage_delete)(void *map, struct bpf_sock *sk) = | 225 | static int (*bpf_sk_storage_delete)(void *map, struct bpf_sock *sk) = |
218 | (void *)BPF_FUNC_sk_storage_delete; | 226 | (void *)BPF_FUNC_sk_storage_delete; |
227 | static int (*bpf_send_signal)(unsigned sig) = (void *)BPF_FUNC_send_signal; | ||
219 | 228 | ||
220 | /* llvm builtin functions that eBPF C program may use to | 229 | /* llvm builtin functions that eBPF C program may use to |
221 | * emit BPF_LD_ABS and BPF_LD_IND instructions | 230 | * emit BPF_LD_ABS and BPF_LD_IND instructions |