Slides from ONOS/CORD meetup in Tokyo 2018. 20th April 2018.
http://www.e-side.co.jp/onoscordmeetup/#P4_2
Future Mobile User Plane is heavily discussed in many SDOs like 3GPP, IETF etc. and still not concreate. P4 lang is usefull to prototype such changing protocol on software switch and on ASIC/NPU.
This slide introudce one candidate for future Mobile User Plane protocol, SRv6 for Mobile User Plane and proto-type implemented in P4-14.
https://datatracker.ietf.org/doc/draft-ietf-dmm-srv6-mobile-uplane/
2024: Domino Containers - The Next Step. News from the Domino Container commu...
SRv6 Mobile User Plane P4 proto-type
1. proto-typing new protocol
with P4
SRv6 for Mobile User Plane
2018/04/20
Kentaro Ebisawa <ebiken@pontonetworks.com>
Twitter: @ebiken
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 1
2. About Me
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 3
https://www.linkedin.com/in/ebiken/ https://twitter.com/ebiken
Open Source NOS
Programmable Data Plane
Connected Cars
Future Mobile Networks
In Network Computing
3. Overview of Future Mobile User Plane (Motivation)
Problem statement | Discussion at IETF and 3GPP
Segment Routing IPv6 (SRv6) basics
Overview | Transit & End Functions
SRv6 Mobile User Plane Functions
SRv6 Open Source Implementations
SRv6 Mobile User Plane Proto-type using P4
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 4
Agenda
4. Overview of Future Mobile User Plane
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 5
5. Overview of Future Mobile User Plane
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 6
Demands and Technologies for Future Mobile Network
Demands
(Characteristics)
Technologies
Application
Based Charging
Converged
Access
Slicing
Classification
Edge
Computing Massive
IoT
Ultra Low
Latency
Anchorless
IPv6
adoption
CUPS
Control and User
Plane Separation
ILA
Identifier Locator
Addressing
LISP
Locator/ID Separation
Protocol
6. proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 7
3GPP TR29.892 “Study on User-plane Protocol in 5GC”
http://www.3gpp.org/DynaReport/WID-history--780001.htm
IETF 5gangip
https://www.ietf.org/mailman/listinfo/5gangip
IETF DMM Working Group
https://datatracker.ietf.org/wg/dmm/about/
Future Mobile User Plane discussion at 3GPP / IETF
7. Overview of Future Mobile User Plane
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 8
SRv6 for Mobile User Plane
One of the Proposals for Future Mobile User Plane Technology
IETF101 “SRv6 for Mobile User-Plane” by Satoru Matsushima (Slide 44)
https://datatracker.ietf.org/meeting/101/materials/slides-101-dmm-srv6-for-mobile-user-plane-01
8. Overview of Future Mobile User Plane
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 9
Segment Routing IPv6 for Mobile User Plane
https://datatracker.ietf.org/doc/draft-ietf-dmm-srv6-mobile-uplane/
9. Segment Routing IPv6 (SRv6) basics
protocol header format, example packets
SRv6 functions
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 10
10. SRv6 Basics
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 11
SRv6 is loose source routing method which source node will specify ordered
list of SIDs (Segment IDs) representing the path the packet should take.
#1
#4
#2 #3
#5
SR Endpoint node node whose “MyLocalSID Table” contains an entry for the DA of the packet
Source SR node node originating an IPv6 packet with its IPv6 and Segment Routing Headers
Transit node node not supporting SRv6 or node whose “MyLocalSID Table” does NOT contain DA of the packet
# Endpoint is NOT last destination
1. Source node
could be a host
originating packet
with SRH
2. Or, could be a gateway
who encap packet in
IPv6 header with SRH
3. Transit node doesn’t
need to understand
(support) SRH
4. Endpoint could have
multiple SIDs
11. SRv6 Basics
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 12
SRv6 enables Traffic Engineering and Network Programmability
no or less state in the network
SID locations would be advertised via IGP
no need to replace all network nodes (router/switch)
non-SR nodes will simply forward packet based on IPv6 routing
discussed in IETF WGs
6MAN, SPRING, DMM
draft-ietf-6man-segment-routing-header
draft-filsfils-spring-srv6-network-programming
draft-xuclad-spring-sr-service-chaining
draft-ietf-dmm-srv6-mobile-uplane
12. SRv6 basics
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 13
Segment Routing Header (SRH)
IPv6
Header
IPv6
Extension
Header
Payload
• Routing Type
• 4 (Segment Routing)
• Segments Left
• Index to the next segment in the
Segment List
• Decremented on Endpoint node
• Last Entry
• Index to the first segment in the
Segment List
• Segment List
• Encoded starting from the last
segment of the path (Segment
List [0] contains the last segment)
Reference: draft-ietf-6man-segment-routing-header
13. SRv6 basics
• “SRv6 Network Programming” Internet-Draft document
• draft-filsfils-spring-srv6-network-programming
• Segment List: <S1, S2, S3>
• S1, S2, S3: 1st, 2nd, 3rd segment to visit
• IP Packet: (SA,DA) (S3, S2, S1; SL)
• SA, DA: Source, Destination Address
• SRH with SID list <S1, S2, S3>
• SL: Segments Left
!! Order of segments would be reversed in <...> and (...) !!
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 14
SID List description in “SRv6 Network Programming”
S1
S2
S3
SL
14. SRv6 basics
• SID is 128bit and similar to IPv6 address. But semantics is different.
• LOC, FUNC, ARGS has flexible length. (ARGS could be 0 length)
• SID would be used to route packet to the node SID resides.
• With longest prefix match, and FUNC, ARGS could also be part of the prefix.
• Local SID may, but does not have to, be an IPv6 address associated to
a local interface of the node.
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 15
SRv6 SID (Segment ID) format
128bits
LOC (locator) FUNC (function) ARGS (arguments)
Reference: draft-filsfils-spring-srv6-network-programming
15. SRv6 basics
• draft-ietf-6man-segment-routing-header
• defines two basic functions (End, End.X)
• draft-filsfils-spring-srv6-network-programming
• defines many functions associated with SRv6 SID’s.
• draft-ietf-dmm-srv6-mobile-uplane
• defines functions to enable SRv6 to be used in mobile network
• includes functions for migrating from GTP to SRv6
• draft-xuclad-spring-sr-service-chaining
• defines functions for Service Chaining
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 16
Segment is a set of Functions (instructions)
WORK IN PROGRESS
Functions are actively
added / removed / modified
16. SRv6 basics
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 17
List of SRv6 functions
End Endpoint
Xconnect End.X Endpoint with Layer-3 cross-connect
Table Lookup End.T Endpoint with specific IPv6 table lookup
Search End.S Endpoint in search of a target in table T
Decaps
+ Xconnect
End.DX6 Endpoint with decapsulation and IPv6 crossconnect
End.DX4 Endpoint with decapsulation and IPv4 crossconnect
End.DX2 Endpoint with decapsulation and Layer-2 crossconnect
End.DX2V Endpoint with decapsulation and VLAN L2 table lookup
Decaps
+ Table Lookup
End.DT6 Endpoint with decapsulation and specific IPv6 table lookup
End.DT4 Endpoint with decapsulation and specific IPv4 table lookup
End.DT46 Endpoint with decapsulation and specific IP table lookup
End.DT2U Endpoint with decapsulation and unicast MAC L2 table lookup
End.DT2M Endpoint with decapsulation and L2 table flooding
Binding
End.B6 Endpoint bound to an SRv6 policy
End.B6.Encaps Endpoint bound to an SRv6 encapsulation policy
End.BM Endpoint bound to an SR-MPLS policy
T Transit behavior
Insert
T.Insert Transit with insertion of an SRv6 Policy
T.Insert.Red Transit with reduced insertion of an SRv6 Policy
Encaps
T.Encaps Transit with encapsulation in an SRv6 Policy
T.Encaps.Red Transit with reduce encaps in an SRv6 Policy
T.Encaps.L2 Transit with encapsulation of L2 frames
T.Encaps.L2.Red Transit with reduce encaps of L2 frames in an SRv6 Policy
3) draft-ietf-dmm-srv6-mobile-uplane-01
Mobile
End.MAP Endpoint function with SID mapping
End.M.GTP6.D
Endpoint function with decapsulation from
IPv6/GTP tunnel
End.M.GTP6.E
Endpoint function with encapsulation for
IPv6/GTP tunnel
End.M.GTP4.E
Endpoint function with encapsulation for
IPv4/GTP tunnel
End.Limit Rate Limiting function
T.Tmap
Transit behavior with tunnel decapsulation
and mapping an SRv6 Policy
Application
End.AM SRv6 masquerading proxy
End.AD SRv6 dynamic proxy segments
End.AS SRv6 dynamic Static proxy segments
End.AN SR-aware function (native)
1) draft-filsfils-spring-srv6-network-programming-04
2) draft-xuclad-spring-sr-service-chaining-01
17. SRv6 basics
• Transit function (node)
• The packets DA is NOT an IP address of the node
• The packets DA is NOT listed in “My Local SID Table” of the node
• End function (node)
• The packets DA is IP address of the node, or
• The packets DA is listed in “My Local SID Table”
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 18
End vs Transit function (node)
18. SRv6 basics
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 19
Transit functions
Function Description
T Forwards the packet without inspecting the SRH
T.Insert Transit behavior with insertion of an SRv6 Policy
T.Encaps Transit behavior with encapsulation in an SRv6 policy
T.Encaps.L2 T.Encaps behavior of the received L2 frame
#1
#4
#2 #3
#5
19. SRv6 basics
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 20
Transit functions (T.Insert)
a
#1
b #4
#2 #3
#5
d
c
IPv6 Payload
IPv6 PayloadSRH (SA:a, DA: #1)(d, #5, #3, #2, #1; SL=4)
Next SegmentDestination Host
(SA:a, DA: d)
20. SRv6 basics
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 21
Transit functions (T.Encaps)
IPv6 Payload
IPv6 PayloadSRH IPv6 (SA:b, DA: #4)(#3, #2, #4; SL=2)(SA:b, DA: c)
a
#1
b #4
#2 #3
#5
d
c
Next Segment
(SA:b, DA: c)
21. SRv6 basics
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 22
Inline mode Encap mode
final destination is in SID[0]
final destination is in
encapsulated IP header
Example Wireshark Output
IP + SRH + ICMP IP + SRH + IP + ICMP
22. SRv6 basics
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 23
End functions (End)
End: Update the DA with the next segment and forward the packet accordingly.
IPv6
IPv6 PayloadSRH
(SA:a, DA: #1)(d, #5, #3, #2, #1; SL=4)PayloadSRH
(SA:a, DA: #2)(d, #5, #3, #2, #1; SL=3)
a
#1
b #4
#2 #3
#5
d
c
Next Segment
23. SRv6 Mobile User Plane Functions
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 24
24. SRv6 Mobile User Plane Functions
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 25
Segment Routing IPv6 for Mobile User Plane
draft-ietf-dmm-srv6-mobile-uplane-01
Table of Contents
5. User-plane behaviors . . . . . . . . . . . . . . . . . . . . 6
5.1. Traditional mode (formerly Basic mode) . . . . . . . . . 6
5.1.1. Packet flow - Uplink . . . . . . . . . . . . . . . . 7
5.1.2. Packet flow - Downlink . . . . . . . . . . . . . . . 8
5.1.3. IPv6 user-traffic . . . . . . . . . . . . . . . . . . 8
5.2. Enhanced Mode (formerly Aggregate mode) . . . . . . . . . 8
5.2.1. Packet flow - Uplink . . . . . . . . . . . . . . . . 9
5.2.2. Packet flow - Downlink . . . . . . . . . . . . . . . 10
5.2.3. IPv6 user-traffic . . . . . . . . . . . . . . . . . . 10
5.3. Enhanced mode with unchanged gNB GTP behavior . . . . . . 10
5.3.1. Interworking with IPv6 GTP . . . . . . . . . . . . . 11
5.3.2. Interworking with IPv4 GTP . . . . . . . . . . . . . 14
5.3.3. Extensions to the interworking mechanisms . . . . . . 16
mobile user-plane functions are the same as existing ones
except the use of SRv6 as the data plane instead of GTP-U
improvements in terms of traffic steering and service chaining,
thanks to the use of an SR policy of multiple SIDs
interworking with legacy gNBs that still use GTP
( gNB does not support SRv6 )
SRv6 ONLY
SRv6 + GTP
25. SRv6 Mobile User Plane Functions
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 26
SRv6 Functions in “5.3.1. Interworking with IPv6 GTP”
(Encap GTP) End.M.GTP6.D End (PSP)
End
End.DT6
(Decap GTP)
End.M.GTP6.E
End
End
T.Encaps.Red
Uplink
Downlink
Assuming User Packet (A,Z) is IPv6
PSP: Penultimate Segment Pop
GTP to SRv6
SRv6 to GTP
26. SRv6 Mobile User Plane Functions
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 27
Segment Routing IPv6 for Mobile User Plane
draft-ietf-dmm-srv6-mobile-uplane-01
27. proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 28
List of SRv6 functions
End Endpoint
Xconnect End.X Endpoint with Layer-3 cross-connect
Table Lookup End.T Endpoint with specific IPv6 table lookup
Search End.S Endpoint in search of a target in table T
Decaps
+ Xconnect
End.DX6 Endpoint with decapsulation and IPv6 crossconnect
End.DX4 Endpoint with decapsulation and IPv4 crossconnect
End.DX2 Endpoint with decapsulation and Layer-2 crossconnect
End.DX2V Endpoint with decapsulation and VLAN L2 table lookup
Decaps
+ Table Lookup
End.DT6 Endpoint with decapsulation and specific IPv6 table lookup
End.DT4 Endpoint with decapsulation and specific IPv4 table lookup
End.DT46 Endpoint with decapsulation and specific IP table lookup
End.DT2U Endpoint with decapsulation and unicast MAC L2 table lookup
End.DT2M Endpoint with decapsulation and L2 table flooding
Binding
End.B6 Endpoint bound to an SRv6 policy
End.B6.Encaps Endpoint bound to an SRv6 encapsulation policy
End.BM Endpoint bound to an SR-MPLS policy
T Transit behavior
Insert
T.Insert Transit with insertion of an SRv6 Policy
T.Insert.Red Transit with reduced insertion of an SRv6 Policy
Encaps
T.Encaps Transit with encapsulation in an SRv6 Policy
T.Encaps.Red Transit with reduce encaps in an SRv6 Policy
T.Encaps.L2 Transit with encapsulation of L2 frames
T.Encaps.L2.Red Transit with reduce encaps of L2 frames in an SRv6 Policy
3) draft-ietf-dmm-srv6-mobile-uplane-01
Mobile
End.MAP Endpoint function with SID mapping
End.M.GTP6.D
Endpoint function with decapsulation from
IPv6/GTP tunnel
End.M.GTP6.E
Endpoint function with encapsulation for
IPv6/GTP tunnel
End.M.GTP4.E
Endpoint function with encapsulation for
IPv4/GTP tunnel
End.Limit Rate Limiting function
T.Tmap
Transit behavior with tunnel decapsulation
and mapping an SRv6 Policy
Application
End.AM SRv6 masquerading proxy
End.AD SRv6 dynamic proxy segments
End.AS SRv6 dynamic Static proxy segments
End.AN SR-aware function (native)
1) draft-filsfils-spring-srv6-network-programming-04
2) draft-xuclad-spring-sr-service-chaining-01
Many function with different way to manipulate packet
Functions are actively added / removed / modified
=> Good candidate for P4 proto-typing
28. SRv6 Open Source Implementations
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 29
29. SRv6 Open Source Implementations
• Kernel network stack (4.10 and later)
• http://www.segment-routing.org/
• Contributed by “IP Networking Lab” of Université Catholique de Louvain, Louvain-
la-Neuve, Belgium.
• srext: Linux kernel module
• https://netgroup.github.io/SRv6-net-prog/
• Developed by the Networking Group from University of Rome Tor Vergata, Italy
• Could support “Chaining of SRv6-unaware VNFs” use case (End.AD, End.AM)
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 30
SRv6 Linux Kernel Implementations
30. SRv6 Open Source Implementations
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 31
SRv6 Functions on Linux dataplane (status as of 2018/04/17)
First supported in Kernel 4.10
More functions added in 4.14
source: http://www.segment-routing.net/open-software/linux/
31. SRv6 Open Source Implementations
• Not a Linux Kernel (module) implementation, but works on Linux.
• https://wiki.fd.io/view/VPP/Segment_Routing_for_IPv6
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 32
SRv6 on VPP (by FD.io project)
Supported functions as of 2018/04/17
source: http://www.segment-routing.net/open-software/vpp/
32. SRv6 Open Source Implementations
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 33
CLI for SRv6 on Linux is also available
https://www.slideshare.net/kentaroebisawa/zebra-srv6-cli-on-linux-dataplane-enog49
33. proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 34
Can not find SRv6 functions I want
no SRv6 for Mobile User Plane on Linux Kernel nor VPP
End.MAP, End.M.GTP6.D/E, End.M.GTP4.E, T.Encaps.Red ...
Build them with P4 ☺
34. SRv6 Mobile User Plane
| Proto-type using P4
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 35
35. SRv6 Mobile User Plane | Proto-type using P4
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 36
Target Setup (non-routing demo)
UE
(user)
UPF1
(SRGW)
UPF2
(PGW?)
DN
(server)
S1gNB
2001:db8:a::1/64 2001:db8:a::2/64
2001:db8:ff::64/128 2001:db8:1::12/128 2001:db8:1::2/1282001:db8:b::1/128
#0 #15
#16#14#12
#13#11 #1
2001:db8:1::1/128
veth0 veth1
gtpu_encap_v6 End_M_GTP6_D2 End(0) End_DT6
gtpu_decap_v6 End_M_GTP6_E End(1) T_Encaps_Red3
2001:db8:1::11/128
Simply forward packet from port to port
& Apply GTP/SRv6 actions
( No MAC Learning, No L3 Routing)
36. proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 37
GitHub Repo
https://github.com/ebiken/p4srv6
(written in P4-14)
37. SRv6 Mobile User Plane | Proto-type using P4
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 38
source code structure
https://github.com/ebiken/p4srv6
Main file.
Control and Table definitions.
header, parser, actions definitions
SRv6 related
Generic
GTP related
38. SRv6 Mobile User Plane | Proto-type using P4
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 39
Control, Tables and Actions
control ingress{
apply(fwd);
apply(gtpu_v6);
apply(srv6_localsid);
}
table fwd {
reads {
standard_metadata.ingress_port: exact;
}
actions {forward; _drop;}
}
table gtpu_v6 {
reads {
ipv6.dstAddr: exact;
}
actions {
gtpu_encap_v6;
gtpu_decap_v6;
}
}
table srv6_localsid {
reads {
ipv6.dstAddr: exact;
}
actions {
srv6_T_Insert1; srv6_T_Insert2; srv6_T_Insert3;
srv6_T_Encaps2; srv6_T_Encaps1; srv6_T_Encaps3;
srv6_T_Encaps_Red2; srv6_T_Encaps_Red3;
srv6_End0; srv6_End1;
srv6_End_DT6;
srv6_End_M_GTP6_D2; srv6_End_M_GTP6_D3;
srv6_End_M_GTP6_E;
}
}
Fwd
Table
GTP Table SRv6 TablePacket Input Packet Output
39. SRv6 Mobile User Plane | Proto-type using P4
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 40
headers
//// GTPv1 User Data
// flags consists of below bits.
// [flag field name] : typical GTPv1U value
// Version(3bits) : 1 (GTPv1)
// Protocol Type : 1 (GTP)
// Reserved : 0 (must be 0)
// Extention (E) : 0
// Sequence number (S) : 0
// N-PDU number flag (PN) : 0
header_type gtpu_t {
fields { // 8bytes
flags : 8;
type : 8;
length : 16;
teid : 32;
}
}
header gtpu_t gtpu;
header_type ipv6_srh_t {
fields {
nextHeader : 8;
hdrExtLen : 8;
routingType : 8;
segmentsLeft : 8;
lastEntry : 8;
flags : 8;
tag : 16;
}
}
header ipv6_srh_t ipv6_srh;
header_type ipv6_srh_segment_t {
fields {
sid : 128;
}
}
#define SRH_MAX_SEGMENTS 3 // +1 for inline mode
header ipv6_srh_segment_t ¥
ipv6_srh_segment_list[SRH_MAX_SEGMENTS+1];
Using array_instance
for Segment List
40. proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 41
parsers (GTP)
> p4src/include/parser.p4
// GTP signaling and control (GTP-C)
#define UDP_PORT_GTPC 2123
// GTP user data messages (GTP-U)
#define UDP_PORT_GTPU 2152
parser parse_udp {
extract(udp);
return select(latest.dstPort) {
// UDP_PORT_GTPC : parse_gtpc;
UDP_PORT_GTPU : parse_gtpu;
default: ingress;
}
}
> p4src/include/gtp.p4
parser parse_gtpu {
extract(gtpu);
return ingress;
return select(current(0,4)) { // version field
0x04 : parse_gtpu_ipv4;
0x06 : parse_gtpu_ipv6;
}
}
parser parse_gtpu_ipv4 {
extract(gtpu_ipv4);
return ingress;
}
parser parse_gtpu_ipv6 {
extract(gtpu_ipv6);
return ingress;
}
Using 1st 4 bits to
identify payload
41. proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 42
parsers (SRv6)> p4src/include/parser.p4
#define IP_PROTOCOLS_SRV6 43
parser parse_ipv6 {
extract(ipv6);
return select(latest.nextHdr) {
//IP_PROTOCOLS_ICMP6 : parse_icmp6;
IP_PROTOCOLS_TCP : parse_tcp;
IP_PROTOCOLS_UDP : parse_udp;
IP_PROTOCOLS_SRV6 : parse_ipv6_srh;
default: ingress;
}
}
> p4src/include/srv6.p4
parser parse_ipv6_srh {
extract(ipv6_srh);
return parse_ipv6_srh_seg0;
}
parser parse_ipv6_srh_seg0 {
extract(ipv6_srh_segment_list[0]);
return select(ipv6_srh.lastEntry) {
0 : parse_ipv6_srh_payload;
default: parse_ipv6_srh_seg1;
}
}
...
Have parser for each SID
and move on based on
ipv6_srh.lastEntry value
parser parse_ipv6_srh_payload {
return select(ipv6_srh.nextHeader) {
//IP_PROTOCOLS_ICMP : parse_icmp;
IP_PROTOCOLS_IPV4 : parse_ipv4;
IP_PROTOCOLS_TCP : parse_tcp;
IP_PROTOCOLS_UDP : parse_udp;
IP_PROTOCOLS_IPV6 : parse_ipv6_inner;
default: ingress;
}
}
parser parse_ipv6_inner {
extract(ipv6_inner);
return ingress;
}
42. SRv6 Mobile User Plane | Proto-type using P4
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 43
SRv6 actions (srv6_End_M_GTP6_D)
action srv6_End_M_GTP6_D2(srcAddr, sid0, sid1) {
remove_header(udp);
remove_header(gtpu);
subtract_from_field(ipv6.payloadLen, 16); // UDP(8)+GTPU(8)
modify_field(ipv6.nextHdr, IP_PROTOCOLS_SRV6);
add_to_field(ipv6.payloadLen, 8+16*1); // SRH(8)+Seg(16)*1
ipv6_srh_insert(0); // push srh with nextHeader=0
// TODO: support non-IPv6(41) payload
modify_field(ipv6_srh.nextHeader, IP_PROTOCOLS_IPV6);
add_header(ipv6_srh_segment_list[0]);
modify_field(ipv6_srh_segment_list[0].sid, sid1);
// End.M.GTP6.D use seg0 as DA, but does NOT include it in the seg list.
modify_field(ipv6_srh.hdrExtLen, 2); // 2bytes*(number of seg)
modify_field(ipv6_srh.segmentsLeft, 1);
modify_field(ipv6_srh.lastEntry, 0); // sid0 is not included thus 1 smaller.
// 4. set the outer IPv6 SA to A
modify_field(ipv6.srcAddr, srcAddr);
// 5. set the outer IPv6 DA to S1
modify_field(ipv6.dstAddr, sid0);
// 6. forward according to the first segment of the SRv6 Policy
}
action srv6_End_M_GTP6_D3(srcAddr, sid0, sid1, sid2) {
...
multiple srv6_End_M_GTP_D*
based on number of SIDs to insert.
How to identify nextHeader is still under discussion.
Most likely it would be configured by control plane and
not by identifying based on 1st 4 bits (IP version field)
[IP][UDP][GTP][IP-inner]
=> [IP][SRH][IP-inner]
43. SRv6 Mobile User Plane | Proto-type using P4
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 44
SRv6 actions (srv6_End_M_GTP6_E) (1/2)
action srv6_End_M_GTP6_E(srcAddr) {
subtract_from_field(ipv6_srh.segmentsLeft, 1);
modify_field(ipv6.srcAddr, srcAddr);
// 4. store TEID in variable new_TEID
bit_and(srv6_meta.teid, 0x000000000000000000000000ffffffff, ipv6.dstAddr);
// 5. pop IP header and all it's extension headers
// don't pop IPv6 header. will reuse it.
remove_header(ipv6_srh);
remove_header(ipv6_srh_segment_list[0]);
remove_header(ipv6_srh_segment_list[1]);
remove_header(ipv6_srh_segment_list[2]);
remove_header(ipv6_srh_segment_list[3]);
// 7. set IPv6 DA to new_DA
// Maybe we need table to call srv6_End_M_GTP6_E1~3 based on SL,
// But let's assume SL=1 when packet reaches SRGW and SL[0] is gNB addr.
modify_field(ipv6.dstAddr, ipv6_srh_segment_list[0].sid);
// Adjust IP length: UDP(8)+GTP(8) - ( SRH(8) + SEG(16)*(n+1) )
srv6_meta.ipv6_payloadLen = ipv6.payloadLen+8+8-8-16; // TODO
modify_field(ipv6.payloadLen, srv6_meta.ipv6_payloadLen);
modify_field(ipv6.nextHdr, IP_PROTOCOLS_UDP);
...
SID of End.M.GTP6.E is SRGW(96)::TEID(32)
mask right most 32 bits to get TEID from SID
[IP][SRH][IP-inner]
=> [IP][UDP][GTP][IP-inner]
44. SRv6 Mobile User Plane | Proto-type using P4
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 45
SRv6 actions (srv6_End_M_GTP6_E) (2/2)
// 6. push new IPv6 header and GTP-U header
add_header(udp);
add_header(gtpu);
// Although identical, you have to add gtpu_ipv6 and remove ipv6_inner
// to help deparser to understand it would come after gtpu_ipv6 header.
add_header(gtpu_ipv6);
copy_header(gtpu_ipv6, ipv6_inner);
remove_header(ipv6_inner);
modify_field(udp.srcPort, 1000); // TODO: generate from flow label, or random??
modify_field(udp.dstPort, UDP_PORT_GTPU);
// ipv6.payloadLen does not include ipv6 header. udp.len does include udp header.
// Thus, udp.length = ipv6.payloadLen.
modify_field(udp.length_, ipv6.payloadLen);
// TODO: update UDP checksum
// 8. set GTP_TEID to new_TEID
modify_field(gtpu.teid, srv6_meta.teid);
modify_field(gtpu.flags, 0x30);
modify_field(gtpu.type, 255); // G-PDU(255)
// gtpu.length length of payload and optional fields.
// exclude udp(8) and 8 byte mandatory field (including teid)
modify_field(gtpu.length, udp.length_-16);
// 9. lookup the new_DA and forward the packet accordingly
}
[IP][SRH][IP-inner]
=> [IP][UDP][GTP][IP-inner]
deparser identify packet to construct
not as BYTE array but as FIELDs
45. #15 #16
#1
veth1#12
#11
SRv6 Mobile User Plane | Proto-type using P4
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 46
Setup: demo/IPv6-GTP-Interworking.md
UE
(user)
UPF1
(SRGW)
UPF2
(PGW?)
DN
(server)
S1gNB
#0
#14#13
veth0
namespace
host0
namespace
host1simple_switch (bmv2)
Thrift-port: 9090
simple_switch (bmv2)
Thrift-port: 9091
Running on single host: Ubuntu 16.04.4
Used 2 (two) BMv2 instance with thrift-port 9090/9091
Both end hosts are Linux netns (network namespace)
bmv2/targets/simple_switch/runtime_CLI --thrift-port 9090
bmv2/targets/simple_switch/runtime_CLI --thrift-port 9090
Runtime CLI
49. SRv6 Mobile User Plane | Proto-type using P4
• Running P4 SRv6 on P4 Switch (ASIC) and SmartNIC (NPU/FPGA)
• Interop with other implementations (Linux, Router etc..)
• Test scalability (packet forwarding performance)
• Implement using P4-16
• (hopefully) cleaner way to code de-serializer
• refactor code and integrate with basic switching features (L2/L3 switching)
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 50
Next Steps
50. proto-typing new protocol with P4
proto-typing new protocol with P4, SRv6 for Mobile User Plane | ONOS/CORD meetup in Tokyo | 2018/04/20 51
conclusion
You can proto-type a new protocol quickly using P4
Easy to test/demo (BMv2 software)
Can scale running on hardware (P4 ASIC/NPU)
Source Code Available on GitHub
P4 Proto-type of SRv6 functions with SRv6 for Mobile User Plane
https://github.com/ebiken/p4srv6
how to run demo
https://github.com/ebiken/p4srv6/blob/master/demo/IPv6-GTP-Interworking.md