pakls | 0168a57 | 2022-09-14 03:05:11 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2001, 2002 Swedish Institute of Computer Science. |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without modification, |
| 6 | * are permitted provided that the following conditions are met: |
| 7 | * |
| 8 | * 1. Redistributions of source code must retain the above copyright notice, |
| 9 | * this list of conditions and the following disclaimer. |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
| 11 | * this list of conditions and the following disclaimer in the documentation |
| 12 | * and/or other materials provided with the distribution. |
| 13 | * 3. The name of the author may not be used to endorse or promote products |
| 14 | * derived from this software without specific prior written permission. |
| 15 | * |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
| 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
| 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
| 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY |
| 25 | * OF SUCH DAMAGE. |
| 26 | * |
| 27 | * This file is part of the lwIP TCP/IP stack. |
| 28 | * |
| 29 | * Author: Adam Dunkels <adam@sics.se> |
| 30 | * |
| 31 | */ |
| 32 | |
| 33 | #ifndef __LWIPOPTS_H__ |
| 34 | #define __LWIPOPTS_H__ |
| 35 | |
| 36 | #include "FreeRTOSConfig.h" |
| 37 | |
| 38 | #define LWIP_NETIF_TX_ZEROCP_ENABLE 1 |
| 39 | #define LWIP_TCPIP_CORE_LOCKING 1 |
| 40 | #define LWIP_NETIF_TX_SINGLE_PBUF 1 |
| 41 | #define TCPIP_MBOX_SIZE 16 |
| 42 | #define DEFAULT_RAW_RECVMBOX_SIZE 16 |
| 43 | #define DEFAULT_UDP_RECVMBOX_SIZE 16 |
| 44 | #define DEFAULT_TCP_RECVMBOX_SIZE 16 |
| 45 | #define DEFAULT_ACCEPTMBOX_SIZE 16 |
| 46 | #define LWIP_STATS_DISPLAY 0 |
| 47 | |
| 48 | // fix http IOT issue |
| 49 | #define LWIP_WND_SCALE 1 |
| 50 | #define TCP_RCV_SCALE 1 |
| 51 | #define MEMP_NUM_NETDB 4 |
| 52 | // fix reuse address issue |
| 53 | #define SO_REUSE 1 |
| 54 | #define LWIP_SO_RCVTIMEO 1 |
| 55 | // for ip display |
| 56 | #define LWIP_NETIF_STATUS_CALLBACK 1 |
| 57 | |
| 58 | #if defined(MTK_MDNS_ENABLE) |
| 59 | #define LWIP_IPV6 1 |
| 60 | #define IP_REASS_MAXAGE 60 // 3 |
| 61 | #define LWIP_IPV6_FRAG 1 |
| 62 | #define LWIP_MULTICAST_PING 1 |
| 63 | #define LWIP_HAVE_LOOPIF 1 |
| 64 | #define LWIP_IGMP 1 |
| 65 | #define LWIP_NETIF_HOSTNAME 1 |
| 66 | #define LWIP_DHCP_AUTOIP_COOP 1 |
| 67 | #define LWIP_DHCP_AUTOIP_COOP_TRIES 3 |
| 68 | |
| 69 | #define LWIP_NETBUF_RECVINFO 1 |
| 70 | #define LWIP_DNS 1 |
| 71 | #define LWIP_SOCKET 1 |
| 72 | #define LWIP_COMPAT_SOCKETS 1 |
| 73 | #define LWIP_POSIX_SOCKETS_IO_NAMES 1 |
| 74 | #define MEMP_NUM_NETBUF 16 |
| 75 | #define MEMP_NUM_MLD6_GROUP 10 |
| 76 | |
| 77 | #define MEMP_NUM_ND6_QUEUE 30 |
| 78 | #define LWIP_ND6_RETRANS_TIMER 200 |
| 79 | #endif |
| 80 | |
| 81 | #define ETH_PAD_SIZE 0 |
| 82 | |
| 83 | #define NO_SYS 0 |
| 84 | #define LWIP_CALLBACK_API 1 |
| 85 | |
| 86 | /* |
| 87 | -------------------------------------- |
| 88 | ---------- Checksum options ---------- |
| 89 | -------------------------------------- |
| 90 | */ |
| 91 | #define CHECKSUM_GEN_UDP 0 |
| 92 | #define CHECKSUM_GEN_TCP 0 |
| 93 | #define CHECKSUM_CHECK_UDP 0 |
| 94 | #define CHECKSUM_CHECK_TCP 0 |
| 95 | |
| 96 | /* |
| 97 | ------------------------------------ |
| 98 | ---------- Memory options ---------- |
| 99 | ------------------------------------ |
| 100 | */ |
| 101 | /* MEM_ALIGNMENT: should be set to the alignment of the CPU for which |
| 102 | lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2 |
| 103 | byte alignment -> define MEM_ALIGNMENT to 2. */ |
| 104 | #define MEM_ALIGNMENT 8 |
| 105 | |
| 106 | /** |
| 107 | * MEMP_MEM_MALLOC==1: Use mem_malloc/mem_free instead of the lwip pool allocator. |
| 108 | * Especially useful with MEM_LIBC_MALLOC but handle with care regarding execution |
| 109 | * speed and usage from interrupts! |
| 110 | */ |
| 111 | #define MEMP_MEM_MALLOC 1 |
| 112 | |
| 113 | /* MEM_SIZE: the size of the heap memory. If the application will send |
| 114 | a lot of data that needs to be copied, this should be set high. */ |
| 115 | #if defined(MTK_WIFI_TGN_VERIFY_ENABLE) && !defined(MTK_HOMEKIT_ENABLE) |
| 116 | #define MEM_SIZE (100 * 1024) |
| 117 | #else |
| 118 | #if defined(MTK_WIFI_ROUTER_ENABLE) |
| 119 | #define MEM_SIZE (78 * 1024) |
| 120 | #else |
| 121 | #define MEM_SIZE (48 * 1024) |
| 122 | #endif |
| 123 | #endif |
| 124 | |
| 125 | /** |
| 126 | * SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain |
| 127 | * critical regions during buffer allocation, deallocation and memory |
| 128 | * allocation and deallocation. |
| 129 | */ |
| 130 | |
| 131 | #define SYS_LIGHTWEIGHT_PROT 1 |
| 132 | |
| 133 | /* |
| 134 | ------------------------------------------------ |
| 135 | ---------- Internal Memory Pool Sizes ---------- |
| 136 | ------------------------------------------------ |
| 137 | */ |
| 138 | |
| 139 | /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application |
| 140 | sends a lot of data out of ROM (or other static memory), this |
| 141 | should be set high. */ |
| 142 | #define MEMP_NUM_PBUF 8 |
| 143 | /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One |
| 144 | per active UDP "connection". */ |
| 145 | #define MEMP_NUM_UDP_PCB 8 |
| 146 | /* MEMP_NUM_TCP_PCB: the number of simultaneously active TCP |
| 147 | connections. */ |
| 148 | #define MEMP_NUM_TCP_PCB 32 // 8 original |
| 149 | /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP |
| 150 | connections. */ |
| 151 | #define MEMP_NUM_TCP_PCB_LISTEN 32 // 16 original |
| 152 | /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP |
| 153 | segments. */ |
| 154 | #define MEMP_NUM_TCP_SEG 255 |
| 155 | |
| 156 | /** |
| 157 | * MEMP_NUM_ARP_QUEUE: the number of simulateously queued outgoing |
| 158 | * packets (pbufs) that are waiting for an ARP request (to resolve |
| 159 | * their destination address) to finish. |
| 160 | * (requires the ARP_QUEUEING option) |
| 161 | */ |
| 162 | #define MEMP_NUM_ARP_QUEUE 8 |
| 163 | |
| 164 | /** |
| 165 | * MEMP_NUM_NETCONN: the number of struct netconns. |
| 166 | * (only needed if you use the sequential API, like api_lib.c) |
| 167 | */ |
| 168 | #define MEMP_NUM_NETCONN 32 |
| 169 | |
| 170 | /* |
| 171 | ---------------------------------- |
| 172 | ---------- Pbuf options ---------- |
| 173 | ---------------------------------- |
| 174 | */ |
| 175 | /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */ |
| 176 | #define PBUF_POOL_SIZE 10 |
| 177 | |
| 178 | /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */ |
Karsten Sperling | 38d6a48 | 2023-09-29 15:50:08 +1300 | [diff] [blame] | 179 | // #define PBUF_POOL_BUFSIZE 1536 |
pakls | 0168a57 | 2022-09-14 03:05:11 +0800 | [diff] [blame] | 180 | /* packet of MT7687 IOT has extra TXD header and packet offset */ |
| 181 | #define PBUF_POOL_BUFSIZE 1664 |
| 182 | |
| 183 | /** |
| 184 | * PBUF_LINK_HLEN: the number of bytes that should be allocated for a |
| 185 | * link level header. The default is 14, the standard value for |
| 186 | * Ethernet. |
| 187 | */ |
| 188 | |
| 189 | #define RESERVED_HLEN 0 // depend on CFG_CONNSYS_TXD_PAD_SIZE |
| 190 | #ifdef MTK_HIF_GDMA_ENABLE |
| 191 | #define PBUF_LINK_ENCAPSULATION_HLEN 0 // for WiFi headroom (TX zero copy) |
| 192 | #else |
| 193 | #define PBUF_LINK_ENCAPSULATION_HLEN (64 + 4) |
| 194 | #endif |
| 195 | #define PBUF_LINK_HLEN (RESERVED_HLEN + 14 + ETH_PAD_SIZE) |
| 196 | /* |
| 197 | --------------------------------- |
| 198 | ---------- TCP options ---------- |
| 199 | --------------------------------- |
| 200 | */ |
| 201 | #define LWIP_TCP 1 |
| 202 | #define TCP_TTL 255 |
| 203 | |
| 204 | /* Controls if TCP should queue segments that arrive out of |
| 205 | order. Define to 0 if your device is low on memory. */ |
| 206 | #define TCP_QUEUE_OOSEQ 1 |
| 207 | |
| 208 | /* TCP Maximum segment size. */ |
| 209 | #define TCP_MSS 1476 |
| 210 | |
| 211 | /* TCP sender buffer space (bytes). */ |
| 212 | #define TCP_SND_BUF (24 * 1024) //(12 * 1024) |
| 213 | |
| 214 | /* TCP sender buffer space (pbufs). This must be at least = 2 * |
| 215 | TCP_SND_BUF/TCP_MSS for things to work. */ |
| 216 | #define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1)) / (TCP_MSS)) |
| 217 | |
| 218 | /* TCP receive window. */ |
| 219 | #define TCP_WND (24 * 1024) |
| 220 | |
| 221 | /* Maximum number of retransmissions of data segments. */ |
| 222 | #define TCP_MAXRTX 12 |
| 223 | |
| 224 | /* Maximum number of retransmissions of SYN segments. */ |
| 225 | #define TCP_SYNMAXRTX 4 |
| 226 | |
| 227 | #define LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS 1 |
| 228 | |
| 229 | /* |
| 230 | --------------------------------- |
| 231 | ---------- ARP options ---------- |
| 232 | --------------------------------- |
| 233 | */ |
| 234 | #define LWIP_ARP 1 |
| 235 | #define ARP_TABLE_SIZE 10 |
| 236 | #define ARP_QUEUEING 1 |
| 237 | |
| 238 | /* ---------- IP options ---------- */ |
| 239 | /* Define IP_FORWARD to 1 if you wish to have the ability to forward |
| 240 | IP packets across network interfaces. If you are going to run lwIP |
| 241 | on a device with only one network interface, define this to 0. */ |
| 242 | #define IP_FORWARD 1 |
| 243 | |
| 244 | /* Define IP_NAPT to 1 If you wish to have the ability to forward |
| 245 | IP packets across network interfaces using Network Address Port |
| 246 | Translation (NAPT).*/ |
| 247 | #if defined(MTK_WIFI_ROUTER_ENABLE) |
| 248 | #define IP_NAPT 1 |
| 249 | #endif |
| 250 | |
| 251 | /* If defined to 1, IP options are allowed (but not parsed). If |
| 252 | defined to 0, all packets with IP options are dropped. */ |
| 253 | #define IP_OPTIONS 1 |
| 254 | |
| 255 | #define IP_REASSEMBLY 1 |
| 256 | |
| 257 | /** |
| 258 | * IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled. |
| 259 | * Since the received pbufs are enqueued, be sure to configure |
| 260 | * PBUF_POOL_SIZE > IP_REASS_MAX_PBUFS so that the stack is still able to receive |
| 261 | * packets even if the maximum amount of fragments is enqueued for reassembly! |
| 262 | */ |
| 263 | #if defined(MTK_WIFI_TGN_VERIFY_ENABLE) |
| 264 | #define IP_REASS_MAX_PBUFS 25 |
| 265 | #else |
| 266 | #define IP_REASS_MAX_PBUFS 12 |
| 267 | #endif |
| 268 | /* ---------- ICMP options ---------- */ |
| 269 | #define ICMP_TTL 255 |
| 270 | |
| 271 | /* ---------- DHCP options ---------- */ |
| 272 | /* Define LWIP_DHCP to 1 if you want DHCP configuration of |
| 273 | interfaces. DHCP is not implemented in lwIP 0.5.1, however, so |
| 274 | turning this on does currently not work. */ |
| 275 | #define LWIP_DHCP 1 |
| 276 | #define LWIP_DHCP_CHECK_LINK_UP 1 |
| 277 | |
| 278 | /* 1 if you want to do an ARP check on the offered address |
| 279 | (recommended). */ |
| 280 | #define DHCP_DOES_ARP_CHECK 1 |
| 281 | |
| 282 | /* ---------- UDP options ---------- */ |
| 283 | #define LWIP_UDP 1 |
| 284 | #define UDP_TTL 255 |
| 285 | |
| 286 | /* ---------- Statistics options ---------- */ |
| 287 | #if defined(MTK_LWIP_STATISTICS_ENABLE) |
| 288 | #define LWIP_STATS 1 |
| 289 | #define LWIP_STATS_DISPLAY 1 |
| 290 | #endif |
| 291 | /* |
| 292 | * Should use the default value defined in tcp_impl.h |
| 293 | */ |
| 294 | /* |
| 295 | ------------------------------------ |
| 296 | ---------- AUTOIP options ---------- |
| 297 | ------------------------------------ |
| 298 | */ |
| 299 | #if defined(MTK_HOMEKIT_ENABLE) || defined(MTK_MDNS_ENABLE) |
| 300 | #define LWIP_AUTOIP 1 |
| 301 | #else |
| 302 | #define LWIP_AUTOIP 0 |
| 303 | #endif |
| 304 | |
| 305 | /* |
| 306 | ---------------------------------- |
| 307 | ---------- DNS options ----------- |
| 308 | ---------------------------------- |
| 309 | */ |
| 310 | #define LWIP_DNS 1 |
| 311 | |
| 312 | /* |
| 313 | --------------------------------- |
| 314 | ---------- PPP options ---------- |
| 315 | --------------------------------- |
| 316 | */ |
| 317 | #define PPP_SUPPORT 0 |
| 318 | |
| 319 | /* |
| 320 | ------------------------------------------------ |
| 321 | ---------- Network Interfaces options ---------- |
| 322 | ------------------------------------------------ |
| 323 | */ |
| 324 | |
| 325 | /** |
| 326 | * LWIP_NETIF_LOOPBACK==1: Support sending packets with a destination IP |
| 327 | * address equal to the netif IP address, looping them back up the stack. |
| 328 | */ |
| 329 | #define LWIP_NETIF_LOOPBACK 1 |
| 330 | |
| 331 | /** |
| 332 | * LWIP_LOOPBACK_MAX_PBUFS: Maximum number of pbufs on queue for loopback |
| 333 | * sending for each netif (0 = disabled) |
| 334 | */ |
| 335 | #define LWIP_LOOPBACK_MAX_PBUFS 12 |
| 336 | |
| 337 | /* |
| 338 | ------------------------------------ |
| 339 | ---------- LOOPIF options ---------- |
| 340 | ------------------------------------ |
| 341 | */ |
| 342 | /** |
| 343 | * LWIP_HAVE_LOOPIF==1: Support loop interface (127.0.0.1) and loopif.c |
| 344 | */ |
| 345 | #define LWIP_HAVE_LOOPIF 1 |
| 346 | |
| 347 | /* |
| 348 | * Should use the default value defined in opt.h |
| 349 | */ |
| 350 | |
| 351 | /** |
| 352 | * MTK_LWIP_DYNAMIC_DEBUG_ENABLE: Support LwIP dynamic debug |
| 353 | * No dependency |
| 354 | */ |
| 355 | #if defined(MTK_LWIP_DYNAMIC_DEBUG_ENABLE) |
| 356 | |
| 357 | struct lwip_debug_flags |
| 358 | { |
| 359 | char * debug_flag_name; |
| 360 | uint32_t debug_flag; |
| 361 | }; |
| 362 | |
| 363 | extern struct lwip_debug_flags lwip_debug_flags[]; |
| 364 | |
| 365 | #define LWIP_DEBUG LWIP_DBG_ON |
| 366 | #define LWIP_DEBUG_IDX(idx) ((idx) >> 8) |
| 367 | |
| 368 | #undef ETHARP_DEBUG |
| 369 | #undef NETIF_DEBUG |
| 370 | #undef PBUF_DEBUG |
| 371 | #undef API_LIB_DEBUG |
| 372 | #undef API_MSG_DEBUG |
| 373 | #undef SOCKETS_DEBUG |
| 374 | #undef ICMP_DEBUG |
| 375 | #undef IGMP_DEBUG |
| 376 | #undef INET_DEBUG |
| 377 | #undef IP_DEBUG |
| 378 | #undef IP_REASS_DEBUG |
| 379 | #undef RAW_DEBUG |
| 380 | #undef MEM_DEBUG |
| 381 | #undef MEMP_DEBUG |
| 382 | #undef SYS_DEBUG |
| 383 | #undef TIMERS_DEBUG |
| 384 | #undef TCP_DEBUG |
| 385 | #undef TCP_INPUT_DEBUG |
| 386 | #undef TCP_FR_DEBUG |
| 387 | #undef TCP_RTO_DEBUG |
| 388 | #undef TCP_CWND_DEBUG |
| 389 | #undef TCP_WND_DEBUG |
| 390 | #undef TCP_OUTPUT_DEBUG |
| 391 | #undef TCP_RST_DEBUG |
| 392 | #undef TCP_QLEN_DEBUG |
| 393 | #undef UDP_DEBUG |
| 394 | #undef TCPIP_DEBUG |
| 395 | #undef PPP_DEBUG |
| 396 | #undef SLIP_DEBUG |
| 397 | #undef DHCP_DEBUG |
| 398 | #undef AUTOIP_DEBUG |
| 399 | #undef SNMP_MSG_DEBUG |
| 400 | #undef SNMP_MIB_DEBUG |
| 401 | #undef DNS_DEBUG |
| 402 | |
| 403 | #define ETHARP_DEBUG 0x0000U |
| 404 | #define NETIF_DEBUG 0x0100U |
| 405 | #define PBUF_DEBUG 0x0200U |
| 406 | #define API_LIB_DEBUG 0x0300U |
| 407 | #define API_MSG_DEBUG 0x0400U |
| 408 | #define SOCKETS_DEBUG 0x0500U |
| 409 | #define ICMP_DEBUG 0x0600U |
| 410 | #define IGMP_DEBUG 0x0700U |
| 411 | #define INET_DEBUG 0x0800U |
| 412 | #define IP_DEBUG 0x0900U |
| 413 | #define IP_REASS_DEBUG 0x0a00U |
| 414 | #define RAW_DEBUG 0x0b00U |
| 415 | #define MEM_DEBUG 0x0c00U |
| 416 | #define MEMP_DEBUG 0x0d00U |
| 417 | #define SYS_DEBUG 0x0e00U |
| 418 | #define TIMERS_DEBUG 0x0f00U |
| 419 | #define TCP_DEBUG 0x1000U |
| 420 | #define TCP_INPUT_DEBUG 0x1100U |
| 421 | #define TCP_FR_DEBUG 0x1200U |
| 422 | #define TCP_RTO_DEBUG 0x1300U |
| 423 | #define TCP_CWND_DEBUG 0x1400U |
| 424 | #define TCP_WND_DEBUG 0x1500U |
| 425 | #define TCP_OUTPUT_DEBUG 0x1600U |
| 426 | #define TCP_RST_DEBUG 0x1700U |
| 427 | #define TCP_QLEN_DEBUG 0x1800U |
| 428 | #define UDP_DEBUG 0x1900U |
| 429 | #define TCPIP_DEBUG 0x1a00U |
| 430 | #define PPP_DEBUG 0x1b00U |
| 431 | #define SLIP_DEBUG 0x1c00U |
| 432 | #define DHCP_DEBUG 0x1d00U |
| 433 | #define AUTOIP_DEBUG 0x1e00U |
| 434 | #define SNMP_MSG_DEBUG 0x1f00U |
| 435 | #define SNMP_MIB_DEBUG 0x2000U |
| 436 | #define DNS_DEBUG 0x2100U |
| 437 | #endif |
| 438 | |
| 439 | #endif /* __LWIPOPTS_H__ */ |