Slide 1

Slide 1 text

P4 新手初探 2018/05/26, Taiwan, SDN x Cloud Native Meetup Presenter: Shan-Jung Fu (Samina) 1 Slides: http://bit.ly/p4cntug

Slide 2

Slide 2 text

Hello! I am Shan-Jung Fu (Samina). ● A master student in computer science at NCTU ● Was a Information Technology Service Center Network & System Engineer at NCTU before ● You can find me at ○ GitHub: @sufuf3 ○ Twitter: @sufuf3149 2

Slide 3

Slide 3 text

Outline ● What is P4 ● Why P4 ● P4.org Membership ● The concept of Packet processing w/ P4 ● Key Components of P4 ● P4 16 Language ● Example of P4 pipeline ● P4 Compiler ● Environments ● Try P4 ● What can you do with P4? ● Conclusion 3

Slide 4

Slide 4 text

● What is P4 ● Why P4 ● P4.org Membership ● The concept of Packet processing w/ P4 ● Key Components of P4 ● P4 16 Language ● Example of P4 pipeline ● P4 Compiler ● Environments ● Try P4 ● What can you do with P4? ● Conclusion Outline 4

Slide 5

Slide 5 text

● Programming Protocol-Independent Packet Processors ○ processors: eg. switches, smart NIC, etc ● Web site: https://p4.org ● GitHub: https://github.com/p4lang ● White Paper(July 2014) What is P4 5

Slide 6

Slide 6 text

What is P4 (Cont’d) ● A high-level language ● Can program the network data plane Ref: https://www.slideshare.net/Docker/docker-networking-control-plane-and-data-plane 6

Slide 7

Slide 7 text

● What is P4 ● Why P4 ○ Motivation ○ Benefits ● P4.org Membership ● The concept of Packet processing w/ P4 ● Key Components of P4 ● P4 16 Language ● Example of P4 pipeline ● P4 Compiler ● Environments ● Try P4 ● What can you do with P4? ● Conclusion Outline 7

Slide 8

Slide 8 text

● Network changes Motivation 2014 P4: Programming Protocol-Independent Packet Processors 2008 Software Defined Networking (SDN) with OpenFlow Before 2008 Traditional Network ● Motivation ● Benefits 8

Slide 9

Slide 9 text

Software-Defined Networking(SDN) ● Physical separation of the network control plane from the forwarding plane (data plane) ● Control plane controls several devices ● The network control to become directly programmable ● Motivation ● Benefits Ref: https://www.sdxcentral.com/sdn/definitions/inside-sdn-architecture/ 9

Slide 10

Slide 10 text

SDN with OpenFlow ● Motivation ● Benefits Ref: http://flowgrammable.org/sdn/openflow/ https://www.opennetworking.org/images/stories/downloads/sdn-resources/onf-specifications/ope nflow/openflow-spec-v1.4.0.pdf#page=9 10

Slide 11

Slide 11 text

Using P4 to solve OpenFlow problems ● OpenFlow explicitly specifies protocol headers on which it operates. This set has grown from 12 to 41 fields in a few years, increasing the complexity of the specification while still not providing the flexibility to add new headers. ● Motivation ● Benefits Versio n 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 Ref: https://www.sigcomm.org/sites/default/files/ccr/papers/2014/July/0000000-0000004.pdf 11

Slide 12

Slide 12 text

The goals of P4 ● Reconfigurability in the field ● Protocol independence ○ Switches should not be tied to any specific network protocols. ○ Controller should be able to specify ■ A packet parser for extracting header fields with particular names and types ■ A collection of typed match + action tables that process these headers ● Target independence ○ Programmers should be able to describe packet-processing functionality independently of the specifics of the underlying hardware. ● Motivation ● Benefits Ref: https://www.sigcomm.org/sites/default/files/ccr/papers/2014/July/0000000-0000004.pdf 12

Slide 13

Slide 13 text

Benefits of P4 Benefits of Data Plane Programmability ● New Features - Add new protocols ● Reduce complexity - Remove unused protocols ● Efficient use of resources - flexible use of tables ● Greater visibility - New diagnostic techniques, telemetry, etc. ● Software style development - rapid design cycle, fast innovation, fix data plane bugs in the field ● You keep your own ideas Think programming rather than protocols... ● Motivation ● Benefits Ref: https://p4.org/p4-spec/docs/P4-16-v1.0.0-spec.html#sec-benefits-of-p4 && https://p4.org/assets/P4_tutorial_01_basics.gslide.pdf 13

Slide 14

Slide 14 text

● What is P4 ● Why P4 ● P4.org Membership ● The concept of Packet processing w/ P4 ● Key Components of P4 ● P4 16 Language ● Example of P4 pipeline ● P4 Compiler ● Environments ● Try P4 ● What can you do with P4? ● Conclusion Outline 14

Slide 15

Slide 15 text

P4.org Membership ● Ref: https://github.com/p4lang/tutorials/blob/master/P4D2_2017_Fall/P4_tutorial_labs.pdf 15

Slide 16

Slide 16 text

● What is P4 ● Why P4 ● P4.org Membership ● The concept of Packet processing w/ P4 ● Key Components of P4 ● P4 16 Language ● Example of P4 pipeline ● P4 Compiler ● Environments ● Try P4 ● What can you do with P4? ● Conclusion Outline 16

Slide 17

Slide 17 text

The concept of Packet processing w/ P4 ● Headers ○ Describes the sequence & structure of a series of fields typedef bit<48> macAddr_t; typedef bit<32> ip4Addr_t; header ethernet_t { macAddr_t dstAddr; macAddr_t srcAddr; bit<16> etherType; } 17

Slide 18

Slide 18 text

● Parsers ○ Specifies how to identify headers & valid header sequences within packets The concept of Packet processing w/ P4 (Cont’d) MAC Header IP Header TCP header data 18

Slide 19

Slide 19 text

The concept of Packet processing w/ P4 (Cont’d) ● Parsers ○ Specifies how to identify headers & valid header sequences within packets header ethernet_t { macAddr_t dstAddr; macAddr_t srcAddr; bit<16> etherType; } dstAddr = 8000207A3F3E srcAddr = 800020203AAE etherType = 0x800 19

Slide 20

Slide 20 text

● After the switch parse headers’ value, the switch needs to process the packet. ● How does the switch process the headers’ value? 1. Write some logical program to deal with them ■ Actions 2. Invoke the actions according to the rules which are sent from the SDN controller ■ Tables ● Control Program ○ Determines the order of tables that are applied to a packet. A simple imperative program describe the flow of control between match + action tables The concept of Packet processing w/ P4 (Cont’d) 20

Slide 21

Slide 21 text

The concept of Packet processing w/ P4 (Cont’d) SDN controller table_add ipv4_lpm ipv4_forward 10.0.1.1/32 => 00:00:00:00:01:01 1 Table name Action name Key table ipv4_lpm { key = { hdr.ipv4.dstAddr: lpm; } action = { ipv4_forward; drop; NoAction; } ...} 21

Slide 22

Slide 22 text

● Match-Action Processing The concept of Packet processing w/ P4 (Cont’d) Ref: https://p4.org/assets/P4_tutorial_01_basics.gslide.pdf 22

Slide 23

Slide 23 text

● What is P4 ● Why P4 ● P4.org Membership ● The concept of Packet processing w/ P4 ● Key Components of P4 ● P4 16 Language ● Example of P4 pipeline ● P4 Compiler ● Environments ● Try P4 ● What can you do with P4? ● Conclusion Outline 23

Slide 24

Slide 24 text

● Headers ○ Describes the sequence & structure of a series of fields ● Parsers ○ Specifies how to identify headers & valid header sequences within packets ● Tables (match + action tables) ○ The mechanism for performing packet processing ● Actions ○ P4 supports construction of complex actions from simpler protocol-independent primitives. These complex actions are available within match + action tables. ● Control Program ○ Determines the order of tables that are applied to a packet. A simple imperative program describe the flow of control between match + action tables Key Components of P4 24

Slide 25

Slide 25 text

● What is P4 ● Why P4 ● P4.org Membership ● The concept of Packet processing w/ P4 ● Key Components of P4 ● P4 16 Language ○ Program Template ○ Approach ■ Target ■ Architecture ● Example of P4 pipeline ● P4 Compiler ● Environments ● Try P4 ● What can you do with P4? ● Conclusion Outline 25

Slide 26

Slide 26 text

P4 16 Program Template ● ● Program Template ● Approach ○ Target ○ Architecture Ref: https://p4.org/assets/P4_tutorial_01_basics.gslide.pdf Learn P4 lang like SQL 26

Slide 27

Slide 27 text

P4 16 Approach ● Program Template ● Approach ○ Target ○ Architecture Ref: https://p4.org/assets/P4_tutorial_01_basics.gslide.pdf 27 Term P4 Architecture P4 Target

Slide 28

Slide 28 text

P4 Target ● Program Template ● Approach ○ Target ○ Architecture Ref: https://p4.org/assets/P4_tutorial_01_basics.gslide.pdf 28 ● An embodiment of a specific hardware implementation

Slide 29

Slide 29 text

P4 16 Architecture ● Program Template ● Approach ○ Target ○ Architecture ● Provides an interface to program a target via some set of P4-programmable components, externs, fixed components 29 Ref: https://p4.org/assets/P4_tutorial_01_basics.gslide.pdf

Slide 30

Slide 30 text

● What is P4 ● Why P4 ● P4.org Membership ● The concept of Packet processing w/ P4 ● Key Components of P4 ● P4 16 Language ● Example of P4 pipeline ○ Topology ○ Source code ○ Architecture ○ Explain ● P4 Compiler ● Environments ● Try P4 ● What can you do with P4? Outline 30

Slide 31

Slide 31 text

Basic Forwarding: Topology ● For every packet, the L3 switch must perform: ○ Update the source and destination MAC addresses ○ Decrement the time-to-live (TTL) in the IP header ○ Forward the packet out the appropriate port ● Topology ● Source code ● Architecture ● Explain 31 ● Have a single table: the control plane will populate with static rules ● Each rule will map an IP address to the MAC address and output port for the next hop ● Already defined the control plane rules

Slide 32

Slide 32 text

● Topology ● Source code ● Architecture ● Explain Basic Forwarding: Source code ● Code: https://github.com/p4lang/tutorials/blob/master/P4D2_2018 _East/exercises/basic/solution/basic.p4 ● Ref: https://p4.org/assets/P4_tutorial_01_basics.gslide.pdf 32

Slide 33

Slide 33 text

Architecture ● Ingress Pipeline ● Egress Pipeline ● Traffic Manager ○ N:1 Relationships: Package Queueing, Congestion Control ○ 1:N Relationships: Replication ○ Scheduling Ref: https://p4.org/assets/P4_tutorial_01_basics.gslide.pdf https://github.com/NetFPGA/P4-NetFPGA-public/blob/master/slides/FPGA-2018/FPGA%202018%20P4%20tut orial.pdf 33 ● Topology ● Source code ● Architecture ● Explain

Slide 34

Slide 34 text

Explain ● Preprocessor and contant ● Headers ● Parser ● Controls ○ Checksum Verification ○ Ingress Processing ○ Egress Processing ○ Checksum Computation ○ Deparser ● Switch ● Topology ● Source code ● Architecture ● Explain 34

Slide 35

Slide 35 text

● Preprocessor and contant ● Headers ● Parser ● Controls ○ Checksum Verification ○ Ingress Processing ○ Egress Processing ○ Checksum Computation ○ Deparser ● Switch Explain ● Topology ● Source code ● Explain 35 ● Topology ● Source code ● Architecture ● Explain

Slide 36

Slide 36 text

● Include P4 core library ○ Defines some standard data-types and error codes ○ https://p4.org/p4-spec/docs/P4-16-v1.0.0-spec.html#sec -p4-core-lib ● Ref: https://en.wikipedia.org/wiki/EtherType Preprocessor and contant 36 2 3 4 5 #include #include const bit<16> TYPE_IPV4 = 0x800;

Slide 37

Slide 37 text

● Preprocessor and contant ● Headers ● Parser ● Controls ○ Checksum Verification ○ Ingress Processing ○ Egress Processing ○ Checksum Computation ○ Deparser ● Switch Explain ● Topology ● Source code ● Explain 37 ● Topology ● Source code ● Architecture ● Explain

Slide 38

Slide 38 text

Headers ● Typedef ○ Alternative name for a type ● Basic Types ○ bit ○ bit == bit<1> ○ int ○ varbit ● Header Types ○ Ordered collection of members 38 11 12 13 14 15 16 17 18 19 typedef bit<9> egressSpec_t; typedef bit<48> macAddr_t; typedef bit<32> ip4Addr_t; header ethernet_t { macAddr_t dstAddr; macAddr_t srcAddr; bit<16> etherType; }

Slide 39

Slide 39 text

Headers (Cont’d) 39 21 22 23 24 25 26 27 28 29 30 31 32 33 34 header ipv4_t { bit<4> version; bit<4> ihl; bit<8> diffserv; bit<16> totalLen; bit<16> identification; bit<3> flags; bit<13> fragOffset; bit<8> ttl; bit<8> protocol; bit<16> hdrChecksum; ip4Addr_t srcAddr; ip4Addr_t dstAddr; }

Slide 40

Slide 40 text

● Other useful types ● Struct ○ Unordered collection of members (with no alignment restrictions) ● Header Stack ○ array of headers ● Header Union ○ one of several headers Headers (Cont’d) 40 36 37 38 39 40 41 42 43 struct metadata { /* empty */ } struct headers { ethernet_t ethernet; ipv4_t ipv4; }

Slide 41

Slide 41 text

● Preprocessor and contant ● Headers ● Parser ● Controls ○ Checksum Verification ○ Ingress Processing ○ Egress Processing ○ Checksum Computation ○ Deparser ● Switch Explain ● Topology ● Source code ● Explain 41 ● Topology ● Source code ● Architecture ● Explain

Slide 42

Slide 42 text

49 . . . 71 parser MyParser(packet_in packet, out headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) { state start { transition parse_ethernet; } state parse_ethernet { packet.extract(hdr.ethernet); transition select(hdr.ethernet.etherType) { TYPE_IPV4: parse_ipv4; default: accept; } } state parse_ipv4 { packet.extract(hdr.ipv4); transition accept; } } Parser 42

Slide 43

Slide 43 text

parser MyParser(packet_in packet, out headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) { state start { transition parse_ethernet; } state parse_ethernet { packet.extract(hdr.ethernet); transition select(hdr.ethernet.etherType) { TYPE_IPV4: parse_ipv4; default: accept; } } state parse_ipv4 { packet.extract(hdr.ipv4); transition accept; Parser (Cont’d) Parsers are functions that map packets into headers and metadata, written in a state machine style ● packet_in: reads its input from a packet_in ● in: read-only ● out: are treated as a storage ● inout: both in & out 43

Slide 44

Slide 44 text

parser MyParser(packet_in packet, out headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) { state start { transition parse_ethernet; } state parse_ethernet { packet.extract(hdr.ethernet); transition select(hdr.ethernet.etherType) { TYPE_IPV4: parse_ipv4; default: accept; } } state parse_ipv4 { packet.extract(hdr.ipv4); transition accept; } Every parser has three predefined states ● start ● accept ● reject Parser (Cont’d) 44

Slide 45

Slide 45 text

is_default parser MyParser(packet_in packet, out headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) { state start { transition parse_ethernet; } state parse_ethernet { packet.extract(hdr.ethernet); transition select(hdr.ethernet.etherType) { TYPE_IPV4: parse_ipv4; default: accept; } } state parse_ipv4 { packet.extract(hdr.ipv4); transition accept; } Every parser has three predefined states ● start ● accept ● reject Parser (Cont’d) packet.extract is from include file: core.p4 select statement that can be used to branch in a parser 45 start parse_ethernet Ethernet header extract is_IPv4: parse_ipv4 IPv4 header extract Accept Accept

Slide 46

Slide 46 text

Explain ● Topology ● Source code ● Explain 46 ● Preprocessor and contant ● Headers ● Parser ● Controls ○ Checksum Verification ○ Ingress Processing ○ Egress Processing ○ Checksum Computation ○ Deparser ● Switch ● Topology ● Source code ● Architecture ● Explain

Slide 47

Slide 47 text

● Similar to C functions (without loops) ● Can declare variables, create tables, instantiate externs, etc. ● Functionality specified by code in apply statement ● Represent all kinds of processing that are expressible as DAG(Directed Acyclic Graph): ○ Additional forms of packet processing (updating checksums) ○ Match-Action Pipelines ○ Deparsers Controls control MyVerifyChecksum(inout headers hdr, inout metadata meta) { apply { } } Evaluating a program that has several instantiations of the same component. parameters of control ● Controls ○ CV ○ Ingress ○ Egress ○ CC ○ Deparser 47

Slide 48

Slide 48 text

Controls (Cont’d) ● The control instances enclose controllable entities: ○ actions, tables, keys, extern instances ● Control flow control MyIngress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) { action drop() { ... } action ipv4_forward(macAddr_t dstAddr, egressSpec_t port) { standard_metadata.egress_spec = port; hdr.ethernet.srcAddr = hdr.ethernet.dstAddr; hdr.ethernet.dstAddr = dstAddr; hdr.ipv4.ttl = hdr.ipv4.ttl - 1; } table ipv4_lpm { ... } apply { //body of the pipeline if (hdr.ipv4.isValid()) { ipv4_lpm.apply(); } } } ● Controls ○ CV ○ Ingress ○ Egress ○ CC ○ Deparser 48

Slide 49

Slide 49 text

● Actions ○ Very similar to C functions ○ Reside in tables; invoked automatically on table match. ○ Can be declared inside a control or globally ○ Parameters have type and direction ○ Variables can be instantiated inside ○ Many standard arithmetic and logical operations are supported Controls (Cont’d) ● Controls ○ CV ○ Ingress ○ Egress ○ CC ○ Deparser 49

Slide 50

Slide 50 text

Data Plane (P4) Program ● Defines the format of table ○ Key Fields ○ Actions ○ Action Data ● Performs the lookup ● Executes the chosen action Control Plane (IP stack, Routing protocols) ● Populates table entries with specific information ○ Based on the configuration, automatic discovery, protocol calculations table ipv4_lpm { key = { hdr.ipv4.dstAddr: lpm; } action = { ipv4_forward; drop; NoAction; } size = 1024; default_action = NoAction(); } Controls (Cont’d) Tables(Cont’d) ● Controls ○ CV ○ Ingress ○ Egress ○ CC ○ Deparser 50 table_add ipv4_lpm ipv4_forward 10.0.1.1/32 => 00:00:00:00:01:01 1 Longest prefix match

Slide 51

Slide 51 text

Checksum Verification ● No built-in constructs in P416 for manipulating packet checksums ● You can write your checksum verification ● Ref: https://p4.org/p4-spec/docs/P4-16-v1.0.0-spec.html#sec-ch ecksums ● Controls ○ CV ○ Ingress ○ Egress ○ CC ○ Deparser 51 77 78 79 control MyVerifyChecksum(inout headers hdr, inout metadata meta) { apply { } }

Slide 52

Slide 52 text

86 . . . 118 control MyIngress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) { action drop() { mark_to_drop(); } action ipv4_forward(macAddr_t dstAddr, egressSpec_t port) { standard_metadata.egress_spec = port; hdr.ethernet.srcAddr = hdr.ethernet.dstAddr; hdr.ethernet.dstAddr = dstAddr; hdr.ipv4.ttl = hdr.ipv4.ttl - 1; } table ipv4_lpm { key = { hdr.ipv4.dstAddr: lpm; } action = { ipv4_forward; drop; NoAction; } size = 1024; default_action = NoAction(); } apply { if (hdr.ipv4.isValid()) { ipv4_lpm.apply(); }}} Ingress Processing ● Controls ○ CV ○ Ingress ○ Egress ○ CC ○ Deparser 52

Slide 53

Slide 53 text

Egress Processing ● Egress processing ● Controls ○ CV ○ Ingress ○ Egress ○ CC ○ Deparser 53 124 125 126 127 128 control MyEgress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata){ apply { } }

Slide 54

Slide 54 text

134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 control MyComputeChecksum(inout headers hdr, inout metadata meta) { apply { update_checksum( hdr.ipv4.isValid(), { hdr.ipv4.version, hdr.ipv4.ihl, hdr.ipv4.diffserv, hdr.ipv4.totalLen, hdr.ipv4.identification, hdr.ipv4.flags, hdr.ipv4.fragOffset, hdr.ipv4.ttl, hdr.ipv4.protocol, hdr.ipv4.srcAddr, hdr.ipv4.dstAddr }, hdr.ipv4.hdrChecksum, HashAlgorithm.csum16); } } Checksum Computation Computes the checksum of the supplied data ● Controls ○ CV ○ Ingress ○ Egress ○ CC ○ Deparser 54

Slide 55

Slide 55 text

158 159 160 161 162 163 control MyDeparser(packet_out packet, in headers hdr){ apply { packet.emit(hdr.ethernet); packet.emit(hdr.ipv4); } } Deparser ● Assembles the headers back into a well-formed packet ● P416 does not provide a separate language for packet deparsing ● Deparsing is done in a control block that has at least one parameter of type packet_out ● packet_out extern is defined in core.p4: emit(hdr): serializes header if it is valid ● Advantages: ○ Makes deparsing explicit...but decouples from parsing ● Controls ○ CV ○ Ingress ○ Egress ○ CC ○ Deparser 55

Slide 56

Slide 56 text

Explain ● Topology ● Source code ● Explain 56 ● Preprocessor and contant ● Headers ● Parser ● Controls ○ Checksum Verification ○ Ingress Processing ○ Egress Processing ○ Checksum Computation ○ Deparser ● Switch ● Topology ● Source code ● Architecture ● Explain

Slide 57

Slide 57 text

169 170 171 172 173 174 175 176 V1Switch( MyParser(), MyVerifyChecksum(), MyIngress(), MyEgress(), MyComputeChecksum(), MyDeparser() ) main; ● Instantiate the top-level V1Switch package ● All the arguments of the V1Switch package constructor have been evaluated (instances of MyParser, MyVerifyChecksum ...). ● Their signatures are matched w/ the V1Switch declaration ● The result of the program evaluation is the value of the main variable Switch 57

Slide 58

Slide 58 text

● What is P4 ● Why P4 ● P4.org Membership ● The concept of Packet processing w/ P4 ● Key Components of P4 ● P4 16 Language ● Example of P4 pipeline ● P4 Compiler ● Environments ● Try P4 ● What can you do with P4? ● Conclusion Outline 58

Slide 59

Slide 59 text

● p4c ● A new, alpha-quality reference compiler ● Supports P4 16 ● Provides a standard frontend and midend which can be combined with a target-specific backend to create a complete P4 compiler ● The compiler supports several backends: ● p4c-bmv2 – targets the behavioral model ● p4c-ebpf, p4c-graphs, p4test … etc. ● Repository: https://github.com/p4lang/p4c ● Eg. P4 Compiler $ p4c -b bmv2-ss-p4org program.p4 -o program.bmv2.json 59

Slide 60

Slide 60 text

● What is P4 ● Why P4 ● P4.org Membership ● The concept of Packet processing w/ P4 ● Key Components of P4 ● P4 16 Language ● Example of P4 pipeline ● P4 Compiler ● Environments ● Try P4 ● What can you do with P4? ● Conclusion Outline 60

Slide 61

Slide 61 text

Environments ● BMv2 (Behavioral Model) ● Programmable Network Devices 61

Slide 62

Slide 62 text

Environments BMv2 (Behavioral Model) ● The second version of the P4 software switch (aka behavioral model) ● nicknamed BMv2 ● A simulation environment to run the P4 software switch, standalone or in Mininet ● Allows you to easily simulate new architectures by implementing new externs ● Enabling you to organize the forwarding elements as needed ● Repository: https://github.com/p4lang/behavioral-model 62

Slide 63

Slide 63 text

Environments Programmable Network Devices ● Protocol-Independent Switch Architecture (PISA): Flexible Match+Action ASICs ○ Intel Flexpipe, Cisco Doppler, Cavium (Xpliant), Barefoot Tofino, ... ● Network Processor Unit (NPU) ○ EZchip, Netronome, ... ● CPU ○ Open Vswitch, eBPF, DPDK, VPP... ● Field-Programmable Gate Array (FPGA) ○ Xilinx, Altera, ... Ref: https://p4.org/assets/P4_tutorial_01_basics.gslide.pdf 63

Slide 64

Slide 64 text

● What is P4 ● Why P4 ● P4.org Membership ● The concept of Packet processing w/ P4 ● Key Components of P4 ● P4 16 Language ● Example of P4 pipeline ● P4 Compiler ● Environments ● Try P4 ● What can you do with P4? ● Conclusion Outline 64

Slide 65

Slide 65 text

Try P4 ● P4 tutorials: https://github.com/p4lang/tutorials ● Before Hands-on, you need to setup the environment ○ OS & HW requirement ■ OS: Ubuntu 16.04 64-bits ■ CPU: at least 2 cores ■ RAM: at least 2G ■ Disk: at least 25G ○ Run command by yourself (not root), after finish OS installation $ wget -O setup.sh https://goo.gl/EHgk4v && sudo bash setup.sh && wget -O - https://goo.gl/NKaau7 | bash 65

Slide 66

Slide 66 text

● What is P4 ● Why P4 ● P4.org Membership ● The concept of Packet processing w/ P4 ● Key Components of P4 ● P4 16 Language ● Example of P4 pipeline ● P4 Compiler ● Environments ● Try P4 ● What can you do with P4? ● Conclusion Outline 66

Slide 67

Slide 67 text

Applications of P4 ● Layer 4 Load Balancer – SilkRoad[1] ● Low Latency Congestion Control – NDP[2] ● Fast In-Network cache for key-value stores – NetCache[3] ● In-band Network Telemetry – INT[4] ● Consensus at network speed – NetPaxos[5] ● ... and much more [1] Miao, Rui, et al. "SilkRoad: Making Stateful Layer-4 Load Balancing Fast and Cheap Using Switching ASICs." SIGCOMM, 2017. [2] Handley, Mark, et al. "Re-architecting datacenter networks and stacks for low latency and high performance.” SIGCOMM, 2017. [3] Xin Jin et al. “NetCache: Balancing Key-Value Stores with Fast In-Network Caching.” To appear at SOSP 2017 [4] Kim, Changhoon, et al. "In-band network telemetry via programmable dataplanes.” SIGCOMM. 2015. [5] Dang, Huynh Tu, et al. "NetPaxos: Consensus at network speed.” SIGCOMM, 2015 What can you do with P4? 67

Slide 68

Slide 68 text

Outline ● What is P4 ● Why P4 ● P4.org Membership ● The concept of Packet processing w/ P4 ● Key Components of P4 ● P4 16 Language ● Example of P4 pipeline ● P4 Compiler ● Environments ● Try P4 ● What can you do with P4? ● Conclusion 68

Slide 69

Slide 69 text

Conclusion ● Introduce P4, its concepts, languages & some applications ● With P4, SDN programmers can design these goals ○ Can keep the new ideas secret ■ Don’t have to let switch chip vendor know ○ Unique features in every network 69

Slide 70

Slide 70 text

Thanks! Any questions? You can find me at: @sufuf3 (GitHub) @sufuf3149 (Twitter) More: https://p4tw.org/ 70