Disabling auto-refresh of game list by default, as it is causing bugs sometimes
[open-ps2-loader.git] / modules / network / SMSTCPIP / include / lwipopts.h
blobfab97f1673f11e710beb40ef4727d745bb4ccf1c
1 #ifndef __LWIPOPTS_H__
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. */
13 #ifdef INGAME_DRIVER
14 #define MEM_SIZE 0x400
15 #else
16 #define MEM_SIZE 0x3000
17 #endif
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. */
22 #ifdef INGAME_DRIVER
23 #define MEMP_NUM_PBUF 10
24 #else
25 #define MEMP_NUM_PBUF 40
26 #endif
28 /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
29 per active UDP "connection". */
30 #ifdef INGAME_DRIVER
31 #define MEMP_NUM_UDP_PCB 1
32 #else
33 #define MEMP_NUM_UDP_PCB 15
34 #endif
36 /* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
37 connections. */
38 #ifdef INGAME_DRIVER
39 #define MEMP_NUM_TCP_PCB 1
40 #else
41 #define MEMP_NUM_TCP_PCB 15
42 #endif
44 /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
45 connections. */
46 #ifdef INGAME_DRIVER
47 #define MEMP_NUM_TCP_PCB_LISTEN 1
48 #else
49 #define MEMP_NUM_TCP_PCB_LISTEN 15
50 #endif
52 /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
53 segments. */
54 #ifdef INGAME_DRIVER
55 #define MEMP_NUM_TCP_SEG 15
56 #else
57 #define MEMP_NUM_TCP_SEG 40
58 #endif
60 /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
61 timeouts. */
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. */
67 #ifdef INGAME_DRIVER
68 #define MEMP_NUM_NETBUF 5
69 #else
70 #define MEMP_NUM_NETBUF 15
71 #endif
73 /* MEMP_NUM_NETCONN: the number of struct netconns. */
74 #ifdef INGAME_DRIVER
75 #define MEMP_NUM_NETCONN 1
76 #else
77 #define MEMP_NUM_NETCONN 15
78 #endif
80 /* MEMP_NUM_APIMSG: the number of struct api_msg, used for
81 communication between the TCP/IP stack and the sequential
82 programs. */
83 #ifdef INGAME_DRIVER
84 #define MEMP_NUM_API_MSG 5
85 #else
86 #define MEMP_NUM_API_MSG 40
87 #endif
89 /* MEMP_NUM_TCPIPMSG: the number of struct tcpip_msg, which is used
90 for sequential API communication and incoming packets. Used in
91 src/api/tcpip.c. */
92 #ifdef INGAME_DRIVER
93 #define MEMP_NUM_TCPIP_MSG 15
94 #else
95 #define MEMP_NUM_TCPIP_MSG 40
96 #endif
98 /* ---------- Pbuf options ---------- */
99 /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
100 #ifdef INGAME_DRIVER
101 #define PBUF_POOL_SIZE 5
102 #else
103 #define PBUF_POOL_SIZE 25
104 #endif
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 ---------- */
123 #define LWIP_TCP 1
124 #define TCP_TTL 255
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. */
131 #define TCP_MSS 1460
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. */
141 #ifdef INGAME_DRIVER
142 #define TCP_WND 5120
143 #else
144 #define TCP_WND 8192
145 #endif
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
161 //#else
162 #define TCPIP_THREAD_PRIO 1
163 //#endif
165 /* ---------- ARP options ---------- */
166 #ifdef INGAME_DRIVER
167 #define ARP_TABLE_SIZE 2
168 #else
169 #define ARP_TABLE_SIZE 10
170 #endif
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. */
177 #define IP_FORWARD 0
179 /* IP reassembly and segmentation. These are orthogonal even
180 if they both deal with IP fragments */
181 #define IP_REASSEMBLY 1
182 #define IP_FRAG 1
184 /* ---------- ICMP options ---------- */
185 #define ICMP_TTL 255
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. */
193 #ifdef PS2IP_DHCP
195 #define LWIP_DHCP 1
197 /* 1 if you want to do an ARP check on the offered address
198 (recommended). */
199 #define DHCP_DOES_ARP_CHECK 1
201 #else
203 #define LWIP_DHCP 0
204 #define DHCP_DOES_ARP_CHECK 0
206 #endif
208 /* ---------- UDP options ---------- */
209 #ifdef INGAME_DRIVER
210 #define LWIP_UDP 0
211 #else
212 #define LWIP_UDP 1
213 #endif
214 #define UDP_TTL 255
217 /* ---------- Statistics options ---------- */
218 #define LWIP_STATS 0
220 #if LWIP_STATS
221 #define LINK_STATS 1
222 #define IP_STATS 1
223 #define IPFRAG_STATS 1
224 #define ICMP_STATS 1
225 #define UDP_STATS 1
226 #define TCP_STATS 1
227 #define MEM_STATS 1
228 #define MEMP_STATS 1
229 #define PBUF_STATS 1
230 #define SYS_STATS 1
231 #define RAW_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
237 //spooo:
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 +
252 // latency).
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
261 // 200ms).
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:
276 // int ret, 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__ */