eBPF Implementation for FreeBSD

Project description

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.

Deliverables

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)

Milestones

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

The Code

https://github.com/YutaroHayakawa/generic-ebpf

https://github.com/YutaroHayakawa/vale-bpf

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

Weekly reports

You can comment to the report on google docs.

Week1: https://docs.google.com/document/d/1iY9-PwvrSd_mKF5P62a7BH0iOWRJkTjExf8KfnaxjMU/edit?usp=sharing

Week2: https://docs.google.com/document/d/1rdrHIeap8gYRh3es4yCnuWkuA6zDDot4UDFgEyiuG3E/edit?usp=sharing

Week3: https://docs.google.com/document/d/15jvbmQJXeLdjo7LwOJai-M-qVdvie8E-eO7a8FHz65Q/edit?usp=sharing

Week4: Attended to BSDCan2018. Made presentation about this work and got a lot of useful feedbacks.

Week5: https://docs.google.com/document/d/1cnnBRJ-yxcDMOAJ0uGtVj1uHlGadtRjUqTGviQD1Th8/edit?usp=sharing

Week6: https://docs.google.com/document/d/1_zAJVBmazYa80HxPvOAk0hQeyVUmOANN3hU6drPUNxI/edit?usp=sharing

Week7: https://docs.google.com/document/d/1Oj26geeb2FrAKHc32vkfLDA2Venb5wLfumEiDDXO0yM/edit?usp=sharing

Week8: https://docs.google.com/document/d/1S7iSXiDDOc8XW34z-zVEVXRq4ZC6jKMuXdz-1ndJslk/edit?usp=sharing

Week9: https://docs.google.com/document/d/1r2xk9sk3G9aNH7VwcU1UejsIqjl-M9LTh2Zt7bsKSdE/edit?usp=sharing

Week10: https://docs.google.com/document/d/1Hj3q8rU1u_LCmRbciud-83WGDpmj1xDWQ_FfPfDY8DA/edit?usp=sharing

Week11: https://docs.google.com/document/d/1YVDtD8MDswnDamWZ_19RQVZ5K2t3AWcQeAvNlQakO9c/edit?usp=sharing

Week12: https://docs.google.com/document/d/1x5OH_u-Lpf_2lkeLAlNH8cNLZn2O1euaUzxpBs1ph-o/edit?usp=sharing

SummerOfCode2018Projects/eBPF (last edited 2018-08-07T07:17:29+0000 by YutaroHayakawa)