FD.io VPP  v16.09
Vector Packet Processing
platform_common_override.h
Go to the documentation of this file.
1 /*
2  *---------------------------------------------------------------------------
3  * platform_common_override.h -- Files has actual platform specific defines.
4  * Will only included by platform_common.h
5  *
6  * Copyright (c) 2011-2013 Cisco and/or its affiliates.
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at:
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *---------------------------------------------------------------------------
19  */
20 
21 #ifndef __PLATFORM_COMMON_OVERRIDE_H__
22 #define __PLATFORM_COMMON_OVERRIDE_H__
23 
24 extern unsigned char my_octeon_id;
25 
26 #undef PLATFORM_DBL_SUPPORT
27 #define PLATFORM_DBL_SUPPORT 1 // Destination Based logging support
28  // NAT44 session table required.
29 
30 #undef PLATFORM_ADDR_MASK_PER_CORE
31 /* commenting this. Currently we are considering only single core */
32 //#define PLATFORM_ADDR_MASK_PER_CORE 0x3f // Using 64 cores
33 #define PLATFORM_ADDR_MASK_PER_CORE 0x01
34 
35 #undef MAX_COMBINED_DB_ENTRIES_PER_SCAN
36 #define MAX_COMBINED_DB_ENTRIES_PER_SCAN 128
37 
38 #undef PLATFORM_MAX_CORES
39 #define PLATFORM_MAX_CORES (PLATFORM_ADDR_MASK_PER_CORE + 1)
40 
41 // Roddick does not have any partition of cores
42 #undef PLATFORM_ADDR_MASK_PER_CORE_PER_PARTITION
43 #define PLATFORM_ADDR_MASK_PER_CORE_PER_PARTITION \
44  PLATFORM_ADDR_MASK_PER_CORE
45 
46 #undef PLATFORM_MAX_CORES_PER_PARTITION
47 #define PLATFORM_MAX_CORES_PER_PARTITION PLATFORM_MAX_CORES
48 
49 #undef PLATFORM_CNAT_INSTS
50 //#define PLATFORM_CNAT_INSTS 64
51 #define PLATFORM_CNAT_INSTS 1 /* currently its only single instance */
52 
53 #undef PLATFORM_MAX_NAT_ENTRIES
54 //#define PLATFORM_MAX_NAT_ENTRIES 20000000 // 20M
55 #define PLATFORM_MAX_NAT_ENTRIES 1666660 // ~80M/48 (79999680/48)
56 
57 #undef PLATFORM_MAX_USER_ENTRIES
58 #define PLATFORM_MAX_USER_ENTRIES 20800 // ~1M/48 (998400/48)
59 
60 
61 /* 524288:
62  (20000000 translations) / (64 CNAT INSTANCES) = 312500
63  nearest higher number which is power of 2 next to 312500
64 */
65 #undef PLATFORM_CNAT_MAIN_PRELIM_HASH_SIZE
66 //#define PLATFORM_CNAT_MAIN_PRELIM_HASH_SIZE 524288
67 #define PLATFORM_CNAT_MAIN_PRELIM_HASH_SIZE (5<<20)
68 /* 4096:
69  (200000 users) / (64 CNAT INSTANCES) = 3125
70  nearest higher number which is power of 2 next to 3125
71 */
72 #undef PLATFORM_CNAT_USER_PRELIM_HASH_SIZE
73 #define PLATFORM_CNAT_USER_PRELIM_HASH_SIZE 4096
74 
75 #undef PLATFORM_CNAT_MAX_ADDR_POOL_SIZE
76 #define PLATFORM_CNAT_MAX_ADDR_POOL_SIZE 0x10000 // max /16
77 
78 #undef PLATFORM_MAX_DB_ENTRY_PER_SCAN
79 #define PLATFORM_MAX_DB_ENTRY_PER_SCAN 400
80 
81 #undef PLATFORM_MAX_DB_ENTRY_SELECTED_PER_SCAN
82 #define PLATFORM_MAX_DB_ENTRY_SELECTED_PER_SCAN 100 // 1/4th of above
83 
84 #undef PLATFORM_CNAT_TIMEOUT_IPPROT_MASK
85 #define PLATFORM_CNAT_TIMEOUT_IPPROT_MASK 0xFFFFFFFF0000FFFF
86 
87 #undef PLATFORM_CNAT_TIMEOUT_PORTPROT_MASK
88 #define PLATFORM_CNAT_TIMEOUT_PORTPROT_MASK 0x00000000FFFFFFFF
89 
90 #ifdef TARGET_RODDICK /* EVB doesnt need it */
91 #undef PLATFORM_FILL_DST_ADDR_PORT_TABLE
92 #define PLATFORM_FILL_DST_ADDR_PORT_TABLE fill_dst_addr_port_table();
93 #endif
94 
95 
96 #ifndef RODDICK_ON_LINUX_OR_EVB
97 #undef PLATFORM_SET_CTX_RU_TX_FROM_NODE
98 #undef PLATFORM_SET_CTX_RU_TX_DST_IPPORT_IDX
99 #undef PLATFORM_SET_CTX_RU_TX_PKT_TYPE
100 
101 #define PLATFORM_SET_CTX_RU_TX_FROM_NODE(ctx, value) \
102  (vnet_buffer(ctx))->vcgn_uii.ru.tx.from_node = value;
103 #define PLATFORM_SET_CTX_RU_TX_DST_IPPORT_IDX(ctx, value) \
104  (vnet_buffer(ctx))->vcgn_uii.ru.tx.dst_ip_port_idx = value;
105 #define PLATFORM_SET_CTX_RU_TX_PKT_TYPE(ctx, type) \
106  (vnet_buffer(ctx))->vcgn_uii.ru.tx.packet_type = type;
107 #endif
108 
109 #undef PLATFORM_SET_RX_VRF
110 #undef PLATFORM_SET_TX_VRF
111 #ifdef TARGET_RODDICK
112 #define PLATFORM_SET_RX_VRF(ctx, rx_vrf, hardcode, mask) \
113  rx_vrf = (ctx->ru.rx.uidb_index & CNAT_VRF_MASK);
114 #define PLATFORM_SET_TX_VRF(ctx, tx_vrf) \
115  ctx->ru.tx.uidb_index = tx_vrf;
116 #else /*EVB */
117 #define PLATFORM_SET_RX_VRF(ctx, rx_vrf, hardcode, mask) \
118  rx_vrf = hardcode;
119 #define PLATFORM_SET_TX_VRF(ctx, tx_vrf)
120 #endif
121 
122 #undef PLATFORM_CNAT_SET_RX_VRF
123 #undef PLATFORM_CNAT_SET_TX_VRF
124 
125 #define PLATFORM_CNAT_SET_RX_VRF(if_index, rx_vrf, proto) \
126  rx_vrf = proto | ((if_index) & CNAT_VRF_MASK);
127 
128 #define PLATFORM_CNAT_SET_TX_VRF(if_index, tx_vrf) \
129  (if_index) = ((tx_vrf) & CNAT_VRF_MASK);
130 
131 
132 
133 #undef PLATFORM_NAT64_SET_RX_VRF
134 
135 #ifdef TARGET_RODDICK
136 
137 #define PLATFORM_NAT64_SET_RX_VRF(rx_vrf, proto, inst_id) \
138  rx_vrf = proto | (inst_id & CNAT_VRF_MASK);
139 
140 #else /* EVB */
141 
142 #define PLATFORM_NAT64_SET_RX_VRF(rx_vrf, proto, inst_id) \
143  rx_vrf = proto | inst_id;
144 
145 #endif
146 
147 #ifdef TARGET_EVB
148 #define VRF_MAP_CONFIG
149 #endif
150 
151 #undef PLATFORM_PRINT_TESTING_PG
152 #if defined(TARGET_LINUX_UDVR) || defined(CNAT_PG)
153 #define PLATFORM_PRINT_TESTING_PG() printf("testing pg\n");
154 #else
155 #define PLATFORM_PRINT_TESTING_PG()
156 #endif
157 
158 #ifdef TARGET_RODDICK
159 #undef PLATFORM_INIT_TEMP_SENSORS
160 #undef PLATFORM_READ_CPU_SENSORS
161 #undef PLATFORM_SET_TEMP_READ_BLOCK
162 
163 #define PLATFORM_INIT_TEMP_SENSORS() Init_temperature_sensors();
164 #define PLATFORM_READ_CPU_SENSORS(value) read_octeon_sensors(value);
165 #define PLATFORM_SET_TEMP_READ_BLOCK(var, val) var = &val->param[0];
166 #endif
167 
168 #undef PLATFORM_HANDLE_ICMP_TTL_EXPIRED
169 #define PLATFORM_HANDLE_ICMP_TTL_EXPIRED 1 // handle TTL in NAT44 Application (for AVSM)
170 
171 #undef PLATFORM_NFV9_DISP_NODE_IDX
172 #ifdef TARGET_RODDICK
173 #define PLATFORM_NFV9_DISP_NODE_IDX "roddick_infra_l3_tx"
174 #else /* EVB */
175 #define PLATFORM_NFV9_DISP_NODE_IDX "cnat_rewrite_output"
176 #endif
177 
178 #undef PLATFORM_CNAT_DB_DUMP_POLICY_PRINT
179 #define PLATFORM_CNAT_DB_DUMP_POLICY_PRINT() \
180  printf("my instance:%d\n" \
181  "icmp timeout %d udp init timeout %d act timeout %d\n" \
182  "tcp init timeout %d act timeout %d mapping refresh %d\n" \
183  "port limit per user %d ftp alg %d lb debug %d\n" \
184  "icmp rate limit 0x%x config delete timer 0x%x\n" \
185  "global debug flag 0x%x\n" \
186  "icmp rate limit (pkts/per sec) %d\n" \
187  "dynamic port range start %d\n" \
188  "debug ivrf 0x%x flag 0x%x start_addr 0x%x end_addr 0x%x\n" \
189  "debug ovrf 0x%x flag 0x%x start_addr 0x%x end_addr 0x%x\n", \
190  my_instance_number, \
191  icmp_session_timeout, udp_init_session_timeout, udp_act_session_timeout, \
192  tcp_initial_setup_timeout, tcp_active_timeout, \
193  mapping_refresh_both_direction, cnat_main_db_max_ports_per_user, \
194  ftp_alg_enabled, lb_debug_enable, per_user_icmp_msg_limit, \
195  config_delete_timeout, \
196  global_debug_flag, \
197  cnat_main_db_icmp_rate_limit, \
198  cnat_static_port_range, \
199  debug_i_vrf, debug_i_flag, debug_i_addr_start, debug_i_addr_end, \
200  debug_o_vrf, debug_o_flag, debug_o_addr_start, debug_o_addr_end);
201 
202 
203 #undef PLATFORM_PRINT_CTX_VALUES
204 #ifdef TARGET_RODDICK
205 #define PLATFORM_PRINT_CTX_VALUES(ctx) \
206  printf("\nAFTER: %s cur_hdr %p, uidb %d, pkt_type %d, cur_len %d\n", \
207  type_str, \
208  ctx->current_header, \
209  ctx->ru.tx.uidb_index, \
210  ctx->ru.tx.packet_type, \
211  ctx->current_length);
212 #else /* EVB */
213 #define PLATFORM_PRINT_CTX_VALUES(ctx) \
214  printf("\nAFTER: %s cur_hdr %p, cur_len %d\n", \
215  type_str,\
216  ctx->current_header, \
217  ctx->current_length);
218 #endif
219 
220 #undef PLATFORM_ADD_VRF_MAP_HANDLE_PARTITION
221 #define PLATFORM_ADD_VRF_MAP_HANDLE_PARTITION(uidb_index, partition_id)
222 
223 #undef PLATFORM_DEL_VRF_MAP_HANDLE_PARTITION
224 #define PLATFORM_DEL_VRF_MAP_HANDLE_PARTITION(uidb_index, partition_id)
225 
226 #undef PLATFORM_ALLOC_NFV9_PKT_BUFFER
227 #define PLATFORM_ALLOC_NFV9_PKT_BUFFER(ctx, to_lc_cpu)
228 
229 #undef PLATFORM_CNAT_NFV9_SHIM_HDR_OFFSET
230 #ifdef TARGET_RODDICK
231 // This corresponds to the length of the IMETRO SHIM Header for RODDICK
232 #define PLATFORM_CNAT_NFV9_SHIM_HDR_OFFSET 8
233 #else
234 #define PLATFORM_CNAT_NFV9_SHIM_HDR_OFFSET 0
235 #endif
236 
237 #undef PLATFORM_CNAT_NFV9_L2_ENCAPS_OFFSET
238 #ifdef TARGET_RODDICK
239 #define PLATFORM_CNAT_NFV9_L2_ENCAPS_OFFSET 0
240 #else
241 #define PLATFORM_CNAT_NFV9_L2_ENCAPS_OFFSET 16
242 #endif
243 
244 #undef PLATFORM_MAX_SHOW_BUFFER_SIZE
245 #undef PLATFORM_MAX_TRANSLATION_ENTRIES
246 #undef PLATFORM_MAX_UTIL_ENTRIES
247 
248 #define PLATFORM_MAX_SHOW_BUFFER_SIZE 1700
249 #define PLATFORM_MAX_TRANSLATION_ENTRIES (50)
250 #define PLATFORM_NAT64_MAX_TRANSLATION_ENTRIES (30)
251 #define PLATFORM_MAX_UTIL_ENTRIES (100)
252 
253 
254 #undef PLATFORM_NAT64_MAX_SESSIONS
255 #undef PLATFORM_NAT64_TIMEOUT_HASH_SIZE
256 #define PLATFORM_NAT64_MAX_SESSIONS 20000000
257 #define PLATFORM_NAT64_TIMEOUT_HASH_SIZE 24001 /* Ref: CSCtr36242 */
258 
259 #undef PLATFORM_CHECK_DSLITE_ENABLE_FLAG
260 #define PLATFORM_CHECK_DSLITE_ENABLE_FLAG 1
261 
262 /* Fragment hold limit is Platform specific */
263 /* For Roddick, it is 63 due to hardware limitation */
264 #undef PLATFORM_IPV4_FRAG_FRAG_HOLD_LIMIT
265 #define PLATFORM_IPV4_FRAG_FRAG_HOLD_LIMIT 63
266 
267 #undef PLATFORM_MAX_IPV4_CTX_ENTRIES
268 #define PLATFORM_MAX_IPV4_CTX_ENTRIES 80
269 
270 #undef PLATFORM_DIRN_IN_TO_OUT
271 #undef PLATFORM_DIRN_OUT_TO_IN
272 #undef PLATFORM_SET_SVI_PARAMS_FIELD
273 
274 #define PLATFORM_DIRN_IN_TO_OUT
275 #define PLATFORM_DIRN_OUT_TO_IN
276 #define PLATFORM_SET_SVI_PARAMS_FIELD(var, value)
277 
278 #undef PLATFORM_GET_NFV9_L3_HDR_OFFSET
279 #define PLATFORM_GET_NFV9_L3_HDR_OFFSET \
280  ((u8 *)ctx + ctx->data + CNAT_NFV9_IP_HDR_OFFSET);
281 
282 #undef PLATFORM_GET_NFV9_L4_HDR_OFFSET
283 #define PLATFORM_GET_NFV9_L4_HDR_OFFSET \
284  ((u8 *) ctx + ctx->data + CNAT_NFV9_UDP_HDR_OFFSET);
285 
286 #undef PLATFORM_MEMSET_CNAT_LOG_PKT_DATA
287 #define PLATFORM_MEMSET_CNAT_LOG_PKT_DATA
288 
289 /*
290  Index 0 -- SE_P2MP
291  Index 1 -- HA Destination 1
292  Index 2 -- HA Destination 2
293  Index 3 -- EXT_LOG_SRVR
294 */
295 enum {
302 };
303 
304 #endif /* __PLATFORM_COMMON_OVERRIDE_H__ */
unsigned char my_octeon_id