WIP FPC-III support
[linux/fpc-iii.git] / tools / testing / selftests / bpf / progs / test_skb_ctx.c
blobb02ea589ce7eaa308d36f81b75a7063de8713e3e
1 // SPDX-License-Identifier: GPL-2.0
3 #include <linux/bpf.h>
4 #include <bpf/bpf_helpers.h>
6 int _version SEC("version") = 1;
7 char _license[] SEC("license") = "GPL";
9 SEC("skb_ctx")
10 int process(struct __sk_buff *skb)
12 #pragma clang loop unroll(full)
13 for (int i = 0; i < 5; i++) {
14 if (skb->cb[i] != i + 1)
15 return 1;
16 skb->cb[i]++;
18 skb->priority++;
19 skb->tstamp++;
20 skb->mark++;
22 if (skb->wire_len != 100)
23 return 1;
24 if (skb->gso_segs != 8)
25 return 1;
26 if (skb->gso_size != 10)
27 return 1;
29 return 0;