xref: /linux/tools/testing/selftests/bpf/progs/test_global_func14.c (revision da1d9caf95def6f0320819cf941c9fd1069ba9e1)
1 // SPDX-License-Identifier: GPL-2.0-only
2 #include <stddef.h>
3 #include <linux/bpf.h>
4 #include <bpf/bpf_helpers.h>
5 
6 struct S;
7 
8 __noinline int foo(const struct S *s)
9 {
10 	if (s)
11 		return bpf_get_prandom_u32() < *(const int *) s;
12 
13 	return 0;
14 }
15 
16 SEC("cgroup_skb/ingress")
17 int test_cls(struct __sk_buff *skb)
18 {
19 
20 	return foo(NULL);
21 }
22