P4 (programming language): Difference between revisions

Content deleted Content added
Note foundation hosting by the ONF; flesh out a reference, format and link to publication; MOS:NOBOLD fixes; other ce
m Update broken link to P4 paper
 
(13 intermediate revisions by 9 users not shown)
Line 1:
{{Short description|Language for controlling network data forwarding}}
{{about|the programming language|the Perforce version control system|Perforce|other uses|P4 (disambiguation)}}
 
{{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 = [[TheOpen P4Networking Language ConsortiumFoundation]]
| latest_release_version = version 1.2.5<ref>{{cite web|title=P4P416 Language and Related SpecificationsSpecification |url=https://p4.org/p4wp-speccontent/docsuploads/2024/10/P4-16-spec-v1.2.05.html |accessdate=213 DecemberNovember 20192024}}</ref>
| latest_release_date = {{start date and age|df=yes|20192024|10|23}}
| license = [[Apache Licence|Apache]]-style
| website = {{URL|httphttps://p4.org}}
| 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
|url=httphttps://wwwdl.sigcommacm.org/nodedoi/350310.1145/2656877.2656890
|title=P4: Programming Protocol-Independent Packet Processors
|author1=P. Bosshart
Line 36 ⟶ 37:
|date=July 2014
|work=[[Computer Communication Review]]
|access-date=79 AprilJune 20152025
}}</ref>—the alliterative name shortens to "P4". The first P4 workshop took place in June 2015 at [[Stanford University]].<ref>{{cite web |title=1st P4 Workshop |url=https://p4.org/events/2015-06-04-p4-workshop/ |website=P4 Official Website |date=4 June 2015 |accessdate=1 August 2019}}</ref> An updated specification of P4, called P4-16, was released between 2016 and 2017,<ref name="P4-16">{{cite web |title=P4-16 SpecificationSpecifications |url=https://p4.org/p4-specspecs/docs/P4-16-v1.2.0.html |website=P4 Official Website |accessdate=237 OctoberJune 20192022}}</ref> replacing P4-14, the original specification of P4.
 
==Design==
As the language is specifically targeted at packet forwarding applications, the list of requirements or design choices is somewhat unusualspecific to those use cases. The language is designed to meet several goals:
 
===Target independence===
Line 58 ⟶ 59:
 
===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 the a 48-bit field named “dest” followed by a 48-bit “src” field, followed by a 16-bit “type” field. The names in a header definition are used later in the P4 program to reference these fields.
 
===Parsers===