mirror of
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git
synced 2024-11-15 22:15:13 +08:00
612ff099a1
Add support for map in map in the loader and add a small example program. The outer map uses inner_id to reference a bpf_elf_map with a given ID as the inner type. Loading maps is done in three passes, i) all non-map in map maps are loaded, ii) all map in map maps are loaded based on the inner_id map spec of a non-map in map with corresponding id, and iii) related inner maps are attached to the map in map with given inner_idx key. Pinned objetcs are assumed to be managed externally, so they are only retrieved from BPF fs. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
44 lines
964 B
C
44 lines
964 B
C
#ifndef __BPF_ELF__
|
|
#define __BPF_ELF__
|
|
|
|
#include <asm/types.h>
|
|
|
|
/* Note:
|
|
*
|
|
* Below ELF section names and bpf_elf_map structure definition
|
|
* are not (!) kernel ABI. It's rather a "contract" between the
|
|
* application and the BPF loader in tc. For compatibility, the
|
|
* section names should stay as-is. Introduction of aliases, if
|
|
* needed, are a possibility, though.
|
|
*/
|
|
|
|
/* ELF section names, etc */
|
|
#define ELF_SECTION_LICENSE "license"
|
|
#define ELF_SECTION_MAPS "maps"
|
|
#define ELF_SECTION_PROG "prog"
|
|
#define ELF_SECTION_CLASSIFIER "classifier"
|
|
#define ELF_SECTION_ACTION "action"
|
|
|
|
#define ELF_MAX_MAPS 64
|
|
#define ELF_MAX_LICENSE_LEN 128
|
|
|
|
/* Object pinning settings */
|
|
#define PIN_NONE 0
|
|
#define PIN_OBJECT_NS 1
|
|
#define PIN_GLOBAL_NS 2
|
|
|
|
/* ELF map definition */
|
|
struct bpf_elf_map {
|
|
__u32 type;
|
|
__u32 size_key;
|
|
__u32 size_value;
|
|
__u32 max_elem;
|
|
__u32 flags;
|
|
__u32 id;
|
|
__u32 pinning;
|
|
__u32 inner_id;
|
|
__u32 inner_idx;
|
|
};
|
|
|
|
#endif /* __BPF_ELF__ */
|