0ac7322aa06e596a2e9228d1d9d2a54d414ce54c
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 2010-2011
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
53 /**
54 * @ingroup netapi_tune_parameters
55 * @def NETAPI_ENABLE_SECURITY
56 * Define this to enable securtiy.
57 * @note Libraries using netapi need to be built with SA enabled
58 */
59 #define NETAPI_ENABLE_SECURITY
62 /**
63 * @ingroup netapi_tune_parameters
64 * @def NETAPI_USE_DDR
65 * Define this to enable use of cached DDR for buffers and descriptors.
66 * @note Do not define if USE_MSMC defined below
67 */
68 #define NETAPI_USE_DDR
71 #ifdef NETAPI_USE_DDR
72 /**
73 * @ingroup netapi_tune_parameters
74 * @def NETAPI_TUNE_USE_CACHE_OPS
75 * Define this to enable use of cached DDR for buffers and descriptors.
76 * @note Do not define if USE_MSMC defined below
77 */
78 #define NETAPI_TUNE_USE_CACHE_OPS //for appleton, no cache coherency with netcp & ARM
79 #endif
81 /**
82 * @ingroup netapi_tune_parameters
83 * @def NETAPI_USE_MSMC
84 * Define this to enable use of un-cached MSMC for buffers and descriptors
85 * @note Do not define if USE_DDR defined above
86 */
87 //#define NETAPI_USE_MSMC
89 #ifdef NETAPI_USE_MSMC
90 #ifdef NETAPI_USE_DDR
91 #error "only define NETAPO_USE_MSMC or NETAPI_USE_DDR"
92 #endif
93 #endif
95 /**
96 * @ingroup netapi_tune_parameters
97 * @def TUNE_NETAPI_NUM_CORES
98 * This defines the number of cores (theads)
99 */
100 #define TUNE_NETAPI_NUM_CORES 1
102 /**
103 * @ingroup netapi_tune_parameters
104 * @def TUNE_NETAPI_PERM_MEM_SZ
105 * This defines how much contiguous memory to grab. This is used for
106 * descriptors and buffers in the case of uncached configuration only.
107 * descriptors and buffers. Can't be bigger than msmc if
108 * MSMC memory is being using uncached . This can be set at netapi_init via NETAPI_CFG_T
109 */
110 #define TUNE_NETAPI_PERM_MEM_SZ (2*1024*1024)
112 /**
113 * @ingroup netapi_tune_parameters
114 * @def TUNE_NETAPI_MAX_PKTIO
115 * This defines the number of GLOBAL pkt io channels
116 */
117 #define TUNE_NETAPI_MAX_PKTIO 16
119 /**
120 * @ingroup netapi_tune_parameters
121 * @def TUNE_NETAPI_DEFAULT_BUFFER_SIZE
122 * This defines the size of the netapi default pktlib heap buffers This can be set at @ref netapi_init
123 */
124 #define TUNE_NETAPI_DEFAULT_BUFFER_SIZE 1600
127 /**
128 * @ingroup netapi_tune_parameters
129 * @def TUNE_NETAPI_DEFAULT_NUM_BUFFERS
130 * This defines the number of netapi default pktlib heap buffers (and assoc descriptors)
131 * this can be set at @ref netapi_init
132 */
133 #define TUNE_NETAPI_DEFAULT_NUM_BUFFERS 200
135 /**
136 * @ingroup netapi_tune_parameters
137 * @def TUNE_NETAPI_DEFAULT_NUM_SOLO_DESCRIPTORS
138 * This defines the number of netapi default pkt lib heap solo descriptors
139 * this can be set at @ref netapi_init
140 */
141 #define TUNE_NETAPI_DEFAULT_NUM_SOLO_DESCRIPTORS 100
143 /**
144 * @ingroup netapi_tune_parameters
145 * @def NETAPI_INCLUDE_SCHED
146 * Define this to include the scheduler component
147 */
148 #define NETAPI_INCLUDE_SCHED
150 /**
151 * @ingroup netapi_tune_parameters
152 * @def TUNE_NETAPI_QM_CONFIG_MAX_DESC_NUM
153 * This defines the number of of QM descriptors (total). This can be set set in @ref netapi_init
154 * @note Must be a power or 2
155 */
156 #define TUNE_NETAPI_QM_CONFIG_MAX_DESC_NUM 2048 /* 16384 is abs max */
159 /**
160 * @ingroup netapi_tune_parameters
161 * @def TUNE_NETAPI_NUM_LOCAL_DESC
162 * This defines the number of of QM descriptors (total). This can be set set in @ref netapi_init
163 */
164 #define TUNE_NETAPI_NUM_LOCAL_DESC 64
167 /**
168 * @ingroup netapi_tune_parameters
169 * @def TUNE_NETAPI_NUM_GLOBAL_DESC
170 * This defines the number of global descriptors.
171 * @note Must be a power or 2
172 */
173 #define TUNE_NETAPI_NUM_GLOBAL_DESC 1024
175 /**
176 * @ingroup netapi_tune_parameters
177 * @def TUNE_NETAPI_DESC_SIZE
178 * This defines the descriptor size
179 * @note This define should NOT be changes
180 */
181 #define TUNE_NETAPI_DESC_SIZE 128
183 #ifdef NETAPI_USE_DDR
184 /**
185 * @ingroup netapi_tune_parameters
186 * @def TUNE_NETAPI_QM_START_INDEX
187 * This defines the queue manager start index
188 * @note This must reflect what the kernel is uding for their region, see device tree blob for details.
189 */
190 #define TUNE_NETAPI_QM_START_INDEX 0x2000 //WARNING: must reflect what kernel is using for their region, see device tree blob
192 /**
193 * @ingroup netapi_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 uding 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
200 #else //use msmc..
201 /**
202 * @ingroup netapi_tune_parameters
203 * @def TUNE_NETAPI_QM_START_INDEX
204 * This defines the queue manager start index
205 * @note This must reflect what the kernel is uding for their region, see device tree blob for details.
206 */
207 #define TUNE_NETAPI_QM_START_INDEX 0 //ok to use 0 since kernel is somewhere higher
209 /**
210 * @ingroup netapi_tune_parameters
211 * @def TUNE_NETAPI_QM_GLOBAL_REGION
212 * This defines the queue manager global region
213 * @note This must reflect what the kernel is uding for their region, see device tree blob for details.
214 */
215 #define 0 //ok to to use 0 since msmc addr < ddr addr
217 #endif
219 /**
220 * @ingroup netapi_tune_parameters
221 * @def TUNE_NETAPI_NWAL_ENABLE_PASS_LOOPBACK
222 * Define this to 1 for debutg mode where NETCP just loops pkts that tx back to rx
223 */
224 #define TUNE_NETAPI_NWAL_ENABLE_PASS_LOOPBACK 0 /*1*/
227 /// @cond INTERNAL
228 //(10) NWAL (internal) config. Should not have to change
229 #define TUNE_NETAPI_CONFIG_MAX_PA_TO_SA_DESC 32
230 #define TUNE_NETAPI_CONFIG_MAX_SA_TO_PA_DESC 32
231 /// @endcond
233 /**
234 * @ingroup netapi_tune_parameters
235 * @def TUNE_NETAPI_MAX_NUM_MAC
236 * This defines the number of logical mac addresses
237 */
238 #define TUNE_NETAPI_MAX_NUM_MAC 2
240 /**
241 * @ingroup netapi_tune_parameters
242 * @def TUNE_NETAPI_MAX_NUM_IP
243 * This defines the number of ip addresses
244 */
245 #define TUNE_NETAPI_MAX_NUM_IP 32
247 /**
248 * @ingroup netapi_tune_parameters
249 * @def TUNE_NETAPI_MAX_NUM_PORTS_PER_CORE
250 * This defines the number of ports per core
251 */
252 #define TUNE_NETAPI_MAX_NUM_PORTS_PER_CORE 4
254 /**
255 * @ingroup netapi_tune_parameters
256 * @def TUNE_NETAPI_MAX_NUM_PORTS
257 * This defines the number maximum number of ports
258 */
259 #define TUNE_NETAPI_MAX_NUM_PORTS (TUNE_NETAPI_MAX_NUM_PORTS_PER_CORE * (TUNE_NETAPI_NUM_CORES))
261 #ifdef NETAPI_ENABLE_SECURITY
262 /**
263 * @ingroup netapi_tune_parameters
264 * @def TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS
265 * This defines the number maximum number of ipsec channels
266 */
267 #define TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS 32
268 #else
269 /**
270 * @ingroup netapi_tune_parameters
271 * @def TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS
272 * This defines the number maximum number of ipsec channels
273 */
274 #define TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS 0
275 #endif
277 /**
278 * @ingroup netapi_tune_parameters
279 * @def TUNE_NETAPI_MAX_NUM_L2_L3_HDRS
280 * This defines the number maximum number of L2_L3 headers TBD
281 */
282 #define TUNE_NETAPI_MAX_NUM_L2_L3_HDRS 3
284 /**
285 * @ingroup netapi_tune_parameters
286 * @def TUNE_NETAPI_MAX_NUM_TRANS
287 * This defines the number maximum number of trans TBD
288 */
289 #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)
292 /// @cond INTERNAL
293 /* PA control buffer pool (internal) */
294 #define TUNE_NETAPI_CONFIG_MAX_CTL_RXTX_BUF_SIZE 384
295 #define TUNE_NETAPI_CONFIG_NUM_CTL_RX_BUF 16
296 #define TUNE_NETAPI_CONFIG_NUM_CTL_TX_BUF 16
297 /// @endcond
299 /**
300 * @ingroup netapi_tune_parameters
301 * @def TUNE_NETAPI_MAX_BURST_RCV
302 * This defines the maximum number of packets to receive in one pktio poll.
303 */
304 #define TUNE_NETAPI_MAX_BURST_RCV 32
306 /**
307 * @ingroup netapi_tune_parameters
308 * @def TUNE_NETAPI_MAX_IP
309 * This defines the maximum number of IP's that can be attached to MAC interfaces.
310 */
311 #define TUNE_NETAPI_MAX_IP 4
313 /**
314 * @ingroup netapi_tune_parameters
315 * @def TUNE_NETAPI_MAX_INTERFACES
316 * This defines the maximum number of MAX interfaces */
317 #define TUNE_NETAPI_MAX_INTERFACES 2
319 /**
320 * @ingroup netapi_tune_parameters
321 * @def TUNE_NETAPI_NUM_TIMER_CELLS
322 * This defines the number of hash bins in a timer group.
323 */
324 #define TUNE_NETAPI_NUM_TIMER_CELLS 128 //# of hash bins in a timer group
325 /**
326 * @ingroup netapi_tune_parameters
327 * @def TUNE_NETAPI_NUM_GLOBAL_TIMERS
328 * This defines the number of global timer blocks
329 */
330 #define TUNE_NETAPI_NUM_GLOBAL_TIMERS 4 //# global timer blocks
332 /**
333 * @ingroup netapi_tune_parameters
334 * @def TUNE_NETAPI_MAX_HEAPS
335 * This defines the maximum number of heaps
336 */
337 #define TUNE_NETAPI_MAX_HEAPS 4 //max # of heaps one instance can create
339 /**
340 * @ingroup netapi_tune_parameters
341 * @def TUNE_NETAPI_MAX_CLASSIFIERS
342 * This defines the maximum number of classifiers
343 */
344 #define TUNE_NETAPI_MAX_CLASSIFIERS 16
346 /**
347 * @ingroup netapi_tune_parameters
348 * @def TUNE_NETAPI_MAX_BUF_POOLS_IN_FLOW
349 * This defines the maximum number of buffer pools in flow -TBD
350 * @note This define should NOT be changes
351 */
352 #define TUNE_NETAPI_MAX_BUF_POOLS_IN_FLOW 4 //!!do not change!!
355 /**
356 * @ingroup netapi_tune_parameters
357 * @def TUNE_NETAPI_MAX_FLOWS
358 * This defines the maximum number of flows
359 */
360 #define TUNE_NETAPI_MAX_FLOWS 4 //app defined flows
362 /**
363 * @ingroup netapi_tune_parameters
364 * @def TUNE_NETAPI_MAX_SA
365 * This defines the maximum number of security associations
366 */
367 #define TUNE_NETAPI_MAX_SA 8 //rx&tx combined (so MAX_SA/4 tunnels typically)
369 /**
370 * @ingroup netapi_tune_parameters
371 * @def TUNE_NETAPI_MAX_POLICY
372 * This defines the maximum number of security policies.
373 */
374 #define TUNE_NETAPI_MAX_POLICY 8 //rx policies
376 #endif