xref: /linux/tools/testing/selftests/bpf/progs/lpm_trie_map.c (revision 07fdad3a93756b872da7b53647715c48d0f4a2d0)
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/bpf.h>
3 #include <bpf/bpf_helpers.h>
4 #include <bpf/bpf_tracing.h>
5 
6 #define MAX_ENTRIES 100000000
7 
8 struct trie_key {
9 	__u32 prefixlen;
10 	__u32 data;
11 };
12 
13 struct {
14 	__uint(type, BPF_MAP_TYPE_LPM_TRIE);
15 	__type(key, struct trie_key);
16 	__type(value, __u32);
17 	__uint(map_flags, BPF_F_NO_PREALLOC);
18 	__uint(max_entries, MAX_ENTRIES);
19 } trie_free_map SEC(".maps");
20