20 lines · c
1// SPDX-License-Identifier: GPL-2.02/* Copyright (C) 2023. Huawei Technologies Co., Ltd */3#include <linux/bpf.h>4#include <bpf/bpf_helpers.h>5 6char _license[] SEC("license") = "GPL";7 8struct htab_val {9 struct bpf_spin_lock lock;10 unsigned int data;11};12 13struct {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