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 int f3(int, struct __sk_buff *skb);
0014 
0015 __attribute__ ((noinline))
0016 int f2(int val, struct __sk_buff *skb)
0017 {
0018     return f1(skb) + f3(val, skb + 1); /* type mismatch */
0019 }
0020 
0021 __attribute__ ((noinline))
0022 int f3(int val, struct __sk_buff *skb)
0023 {
0024     return skb->ifindex * val;
0025 }
0026 
0027 SEC("tc")
0028 int test_cls(struct __sk_buff *skb)
0029 {
0030     return f1(skb) + f2(2, skb) + f3(3, skb);
0031 }