• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2022 Huawei Technologies Co., Ltd. All rights reserved.
3  *
4  * UniProton is licensed under Mulan PSL v2.
5  * You can use this software according to the terms and conditions of the Mulan PSL v2.
6  * You may obtain a copy of Mulan PSL v2 at:
7  *          http://license.coscl.org.cn/MulanPSL2
8  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
9  * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
10  * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
11  * See the Mulan PSL v2 for more details.
12  * Create: 2022-09-21
13  * Description: 网络
14  */
15 #ifndef LWIP_PORTING_LWIPOPTS_H
16 #define LWIP_PORTING_LWIPOPTS_H
17 
18 #include "prt_config.h"
19 
20 // lwIP debug options, comment the ones you don't want
21 #define LWIP_DEBUG 1
22 #if LWIP_DEBUG
23 #define ETHARP_DEBUG                    LWIP_DBG_OFF
24 #define NETIF_DEBUG                     LWIP_DBG_OFF
25 #define PBUF_DEBUG                      LWIP_DBG_OFF
26 #define API_LIB_DEBUG                   LWIP_DBG_OFF
27 #define API_MSG_DEBUG                   LWIP_DBG_OFF
28 #define SOCKETS_DEBUG                   LWIP_DBG_OFF
29 #define ICMP_DEBUG                      LWIP_DBG_OFF
30 #define IGMP_DEBUG                      LWIP_DBG_OFF
31 #define INET_DEBUG                      LWIP_DBG_OFF
32 #define IP_DEBUG                        LWIP_DBG_OFF
33 #define DRIVERIF_DEBUG                  LWIP_DBG_OFF
34 #define IP_REASS_DEBUG                  LWIP_DBG_OFF
35 #define RAW_DEBUG                       LWIP_DBG_OFF
36 #define MEM_DEBUG                       LWIP_DBG_OFF
37 #define MEMP_DEBUG                      LWIP_DBG_OFF
38 #define SYS_DEBUG                       LWIP_DBG_ON
39 #define TIMERS_DEBUG                    LWIP_DBG_OFF
40 #define TCP_DEBUG                       LWIP_DBG_OFF
41 #define TCP_ERR_DEBUG                   LWIP_DBG_OFF
42 #define TCP_INPUT_DEBUG                 LWIP_DBG_OFF
43 #define TCP_FR_DEBUG                    LWIP_DBG_OFF
44 #define TCP_RTO_DEBUG                   LWIP_DBG_OFF
45 #define TCP_CWND_DEBUG                  LWIP_DBG_OFF
46 #define TCP_WND_DEBUG                   LWIP_DBG_OFF
47 #define TCP_OUTPUT_DEBUG                LWIP_DBG_OFF
48 #define TCP_RST_DEBUG                   LWIP_DBG_OFF
49 #define TCP_QLEN_DEBUG                  LWIP_DBG_OFF
50 #define TCP_SACK_DEBUG                  LWIP_DBG_OFF
51 #define TCP_TLP_DEBUG                   LWIP_DBG_OFF
52 #define UDP_DEBUG                       LWIP_DBG_OFF
53 #define TCPIP_DEBUG                     LWIP_DBG_OFF
54 #define SLIP_DEBUG                      LWIP_DBG_OFF
55 #define DHCP_DEBUG                      LWIP_DBG_OFF
56 #define AUTOIP_DEBUG                    LWIP_DBG_OFF
57 #define DNS_DEBUG                       LWIP_DBG_OFF
58 #define TFTP_DEBUG                      LWIP_DBG_OFF
59 #define SYS_ARCH_DEBUG                  LWIP_DBG_OFF
60 #define SNTP_DEBUG                      LWIP_DBG_OFF
61 #define IP6_DEBUG                       LWIP_DBG_OFF
62 #define DHCP6_DEBUG                     LWIP_DBG_OFF
63 #define DRV_STS_DEBUG                   LWIP_DBG_OFF
64 #endif
65 
66 // Options only in new opt.h
67 #define LWIP_SOCKET_SELECT              1
68 #define LWIP_SOCKET_POLL                1
69 
70 // Options in old opt.h that differs from new opt.h
71 #define MEM_ALIGNMENT                   __SIZEOF_POINTER__
72 #define MEMP_NUM_NETDB                  8
73 #define IP_REASS_MAXAGE                 3
74 #define IP_SOF_BROADCAST                1
75 #define IP_SOF_BROADCAST_RECV           1
76 #define LWIP_MULTICAST_PING             1
77 #define LWIP_RAW                        1
78 #define LWIP_DHCP_AUTOIP_COOP_TRIES     64
79 #define TCP_LISTEN_BACKLOG              1
80 #define TCP_DEFAULT_LISTEN_BACKLOG      16
81 
82 #define LWIP_WND_SCALE                  1
83 #define TCP_RCV_SCALE                   7
84 
85 #define LWIP_NETIF_HOSTNAME             1
86 #define LWIP_NETIF_TX_SINGLE_PBUF       1
87 #define LWIP_NETCONN_FULLDUPLEX         1
88 #define LWIP_COMPAT_SOCKETS             2
89 #define LWIP_POSIX_SOCKETS_IO_NAMES     0
90 #define LWIP_TCP_KEEPALIVE              1
91 #define RECV_BUFSIZE_DEFAULT            65535
92 #define SO_REUSE_RXTOALL                1
93 
94 #define LWIP_CHECKSUM_ON_COPY           1
95 #ifndef LWIP_IPV6
96 #define LWIP_IPV6                       1
97 #endif
98 #define LWIP_IPV6_NUM_ADDRESSES         5
99 #define LWIP_ND6_NUM_PREFIXES           10
100 #define LWIP_IPV6_DHCP6                 1
101 #define LWIP_IPV6_DHCP6_STATEFUL        1
102 
103 // Options in old lwipopts.h
104 #define ARP_QUEUEING                    1
105 #define DEFAULT_ACCEPTMBOX_SIZE         32
106 #define DEFAULT_RAW_RECVMBOX_SIZE       128
107 #define DEFAULT_TCP_RECVMBOX_SIZE       128
108 #define DEFAULT_UDP_RECVMBOX_SIZE       128
109 #define ETHARP_SUPPORT_STATIC_ENTRIES   1
110 #define ETH_PAD_SIZE                    0
111 #define IP_REASS_MAX_PBUFS              (((65535) / (IP_FRAG_MAX_MTU - 20 - 8) + 1) * MEMP_NUM_REASSDATA)
112 #define LWIP_COMPAT_SOCKETS             2
113 #define LWIP_DBG_MIN_LEVEL              LWIP_DBG_LEVEL_OFF
114 #ifndef LWIP_DHCP
115 #define LWIP_DHCP                       0
116 #endif
117 #define LWIP_DNS                        1
118 #define LWIP_ETHERNET                   1
119 #define LWIP_HAVE_LOOPIF                1
120 #define LWIP_IGMP                       1
121 #define LWIP_NETIF_API                  1
122 #define LWIP_NETIF_LINK_CALLBACK        1
123 #define LWIP_NETIF_LOOPBACK             1
124 #define LWIP_POSIX_SOCKETS_IO_NAMES     0
125 #define LWIP_RAW                        1
126 #define LWIP_SO_RCVBUF                  1
127 #define LWIP_SO_RCVTIMEO                1
128 #define LWIP_SO_SNDTIMEO                1
129 #define LWIP_STATS_DISPLAY              1
130 #define MEM_LIBC_MALLOC                 1
131 #define MEMP_NUM_ARP_QUEUE              (65535 * LWIP_CONFIG_NUM_SOCKETS / (IP_FRAG_MAX_MTU - 20 - 8))
132 #define MEMP_NUM_NETBUF                 (65535 * 3 * LWIP_CONFIG_NUM_SOCKETS / (IP_FRAG_MAX_MTU - 20 - 8))
133 #define MEMP_NUM_NETCONN                LWIP_CONFIG_NUM_SOCKETS
134 #define MEMP_NUM_PBUF                   (LWIP_CONFIG_NUM_SOCKETS*2)
135 #define MEMP_NUM_RAW_PCB                LWIP_CONFIG_NUM_SOCKETS
136 #define MEMP_NUM_REASSDATA              (IP_REASS_MAX_MEM_SIZE / 65535)
137 #define MEMP_NUM_TCPIP_MSG_API          64
138 #define MEMP_NUM_TCPIP_MSG_INPKT        512
139 #define MEMP_NUM_TCP_PCB                LWIP_CONFIG_NUM_SOCKETS
140 #define MEMP_NUM_TCP_PCB_LISTEN         LWIP_CONFIG_NUM_SOCKETS
141 #define MEMP_NUM_TCP_SEG                (((TCP_SND_BUF * 3 / 2) + TCP_WND) * LWIP_CONFIG_NUM_SOCKETS / TCP_MSS)
142 #define MEMP_NUM_UDP_PCB                LWIP_CONFIG_NUM_SOCKETS
143 #define MEM_SIZE                        (4*1024*1024)
144 #define PBUF_POOL_BUFSIZE               1550
145 #define PBUF_POOL_SIZE                  64
146 #define SO_REUSE                        1
147 #define TCPIP_MBOX_SIZE                 512
148 #define TCPIP_THREAD_PRIO               5
149 #define TCPIP_THREAD_STACKSIZE          0x800
150 #define TCP_MAXRTX                      64
151 #define TCP_MSS                         1400
152 #define TCP_SND_BUF                     65535
153 #define TCP_SND_QUEUELEN                ((8 * TCP_SND_BUF) / TCP_MSS)
154 #define TCP_TTL                         255
155 #define TCP_WND                         32768
156 #define UDP_TTL                         255
157 
158 // Options in old lwipopts.h but kept in Defaults with new opt.h
159 #define IP_FORWARD                      0
160 #define LWIP_DBG_TYPES_ON               LWIP_DBG_ON
161 #define LWIP_ICMP                       1
162 #define LWIP_NETCONN                    1
163 #define LWIP_SOCKET                     1
164 #define LWIP_STATS                      1
165 #define LWIP_TCP                        1
166 #define LWIP_UDP                        1
167 #define NO_SYS                          0
168 #define TCP_QUEUE_OOSEQ                 LWIP_TCP
169 
170 #if defined LWIP_STATS_DISPLAY && !LWIP_STATS
171 #undef LWIP_STATS_DISPLAY
172 #define LWIP_STATS_DISPLAY              0
173 #endif
174 
175 // Change some options for lwIP 2.1.2
176 #undef TCP_MAXRTX
177 #define TCP_MAXRTX                      12
178 
179 #undef LWIP_COMPAT_SOCKETS
180 #define LWIP_COMPAT_SOCKETS             0
181 
182 #define MEMP_NUM_SYS_TIMEOUT            (LWIP_NUM_SYS_TIMEOUT_INTERNAL + (LWIP_IPV6 * LWIP_IPV6_DHCP6))
183 
184 #undef DEFAULT_ACCEPTMBOX_SIZE
185 #define DEFAULT_ACCEPTMBOX_SIZE         LWIP_CONFIG_NUM_SOCKETS
186 
187 #undef TCP_MSS
188 #define TCP_MSS                         (IP_FRAG_MAX_MTU - 20 - 20)
189 
190 #undef IP_SOF_BROADCAST_RECV
191 #define IP_SOF_BROADCAST_RECV           0
192 
193 /**
194  * Defines whether to enable debugging for driver module.
195  */
196 #ifndef DRIVERIF_DEBUG
197 #define DRIVERIF_DEBUG                  LWIP_DBG_OFF
198 #endif
199 
200 // Options for old lwipopts.h
201 #define IP_FRAG_MAX_MTU                 1500
202 #define LWIP_CONFIG_NUM_SOCKETS         128
203 #define IP_REASS_MAX_MEM_SIZE           (MEM_SIZE / 4)
204 
205 // Options for enhancement code, same for old lwipopts.h
206 #define LWIP_NETIF_PROMISC              0
207 #define LWIP_TFTP                       1
208 #define LWIP_DHCPS                      1
209 #define LWIP_ENABLE_NET_CAPABILITY      1
210 #define LWIP_ENABLE_CAP_NET_BROADCAST   0
211 
212 #define MEMP_MEM_MALLOC                 1
213 
214 // Options for TcpTestSelect
215 #define LWIP_SOCKET_SELECT_FUNC         1
216 
217 // Options for TcpTestPoll
218 #define LWIP_SOCKET_POLL_FUNC           1
219 
220 // use PBUF_RAM instead of PBUF_POOL in udp_input
221 #define USE_PBUF_RAM_UDP_INPUT          1
222 
223 #endif /* LWIP_PORTING_LWIPOPTS_H */
224