p4lang / p4c

P4_16 reference compiler
https://p4.org/
Apache License 2.0
681 stars 445 forks source link

Use libbpf instead of iproute2 to load eBPF programs #2407

Open fruffy opened 4 years ago

fruffy commented 4 years ago

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.

jafingerhut commented 4 years ago

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.

fruffy commented 4 years ago

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.