%BO%BMZ (MFO(JCC .BSUJO*[[BSE /JDL.D,FPXO +FOOJGFS 3FYGPSE $PMF4DIMFTJOHFS %BO5BMBZDP "NJO7BIEBU (FPSHF7BSHIFTF %BWJE8BMLFS l1SPHSBNNJOH1SPUPDPMJOEFQFOEFOU1BDLFU1SPDFTTPST z IUUQTBSYJWPSHQEGQEG͔ΒҾ༻ Software-Defined Networking (SDN) gives operators pro- grammatic control over their networks. In SDN, the con- trol plane is physically separate from the forwarding plane, and one control plane controls multiple forwarding devices. While forwarding devices could be programmed in many ways, having a common, open, vendor-agnostic interface (like OpenFlow) enables a control plane to control forward- ing devices from di↵erent hardware and software vendors. Version Date Header Fields OF 1.0 Dec 2009 12 fields (Ethernet, TCP/IPv4) OF 1.1 Feb 2011 15 fields (MPLS, inter-table metadata) OF 1.2 Dec 2011 36 fields (ARP, ICMP, IPv6, etc.) OF 1.3 Jun 2012 40 fields OF 1.4 Oct 2013 41 fields Table 1: Fields recognized by the OpenFlow standard The OpenFlow interface started simple, with the abstrac- tion of a single table of rules that could match packets on a dozen header fields (e.g., MAC addresses, IP addresses, pro- tocol, TCP/UDP port numbers, etc.). Over the past five years, the specification has grown increasingly more com- Figur Recen be achie grammi easy. E microco sign of indepen relation it how p as Open tables i stractio arXiv:1312
codes can be declared by users. 23 error { 24 NoError, /// No error. 25 PacketTooShort, /// Not enough bits in packet for 'extract'. 26 NoMatch, /// 'select' expression has no matches. 27 StackOutOfBounds, /// Reference to invalid element of a header stack. 28 HeaderTooShort, /// Extracting too many bits into a varbit field. 29 ParserTimeout /// Parser execution time limit exceeded. 30 } 66 /// Built-in action that does nothing. 67 action NoAction() {} 69 /// Standard match kinds for table key fields. 70 /// Some architectures may not support all these match kinds. 71 /// Architectures can declare additional match kinds. 72 match_kind { 73 /// Match bits exactly. 74 exact, 75 /// Ternary match, using a mask. 76 ternary, 77 /// Longest-prefix match. 78 lpm 79 }
a header from the packet into a fixed-sized header @hdr and advance the cursor. 34 /// May trigger error PacketTooShort or StackOutOfBounds. 35 /// @T must be a fixed-size header type 36 void extract<T>(out T hdr); 37 /// Read bits from the packet into a variable-sized header @variableSizeHeader 38 /// and advance the cursor. 39 /// @T must be a header containing exactly 1 varbit field. 40 /// May trigger errors PacketTooShort, StackOutOfBounds, or HeaderTooShort. 41 void extract<T>(out T variableSizeHeader, 42 in bit<32> variableFieldSizeInBits); 43 /// Read bits from the packet without advancing the cursor. 44 /// @returns: the bits read from the packet. 45 /// T may be an arbitrary fixed-size type. 46 T lookahead<T>(); 47 /// Advance the packet cursor by the specified number of bits. 48 void advance(in bit<32> sizeInBits); 49 /// @return packet length in bytes. This method may be unavailable on 50 /// some target architectures. 51 bit<32> length(); 52 }
@hdr into the output packet, advancing cursor. 56 /// @T can be a header type, a header stack, a header_union, or a struct 57 /// containing fields with such types. 58 void emit<T>(in T hdr); 59 } 61 // TODO: remove from this file, convert to built-in 62 /// Check a predicate @check in the parser; if the predicate is true do nothing, 63 /// otherwise set the parser error to @toSignal, and transition to the `reject` state. 64 extern void verify(in bool check, in error toSignal);
What is P4Runtime? • Framework for runtime control of P4 targets ◦ Open-source API + server implementation ▪ https://github.com/p4lang/PI ◦ Initial contribution by Google and Barefoot • Work-in-progress by the p4.org API WG • Protobuf-based API definition ◦ p4runtime.proto ◦ gRPC as a possible RPC transport • P4 program-independent ◦ API doesn’t change with the P4 program • Enables field-reconfigurability ◦ Ability to push new P4 program without recompiling deployed switches 46 p4runtime.proto (API) Program-independent server (e.g. gRPC) Target driver P4 target l1-BOHVBHF5VUPSJBMzIUUQTHJUIVCDPNQMBOHUVUPSJBMTSBXNBTUFS 1%@@'BMM1@[email protected]QEG͔ΒҾ༻
48 test.p4 test.json Control plane p4runtime.proto P4Runtime server BMv2 driver BMv2 simple_switch p4c-bm2-ss (compiler) P4Info • Captures P4 program attributes needed at runtime ◦ IDs for tables, actions, params, etc. ◦ Table structure, action parameters, etc. • Protobuf-based format • Target-independent compiler output ◦ Same P4Info for BMv2, ASIC, etc. test.p4info Full P4Info protobuf specification: https://github.com/p4lang/PI/blob/master/proto/p4/config/p4info.proto l1-BOHVBHF5VUPSJBMzIUUQTHJUIVCDPNQMBOHUVUPSJBMTSBXNBTUFS 1%@@'BMM1@[email protected]QEG͔ΒҾ༻
52 P4Runtime control server Target driver P4 target Local control plane OSPF BGP P4-defined protocol etc. table_entry { table_id: 33581985 match { field_id: 1 lpm { value: "\f\000\... prefix_len: 8 } } action { action_id: 16786453 params { param_id: 1 value: "\000\0... } params { param_id: 2 value: 7 } } } Same target-independent protobuf format p4info p4info The P4 Runtime API can be used equally well by a remote or local control plane l1-BOHVBHF5VUPSJBMzIUUQTHJUIVCDPNQMBOHUVUPSJBMTSBXNBTUFS 1%@@'BMM1@[email protected]QEG͔ΒҾ༻
11PSUBCMF4XJUDI"SDIJUFDUVSF 14" w IUUQTQPSHQTQFDEPDT14"IUNM w 1%FWFMPQFS%BZ 1% 'BMM w IUUQTXXXZPVUVCFDPNQMBZMJTU MJTU1-G)(3."M+#[($(D:QJNZ*T%OV4PP w 1-BOHVBHF5VUPSJBM w IUUQTHJUIVCDPNQMBOHUVUPSJBMTSBXNBTUFS1%@@'BMM 1@[email protected]QEG w 1QSPUPUZQFDPNQJMFS w IUUQTHJUIVCDPNQMBOHQD w 3FXSJUFPGUIFCFIBWJPSBMNPEFMBTB$ QSPKFDUXJUIPVUBVUPHFOFSBUFEDPEF FYDFQUGPSUIF1%JOUFSGBDF w IUUQTHJUIVCDPNQMBOHCFIBWJPSBMNPEFM w 13VOUJNFBDPOUSPMQMBOFGSBNFXPSLBOEUPPMTGPSUIF1QSPHSBNNJOHMBOHVBHF w IUUQTHJUIVCDPNQMBOH1* 38