Content deleted Content added
No edit summary |
m Update broken link to P4 paper |
||
(21 intermediate revisions by 16 users not shown) | |||
Line 1:
{{Short description|Language for controlling network data forwarding}}
{{Multiple issues|
Line 7:
{{Infobox programming language
| name = P4
| logo = P4-logo.svg
| paradigm = [[compiled language|compiled]], [[Domain-specific language|___domain-specific]], [[imperative programming|imperative]]
| year = {{start date and age|2013}}
| developer = [[
| latest_release_version = version 1.2.5<ref>{{cite web|title=
| latest_release_date = {{start date and age|df=yes|
| license = [[Apache Licence|Apache]]-style
| website = {{URL|
| file_ext = .p4
}}
'''P4''' is a [[programming language]] for controlling [[Network packet|packet]] [[forwarding plane]]s in networking devices, such as routers and switches. In contrast to a general purpose language such as [[C (programming language)|C]] or [[Python (programming language)|Python]], P4 is a [[___domain-specific language]] with a number of constructs optimized for [[Packet forwarding|network data forwarding]]. P4 is distributed as [[Open-source software|open-source]], [[Permissive free software licence|permissively licensed]] code, and is maintained by the P4 Project (formerly the P4 Language Consortium), a not-for-profit organization hosted by the [[Open Networking Foundation]].
== History ==
P4 was originally described in a 2014 [[Computer Communication Review|SIGCOMM ''CCR'']] paper titled “Programming Protocol-Independent Packet Processors”<ref>{{cite web
The programming language P4 was originally described in a SIGCOMM CCR paper in 2014 titled “Programming Protocol-Independent Packet Processors”<ref>{{cite web|url=http://www.sigcomm.org/node/3503|title=P4: Programming Protocol-Independent Packet Processors|date=July 2014|accessdate=7 April 2015}}</ref> – the alliterative name shortens to “P4”. The first P4 workshop took place in June, 2015 <ref>{{cite web |title="1st P4 Workshop" |url=https://p4.org/events/2015-06-04-p4-workshop/ |website=P4 Official Website |accessdate=1 August 2019}}</ref> at [[Stanford University | Stanford University]]. An updated specification of P4, called P4-16, was released between 2016 and 2017 <ref name="P4-16">{{cite web |title=P4-16 Specification |url=https://p4.org/p4-spec/docs/P4-16-v1.2.0.html |website=P4 Official Website |accessdate=23 October 2019}}</ref> replacing original specification of P4, called P4-14. ▼
|url=https://dl.acm.org/doi/10.1145/2656877.2656890
|title=P4: Programming Protocol-Independent Packet Processors
|author1=P. Bosshart
|author2=D. Daly
|author3=G. Gibb
|author4=M. Izzard
|author5=N. McKeown
|author6=J. Rexford
|author7=C. Schlesinger
|author8=D. Talayco
|author9=A. Vahdat
|author10=G. Varghese
|author11=D. Walker
|date=July 2014
|work=[[Computer Communication Review]]
|access-date=9 June 2025
▲
==Design==
As the language is specifically targeted at packet forwarding applications, the list of requirements or design choices is somewhat
===Target independence===
P4 programs are designed to be
===Protocol independence===
P4 is designed to be
===Reconfigurability===
Protocol independence and the abstract language model allow for
==Components==
P4 programs
===Parsing logic===
P4 allows the specification of custom packet header parsing logic
===Headers===
Header definitions describe packet formats and provide names for the fields within the packet. The language allows customized header names and fields of arbitrary length, although many header definitions use widely known protocol names and fields widths. For example, an [[IEEE 802.3|802.3]] Ethernet header definition might be called “Ethernet” and consist of
===Parsers===
The P4
===Stateful processing===
P4 allows the programmer to maintain state in the form of registers, counters and meters
===Generic match action tables===
The primary component of a P4 program is a set of user-defined match action tables. P4 treats all match action tables as generic, leaving the user to add their match-action rules via the control plane.
====Match-action processing====
Fundamental to P4 is the concept of
====Tables====
P4
====Actions====
==Control flow==
|