18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */
28c2ecf20Sopenharmony_ci#ifndef __BPF_LEGACY__
38c2ecf20Sopenharmony_ci#define __BPF_LEGACY__
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#define BPF_ANNOTATE_KV_PAIR(name, type_key, type_val)		\
68c2ecf20Sopenharmony_ci	struct ____btf_map_##name {				\
78c2ecf20Sopenharmony_ci		type_key key;					\
88c2ecf20Sopenharmony_ci		type_val value;					\
98c2ecf20Sopenharmony_ci	};							\
108c2ecf20Sopenharmony_ci	struct ____btf_map_##name				\
118c2ecf20Sopenharmony_ci	__attribute__ ((section(".maps." #name), used))		\
128c2ecf20Sopenharmony_ci		____btf_map_##name = { }
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/* llvm builtin functions that eBPF C program may use to
158c2ecf20Sopenharmony_ci * emit BPF_LD_ABS and BPF_LD_IND instructions
168c2ecf20Sopenharmony_ci */
178c2ecf20Sopenharmony_ciunsigned long long load_byte(void *skb,
188c2ecf20Sopenharmony_ci			     unsigned long long off) asm("llvm.bpf.load.byte");
198c2ecf20Sopenharmony_ciunsigned long long load_half(void *skb,
208c2ecf20Sopenharmony_ci			     unsigned long long off) asm("llvm.bpf.load.half");
218c2ecf20Sopenharmony_ciunsigned long long load_word(void *skb,
228c2ecf20Sopenharmony_ci			     unsigned long long off) asm("llvm.bpf.load.word");
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#endif
258c2ecf20Sopenharmony_ci
26