eBPF Implementation for FreeBSD
eBPF is an in-kernel virtual machine with an independent 64-bit instruction set architecture with C calling convention. It was appeared in the Linux kernel in 2014 as an extension to the existing BPF. Compared to the classic BPF, the instruction set is extended to make it a highly-flexible domain-specific language. Recently Linux proposes many eBPF programmable kernel features like dynamic tracing, resource control, and so on.
Especially from the networking community perspective, it is a hot technology for programming high performance software/hardware packet processor such as Linux XDP (eXpress Data Path), OpenVSwitch or Netronome NFP (Netronome Flow Processor) card. It is also used as an backend for the high level network dataplane description
language such as P4 or iptables.
In this project, we will implement eBPF for FreeBSD which has very basic functionality and apply it to VALE software
switch for demonstrating how it is useful for FreeBSD.
In this project, we will deliver two things.
1. Basic eBPF implementation for FreeBSD (eBPF itself)
2. eBPF extension module for VALE software switch (application)
Week 1-2: Implement percpu array map and percpu hash map Implement percpu array map and percpu hash map. Confirm it can be manipulated from both user space and eBPF programs. Write tests for make sure that.
Week 3-4 : Initial performance measurement for maps Measure initial performance number for maps. For map benchmarking, write code for measuring lookup/update/delete rate for each maps. Use query per second (QPS) as a metric and Linux maps as a baseline. If the performance number was bad, fix it in this week.
Week 5-6: Brush up deliverable1 Brush up rest of the deliverable1 implementation. We might have bugs or performance issues at this time. Repeat fixing and benchmarking.
Week 7-8: Make current vale-bpf consistent with eBPF for FreeBSD Current vale-bpf implementation may not consistent with eBPF for FreeBSD implementation. Fix it.
Week 9-10: Measure the performance of vale-bpf Write benchmark for comparing vale-bpf and Linux XDP. L2 learning bridge may be good as a workload, because it contains lookup/update of the map. Use daisy chain topology like below
pkt-gen(TX) ----10Gbps---- Switch (vale-bpf or XDP) ----10Gbps---- pkt-gen(RX)
and Measure packet forwarding speed (Mpps) in RX side of pkt-gen. All machine will use only single core. Performance of vale-bpf should be comparable with XDP. If the performance was bad, make clear why and fix it.
Week 11-12: Make document
Document the following things.
How to use eBPF for FreeBSD and vale-bpf with some example codes
Design decision and future works
Useful correction of links about eBPF https://qmonnet.github.io/whirl-offload/2016/09/01/dive-into-bpf/
Unofficial, but useful manual about BPF and XDP http://docs.cilium.io/en/latest/bpf/
Unofficial eBPF specification https://github.com/iovisor/bpf-docs/blob/master/eBPF.md
You can comment to the report on google docs.
Week4: Attended to BSDCan2018. Made presentation about this work and got a lot of useful feedbacks.