Skip to content

Instantly share code, notes, and snippets.

@TCY16
Last active October 5, 2020 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save TCY16/38fc7a5cc28adf4ef1ce3c20afbf0a82 to your computer and use it in GitHub Desktop.
Save TCY16/38fc7a5cc28adf4ef1ce3c20afbf0a82 to your computer and use it in GitHub Desktop.
struct bucket {
uint64_t start_time;
uint64_t n_packets;
};
struct bpf_map_def SEC("maps") state_map = {
.type = BPF_MAP_TYPE_PERCPU_HASH,
.key_size = sizeof(uint32_t),
.value_size = sizeof(struct bucket),
.max_entries = 1000000
};
struct bpf_map_def SEC("maps") state_map_v6 = {
.type = BPF_MAP_TYPE_PERCPU_HASH,
.key_size = sizeof(struct in6_addr),
.value_size = sizeof(struct bucket),
.max_entries = 1000000
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment