Blame include/bpf_elf.h

Packit Service 3880ab
/* SPDX-License-Identifier: GPL-2.0 */
Packit Service 3880ab
#ifndef __BPF_ELF__
Packit Service 3880ab
#define __BPF_ELF__
Packit Service 3880ab
Packit Service 3880ab
#include <asm/types.h>
Packit Service 3880ab
Packit Service 3880ab
/* Note:
Packit Service 3880ab
 *
Packit Service 3880ab
 * Below ELF section names and bpf_elf_map structure definition
Packit Service 3880ab
 * are not (!) kernel ABI. It's rather a "contract" between the
Packit Service 3880ab
 * application and the BPF loader in tc. For compatibility, the
Packit Service 3880ab
 * section names should stay as-is. Introduction of aliases, if
Packit Service 3880ab
 * needed, are a possibility, though.
Packit Service 3880ab
 */
Packit Service 3880ab
Packit Service 3880ab
/* ELF section names, etc */
Packit Service 3880ab
#define ELF_SECTION_LICENSE	"license"
Packit Service 3880ab
#define ELF_SECTION_MAPS	"maps"
Packit Service 3880ab
#define ELF_SECTION_PROG	"prog"
Packit Service 3880ab
#define ELF_SECTION_CLASSIFIER	"classifier"
Packit Service 3880ab
#define ELF_SECTION_ACTION	"action"
Packit Service 3880ab
Packit Service 3880ab
#define ELF_MAX_MAPS		64
Packit Service 3880ab
#define ELF_MAX_LICENSE_LEN	128
Packit Service 3880ab
Packit Service 3880ab
/* Object pinning settings */
Packit Service 3880ab
#define PIN_NONE		0
Packit Service 3880ab
#define PIN_OBJECT_NS		1
Packit Service 3880ab
#define PIN_GLOBAL_NS		2
Packit Service 3880ab
Packit Service 3880ab
/* ELF map definition */
Packit Service 3880ab
struct bpf_elf_map {
Packit Service 3880ab
	__u32 type;
Packit Service 3880ab
	__u32 size_key;
Packit Service 3880ab
	__u32 size_value;
Packit Service 3880ab
	__u32 max_elem;
Packit Service 3880ab
	__u32 flags;
Packit Service 3880ab
	__u32 id;
Packit Service 3880ab
	__u32 pinning;
Packit Service 3880ab
	__u32 inner_id;
Packit Service 3880ab
	__u32 inner_idx;
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
#define BPF_ANNOTATE_KV_PAIR(name, type_key, type_val)		\
Packit Service 3880ab
	struct ____btf_map_##name {				\
Packit Service 3880ab
		type_key key;					\
Packit Service 3880ab
		type_val value;					\
Packit Service 3880ab
	};							\
Packit Service 3880ab
	struct ____btf_map_##name				\
Packit Service 3880ab
	    __attribute__ ((section(".maps." #name), used))	\
Packit Service 3880ab
	    ____btf_map_##name = { }
Packit Service 3880ab
Packit Service 3880ab
#endif /* __BPF_ELF__ */