BSDCan2014 - Final

BSDCan 2014
The Technical BSD Conference

Speakers
Luigi Rizzo
Schedule
Day Talks - Day 1 - Fri May 16 - 2014-05-16
Room Montpetit 202
Start time 10:00
Duration 01:00
Info
ID 478
Event type Lecture
Track Hacking
Language used for presentation English

In-kernel OpenvSwitch on FreeBSD.

OpenvSwitch (OVS) is a very popular component for experimenting with Software Defined Networking. OVS is especially useful for interconnecting virtual machines, as it eases VM migration and reconfiguration of routing in the hosting provider.

In this paper we will discuss how we ported the in-kernel OVS dataplane to FreeBSD, using the original linux code with minimal modifications and suitable wrappers to build a FreeBSD kernel module, parse netlink messages and convert skbufs and mbufs.

Our module equals or exceeds the performance of the Linux one (reaching 600-700 Kpps with TAP interfaces). Our approach eases retaining feature parity as the original OVS is updated. This also includes much faster versions of OVS which we have in the works, using netmap/VALE as a dataplane.

Our work will also help porting further network-related kernel modules from Linux to FreeBSD, and provides a useful starting point for a complete, BSD-licensed version of the OVS dataplane.

OVS has two components: a userspace control plane, available for multiple platforms including FreeBSD; and a data plane in charge of moving packets around, with both userspace and kernel implementations. The in-kernel OVS dataplane, required to efficiently interconnect virtual machines, is a linux-only kernel subsystem.

With the obvious desire to provide FreeBSD with such as useful component, we looked at how to implement in-kernel OVS for FreeBSD, by reusing the Linux kernel code and building suitable adaptation layers.

As a result of our effort, we achieved a working FreeBSD openvswitchkernel module with approximately 1500 lines of new code, mostly to implement generic netlink sockets and netlink message parsing, and to convert between skbufs and mbufs. Modifications to the existing files were minimal and mainly to address compiler issues (unnamed unions; missing const qualifiers and printf format warnings) and disable a handful of unsupported features.

One might rightly question our approach: the original linux-OVS kernel code is only about 8000 lines, and a complete rewrite would be feasible and could be done under a BSD license.

However, we believe that our choice was appropriate for a number of reasons: our module will support updates with almost no additional work, does not incur any performance penalty, helps testing the correctness of the userspace component of OVS, and provides a suitable starting point for a BSD-licensed version of the code for interested parties.

We are working with the OVS developers to integrate some of our changes, and we plan to release the code soon for use into FreeBSD, either as a port or as in-tree kernel component.

The full paper/presentation will discuss the internal architecture of the in-kernel OVS dataplane, including performance issues, and give more details on the porting infrastructure.