1 /******************************************************************************
2 * FILE PURPOSE: netapi tunable parameters (compile time)
3 ******************************************************************************
4 * FILE NAME: netapi_tune.h
5 *
6 * DESCRIPTION:Tuneable (compile time) parameters for user space transport library
7 *
8 * REVISION HISTORY:
9 *
10 * Copyright (c) Texas Instruments Incorporated 2013
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 *
16 * Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 *
19 * Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the
22 * distribution.
23 *
24 * Neither the name of Texas Instruments Incorporated nor the names of
25 * its contributors may be used to endorse or promote products derived
26 * from this software without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 *
40 */
41 /* ============================================================= */
43 /**
44 * @file netapi_tune.h
45 * @brief Netapi Tuneable (compile time) parameters for user space transport library
46 */
49 #ifndef __NETAPI_TUNE__H
50 #define __NETAPI_TUNE__H
52 /**
53 * @ingroup tune_parameters
54 * @def NETAPI_ENABLE_SECURITY
55 * Define this to enable securtiy.
56 * @note Libraries using netapi need to be built with SA enabled
57 */
58 #define NETAPI_ENABLE_SECURITY
61 /**
62 * @ingroup tune_parameters
63 * @def NETAPI_USE_DDR
64 * Define this to enable use of cached DDR for buffers and descriptors.
65 * @note Do not define if USE_MSMC defined below
66 */
67 #define NETAPI_USE_DDR
70 #ifdef NETAPI_USE_DDR
71 /**
72 * @ingroup tune_parameters
73 * @def NETAPI_TUNE_USE_CACHE_OPS
74 * Define this to enable use of cached DDR for buffers and descriptors.
75 * @note Do not define if USE_MSMC defined below
76 */
77 #define NETAPI_TUNE_USE_CACHE_OPS //for appleton, no cache coherency with netcp & ARM
78 #endif
80 /**
81 * @ingroup tune_parameters
82 * @def NETAPI_USE_MSMC
83 * Define this to enable use of un-cached MSMC for buffers and descriptors
84 * @note Do not define if USE_DDR defined above
85 */
86 //#define NETAPI_USE_MSMC
88 #ifdef NETAPI_USE_MSMC
89 #ifdef NETAPI_USE_DDR
90 #error "only define NETAPO_USE_MSMC or NETAPI_USE_DDR"
91 #endif
92 #endif
94 /**
95 * @ingroup tune_parameters
96 * @def TUNE_NETAPI_NUM_CORES
97 * This defines the number of cores (theads)
98 */
99 #define TUNE_NETAPI_NUM_CORES 5
101 /**
102 * @ingroup tune_parameters
103 * @def TUNE_NETAPI_PERM_MEM_SZ
104 * This defines how much contiguous memory to grab. This is used for
105 * descriptors and buffers in the case of uncached configuration only.
106 * descriptors and buffers. Can't be bigger than msmc if
107 * MSMC memory is being using uncached . This can be set at netapi_init via NETAPI_CFG_T
108 */
109 #define TUNE_NETAPI_PERM_MEM_SZ (2*1024*1024)
111 /**
112 * @ingroup tune_parameters
113 * @def TUNE_NETAPI_MAX_PKTIO
114 * This defines the number of GLOBAL pkt io channels
115 */
116 #define TUNE_NETAPI_MAX_PKTIO 16
118 /**
119 * @ingroup tune_parameters
120 * @def TUNE_NETAPI_DEFAULT_BUFFER_SIZE
121 * This defines the size of the netapi default pktlib heap buffers This can be set at @ref netapi_init
122 */
123 #define TUNE_NETAPI_DEFAULT_BUFFER_SIZE 1600
126 /**
127 * @ingroup tune_parameters
128 * @def TUNE_NETAPI_DEFAULT_NUM_BUFFERS
129 * This defines the number of netapi default pktlib heap buffers (and assoc descriptors)
130 * this can be set at @ref netapi_init
131 */
132 #define TUNE_NETAPI_DEFAULT_NUM_BUFFERS 200
134 /**
135 * @ingroup tune_parameters
136 * @def TUNE_NETAPI_DEFAULT_NUM_SOLO_DESCRIPTORS
137 * This defines the number of netapi default pkt lib heap solo descriptors
138 * this can be set at @ref netapi_init
139 */
140 #define TUNE_NETAPI_DEFAULT_NUM_SOLO_DESCRIPTORS 100
142 /**
143 * @ingroup tune_parameters
144 * @def NETAPI_INCLUDE_SCHED
145 * Define this to include the scheduler component
146 */
147 #define NETAPI_INCLUDE_SCHED
149 /**
150 * @ingroup tune_parameters
151 * @def TUNE_NETAPI_QM_CONFIG_MAX_DESC_NUM
152 * This defines the number of of QM descriptors (total). This can be set set in @ref netapi_init
153 * @note Must be a power or 2
154 */
155 #define TUNE_NETAPI_QM_CONFIG_MAX_DESC_NUM 2048 /* 16384 is abs max */
158 /**
159 * @ingroup tune_parameters
160 * @def TUNE_NETAPI_NUM_LOCAL_DESC
161 * This defines the number of of QM descriptors (total). This can be set set in @ref netapi_init
162 */
163 #define TUNE_NETAPI_NUM_LOCAL_DESC 64
166 /**
167 * @ingroup tune_parameters
168 * @def TUNE_NETAPI_NUM_GLOBAL_DESC
169 * This defines the number of global descriptors.
170 * @note Must be a power or 2
171 */
172 #define TUNE_NETAPI_NUM_GLOBAL_DESC 1024
174 /**
175 * @ingroup tune_parameters
176 * @def TUNE_NETAPI_DESC_SIZE
177 * This defines the descriptor size
178 * @note This define should NOT be changes
179 */
180 #define TUNE_NETAPI_DESC_SIZE 128
182 #ifdef NETAPI_USE_DDR
183 /**
184 * @ingroup tune_parameters
185 * @def TUNE_NETAPI_QM_START_INDEX
186 * This defines the queue manager start index
187 * @note This must reflect what the kernel is uding for their region, see device tree blob for details.
188 */
189 #define TUNE_NETAPI_QM_START_INDEX 0x2000 //WARNING: must reflect what kernel is using for their region, see device tree blob
191 //#define TUNE_NETAPI_QM_START_INDEX 0
192 /**
193 * @ingroup tune_parameters
194 * @def TUNE_NETAPI_QM_GLOBAL_REGION
195 * This defines the queue manager global region
196 * @note This must reflect what the kernel is using for their region, see device tree blob for details.
197 */
198 #define TUNE_NETAPI_QM_GLOBAL_REGION 18 //WARNING: must reflect what kernel is using for their region, see device tree blob
199 //#define TUNE_NETAPI_QM_GLOBAL_REGION 0 //WARNING: must reflect what kernel is using for their region, see device tree blob
201 #else //use msmc..
202 /**
203 * @ingroup tune_parameters
204 * @def TUNE_NETAPI_QM_START_INDEX
205 * This defines the queue manager start index
206 * @note This must reflect what the kernel is uding for their region, see device tree blob for details.
207 */
208 #define TUNE_NETAPI_QM_START_INDEX 0 //ok to use 0 since kernel is somewhere higher
210 /**
211 * @ingroup tune_parameters
212 * @def TUNE_NETAPI_QM_GLOBAL_REGION
213 * This defines the queue manager global region
214 * @note This must reflect what the kernel is uding for their region, see device tree blob for details.
215 */
216 #define TUNE_NETAPI_QM_GLOBAL_REGION 0 //ok to use 0 since msmc addr < ddr addr
218 #endif
220 /**
221 * @ingroup tune_parameters
222 * @def TUNE_NETAPI_NWAL_ENABLE_PASS_LOOPBACK
223 * Define this to 1 for debutg mode where NETCP just loops pkts that tx back to rx
224 */
225 #define TUNE_NETAPI_NWAL_ENABLE_PASS_LOOPBACK 0 /*1*/
228 /// @cond INTERNAL
229 //(10) NWAL (internal) config. Should not have to change
230 #define TUNE_NETAPI_CONFIG_MAX_PA_TO_SA_DESC 32
231 #define TUNE_NETAPI_CONFIG_MAX_SA_TO_PA_DESC 200
232 /// @endcond
234 /**
235 * @ingroup tune_parameters
236 * @def TUNE_NETAPI_MAX_NUM_MAC
237 * This defines the number of logical mac addresses
238 */
239 #define TUNE_NETAPI_MAX_NUM_MAC 64
241 /**
242 * @ingroup tune_parameters
243 * @def TUNE_NETAPI_MAX_NUM_IP
244 * This defines the number of ip addresses
245 */
246 #define TUNE_NETAPI_MAX_NUM_IP 64
248 /**
249 * @ingroup tune_parameters
250 * @def TUNE_NETAPI_MAX_NUM_PORTS_PER_CORE
251 * This defines the number of ports per core
252 */
253 #define TUNE_NETAPI_MAX_NUM_PORTS_PER_CORE 4
255 /**
256 * @ingroup tune_parameters
257 * @def TUNE_NETAPI_MAX_NUM_PORTS
258 * This defines the number maximum number of ports
259 */
260 #define TUNE_NETAPI_MAX_NUM_PORTS (TUNE_NETAPI_MAX_NUM_PORTS_PER_CORE * (TUNE_NETAPI_NUM_CORES))
262 #ifdef NETAPI_ENABLE_SECURITY
263 /**
264 * @ingroup tune_parameters
265 * @def TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS
266 * This defines the number maximum number of ipsec channels
267 */
268 #define TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS 128
269 #else
270 /**
271 * @ingroup tune_parameters
272 * @def TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS
273 * This defines the number maximum number of ipsec channels
274 */
275 #define TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS 0
276 #endif
278 /**
279 * @ingroup tune_parameters
280 * @def TUNE_NETAPI_MAX_NUM_L2_L3_HDRS
281 * This defines the number maximum number of L2_L3 headers to reserve in the nwal layer. This should be kept small as transport lib does not expose this inwal feature by default
282 */
283 #define TUNE_NETAPI_MAX_NUM_L2_L3_HDRS 3
285 /**
286 * @ingroup tune_parameters
287 * @def TUNE_NETAPI_MAX_NUM_TRANS
288 * This defines the number maximum number of transactions with NETCP that can be outstanding at any one time
289 */
290 #define TUNE_NETAPI_MAX_NUM_TRANS (TUNE_NETAPI_MAX_NUM_MAC + TUNE_NETAPI_MAX_NUM_IP + TUNE_NETAPI_MAX_NUM_PORTS + TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS)
293 /// @cond INTERNAL
294 /* PA control buffer pool (internal) */
295 #define TUNE_NETAPI_CONFIG_MAX_CTL_RXTX_BUF_SIZE 520
296 #define TUNE_NETAPI_CONFIG_NUM_CTL_RX_BUF 16
297 #define TUNE_NETAPI_CONFIG_NUM_CTL_TX_BUF 16
298 /// @endcond
300 /**
301 * @ingroup tune_parameters
302 * @def TUNE_NETAPI_MAX_BURST_RCV
303 * This defines the maximum number of packets to receive in one pktio poll.
304 */
305 #define TUNE_NETAPI_MAX_BURST_RCV 32
307 /**
308 * @ingroup tune_parameters
309 * @def TUNE_NETAPI_NUM_TIMER_CELLS
310 * This defines the number of hash bins in a timer group.
311 */
312 #define TUNE_NETAPI_NUM_TIMER_CELLS 128
313 /**
314 * @ingroup tune_parameters
315 * @def TUNE_NETAPI_NUM_GLOBAL_TIMERS
316 * This defines the number of global timer blocks
317 */
318 #define TUNE_NETAPI_NUM_GLOBAL_TIMERS 4
320 /**
321 * @ingroup tune_parameters
322 * @def TUNE_NETAPI_MAX_HEAPS
323 * This defines the maximum number of heaps one NETAPI instance can create
324 */
325 #define TUNE_NETAPI_MAX_HEAPS 4
327 /**
328 * @ingroup tune_parameters
329 * @def TUNE_NETAPI_MAX_CLASSIFIERS
330 * This defines the maximum number of classifiers
331 */
332 #define TUNE_NETAPI_MAX_CLASSIFIERS 16
334 /**
335 * @ingroup tune_parameters
336 * @def TUNE_NETAPI_MAX_BUF_POOLS_IN_FLOW
337 * This defines the maximum number of buffer pools in a flow - A flow is used by hardware
338 * when it needs a buffer for a receive packet. This define allows the maximum number
339 * of pools (free descriptor queues) to be defined for a flow, so that different sized packets
340 * can be allocated from different memory areas.
341 * @note This define should NOT be changed as HW assumes at most 4 now
342 */
343 #define TUNE_NETAPI_MAX_BUF_POOLS_IN_FLOW 4
346 /**
347 * @ingroup tune_parameters
348 * @def TUNE_NETAPI_MAX_FLOWS
349 * This defines the maximum number of flows
350 */
351 #define TUNE_NETAPI_MAX_FLOWS 4 //app defined flows
353 /**
354 * @ingroup tune_parameters
355 * @def TUNE_NETAPI_MAX_SA
356 * This defines the maximum number of security associations
357 */
358 #define TUNE_NETAPI_MAX_SA 128 //rx&tx combined (so MAX_SA/4 tunnels typically)
360 /**
361 * @ingroup tune_parameters
362 * @def TUNE_NETAPI_MAX_POLICY
363 * This defines the maximum number of security policies.
364 */
365 #define TUNE_NETAPI_MAX_POLICY 128 //rx policies
367 #endif