xref: /linux/tools/testing/selftests/bpf/progs/test_xdp_with_devmap_frags_helpers.c (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/bpf.h>
3 #include <bpf/bpf_helpers.h>
4 
5 struct {
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  */
15 SEC("xdp/devmap")
xdp_dummy_dm(struct xdp_md * ctx)16 int xdp_dummy_dm(struct xdp_md *ctx)
17 {
18 	return XDP_PASS;
19 }
20 
21 SEC("xdp.frags/devmap")
xdp_dummy_dm_frags(struct xdp_md * ctx)22 int xdp_dummy_dm_frags(struct xdp_md *ctx)
23 {
24 	return XDP_PASS;
25 }
26 
27 char _license[] SEC("license") = "GPL";
28