]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/netapi.git/blob - ti/runtime/netapi/netapi_tune.h
SDOCM00115593: Re-size max control rx/tx buf size to sync with latest PA LLD
[keystone-rtos/netapi.git] / ti / runtime / netapi / netapi_tune.h
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 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 /**
56  * @ingroup tune_parameters
57  * @def NETAPI_ENABLE_SECURITY
58  *      Define this to enable securtiy.
59  * @note Libraries using netapi need to be built with SA enabled
60 */
61 #define NETAPI_ENABLE_SECURITY 
64 /**
65  * @ingroup tune_parameters
66  * @def NETAPI_USE_DDR
67  *      Define this to enable use of cached DDR for buffers and descriptors. 
68  * @note Do not define if USE_MSMC defined below
69 */
70 #define NETAPI_USE_DDR
73 #ifdef NETAPI_USE_DDR
74 /**
75  * @ingroup tune_parameters
76  * @def NETAPI_TUNE_USE_CACHE_OPS
77  *      Define this to enable use of cached DDR for buffers and descriptors. 
78  * @note Do not define if USE_MSMC defined below
79 */
80 #define NETAPI_TUNE_USE_CACHE_OPS   //for appleton, no cache coherency with netcp & ARM 
81 #endif
83 /**
84  * @ingroup tune_parameters
85  * @def NETAPI_USE_MSMC
86  *      Define this to enable use of un-cached MSMC for buffers and descriptors 
87  * @note Do not define if USE_DDR defined above 
88 */
89 //#define NETAPI_USE_MSMC
91 #ifdef NETAPI_USE_MSMC
92 #ifdef NETAPI_USE_DDR
93 #error "only define NETAPO_USE_MSMC or NETAPI_USE_DDR"
94 #endif
95 #endif
97 /**
98  * @ingroup tune_parameters
99 * @def TUNE_NETAPI_NUM_CORES
100 *       This defines the number of cores (theads) 
101  */
102 #define TUNE_NETAPI_NUM_CORES 5
104 /**
105  * @ingroup tune_parameters
106  * @def TUNE_NETAPI_PERM_MEM_SZ
107  *      This defines how much contiguous memory to grab. This is used for
108  *      descriptors and buffers in the case of uncached configuration only.  
109  *      descriptors and buffers.  Can't be bigger than  msmc if
110  *      MSMC memory is being using uncached .  This can be set at netapi_init via NETAPI_CFG_T
111  */
112 #define TUNE_NETAPI_PERM_MEM_SZ   (2*1024*1024) 
114 /**
115  * @ingroup tune_parameters
116  * @def TUNE_NETAPI_MAX_PKTIO
117  *      This defines the number of GLOBAL pkt io channels
118  */
119 #define TUNE_NETAPI_MAX_PKTIO 16
121 /**
122  * @ingroup tune_parameters
123  * @def TUNE_NETAPI_DEFAULT_BUFFER_SIZE
124  *      This defines the size of the netapi default pktlib heap buffers This can be set at @ref netapi_init 
125  */
126 #define TUNE_NETAPI_DEFAULT_BUFFER_SIZE 1600  
129 /**
130  * @ingroup tune_parameters
131  * @def TUNE_NETAPI_DEFAULT_NUM_BUFFERS
132  *      This defines the number of netapi default pktlib heap buffers (and assoc descriptors)
133  *      this can be set at @ref netapi_init
134  */
135 #define TUNE_NETAPI_DEFAULT_NUM_BUFFERS  200 
137 /**
138  * @ingroup tune_parameters
139  * @def TUNE_NETAPI_DEFAULT_NUM_SOLO_DESCRIPTORS
140  *      This defines the number of netapi default pkt lib heap solo descriptors
141  *      this can be set at @ref netapi_init
142  */
143 #define TUNE_NETAPI_DEFAULT_NUM_SOLO_DESCRIPTORS  100 
145 /**
146  * @ingroup tune_parameters
147  * @def  NETAPI_INCLUDE_SCHED
148  *      Define this to include the scheduler component
149  */
150 #define NETAPI_INCLUDE_SCHED 
152 /**
153  * @ingroup tune_parameters
154  * @def  TUNE_NETAPI_QM_CONFIG_MAX_DESC_NUM
155  *      This defines the number of of QM descriptors (total). This can be set set in @ref netapi_init
156  * @note Must be a power or 2
157 */
158 #define TUNE_NETAPI_QM_CONFIG_MAX_DESC_NUM  2048 /* 16384 is abs max */
161 /**
162  * @ingroup tune_parameters
163  * @def  TUNE_NETAPI_NUM_LOCAL_DESC
164  *      This defines the number of of QM descriptors (total). This can be set set in @ref netapi_init
165 */
166 #define TUNE_NETAPI_NUM_LOCAL_DESC  64 
169 /**
170  * @ingroup tune_parameters
171  * @def TUNE_NETAPI_NUM_GLOBAL_DESC
172  *      This defines the number of global descriptors.
173  * @note Must be a power or 2
174 */
175 #define TUNE_NETAPI_NUM_GLOBAL_DESC  1024
177 /**
178  * @ingroup tune_parameters
179  * @def  TUNE_NETAPI_DESC_SIZE
180  *      This defines the descriptor size
181  * @note This define should NOT be changes
182  */
183 #define TUNE_NETAPI_DESC_SIZE  128
185 /**
186  * @ingroup tune_parameters
187  * @def TUNE_NETAPI_NWAL_ENABLE_PASS_LOOPBACK
188  *      Define this to 1 for debutg mode where NETCP just loops pkts that tx back to rx
189  */
190 #define TUNE_NETAPI_NWAL_ENABLE_PASS_LOOPBACK 0  /*1*/
193 /// @cond INTERNAL
194 //(10) NWAL (internal) config. Should not have to change
195 #define TUNE_NETAPI_CONFIG_MAX_PA_TO_SA_DESC       32
196 #define TUNE_NETAPI_CONFIG_MAX_SA_TO_PA_DESC       200
197 /// @endcond
199 /**
200  * @ingroup tune_parameters
201  * @def TUNE_NETAPI_MAX_NUM_MAC
202  *      This defines the number of logical mac addresses
203  */
204 #define TUNE_NETAPI_MAX_NUM_MAC                64
206 /**
207  * @ingroup tune_parameters
208  * @def TUNE_NETAPI_MAX_NUM_IP
209  *      This defines the number of ip addresses
210  */
211 #define TUNE_NETAPI_MAX_NUM_IP                64
213 /**
214  * @ingroup tune_parameters
215  * @def TUNE_NETAPI_MAX_NUM_PORTS_PER_CORE
216  *      This defines the number of ports per core
217  */
218 #define TUNE_NETAPI_MAX_NUM_PORTS_PER_CORE     4
220 /**
221  * @ingroup tune_parameters
222  * @def TUNE_NETAPI_MAX_NUM_PORTS
223  *      This defines the number maximum number of ports
224  */
225 #define TUNE_NETAPI_MAX_NUM_PORTS     (TUNE_NETAPI_MAX_NUM_PORTS_PER_CORE * (TUNE_NETAPI_NUM_CORES)) 
227 #ifdef NETAPI_ENABLE_SECURITY
228 /**
229  * @ingroup tune_parameters
230  * @def TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS
231  *      This defines the number maximum number of ipsec channels
232  */
233 #define TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS     128
234 #else
235 /**
236  * @ingroup tune_parameters
237  * @def TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS
238  *      This defines the number maximum number of ipsec channels
239  */
240 #define TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS     0
241 #endif
243 /**
244  * @ingroup tune_parameters
245  * @def TUNE_NETAPI_MAX_NUM_L2_L3_HDRS
246  *      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
247  */
248 #define TUNE_NETAPI_MAX_NUM_L2_L3_HDRS         3
250 /**
251  * @ingroup tune_parameters
252  * @def TUNE_NETAPI_MAX_NUM_TRANS
253  *      This defines the number maximum number of transactions with NETCP that can be outstanding at any one time 
254  */
255 #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)
258 /// @cond INTERNAL
259 /* PA control buffer pool (internal) */
260 #define TUNE_NETAPI_CONFIG_MAX_CTL_RXTX_BUF_SIZE 2400
261 #define TUNE_NETAPI_CONFIG_NUM_CTL_RX_BUF  16 
262 #define TUNE_NETAPI_CONFIG_NUM_CTL_TX_BUF  16 
263 /// @endcond
265 /**
266  * @ingroup tune_parameters
267  * @def  TUNE_NETAPI_MAX_BURST_RCV
268  *      This defines the maximum number of packets to receive in one pktio poll.
269  */
270 #define TUNE_NETAPI_MAX_BURST_RCV 32
272 /**
273  * @ingroup tune_parameters
274  * @def  TUNE_NETAPI_NUM_TIMER_CELLS
275  *      This defines the number of hash bins in a timer group.
276  */
277 #define TUNE_NETAPI_NUM_TIMER_CELLS  128
278 /**
279  * @ingroup tune_parameters
280  * @def  TUNE_NETAPI_NUM_GLOBAL_TIMERS
281  *      This defines the number of global timer blocks
282  */
283 #define TUNE_NETAPI_NUM_GLOBAL_TIMERS  4
285 /**
286  * @ingroup tune_parameters
287  * @def  TUNE_NETAPI_MAX_HEAPS
288  *      This defines the maximum number of heaps one NETAPI instance can create
289  */
290 #define TUNE_NETAPI_MAX_HEAPS  4
292 /**
293  * @ingroup tune_parameters
294  * @def  TUNE_NETAPI_MAX_CLASSIFIERS
295  *      This defines the maximum number of classifiers
296  */
297 #define TUNE_NETAPI_MAX_CLASSIFIERS 16
299 /**
300  * @ingroup tune_parameters
301  * @def  TUNE_NETAPI_MAX_BUF_POOLS_IN_FLOW
302  *      This defines the  maximum number of buffer pools in a flow - A flow is used by hardware
303  *      when it needs a buffer for a receive packet.  This define allows the maximum number 
304  *      of pools (free descriptor queues) to be defined for a flow, so that different sized packets 
305  *      can be allocated from different memory areas.
306  * @note This define should NOT be changed as HW assumes at most 4 now
307  */
308 #define TUNE_NETAPI_MAX_BUF_POOLS_IN_FLOW  4
311 /**
312  * @ingroup tune_parameters
313  * @def  TUNE_NETAPI_MAX_FLOWS
314  *      This defines the maximum number of flows
315  */
316 #define TUNE_NETAPI_MAX_FLOWS  4   //app defined flows
318 /**
319  * @ingroup tune_parameters
320 * @def  TUNE_NETAPI_MAX_SA
321 *       This defines the maximum number of security associations
322 */
323 #define TUNE_NETAPI_MAX_SA 128   //rx&tx combined (so MAX_SA/4 tunnels typically)
325 /**
326  * @ingroup tune_parameters
327  * @def  TUNE_NETAPI_MAX_POLICY
328  *      This defines the maximum number of security policies.
329 */
330 #define TUNE_NETAPI_MAX_POLICY 128  //rx policies
332 #ifdef __cplusplus
334 #endif
335 #endif