File Index
Files and directories
Sign in
FILE

test_xdp_devmap_tailcall.c

File preview with syntax highlighting.

linux-6.19.14/tools/testing/selftests/bpf/progs/test_xdp_devmap_tailcall.c C
 1// SPDX-License-Identifier: GPL-2.0
 2
 3#include "vmlinux.h"
 4#include <bpf/bpf_helpers.h>
 5#include <bpf/bpf_tracing.h>
 6
 7SEC("xdp")
 8int xdp_devmap(struct xdp_md *ctx)
 9{
10	return ctx->egress_ifindex;
11}
12
13struct {
14	__uint(type, BPF_MAP_TYPE_PROG_ARRAY);
15	__uint(max_entries, 1);
16	__uint(key_size, sizeof(__u32));
17	__array(values, int (void *));
18} xdp_map SEC(".maps") = {
19	.values = {
20		[0] = (void *)&xdp_devmap,
21	},
22};
23
24SEC("xdp")
25int xdp_entry(struct xdp_md *ctx)
26{
27	bpf_tail_call(ctx, &xdp_map, 0);
28	return 0;
29}
~/ Read-only file preview.