mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-10-04 23:36:47 +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>
27 lines
409 B
C
27 lines
409 B
C
#ifndef __BPF_SHARED__
|
|
#define __BPF_SHARED__
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "../../include/bpf_elf.h"
|
|
|
|
enum {
|
|
BPF_MAP_ID_PROTO,
|
|
BPF_MAP_ID_QUEUE,
|
|
BPF_MAP_ID_DROPS,
|
|
__BPF_MAP_ID_MAX,
|
|
#define BPF_MAP_ID_MAX __BPF_MAP_ID_MAX
|
|
};
|
|
|
|
struct count_tuple {
|
|
long packets; /* type long for __sync_fetch_and_add() */
|
|
long bytes;
|
|
};
|
|
|
|
struct count_queue {
|
|
long total;
|
|
long mismatch;
|
|
};
|
|
|
|
#endif /* __BPF_SHARED__ */
|