1 /* 2 * Copyright (c) 2001-2003 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 #ifndef __LWIPOPTS_H__ 33 #define __LWIPOPTS_H__ 34 35 36 /** 37 * Loopback demo related options. 38 */ 39 #define LWIP_NETIF_LOOPBACK 1 40 #define LWIP_HAVE_LOOPIF 1 41 #define LWIP_NETIF_LOOPBACK_MULTITHREADING 1 42 #define LWIP_LOOPBACK_MAX_PBUFS 8 43 44 #define LWIP_TIMERS 1 45 #define LWIP_TCPIP_TIMEOUT 1 46 47 48 #define TCPIP_THREAD_NAME "tcp/ip" 49 #define TCPIP_THREAD_STACKSIZE 3072 50 #define TCPIP_THREAD_PRIO 7 51 52 #define DEFAULT_THREAD_STACKSIZE 200 53 #define DEFAULT_THREAD_PRIO 1 54 55 /* Disable lwIP asserts */ 56 #define LWIP_NOASSERT 1 57 58 #define LWIP_DEBUG 1 59 //#define LWIP_DEBUG_TRACE 1 60 #define SOCKETS_DEBUG LWIP_DBG_OFF // | LWIP_DBG_MASK_LEVEL 61 62 #define IP_DEBUG LWIP_DBG_OFF 63 #define ETHARP_DEBUG LWIP_DBG_OFF 64 #define NETIF_DEBUG LWIP_DBG_OFF 65 #define PBUF_DEBUG LWIP_DBG_OFF 66 #define MEMP_DEBUG LWIP_DBG_OFF 67 #define API_LIB_DEBUG LWIP_DBG_OFF 68 #define API_MSG_DEBUG LWIP_DBG_OFF 69 #define ICMP_DEBUG LWIP_DBG_OFF 70 #define IGMP_DEBUG LWIP_DBG_OFF 71 #define INET_DEBUG LWIP_DBG_OFF 72 #define IP_REASS_DEBUG LWIP_DBG_OFF 73 #define RAW_DEBUG LWIP_DBG_OFF 74 #define MEM_DEBUG LWIP_DBG_OFF 75 #define SYS_DEBUG LWIP_DBG_OFF 76 #define TCP_DEBUG LWIP_DBG_OFF 77 #define TCP_INPUT_DEBUG LWIP_DBG_OFF 78 #define TCP_FR_DEBUG LWIP_DBG_OFF 79 #define TCP_RTO_DEBUG LWIP_DBG_OFF 80 #define TCP_CWND_DEBUG LWIP_DBG_OFF 81 #define TCP_WND_DEBUG LWIP_DBG_OFF 82 #define TCP_OUTPUT_DEBUG LWIP_DBG_OFF 83 #define TCP_RST_DEBUG LWIP_DBG_OFF 84 #define TCP_QLEN_DEBUG LWIP_DBG_OFF 85 #define UDP_DEBUG LWIP_DBG_OFF 86 #define TCPIP_DEBUG LWIP_DBG_OFF 87 #define PPP_DEBUG LWIP_DBG_OFF 88 #define SLIP_DEBUG LWIP_DBG_OFF 89 #define DHCP_DEBUG LWIP_DBG_OFF 90 #define AUTOIP_DEBUG LWIP_DBG_OFF 91 #define SNMP_MSG_DEBUG LWIP_DBG_OFF 92 #define SNMP_MIB_DEBUG LWIP_DBG_OFF 93 #define DNS_DEBUG LWIP_DBG_OFF 94 #define REENTER_DEBUG LWIP_DBG_OFF 95 #define IPERF_DEBUG LWIP_DBG_OFF 96 #define PING_DEBUG LWIP_DBG_OFF 97 98 //#define LWIP_COMPAT_MUTEX 1 99 /** 100 * SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain 101 * critical regions during buffer allocation, deallocation and memory 102 * allocation and deallocation. 103 */ 104 #define SYS_LIGHTWEIGHT_PROT 1 105 106 /* 107 ------------------------------------ 108 ---------- Memory options ---------- 109 ------------------------------------ 110 */ 111 112 /** 113 * MEM_ALIGNMENT: should be set to the alignment of the CPU 114 * 4 byte alignment -> #define MEM_ALIGNMENT 4 115 * 2 byte alignment -> #define MEM_ALIGNMENT 2 116 */ 117 #define MEM_ALIGNMENT 4 118 119 #define MAX_SOCKETS_TCP 12 120 #define MAX_LISTENING_SOCKETS_TCP 4 121 #define MAX_SOCKETS_UDP 22 122 #define TCP_SND_BUF_COUNT 5 123 124 /* Value of TCP_SND_BUF_COUNT denotes the number of buffers and is set by 125 * CONFIG option available in the SDK 126 */ 127 /* Buffer size needed for TCP: Max. number of TCP sockets * Size of pbuf * 128 * Max. number of TCP sender buffers per socket 129 * 130 * Listening sockets for TCP servers do not require the same amount buffer 131 * space. Hence do not consider these sockets for memory computation 132 */ 133 #define TCP_MEM_SIZE (MAX_SOCKETS_TCP * \ 134 PBUF_POOL_BUFSIZE * (TCP_SND_BUF/TCP_MSS)) 135 136 /* Buffer size needed for UDP: Max. number of UDP sockets * Size of pbuf 137 */ 138 #define UDP_MEM_SIZE (MAX_SOCKETS_UDP * PBUF_POOL_BUFSIZE) 139 140 /** 141 * MEM_SIZE: the size of the heap memory. If the application will send 142 * a lot of data that needs to be copied, this should be set high. 143 */ 144 145 #define MEM_SIZE (20*1024) 146 147 148 149 /* 150 ------------------------------------------------ 151 ---------- Internal Memory Pool Sizes ---------- 152 ------------------------------------------------ 153 */ 154 /** 155 * MEMP_NUM_PBUF: the number of memp struct pbufs (used for PBUF_ROM and PBUF_REF). 156 * If the application sends a lot of data out of ROM (or other static memory), 157 * this should be set high. 158 */ 159 #define MEMP_NUM_PBUF 10 160 161 162 /** 163 * MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections. 164 * (requires the LWIP_TCP option) 165 */ 166 #define MEMP_NUM_TCP_PCB MAX_SOCKETS_TCP 167 168 #define MEMP_NUM_TCP_PCB_LISTEN MAX_LISTENING_SOCKETS_TCP 169 170 /** 171 * MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments. 172 * (requires the LWIP_TCP option) 173 */ 174 //#define MEMP_NUM_TCP_SEG 12 175 176 /** 177 * MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used 178 * for incoming packets. 179 * (only needed if you use tcpip.c) 180 */ 181 182 #define MEMP_NUM_TCPIP_MSG_INPKT 16 183 #define TCPIP_MBOX_SIZE 16 184 185 /** 186 * MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts. 187 * (requires NO_SYS==0) 188 */ 189 #define MEMP_NUM_SYS_TIMEOUT 12 190 191 /** 192 * MEMP_NUM_NETBUF: the number of struct netbufs. 193 * (only needed if you use the sequential API, like api_lib.c) 194 */ 195 196 #define MEMP_NUM_NETBUF 16 197 198 /** 199 * MEMP_NUM_NETCONN: the number of struct netconns. 200 * (only needed if you use the sequential API, like api_lib.c) 201 * 202 * This number corresponds to the maximum number of active sockets at any 203 * given point in time. This number must be sum of max. TCP sockets, max. TCP 204 * sockets used for listening, and max. number of UDP sockets 205 */ 206 #define MEMP_NUM_NETCONN (MAX_SOCKETS_TCP + \ 207 MAX_LISTENING_SOCKETS_TCP + MAX_SOCKETS_UDP) 208 209 210 211 /** 212 * PBUF_POOL_SIZE: the number of buffers in the pbuf pool. 213 */ 214 215 //#define PBUF_POOL_SIZE 30 216 217 218 /* 219 ---------------------------------- 220 ---------- Pbuf options ---------- 221 ---------------------------------- 222 */ 223 224 /** 225 * PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. The default is 226 * designed to accomodate single full size TCP frame in one pbuf, including 227 * TCP_MSS, IP header, and link header. 228 */ 229 #define PBUF_POOL_BUFSIZE 500 230 231 232 /* 233 --------------------------------- 234 ---------- RAW options ---------- 235 --------------------------------- 236 */ 237 /** 238 * LWIP_RAW==1: Enable application layer to hook into the IP layer itself. 239 */ 240 #define LWIP_RAW 1 241 #define LWIP_IPV6 0 242 243 /* Enable IPv4 Auto IP */ 244 #ifdef CONFIG_AUTOIP 245 #define LWIP_AUTOIP 1 246 #define LWIP_DHCP_AUTOIP_COOP 1 247 #define LWIP_DHCP_AUTOIP_COOP_TRIES 5 248 #endif 249 250 /* 251 ------------------------------------ 252 ---------- Socket options ---------- 253 ------------------------------------ 254 */ 255 /** 256 * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c) 257 */ 258 #define LWIP_SOCKET 1 259 #define LWIP_NETIF_API 1 260 261 /** 262 * LWIP_RECV_CB==1: Enable callback when a socket receives data. 263 */ 264 #define LWIP_RECV_CB 1 265 /** 266 * SO_REUSE==1: Enable SO_REUSEADDR option. 267 */ 268 #define SO_REUSE 1 269 #define SO_REUSE_RXTOALL 1 270 271 /** 272 * Enable TCP_KEEPALIVE 273 */ 274 #define LWIP_TCP_KEEPALIVE 1 275 276 /** 277 * TCP_SYNMAXRTX: Maximum number of retransmissions of SYN segments. 278 */ 279 #define TCP_SYNMAXRTX 10 280 281 /* 282 ---------------------------------------- 283 ---------- Statistics options ---------- 284 ---------------------------------------- 285 */ 286 /** 287 * LWIP_STATS==1: Enable statistics collection in lwip_stats. 288 */ 289 #define LWIP_STATS 0 290 291 /** 292 * LWIP_STATS_DISPLAY==1: Compile in the statistics output functions. 293 */ 294 #define LWIP_STATS_DISPLAY 0 295 296 /* 297 ---------------------------------- 298 ---------- DHCP options ---------- 299 ---------------------------------- 300 */ 301 /** 302 * LWIP_DHCP==1: Enable DHCP module. 303 */ 304 #define LWIP_DHCP 1 305 #define LWIP_NETIF_STATUS_CALLBACK 1 306 307 /** 308 * DNS related options, revisit later to fine tune. 309 */ 310 #define LWIP_DNS 1 311 #define DNS_TABLE_SIZE 2 // number of table entries, default 4 312 //#define DNS_MAX_NAME_LENGTH 64 // max. name length, default 256 313 #define DNS_MAX_SERVERS 2 // number of DNS servers, default 2 314 #define DNS_DOES_NAME_CHECK 1 // compare received name with given,def 0 315 #define DNS_MSG_SIZE 512 316 #define MDNS_MSG_SIZE 512 317 318 #define MDNS_TABLE_SIZE 1 // number of mDNS table entries 319 #define MDNS_MAX_SERVERS 1 // number of mDNS multicast addresses 320 /* TODO: Number of active UDP PCBs is equal to number of active UDP sockets plus 321 * two. Need to find the users of these 2 PCBs 322 */ 323 #define MEMP_NUM_UDP_PCB (MAX_SOCKETS_UDP + 2) 324 /* NOTE: some times the socket() call for SOCK_DGRAM might fail if you dont 325 * have enough MEMP_NUM_UDP_PCB */ 326 327 /* 328 ---------------------------------- 329 ---------- IGMP options ---------- 330 ---------------------------------- 331 */ 332 /** 333 * LWIP_IGMP==1: Turn on IGMP module. 334 */ 335 #define LWIP_IGMP 1 336 337 /** 338 * LWIP_SO_SNDTIMEO==1: Enable send timeout for sockets/netconns and 339 * SO_SNDTIMEO processing. 340 */ 341 #define LWIP_SO_SNDTIMEO 1 342 343 /** 344 * LWIP_SO_RCVTIMEO==1: Enable receive timeout for sockets/netconns and 345 * SO_RCVTIMEO processing. 346 */ 347 #define LWIP_SO_RCVTIMEO 1 348 #define LWIP_SO_SNDTIMEO 1 349 /** 350 * TCP_LISTEN_BACKLOG==1: Handle backlog connections. 351 */ 352 #define TCP_LISTEN_BACKLOG 1 353 354 //#define LWIP_PROVIDE_ERRNO 1 355 #include <errno.h> 356 #define ERRNO 1 357 358 //#define LWIP_SNMP 1 359 360 361 /* 362 ------------------------------------------------ 363 ---------- Network Interfaces options ---------- 364 ------------------------------------------------ 365 */ 366 /** 367 * LWIP_NETIF_HOSTNAME==1: use DHCP_OPTION_HOSTNAME with netif's hostname 368 * field. 369 */ 370 #define LWIP_NETIF_HOSTNAME 1 371 372 373 /* 374 The STM32F107 allows computing and verifying the IP, UDP, TCP and ICMP checksums by hardware: 375 - To use this feature let the following define uncommented. 376 - To disable it and process by CPU comment the the checksum. 377 */ 378 //#define CHECKSUM_BY_HARDWARE 379 380 381 #ifdef CHECKSUM_BY_HARDWARE 382 /* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/ 383 #define CHECKSUM_GEN_IP 0 384 /* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/ 385 #define CHECKSUM_GEN_UDP 0 386 /* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/ 387 #define CHECKSUM_GEN_TCP 0 388 /* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/ 389 #define CHECKSUM_CHECK_IP 0 390 /* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/ 391 #define CHECKSUM_CHECK_UDP 0 392 /* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/ 393 #define CHECKSUM_CHECK_TCP 0 394 #else 395 /* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/ 396 #define CHECKSUM_GEN_IP 1 397 /* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/ 398 #define CHECKSUM_GEN_UDP 1 399 /* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/ 400 #define CHECKSUM_GEN_TCP 1 401 /* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/ 402 #define CHECKSUM_CHECK_IP 1 403 /* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/ 404 #define CHECKSUM_CHECK_UDP 1 405 /* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/ 406 #define CHECKSUM_CHECK_TCP 1 407 #endif 408 409 /** 410 * TCP_RESOURCE_FAIL_RETRY_LIMIT: limit for retrying sending of tcp segment 411 * on resource failure error returned by driver. 412 */ 413 #define TCP_RESOURCE_FAIL_RETRY_LIMIT 50 414 415 //yhb changed: 416 //#ifdef CONFIG_ENABLE_MXCHIP 417 /* save memory */ 418 #define PBUF_POOL_SIZE 30 419 #define TCP_MSS (1500 - 40) 420 /* TCP receive window. */ 421 #define TCP_WND (3*TCP_MSS) 422 /* TCP sender buffer space (bytes). */ 423 #define TCP_SND_BUF (10*TCP_MSS) 424 425 #define TCP_SND_QUEUELEN (4* TCP_SND_BUF/TCP_MSS) 426 427 /* ARP before DHCP causes multi-second delay - turn it off */ 428 #define DHCP_DOES_ARP_CHECK (0) 429 430 #define TCP_MAX_ACCEPT_CONN 5 431 #define MEMP_NUM_TCP_SEG (TCP_SND_QUEUELEN*2) 432 433 #define IP_REASS_MAX_PBUFS 0 434 #define IP_REASSEMBLY 0 435 #define IP_REASS_MAX_PBUFS 0 436 #define IP_REASSEMBLY 0 437 #define MEMP_NUM_REASSDATA 0 438 #define IP_FRAG 0 439 440 #define MEM_LIBC_MALLOC (1) 441 442 //#define DEFAULT_UDP_RECVMBOX_SIZE 3 // yhb set, each udp socket max buffer 3 packets. 443 444 #define MEMP_MEM_MALLOC (1) 445 #define TCP_MSL (TCP_TMR_INTERVAL) 446 447 #define LWIP_COMPAT_MUTEX_ALLOWED (1) 448 //#endif 449 450 #define TCPIP_MBOX_SIZE 16 451 #define DEFAULT_ACCEPTMBOX_SIZE 8 452 #define DEFAULT_RAW_RECVMBOX_SIZE 4 453 #define DEFAULT_UDP_RECVMBOX_SIZE 20 // 8 454 #define DEFAULT_TCP_RECVMBOX_SIZE 8 455 456 #ifdef CONFIG_AOS_MESH 457 #define LWIP_DECLARE_HOOK \ 458 struct netif *lwip_hook_ip6_route(const ip6_addr_t *src, const ip6_addr_t *dest); \ 459 int lwip_hook_mesh_is_mcast_subscribed(const ip6_addr_t *dest); 460 #define LWIP_HOOK_IP6_ROUTE(src, dest) lwip_hook_ip6_route(src, dest) 461 #define LWIP_HOOK_MESH_IS_MCAST_SUBSCRIBED(dest) lwip_hook_mesh_is_mcast_subscribed(dest) 462 463 #define LWIP_ICMP6 1 464 #define CHECKSUM_CHECK_ICMP6 0 465 #define LWIP_MULTICAST_PING 1 466 467 #endif 468 469 #define LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS 1 470 471 #define TCP_QUEUE_OOSEQ 1 472 473 #endif /* __LWIPOPTS_H__ */ 474 475