xref: /linux/tools/testing/selftests/net/lib/xdp_cpumap.bpf.c (revision f16d85cd3de9d0c761b74155b4cbe2f20d3dcf80)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include <linux/bpf.h>
4 #include <bpf/bpf_helpers.h>
5 
6 struct {
7 	__uint(type, BPF_MAP_TYPE_CPUMAP);
8 	__uint(max_entries, 1);
9 	__type(key, __u32);
10 	__type(value, __u32);
11 } map_cpumap SEC(".maps");
12 
13 SEC("xdp.frags")
14 int xdp_cpumap_prog_frags(struct xdp_md *ctx)
15 {
16 	return bpf_redirect_map(&map_cpumap, 0, XDP_DROP);
17 }
18 
19 char _license[] SEC("license") = "GPL";
20