programmable-data-plane-p4.md (947B)
1 +++ 2 title = 'Programmable data plane (P4)' 3 +++ 4 5 ## Programmable data plane (P4) 6 All network features are centered around the capabilities of the ASIC, and it takes years for a new one to be developed and deployed. 7 So, make the ASIC programmable, and let your features tell the ASIC what to support. 8 9 PISA: protocol independent switch architecture 10 11 P4: domain-specific language for programming protocol-independent packet processors 12 13 Architecture specific constructs 14 - each architecture defines "externs" - blackbox functions whose interface is known 15 - P4 aims to be target-independent 16 17 P4 is C-like, statically typed. 18 19 Parser: 20 - uses state machine to map packets into headers and metadata 21 - `transition` statements move between states, with final accept/reject states 22 23 Control: 24 - tables: match a key and return an action 25 - actions: like C functions 26 - control flow is similar to C, but no loops 27 28 Deparser assembles the packet from data structures.