Petr4: Formal Foundations for P4 Data Planes
Ryan Doenges, Mina Tahmasbi Arashloo, Santiago Bautista, Alexander, Chang, Newton Ni, Samwise Parkinson, Rudy Peterson, Alaia Solko-Breslin,, Amanda Xu, Nate Foster

TL;DR
Petr4 provides a formal, mathematically rigorous foundation for the P4 language, enabling precise reasoning about packet-processing programs and verifying their correctness.
Contribution
It introduces a formal semantics framework and a core calculus for P4, along with a verified interpreter and termination proof, addressing the lack of formal foundations in P4.
Findings
Validated the interpreter with 750+ tests from the reference implementation.
Proved termination of all programs in the core calculus.
Identified and fixed dozens of bugs in the P4 specification and implementation.
Abstract
P4 is a domain-specific language for programming and specifying packet-processing systems. It is based on an elegant design with high-level abstractions like parsers and match-action pipelines that can be compiled to efficient implementations in software or hardware. Unfortunately, like many industrial languages, P4 has developed without a formal foundation. The P4 Language Specification is a 160-page document with a mixture of informal prose, graphical diagrams, and pseudocode. The P4 reference implementation is a complex system, running to over 40KLoC of C++ code. Clearly neither of these artifacts is suitable for formal reasoning. This paper presents a new framework, called Petr4, that puts P4 on a solid foundation. Petr4 consists of a clean-slate definitional interpreter and a calculus that models the semantics of a core fragment of P4. Throughout the specification, some aspects…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
