ktsdesign - stock.adobe.com

What is a programmable data plane and where does P4 fit in?

A programmable data plane presents a versatile way to forward packets and supports various formats and protocols. The P4 language is used to configure the forwarding actions.

Programmable data planes represent the next step in enabling switches to perform complex operations on packets. While it's possible to use software to forward packets in any format and carry out any set of operations, achieving high throughput requires the use of hardware.

Current forwarding chips are designed to operate on packets with standard Layer 2 formats and for the IP protocol set. The development of software-defined networking (SDN) added flexibility by moving the control plane out of the switch itself and removing the reliance on Layer 2 and Layer 3 switching and routing protocols -- but forwarding was still based on the same packet formats.

The OpenFlow protocol defines the SDN interface between the control and data planes. Programmable data planes go beyond the capability of an OpenFlow-compatible switch. For example, an SDN controller can use the OpenFlow protocol to indicate that a packet with specified source and destination IP addresses should be forwarded to a port based on an additional field in the packet, such as time to live or a value in the IP packet options field.

A programmable data plane can forward packets using criteria other than the values in Layer 2 or IP packet fields. It can carry out load balancing by sending packets with the same parameters out of different ports. It can also implement other types of policy based on packet rate through the switch, for example, or it can encapsulate packets in any arbitrary format.

The ability to forward packets based on any arbitrary frame format could be useful to support a non-IP protocol, which some IoT devices use. A switch with a programmable data plane could forward these packets and modify them to be sent over an IP network.

The P4 language

A specialized programming language has been developed to configure programmable data planes: Programming Protocol-Independent Packet Processors (P4). This is an open source language maintained by the P4 Language Consortium. P4 is independent of the forwarding hardware design, so a compiler specific to the hardware must be developed to translate P4 statements to the hardware.


Nick McKeown explains the need for programmable data planes

A P4 program consists of a set of tables that specify fields within the packet and actions to be performed on those fields. A parser scans the incoming packet until it matches a pattern in a table entry, then it carries out the associated action. There is no defined set of fields or actions, so the P4 programmer is free to create them.

Programmable data planes are not the only way to support non-IP protocols. A chip can be designed to support any protocol or application, but it would be limited to that application. Developing semiconductors is a time-consuming and expensive process. A programmable data plane coupled with P4 provides a much more efficient and flexible way to deal with new protocols and new requirements on existing protocols.

Dig Deeper on Network infrastructure