P 4 specifying data planes http P 4

  • Slides: 17
Download presentation
P 4: specifying data planes http: //P 4. org netdev 0. 1 Ottawa, February

P 4: specifying data planes http: //P 4. org netdev 0. 1 Ottawa, February 15, 2015 Mihai Budiu

P 4 Language Consortium • “Open for participation by any individual or corporation” •

P 4 Language Consortium • “Open for participation by any individual or corporation” • http: //p 4. org • Language spec v 1. 0. 1 • Coming soon (3/2015): FOSS release of a reference P 4 implementation 2

What do we want to achieve? Switch Currently most useful if you have your

What do we want to achieve? Switch Currently most useful if you have your own network playground Standard protocols Your own protocols Datacenter 3

Benefits • Implement (new) protocols • Vx. LAN: 175 lines of code • NVGRE:

Benefits • Implement (new) protocols • Vx. LAN: 175 lines of code • NVGRE: 183 lines of code • Low overhead (high speed) • Flexible forwarding policies • Improved signaling, monitoring, and troubleshooting • Change functionality with software upgrades • Use only what you need 4

P 4 Scope Traditional switch P 4 -defined switch Control plane Data plane Control

P 4 Scope Traditional switch P 4 -defined switch Control plane Data plane Control plane Table mgmt Control traffic Packets P 4 Program P 4 table mgmt Data plane 5

Q: Which data plane? A: Any data plane! Control plane Programmable switches FPGA switches

Q: Which data plane? A: Any data plane! Control plane Programmable switches FPGA switches Programmable NICs Software switches You name it… Data plane 6

Data plane programmability Programmable blocks Data plane P 4 P 4 Fixed function 7

Data plane programmability Programmable blocks Data plane P 4 P 4 Fixed function 7

How does it work? Programmable parser eth vlan ipv 4 Headers Payload Packet (byte[])

How does it work? Programmable parser eth vlan ipv 4 Headers Payload Packet (byte[]) Programmable match-action units eth ipv 4 mtag err port bcast Queueing Metadata Headers eth mtag ipv 4 Programmable reassembly Packet 8

P 4 language Programmable parser State-machine; bitfield extraction Programmable match-action units Table lookup and

P 4 language Programmable parser State-machine; bitfield extraction Programmable match-action units Table lookup and update; bitfield manipulation; control flow Programmable reassembly Bitfield assembly No: memory (pointers), loops, recursion, floating point 9

Parsing = State machines header_type ethernet_t { fields { dst. Addr : 48; src.

Parsing = State machines header_type ethernet_t { fields { dst. Addr : 48; src. Addr : 48; ether. Type : 16; } } Eth VLAN IPv 4 IPv 6 TCP New parser parse_ethernet { extract(ethernet); return select(latest. ether. Type) { 0 x 8100 : parse_vlan; 0 x 800 : parse_ipv 4; 0 x 86 DD : parse_ipv 6; } } 10

Match � table ipv 4_lpm { reads { ipv 4. dst. Addr : lpm;

Match � table ipv 4_lpm { reads { ipv 4. dst. Addr : lpm; } actions { set_next_hop; drop; } } Lookup key dst. Addr action 0. * drop 10. 0. 0. * set_next_hop 224. * drop 192. 168. * drop 10. 0. 1. * set_next_hop 11

Actions action set_nhop(nhop_ipv 4_addr, port) { modify_field(metadata. nhop_ipv 4_addr, nhop_ipv 4_addr); modify_field(standard_metadata. egress_port, port);

Actions action set_nhop(nhop_ipv 4_addr, port) { modify_field(metadata. nhop_ipv 4_addr, nhop_ipv 4_addr); modify_field(standard_metadata. egress_port, port); add_to_field(ipv 4. ttl, -1); } dst. Addr action 0. * drop 10. 0. 0. * set_next_hop 224. * drop 192. 168. * drop 10. 0. 1. * set_next_hop nhop_ipv 4_addr port 10. 0. 0. 10 1 10. 0. 1. 10 2 12

Control-Flow M/A control ingress { apply(port); M/A if (valid(vlan_tag[0])) { apply(port_vlan); } apply (bridge_domain);

Control-Flow M/A control ingress { apply(port); M/A if (valid(vlan_tag[0])) { apply(port_vlan); } apply (bridge_domain); M/A if (valid(mpls_bos)) { apply(mpls_label); } M/A retrieve_tunnel_vni(); if (valid(vxlan) or valid(genv) or valid(nvgre)) { apply(dest_vtep); M/A apply(src_vtep); } } 13

Reassembly • Driven by header types • add_header(ipv 6); • remove_header(vlan); 14

Reassembly • Driven by header types • add_header(ipv 6); • remove_header(vlan); 14

Table contents management Control plane Manage tables contents (Tied to P 4 program) Data

Table contents management Control plane Manage tables contents (Tied to P 4 program) Data plane 15

P 4 Summary • Simple language • Parsing, bit-field manipulation, table lookup, control flow,

P 4 Summary • Simple language • Parsing, bit-field manipulation, table lookup, control flow, packet reassembly • • • Efficient execution (high speed switching) Simple cost model Abstract resources Portable Expressive: • New protocols, forwarding policies, monitoring and instrumentation 16

Control plane The P 4 Programming. Language Interface Data plane 17

Control plane The P 4 Programming. Language Interface Data plane 17