xref: /linux/tools/testing/selftests/bpf/progs/htab_reuse.c (revision 58f6259b7a08f8d47d4629609703d358b042f0fd)
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