• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
36 // lwIP debug options, comment the ones you don't want
37 #if LWIP_DEBUG
38 #define ETHARP_DEBUG                    LWIP_DBG_ON
39 #define NETIF_DEBUG                     LWIP_DBG_ON
40 #define PBUF_DEBUG                      LWIP_DBG_ON
41 #define API_LIB_DEBUG                   LWIP_DBG_ON
42 #define API_MSG_DEBUG                   LWIP_DBG_ON
43 #define SOCKETS_DEBUG                   LWIP_DBG_ON
44 #define ICMP_DEBUG                      LWIP_DBG_ON
45 #define IGMP_DEBUG                      LWIP_DBG_ON
46 #define INET_DEBUG                      LWIP_DBG_ON
47 #define IP_DEBUG                        LWIP_DBG_ON
48 #define DRIVERIF_DEBUG                  LWIP_DBG_ON
49 #define IP_REASS_DEBUG                  LWIP_DBG_ON
50 #define RAW_DEBUG                       LWIP_DBG_ON
51 #define MEM_DEBUG                       LWIP_DBG_ON
52 #define MEMP_DEBUG                      LWIP_DBG_ON
53 #define SYS_DEBUG                       LWIP_DBG_ON
54 #define TIMERS_DEBUG                    LWIP_DBG_ON
55 #define TCP_DEBUG                       LWIP_DBG_ON
56 #define TCP_ERR_DEBUG                   LWIP_DBG_ON
57 #define TCP_INPUT_DEBUG                 LWIP_DBG_ON
58 #define TCP_FR_DEBUG                    LWIP_DBG_ON
59 #define TCP_RTO_DEBUG                   LWIP_DBG_ON
60 #define TCP_CWND_DEBUG                  LWIP_DBG_ON
61 #define TCP_WND_DEBUG                   LWIP_DBG_ON
62 #define TCP_OUTPUT_DEBUG                LWIP_DBG_ON
63 #define TCP_RST_DEBUG                   LWIP_DBG_ON
64 #define TCP_QLEN_DEBUG                  LWIP_DBG_ON
65 #define TCP_SACK_DEBUG                  LWIP_DBG_ON
66 #define TCP_TLP_DEBUG                   LWIP_DBG_ON
67 #define UDP_DEBUG                       LWIP_DBG_ON
68 #define TCPIP_DEBUG                     LWIP_DBG_ON
69 #define SLIP_DEBUG                      LWIP_DBG_ON
70 #define DHCP_DEBUG                      LWIP_DBG_ON
71 #define AUTOIP_DEBUG                    LWIP_DBG_ON
72 #define DNS_DEBUG                       LWIP_DBG_ON
73 #define TFTP_DEBUG                      LWIP_DBG_ON
74 #define SYS_ARCH_DEBUG                  LWIP_DBG_ON
75 #define SNTP_DEBUG                      LWIP_DBG_ON
76 #define IP6_DEBUG                       LWIP_DBG_ON
77 #define DHCP6_DEBUG                     LWIP_DBG_ON
78 #define DRV_STS_DEBUG                   LWIP_DBG_ON
79 #endif
80 
81 
82 // Options only in new opt.h
83 #define LWIP_SOCKET_SELECT              0
84 #define LWIP_SOCKET_POLL                1
85 
86 
87 // Options in old opt.h that differs from new opt.h
88 #define MEM_ALIGNMENT                   __SIZEOF_POINTER__
89 #define MEMP_NUM_NETDB                  8
90 #define IP_REASS_MAXAGE                 3
91 #define IP_SOF_BROADCAST                1
92 #define IP_SOF_BROADCAST_RECV           1
93 #define LWIP_MULTICAST_PING             1
94 #define LWIP_RAW                        1
95 #define LWIP_DHCP_AUTOIP_COOP_TRIES     64
96 #define TCP_LISTEN_BACKLOG              1
97 #define TCP_DEFAULT_LISTEN_BACKLOG      16
98 
99 #define LWIP_WND_SCALE                  1
100 #define TCP_RCV_SCALE                   7
101 
102 #define LWIP_NETIF_HOSTNAME             1
103 #define LWIP_NETIF_TX_SINGLE_PBUF       1
104 #define LWIP_NETCONN_FULLDUPLEX         1 // Caution
105 #define LWIP_COMPAT_SOCKETS             2
106 #define LWIP_POSIX_SOCKETS_IO_NAMES     0
107 #define LWIP_TCP_KEEPALIVE              1
108 #define RECV_BUFSIZE_DEFAULT            65535
109 #define SO_REUSE_RXTOALL                1
110 
111 #define LWIP_CHECKSUM_ON_COPY           1
112 #define LWIP_IPV6                       1
113 #define LWIP_IPV6_NUM_ADDRESSES         5
114 #define LWIP_ND6_NUM_PREFIXES           10
115 #define LWIP_IPV6_DHCP6                 1
116 #define LWIP_IPV6_DHCP6_STATEFUL        1
117 
118 
119 // Options in old lwipopts.h
120 #define ARP_QUEUEING                    1
121 #define DEFAULT_ACCEPTMBOX_SIZE         32
122 #define DEFAULT_RAW_RECVMBOX_SIZE       128
123 #define DEFAULT_TCP_RECVMBOX_SIZE       128
124 #define DEFAULT_UDP_RECVMBOX_SIZE       128
125 #define ETHARP_SUPPORT_STATIC_ENTRIES   1
126 #define ETH_PAD_SIZE                    2
127 #define IP_REASS_MAX_PBUFS              (((65535) / (IP_FRAG_MAX_MTU - 20 - 8) + 1) * MEMP_NUM_REASSDATA)
128 #define LWIP_COMPAT_SOCKETS             2
129 #define LWIP_DBG_MIN_LEVEL              LWIP_DBG_LEVEL_OFF
130 #define LWIP_DHCP                       1
131 #define LWIP_DNS                        1
132 #define LWIP_ETHERNET                   1
133 #define LWIP_HAVE_LOOPIF                1
134 #define LWIP_IGMP                       1
135 #define LWIP_NETIF_API                  1
136 #define LWIP_NETIF_LINK_CALLBACK        1
137 #define LWIP_NETIF_LOOPBACK             1
138 #define LWIP_POSIX_SOCKETS_IO_NAMES     0
139 #define LWIP_RAW                        1
140 #define LWIP_SOCKET_OFFSET              CONFIG_NFILE_DESCRIPTORS
141 #define LWIP_SO_RCVBUF                  1
142 #define LWIP_SO_RCVTIMEO                1
143 #define LWIP_SO_SNDTIMEO                1
144 #define LWIP_STATS_DISPLAY              1
145 #define MEM_LIBC_MALLOC                 1
146 #define MEMP_NUM_ARP_QUEUE              (65535 * LWIP_CONFIG_NUM_SOCKETS / (IP_FRAG_MAX_MTU - 20 - 8))
147 #define MEMP_NUM_NETBUF                 (65535 * 3 * LWIP_CONFIG_NUM_SOCKETS / (IP_FRAG_MAX_MTU - 20 - 8))
148 #define MEMP_NUM_NETCONN                LWIP_CONFIG_NUM_SOCKETS
149 #define MEMP_NUM_PBUF                   LWIP_CONFIG_NUM_SOCKETS*2
150 #define MEMP_NUM_RAW_PCB                LWIP_CONFIG_NUM_SOCKETS
151 #define MEMP_NUM_REASSDATA              (IP_REASS_MAX_MEM_SIZE / 65535)
152 #define MEMP_NUM_TCPIP_MSG_API          64
153 #define MEMP_NUM_TCPIP_MSG_INPKT        512
154 #define MEMP_NUM_TCP_PCB                LWIP_CONFIG_NUM_SOCKETS
155 #define MEMP_NUM_TCP_PCB_LISTEN         LWIP_CONFIG_NUM_SOCKETS
156 #define MEMP_NUM_TCP_SEG                (((TCP_SND_BUF * 3 / 2) + TCP_WND) * LWIP_CONFIG_NUM_SOCKETS / TCP_MSS)
157 #define MEMP_NUM_UDP_PCB                LWIP_CONFIG_NUM_SOCKETS
158 #define MEM_SIZE                        (4*1024*1024) // (512*1024)
159 #define PBUF_POOL_BUFSIZE               1550
160 #define PBUF_POOL_SIZE                  64
161 #define SO_REUSE                        1
162 #define TCPIP_MBOX_SIZE                 512
163 #define TCPIP_THREAD_PRIO               5
164 #define TCPIP_THREAD_STACKSIZE          0x6000
165 #define TCP_MAXRTX                      64
166 #define TCP_MSS                         1400
167 #define TCP_SND_BUF                     65535
168 #define TCP_SND_QUEUELEN                (8 * TCP_SND_BUF) / TCP_MSS
169 #define TCP_TTL                         255
170 #define TCP_WND                         32768
171 #define UDP_TTL                         255
172 
173 
174 // Options in old lwipopts.h but kept in Defaults with new opt.h
175 #define IP_FORWARD                      0
176 #define LWIP_DBG_TYPES_ON               LWIP_DBG_ON
177 #define LWIP_ICMP                       1
178 #define LWIP_NETCONN                    1
179 #define LWIP_SOCKET                     1
180 #define LWIP_STATS                      1
181 #define LWIP_TCP                        1
182 #define LWIP_UDP                        1
183 #define NO_SYS                          0
184 #define TCP_QUEUE_OOSEQ                 LWIP_TCP
185 
186 
187 // Change some options for lwIP 2.1.2
188 #undef TCP_MAXRTX
189 #define TCP_MAXRTX                      12
190 
191 #undef LWIP_COMPAT_SOCKETS
192 #define LWIP_COMPAT_SOCKETS             0
193 
194 #define MEMP_NUM_SYS_TIMEOUT            (LWIP_NUM_SYS_TIMEOUT_INTERNAL + (LWIP_IPV6 * LWIP_IPV6_DHCP6))
195 
196 #undef DEFAULT_ACCEPTMBOX_SIZE
197 #define DEFAULT_ACCEPTMBOX_SIZE         LWIP_CONFIG_NUM_SOCKETS
198 
199 #undef TCP_MSS
200 #define TCP_MSS                         (IP_FRAG_MAX_MTU - 20 - 20)
201 
202 #undef IP_SOF_BROADCAST_RECV
203 #define IP_SOF_BROADCAST_RECV           0
204 
205 /**
206  * Defines whether to enable debugging for driver module.
207  */
208 #ifndef DRIVERIF_DEBUG
209 #define DRIVERIF_DEBUG                  LWIP_DBG_OFF
210 #endif
211 
212 
213 // Options for old lwipopts.h
214 #define IP_FRAG_MAX_MTU                 1500
215 #define LWIP_CONFIG_NUM_SOCKETS         128
216 #define IP_REASS_MAX_MEM_SIZE           (MEM_SIZE / 4)
217 
218 // Options for enhancement code, same for old lwipopts.h
219 #define LWIP_NETIF_PROMISC              1
220 #define LWIP_DHCPS                      1
221 #define LWIP_ENABLE_NET_CAPABILITY      1
222 #define LWIP_ENABLE_CAP_NET_BROADCAST   0
223 
224 #endif /* _LWIP_PORTING_LWIPOPTS_H_ */
225