论文标题

PETR4:P4数据平面的正式基础

Petr4: Formal Foundations for P4 Data Planes

论文作者

Doenges, Ryan, Arashloo, Mina Tahmasbi, Bautista, Santiago, Chang, Alexander, Ni, Newton, Parkinson, Samwise, Peterson, Rudy, Solko-Breslin, Alaia, Xu, Amanda, Foster, Nate

论文摘要

P4是一种针对编程和指定数据包处理系统的特定领域语言。它基于一种优雅的设计,具有高级抽象(例如解析器和匹配行动管道),可以将其编译为软件或硬件中的有效实现。不幸的是,像许多工业语言一样,P4没有正式的基础发展。 P4语言规范是一份160页的文档,其中包含非正式散文,图形图和伪代码的混合物。 P4参考实现是一个复杂的系统,可运行到C ++代码的40KLOC以上。显然,这些文物都不适合正式推理。 本文提出了一个名为PETR4的新框架,该框架将P4固定在坚实的基础上。 PETR4由一个清洁式定义性解释器和一个对P4核心片段的语义进行建模的演算。在整个规范中,程序行为的某些方面都留为目标。我们的解释器通过目标接口进行参数化,该目标接口在单个接口中收集规范中的所有特定于目标行为。 该规范对某些程序构造的嵌套构成了临时限制,以简化编译并避免非终止程序的可能性。我们通过分层其类型系统,而不是施加非自然的句法限制,从而捕获了核心演算中的后者意图,我们证明了该核心演算中的所有程序终止。 我们已经通过P4参考实现的750多个测试验证了解释器,并通过对不同目标进行测试行使目标界面。我们通过诱导分层类型系统建立了核心演算的终止。在开发PETR4时,我们报告了数十个语言规范和参考实现的错误,其中许多已固定。

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 of program behavior are left up to targets. Our interpreter is parameterized over a target interface which collects all the target-specific behavior in the specification in a single interface. The specification makes ad-hoc restrictions on the nesting of certain program constructs in order to simplify compilation and avoid the possibility of nonterminating programs. We captured the latter intention in our core calculus by stratifying its type system, rather than imposing unnatural syntactic restrictions, and we proved that all programs in this core calculus terminate. We have validated the interpreter against a suite of over 750 tests from the P4 reference implementation, exercising our target interface with tests for different targets. We established termination for the core calculus by induction on the stratified type system. While developing Petr4, we reported dozens of bugs in the language specification and the reference implementation, many of which have been fixed.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源