1 // SPDX-License-Identifier: GPL-2.0
4 #include <bpf/bpf_helpers.h>
9 __uint(type, BPF_MAP_TYPE_CPUMAP);
10 __uint(key_size, sizeof(__u32));
11 __uint(value_size, sizeof(struct bpf_cpumap_val));
12 __uint(max_entries, 4);
13 } cpu_map SEC(".maps");
15 __u32 redirect_count = 0;
18 int xdp_redir_prog(struct xdp_md *ctx)
20 return bpf_redirect_map(&cpu_map, 0, 0);
24 int xdp_dummy_prog(struct xdp_md *ctx)
30 int xdp_dummy_cm(struct xdp_md *ctx)
32 if (bpf_get_smp_processor_id() == 0)
35 if (ctx->ingress_ifindex == IFINDEX_LO)
41 SEC("xdp.frags/cpumap")
42 int xdp_dummy_cm_frags(struct xdp_md *ctx)
47 char _license[] SEC("license") = "GPL";