p4c icon indicating copy to clipboard operation
p4c copied to clipboard

Use libbpf instead of iproute2 to load eBPF programs

Open fruffy opened this issue 4 years ago • 2 comments

The dependency on iproute2 and tc causes some issues when loading eBPF programs. Different versions of Ubuntu package different versions of iproute2, which offers different levels of support for eBPF. In addition, there seems to be some problems trying to load more advanced map types such as LPM_TRIE maps.

libbpf offers an API to load and manage eBPF programs. It might make sense to write a small loader that takes care of attaching an eBPF program to an interface.

fruffy avatar Jun 01 '20 09:06 fruffy

I do not know the intricacies involved here, but depending upon what the major EBPF users want, you could consider limiting 'official', i.e. checked-into-repository, support to only long term Ubuntu releases, and even carefully delimit a subset of those.

For example, one could consider no longer supporting Ubuntu 16.04 effective immediately, or "soon", for this purpose, although that would require updating other things which are currently tested on Travis on Ubuntu 16.04 images, I believe.

jafingerhut avatar Jun 01 '20 19:06 jafingerhut

That could also be an option, I think for sanity's sake, Ubuntu 16.04 needs to be eventually deprecated to keep up with all the eBPF/XDP changes. Another reason to get rid of iproute2 is simply the lack of flexibility. There are data structures such as the bpf_elf_map I have to maintain just for loading with tc.

fruffy avatar Jun 03 '20 18:06 fruffy