sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
lwipopts.h
Go to the documentation of this file.
1/* If changes are made to this file, please update the defined
2 values at the bottom of common/include/tcpip.h too. */
3
8#ifndef __LWIPOPTS_H__
9#define __LWIPOPTS_H__
10
11#define LWIP_TIMEVAL_PRIVATE 0
12
13/* ---------- Thread options ---------- */
19#define DEFAULT_THREAD_STACKSIZE 0x1000
20
26#define DEFAULT_THREAD_PRIO 0x58
27
33#define TCPIP_THREAD_STACKSIZE DEFAULT_THREAD_STACKSIZE
34
40#define TCPIP_THREAD_PRIO DEFAULT_THREAD_PRIO
41
42/*
43 ------------------------------------
44 ---------- Memory options ----------
45 ------------------------------------
46*/
57#define MEM_LIBC_MALLOC 1
58
59/* MEM_ALIGNMENT: must equal the alignment libc's malloc returns,
60 because pbuf_alloc(PBUF_RAM) computes
61 payload = LWIP_MEM_ALIGN(p + SIZEOF_STRUCT_PBUF + offset)
62 inside an allocation sized assuming p is already MEM_ALIGNMENT-
63 aligned. If MEM_ALIGNMENT > newlib's alignment the payload pointer
64 overruns the chunk and corrupts the next-chunk header on the
65 freelist (TLB misses inside _malloc_r / _free_r).
66
67 16 is the contract baked into the toolchain configuration. See
68 newlib/newlib/configure.host:
69
70 mips64r5900*)
71 machine_dir=r5900
72 newlib_cflags="${newlib_cflags} -DMALLOC_ALIGNMENT=16"
73 ;;
74
75 so for the mips64r5900el-ps2-elf target newlib is built with
76 -DMALLOC_ALIGNMENT=16, which sets _mallocr.c's MALLOC_ALIGNMENT
77 directly (overriding the SIZE_SZ-derived default of 8). 16 is also
78 what samples/malloc_stress observes empirically.
79
80 The historical value here was 64 with a comment about "the EE cache
81 design" (SP193). That was over-cautious: PBUF_POOL pbufs (the only
82 ones touched by IOP->EE DMA + cache invalidate) come from memp's
83 static pools and are always 64-byte aligned regardless of
84 MEM_ALIGNMENT; PBUF_RAM pbufs (TX, ARP, DNS, ...) only see DMA
85 writeback, where misalignment harmlessly over-flushes extra cache
86 lines. The IOP-side lwipopts has used MEM_ALIGNMENT=4 forever for
87 the same reason. */
88#define MEM_ALIGNMENT 16
89
94/* SP193: setting this too low may cause tcp_write() to fail when it tries to allocate from PBUF_RAM!
95 Up to TCP_SND_BUF * 2 segments may be transmitted at once, thanks to Nagle and Delayed Ack. */
96#define MEM_SIZE (TCP_SND_BUF * 2)
97
98/*
99 ------------------------------------------------
100 ---------- Internal Memory Pool Sizes ----------
101 ------------------------------------------------
102*/
107#define MEMP_NUM_NETCONN (MEMP_NUM_TCP_PCB+MEMP_NUM_UDP_PCB)
108
112//SP193: should be at least ((TCP_WND/PBUF_POOL_BUFSIZE)+1). But that is too small to accommodate data not accepted by the application layer and multiple connections.
113//NETMAN will also always have PBUFs reserved for incoming frames (currently 64).
114#define PBUF_POOL_SIZE 128
115
123#define MEMP_NUM_TCPIP_MSG_INPKT 50
124
130//SP193: this should be around the size of MEM_SIZE (in PBUFs), to prevent transmissions from being potentially being dropped.
131#define MEMP_NUM_TCPIP_MSG_API 50
132
137#define MEMP_NUM_TCP_SEG TCP_SND_QUEUELEN
138
147#define LWIP_TCPIP_CORE_LOCKING 1
148
154#define LWIP_TCPIP_CORE_LOCKING_INPUT 1
155
156/*
157 ---------------------------------
158 ---------- TCP options ----------
159 ---------------------------------
160*/
161/* TCP Maximum segment size. */
162#define TCP_MSS 1460
163
164/* TCP sender buffer space (bytes). */
165#define TCP_SND_BUF (TCP_MSS*32)
166
167/* TCP receive window. */
168#define TCP_WND 65535
169
170/* ---------- DHCP options ---------- */
171#ifndef PS2IP_DHCP
172#define PS2IP_DHCP
173#endif
177#ifndef LWIP_DHCP
178#define LWIP_DHCP 1
179#endif
180
181/* LWIP_DHCP_DOES_ACD_CHECK / LWIP_ACD left at upstream defaults (=1 when
182 * LWIP_DHCP=1) so the RFC 5227 Address Conflict Detection probe runs on
183 * any DHCP-offered IP. EE applications run on user home networks where
184 * IP collisions are a real (if uncommon) failure mode; the few KB of
185 * code and ~1-2 s extra DHCP-bind delay are worth the robustness. The
186 * IOP lwIP build forces both off because ps2link runs in controlled
187 * bench environments where the IRX size + tick savings matter more. */
188
189/*
190 ----------------------------------
191 ---------- DNS options -----------
192 ----------------------------------
193*/
198#ifndef PS2IP_DNS
199#define PS2IP_DNS
200#endif
201#ifndef LWIP_DNS
202#define LWIP_DNS 1
203#endif
204
205/* ---------- Statistics options ---------- */
209#define LWIP_STATS 0
210
211/*
212 --------------------------------------
213 ---------- Checksum options ----------
214 --------------------------------------
215*/
216//Rely on the Ethernet checksums to reduce the number of checksum compuations. If you require any of these, re-enable them.
220#define CHECKSUM_CHECK_IP 0
221
225#define CHECKSUM_CHECK_UDP 0
226
230#define CHECKSUM_CHECK_TCP 0
231
235#define CHECKSUM_CHECK_ICMP 0
236
240#define CHECKSUM_CHECK_ICMP6 0
241
246#define LWIP_CHECKSUM_ON_COPY 1
247
248/*
249 ------------------------------------
250 ---------- Socket options ----------
251 ------------------------------------
252*/
258#define LWIP_POSIX_SOCKETS_IO_NAMES 0
259
260/*
261 ----------------------------------
262 ---------- DNS options -----------
263 ----------------------------------
264*/
269#define LWIP_DNS_SECURE 0
270
271/*
272 ------------------------------------------------
273 ---------- Network Interfaces options ----------
274 ------------------------------------------------
275*/
285#define LWIP_NETIF_TX_SINGLE_PBUF 1
286
287#endif /* __LWIPOPTS_H__ */