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> 6 7 __attribute__ ((noinline)) f1(struct __sk_buff * skb)8int f1(struct __sk_buff *skb) 9 { 10 return skb->len; 11 } 12 13 __attribute__ ((noinline)) f2(int val,struct __sk_buff * skb)14int f2(int val, struct __sk_buff *skb) 15 { 16 return f1(skb) + val; 17 } 18 19 __attribute__ ((noinline)) f3(int val,struct __sk_buff * skb,int var)20int f3(int val, struct __sk_buff *skb, int var) 21 { 22 return f2(var, skb) + val; 23 } 24 25 __attribute__ ((noinline)) f4(struct __sk_buff * skb)26int f4(struct __sk_buff *skb) 27 { 28 return f3(1, skb, 2); 29 } 30 31 __attribute__ ((noinline)) f5(struct __sk_buff * skb)32int f5(struct __sk_buff *skb) 33 { 34 return f4(skb); 35 } 36 37 __attribute__ ((noinline)) f6(struct __sk_buff * skb)38int f6(struct __sk_buff *skb) 39 { 40 return f5(skb); 41 } 42 43 __attribute__ ((noinline)) f7(struct __sk_buff * skb)44int f7(struct __sk_buff *skb) 45 { 46 return f6(skb); 47 } 48 49 #ifndef NO_FN8 50 __attribute__ ((noinline)) f8(struct __sk_buff * skb)51int f8(struct __sk_buff *skb) 52 { 53 return f7(skb); 54 } 55 #endif 56 57 SEC("tc") test_cls(struct __sk_buff * skb)58int test_cls(struct __sk_buff *skb) 59 { 60 #ifndef NO_FN8 61 return f8(skb); 62 #else 63 return f7(skb); 64 #endif 65 } 66