Brussels / 2 & 3 February 2019


Writing Network Drivers in High-Level Languages

How to write drivers in Rust, go, C#, Swift, Haskell, and OCaml

Drivers are usually written in C for historical reasons, this can be bad if you want your driver to be safe and secure. We show that it is possible to write low-level drivers for PCIe devices in modern high-level languages. We are working on super-fast user space network drivers for the Intel 82599ES (ixgbe) 10 Gbit/s NIC in Rust, C#, go, OCaml, Haskell, Python, Swift, and a few more languages (WIP). All of our drivers are written from scratch and require no additional kernel code.

Check out our GitHub page with links to all implementations, performance measurements, and publications for further reading.

Supposedly modern user space drivers (e.g., DPDK or SPDK) are still being written in C in 2018 :(

This comes with all the well-known drawbacks of writing things in C that might be prevented by using safer programming languages. Also, did you ever see a kernel panic because a in-kernel driver did something stupid? It doesn't have to be that way, drivers should not be able to take down the whole system.

There are three steps to building better drivers:

  • Write them in a safer programming language eliminating whole classes of bugs and security problems like bad memory accesses
  • Isolating them from the rest of the operating system: user space drivers that drop privileges
  • Isolating the hardware using the IOMMU

We are showing that it is possible to achieve all of these goals for PCIe drivers on Linux by implementing user space network drivers in all of the aforementioned programming languages. Our techniques are transferable to other drivers that would benefit from more modern implementations.

Our drivers in Rust, C#, go, OCaml, and Swift are completely finished, tuned for performance, evaluated, and benchmarked (they are about 80-90% as fast as our user space C driver which is as fast as older versions of DPDK).

The main thing to take away from this talk is: writing drivers is neither scary nor hard. You can write one in your favorite programming language, so go ahead and try that :)


Photo of Paul Emmerich Paul Emmerich
Photo of Simon Ellmann Simon Ellmann