selftests/bpf: convert tests w/ custom values to BTF-defined maps
Convert a bulk of selftests that have maps with custom (not integer) key and/or value. Signed-off-by: Andrii Nakryiko <andriin@fb.com> Acked-by: Song Liu <songliubraving@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:
parent
f654407481
commit
df0b779259
@ -57,17 +57,25 @@ struct frag_hdr {
|
||||
__be32 identification;
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") jmp_table = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 key_size;
|
||||
__u32 value_size;
|
||||
} jmp_table SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_PROG_ARRAY,
|
||||
.max_entries = 8,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(__u32),
|
||||
.max_entries = 8
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") last_dissection = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
struct bpf_flow_keys *value;
|
||||
} last_dissection SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(struct bpf_flow_keys),
|
||||
.max_entries = 1,
|
||||
};
|
||||
|
||||
|
@ -12,15 +12,16 @@ struct socket_cookie {
|
||||
__u32 cookie_value;
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") socket_cookies = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 map_flags;
|
||||
int *key;
|
||||
struct socket_cookie *value;
|
||||
} socket_cookies SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_SK_STORAGE,
|
||||
.key_size = sizeof(int),
|
||||
.value_size = sizeof(struct socket_cookie),
|
||||
.map_flags = BPF_F_NO_PREALLOC,
|
||||
};
|
||||
|
||||
BPF_ANNOTATE_KV_PAIR(socket_cookies, int, struct socket_cookie);
|
||||
|
||||
SEC("cgroup/connect6")
|
||||
int set_cookie(struct bpf_sock_addr *ctx)
|
||||
{
|
||||
|
@ -15,17 +15,25 @@ struct stack_trace_t {
|
||||
struct bpf_stack_build_id user_stack_buildid[MAX_STACK_RAWTP];
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") perfmap = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 key_size;
|
||||
__u32 value_size;
|
||||
} perfmap SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_PERF_EVENT_ARRAY,
|
||||
.max_entries = 2,
|
||||
.key_size = sizeof(int),
|
||||
.value_size = sizeof(__u32),
|
||||
.max_entries = 2,
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") stackdata_map = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
struct stack_trace_t *value;
|
||||
} stackdata_map SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_PERCPU_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(struct stack_trace_t),
|
||||
.max_entries = 1,
|
||||
};
|
||||
|
||||
@ -47,10 +55,13 @@ struct bpf_map_def SEC("maps") stackdata_map = {
|
||||
* issue and avoid complicated C programming massaging.
|
||||
* This is an acceptable workaround since there is one entry here.
|
||||
*/
|
||||
struct bpf_map_def SEC("maps") rawdata_map = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
__u64 (*value)[2 * MAX_STACK_RAWTP];
|
||||
} rawdata_map SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_PERCPU_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = MAX_STACK_RAWTP * sizeof(__u64) * 2,
|
||||
.max_entries = 1,
|
||||
};
|
||||
|
||||
|
@ -7,17 +7,23 @@
|
||||
|
||||
#include "bpf_helpers.h"
|
||||
|
||||
struct bpf_map_def SEC("maps") result_number = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
__u64 *value;
|
||||
} result_number SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(__u64),
|
||||
.max_entries = 11,
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") result_string = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
const char (*value)[32];
|
||||
} result_string SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = 32,
|
||||
.max_entries = 5,
|
||||
};
|
||||
|
||||
@ -27,10 +33,13 @@ struct foo {
|
||||
__u64 c;
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") result_struct = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
struct foo *value;
|
||||
} result_struct SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(struct foo),
|
||||
.max_entries = 5,
|
||||
};
|
||||
|
||||
|
@ -169,38 +169,53 @@ struct eth_hdr {
|
||||
unsigned short eth_proto;
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") vip_map = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
struct vip *key;
|
||||
struct vip_meta *value;
|
||||
} vip_map SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_HASH,
|
||||
.key_size = sizeof(struct vip),
|
||||
.value_size = sizeof(struct vip_meta),
|
||||
.max_entries = MAX_VIPS,
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") ch_rings = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
__u32 *value;
|
||||
} ch_rings SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(__u32),
|
||||
.max_entries = CH_RINGS_SIZE,
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") reals = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
struct real_definition *value;
|
||||
} reals SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(struct real_definition),
|
||||
.max_entries = MAX_REALS,
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") stats = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
struct vip_stats *value;
|
||||
} stats SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_PERCPU_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(struct vip_stats),
|
||||
.max_entries = MAX_VIPS,
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") ctl_array = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
struct ctl_value *value;
|
||||
} ctl_array SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(struct ctl_value),
|
||||
.max_entries = CTL_MAP_SIZE,
|
||||
};
|
||||
|
||||
|
@ -165,38 +165,53 @@ struct eth_hdr {
|
||||
unsigned short eth_proto;
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") vip_map = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
struct vip *key;
|
||||
struct vip_meta *value;
|
||||
} vip_map SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_HASH,
|
||||
.key_size = sizeof(struct vip),
|
||||
.value_size = sizeof(struct vip_meta),
|
||||
.max_entries = MAX_VIPS,
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") ch_rings = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
__u32 *value;
|
||||
} ch_rings SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(__u32),
|
||||
.max_entries = CH_RINGS_SIZE,
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") reals = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
struct real_definition *value;
|
||||
} reals SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(struct real_definition),
|
||||
.max_entries = MAX_REALS,
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") stats = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
struct vip_stats *value;
|
||||
} stats SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_PERCPU_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(struct vip_stats),
|
||||
.max_entries = MAX_VIPS,
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") ctl_array = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
struct ctl_value *value;
|
||||
} ctl_array SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(struct ctl_value),
|
||||
.max_entries = CTL_MAP_SIZE,
|
||||
};
|
||||
|
||||
|
@ -21,38 +21,55 @@ int _version SEC("version") = 1;
|
||||
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
|
||||
#endif
|
||||
|
||||
struct bpf_map_def SEC("maps") outer_map = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 key_size;
|
||||
__u32 value_size;
|
||||
} outer_map SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY_OF_MAPS,
|
||||
.max_entries = 1,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(__u32),
|
||||
.max_entries = 1,
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") result_map = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
__u32 *value;
|
||||
} result_map SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(__u32),
|
||||
.max_entries = NR_RESULTS,
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") tmp_index_ovr_map = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
int *value;
|
||||
} tmp_index_ovr_map SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(int),
|
||||
.max_entries = 1,
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") linum_map = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
__u32 *value;
|
||||
} linum_map SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(__u32),
|
||||
.max_entries = 1,
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") data_check_map = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
struct data_check *value;
|
||||
} data_check_map SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(struct data_check),
|
||||
.max_entries = 1,
|
||||
};
|
||||
|
||||
|
@ -8,34 +8,50 @@
|
||||
#define PERF_MAX_STACK_DEPTH 127
|
||||
#endif
|
||||
|
||||
struct bpf_map_def SEC("maps") control_map = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
__u32 *value;
|
||||
} control_map SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(__u32),
|
||||
.max_entries = 1,
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") stackid_hmap = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
__u32 *value;
|
||||
} stackid_hmap SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_HASH,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(__u32),
|
||||
.max_entries = 16384,
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") stackmap = {
|
||||
typedef struct bpf_stack_build_id stack_trace_t[PERF_MAX_STACK_DEPTH];
|
||||
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 map_flags;
|
||||
__u32 key_size;
|
||||
__u32 value_size;
|
||||
} stackmap SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_STACK_TRACE,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(struct bpf_stack_build_id)
|
||||
* PERF_MAX_STACK_DEPTH,
|
||||
.max_entries = 128,
|
||||
.map_flags = BPF_F_STACK_BUILD_ID,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(stack_trace_t),
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") stack_amap = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
/* there seems to be a bug in kernel not handling typedef properly */
|
||||
struct bpf_stack_build_id (*value)[PERF_MAX_STACK_DEPTH];
|
||||
} stack_amap SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(struct bpf_stack_build_id)
|
||||
* PERF_MAX_STACK_DEPTH,
|
||||
.max_entries = 128,
|
||||
};
|
||||
|
||||
|
@ -8,31 +8,47 @@
|
||||
#define PERF_MAX_STACK_DEPTH 127
|
||||
#endif
|
||||
|
||||
struct bpf_map_def SEC("maps") control_map = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
__u32 *value;
|
||||
} control_map SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(__u32),
|
||||
.max_entries = 1,
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") stackid_hmap = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
__u32 *value;
|
||||
} stackid_hmap SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_HASH,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(__u32),
|
||||
.max_entries = 16384,
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") stackmap = {
|
||||
typedef __u64 stack_trace_t[PERF_MAX_STACK_DEPTH];
|
||||
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 key_size;
|
||||
__u32 value_size;
|
||||
} stackmap SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_STACK_TRACE,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(__u64) * PERF_MAX_STACK_DEPTH,
|
||||
.max_entries = 16384,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(stack_trace_t),
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") stack_amap = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
__u64 (*value)[PERF_MAX_STACK_DEPTH];
|
||||
} stack_amap SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(__u64) * PERF_MAX_STACK_DEPTH,
|
||||
.max_entries = 16384,
|
||||
};
|
||||
|
||||
|
@ -148,10 +148,13 @@ struct tcp_estats_basic_event {
|
||||
struct tcp_estats_conn_id conn_id;
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") ev_record_map = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
struct tcp_estats_basic_event *value;
|
||||
} ev_record_map SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_HASH,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(struct tcp_estats_basic_event),
|
||||
.max_entries = 1024,
|
||||
};
|
||||
|
||||
|
@ -14,17 +14,23 @@
|
||||
#include "bpf_endian.h"
|
||||
#include "test_tcpbpf.h"
|
||||
|
||||
struct bpf_map_def SEC("maps") global_map = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
struct tcpbpf_globals *value;
|
||||
} global_map SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(struct tcpbpf_globals),
|
||||
.max_entries = 4,
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") sockopt_results = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
int *value;
|
||||
} sockopt_results SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(int),
|
||||
.max_entries = 2,
|
||||
};
|
||||
|
||||
|
@ -14,18 +14,26 @@
|
||||
#include "bpf_endian.h"
|
||||
#include "test_tcpnotify.h"
|
||||
|
||||
struct bpf_map_def SEC("maps") global_map = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
struct tcpnotify_globals *value;
|
||||
} global_map SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(struct tcpnotify_globals),
|
||||
.max_entries = 4,
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") perf_event_map = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 key_size;
|
||||
__u32 value_size;
|
||||
} perf_event_map SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_PERF_EVENT_ARRAY,
|
||||
.max_entries = 2,
|
||||
.key_size = sizeof(int),
|
||||
.value_size = sizeof(__u32),
|
||||
.max_entries = 2,
|
||||
};
|
||||
|
||||
int _version SEC("version") = 1;
|
||||
|
@ -22,17 +22,23 @@
|
||||
|
||||
int _version SEC("version") = 1;
|
||||
|
||||
struct bpf_map_def SEC("maps") rxcnt = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
__u64 *value;
|
||||
} rxcnt SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_PERCPU_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(__u64),
|
||||
.max_entries = 256,
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") vip2tnl = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
struct vip *key;
|
||||
struct iptnl_info *value;
|
||||
} vip2tnl SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_HASH,
|
||||
.key_size = sizeof(struct vip),
|
||||
.value_size = sizeof(struct iptnl_info),
|
||||
.max_entries = MAX_IPTNL_ENTRIES,
|
||||
};
|
||||
|
||||
|
@ -163,52 +163,66 @@ struct lb_stats {
|
||||
__u64 v1;
|
||||
};
|
||||
|
||||
struct bpf_map_def __attribute__ ((section("maps"), used)) vip_map = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
struct vip_definition *key;
|
||||
struct vip_meta *value;
|
||||
} vip_map SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_HASH,
|
||||
.key_size = sizeof(struct vip_definition),
|
||||
.value_size = sizeof(struct vip_meta),
|
||||
.max_entries = 512,
|
||||
.map_flags = 0,
|
||||
};
|
||||
|
||||
struct bpf_map_def __attribute__ ((section("maps"), used)) lru_cache = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 map_flags;
|
||||
struct flow_key *key;
|
||||
struct real_pos_lru *value;
|
||||
} lru_cache SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_LRU_HASH,
|
||||
.key_size = sizeof(struct flow_key),
|
||||
.value_size = sizeof(struct real_pos_lru),
|
||||
.max_entries = 300,
|
||||
.map_flags = 1U << 1,
|
||||
};
|
||||
|
||||
struct bpf_map_def __attribute__ ((section("maps"), used)) ch_rings = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
__u32 *value;
|
||||
} ch_rings SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(__u32),
|
||||
.max_entries = 12 * 655,
|
||||
.map_flags = 0,
|
||||
};
|
||||
|
||||
struct bpf_map_def __attribute__ ((section("maps"), used)) reals = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
struct real_definition *value;
|
||||
} reals SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(struct real_definition),
|
||||
.max_entries = 40,
|
||||
.map_flags = 0,
|
||||
};
|
||||
|
||||
struct bpf_map_def __attribute__ ((section("maps"), used)) stats = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
struct lb_stats *value;
|
||||
} stats SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_PERCPU_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(struct lb_stats),
|
||||
.max_entries = 515,
|
||||
.map_flags = 0,
|
||||
};
|
||||
|
||||
struct bpf_map_def __attribute__ ((section("maps"), used)) ctl_array = {
|
||||
struct {
|
||||
__u32 type;
|
||||
__u32 max_entries;
|
||||
__u32 *key;
|
||||
struct ctl_value *value;
|
||||
} ctl_array SEC(".maps") = {
|
||||
.type = BPF_MAP_TYPE_ARRAY,
|
||||
.key_size = sizeof(__u32),
|
||||
.value_size = sizeof(struct ctl_value),
|
||||
.max_entries = 16,
|
||||
.map_flags = 0,
|
||||
};
|
||||
|
||||
struct eth_hdr {
|
||||
|
Loading…
Reference in New Issue
Block a user