fd8113b92739fb0bb7663334617401bb99dccb02
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 * @brief Define this to enable securtiy. Note: libraries being use need to be built with SA enabled also
56 */
57 #define NETAPI_ENABLE_SECURITY
60 /**
61 * @ingroup netapi_tune_parameters
62 * @brief Define this to enable use of cached DDR for buffers and descriptors. Do not define if USE_MSMC defined below
63 */
64 #define NETAPI_USE_DDR
65 #ifdef NETAPI_USE_DDR
66 #define NETAPI_TUNE_USE_CACHE_OPS //for appleton, no cache coherency with netcp & ARM
67 #endif
69 /**
70 * @ingroup netapi_tune_parameters
71 * @brief Define this to enable use of un-cached MSMC for buffers and descriptors . Do not define if USE_DDR defined above
72 */
73 //#define NETAPI_USE_MSMC
75 #ifdef NETAPI_USE_MSMC
76 #ifdef NETAPI_USE_DDR
77 #error "only define NETAPO_USE_MSMC or NETAPI_USE_DDR"
78 #endif
79 #endif
81 /**
82 * @ingroup netapi_tune_parameters
83 * @brief Define this to the number of cores (theads)
84 */
85 #define TUNE_NETAPI_NUM_CORES 1
87 /**
88 * @ingroup netapi_tune_parameters
89 * @brief Define this to how much contiguous memory to grab. This is used for
90 * descriptors and buffers in the case of uncached configuration only.
91 * descriptors and buffers. Can't be bigger than msmc if
92 * MSMC memory is being using uncached . This can be set at netapi_init via NETAPI_CFG_T
93 */
94 #define TUNE_NETAPI_PERM_MEM_SZ (2*1024*1024)
96 /**
97 * @ingroup netapi_tune_parameters
98 * @brief Define this to how many GLOBAL pkt io channels
99 */
100 #define TUNE_NETAPI_MAX_PKTIO 16
102 /**
103 * @ingroup netapi_tune_parameters
104 * @brief Define this to the size of netapi default pktlib heap buffers This can be set at @ref netapi_init
105 */
106 #define TUNE_NETAPI_DEFAULT_BUFFER_SIZE 1600
110 /**
111 * @ingroup netapi_tune_parameters
112 * @brief Define this to number of netapi default pktlib heap buffers (and assoc descriptors)
113 * this can be set at @ref netapi_init
114 */
115 #define TUNE_NETAPI_DEFAULT_NUM_BUFFERS 200
117 /**
118 * @ingroup netapi_tune_parameters
119 * @brief Define this to number of netapi default pkt lib heap solo descriptors
120 * this can be set at @ref netapi_init
121 */
122 #define TUNE_NETAPI_DEFAULT_NUM_SOLO_DESCRIPTORS 100
124 /**
125 * @ingroup netapi_tune_parameters
126 * @brief Define this to include the scheduler component
127 */
128 #define NETAPI_INCLUDE_SCHED
130 /**
131 * @ingroup netapi_tune_parameters
132 * @brief Define this to the number of of QM descriptors (total). This can be set set in @ref netapi_init
133 * @note MUST BE POWER OF 2
134 */
135 #define TUNE_NETAPI_QM_CONFIG_MAX_DESC_NUM 2048 /* 16384 is abs max */
137 //(8) Region info
138 #define TUNE_NETAPI_NUM_LOCAL_DESC 64
140 /* at least as big as DEFAULT_NUM_SOLO+DEFAULT_NUM_BUFFERS but also a power of 2*/
141 #define TUNE_NETAPI_NUM_GLOBAL_DESC 1024
143 #define TUNE_NETAPI_DESC_SIZE 128 //don't change!!
144 #ifdef NETAPI_USE_DDR
145 #define TUNE_NETAPI_QM_START_INDEX 0x2000 //WARNING: must reflect what kernel is using for their region, see device tree blob
146 #define TUNE_NETAPI_QM_GLOBAL_REGION 18 //WARNING: must reflect what kernel is using for their region, see device tree blob
147 #else //use msmc..
148 #define TUNE_NETAPI_QM_START_INDEX 0 //ok to use 0 since kernel is somewhere higher
149 #define TUNE_NETAPI_QM_GLOBAL_REGION 0 //ok to to use 0 since msmc addr < ddr addr
150 #endif
151 //(9) Define to 1 for DEBUG MODE [where NETCP just loops pkts that tx back to rx]
152 #define TUNE_NETAPI_NWAL_ENABLE_PASS_LOOPBACK 0 /*1*/
155 //(10) NWAL (internal) config. Should not have to change
156 #define TUNE_NETAPI_CONFIG_MAX_PA_TO_SA_DESC 32
157 #define TUNE_NETAPI_CONFIG_MAX_SA_TO_PA_DESC 32
159 #define TUNE_NETAPI_MAX_NUM_MAC 2 //2 'logical' mac addresses
160 #define TUNE_NETAPI_MAX_NUM_IP 32 //2 ip addresses
161 #define TUNE_NETAPI_MAX_NUM_PORTS_PER_CORE 4 //udp/tcp ports -> for lUT2 )
162 #define TUNE_NETAPI_MAX_NUM_PORTS (TUNE_NETAPI_MAX_NUM_PORTS_PER_CORE * (TUNE_NETAPI_NUM_CORES))
164 #ifdef NETAPI_ENABLE_SECURITY
165 #define TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS 32
166 #else
167 #define TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS 0
168 #endif
169 #define TUNE_NETAPI_MAX_NUM_L2_L3_HDRS 3
170 #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)
172 //(11) PA control buffer pool (internal)
173 #define TUNE_NETAPI_CONFIG_MAX_CTL_RXTX_BUF_SIZE 384
174 #define TUNE_NETAPI_CONFIG_NUM_CTL_RX_BUF 16
175 #define TUNE_NETAPI_CONFIG_NUM_CTL_TX_BUF 16
177 //(12) PKTIO RECV BURST SIZE
178 #define TUNE_NETAPI_MAX_BURST_RCV 32 //max #ok pkts to recv in one poll
180 //(13) netcp interfaces
181 #define TUNE_NETAPI_MAX_IP 4 //4 ip's can be attached to interfaces
182 #define TUNE_NETAPI_MAX_INTERFACES 2 //2 interfaces
184 //(14) timers
185 #define TUNE_NETAPI_NUM_TIMER_CELLS 128 //# of hash bins in a timer group
186 #define TUNE_NETAPI_NUM_GLOBAL_TIMERS 4 //# global timer blocks
188 //(15) heaps
189 #define TUNE_NETAPI_MAX_HEAPS 4 //max # of heaps one instance can create
191 //(16) classifiers
192 #define TUNE_NETAPI_MAX_CLASSIFIERS 16
194 //(17) FLows
195 #define TUNE_NETAPI_MAX_BUF_POOLS_IN_FLOW 4 //!!do not change!!
196 #define TUNE_NETAPI_MAX_FLOWS 4 //app defined flows
198 //(18) SAs & RX policies
199 #define TUNE_NETAPI_MAX_SA 8 //rx&tx combined (so MAX_SA/4 tunnels typically)
200 #define TUNE_NETAPI_MAX_POLICY 8 //rx policies
202 #endif