1 // SPDX-License-Identifier: GPL-2.0-only
2 /* Copyright (c) 2020 Facebook */
5 #include <bpf/bpf_helpers.h>
8 #define MAX_STACK (512 - 3 * 32)
10 static __attribute__ ((noinline))
11 int f0(int var, struct __sk_buff *skb)
16 __attribute__ ((noinline))
17 int f1(struct __sk_buff *skb)
19 volatile char buf[MAX_STACK] = {};
21 __sink(buf[MAX_STACK - 1]);
23 return f0(0, skb) + skb->len;
26 int f3(int, struct __sk_buff *skb, int);
28 __attribute__ ((noinline))
29 int f2(int val, struct __sk_buff *skb)
31 return f1(skb) + f3(val, skb, 1);
34 __attribute__ ((noinline))
35 int f3(int val, struct __sk_buff *skb, int var)
37 volatile char buf[MAX_STACK] = {};
39 __sink(buf[MAX_STACK - 1]);
41 return skb->ifindex * val * var;
46 int global_func2(struct __sk_buff *skb)
48 return f0(1, skb) + f1(skb) + f2(2, skb) + f3(3, skb, 4);