.. | .. |
---|
2 | 2 | #include <linux/ptrace.h> |
---|
3 | 3 | #include <linux/version.h> |
---|
4 | 4 | #include <uapi/linux/bpf.h> |
---|
5 | | -#include "bpf_helpers.h" |
---|
| 5 | +#include <bpf/bpf_helpers.h> |
---|
6 | 6 | |
---|
7 | 7 | #define SAMPLE_SIZE 64ul |
---|
8 | | -#define MAX_CPUS 128 |
---|
9 | 8 | |
---|
10 | | -#define bpf_printk(fmt, ...) \ |
---|
11 | | -({ \ |
---|
12 | | - char ____fmt[] = fmt; \ |
---|
13 | | - bpf_trace_printk(____fmt, sizeof(____fmt), \ |
---|
14 | | - ##__VA_ARGS__); \ |
---|
15 | | -}) |
---|
16 | | - |
---|
17 | | -struct bpf_map_def SEC("maps") my_map = { |
---|
18 | | - .type = BPF_MAP_TYPE_PERF_EVENT_ARRAY, |
---|
19 | | - .key_size = sizeof(int), |
---|
20 | | - .value_size = sizeof(u32), |
---|
21 | | - .max_entries = MAX_CPUS, |
---|
22 | | -}; |
---|
| 9 | +struct { |
---|
| 10 | + __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY); |
---|
| 11 | + __uint(key_size, sizeof(int)); |
---|
| 12 | + __uint(value_size, sizeof(u32)); |
---|
| 13 | +} my_map SEC(".maps"); |
---|
23 | 14 | |
---|
24 | 15 | SEC("xdp_sample") |
---|
25 | 16 | int xdp_sample_prog(struct xdp_md *ctx) |
---|