]> Git Repo - J-linux.git/blob - tools/testing/selftests/bpf/progs/test_xdp_context_test_run.c
Merge tag 'vfs-6.13-rc7.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
[J-linux.git] / tools / testing / selftests / bpf / progs / test_xdp_context_test_run.c
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/bpf.h>
3 #include <bpf/bpf_helpers.h>
4
5 SEC("xdp")
6 int xdp_context(struct xdp_md *xdp)
7 {
8         void *data = (void *)(long)xdp->data;
9         __u32 *metadata = (void *)(long)xdp->data_meta;
10         __u32 ret;
11
12         if (metadata + 1 > data)
13                 return XDP_ABORTED;
14         ret = *metadata;
15         if (bpf_xdp_adjust_meta(xdp, 4))
16                 return XDP_ABORTED;
17         return ret;
18 }
19
20 char _license[] SEC("license") = "GPL";
This page took 0.027765 seconds and 4 git commands to generate.