is there a way to get a pointer to map when using BCC?
- Dominant language
- C
- Stars
- 22.7k
- Forks
- 4.1k
- Avg merge
- 10d 4h
- Merged PRs (30d)
- 3
Description
I am a student new to XDP. I am trying to make a small failure detector using BPF/XDP, and I need a timer.
I noticed there are several bpf functions like bpf_timer_init, bpf_timer_start
(see examples from https://github.com/torvalds/linux/blob/master/include/uapi/linux/bpf.h)
(see test code from https://github.com/torvalds/linux/blob/master/tools/testing/selftests/bpf/progs/timer.c)
....
that could start a timer in bpf programs, but I need a pointer to the map that contains struct bpf_timer.
Since I use BCC as the frontend, I wrote something like
BPF_ARRAY(timers, struct bpf_timer, 1);
which does not give me a pointer to the map I need.
even when I tried sth like
bpf_timer_init(timer, &timers, CLOCK_REALTIME);
it gives me error:
; bpf_timer_init(timer, timers_ptr, CLOCK_REALTIME);
186: (bf) r1 = r0
187: (18) r2 = 0x0
189: (b7) r3 = 0
190: (85) call bpf_timer_init#169
R2 type=inv expected=map_ptr
processed 222 insns (limit 1000000) max_states_per_insn 1 total_states 15 peak_states 15 mark_read 5
so I am wondering, is it possible to get a pointer to a map using BCC, so that I could pass it as a parameter to the bpf_timer_init function?
Many thanks in advance!!!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.