WIP FPC-III support
[linux/fpc-iii.git] / tools / testing / selftests / bpf / progs / test_global_func6.c
blob69e19c64e10b6b9d07c3675c5969a010ff31ffcf
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 int f3(int, struct __sk_buff *skb);
15 __attribute__ ((noinline))
16 int f2(int val, struct __sk_buff *skb)
18 return f1(skb) + f3(val, skb + 1); /* type mismatch */
21 __attribute__ ((noinline))
22 int f3(int val, struct __sk_buff *skb)
24 return skb->ifindex * val;
27 SEC("classifier/test")
28 int test_cls(struct __sk_buff *skb)
30 return f1(skb) + f2(2, skb) + f3(3, skb);