1 /**************************************************************
2 * FILE: netapi_tune.h
3 * Purpose: hold tunable parameters (build time)
4 **************************************************************
5 * @file netapi_tune.h
6 *
7 * @brief DESCRIPTION: Tuneable (compile time) parameters for user space transport
8 * library
9 *
10 * REVISION HISTORY: rev 0.0.1
11 *
12 * Copyright (c) Texas Instruments Incorporated 2010-2011
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 *
18 * Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer.
20 *
21 * Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the
24 * distribution.
25 *
26 * Neither the name of Texas Instruments Incorporated nor the names of
27 * its contributors may be used to endorse or promote products derived
28 * from this software without specific prior written permission.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
33 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
34 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
37 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
38 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
40 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 ****************************************************/
43 #ifndef __NETAPI_TUNE__H
44 #define __NETAPI_TUNE__H
47 /**
48 * @defgroup NETAPI_TUNE NETAPI tunable parameters
49 */
50 /** @ingroup NETAPI_TUNE */
52 /**
53 * @def NETAPI_ENABLE_SECURITY
54 * (0) define this to enable securtiy. Note: libraries being use need to be built with SA enabled also!
55 */
56 #define NETAPI_ENABLE_SECURITY
59 /**
60 * @def NETAPI_USE_DDR
61 * (0) define this to enable use of cached DDR for buffers and descriptors
62 * 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
68 /**
69 * @def NETAPI_USE_MSMC
70 * (0) define this to enable use of un-cached MSMC for buffers and descriptors
71 * 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 * @def TUNE_NETAPI_NUM_CORES
83 * (0) How many cores (theads)
84 */
85 #define TUNE_NETAPI_NUM_CORES 1
87 /**
88 * @def TUNE_NETAPI_PERM_MEM_SZ
89 * (1) how much contiguous memory to grab. This is used for
90 * descriptors and buffers. Can't be bigger than CMA memory area (or msmc if
91 * we are using uncached . This can be set at netapi_init via NETAPI_CFG_T
92 */
93 #define TUNE_NETAPI_PERM_MEM_SZ (2*1024*1024)
95 /**
96 * @def TUNE_NETAPI_MAX_PKTIO
97 * (2) how many GLOBAL pkt io channels
98 */
99 #define TUNE_NETAPI_MAX_PKTIO 16
101 //(2a) default TX channel name
102 //(2b) default RX channel name
105 /**
106 * @def TUNE_NETAPI_DEFAULT_BUFFER_SIZE
107 * (3) size of netapi default pktlib heap buffers
108 * This can be set at netapi_init()
109 */
110 #define TUNE_NETAPI_DEFAULT_BUFFER_SIZE 1600
112 //(3a) default pkt heap name
114 /**
115 * @def TUNE_NETAPI_DEFAULT_NUM_BUFFERS
116 *(4) number of netapi default pktlib heap buffers (and assoc descriptors)
117 * this can be set at netapi_init()
118 */
119 #define TUNE_NETAPI_DEFAULT_NUM_BUFFERS 200
121 /*
122 * @def TUNE_NETAPI_DEFAULT_NUM_SOLO_DESCRIPTORS
123 * (5) number of netapi default pkt lib heap solo descriptors
124 * this can be set at netapi_init
125 */
126 #define TUNE_NETAPI_DEFAULT_NUM_SOLO_DESCRIPTORS 100
128 /**
129 * @def NETAPI_INCLUDE_SCHED
130 * (6) define this to include the scheduler component
131 */
132 #define NETAPI_INCLUDE_SCHED
134 //(7) # of QM descriptors (total)
135 // this can be set set in netapi_init
136 // MUST BE POWER OF 2
137 #define TUNE_NETAPI_QM_CONFIG_MAX_DESC_NUM 1024 /* 16384 is abs max */
139 //(8) Region info
140 #define TUNE_NETAPI_NUM_LOCAL_DESC 64
142 /* at least as big as DEFAULT_NUM_SOLO+DEFAULT_NUM_BUFFERS but also a power of 2*/
143 #define TUNE_NETAPI_NUM_GLOBAL_DESC 512
145 #define TUNE_NETAPI_DESC_SIZE 128 //don't change!!
146 #ifdef NETAPI_USE_DDR
147 #define TUNE_NETAPI_QM_START_INDEX 0x2000 //WARNING: must reflect what kernel is using for their region, see device tree blob
148 #define TUNE_NETAPI_QM_GLOBAL_REGION 18 //WARNING: must reflect what kernel is using for their region, see device tree blob
149 #else //use msmc..
150 #define TUNE_NETAPI_QM_START_INDEX 0 //ok to use 0 since kernel is somewhere higher
151 #define TUNE_NETAPI_QM_GLOBAL_REGION 0 //ok to to use 0 since msmc addr < ddr addr
152 #endif
153 //(9) Define to 1 for DEBUG MODE [where NETCP just loops pkts that tx back to rx]
154 #define TUNE_NETAPI_NWAL_ENABLE_PASS_LOOPBACK 0 /*1*/
157 //(10) NWAL (internal) config. Should not have to change
158 #define TUNE_NETAPI_CONFIG_MAX_PA_TO_SA_DESC 16
159 #define TUNE_NETAPI_CONFIG_MAX_SA_TO_PA_DESC 16
161 #define TUNE_NETAPI_MAX_NUM_MAC 2 //2 'logical' mac addresses
162 #define TUNE_NETAPI_MAX_NUM_IP 4 //2 ip addresses
163 #define TUNE_NETAPI_MAX_NUM_PORTS_PER_CORE 4 //udp/tcp ports -> for lUT2 )
164 #define TUNE_NETAPI_MAX_NUM_PORTS (TUNE_NETAPI_MAX_NUM_PORTS_PER_CORE * (TUNE_NETAPI_NUM_CORES))
166 #ifdef NETAPI_ENABLE_SECURITY
167 #define TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS 4
168 #else
169 #define TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS 0
170 #endif
171 #define TUNE_NETAPI_MAX_NUM_L2_L3_HDRS 3
172 #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)
174 //(11) PA control buffer pool (internal)
175 #define TUNE_NETAPI_CONFIG_MAX_CTL_RXTX_BUF_SIZE 384
176 #define TUNE_NETAPI_CONFIG_NUM_CTL_RX_BUF 16
177 #define TUNE_NETAPI_CONFIG_NUM_CTL_TX_BUF 16
179 //(12) PKTIO RECV BURST SIZE
180 #define TUNE_NETAPI_MAX_BURST_RCV 32 //max #ok pkts to recv in one poll
182 //(13) netcp interfaces
183 #define TUNE_NETAPI_MAX_IP 4 //4 ip's can be attached to interfaces
184 #define TUNE_NETAPI_MAX_INTERFACES 2 //2 interfaces
186 //(14) timers
187 #define TUNE_NETAPI_NUM_TIMER_CELLS 128 //# of hash bins in a timer group
188 #define TUNE_NETAPI_NUM_GLOBAL_TIMERS 4 //# global timer blocks
190 //(15) heaps
191 #define TUNE_NETAPI_MAX_HEAPS 4 //max # of heaps one instance can create
193 //(16) classifiers
194 #define TUNE_NETAPI_MAX_CLASSIFIERS 16
196 //(17) FLows
197 #define TUNE_NETAPI_MAX_BUF_POOLS_IN_FLOW 4 //!!do not change!!
198 #define TUNE_NETAPI_MAX_FLOWS 4 //app defined flows
200 //(18) SAs & RX policies
201 #define TUNE_NETAPI_MAX_SA 8 //rx&tx combined (so MAX_SA/4 tunnels typically)
202 #define TUNE_NETAPI_MAX_POLICY 8 //rx policies
204 #endif