1 /* 2 * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. 3 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 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, this list of 9 * conditions and the following disclaimer. 10 * 11 * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 * of conditions and the following disclaimer in the documentation and/or other materials 13 * provided with the distribution. 14 * 15 * 3. Neither the name of the copyright holder nor the names of its contributors may be used 16 * to endorse or promote products derived from this software without specific prior written 17 * permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 26 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32 #ifndef _LWIP_PORTING_LWIPOPTS_H_ 33 #define _LWIP_PORTING_LWIPOPTS_H_ 34 35 // lwIP debug options, comment the ones you don't want 36 #define LWIP_DEBUG 0 37 #if LWIP_DEBUG 38 #define ETHARP_DEBUG LWIP_DBG_OFF 39 #define NETIF_DEBUG LWIP_DBG_OFF 40 #define PBUF_DEBUG LWIP_DBG_OFF 41 #define API_LIB_DEBUG LWIP_DBG_OFF 42 #define API_MSG_DEBUG LWIP_DBG_OFF 43 #define SOCKETS_DEBUG LWIP_DBG_OFF 44 #define ICMP_DEBUG LWIP_DBG_OFF 45 #define IGMP_DEBUG LWIP_DBG_OFF 46 #define INET_DEBUG LWIP_DBG_OFF 47 #define IP_DEBUG LWIP_DBG_OFF 48 #define DRIVERIF_DEBUG LWIP_DBG_OFF 49 #define IP_REASS_DEBUG LWIP_DBG_OFF 50 #define RAW_DEBUG LWIP_DBG_OFF 51 #define MEM_DEBUG LWIP_DBG_OFF 52 #define MEMP_DEBUG LWIP_DBG_OFF 53 #define SYS_DEBUG LWIP_DBG_OFF 54 #define TIMERS_DEBUG LWIP_DBG_OFF 55 #define TCP_DEBUG LWIP_DBG_OFF 56 #define TCP_ERR_DEBUG LWIP_DBG_OFF 57 #define TCP_INPUT_DEBUG LWIP_DBG_OFF 58 #define TCP_FR_DEBUG LWIP_DBG_OFF 59 #define TCP_RTO_DEBUG LWIP_DBG_OFF 60 #define TCP_CWND_DEBUG LWIP_DBG_OFF 61 #define TCP_WND_DEBUG LWIP_DBG_OFF 62 #define TCP_OUTPUT_DEBUG LWIP_DBG_OFF 63 #define TCP_RST_DEBUG LWIP_DBG_OFF 64 #define TCP_QLEN_DEBUG LWIP_DBG_OFF 65 #define TCP_SACK_DEBUG LWIP_DBG_OFF 66 #define TCP_TLP_DEBUG LWIP_DBG_OFF 67 #define UDP_DEBUG LWIP_DBG_OFF 68 #define TCPIP_DEBUG LWIP_DBG_OFF 69 #define SLIP_DEBUG LWIP_DBG_OFF 70 #define DHCP_DEBUG LWIP_DBG_OFF 71 #define AUTOIP_DEBUG LWIP_DBG_OFF 72 #define DNS_DEBUG LWIP_DBG_OFF 73 #define TFTP_DEBUG LWIP_DBG_OFF 74 #define SYS_ARCH_DEBUG LWIP_DBG_OFF 75 #define SNTP_DEBUG LWIP_DBG_OFF 76 #define IP6_DEBUG LWIP_DBG_OFF 77 #define DHCP6_DEBUG LWIP_DBG_OFF 78 #define DRV_STS_DEBUG LWIP_DBG_OFF 79 #endif 80 81 // Options only in new opt.h 82 #define LWIP_SOCKET_SELECT 0 83 #define LWIP_SOCKET_POLL 1 84 85 // Options in old opt.h that differs from new opt.h 86 #define MEM_ALIGNMENT __SIZEOF_POINTER__ 87 #define MEMP_NUM_NETDB 8 88 #define IP_REASS_MAXAGE 3 89 #define IP_SOF_BROADCAST 1 90 #define IP_SOF_BROADCAST_RECV 1 91 #define LWIP_MULTICAST_PING 1 92 #define LWIP_RAW 1 93 #define LWIP_DHCP_AUTOIP_COOP_TRIES 64 94 #define TCP_LISTEN_BACKLOG 1 95 #define TCP_DEFAULT_LISTEN_BACKLOG 16 96 97 #define LWIP_WND_SCALE 1 98 #define TCP_RCV_SCALE 7 99 100 #define LWIP_NETIF_HOSTNAME 1 101 #define LWIP_NETIF_TX_SINGLE_PBUF 1 102 #define LWIP_NETCONN_FULLDUPLEX 1 // Caution 103 #define LWIP_COMPAT_SOCKETS 2 104 #define LWIP_POSIX_SOCKETS_IO_NAMES 0 105 #define LWIP_TCP_KEEPALIVE 1 106 #define RECV_BUFSIZE_DEFAULT 65535 107 #define SO_REUSE_RXTOALL 1 108 109 #define LWIP_CHECKSUM_ON_COPY 1 110 #define LWIP_IPV6 1 111 #define LWIP_IPV6_NUM_ADDRESSES 5 112 #define LWIP_ND6_NUM_PREFIXES 10 113 #define LWIP_IPV6_DHCP6 1 114 #define LWIP_IPV6_DHCP6_STATEFUL 1 115 116 // Options in old lwipopts.h 117 #define ARP_QUEUEING 1 118 #define DEFAULT_ACCEPTMBOX_SIZE 32 119 #define DEFAULT_RAW_RECVMBOX_SIZE 128 120 #define DEFAULT_TCP_RECVMBOX_SIZE 128 121 #define DEFAULT_UDP_RECVMBOX_SIZE 128 122 #define ETHARP_SUPPORT_STATIC_ENTRIES 1 123 #define ETH_PAD_SIZE 0 124 #define IP_REASS_MAX_PBUFS (((65535) / (IP_FRAG_MAX_MTU - 20 - 8) + 1) * MEMP_NUM_REASSDATA) 125 #define LWIP_COMPAT_SOCKETS 2 126 #define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_OFF 127 #define LWIP_DHCP 1 128 #define LWIP_DNS 1 129 #define LWIP_ETHERNET 1 130 #define LWIP_HAVE_LOOPIF 1 131 #define LWIP_IGMP 1 132 #define LWIP_NETIF_API 1 133 #define LWIP_NETIF_LINK_CALLBACK 1 134 #define LWIP_NETIF_LOOPBACK 1 135 #define LWIP_POSIX_SOCKETS_IO_NAMES 0 136 #define LWIP_RAW 1 137 #define LWIP_SO_RCVBUF 1 138 #define LWIP_SO_RCVTIMEO 1 139 #define LWIP_SO_SNDTIMEO 1 140 #define LWIP_STATS_DISPLAY 1 141 #define MEM_LIBC_MALLOC 1 142 #define MEMP_NUM_ARP_QUEUE (65535 * LWIP_CONFIG_NUM_SOCKETS / (IP_FRAG_MAX_MTU - 20 - 8)) 143 #define MEMP_NUM_NETBUF (65535 * 3 * LWIP_CONFIG_NUM_SOCKETS / (IP_FRAG_MAX_MTU - 20 - 8)) 144 #define MEMP_NUM_NETCONN LWIP_CONFIG_NUM_SOCKETS 145 #define MEMP_NUM_PBUF ((LWIP_CONFIG_NUM_SOCKETS) * 2) 146 #define MEMP_NUM_RAW_PCB LWIP_CONFIG_NUM_SOCKETS 147 #define MEMP_NUM_REASSDATA (IP_REASS_MAX_MEM_SIZE / 65535) 148 #define MEMP_NUM_TCPIP_MSG_API 64 149 #define MEMP_NUM_TCPIP_MSG_INPKT 512 150 #define MEMP_NUM_TCP_PCB LWIP_CONFIG_NUM_SOCKETS 151 #define MEMP_NUM_TCP_PCB_LISTEN LWIP_CONFIG_NUM_SOCKETS 152 #define MEMP_NUM_TCP_SEG (((TCP_SND_BUF * 3 / 2) + TCP_WND) * LWIP_CONFIG_NUM_SOCKETS / TCP_MSS) 153 #define MEMP_NUM_UDP_PCB LWIP_CONFIG_NUM_SOCKETS 154 #define MEM_SIZE (4*1024*1024) // (512*1024) 155 #define PBUF_POOL_BUFSIZE 1550 156 #define PBUF_POOL_SIZE 64 157 #define SO_REUSE 1 158 #define TCPIP_MBOX_SIZE 512 159 #define TCPIP_THREAD_PRIO 5 160 #define TCPIP_THREAD_STACKSIZE 0x6000 161 #define TCP_MAXRTX 64 162 #define TCP_MSS 1400 163 #define TCP_SND_BUF 65535 164 #define TCP_SND_QUEUELEN ((8 * (TCP_SND_BUF)) / (TCP_MSS)) 165 #define TCP_TTL 255 166 #define TCP_WND 32768 167 #define UDP_TTL 255 168 169 // Options in old lwipopts.h but kept in Defaults with new opt.h 170 #define IP_FORWARD 0 171 #define LWIP_DBG_TYPES_ON LWIP_DBG_ON 172 #define LWIP_ICMP 1 173 #define LWIP_NETCONN 1 174 #define LWIP_SOCKET 1 175 #define LWIP_STATS 1 176 #define LWIP_TCP 1 177 #define LWIP_UDP 1 178 #define NO_SYS 0 179 #define TCP_QUEUE_OOSEQ LWIP_TCP 180 181 // Change some options for lwIP 2.1.2 182 #undef TCP_MAXRTX 183 #define TCP_MAXRTX 12 184 185 #undef LWIP_COMPAT_SOCKETS 186 #define LWIP_COMPAT_SOCKETS 0 187 188 #define MEMP_NUM_SYS_TIMEOUT (LWIP_NUM_SYS_TIMEOUT_INTERNAL + (LWIP_IPV6 * LWIP_IPV6_DHCP6)) 189 190 #undef DEFAULT_ACCEPTMBOX_SIZE 191 #define DEFAULT_ACCEPTMBOX_SIZE LWIP_CONFIG_NUM_SOCKETS 192 193 #undef TCP_MSS 194 #define TCP_MSS (IP_FRAG_MAX_MTU - 20 - 20) 195 196 #undef IP_SOF_BROADCAST_RECV 197 #define IP_SOF_BROADCAST_RECV 0 198 199 /** 200 * Defines whether to enable debugging for driver module. 201 */ 202 #ifndef DRIVERIF_DEBUG 203 #define DRIVERIF_DEBUG LWIP_DBG_OFF 204 #endif 205 206 // Options for old lwipopts.h 207 #define IP_FRAG_MAX_MTU 1500 208 #define LWIP_CONFIG_NUM_SOCKETS 128 209 #define IP_REASS_MAX_MEM_SIZE (MEM_SIZE / 4) 210 211 // Options for enhancement code, same for old lwipopts.h 212 #define LWIP_NETIF_PROMISC 1 213 #define LWIP_TFTP LOSCFG_NET_LWIP_SACK_TFTP 214 #define LWIP_DHCPS 1 215 #define LWIP_ENABLE_NET_CAPABILITY 1 216 #define LWIP_ENABLE_CAP_NET_BROADCAST 0 217 218 // Options for liteos_m 219 #undef LWIP_NETIF_PROMISC 220 #define LWIP_NETIF_PROMISC 0 221 222 #define MEMP_MEM_MALLOC 1 223 224 #undef LWIP_IPV6 225 #define LWIP_IPV6 0 226 227 #undef LWIP_SOCKET_SELECT 228 #define LWIP_SOCKET_SELECT 1 229 230 // use PBUF_RAM instead of PBUF_POOL in udp_input 231 #define USE_PBUF_RAM_UDP_INPUT 1 232 233 #ifdef LOSCFG_FS_VFS 234 #include "vfs_config.h" 235 #define LWIP_SOCKET_OFFSET CONFIG_NFILE_DESCRIPTORS 236 #endif 237 238 #endif /* _LWIP_PORTING_LWIPOPTS_H_ */ 239