sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
lwipopts.h File Reference

Go to the source code of this file.

Macros

#define LWIP_TIMEVAL_PRIVATE   0
#define DEFAULT_THREAD_STACKSIZE   0x600
#define DEFAULT_THREAD_PRIO   0x18
#define TCPIP_THREAD_STACKSIZE   DEFAULT_THREAD_STACKSIZE
#define TCPIP_THREAD_PRIO   DEFAULT_THREAD_PRIO
#define MEM_ALIGNMENT   4
#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT   1
#define MEM_SIZE   (TCP_SND_BUF * 2)
#define IP_REASSEMBLY   0
#define IP_FRAG   0
#define MEMP_NUM_TCPIP_MSG_INPKT   24
#define MEMP_NUM_NETCONN   (MEMP_NUM_TCP_PCB+MEMP_NUM_UDP_PCB)
#define PBUF_POOL_SIZE   32
#define LWIP_TCPIP_CORE_LOCKING   1
#define LWIP_TCPIP_CORE_LOCKING_INPUT   1
#define TCP_MSS   1460
#define TCP_SND_BUF   (TCP_MSS*4)
#define TCP_WND   32768
#define LWIP_DHCP_DOES_ACD_CHECK   0
#define LWIP_ACD   0
#define LWIP_STATS   0
#define CHECKSUM_CHECK_IP   0
#define CHECKSUM_CHECK_UDP   0
#define CHECKSUM_CHECK_TCP   0
#define CHECKSUM_CHECK_ICMP   0
#define CHECKSUM_CHECK_ICMP6   0
#define LWIP_CHECKSUM_ON_COPY   1
#define LWIP_POSIX_SOCKETS_IO_NAMES   0
#define LWIP_DNS_SECURE   0
#define LWIP_NETIF_TX_SINGLE_PBUF   1

Macro Definition Documentation

◆ CHECKSUM_CHECK_ICMP

#define CHECKSUM_CHECK_ICMP   0

CHECKSUM_CHECK_ICMP==1: Check checksums in software for incoming ICMP packets.

Definition at line 219 of file lwipopts.h.

◆ CHECKSUM_CHECK_ICMP6

#define CHECKSUM_CHECK_ICMP6   0

CHECKSUM_CHECK_ICMP6==1: Check checksums in software for incoming ICMPv6 packets

Definition at line 224 of file lwipopts.h.

◆ CHECKSUM_CHECK_IP

#define CHECKSUM_CHECK_IP   0

CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.

Definition at line 204 of file lwipopts.h.

◆ CHECKSUM_CHECK_TCP

#define CHECKSUM_CHECK_TCP   0

CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.

Definition at line 214 of file lwipopts.h.

◆ CHECKSUM_CHECK_UDP

#define CHECKSUM_CHECK_UDP   0

CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.

Definition at line 209 of file lwipopts.h.

◆ DEFAULT_THREAD_PRIO

#define DEFAULT_THREAD_PRIO   0x18

DEFAULT_THREAD_PRIO: The priority assigned to any other lwIP thread. The priority value itself is platform-dependent, but is passed to sys_thread_new() when the thread is created.

Definition at line 38 of file lwipopts.h.

◆ DEFAULT_THREAD_STACKSIZE

#define DEFAULT_THREAD_STACKSIZE   0x600

DEFAULT_THREAD_STACKSIZE: The stack size used by any other lwIP thread spawned via sys_thread_new(). In our build that's just the tcpip thread.

With LWIP_TCPIP_CORE_LOCKING=1 the deep socket-API call chains run on the calling app thread, not on the tcpip thread; the tcpip thread itself only dispatches timer callbacks and the occasional tcpip_callback (e.g. link up/down). Worst-case chain on the tcpip thread is roughly

tcpip_thread (56) -> sys_check_timeouts (32) -> lwip_cyclic_timer (32) -> tcp_slowtmr (72) or dhcp_fine_tmr -> ~150-200 of inner work ~= 350-450 bytes + register-save overhead.

0x600 (1.5 KB) is the historical 2.0.3 value and matches the call-chain profile under LWIP_TCPIP_CORE_LOCKING=1. ~2x margin over the measured worst case.

Definition at line 31 of file lwipopts.h.

◆ IP_FRAG

#define IP_FRAG   0

IP_FRAG==1: Fragment outgoing IP packets if their size exceeds MTU. Disabled: TCP_MSS=1460 ensures we never exceed Ethernet MTU=1500.

Definition at line 99 of file lwipopts.h.

◆ IP_REASSEMBLY

#define IP_REASSEMBLY   0

IP_REASSEMBLY==1: Reassemble incoming fragmented IP packets. Disabled: PS2 networking targets a local LAN with MTU=1500, and TCP negotiates MSS=1460 so fragments never arise in the common case. Frees MEMP_NUM_REASSDATA / MEMP_NUM_FRAG_PBUF pool entries.

Definition at line 93 of file lwipopts.h.

◆ LWIP_ACD

#define LWIP_ACD   0

Definition at line 174 of file lwipopts.h.

◆ LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT

#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT   1

LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT==1: make mem_free() callable from any context (ISR/disabled-interrupt) by using SYS_ARCH_PROTECT instead of a mutex for critical regions. Required on IOP because SMAP RX interrupts invoke pbuf_free() in interrupt-disabled context; taking a mutex there would violate the critical section (same effect as ps2dev/lwip's mem.c patch, but achieved via upstream lwipopts instead of patching lwIP).

Definition at line 72 of file lwipopts.h.

◆ LWIP_CHECKSUM_ON_COPY

#define LWIP_CHECKSUM_ON_COPY   1

LWIP_CHECKSUM_ON_COPY==1: Calculate checksum when copying data from application buffers to pbufs.

Definition at line 230 of file lwipopts.h.

◆ LWIP_DHCP_DOES_ACD_CHECK

#define LWIP_DHCP_DOES_ACD_CHECK   0

LWIP_DHCP_DOES_ACD_CHECK==0: skip RFC 5227 Address Conflict Detection on the DHCP-offered address (replaces the pre-2.2.0 DHCP_DOES_ARP_CHECK). PS2 networking targets a controlled LAN; the saved code+timer/RAM beats guarding against a vanishingly unlikely IP collision. Combined with LWIP_AUTOIP=0 (default) this lets LWIP_ACD default to 0 too.

Definition at line 173 of file lwipopts.h.

◆ LWIP_DNS_SECURE

#define LWIP_DNS_SECURE   0

LWIP_DNS_SECURE: controls the security level of the DNS implementation Use all DNS security features by default. This is overridable but should only be needed by very small targets or when using against non standard DNS servers.

Definition at line 253 of file lwipopts.h.

◆ LWIP_NETIF_TX_SINGLE_PBUF

#define LWIP_NETIF_TX_SINGLE_PBUF   1

LWIP_NETIF_TX_SINGLE_PBUF: if this is set to 1, lwIP tries to put all data to be sent into one single pbuf. This is for compatibility with DMA-enabled MACs that do not support scatter-gather. Beware that this might involve CPU-memcpy before transmitting that would not be needed without this flag! Use this only if you need to!

Todo
: TCP and IP-frag do not work with this, yet:

Definition at line 269 of file lwipopts.h.

◆ LWIP_POSIX_SOCKETS_IO_NAMES

#define LWIP_POSIX_SOCKETS_IO_NAMES   0

LWIP_POSIX_SOCKETS_IO_NAMES==1: Enable POSIX-style sockets functions names. Disable this option if you use a POSIX operating system that uses the same names (read, write & close). (only used if you use sockets.c)

Definition at line 242 of file lwipopts.h.

◆ LWIP_STATS

#define LWIP_STATS   0

LWIP_DNS==1: Turn on DNS module. UDP must be available for DNS transport. LWIP_STATS==1: Enable statistics collection in lwip_stats.

Definition at line 193 of file lwipopts.h.

◆ LWIP_TCPIP_CORE_LOCKING

#define LWIP_TCPIP_CORE_LOCKING   1

LWIP_TCPIP_CORE_LOCKING==1: matches lwIP 2.2.1's upstream default. Socket and netconn API calls take the core mutex on the calling app thread and run synchronously, instead of round-tripping through the tcpip thread's mailbox. Saves a context switch + sem wait per API call. lwIP releases the core lock before any blocking I/O wait (mbox_fetch on connection mboxes), so the tcpip thread and SMAP RX can still run to deliver data.

Definition at line 134 of file lwipopts.h.

◆ LWIP_TCPIP_CORE_LOCKING_INPUT

#define LWIP_TCPIP_CORE_LOCKING_INPUT   1

LWIP_TCPIP_CORE_LOCKING_INPUT==1: tcpip_input() takes the core mutex directly instead of allocating a message. Safe here because the netif input callback runs in IntrHandlerThread (smap.c) — a normal thread, not interrupt context — so the lock acquire is allowed.

Definition at line 142 of file lwipopts.h.

◆ LWIP_TIMEVAL_PRIVATE

#define LWIP_TIMEVAL_PRIVATE   0

Definition at line 11 of file lwipopts.h.

◆ MEM_ALIGNMENT

#define MEM_ALIGNMENT   4

Definition at line 62 of file lwipopts.h.

◆ MEM_SIZE

#define MEM_SIZE   (TCP_SND_BUF * 2)

MEM_SIZE: the size of the heap memory. If the application will send a lot of data that needs to be copied, this should be set high.

Definition at line 80 of file lwipopts.h.

◆ MEMP_NUM_NETCONN

#define MEMP_NUM_NETCONN   (MEMP_NUM_TCP_PCB+MEMP_NUM_UDP_PCB)

MEMP_NUM_NETCONN: the number of struct netconns. (only needed if you use the sequential API, like api_lib.c)

Definition at line 119 of file lwipopts.h.

◆ MEMP_NUM_TCPIP_MSG_INPKT

#define MEMP_NUM_TCPIP_MSG_INPKT   24

MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used for incoming packets. SP193: this should be around the size of the TCP window because the TCPIP thread may take a while to execute (non-preemptive multitasking), otherwise incoming frames may get dropped.

Definition at line 113 of file lwipopts.h.

◆ PBUF_POOL_SIZE

#define PBUF_POOL_SIZE   32

PBUF_POOL_SIZE: the number of buffers in the pbuf pool.

Definition at line 124 of file lwipopts.h.

◆ TCP_MSS

#define TCP_MSS   1460

Definition at line 150 of file lwipopts.h.

◆ TCP_SND_BUF

#define TCP_SND_BUF   (TCP_MSS*4)

Definition at line 153 of file lwipopts.h.

◆ TCP_WND

#define TCP_WND   32768

Definition at line 156 of file lwipopts.h.

◆ TCPIP_THREAD_PRIO

#define TCPIP_THREAD_PRIO   DEFAULT_THREAD_PRIO

TCPIP_THREAD_PRIO: The priority assigned to the main tcpip thread. The priority value itself is platform-dependent, but is passed to sys_thread_new() when the thread is created.

Definition at line 52 of file lwipopts.h.

◆ TCPIP_THREAD_STACKSIZE

#define TCPIP_THREAD_STACKSIZE   DEFAULT_THREAD_STACKSIZE

TCPIP_THREAD_STACKSIZE: The stack size used by the main tcpip thread. The stack size value itself is platform-dependent, but is passed to sys_thread_new() when the thread is created.

Definition at line 45 of file lwipopts.h.