Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /* Copyright (c) 2020 Facebook */
0003 #include <stddef.h>
0004 #include <linux/bpf.h>
0005 #include <bpf/bpf_helpers.h>
0006 
0007 __attribute__ ((noinline))
0008 int f1(struct __sk_buff *skb)
0009 {
0010     return skb->len;
0011 }
0012 
0013 __attribute__ ((noinline))
0014 int f2(int val, struct __sk_buff *skb)
0015 {
0016     return f1(skb) + val;
0017 }
0018 
0019 __attribute__ ((noinline))
0020 int f3(int val, struct __sk_buff *skb, int var)
0021 {
0022     return f2(var, skb) + val;
0023 }
0024 
0025 __attribute__ ((noinline))
0026 int f4(struct __sk_buff *skb)
0027 {
0028     return f3(1, skb, 2);
0029 }
0030 
0031 __attribute__ ((noinline))
0032 int f5(struct __sk_buff *skb)
0033 {
0034     return f4(skb);
0035 }
0036 
0037 __attribute__ ((noinline))
0038 int f6(struct __sk_buff *skb)
0039 {
0040     return f5(skb);
0041 }
0042 
0043 __attribute__ ((noinline))
0044 int f7(struct __sk_buff *skb)
0045 {
0046     return f6(skb);
0047 }
0048 
0049 #ifndef NO_FN8
0050 __attribute__ ((noinline))
0051 int f8(struct __sk_buff *skb)
0052 {
0053     return f7(skb);
0054 }
0055 #endif
0056 
0057 SEC("tc")
0058 int test_cls(struct __sk_buff *skb)
0059 {
0060 #ifndef NO_FN8
0061     return f8(skb);
0062 #else
0063     return f7(skb);
0064 #endif
0065 }