Slide 1

Slide 1 text

~ p4alu ~ Arithmetic Logic Unit in P4 Kentaro Ebisawa | Ponto Networks, Inc. [email protected] Twitter: @ebiken p4alu ... Arithmetic Logic Unit in P4 | Software Router BoF @ IW2017 Japan | 2017/11/29 1

Slide 2

Slide 2 text

• “p4alu” is an P4 program who would parse UDP packet with payload in "p4alu header format" and apply calculation. • This program is tested using BMv2 simple_switch P4 target. • Source Code on GitHub • https://github.com/ebiken/p4sandbox/tree/master/p4alu • Generic P4 information in Japanese (日本語) • How to Run P4 Behavior Model v2 (JAPANESE) • https://www.slideshare.net/kentaroebisawa/how-to-run-p4-bmv2 p4alu ... Arithmetic Logic Unit in P4 | Software Router BoF @ IW2017 Japan | 2017/11/29 2 p4alu

Slide 3

Slide 3 text

p4alu ... Arithmetic Logic Unit in P4 | Software Router BoF @ IW2017 Japan | 2017/11/29 3 ALU Integer Operand Integer Operand Integer Result opCode op1 op2 result

Slide 4

Slide 4 text

p4alu ... Arithmetic Logic Unit in P4 | Software Router BoF @ IW2017 Japan | 2017/11/29 4 p4alu header format Integer Operand Integer Operand Integer Result opCode op1 op2 result

Slide 5

Slide 5 text

p4alu ... Arithmetic Logic Unit in P4 | Software Router BoF @ IW2017 Japan | 2017/11/29 5 P4 parser

Slide 6

Slide 6 text

p4alu ... Arithmetic Logic Unit in P4 | Software Router BoF @ IW2017 Japan | 2017/11/29 6 P4 action

Slide 7

Slide 7 text

p4alu ... Arithmetic Logic Unit in P4 | Software Router BoF @ IW2017 Japan | 2017/11/29 7 P4 table & control

Slide 8

Slide 8 text

p4alu ... Arithmetic Logic Unit in P4 | Software Router BoF @ IW2017 Japan | 2017/11/29 8 Setup netns based hosts BMv2 running p4alu

Slide 9

Slide 9 text

p4alu ... Arithmetic Logic Unit in P4 | Software Router BoF @ IW2017 Japan | 2017/11/29 9 Compile and Run on BMv2

Slide 10

Slide 10 text

p4alu ... Arithmetic Logic Unit in P4 | Software Router BoF @ IW2017 Japan | 2017/11/29 10 Configure Tables via runtime_CLI Forward Packet from/to port#0 <-> port#1 Apply action based on opCode • opCode: 1 => p4alu_add • opCode: 2 => p4alu_sub BMv2 Runtime CLI command format

Slide 11

Slide 11 text

p4alu ... Arithmetic Logic Unit in P4 | Software Router BoF @ IW2017 Japan | 2017/11/29 11 Packet Format (sending from host0) • opCode: 0x01 => p4alu_add • opCode: 0x02 => p4alu_sub

Slide 12

Slide 12 text

CuiShark by @slankdev | https://github.com/slankdev/cuishark p4alu ... Arithmetic Logic Unit in P4 | Software Router BoF @ IW2017 Japan | 2017/11/29 12 packets after going through p4alu op1 opCode op2 result

Slide 13

Slide 13 text

CuiShark by @slankdev | https://github.com/slankdev/cuishark p4alu ... Arithmetic Logic Unit in P4 | Software Router BoF @ IW2017 Japan | 2017/11/29 13 packets after going through p4alu op1 opCode op2 result