Share bpf map between different XDP programs running on different interfaces
Hi there,
I need to share 1 bpf map between 2 different XDP programs loaded on 2 different interfaces. I understand how a map can be shared with a userspace program, but how can one XDP program gain access to a map that was created previously by a different XDP program?
I need to invoke bpf_map_lookup_elem() in the context of one program and get data that was updated by another. Can this be done? is there a working example?
Thanks a lot,
Nir.
Just create both XDP programs in the same source file, that way they can share the reference to the map. Note that you'll have to do any needed cross-CPU synchronisation yourself, either using atomics or locking (depending on what you're using the map for).