FD.io VPP  v21.01.1
Vector Packet Processing
mobile.h
Go to the documentation of this file.
1 /*
2  * srv6_end.h
3  *
4  * Copyright (c) 2019 Arrcus Inc and/or its affiliates.
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef __included_srv6_end_h__
19 #define __included_srv6_end_h__
20 
21 #include <vnet/vnet.h>
22 #include <vnet/ip/ip.h>
23 #include <vnet/srv6/sr.h>
24 #include <vnet/srv6/sr_packet.h>
25 
26 #include <vppinfra/error.h>
27 #include <vppinfra/elog.h>
28 
29 #define SRV6_GTP_UDP_DST_PORT 2152
30 
31 #define SRV6_NHTYPE_NONE 0
32 #define SRV6_NHTYPE_IPV4 1
33 #define SRV6_NHTYPE_IPV6 2
34 #define SRV6_NHTYPE_NON_IP 3
35 
36 #ifndef IP_PROTOCOL_IP6_ETHERNET
37 #define IP_PROTOCOL_IP6_ETHERNET 143
38 #endif
39 
40 #define SRV6_GTP6_UNKNOW 0
41 #define SRV6_GTP6_DT4 1
42 #define SRV6_GTP6_DT6 2
43 #define SRV6_GTP6_DT46 3
44 
45 #define SRV6_GTP4_UNKNOW 0
46 #define SRV6_GTP4_DT4 1
47 #define SRV6_GTP4_DT6 2
48 #define SRV6_GTP4_DT46 3
49 
50 #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
51 #define BITALIGN2(A,B) A; B
52 #define BITALIGN3(A,B,C) A; B; C
53 #else
54 #define BITALIGN2(A,B) B; A
55 #define BITALIGN3(A,B,C) C; B; A
56 #endif
57 
58 #define GTPU_EXTHDR_FLAG 0x04
59 #define GTPU_SEQ_FLAG 0x02
60 #define GTPU_EXTHDR_PDU_SESSION 0x85
61 
62 #define SRH_TAG_ECHO_REPLY 0x0008
63 #define SRH_TAG_ECHO_REQUEST 0x0004
64 #define SRH_TAG_ERROR_INDICATION 0x0002
65 #define SRH_TAG_END_MARKER 0x0001
66 
67 #define GTPU_RECOVERY_IE_TYPE 0x0e
68 
69 #define GTPU_IE_MAX_SIZ 256
70 #define SRH_TLV_USER_PLANE_CONTAINER 0x0a /* tentative */
71 
72 /* *INDENT-OFF* */
73 typedef struct
74 {
77 } __attribute__ ((packed)) gtpu_recovery_ie;
78 /* *INDENT-ON* */
79 
80 /* *INDENT-OFF* */
81 typedef struct
82 {
86 } __attribute__ ((packed)) gtpu_exthdr_t;
87 /* *INDENT-ON* */
88 
89 /* *INDENT-OFF* */
90 typedef struct
91 {
94  u16 length; /* length in octets of the payload */
96  gtpu_exthdr_t ext[0];
97 } __attribute__ ((packed)) gtpu_header_t;
98 /* *INDENT-ON* */
99 
100 #define GTPU_TYPE_ECHO_REQUEST 1
101 #define GTPU_TYPE_ECHO_REPLY 2
102 #define GTPU_TYPE_ERROR_INDICATION 26
103 #define GTPU_TYPE_END_MARKER 254
104 #define GTPU_TYPE_GTPU 255
105 
106 /* *INDENT-OFF* */
107 typedef struct
108 {
109  BITALIGN2 (u8 ppi:3,
110  u8 spare:5);
111 
113 } __attribute__ ((packed)) gtpu_paging_policy_t;
114 /* *INDENT-ON* */
115 
116 /* *INDENT-OFF* */
117 typedef struct
118 {
120  BITALIGN2(u8 type:4,
121  u8 spare:4);
122  union {
123  struct gtpu_qfi_bits {BITALIGN3(u8 p:1,
124  u8 r:1,
125  u8 qfi:6);
126  } bits;
127 
129  } u;
130 
133 } __attribute__ ((packed)) gtpu_pdu_session_t;
134 /* *INDENT-ON* */
135 
136 #define GTPU_PDU_SESSION_P_BIT_MASK 0x80
137 #define GTPU_PDU_SESSION_R_BIT_MASK 0x40
138 #define GTPU_PDU_SESSION_QFI_MASK 0x3f
139 
140 #define SRV6_PDU_SESSION_U_BIT_MASK 0x01
141 #define SRV6_PDU_SESSION_R_BIT_MASK 0x02
142 #define SRV6_PDU_SESSION_QFI_MASK 0xfC
143 
144 /* *INDENT-OFF* */
145 typedef struct
146 {
147  ip4_header_t ip4; /* 20 bytes */
148  udp_header_t udp; /* 8 bytes */
149  gtpu_header_t gtpu; /* 8 bytes */
150 } __attribute__ ((packed)) ip4_gtpu_header_t;
151 /* *INDENT-ON* */
152 
153 /* *INDENT-OFF* */
154 typedef struct
155 {
156  ip6_header_t ip6; /* 40 bytes */
157  udp_header_t udp; /* 8 bytes */
158  gtpu_header_t gtpu; /* 8 bytes */
159 } __attribute__ ((packed)) ip6_gtpu_header_t;
160 /* *INDENT-ON* */
161 
162 #define GTPU_V1_VER (1<<5)
163 
164 #define GTPU_PT_GTP (1<<4)
165 
166 /* *INDENT-OFF* */
167 typedef struct
168 {
171  u8 value[0];
172 } __attribute__ ((packed)) user_plane_sub_tlv_t;
173 /* *INDENT-ON* */
174 
175 #define USER_PLANE_SUB_TLV_IE 0x01
176 
177 typedef struct srv6_end_gtp6_param_s
178 {
180 
181  ip6_address_t sr_prefix;
184 
186 {
188 
193 
195 {
197 
202 
203 typedef struct srv6_end_gtp4_param_s
204 {
206 
207  ip6_address_t sr_prefix;
209 
210  ip6_address_t v6src_prefix;
212 
215 
216 typedef struct srv6_end_main_v4_s
217 {
220 
223 
224  u32 dst_p_len; // dst prefix len
225  u32 src_p_len; // src prefix len
226 
228 
230 
232 {
235 
238 
241 
245 
246 typedef struct srv6_end_main_v6_s
247 {
250 
253 
256 
259 
261 {
264 
267 
270 
273 
275 {
278 
281 
284 
287 
288 typedef struct srv6_end_main_v6_dt_s
289 {
292 
296 
299 
300 typedef struct srv6_t_main_v4_dt_s
301 {
304 
308 
311 
312 #endif /* __included_srv6_end_h__ */
313 
314 /*
315  * fd.io coding-style-patch-verification: ON
316  *
317  * Local Variables:
318  * eval: (c-set-style "gnu")
319  * End:
320  */
vnet_main_t * vnet_main
Definition: mobile.h:303
vlib_main_t * vlib_main
Definition: mobile.h:302
srv6_end_main_v4_t srv6_end_main_v4
Definition: gtp4_e.c:24
ip6_header_t cache_hdr
Definition: mobile.h:268
u32 teid
Definition: mobile.h:95
srv6_t_main_v4_dt_t srv6_t_main_v4_dt
Definition: gtp4_dt.c:25
struct srv6_end_main_v6_dt_s srv6_end_main_v6_dt_t
vlib_node_registration_t srv6_end_m_gtp4_e
(constructor) VLIB_REGISTER_NODE (srv6_end_m_gtp4_e)
Definition: node.c:1213
u16 length
Definition: mobile.h:94
unsigned char u8
Definition: types.h:56
vnet_main_t * vnet_main
Definition: mobile.h:277
vlib_main_t * vlib_main
Definition: mobile.h:218
ip6_header_t ip6
Definition: mobile.h:156
unsigned int u32
Definition: types.h:88
vnet_main_t * vnet_main
Definition: mobile.h:291
vlib_main_t * vlib_main
Definition: mobile.h:233
u32 padding
Definition: vhost_user.h:105
struct srv6_end_main_v6_s srv6_end_main_v6_t
u8 npdu_num
Definition: mobile.h:84
vl_api_fib_path_type_t type
Definition: fib_types.api:123
gtpu_header_t gtpu
Definition: mobile.h:149
vnet_main_t * vnet_main
Definition: mobile.h:249
struct srv6_end_main_v6_decap_di_s srv6_end_main_v6_decap_di_t
unsigned short u16
Definition: types.h:57
struct srv6_end_gtp6_param_s srv6_end_gtp6_param_t
#define BITALIGN3(A, B, C)
Definition: mobile.h:55
vlib_main_t * vlib_main
Definition: mobile.h:276
struct srv6_end_gtp4_param_s srv6_end_gtp4_param_t
srv6_t_main_v4_decap_t srv6_t_main_v4_decap
Definition: gtp4_d.c:24
The fine-grained event logger allows lightweight, thread-safe event logging at minimum cost...
u32 end_m_gtp4_e_node_index
Definition: mobile.h:221
ip6_address_t v6src_prefix
Definition: mobile.h:210
vlib_node_registration_t srv6_t_m_gtp4_dt
(constructor) VLIB_REGISTER_NODE (srv6_t_m_gtp4_dt)
Definition: node.c:3013
struct srv6_end_main_v4_s srv6_end_main_v4_t
struct srv6_t_main_v4_decap_s srv6_t_main_v4_decap_t
struct srv6_end_main_v6_decap_s srv6_end_main_v6_decap_t
u32 t_m_gtp4_dt_node_index
Definition: mobile.h:305
ip4_gtpu_header_t cache_hdr
Definition: mobile.h:227
ip6_gtpu_header_t cache_hdr
Definition: mobile.h:254
udp_header_t udp
Definition: mobile.h:157
u8 value
Definition: qos.api:54
u32 end_m_gtp6_e_node_index
Definition: mobile.h:251
vnet_main_t * vnet_main
Definition: mobile.h:263
srv6_end_main_v6_t srv6_end_main_v6
Definition: gtp6_e.c:24
vlib_node_registration_t srv6_end_m_gtp6_d_di
(constructor) VLIB_REGISTER_NODE (srv6_end_m_gtp6_d_di)
Definition: node.c:2987
u8 nextexthdr
Definition: mobile.h:85
vlib_main_t * vlib_main
Definition: mobile.h:248
u32 error_node_index
Definition: mobile.h:222
udp_header_t udp
Definition: mobile.h:148
struct _vlib_node_registration vlib_node_registration_t
ip4_header_t ip4
Definition: mobile.h:147
vlib_main_t * vlib_main
Definition: mobile.h:262
srv6_end_main_v6_dt_t srv6_end_main_v6_dt
Definition: gtp6_dt.c:25
u32 error_node_index
Definition: mobile.h:252
vlib_node_registration_t srv6_end_m_gtp6_e
(constructor) VLIB_REGISTER_NODE (srv6_end_m_gtp6_e)
Definition: node.c:2963
struct srv6_t_gtp4_dt_param_s srv6_t_gtp4_dt_param_t
vlib_node_registration_t srv6_end_m_gtp6_d
(constructor) VLIB_REGISTER_NODE (srv6_end_m_gtp6_d)
Definition: node.c:2975
ip6_address_t sr_prefix
Definition: mobile.h:181
vnet_main_t * vnet_main
Definition: mobile.h:234
u8 restart_counter
Definition: mobile.h:76
vnet_main_t * vnet_main
Definition: mobile.h:219
Bits Octets 8 7 6 5 4 3 2 1 1 Version PT (*) E S PN 2 Message Type 3 Length (1st Octet) 4 Length...
Definition: mobile.h:90
vlib_node_registration_t srv6_end_m_gtp6_dt
(constructor) VLIB_REGISTER_NODE (srv6_end_m_gtp6_dt)
Definition: node.c:2999
u32 end_m_gtp6_dt_node_index
Definition: mobile.h:293
ip6_address_t sr_prefix
Definition: mobile.h:207
Segment Routing data structures definitions.
struct srv6_end_gtp6_dt_param_s srv6_end_gtp6_dt_param_t
u8 ver_flags
Definition: mobile.h:92
gtpu_header_t gtpu
Definition: mobile.h:158
srv6_end_main_v6_decap_t srv6_end_main_v6_decap
Definition: gtp6_d.c:24
ip6_header_t cache_hdr
Definition: mobile.h:239
vlib_main_t * vlib_main
Definition: mobile.h:290
ip6srv_combo_header_t cache_hdr
Definition: mobile.h:282
#define BITALIGN2(A, B)
Definition: mobile.h:54
struct srv6_t_main_v4_dt_s srv6_t_main_v4_dt_t
srv6_end_main_v6_decap_di_t srv6_end_main_v6_decap_di
Definition: gtp6_d_di.c:24