2 # define __LWIPOPTS_H__
4 # define LWIP_CALLBACK_API 1
5 /* ---------- Memory options ---------- */
6 /* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
7 lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
8 byte alignment -> define MEM_ALIGNMENT to 2. */
9 # define MEM_ALIGNMENT 4
11 /* MEM_SIZE: the size of the heap memory. If the application will send
12 a lot of data that needs to be copied, this should be set high. */
14 #define MEM_SIZE 0x400
16 #define MEM_SIZE 0x3000
19 /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
20 sends a lot of data out of ROM (or other static memory), this
21 should be set high. */
23 #define MEMP_NUM_PBUF 10
25 #define MEMP_NUM_PBUF 40
28 /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
29 per active UDP "connection". */
31 #define MEMP_NUM_UDP_PCB 1
33 #define MEMP_NUM_UDP_PCB 15
36 /* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
39 #define MEMP_NUM_TCP_PCB 1
41 #define MEMP_NUM_TCP_PCB 15
44 /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
47 #define MEMP_NUM_TCP_PCB_LISTEN 1
49 #define MEMP_NUM_TCP_PCB_LISTEN 15
52 /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
55 #define MEMP_NUM_TCP_SEG 15
57 #define MEMP_NUM_TCP_SEG 40
60 /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
62 #define MEMP_NUM_SYS_TIMEOUT 5
64 /* The following four are used only with the sequential API and can be
65 set to 0 if the application only will use the raw API. */
66 /* MEMP_NUM_NETBUF: the number of struct netbufs. */
68 #define MEMP_NUM_NETBUF 5
70 #define MEMP_NUM_NETBUF 15
73 /* MEMP_NUM_NETCONN: the number of struct netconns. */
75 #define MEMP_NUM_NETCONN 1
77 #define MEMP_NUM_NETCONN 15
80 /* MEMP_NUM_APIMSG: the number of struct api_msg, used for
81 communication between the TCP/IP stack and the sequential
84 #define MEMP_NUM_API_MSG 5
86 #define MEMP_NUM_API_MSG 40
89 /* MEMP_NUM_TCPIPMSG: the number of struct tcpip_msg, which is used
90 for sequential API communication and incoming packets. Used in
93 #define MEMP_NUM_TCPIP_MSG 15
95 #define MEMP_NUM_TCPIP_MSG 40
98 /* ---------- Pbuf options ---------- */
99 /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
101 #define PBUF_POOL_SIZE 5
103 #define PBUF_POOL_SIZE 25
106 /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
107 //Boman666: Should be atleast 1518 to be compatible with ps2smap
108 #define PBUF_POOL_BUFSIZE 1540
110 /* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
111 link level header. */
112 /* MRB: This needs to be the actual size so that pbuf's are aligned properly. */
113 #define PBUF_LINK_HLEN 14
115 /** SYS_LIGHTWEIGHT_PROT
116 * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
117 * for certain critical regions during buffer allocation, deallocation and
118 * memory allocation and deallocation.
120 #define SYS_LIGHTWEIGHT_PROT 1
122 /* ---------- TCP options ---------- */
126 /* Controls if TCP should queue segments that arrive out of
127 order. Define to 0 if your device is low on memory. */
128 #define TCP_QUEUE_OOSEQ 0
130 /* TCP Maximum segment size. */
133 /* TCP sender buffer space (bytes). */
134 #define TCP_SND_BUF (TCP_MSS*2)
136 /* TCP sender buffer space (pbufs). This must be at least = 2 *
137 TCP_SND_BUF/TCP_MSS for things to work. */
138 #define TCP_SND_QUEUELEN (2*TCP_SND_BUF/TCP_MSS)
140 /* TCP receive window. */
147 /* Maximum number of retransmissions of data segments. */
148 #define TCP_MAXRTX 12
150 /* Maximum number of retransmissions of SYN segments. */
151 #define TCP_SYNMAXRTX 4
153 /* TCP writable space (bytes). This must be less than or equal
154 to TCP_SND_BUF. It is the amount of space which must be
155 available in the tcp snd_buf for select to return writable */
156 #define TCP_SNDLOWAT (TCP_SND_BUF/2)
158 /* ----- TCPIP thread priority ----- */
159 //#ifdef INGAME_DRIVER
160 //#define TCPIP_THREAD_PRIO 16
162 #define TCPIP_THREAD_PRIO 1
165 /* ---------- ARP options ---------- */
167 #define ARP_TABLE_SIZE 2
169 #define ARP_TABLE_SIZE 10
171 #define ARP_QUEUEING 1
173 /* ---------- IP options ---------- */
174 /* Define IP_FORWARD to 1 if you wish to have the ability to forward
175 IP packets across network interfaces. If you are going to run lwIP
176 on a device with only one network interface, define this to 0. */
179 /* IP reassembly and segmentation. These are orthogonal even
180 if they both deal with IP fragments */
181 #define IP_REASSEMBLY 1
184 /* ---------- ICMP options ---------- */
188 /* ---------- DHCP options ---------- */
189 /* Define LWIP_DHCP to 1 if you want DHCP configuration of
190 interfaces. DHCP is not implemented in lwIP 0.5.1, however, so
191 turning this on does currently not work. */
197 /* 1 if you want to do an ARP check on the offered address
199 #define DHCP_DOES_ARP_CHECK 1
204 #define DHCP_DOES_ARP_CHECK 0
208 /* ---------- UDP options ---------- */
217 /* ---------- Statistics options ---------- */
223 #define IPFRAG_STATS 1
232 #endif /*LWIP_STATS*/
234 //Boman666: This define will force the TX-data to be splitted in an even number of TCP-segments. This will significantly increase
235 //the upload speed, atleast on my configuration (PC - WinXP).
236 //#define PS2IP_EVEN_TCP_SEG
238 // It is a normal TCP behaviour that small data are delayed. This is
239 // Nagle's algorithm. If you don't want it there's a legal way of
240 // preventing delayed data which is the TCP_NODELAY option.
242 // I'm not really sure, here are my thoughts about Boman666's patch:
244 // - This patch hard-breaks (compile time define) this old grandma-TCP
245 // behaviour, I'm not sure it is safe.
247 // - I suspect a possible loss of performance (I have experienced a 1/7
248 // waste time on a not only networking algorithm) because in case
249 // that ps2 has to send small packets (sort of response to a query)
250 // of 2N bytes length, two packets of N bytes size are sent. Which is
251 // more overhead: 2*(40+N bytes + latency) instead of (40+2N +
254 // - I am aware that this patch improves other things, and I have not
255 // tested this myself yet.
257 // - I don't really understand the effects of this patch:
258 // My understanding is that XP ("this" XP stack used with "this"
259 // protocol, check iop/tcpip/lwip/src/core/tcp_out.c) needs ps2 TCP
260 // acks to work efficiently (to send more quickly not waiting TCP
263 // - I provide two runtime setsockopt()-configurable replacements
265 // In replacement, and to make people test with their apps, I added two
266 // new socket (TCP level) options which are:
268 // - TCP_EVENSEG - it re-enables the original Boman666's patch
269 // - TCP_ACKNODELAY - This option forces an ack to be sent
270 // at every data packet received.
271 // To activate or not these option *at runtime* (not compile time), use the same
272 // syntax as standard TCP_NODELAY:
273 // int ret, value = 1; /* or 0 */
274 // ret = lwip_setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value));
275 // To read option value:
277 // int valuesize = sizeof(value);
278 // ret = lwip_getsockopt(socket, IPPROTO_TCP, TCP_NODELAY, &value, &valuesize);
279 // printf("TCP_ACKNODELAY state: %i\n", ret == 0? value: -1);
281 // setsockopt/getsockopt are POSIX, manual is available everywhere. They were not
282 // exported in ps2ip symbol list, I've added them.
283 // One should check performance penalty or improvement by activating any combination
284 // of these three options. The only one which is standard is TCP_NODELAY.
285 // By default, everything is not active.
286 #endif /* __LWIPOPTS_H__ */