BPF List
 help / color / mirror / Atom feed
* Best way to share maps between multiple files/objects?
@ 2022-11-11  0:32 Grant Seltzer Richman
  2022-11-11  7:34 ` Dave Marchevsky
  0 siblings, 1 reply; 4+ messages in thread
From: Grant Seltzer Richman @ 2022-11-11  0:32 UTC (permalink / raw)
  To: bpf

Hi folks,

I want to organize my BPF programs so that I can load them
individually. I want this so that if loading one fails (because of
lack of kernel support for BPF features), I can load a fall-back
replacement program. To do so, I've organized the BPF programs into
their own source code files and compiled them individually. Each BPF
program references what is supposed to be the same ringbuffer. Using
libbpf I open them and attempt to load each in order.

My question is, how am I supposed to share maps such as ringbuffers
between them? If I have identical map definitions in each, they have
their own file descriptors. Is the best way to call
`bpf_map__reuse_fd()` on each handle of the maps in each BPF object?

I'd also take advice on how to better achieve my overall goal of being
able to load programs individually!

Thanks so much for your help,
Grant Seltzer

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-18  0:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-11  0:32 Best way to share maps between multiple files/objects? Grant Seltzer Richman
2022-11-11  7:34 ` Dave Marchevsky
2022-11-14 19:02   ` Grant Seltzer Richman
2022-11-18  0:38     ` Andrii Nakryiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox