Skip to content

Commit a46938c

Browse files
DanielTimLeetsipa
authored andcommitted
Most of the samples were converted to use the new BTF-defined MAP as
they moved to libbbpf, but some of the samples were missing. Instead of using the previous BPF MAP definition, this commit refactors xdp_sample_pkts_kern MAP definition with the new BTF-defined MAP format. Signed-off-by: Daniel T. Lee <[email protected]> --- samples/bpf/xdp_sample_pkts_kern.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
1 parent 3e97173 commit a46938c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

samples/bpf/xdp_sample_pkts_kern.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
#define SAMPLE_SIZE 64ul
88
#define MAX_CPUS 128
99

10-
struct bpf_map_def SEC("maps") my_map = {
11-
.type = BPF_MAP_TYPE_PERF_EVENT_ARRAY,
12-
.key_size = sizeof(int),
13-
.value_size = sizeof(u32),
14-
.max_entries = MAX_CPUS,
15-
};
10+
struct {
11+
__uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);
12+
__uint(key_size, sizeof(int));
13+
__uint(value_size, sizeof(u32));
14+
__uint(max_entries, MAX_CPUS);
15+
} my_map SEC(".maps");
1616

1717
SEC("xdp_sample")
1818
int xdp_sample_prog(struct xdp_md *ctx)

0 commit comments

Comments
 (0)