I am beginning with XDP and BPF maps.
I understand that to access a BPF map from userspace, we use bpf_*
syscalls. For example, bpf_map_lookup_elem()
is used to lookup an element of a BPF map in the userspace program. However, I noticed that the same syscalls are also used to access maps in the XDP programs loaded on the kernel (ref. here).
I assumed such programs should be running in the kernel space, and hence is there some other way these BPF maps should be accessed from the kernel space? Or is the XDP loaded program also part of the userspace but only running within the kernel?