xref: /linux/tools/testing/selftests/bpf/progs/htab_reuse.c (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (C) 2023. Huawei Technologies Co., Ltd */
3 #include <linux/bpf.h>
4 #include <bpf/bpf_helpers.h>
5 
6 char _license[] SEC("license") = "GPL";
7 
8 struct htab_val {
9 	struct bpf_spin_lock lock;
10 	unsigned int data;
11 };
12 
13 struct {
14 	__uint(type, BPF_MAP_TYPE_HASH);
15 	__uint(max_entries, 64);
16 	__type(key, unsigned int);
17 	__type(value, struct htab_val);
18 	__uint(map_flags, BPF_F_NO_PREALLOC);
19 } htab SEC(".maps");
20