WIP FPC-III support
[linux/fpc-iii.git] / tools / testing / selftests / bpf / progs / loop5.c
blob913791923fa3249b584611e2e69628811bc1beeb
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2019 Facebook
3 #include <linux/bpf.h>
4 #include <bpf/bpf_helpers.h>
5 #define barrier() __asm__ __volatile__("": : :"memory")
7 char _license[] SEC("license") = "GPL";
9 SEC("socket")
10 int while_true(volatile struct __sk_buff* skb)
12 int i = 0;
14 while (1) {
15 if (skb->len)
16 i += 3;
17 else
18 i += 7;
19 if (i == 9)
20 break;
21 barrier();
22 if (i == 10)
23 break;
24 barrier();
25 if (i == 13)
26 break;
27 barrier();
28 if (i == 14)
29 break;
31 return i;