treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / tools / testing / selftests / bpf / progs / test_global_func3.c
blob86f0ecb304fcfe907b844f6be44db827d287bb5d
1 // SPDX-License-Identifier: GPL-2.0-only
2 /* Copyright (c) 2020 Facebook */
3 #include <stddef.h>
4 #include <linux/bpf.h>
5 #include <bpf/bpf_helpers.h>
7 __attribute__ ((noinline))
8 int f1(struct __sk_buff *skb)
10 return skb->len;
13 __attribute__ ((noinline))
14 int f2(int val, struct __sk_buff *skb)
16 return f1(skb) + val;
19 __attribute__ ((noinline))
20 int f3(int val, struct __sk_buff *skb, int var)
22 return f2(var, skb) + val;
25 __attribute__ ((noinline))
26 int f4(struct __sk_buff *skb)
28 return f3(1, skb, 2);
31 __attribute__ ((noinline))
32 int f5(struct __sk_buff *skb)
34 return f4(skb);
37 __attribute__ ((noinline))
38 int f6(struct __sk_buff *skb)
40 return f5(skb);
43 __attribute__ ((noinline))
44 int f7(struct __sk_buff *skb)
46 return f6(skb);
49 #ifndef NO_FN8
50 __attribute__ ((noinline))
51 int f8(struct __sk_buff *skb)
53 return f7(skb);
55 #endif
57 SEC("classifier/test")
58 int test_cls(struct __sk_buff *skb)
60 #ifndef NO_FN8
61 return f8(skb);
62 #else
63 return f7(skb);
64 #endif