Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update maps with pinning attribute #75

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 0 additions & 12 deletions examples/tc/tcprog_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,4 @@
#define ROOT_ARRAY_SIZE 1
#define PIN_GLOBAL_NS 2

/* Notice: TC and iproute2 bpf-loader uses another elf map layout */
struct bpf_elf_map
{
__u32 type;
__u32 size_key;
__u32 size_value;
__u32 max_elem;
__u32 flags;
__u32 id;
__u32 pinning;
};

#endif
1 change: 1 addition & 0 deletions examples/tc/tcprog_egress_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ struct {
__type(key, u32);
__type(value, u32);
__uint(max_entries, 1);
__uint(pinning, LIBBPF_PIN_BY_NAME);
} tc_egress_next_prog_array SEC(".maps");

/* SEC name should be prefixed with tc */
Expand Down
1 change: 1 addition & 0 deletions examples/tc/tcprog_ingress_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ struct {
__type(key, u32);
__type(value, u32);
__uint(max_entries, 1);
__uint(pinning, LIBBPF_PIN_BY_NAME);
} tc_ingress_next_prog_array SEC(".maps");

/* SEC name should be prefixed with tc */
Expand Down
3 changes: 3 additions & 0 deletions ipfix-flow-exporter/bpf_ipfix_egress_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ struct {
__type(key, u32);
__type(value, flow_record_t);
__uint(max_entries, MAX_RECORDS);
__uint(pinning, LIBBPF_PIN_BY_NAME);
} egress_flow_record_info_map SEC(".maps");

/* EGRESS MAP FOR LAST RECORD PACKET INFO */
Expand All @@ -55,6 +56,7 @@ struct {
__type(key, u32);
__type(value, flow_record_t);
__uint(max_entries, MAX_RECORDS);
__uint(pinning, LIBBPF_PIN_BY_NAME);
} last_egress_flow_record_info_map SEC(".maps");

/* EGRESS MAP FOR CHAINING */
Expand All @@ -63,6 +65,7 @@ struct {
__type(key, u32);
__type(value, u32);
__uint(max_entries, 1);
__uint(pinning, LIBBPF_PIN_BY_NAME);
} ipfix_egress_jmp_table SEC(".maps");

static u32 flow_key_hash (const flow_key_t f) {
Expand Down
3 changes: 3 additions & 0 deletions ipfix-flow-exporter/bpf_ipfix_ingress_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ struct {
__type(key, u32);
__type(value, flow_record_t);
__uint(max_entries, MAX_RECORDS);
__uint(pinning, LIBBPF_PIN_BY_NAME);
} ingress_flow_record_info_map SEC(".maps");


Expand All @@ -56,6 +57,7 @@ struct {
__type(key, u32);
__type(value, flow_record_t);
__uint(max_entries, MAX_RECORDS);
__uint(pinning, LIBBPF_PIN_BY_NAME);
} last_ingress_flow_record_info_map SEC(".maps");

/* INGRESS MAP FOR CHAINING */
Expand All @@ -64,6 +66,7 @@ struct {
__type(key, u32);
__type(value, u32);
__uint(max_entries, 1);
__uint(pinning, LIBBPF_PIN_BY_NAME);
} ipfix_ingress_jmp_table SEC(".maps");

static u32 flow_key_hash (const flow_key_t f) {
Expand Down
11 changes: 0 additions & 11 deletions ipfix-flow-exporter/bpf_ipfix_kern_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ typedef struct flow_key_ {
u8 prot;
}flow_key_t;


typedef struct flow_record_ {
flow_key_t key; /* identifies flow by 5-tuple */
u64 np; /* number of packets */
Expand All @@ -33,16 +32,6 @@ typedef struct flow_record_ {
u16 counter; /* flow_idle_counter */
} flow_record_t;

struct bpf_elf_map {
__u32 type;
__u32 size_key;
__u32 size_value;
__u32 max_elem;
__u32 flags;
__u32 id;
__u32 pinning;
};

#define flow_key_hash_mask 0x000fffff

#endif
12 changes: 0 additions & 12 deletions tc-root/tc_root_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,4 @@
#define ROOT_ARRAY_SIZE 1
#define PIN_GLOBAL_NS 2

/* Notice: TC and iproute2 bpf-loader uses another elf map layout */
struct bpf_elf_map
{
__u32 type;
__u32 size_key;
__u32 size_value;
__u32 max_elem;
__u32 flags;
__u32 id;
__u32 pinning;
};

#endif
1 change: 1 addition & 0 deletions tc-root/tc_root_egress_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ struct {
__type(key, int);
__type(value, int);
__uint(max_entries, ROOT_ARRAY_SIZE);
__uint(pinning, LIBBPF_PIN_BY_NAME);
} tc_egress_root_array SEC(".maps");


Expand Down
2 changes: 1 addition & 1 deletion tc-root/tc_root_ingress_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ struct {
__type(key, int);
__type(value, int);
__uint(max_entries, ROOT_ARRAY_SIZE);
__uint(pinning, LIBBPF_PIN_BY_NAME);
} tc_ingress_root_array SEC(".maps");

SEC("tc-ingress-root")
Expand All @@ -26,5 +27,4 @@ int tc_ingress_root(struct __sk_buff *skb) {
return TC_ACT_OK;
}


char _license[] SEC("license") = "Dual BSD/GPL";