mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-10-18 22:09:55 +00:00

This work finalizes both eBPF front-ends for the classifier and action part in tc, it allows for custom ELF section selection, a simplified tc command frontend (while keeping compat), reusing of common maps between classifier and actions residing in the same object file, and exporting of all map fds to an eBPF agent for handing off further control in user space. It also adds an extensive example of how eBPF can be used, and a minimal self-contained example agent that dumps map data. The example is well documented and hopefully provides a good starting point into programming cls_bpf and act_bpf. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Cc: Alexei Starovoitov <ast@plumgrid.com> Cc: Jiri Pirko <jiri@resnulli.us> Cc: Jamal Hadi Salim <jhs@mojatatu.com> Acked-by: Alexei Starovoitov <ast@plumgrid.com> Acked-by: Thomas Graf <tgraf@suug.ch> Acked-by: Jiri Pirko <jiri@resnulli.us> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
34 lines
766 B
C
34 lines
766 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_CLASSIFIER "classifier"
|
|
#define ELF_SECTION_ACTION "action"
|
|
|
|
#define ELF_MAX_MAPS 64
|
|
#define ELF_MAX_LICENSE_LEN 128
|
|
|
|
/* ELF map definition */
|
|
struct bpf_elf_map {
|
|
__u32 type;
|
|
__u32 size_key;
|
|
__u32 size_value;
|
|
__u32 max_elem;
|
|
__u32 id;
|
|
};
|
|
|
|
#endif /* __BPF_ELF__ */
|