p4alu: arithmetic logic unit in p4

Post on 22-Jan-2018

288 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

~ p4alu ~

Arithmetic Logic Unit in P4

Kentaro Ebisawa | Ponto Networks, Inc.

ebiken@pontonetworks.com

Twitter: @ebiken

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

• “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

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

ALU

IntegerOperand

IntegerOperand

IntegerResult

opCode

op1 op2

result

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

p4alu header format

IntegerOperand

IntegerOperand

IntegerResult

opCode

op1 op2

result

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

P4 parser

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

P4 action

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

P4 table & control

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

Setup netns based hosts

BMv2 running p4alu

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

Compile and Run on BMv2

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

Configure Tables via runtime_CLI

Forward Packetfrom/to port#0 <-> port#1

Apply action based on opCode• opCode: 1 => p4alu_add• opCode: 2 => p4alu_sub

BMv2 Runtime CLI command format

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

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 opCodeop2 result

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 opCodeop2 result

top related