P4 (programming language): Difference between revisions

Content deleted Content added
m top: capitalization
FrescoBot (talk | contribs)
m Bot: link syntax and minor changes
Line 20:
 
== History ==
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.
 
==Design==
Line 29:
 
===Protocol independence===
P4 is designed to be '''protocol-independent''', meaning that the language has no native support even for common protocols such as IP, Ethernet, TCP, [[Virtual Extensible LAN|VxLAN]], or [[Multiprotocol Label Switching|MPLS]]. Instead, the P4 programmer describes the header formats and field names of the required protocols in the program, which are in turn interpreted and processed by the compiled program and target device.
 
===Reconfigurability===
Protocol independence and the abstract language model allow for '''reconfigurability''' – P4 targets should be able to change the way they process packets (perhaps multiple times) after they are deployed. This capability is traditionally associated with forwarding planes built on [[History of general-purpose CPUs|general-purpose CPUs]] or [[network processor]]s, rather than the fixed function [[Application-specific integrated circuit|ASICs]]. Although within the language there is nothing to prevent a given target from optimizing around a certain set of protocols, these optimizations are invisible to the language author and may ultimately reduce the system's flexibility and reconfigurability goals.
 
==Components==
Line 38:
 
===Parsing logic===
P4 allows the specification of custom packet header parsing logic <ref name="P4-16"/> including but not limited to parsing typical headers used in the TCP/IP protocol suite and application specific headers.
 
===Headers===
Line 47:
 
===Stateful processing===
P4 allows the programmer to maintain state in the form of registers, counters and meters <ref name="P4-16"/>.
 
===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. <ref name="P4-16"/>.
 
====Match-action processing====
Fundamental to P4 is the concept of '''match-action pipelines'''. Conceptually, forwarding network packets or frames can be broken down into a series of table lookups and corresponding header manipulations. In P4 these manipulations are known as “actions” and generally consist of things such as copying byte fields from one ___location to another based on the lookup results on learned forwarding state. P4 addresses only the data plane of a packet forwarding device. It does not specify the control plane nor any exact protocol for communicating state between the control and data planes. Instead, P4 uses the concept of tables to represent forwarding plane state. An interface between the control plane and the various P4 tables must be provided to allow the control plane to inject/modify state in the program. This interface is generally referred to as the “program API”.
 
====Tables====
Line 59:
 
====Actions====
'''Actions''' in P4 describe packet field and [[metadata]] manipulations. In P4 context, metadata is information about a packet that is not directly derived from the parser, such as the input interface that the frame arrived on. English descriptions of an example action might be “decrement the IPv4 [[Time to live|TTL]] field by one” or “copy the MAC address from the output port table into the outgoing packet header.” <ref>{{cite web |url=http://lists.p4.org |title=P4 Mailing Lists |date=July 2015 |accessdate=15 July 2015}}</ref> P4 defines both standard metadata that must be provided by all targets as well as target-specific metadata, which is provided by the author of specific targets.
 
==Control flow==