p4 spec v1.1 (1185620)
Текст из файла
The P4 Language SpecificationVersion 1.1.0January 27, 2016The P4 Language Consortium© 2014-2016, The P4 Language ConsortiumCONTENTSCONTENTSContents1 Introduction1.1 The P4 Abstract Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1.2 The mTag Example . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . .1.3 Specification Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2 Structure of the P4 Language2.1 Abstractions . . . . . . . . . . . . . . . . . . . . . . . .2.2 Value Specifications . . . . . . . . . . . . . . . . . . .2.3 Types and declarations . .
. . . . . . . . . . . . . . . .2.4 P4 data types . . . . . . . . . . . . . . . . . . . . . . . .2.4.1 Principles . . . . . . . . . . . . . . . . . . . . .2.4.2 Base types . . . . . . . . . . . . . . . . . . . . .2.4.3 Portability . . . . . . . . . .
. . . . . . . . . . .2.4.4 No saturated types . . . . . . . . . . . . . . . .2.4.5 Boolean . . . . . . . . . . . . . . . . . . . . . .2.4.6 Unsigned integers (bit-strings) . . . . . . . . .2.4.7 Signed Integers . . . . . . . . . . . . . . . . . .2.4.8 Dynamically-sized bit-strings . . . . . . . .
. .2.4.9 Infinite-precision integers . . . . . . . . . . . .2.4.10 Integer literal types . . . . . . . . . . . . . . . .2.5 Base type operations . . . . . . . . . . . . . . . . . . .2.5.1 Computations on Boolean values . . . . . . .2.5.2 Operations on unsigned fixed-width integers2.5.3 Operations on signed fixed-width integers . .2.5.4 A note about shifts . . . . . .
. . . . . . . . . .2.5.5 varbit operations . . . . . . . . . . . . . . . .2.5.6 Operations on arbitrary-precision integers . .2.6 Casts . . . . . . . . . . . . . . . . . . . . . . . . . . . .2.6.1 Explicit casts . . . . . . . . . . . . . . . . . . . .2.6.2 Implicit casts . . . . . . . . . . .
. . . . . . . .2.6.3 Illegal expressions . . . . . . . . . . . . . . . .2.7 References . . . . . . . . . . . . . . . . . . . . . . . . .2.8 Expressions . . . . . . . . . . . . . . . . . . . . . . . .2.9 Pragma . . . . . . . . . . . . . . . . . . . . . . . . . . .5577....................................................................................................................................................................................................................................................................................................................88911121213131414141515161617171818192121222223242525263 Headers and Fields3.1 Header Type Declarations .
. . . . . . . . . . . . . . . . . .3.2 Header and Metadata Instances . . . . . . . . . . . . . . .3.2.1 Testing if Header and Metadata Instances are Valid3.2.2 Header Stacks . . . . . . . . . . . . . . . . . . . . . .........................................26262930312........................................................CONTENTSCONTENTS3.3 Header and Field References . . . . . . . .
. . . . . . . . . . . . . . . . . . . 323.4 Field Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324 Checksums and Hash-value generators334.1 Checksums . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . 345 Parser Specification5.1 Parsed Representation . . . . . . .5.2 Parser Operation . . . . . . . . . .5.3 Value Sets . . . . . . . . . . . . . .5.4 Parser Function BNF . . . . . . . .5.5 The extract Function . . . . . . . .5.6 Parser Exceptions . . . .
. . . . . .5.6.1 Standard Parser Exceptions5.6.2 Default Exception Handling................................................................................................................................................................................................3637373839414142426 Deparsing437 Standard Intrinsic Metadata438 Counters, Meters and Registers468.1 Counters .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478.2 Meters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488.3 Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . 499 Match+Action Table Overview5010 Actions10.1 Primitive Actions . . . . . . . . . . . . .10.1.1 Parameter Binding . . . . . . . .10.2 Action Definitions . . . . . . . . . . . . .10.2.1 Sequential Execution Semantics5152656667....................................................................................11 Action profile declarations6812 Table Declarations7013 Packet Processing and Control Flow7314 Egress Port Selection, Replication and Queuing7615 Recirculation and Cloning7715.1 Clone . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7715.1.1 Clone to Ingress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7815.1.2 Clone to Egress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 783CONTENTSCONTENTS15.1.3 Mirroring . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . 7915.2 Resubmit and Recirculate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8116 Extern objects8116.1 Extern types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8216.2 Extern Instances . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . 8317 Appendices17.1 Programming Conventions . . . . . . . . . . . . . . . . . .17.2 Revision History . . . . . . . . . . . . . . . . . . . . . . . . .17.2.1 Summary of changes introduced in 1.1.0 . . . . . .17.3 Terminology (Incomplete) . . . . . . . . .
. . . . . . . . . .17.4 Summary of P4 BNF . . . . . . . . . . . . . . . . . . . . . .17.5 P4 Reserved Words . . . . . . . . . . . . . . . . . . . . . . .17.6 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17.6.1 The Annotated mTag Example . . . . . . . . . . . .17.6.2 Adding Hysteresis to mTag Metering with Registers17.6.3 ECMP Selection Example . . . . . . . . . .
. . . . .17.7 Addendum for Version 1.1.0 . . . . . . . . . . . . . . . . . .17.7.1 Architecture-language separation . . . . . . . . . .17.7.2 Targets . . . . . . . . . . . . . . . . . . . . . . . . . .17.7.3 Target Architecture Structure . . . . . . . . . . . . .17.7.4 Target Architecture Selection .
. . . . . . . . . . . .17.7.5 Programmable blocks . . . . . . . . . . . . . . . . .17.7.6 Standard Library . . . . . . . . . . . . . . . . . . . .17.7.7 Standard Switch Architecture . . . . . . . . . . . . .17.8 References . . . . . . . . . . . . . . . . . . . . . . . . . . . .4..............................................................................................................................................................................................8484848486869597971121141151151161161171181191211241 INTRODUCTION1IntroductionP4 is a language for expressing how packets are processed by the pipeline of a networkforwarding element such as a switch, NIC, router or network function appliance.
It isbased upon an abstract forwarding model consisting of a parser and a set of match+action table resources, divided between ingress and egress. The parser identifies theheaders present in each incoming packet. Each match+action table performs a lookupon a subset of header fields and applies the actions corresponding to the first matchwithin each table.
Figure 1 shows this model.P4 itself is protocol independent, and hence users can define the forwarding behaviorof their own data-plane protocols in P4. A P4 program specifies the following for eachforwarding element.• Header definitions: the format (the set of fields and their sizes) of each headerwithin a packet.• Parse graph: the permitted header sequences within packets.• Table definitions: the type of lookup to perform, the input fields to use, the actionsthat may be applied, and the dimensions of each table.• Action definitions: compound actions composed from a set of primitive actions.• Pipeline layout and control flow: the layout of tables within the pipeline and thepacket flow through the pipeline.P4 addresses the configuration of a forwarding element.
Характеристики
Тип файла PDF
PDF-формат наиболее широко используется для просмотра любого типа файлов на любом устройстве. В него можно сохранить документ, таблицы, презентацию, текст, чертежи, вычисления, графики и всё остальное, что можно показать на экране любого устройства. Именно его лучше всего использовать для печати.
Например, если Вам нужно распечатать чертёж из автокада, Вы сохраните чертёж на флешку, но будет ли автокад в пункте печати? А если будет, то нужная версия с нужными библиотеками? Именно для этого и нужен формат PDF - в нём точно будет показано верно вне зависимости от того, в какой программе создали PDF-файл и есть ли нужная программа для его просмотра.