SlideShare a Scribd company logo
p4srv6 (P4-16)
design document
rev1.0
ENOG55 @新潟 燕三条| 2019年2月22日
海老澤 健太郎 Kentaro Ebisawa
Toyota InfoTechnology Center Co., Ltd.
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
• p4srv6 ... feature and roadmap
• P4 Difference among Architectures
• p4srv6 ... Pipeline and design
• p4srv6 Pipeline and design
• p4srv6 ... examples of config and packet dump
• p4srv6 ... control plane integration
• MAT abstraction considerations
• P4 Implementation tips
• SID List (variable length array field)
• SRv6 active segment
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
Table of Contents
p4srv6 ... feature and roadmap
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
p4srv6 ... feature and roadmap
What is p4srv6 ??
https://github.com/ebiken/p4srv6
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
p4srv6 ... feature and roadmap
Functions used in the SRv6 Mobile Uplane POC
P4 Difference among Architectures
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
Difference you should care between P4 Architectures
• Pipeline
• Metadata
• Special In/Out port
• Externs (Checksum)
Architecture is also defined using P4
https://github.com/p4lang/p4c/blob/master/p4include/v1model.p4
https://github.com/p4lang/p4c/blob/master/p4include/psa.p4
https://github.com/vmware/p4c-xdp/blob/master/p4include/xdp_model.p4
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
P4 Pipeline ... Difference among Architectures
psa.p4 ... Portable Switch Architecture
package IngressPipeline<IH, IM, NM, CI2EM, RESUBM, RECIRCM>(
IngressParser<IH, IM, RESUBM, RECIRCM> ip,
Ingress<IH, IM> ig,
IngressDeparser<IH, IM, CI2EM, RESUBM, NM> id);
package EgressPipeline<EH, EM, NM, CI2EM, CE2EM, RECIRCM>(
EgressParser<EH, EM, NM, CI2EM, CE2EM> ep,
Egress<EH, EM> eg,
EgressDeparser<EH, EM, CE2EM, RECIRCM> ed);
package PSA_Switch<IH, IM, EH, EM, NM, CI2EM, CE2EM, RESUBM, RECIRCM> (
IngressPipeline<IH, IM, NM, CI2EM, RESUBM, RECIRCM> ingress,
PacketReplicationEngine pre,
EgressPipeline<EH, EM, NM, CI2EM, CE2EM, RECIRCM> egress,
BufferingQueueingEngine bqe);
xdp_model.p4 ... XDP backend of p4c (p4c-xdp)
package xdp<H>(
xdp_parse<H> p,
xdp_switch<H> s,
xdp_deparse<H> d);
v1model.p4 ... p4-14 compatible pipeline
package V1Switch<H, M>(
Parser<H, M> p,
VerifyChecksum<H, M> vr,
Ingress<H, M> ig,
Egress<H, M> eg,
ComputeChecksum<H, M> ck,
Deparser<H> dep);
p4srv6 ... design
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
p4srv6 Pipeline
SwitchParser()
SwitchParser(
packet_in pkt,
out Header hdr,
inout UserMetadata user_md,
inout standard_metadata_t st_md)
state start {
transition parse_ethernet;
}
SwitchVerifyChecksum()
SwitchVerifyChecksum(
inout Header hdr,
inout UserMetadata user_md)
SwitchComputeChecksum()
SwitchComputeChecksum(
inout Header hdr,
inout UserMetadata user_md)
SwitchEgress()
SwitchEgress(
inout Header hdr,
inout UserMetadata user_md,
inout standard_metadata_t st_md)
< no control implemented so far >
SwitchDeparser()
SwitchDeparser(
packet_out pkt,
in Header hdr)
pkt.emit(hdr.ether);
pkt.emit(hdr.ipv6);
pkt.emit(hdr.srh);
pkt.emit(hdr.srh_sid);
pkt.emit(hdr.ipv4);
pkt.emit(hdr.icmp);
pkt.emit(hdr.tcp);
pkt.emit(hdr.udp);
pkt.emit(hdr.gtpu);
pkt.emit(hdr.inner_ether);
pkt.emit(hdr.inner_ipv6);
pkt.emit(hdr.inner_ipv4);
pkt.emit(hdr.inner_tcp);
pkt.emit(hdr.inner_udp);
SwitchIngress()
SwitchIngress(
inout Header hdr,
inout UserMetadata user_md,
inout standard_metadata_t st_md)
table local_mac;
SRv6() srv6;
L2Fwd(1024) l2fwd;
PortFwd() port_fwd;
No parsing of
vendor specific header
Checksum done in
Control Block dedicated for Checksum
Controls to do main packet header
and metadata processing
Architecture: v1model.p4
v1model.p4 ... p4-14 compatible pipeline
package V1Switch<H, M>(
Parser<H, M> p,
VerifyChecksum<H, M> vr,
Ingress<H, M> ig,
Egress<H, M> eg,
ComputeChecksum<H, M> ck,
Deparser<H> dep);
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
p4srv6 main control (Ingress) SwitchIngress()
SwitchIngress(
inout Header hdr,
inout UserMetadata user_md,
inout standard_metadata_t st_md)
table local_mac;
SRv6() srv6;
L2Fwd(1024) l2fwd;
PortFwd() port_fwd;
control SwitchIngress(
inout Header hdr,
inout UserMetadata user_md,
inout standard_metadata_t st_md) {
...
apply {
mark_to_drop(); // set default action to drop to avoid unexpected packets going out.
// apply srv6 without local_mac validation for quick testing
srv6.apply(hdr, user_md);
l2fwd.apply(hdr.ether.dstAddr, user_md.ig_md, st_md.egress_spec);
port_fwd.apply(st_md.ingress_port, st_md.egress_spec);
}
}
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
p4srv6 SRv6 control
control SRv6(
inout Header hdr,
inout UserMetadata user_md) {
...
apply {
if (hdr.srh.isValid()) {
srv6_set_nextsid.apply();
}
if (hdr.ipv6.isValid()) {
if(!srv6_end.apply().hit) {
srv6_transit_v6.apply();
}
} else if (hdr.ipv4.isValid()) {
if(!srv6_transit_udp.apply().hit) {
srv6_transit_v4.apply();
}
}
}
}
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
p4srv6 “Transit” Tables
table srv6_transit_v4 {
key = {
hdr.ipv4.dstAddr: exact;
}
actions = {
@defaultonly NoAction;
//t_encaps_sid1; // T.Encaps
//t_encaps_l2_sid1; // T.Encaps.L2
}
}
table srv6_transit_v6 {
key = {
hdr.ipv6.dstAddr: exact;
}
actions = {
@defaultonly NoAction;
// T.Insert with n+1 SIDs (DA + sid1)
t_insert_sid1;
t_insert_sid2;
t_insert_sid3;
//t_encaps_sid1; // T.Encaps
//t_encaps_l2_sid1; // T.Encaps.L2
}
}
table srv6_transit_udp {
key = {
hdr.udp.dstPort : exact;
}
actions = {
@defaultonly NoAction;
// SRv6 Mobile User Plane
t_m_tmap;
t_m_tmap_sid1; // 2 SIDs (DA + sid1)
t_m_tmap_sid2; // 3 SIDs (DA + sid1/2)
t_m_tmap_sid3; // 4 SIDs (DA + sid1/2/3)
}
}
Strategy
• Separate tables based on “key” field to reduce
“Match” resource
• “insert” is not required for ipv4 match table
(SRH require IPv6)
• Create action per number of SIDs to insert
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
p4srv6 “End” Tables
table srv6_end { // localsid
key = {
hdr.ipv6.dstAddr : ternary;
// hdr.srh.isValid() : ternary;
// hdr.srh.segmentLeft : ternary;
// hdr.srh.nextHdr : ternary; // for decap
}
actions = {
@defaultonly NoAction;
// SRv6 Network Program
end; // End
// SRv6 Mobile User Plane
end_m_gtp4_e; // End.M.GTP4.E
}
const default_action = NoAction;
}
Strategy
• “End” must match IPv6 address (SID = IPv6 dstAddr) thus only single table.
(Currently not implemented but)
Match field (key) to generate errors when
invalid packet received matching localsid.
p4srv6
... examples of config and packet dump
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
GTP to SRv6 with T.M.Tmap & End.M.GTP4.E (no SRH)
SRGW1 R1 SRGW2
veth1
host1
#1
vtap1
#2
vtap2
#11
vtap11
#12
vtap12
host1172.20.0.1/24 172.20.0.2/24
veth2
BMv2 simple switch with p4srv6
GTP Tunnel
(Linux Kernel)
T.M.Tmap
(BMv2)
End.M.GTP4.E
(BMv2)
GTP Tunnel
(Linux Kernel)
[ICMP][IPv4] => [ICMP][IPv4][GTP][UDP][IPv4] => [ICMP][IPv4] =>
(SRv6 with no SRH)
[ICMP][IPv4][IPv6] => [ICMP][IPv4][GTP][UDP][IPv4] =>
① ①②
① ②
SRv6 SID : fc34:5678:ac14:0002:ac14:0001:0000:0064
Dst: 172.20.0.2
Src: 172.20.0.1
TEID: 100
PREFIX
SRv6 SID
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
GTP to SRv6 with T.M.Tmap & End.M.GTP4.E (with SRH)
GTP Tunnel
(Linux Kernel)
T.M.Tmap
(BMv2)
End.M.GTP4.E
(BMv2)
GTP Tunnel
(Linux Kernel)
[ICMP][IPv4] => [ICMP][IPv4][GTP][UDP][IPv4] => [ICMP][IPv4] =>(SRv6 with SRH)
[ICMP][IPv4][SRH][IPv6] =>
[ICMP][IPv4][GTP][UDP][IPv4] =>
① ②End
(BMv2)
SRGW1 SRGW2
veth1
host1
#1
vtap1
#2
vtap2
#11
vtap11
#12
vtap12
host1172.20.0.1/24 172.20.0.2/24
veth2
BMv2 simple switch with p4srv6
#13
vtap13
#14
vtap14
R1
p4srv6 ... control plane integration
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
To Be Updated in Future Rev.
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
Match Action Table (MAT) abstraction considerations
To Be Updated in Future Rev.
P4 Implementation tips
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
SID List (variable length array field)
state start {
transition parse_ethernet;
}
state parse_ethernet {
pkt.extract(hdr.ether);
transition
select(hdr.ether.etherType) {
ETH_P_IPV4 : parse_ipv4;
ETH_P_IPV6 : parse_ipv6;
//ETH_P_ARP : parse_arp;
//ETH_P_VLAN : parse_vlan;
default : accept;
}
state parse_ipv4 {
pkt.extract(hdr.ipv4);
transition
select(hdr.ipv4.protocol) {
IPPROTO_TCP : parse_tcp;
IPPROTO_UDP : parse_udp;
default : accept;
}
} state parse_ipv6 {
pkt.extract(hdr.ipv6);
transition
select(hdr.ipv6.nextHdr) {
IPPROTO_TCP : parse_tcp;
IPPROTO_UDP : parse_udp;
IPPROTO_ROUTE : parse_srh;
IPPROTO_IPV4 :
parse_inner_ipv4;
IPPROTO_IPV6 :
parse_inner_ipv6;
default : accept;
}
}
header SRH_SegmentList_h {
bit<128> sid;
}
struct Header {
Ethernet_h ether;
IPv6_h ipv6;
SRH_h srh;
SRH_SegmentList_h[SRH_SID_MAX] srh_sid;
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
SID List (variable length array field)
/*** PARSE SRH (SRv6) ***/
state parse_srh {
pkt.extract(hdr.srh);
transition parse_srh_sid_0;
}
#define PARSE_SRH_SID(curr, next) ¥
state parse_srh_sid_##curr { ¥
pkt.extract(hdr.srh_sid[curr]); ¥
transition select(hdr.srh.lastEntry) { ¥
curr : parse_srh_next_header; ¥
default : parse_srh_sid_##next; ¥
} ¥
} ¥
// switch_srv6.p4:SRH_SID_MAX 4
PARSE_SRH_SID(0, 1)
PARSE_SRH_SID(1, 2)
PARSE_SRH_SID(2, 3)
state parse_srh_sid_3 {
pkt.extract(hdr.srh_sid[3]);
transition select(hdr.srh.lastEntry) {
3 : parse_srh_next_header;
// v1model: no default rule:
// all other packets rejected
}
}
state parse_srh_next_header {
transition select(hdr.srh.nextHdr) {
IPPROTO_TCP : parse_tcp;
IPPROTO_UDP : parse_udp;
IPPROTO_IPV4 : parse_inner_ipv4;
IPPROTO_IPV6 : parse_inner_ipv6;
default : accept;
}
}
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
SRv6 active segment
action end() {
// 1. IF NH=SRH and SL > 0
// 2. decrement SL
hdr.srh.segmentsLeft = hdr.srh.segmentsLeft - 1;
// 3. update the IPv6 DA with SRH[SL]
hdr.ipv6.dstAddr = hdr.srh_sid[hdr.segmentsLeft-1];
...
Compiler ERROR!!
Cannot use array with variable
index in action statement.
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
SRv6 active segment
table srv6_set_nextsid { // helper table
key = {
hdr.srh.segmentsLeft : exact;
}
actions = {
NoAction;
set_nextsid_1;
set_nextsid_2;
set_nextsid_3;
set_nextsid_4;
}
const default_action = NoAction;
const entries = {
(1) : set_nextsid_1();
(2) : set_nextsid_2();
(3) : set_nextsid_3();
(4) : set_nextsid_4();
}
}
action set_nextsid_1() {
user_md.srv6.nextsid = hdr.srh_sid[0].sid;
}
action set_nextsid_2() {
user_md.srv6.nextsid = hdr.srh_sid[1].sid;
}
action set_nextsid_3() {
user_md.srv6.nextsid = hdr.srh_sid[2].sid;
}
action set_nextsid_4() {
user_md.srv6.nextsid = hdr.srh_sid[3].sid;
}
Use constant entries to set next SID to
metadata without user configuration.
Let me know if you have better idea ☺
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
SRv6 active segment
action end() {
// 1. IF NH=SRH and SL > 0
// 2. decrement SL
hdr.srh.segmentsLeft = hdr.srh.segmentsLeft - 1;
// 3. update the IPv6 DA with SRH[SL]
hdr.ipv6.dstAddr = hdr.srh_sid[hdr.segmentsLeft-1];
...
action end() {
// 1. IF NH=SRH and SL > 0
// 2. decrement SL
hdr.srh.segmentsLeft = hdr.srh.segmentsLeft - 1;
// 3. update the IPv6 DA with SRH[SL]
hdr.ipv6.dstAddr = user_md.srv6.nextsid;
...
Compiler ERROR!!
Cannot use array with variable
index in action statement.
Set active segment from metadata
p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
p4srv6 ... feature and roadmap
https://github.com/ebiken/p4srv6

More Related Content

PDF
SRv6 Mobile User Plane : Initial POC and Implementation
PDF
JANOG43 Forefront of SRv6, Open Source Implementations
PDF
Using GTP on Linux with libgtpnl
PDF
SRv6 Mobile User Plane P4 proto-type
PDF
GTPing, How To
PDF
Zebra 2.0 in Hybrid Cloud Era
PDF
IETF 104 Hackathon VPP Prototyping Stateless SRv6/GTP-U Translation
PDF
Performance Evaluation of GTP-U and SRv6 Stateless Translation
SRv6 Mobile User Plane : Initial POC and Implementation
JANOG43 Forefront of SRv6, Open Source Implementations
Using GTP on Linux with libgtpnl
SRv6 Mobile User Plane P4 proto-type
GTPing, How To
Zebra 2.0 in Hybrid Cloud Era
IETF 104 Hackathon VPP Prototyping Stateless SRv6/GTP-U Translation
Performance Evaluation of GTP-U and SRv6 Stateless Translation

What's hot (20)

PDF
Linkmeup v076(2019-06).2
PDF
P4 Introduction
PDF
Linkmeup v076 (2019-06)
PDF
Host Data Plane Acceleration: SmartNIC Deployment Models
PDF
Operational Experience of MAP-E
PDF
RISC-V Linker Relaxation and LLD
PPTX
Dynamic user trace
PDF
Lightweight 4-over-6: One step further Dual-Stack Lite Networks (RIPE 76)
PDF
A High Performance Heterogeneous FPGA-based Accelerator with PyCoRAM (Runner ...
PDF
UKNOF16 - Enhancing BGP
PPTX
PLNOG 13: P. Kupisiewicz, O. Pelerin: Make IOS-XE Troubleshooting Easy – Pack...
PDF
2015.7.17 JANOG36 BGP Flowspec Interoperability Test @ Interop Tokyo 2015 Sho...
PDF
LF_DPDK17_Lagopus Router
PDF
gcov和clang中的实现
PPTX
Implementing MPLS Services using Openflow
PPT
Chap05 gtp 03_kh
PPTX
Open MPI Explorations in Process Affinity (EuroMPI'13 presentation)
PDF
Cilium - Fast IPv6 Container Networking with BPF and XDP
PDF
BPF & Cilium - Turning Linux into a Microservices-aware Operating System
PDF
6 Lo Wpan Tutorial 20080206
Linkmeup v076(2019-06).2
P4 Introduction
Linkmeup v076 (2019-06)
Host Data Plane Acceleration: SmartNIC Deployment Models
Operational Experience of MAP-E
RISC-V Linker Relaxation and LLD
Dynamic user trace
Lightweight 4-over-6: One step further Dual-Stack Lite Networks (RIPE 76)
A High Performance Heterogeneous FPGA-based Accelerator with PyCoRAM (Runner ...
UKNOF16 - Enhancing BGP
PLNOG 13: P. Kupisiewicz, O. Pelerin: Make IOS-XE Troubleshooting Easy – Pack...
2015.7.17 JANOG36 BGP Flowspec Interoperability Test @ Interop Tokyo 2015 Sho...
LF_DPDK17_Lagopus Router
gcov和clang中的实现
Implementing MPLS Services using Openflow
Chap05 gtp 03_kh
Open MPI Explorations in Process Affinity (EuroMPI'13 presentation)
Cilium - Fast IPv6 Container Networking with BPF and XDP
BPF & Cilium - Turning Linux into a Microservices-aware Operating System
6 Lo Wpan Tutorial 20080206
Ad

Similar to p4srv6 (P4-16) design document rev1.0 (20)

PDF
ipv6 mpls by Patrick Grossetete
PPTX
VPP for Stateless SRv6/GTP-U Translation
PDF
SRv6 note from book and some drawing for different srv6 packet format
PPTX
P4+ONOS SRv6 tutorial.pptx
PDF
Ipv6 application in 5G bearer network--C&T RF Antennas Inc
PPT
Iccsit 2010 paper1
PDF
NAT 64 FPGA Implementation
PDF
I Pv6 Enabling Menog 0.4
PDF
Zebra SRv6 CLI on Linux Dataplane (ENOG#49)
PPT
Iccsit 2010 rljit
PPT
Iccci10 bd siit
PDF
1 bonica tutorial_segment_routing
PDF
IPv6 Transition & Deployment, including IPv6-only in cellular and broadband
PPT
Bd siit i pv4-ipv6
PDF
IPv6 Security - Workshop mit Live Demo
PDF
4. IPv6 Security - Workshop mit Live Demo - Marco Senn Fortinet
PDF
Segment Routing Lab
PPT
Iciic2010 114
PPT
IPv4 to v4/v6 dual stack plenaryw-2.ppt
ipv6 mpls by Patrick Grossetete
VPP for Stateless SRv6/GTP-U Translation
SRv6 note from book and some drawing for different srv6 packet format
P4+ONOS SRv6 tutorial.pptx
Ipv6 application in 5G bearer network--C&T RF Antennas Inc
Iccsit 2010 paper1
NAT 64 FPGA Implementation
I Pv6 Enabling Menog 0.4
Zebra SRv6 CLI on Linux Dataplane (ENOG#49)
Iccsit 2010 rljit
Iccci10 bd siit
1 bonica tutorial_segment_routing
IPv6 Transition & Deployment, including IPv6-only in cellular and broadband
Bd siit i pv4-ipv6
IPv6 Security - Workshop mit Live Demo
4. IPv6 Security - Workshop mit Live Demo - Marco Senn Fortinet
Segment Routing Lab
Iciic2010 114
IPv4 to v4/v6 dual stack plenaryw-2.ppt
Ad

More from Kentaro Ebisawa (20)

PDF
P4 Updates (2020) (Japanese)
PDF
Barefoot Faster™ 日本語紹介
PDF
IETF106 Hackathon 報告 & P4 based Switch の課題と未来
PDF
MPLS Japan 2019 : Data & Control Plane を繋ぐ API
PDF
Yang Tools Quick Memo
PDF
In Network Computing Prototype Using P4 at KSC/KREONET 2019
PDF
Comparison of SRv6 Extensions uSID, SRv6+, C-SRH
PDF
Interop2019 Toyota Netcope P4
PDF
"SRv6の現状と展望" ENOG53@上越
PDF
p4alu: Arithmetic Logic Unit in P4
PDF
zebra & openconfigd Introduction
PDF
ONIC2017 プログラマブル・データプレーン時代に向けた ネットワーク・オペレーションスタック
PDF
How to run P4 BMv2
PDF
ネットワークOS野郎 ~ インフラ野郎Night 20160414
PDF
"OPEN NETWORKING" に向けた Management / Data Plane の動向
PPTX
ネットワーク機器のAPIあれこれ入門 (NetOpsCoding#2)
PDF
ネットワークAPI のあれこれ (ENOG37)
PPTX
OVN 設定サンプル | OVN config example 2015/12/27
PPTX
Introduction to Ostinato , network packet crafting and generator.
PPTX
plotnetcfg入門 | Introduction to plotnetcfg
P4 Updates (2020) (Japanese)
Barefoot Faster™ 日本語紹介
IETF106 Hackathon 報告 & P4 based Switch の課題と未来
MPLS Japan 2019 : Data & Control Plane を繋ぐ API
Yang Tools Quick Memo
In Network Computing Prototype Using P4 at KSC/KREONET 2019
Comparison of SRv6 Extensions uSID, SRv6+, C-SRH
Interop2019 Toyota Netcope P4
"SRv6の現状と展望" ENOG53@上越
p4alu: Arithmetic Logic Unit in P4
zebra & openconfigd Introduction
ONIC2017 プログラマブル・データプレーン時代に向けた ネットワーク・オペレーションスタック
How to run P4 BMv2
ネットワークOS野郎 ~ インフラ野郎Night 20160414
"OPEN NETWORKING" に向けた Management / Data Plane の動向
ネットワーク機器のAPIあれこれ入門 (NetOpsCoding#2)
ネットワークAPI のあれこれ (ENOG37)
OVN 設定サンプル | OVN config example 2015/12/27
Introduction to Ostinato , network packet crafting and generator.
plotnetcfg入門 | Introduction to plotnetcfg

Recently uploaded (20)

PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Empathic Computing: Creating Shared Understanding
PPT
Teaching material agriculture food technology
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Review of recent advances in non-invasive hemoglobin estimation
Network Security Unit 5.pdf for BCA BBA.
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
MYSQL Presentation for SQL database connectivity
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Encapsulation_ Review paper, used for researhc scholars
20250228 LYD VKU AI Blended-Learning.pptx
Chapter 3 Spatial Domain Image Processing.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Empathic Computing: Creating Shared Understanding
Teaching material agriculture food technology
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Diabetes mellitus diagnosis method based random forest with bat algorithm
Per capita expenditure prediction using model stacking based on satellite ima...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Approach and Philosophy of On baking technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf

p4srv6 (P4-16) design document rev1.0

  • 1. p4srv6 (P4-16) design document rev1.0 ENOG55 @新潟 燕三条| 2019年2月22日 海老澤 健太郎 Kentaro Ebisawa Toyota InfoTechnology Center Co., Ltd. p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
  • 2. • p4srv6 ... feature and roadmap • P4 Difference among Architectures • p4srv6 ... Pipeline and design • p4srv6 Pipeline and design • p4srv6 ... examples of config and packet dump • p4srv6 ... control plane integration • MAT abstraction considerations • P4 Implementation tips • SID List (variable length array field) • SRv6 active segment p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0 Table of Contents
  • 3. p4srv6 ... feature and roadmap p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
  • 4. p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0 p4srv6 ... feature and roadmap What is p4srv6 ?? https://github.com/ebiken/p4srv6
  • 5. p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0 p4srv6 ... feature and roadmap Functions used in the SRv6 Mobile Uplane POC
  • 6. P4 Difference among Architectures p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
  • 7. p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0 Difference you should care between P4 Architectures • Pipeline • Metadata • Special In/Out port • Externs (Checksum) Architecture is also defined using P4 https://github.com/p4lang/p4c/blob/master/p4include/v1model.p4 https://github.com/p4lang/p4c/blob/master/p4include/psa.p4 https://github.com/vmware/p4c-xdp/blob/master/p4include/xdp_model.p4
  • 8. p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0 P4 Pipeline ... Difference among Architectures psa.p4 ... Portable Switch Architecture package IngressPipeline<IH, IM, NM, CI2EM, RESUBM, RECIRCM>( IngressParser<IH, IM, RESUBM, RECIRCM> ip, Ingress<IH, IM> ig, IngressDeparser<IH, IM, CI2EM, RESUBM, NM> id); package EgressPipeline<EH, EM, NM, CI2EM, CE2EM, RECIRCM>( EgressParser<EH, EM, NM, CI2EM, CE2EM> ep, Egress<EH, EM> eg, EgressDeparser<EH, EM, CE2EM, RECIRCM> ed); package PSA_Switch<IH, IM, EH, EM, NM, CI2EM, CE2EM, RESUBM, RECIRCM> ( IngressPipeline<IH, IM, NM, CI2EM, RESUBM, RECIRCM> ingress, PacketReplicationEngine pre, EgressPipeline<EH, EM, NM, CI2EM, CE2EM, RECIRCM> egress, BufferingQueueingEngine bqe); xdp_model.p4 ... XDP backend of p4c (p4c-xdp) package xdp<H>( xdp_parse<H> p, xdp_switch<H> s, xdp_deparse<H> d); v1model.p4 ... p4-14 compatible pipeline package V1Switch<H, M>( Parser<H, M> p, VerifyChecksum<H, M> vr, Ingress<H, M> ig, Egress<H, M> eg, ComputeChecksum<H, M> ck, Deparser<H> dep);
  • 9. p4srv6 ... design p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
  • 10. p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0 p4srv6 Pipeline SwitchParser() SwitchParser( packet_in pkt, out Header hdr, inout UserMetadata user_md, inout standard_metadata_t st_md) state start { transition parse_ethernet; } SwitchVerifyChecksum() SwitchVerifyChecksum( inout Header hdr, inout UserMetadata user_md) SwitchComputeChecksum() SwitchComputeChecksum( inout Header hdr, inout UserMetadata user_md) SwitchEgress() SwitchEgress( inout Header hdr, inout UserMetadata user_md, inout standard_metadata_t st_md) < no control implemented so far > SwitchDeparser() SwitchDeparser( packet_out pkt, in Header hdr) pkt.emit(hdr.ether); pkt.emit(hdr.ipv6); pkt.emit(hdr.srh); pkt.emit(hdr.srh_sid); pkt.emit(hdr.ipv4); pkt.emit(hdr.icmp); pkt.emit(hdr.tcp); pkt.emit(hdr.udp); pkt.emit(hdr.gtpu); pkt.emit(hdr.inner_ether); pkt.emit(hdr.inner_ipv6); pkt.emit(hdr.inner_ipv4); pkt.emit(hdr.inner_tcp); pkt.emit(hdr.inner_udp); SwitchIngress() SwitchIngress( inout Header hdr, inout UserMetadata user_md, inout standard_metadata_t st_md) table local_mac; SRv6() srv6; L2Fwd(1024) l2fwd; PortFwd() port_fwd; No parsing of vendor specific header Checksum done in Control Block dedicated for Checksum Controls to do main packet header and metadata processing Architecture: v1model.p4 v1model.p4 ... p4-14 compatible pipeline package V1Switch<H, M>( Parser<H, M> p, VerifyChecksum<H, M> vr, Ingress<H, M> ig, Egress<H, M> eg, ComputeChecksum<H, M> ck, Deparser<H> dep);
  • 11. p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0 p4srv6 main control (Ingress) SwitchIngress() SwitchIngress( inout Header hdr, inout UserMetadata user_md, inout standard_metadata_t st_md) table local_mac; SRv6() srv6; L2Fwd(1024) l2fwd; PortFwd() port_fwd; control SwitchIngress( inout Header hdr, inout UserMetadata user_md, inout standard_metadata_t st_md) { ... apply { mark_to_drop(); // set default action to drop to avoid unexpected packets going out. // apply srv6 without local_mac validation for quick testing srv6.apply(hdr, user_md); l2fwd.apply(hdr.ether.dstAddr, user_md.ig_md, st_md.egress_spec); port_fwd.apply(st_md.ingress_port, st_md.egress_spec); } }
  • 12. p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0 p4srv6 SRv6 control control SRv6( inout Header hdr, inout UserMetadata user_md) { ... apply { if (hdr.srh.isValid()) { srv6_set_nextsid.apply(); } if (hdr.ipv6.isValid()) { if(!srv6_end.apply().hit) { srv6_transit_v6.apply(); } } else if (hdr.ipv4.isValid()) { if(!srv6_transit_udp.apply().hit) { srv6_transit_v4.apply(); } } } }
  • 13. p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0 p4srv6 “Transit” Tables table srv6_transit_v4 { key = { hdr.ipv4.dstAddr: exact; } actions = { @defaultonly NoAction; //t_encaps_sid1; // T.Encaps //t_encaps_l2_sid1; // T.Encaps.L2 } } table srv6_transit_v6 { key = { hdr.ipv6.dstAddr: exact; } actions = { @defaultonly NoAction; // T.Insert with n+1 SIDs (DA + sid1) t_insert_sid1; t_insert_sid2; t_insert_sid3; //t_encaps_sid1; // T.Encaps //t_encaps_l2_sid1; // T.Encaps.L2 } } table srv6_transit_udp { key = { hdr.udp.dstPort : exact; } actions = { @defaultonly NoAction; // SRv6 Mobile User Plane t_m_tmap; t_m_tmap_sid1; // 2 SIDs (DA + sid1) t_m_tmap_sid2; // 3 SIDs (DA + sid1/2) t_m_tmap_sid3; // 4 SIDs (DA + sid1/2/3) } } Strategy • Separate tables based on “key” field to reduce “Match” resource • “insert” is not required for ipv4 match table (SRH require IPv6) • Create action per number of SIDs to insert
  • 14. p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0 p4srv6 “End” Tables table srv6_end { // localsid key = { hdr.ipv6.dstAddr : ternary; // hdr.srh.isValid() : ternary; // hdr.srh.segmentLeft : ternary; // hdr.srh.nextHdr : ternary; // for decap } actions = { @defaultonly NoAction; // SRv6 Network Program end; // End // SRv6 Mobile User Plane end_m_gtp4_e; // End.M.GTP4.E } const default_action = NoAction; } Strategy • “End” must match IPv6 address (SID = IPv6 dstAddr) thus only single table. (Currently not implemented but) Match field (key) to generate errors when invalid packet received matching localsid.
  • 15. p4srv6 ... examples of config and packet dump p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
  • 16. p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0 GTP to SRv6 with T.M.Tmap & End.M.GTP4.E (no SRH) SRGW1 R1 SRGW2 veth1 host1 #1 vtap1 #2 vtap2 #11 vtap11 #12 vtap12 host1172.20.0.1/24 172.20.0.2/24 veth2 BMv2 simple switch with p4srv6 GTP Tunnel (Linux Kernel) T.M.Tmap (BMv2) End.M.GTP4.E (BMv2) GTP Tunnel (Linux Kernel) [ICMP][IPv4] => [ICMP][IPv4][GTP][UDP][IPv4] => [ICMP][IPv4] => (SRv6 with no SRH) [ICMP][IPv4][IPv6] => [ICMP][IPv4][GTP][UDP][IPv4] => ① ①② ① ② SRv6 SID : fc34:5678:ac14:0002:ac14:0001:0000:0064 Dst: 172.20.0.2 Src: 172.20.0.1 TEID: 100 PREFIX SRv6 SID
  • 17. p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0 GTP to SRv6 with T.M.Tmap & End.M.GTP4.E (with SRH) GTP Tunnel (Linux Kernel) T.M.Tmap (BMv2) End.M.GTP4.E (BMv2) GTP Tunnel (Linux Kernel) [ICMP][IPv4] => [ICMP][IPv4][GTP][UDP][IPv4] => [ICMP][IPv4] =>(SRv6 with SRH) [ICMP][IPv4][SRH][IPv6] => [ICMP][IPv4][GTP][UDP][IPv4] => ① ②End (BMv2) SRGW1 SRGW2 veth1 host1 #1 vtap1 #2 vtap2 #11 vtap11 #12 vtap12 host1172.20.0.1/24 172.20.0.2/24 veth2 BMv2 simple switch with p4srv6 #13 vtap13 #14 vtap14 R1
  • 18. p4srv6 ... control plane integration p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0 To Be Updated in Future Rev.
  • 19. p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0 Match Action Table (MAT) abstraction considerations To Be Updated in Future Rev.
  • 20. P4 Implementation tips p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
  • 21. SID List (variable length array field) state start { transition parse_ethernet; } state parse_ethernet { pkt.extract(hdr.ether); transition select(hdr.ether.etherType) { ETH_P_IPV4 : parse_ipv4; ETH_P_IPV6 : parse_ipv6; //ETH_P_ARP : parse_arp; //ETH_P_VLAN : parse_vlan; default : accept; } state parse_ipv4 { pkt.extract(hdr.ipv4); transition select(hdr.ipv4.protocol) { IPPROTO_TCP : parse_tcp; IPPROTO_UDP : parse_udp; default : accept; } } state parse_ipv6 { pkt.extract(hdr.ipv6); transition select(hdr.ipv6.nextHdr) { IPPROTO_TCP : parse_tcp; IPPROTO_UDP : parse_udp; IPPROTO_ROUTE : parse_srh; IPPROTO_IPV4 : parse_inner_ipv4; IPPROTO_IPV6 : parse_inner_ipv6; default : accept; } } header SRH_SegmentList_h { bit<128> sid; } struct Header { Ethernet_h ether; IPv6_h ipv6; SRH_h srh; SRH_SegmentList_h[SRH_SID_MAX] srh_sid; p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0
  • 22. p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0 SID List (variable length array field) /*** PARSE SRH (SRv6) ***/ state parse_srh { pkt.extract(hdr.srh); transition parse_srh_sid_0; } #define PARSE_SRH_SID(curr, next) ¥ state parse_srh_sid_##curr { ¥ pkt.extract(hdr.srh_sid[curr]); ¥ transition select(hdr.srh.lastEntry) { ¥ curr : parse_srh_next_header; ¥ default : parse_srh_sid_##next; ¥ } ¥ } ¥ // switch_srv6.p4:SRH_SID_MAX 4 PARSE_SRH_SID(0, 1) PARSE_SRH_SID(1, 2) PARSE_SRH_SID(2, 3) state parse_srh_sid_3 { pkt.extract(hdr.srh_sid[3]); transition select(hdr.srh.lastEntry) { 3 : parse_srh_next_header; // v1model: no default rule: // all other packets rejected } } state parse_srh_next_header { transition select(hdr.srh.nextHdr) { IPPROTO_TCP : parse_tcp; IPPROTO_UDP : parse_udp; IPPROTO_IPV4 : parse_inner_ipv4; IPPROTO_IPV6 : parse_inner_ipv6; default : accept; } }
  • 23. p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0 SRv6 active segment action end() { // 1. IF NH=SRH and SL > 0 // 2. decrement SL hdr.srh.segmentsLeft = hdr.srh.segmentsLeft - 1; // 3. update the IPv6 DA with SRH[SL] hdr.ipv6.dstAddr = hdr.srh_sid[hdr.segmentsLeft-1]; ... Compiler ERROR!! Cannot use array with variable index in action statement.
  • 24. p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0 SRv6 active segment table srv6_set_nextsid { // helper table key = { hdr.srh.segmentsLeft : exact; } actions = { NoAction; set_nextsid_1; set_nextsid_2; set_nextsid_3; set_nextsid_4; } const default_action = NoAction; const entries = { (1) : set_nextsid_1(); (2) : set_nextsid_2(); (3) : set_nextsid_3(); (4) : set_nextsid_4(); } } action set_nextsid_1() { user_md.srv6.nextsid = hdr.srh_sid[0].sid; } action set_nextsid_2() { user_md.srv6.nextsid = hdr.srh_sid[1].sid; } action set_nextsid_3() { user_md.srv6.nextsid = hdr.srh_sid[2].sid; } action set_nextsid_4() { user_md.srv6.nextsid = hdr.srh_sid[3].sid; } Use constant entries to set next SID to metadata without user configuration. Let me know if you have better idea ☺
  • 25. p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0 SRv6 active segment action end() { // 1. IF NH=SRH and SL > 0 // 2. decrement SL hdr.srh.segmentsLeft = hdr.srh.segmentsLeft - 1; // 3. update the IPv6 DA with SRH[SL] hdr.ipv6.dstAddr = hdr.srh_sid[hdr.segmentsLeft-1]; ... action end() { // 1. IF NH=SRH and SL > 0 // 2. decrement SL hdr.srh.segmentsLeft = hdr.srh.segmentsLeft - 1; // 3. update the IPv6 DA with SRH[SL] hdr.ipv6.dstAddr = user_md.srv6.nextsid; ... Compiler ERROR!! Cannot use array with variable index in action statement. Set active segment from metadata
  • 26. p4srv6 (P4-16) design document | ENOG55 in Nigata Tsubame Sanjyo | 2019/02/22 rev1.0 p4srv6 ... feature and roadmap https://github.com/ebiken/p4srv6