FD.io VPP  v17.01-9-ge7dcee4
Vector Packet Processing
dslite_defs.h
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * dslite_defs.h - DSLITE structure definiitions
4  *
5  * Copyright (c) 2011-2012 Cisco and/or its affiliates.
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at:
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *------------------------------------------------------------------
18  */
19 
20 #ifndef __DSLITE_DEFS_H__
21 #define __DSLITE_DEFS_H__
22 
23 #ifdef TOBE_PORTED
24 #include "spp_platform_common.h"
25 #include "cgse_defs.h"
26 #endif
27 #include "cnat_cli.h"
28 #include "cnat_config.h"
29 #include "cnat_ports.h"
30 #include "cnat_bulk_port_defs.h"
31 
33 
34 #define SWAP_IPV6_ADDR(ipv6_hdr, dslite_entry_ptr) \
35  ipv6_hdr->dst_addr[0] = ipv6_hdr->src_addr[0]; \
36  ipv6_hdr->dst_addr[1] = ipv6_hdr->src_addr[1]; \
37  ipv6_hdr->dst_addr[2] = ipv6_hdr->src_addr[2]; \
38  ipv6_hdr->dst_addr[3] = ipv6_hdr->src_addr[3]; \
39  ipv6_hdr->src_addr[0] = spp_host_to_net_byte_order_32(dslite_entry_ptr->AFTR_v6_address[0]); \
40  ipv6_hdr->src_addr[1] = spp_host_to_net_byte_order_32(dslite_entry_ptr->AFTR_v6_address[1]); \
41  ipv6_hdr->src_addr[2] = spp_host_to_net_byte_order_32(dslite_entry_ptr->AFTR_v6_address[2]); \
42  ipv6_hdr->src_addr[3] = spp_host_to_net_byte_order_32(dslite_entry_ptr->AFTR_v6_address[3]);
43 
44 #define DSLITE_SET_TX_PKT_TYPE(type) { \
45  ctx->ru.tx.packet_type = type; \
46 }
47 
48 #define DSLITE_INC_STATS_V4(PTR, COUNTER, IPV4_SRC_ADDR) { \
49  PTR->COUNTER++; \
50 }
51 
52 #define DSLITE_INC_STATS_V6(PTR, COUNTER, IPV6_DEST_ADDR) { \
53  PTR->COUNTER++; \
54 }
55 
56 
57 #define DSLITE_INVALID_UIDX 0xffff /*invalid svi app uidb index */
58 #define DSLITE_INVALID_VRFID 0xffffffff /*invalid vrf id */
59 
60 #define DSLITE_VRF_MASK 0x3fff
61 #define DSLITE_MAX_VRFMAP_ENTRIES (DSLITE_VRF_MASK + 1)
62 
63 #define DSLITE_VRFMAP_ENTRY_INVALID 0xffff
64 
65 #define DSLITE_V6_PREFIX_MASK_MIN 16
66 #define DSLITE_V6_PREFIX_MASK_MAX 96
67 #define DSLITE_V6_PREFIX_MASK_MULTIPLE 8
68 
69 #define DSLITE_TUNNEL_MTU_MIN 1280
70 #define DSLITE_TUNNEL_MTU_MAX 9216
71 
72 #define DSLITE_TUNNEL_TTL_MIN 0
73 #define DSLITE_TUNNEL_TTL_MAX 255
74 
75 #define DSLITE_TUNNEL_TOS_MIN 0
76 #define DSLITE_TUNNEL_TOS_MAX 255
77 
78 #define DSLITE_V4_MASK_MAX 32
79 
80 //#define XLAT_MAX_FRAG_ID_COUNTERS (256)
81 #define DSLITE_AFTR_IPV4_ADDR 0xC0000001
82 
83 #define DSLITE_MAX_TAP_RG_ENTRIES 2
84 #define DSLITE_MAX_DSLITE_ENTRIES (256)
85 #define DSLITE_MAX_DSLITE_ID (DSLITE_MAX_DSLITE_ENTRIES-1)
86 /* Define the below value as 64 if first 64 entries are for NAT44 */
87 #define DSLITE_INDEX_OFFSET 1
88 
89 #define DSLITE_INVALID_DSLITE_ID (0)
90 
91 #define DSLITE_TABLE_ENTRY_DELETED 0
92 #define DSLITE_TABLE_ENTRY_ACTIVE 1
93 #define DSLITE_TABLE_ENTRY_DORMANT 2
94 #define DSLITE_TABLE_ENTRY_INVALID_UIDB 3
95 
96 typedef struct {
104 
105 
106 typedef struct {
107 
108  u16 state; /* To use nat44 enums ?? TBD */
109  u16 dslite_id; /* DSLITE_ID value for this table entry - for easy access */
110 
111  u16 i_vrf; /* V6 uidb index */
112  u16 o_vrf; /* V4 uidb index */
113 
115  u16 tcp_mss; /*tcp max segment size for this inside vrf */
116 
118 
120 
123  u32 AFTR_v6_address[4];
124 
125 #define DSLITE_IPV4_TOS_OVERRIDE_FLAG 0x00000001
126 #define DSLITE_IPV6_TOS_OVERRIDE_FLAG 0x00000002
127 #define DSLITE_IPV4_TTL_OVERRIDE_FLAG 0x00000004
128 #define DSLITE_IPV6_TTL_OVERRIDE_FLAG 0x00000008
129 #define DSLITE_IPV6_FRAG_REASSEMB_ENG 0x00000010
130 #define DSLITE_FTP_ALG_ENABLE 0x00000020
131 #define DSLITE_RTSP_ALG_ENABLE 0x00000040
132 #define DSLITE_NETFLOW_ENABLE 0x00000080
133 #define DSLITE_SYSLOG_ENABLE 0x00000100
134 
137 
142 
143  u32 v4_if_num; /* V4 SVI ifnum */
144  u32 v6_if_num; /* V6 SVI ifnum */
145  u32 i_vrf_id; //inside vrf id
146  u32 o_vrf_id; //outside vrf id
147 
151 
153  bulk_alloc_size_t bulk_size; /* should be equivalent to u16 - 2 bytes */
159 #define DSLITE_BIDIR_REFRESH 1
160  u8 dslite_enable; /* DS-Lite enable check flag */
161  u8 syslog_logging_policy; /* DS-Lite Session Logging check flag */
163 
169 
170 typedef struct {
175 
176 typedef struct {
179  u32 ipv6_addr[4];
181 
183 
184 
185 #define DSLITE_ADD_UIDB_INDEX_DSLITE_ID_MAPPING(uidb_index, dslite_id) \
186  *(cgse_uidb_index_cgse_id_mapping_ptr + uidb_index) = dslite_id;
187 
188 extern u8 my_instance_number;
189 
190 extern void dslite_clear_counters(u16 dslite_id);
191 extern void dslite_clear_per_RG_counters();
196 extern u32 dslite_debug_level;
197 
198 typedef struct {
203 
204 typedef struct {
209 
210 typedef struct {
215 
216 typedef struct {
221 
222 typedef struct {
227 
228 typedef struct {
233 
234 typedef struct {
239 
240 typedef struct {
245 
246 typedef struct {
254 
255 typedef struct {
266 
267 typedef struct {
274 
275 typedef struct {
276 
289 
290 typedef struct {
305 
306 typedef struct {
309  u8 pad[5];
312 
313 
314 #define CMD_GENERATE_PTB 0x1
315 #define CMD_GENERATE_TTL 0x2
316 
317 /*
318  * This structure is to provide abstraction for data exchanged from one
319  * VPP node to its disposition or further in the dslite node graph.
320  */
321 typedef struct {
322  u32 icmp_gen_type; // ctx->feature_data[0]
323  u32 reserved1; // ctx->feature_data[1]
324  u32 reserved2; // ctx->feature_data[2]
325  u32 reserved3; // ctx->feature_data[3]
327 
328 extern dslite_counters_t dslite_all_counters[DSLITE_MAX_DSLITE_ENTRIES];
329 //extern dslite_inst_gen_counter_t dslite_inst_gen_counters[DSLITE_MAX_DSLITE_ENTRIES];
330 
331 
332  extern void dslite_show_config(void);
333 #define STAT_PORT_RANGE_FROM_INST_PTR(inst) ((inst)->cnat_static_port_range)
334 
335 #endif /* __DSLITE_DEFS_H__ */
336 
u16 temp2
Definition: dslite_defs.h:165
u8 ipv4_ttl_value
Definition: dslite_defs.h:138
u8 pad[3]
log2 (size of the packing page block)
Definition: bihash_doc.h:61
dslite_v6_to_v4_icmp_qry_counter_t v64_icmp_counters
Definition: dslite_defs.h:281
u32 in2out_drops_port_limit_exceeded
Definition: dslite_defs.h:296
u16 state
Definition: dslite_defs.h:108
u32 v4_if_num
Definition: dslite_defs.h:143
u16 cnat_main_db_max_ports_per_user
Definition: dslite_defs.h:114
u16 dyn_start_port
Definition: dslite_defs.h:150
u32 v6_if_num
Definition: dslite_defs.h:144
u8 nf_logging_policy
Definition: dslite_defs.h:162
u32 i_vrf_id
Definition: dslite_defs.h:145
dslite_v6_to_v4_udp_counter_t v64_udp_counters
Definition: dslite_defs.h:279
dslite_v4_to_v6_udp_counter_t v46_udp_counters
Definition: dslite_defs.h:280
u16 tcp_mss
Definition: dslite_defs.h:115
dslite_global_counters_t dslite_global_counters
dslite_table_entry_t * dslite_table_db_ptr
Definition: cnat_global.c:52
bulk_alloc_size_t bulk_size
Definition: dslite_defs.h:153
Definition: dslite_defs.h:106
u32 pcp_server_addr
Definition: dslite_defs.h:154
void dslite_clear_counters(u16 dslite_id)
u8 ipv4_tos_value
Definition: dslite_defs.h:140
u16 pcp_server_port
Definition: dslite_defs.h:155
u16 cnat_static_port_range
Definition: dslite_defs.h:149
unsigned long u64
Definition: types.h:89
u32 temp3
Definition: dslite_defs.h:166
u32 dslite_debug_level
Definition: cnat_global.c:50
u16 i_vrf
Definition: dslite_defs.h:111
u16 o_vrf
Definition: dslite_defs.h:112
dslite_v6_icmp_error_counter_t dslite_v6_icmp_err_counters
Definition: dslite_defs.h:285
dslite_v4_to_v6_icmp_qry_counter_t v46_icmp_counters
Definition: dslite_defs.h:282
u32 nfv9_logging_index
Definition: dslite_defs.h:121
dslite_v4_to_v6_icmp_error_counter_t v46_icmp_error_counters
Definition: dslite_defs.h:284
u16 rtsp_port
Definition: dslite_defs.h:158
u8 ipv6_ttl_value
Definition: dslite_defs.h:139
dslite_v6_to_v4_tcp_counter_t v64_tcp_counters
Definition: dslite_defs.h:277
cnat_portmap_v2_t * portmap_list
Definition: dslite_defs.h:119
u8 temp1
Definition: dslite_defs.h:164
u8 my_instance_number
Definition: cnat_ports.c:51
u8 syslog_logging_policy
Definition: dslite_defs.h:161
u32 dslite_data_path_debug_level
Definition: cnat_global.c:48
u32 dslite_defrag_debug_level
Definition: cnat_global.c:49
unsigned int u32
Definition: types.h:88
void dslite_clear_per_RG_counters()
u32 in2out_drops_system_limit_reached
Definition: dslite_defs.h:297
u8 pad
Definition: dslite_defs.h:157
u32 o_vrf_id
Definition: dslite_defs.h:146
dslite_v6_to_v4_icmp_error_counter_t v64_icmp_error_counters
Definition: dslite_defs.h:283
u32 dslite_config_debug_level
Definition: cnat_global.c:47
u32 AFTR_v4_addr
Definition: dslite_defs.h:152
#define DSLITE_MAX_DSLITE_ENTRIES
Definition: dslite_defs.h:84
unsigned short u16
Definition: types.h:57
u32 ds_lite_config_debug_level
dslite_v4_to_v6_tcp_counter_t v46_tcp_counters
Definition: dslite_defs.h:278
unsigned char u8
Definition: types.h:56
dslite_icmp_gen_counter_t dslite_icmp_gen_counters
Definition: dslite_defs.h:286
bulk_alloc_size_t
u32 rseed_ip
Definition: dslite_defs.h:167
u32 delete_time
Definition: dslite_defs.h:117
dslite_timeout_info_t timeout_info
Definition: dslite_defs.h:148
u8 dslite_enable
Definition: dslite_defs.h:160
void dslite_show_config(void)
u16 dslite_id
Definition: dslite_defs.h:109
u8 mapping_refresh_both_direction
Definition: dslite_defs.h:156
u16 tunnel_mtu
Definition: dslite_defs.h:136
u32 syslog_logging_index
Definition: dslite_defs.h:122
dslite_common_counter_t dslite_common_counters
Definition: dslite_defs.h:287
u16 feature_flags
Definition: dslite_defs.h:135
u8 ipv6_tos_value
Definition: dslite_defs.h:141