| 1 | #pragma once |
| 2 | |
| 3 | #include "common.h" |
| 4 | |
| 5 | /* When linking BTF map definitions, all maps must be compatible with each |
| 6 | * other, otherwise bpftool throws an error. */ |
| 7 | struct h32_btf { |
| 8 | __uint(type, BPF_MAP_TYPE_HASH); |
| 9 | __type(key, uint32_t); |
| 10 | __type(value, uint32_t); |
| 11 | __uint(max_entries, 1); |
| 12 | }; |
| 13 | |
| 14 | /* Legacy map definitions are appended like programs sections are, and can |
| 15 | * win/lose based on linking order, even if they're completely different maps. |
| 16 | * Test whether the expected candidate wins by configuring different maxentries. |
| 17 | */ |
| 18 | #define h32_legacy(MAX_ENTRIES) \ |
| 19 | { \ |
| 20 | .type = BPF_MAP_TYPE_HASH, \ |
| 21 | .key_size = sizeof(int), \ |
| 22 | .value_size = sizeof(int), \ |
| 23 | .max_entries = MAX_ENTRIES, \ |
| 24 | .map_flags = BPF_F_NO_PREALLOC, \ |
| 25 | } |