|
86 | 86 | byte alignment -> define MEM_ALIGNMENT to 2. */ |
87 | 87 | #define MEM_ALIGNMENT 4 |
88 | 88 |
|
| 89 | +/** |
| 90 | + * LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT==1: allows mem_free() to be called |
| 91 | + * from ISR/different task context (uses SYS_ARCH_PROTECT instead of mutex). |
| 92 | + * Required on IOP because interrupt context may free pbufs. |
| 93 | + */ |
| 94 | +#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 1 |
| 95 | + |
89 | 96 | /** |
90 | 97 | * MEM_SIZE: the size of the heap memory. If the application will send |
91 | 98 | * a lot of data that needs to be copied, this should be set high. |
|
94 | 101 | Up to TCP_SND_BUF * 2 segments may be transmitted at once, thanks to Nagle and Delayed Ack. */ |
95 | 102 | #define MEM_SIZE (TCP_SND_BUF * 2) |
96 | 103 |
|
| 104 | +/* |
| 105 | + ----------------------------------------------- |
| 106 | + ---------- IP options ------------------------- |
| 107 | + ----------------------------------------------- |
| 108 | +*/ |
| 109 | +/** |
| 110 | + * IP_REASSEMBLY==1: Reassemble incoming fragmented IP packets. |
| 111 | + * Disabled: PS2 always operates on a local LAN; IP fragments never occur |
| 112 | + * with MSS=1460 and MTU=1500. Saves MEMP_NUM_REASSDATA pool entries. |
| 113 | + */ |
| 114 | +#define IP_REASSEMBLY 0 |
| 115 | + |
| 116 | +/** |
| 117 | + * IP_FRAG==1: Fragment outgoing IP packets if their size exceeds MTU. |
| 118 | + * Disabled: TCP_MSS=1460 ensures we never exceed Ethernet MTU=1500. |
| 119 | + */ |
| 120 | +#define IP_FRAG 0 |
| 121 | + |
97 | 122 | /* |
98 | 123 | ------------------------------------------------ |
99 | 124 | ---------- Internal Memory Pool Sizes ---------- |
100 | 125 | ------------------------------------------------ |
101 | 126 | */ |
| 127 | +/** |
| 128 | + * MEMP_NUM_TCP_PCB: the number of simultaneously active TCP connections. |
| 129 | + * ps2link handles at most a few simultaneous TCP connections. |
| 130 | + */ |
| 131 | +#define MEMP_NUM_TCP_PCB 4 |
| 132 | + |
| 133 | +/** |
| 134 | + * MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections. |
| 135 | + * ps2link listens on a small number of ports. |
| 136 | + */ |
| 137 | +#define MEMP_NUM_TCP_PCB_LISTEN 4 |
| 138 | + |
| 139 | +/** |
| 140 | + * MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. |
| 141 | + * DNS (1) + DHCP (1) internally allocate raw UDP PCBs via udp_new(), |
| 142 | + * plus application sockets (udptty 1, ps2link 1) need their own. |
| 143 | + */ |
| 144 | +#define MEMP_NUM_UDP_PCB 4 |
| 145 | + |
| 146 | +/** |
| 147 | + * MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments. |
| 148 | + * Must be at least TCP_SND_QUEUELEN (enforced by lwIP sanity check in init.c). |
| 149 | + */ |
| 150 | +#define MEMP_NUM_TCP_SEG TCP_SND_QUEUELEN |
| 151 | + |
| 152 | +/** |
| 153 | + * MEMP_NUM_ARP_QUEUE: the number of ARP queued packets. |
| 154 | + * ps2link communicates with a single host; 5 entries is more than enough. |
| 155 | + */ |
| 156 | +#define MEMP_NUM_ARP_QUEUE 5 |
| 157 | + |
102 | 158 | /** |
103 | 159 | * MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used |
104 | 160 | * for incoming packets. |
|
125 | 181 |
|
126 | 182 | /** |
127 | 183 | * PBUF_POOL_SIZE: the number of buffers in the pbuf pool. |
| 184 | + * Each pool entry is ~1532 bytes (PBUF_POOL_BUFSIZE ≈ 1516 + struct pbuf). |
| 185 | + * Reduced from 32 (~49 KB) to 12 (~18 KB). Safe because |
| 186 | + * LWIP_TCPIP_CORE_LOCKING_INPUT=1 means RX is processed synchronously, |
| 187 | + * so the pool backlog stays very small. |
| 188 | + * Must satisfy: TCP_WND <= PBUF_POOL_SIZE * (PBUF_POOL_BUFSIZE - 54). |
| 189 | + * With PBUF_POOL_SIZE=12 and PBUF_POOL_BUFSIZE=1516: max = 12 * 1462 = 17544. |
| 190 | + * 16384 (16 KB) fits comfortably. |
128 | 191 | */ |
129 | | -#define PBUF_POOL_SIZE 32 //SP193: should be at least ((TCP_WND/PBUF_POOL_BUFSIZE)+1). But that is too small to handle simultaneous connections. |
| 192 | +#define PBUF_POOL_SIZE 12 |
130 | 193 |
|
131 | 194 | /** |
132 | 195 | * LWIP_TCPIP_CORE_LOCKING_INPUT: when LWIP_TCPIP_CORE_LOCKING is enabled, |
|
156 | 219 | /* TCP sender buffer space (bytes). */ |
157 | 220 | #define TCP_SND_BUF (TCP_MSS*4) |
158 | 221 |
|
159 | | -/* TCP receive window. */ |
160 | | -#define TCP_WND 32768 |
| 222 | +/* TCP receive window. |
| 223 | + * Must satisfy: TCP_WND <= PBUF_POOL_SIZE * (PBUF_POOL_BUFSIZE - 54). |
| 224 | + * With PBUF_POOL_SIZE=12 and PBUF_POOL_BUFSIZE=1516: max = 12 * 1462 = 17544. |
| 225 | + * 16384 (16 KB) fits comfortably and still gives ample throughput on LAN. */ |
| 226 | +#define TCP_WND 16384 |
161 | 227 |
|
162 | 228 | /* ---------- DHCP options ---------- */ |
163 | 229 | #ifdef PS2IP_DHCP |
|
167 | 233 | #define LWIP_DHCP 1 |
168 | 234 | #endif |
169 | 235 |
|
| 236 | +/* ---------- ACD options ---------- */ |
| 237 | +#define LWIP_ACD 0 |
| 238 | +#define LWIP_DHCP_DOES_ACD_CHECK 0 |
| 239 | + |
170 | 240 | /** |
171 | 241 | * DHCP_DOES_ARP_CHECK==1: Do an ARP check on the offered address. |
172 | 242 | */ |
|
236 | 306 | */ |
237 | 307 | #define LWIP_CHECKSUM_ON_COPY 1 |
238 | 308 |
|
| 309 | +/* Use PS2SDK's errno.h instead of lwIP's own errno definitions */ |
| 310 | +#define LWIP_ERRNO_STDINCLUDE 1 |
239 | 311 | /* |
240 | 312 | ------------------------------------ |
241 | 313 | ---------- Socket options ---------- |
|
251 | 323 | * names (read, write & close). (only used if you use sockets.c) |
252 | 324 | */ |
253 | 325 | #define LWIP_POSIX_SOCKETS_IO_NAMES 0 |
| 326 | +/** |
| 327 | + * LWIP_SOCKET_POLL==1: Enable poll() for sockets (new in lwIP 2.2.x, default=1). |
| 328 | + * Disabled: lwip_poll() is not exported by ps2ip; disabling saves code size. |
| 329 | + */ |
| 330 | +#define LWIP_SOCKET_POLL 0 |
254 | 331 |
|
255 | 332 | /* |
256 | 333 | ---------------------------------- |
|
0 commit comments