1// SPDX-License-Identifier: GPL-2.0
2
3#include <linux/bpf.h>
4#include <bpf/bpf_helpers.h>
5
6struct {
7	__uint(type, BPF_MAP_TYPE_DEVMAP);
8	__uint(max_entries, 8);
9	__uint(key_size, sizeof(int));
10	__uint(value_size, sizeof(int));
11} tx_port SEC(".maps");
12
13SEC("redirect_map_0")
14int xdp_redirect_map_0(struct xdp_md *xdp)
15{
16	return bpf_redirect_map(&tx_port, 0, 0);
17}
18
19SEC("redirect_map_1")
20int xdp_redirect_map_1(struct xdp_md *xdp)
21{
22	return bpf_redirect_map(&tx_port, 1, 0);
23}
24
25SEC("redirect_map_2")
26int xdp_redirect_map_2(struct xdp_md *xdp)
27{
28	return bpf_redirect_map(&tx_port, 2, 0);
29}
30
31char _license[] SEC("license") = "GPL";
32