By Chaitanya “CK” Kodeboyina
First let me introduce myself. I am the head of software at Barefoot Networks where I lead a senior team of engineers with many years of experience building networking systems, software and chips.
Whether you build your own chips or use off-the-shelf merchant silicon, it can be frustrating to write software for fixed-function switch chips. You are limited by the set of capabilities baked into the silicon. You can’t add new features, and you have little or no control over how the switch resources are allocated. This should improve over the next few years as P4-programmable switch chips become available allowing us to: (1) Define and customize how a switch processes packets, and (2) Auto-generate an API to interface the chip to the switch software.
To help move this vision along, my team recently open-sourced a compiler that lets you turn a P4 program into an executable soft switch. If you’ve not seen the compiler and tool-chain, you should check out the following GitHub repos: p4compiler and p4factory. With these tools you can write your own switch description in P4, then turn it into an executable soft switch.
The next thing we need is a collection of production-quality switch forwarding planes written in P4, for us all to share and build upon. As you probably know, real production switches are complicated (and proprietary) and it is hard to find out exactly what they do, even with an NDA. State-of-the-art switching chips today provide a lot of features like unicast and multicast forwarding, network virtualization and other tunneling technologies, policy enforcement and security features, traffic prioritization and monitoring features, and multi-chip fabric forwarding. We know from experience how complicated and time-consuming it is to craft a feature-rich switch forwarding plane.
We thought it would help the broader community of network developers and researchers if we open-source some realistic production switch designs in P4. You can use them as-is, or as a starting point for more advanced and customized switches, NICs, routers, load balancers, security appliances etc.
And so today my team is proud to release two open-source projects:
1) An Open & Programmable Ethernet/IP Switch
switch.p4 is a P4 program expressing the forwarding plane of a switch, with features typical of an advanced Ethernet and IP switch. This specification can be compiled using the P4 compiler to create an executable switch. The tables in switch.p4 can be programmed using low-level resource management APIs auto-generated by the compiler from the P4 program. For more details on how to compile and run switch.p4, check out the switch target in p4-factory – switch.
2) An Open implementation of Switch Abstraction Interface (SAI) on switch.p4
SAI is a new standardized API for switches, allowing the same software to program lots of different switch chips without any changes. I am pleased to announce that switch.p4 can be controlled via SAI using the open-source switchsai and switchapi libraries. We are publishing source code for both libraries, which means all layers of software from applications down to the data plane are open. For more details on switchsai and switchapi visit the following github repos: switchsai and switchapi.
The picture below shows the relationship between the different API layers. At the bottom is the software switch, compiled from switch.p4. The low-level resources are managed by the auto-generated API. The switchsai and switchapi libraries let applications program the tables in the soft switch using SAI.
+-----+ +-----+ +-----+ +-----+ |App 1| |App j| |App n| |App q| | |... | |...| |..| | +-----+ +-----+ +-----+ +-----+ | | | | | +-----------------------+ | | | SAI | | | |(via switchsai/api lib)| | | +-----------------------+---------+ | Resource Mgmt. API | | (auto-gen. from switch.p4) | +---------------------------------+ | Soft Switch | | (compiled from switch.p4) | +---------------------------------+
With the release of switch.p4 and the support for SAI, we hope to create a more open culture in networking, leading to more open-source code that is portable across switch chips. We encourage the networking community of vendors, operators, researchers and independent software engineers to build upon our code and push the boundaries of what is possible in the world of networking.
Stay tuned for more exciting things to come!