1// SPDX-License-Identifier: GPL-2.0
2#include <linux/bpf.h>
3#include <bpf/bpf_helpers.h>
4
5struct {
6 __uint(type, BPF_MAP_TYPE_DEVMAP);
7 __uint(key_size, sizeof(__u32));
8 __uint(value_size, sizeof(struct bpf_devmap_val));
9 __uint(max_entries, 4);
10} dm_ports SEC(".maps");
11
12/* valid program on DEVMAP entry via SEC name;
13 * has access to egress and ingress ifindex
14 */
15SEC("xdp/devmap")
16int xdp_dummy_dm(struct xdp_md *ctx)
17{
18 return XDP_PASS;
19}
20
21SEC("xdp.frags/devmap")
22int xdp_dummy_dm_frags(struct xdp_md *ctx)
23{
24 return XDP_PASS;
25}
26
27char _license[] SEC("license") = "GPL";
28

source code of linux/tools/testing/selftests/bpf/progs/test_xdp_with_devmap_frags_helpers.c