What you should know about P4 programming language& P4 programmable switch (2022)

What is P4 programming language?

P4 is a domain-specific programming language used to describe how a programmable forwarding hardware processes packets, whichcan be an ASIC, a FPGA or a NICand so on. The full mane P4 isProgramming Protocol-independent Packet Processors.

P4 originally designed for programmable switches (especiallyfortheASIC), now P4 has expanded to manyscenarios. In P4, the term “target”is used to refer tothehardware.

A network device usually includesa control plane and a data forwarding plane. P4 is designed to be used to programmingthe target’s data plane.

The following picture shows the difference between a traditionalswitch and a P4 programmable switch:
What you should know about P4 programming language& P4 programmable switch (1)

In a traditional switch, ASIC determineswhat functions itsdata planecan support, the control plane is responsible for processing packets (such as routing protocol packets), processing asynchronous events (such asportup/down), etc. Its purpose is to control the forwarding behaviorbycorrectly setting varioustableof the ASIC. Therefore, the functions supported by the AISCdetermineswhat functions the switch can support. However, the P4 programmable switch is different, the functionsof the data planearenot fixed but are defined by the P4 program.

  • P4 is protocol independent: it does not even support the most common protocols like IP, TCP, VxLAN or MPLS. Instead,theprogrammersdescribethe header format and field names of the neededprotocol in the program, which is then interpreted and processed by the compiled program and the target device.
  • Data Plane Programming: P4 programmability makesusers to develop new and customizedfunctions, removes unnecessary functions and tablesto reduce complexity,meanwhile offers a bettervisibility, including diagnostics, telemetry, OAM, etc,. Modularity letusers to combine packet forwarding behavior from the library, which can be compiled to many devices sincethe forwarding behavior is specifiedonce. Instead of relying on ASICS, protocols are transmittedto software because of code-specific functionality thatprovidesprecise control of packets.
What you should know about P4 programming language& P4 programmable switch (2)
(Video) P4 programming language - introduction to network programming with P4

History of P4 programming language

The idea of P4 wasoriginallyborn in 2013, proposed by ProfessorNick Mckeown of Stanford University, and the first formal specification of the P4 language was released in 2014, called P4_14. The first P4 workshop held in June 2015 at Stanford University. After that, an updatedspecification P4_16 was released in 2016.

Professor Nick Mckeown not only has agoodacademicreputation, but also a pioneer in the SDN industry. He has led and participated in many SDN open-source projects: OpenFlow protocol, the first SDN controller NOX, etc. He has founded several successful SDN companies: Nicira (acquired by VMware), Barefoot Network (acquired by Intel), etc.

P4 programmable switches’ applicationscenarios

Firstly, is to replace traditional network elements. There needs to mentionFacebook SilkRoad Layer4 load balancingimplementation. By using the feature of P4 flexibleschedule on-chip resources, it realized load balancing of up to 10 million stateful flow tables on Barefoot Tofino chipand the throughput can reach Tbps .Theperformance is far exceedingthe Layer 4load balancing equipment on the market.

What you should know about P4 programming language& P4 programmable switch (3)

The second is dedicated clusters. Network switching is responsible for forwarding packets which need cooperate with the server cluster to form a complete system. Thus, Programmable switching can be used to participate in multi-node distributed collaboration and coordination.​For example, pairwise unicast can be turned into multicast accelerated coordination. In addition, part of server’s logic can be offloaded to a programmable switch chip.​The Integration architecture of programmable switches and server clusters can optimize dedicated distributed clusters greatly.

Third, A fabric cluster of small switches formed from a CLOS group fabric, equivalent to a large switch. In a data center scenario, all it needs to implement is a cloud-native Fabric cluster. At present, there are two mainmethods implement fabric control for data centers. One is that the fabric only implements simple underlay routing, and the complex logic is undertaken by the host or SmartNIC, represented by SONiC. Theotheris cloud network functions such as tenant isolation, load balancing, flow control, INT, etc., areallsinktothe fabric,represented by Stratum on ONF.

(Video) Programming the Network Data Plane in P4

Fourth, Inband Network Telemetry(INT) whichwas the best-known feature of the P4 when it came out. It is mainly solving the four pain points of Intranet traffic tracking:

What you should know about P4 programming language& P4 programmable switch (4)
  • First, which path does the network packet goes
  • Second, the reason why chooses this path,which protocol refer to
  • Third, how longdoesit stay at each hop node
  • Fourth, anyother flows are sharingthis physical link

INT takes full advantage P4’s programmable feature by adding INT tags to each hop, when the last hop finished, these tags are uploading into thebackendsystemsto analyze the information needed in the previous four questions. As a result, online packet-level visualization can be realized, which is very important for network diagnosis and monitoring,operation and maintenance, and also makes the network data planeincreasingly transparent and detectable.

To summarize:

  • NFV.P4 replaces or even optimizes the implementation of traditional network elements, such as load balancing, security, distributed denials of service (DDoS) attacks, firewall, cloud gateway, TAP network packet broker, etc.
  • Cluster.P4 accelerates specific distributed clusters through barefoot tofino programmable switches, such as NetCache accelerates distributed key-Value store,NetChain accelerates distributed coordination, SwitchML accelerates machine learning, etc.
  • Fabric.p4 is to build a data center switch through the CLOS architecture. The goal is to use network slicingand intranet load balancing to achieve cloud-native Fabric clusters.
  • Telemetry.p4 is mainly for data plane’s online diagnosis and visualization, making the ultra-high-speed data plane still observable.

Asterfusion offers 3.3Tbps-6.5 Tbps programmable network switches based on Intel tofino which are well-suited for Leaf/Spine fabric as well as smart gateway of data centers, enterprises, and cloud service providers’ network deployments.

Highlight 1: When P4 meets DPU, Intel Tofino encounters Marvell Octeon

Asterfusion X-T series is unique P4 switch which designed to combine high performance L2~L4 switching programmability and extensible stateful processing power from DPU for the first time in network history.

(Video) End to End Network Programmability with P4

Intel Tofino switching silicon plus 800G data path connection with Marvell OcteonTX 9/10 DPU, Asterfusion combines P4 based data path on tofino switch and DPDK based traffic processing on ARM64 DPU to provide large stateful table for load balance, NAT and NVME over fabric applications.

X-T programmable switches adopt a computing-network integration architecture, it has the general programmability of CPU while retaining the extreme performance of Intel Tofino ASIC. The combination of the T-bit level fast path for high-performance wire-speed forwarding and the slow path of in-depth data processing, achieves in-depth service processing and application offloading, enhances data center overall computing power and efficiency.

What you should know about P4 programming language& P4 programmable switch (5)

Highlight 2: Ongoing Expert Support

Asterfusion began research on open-source networks since 2014 when has accumulated a wealth of expertise and R & D experience, enable provides expert-level support service to solve the various problems that encountered in the process of open networking development.

Tofino programmable switches support various network applications’ development. Based on the integrated computing &network architecture and expert support, the Bare Tofino P4 series programmable hardware platform can cope with the challenges of various innovative application scenarios.

Traffic scheduling gateway, precise port rate limit and traffic scheduling for the main and backup link, high performance delivers extreme ROI.

(Video) P4-programmable smartNIC controlled by ONOS

What you should know about P4 programming language& P4 programmable switch (6)

NFV gateways, state-based load balancing/state-based network address translation, reducing the burden of data centers.

What you should know about P4 programming language& P4 programmable switch (7)

Large /small flow separation, it can both meet the high bandwidth of large flow and high concurrency of small flow.

What you should know about P4 programming language& P4 programmable switch (8)

Distributed INT-driven intelligence network optimization, providing local real- time network telemetry information, improving the overall user experience of the application system.

What you should know about P4 programming language& P4 programmable switch (9)

Asterfusion Tofino based P4 Programmable switches’ software choices:

  • Asterfusion SONiC enterprise distributionAsterNOS
  • DPDK, VPP and virtIO on octeon TX DPU
What you should know about P4 programming language& P4 programmable switch (10)
(Video) KEYNOTE - From Programmable Switches to Programmable Networks - Nate Foster, Cornell University

Asterfusion Barefoot Tofino based P4 programmable switches help customers to solve pain points of where needs to program their networking data plane, especially for teams who has the in-house expertise to program networking chips.

Asterfusion offers high educational discount on academia and research program for P4 programmingswitch research and experiments.

Welcome to consult [emailprotected]; [emailprotected],[emailprotected]


1. P4 Runtime Implementation in P4.org projects
(P4 Language Consortium)
2. vswitch.p4: Why OVS Needs P4
(Open vSwitch)
3. Keynote: P4 at the Edge
(P4 Language Consortium)
4. 20220216 - Programmable Switches Workshop - Overview of P4 and programmable switches
(Engagement and Performance Operations Center(EPOC))
5. Next-Gen SDN Tutorial - Session 1: P4 and P4Runtime Basics
(Open Networking Foundation)
6. 01 Introduction to Data Plane Programming (Stephen Ibanez)
(P4 Language Consortium)

You might also like

Latest Posts

Article information

Author: Dong Thiel

Last Updated: 05/25/2022

Views: 6303

Rating: 4.9 / 5 (59 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Dong Thiel

Birthday: 2001-07-14

Address: 2865 Kasha Unions, West Corrinne, AK 05708-1071

Phone: +3512198379449

Job: Design Planner

Hobby: Graffiti, Foreign language learning, Gambling, Metalworking, Rowing, Sculling, Sewing

Introduction: My name is Dong Thiel, I am a brainy, happy, tasty, lively, splendid, talented, cooperative person who loves writing and wants to share my knowledge and understanding with you.