rumpk/core/net/lwipopts.h

39 lines
1.2 KiB
C

#ifndef LWIP_HDR_LWIPOPTS_H
#define LWIP_HDR_LWIPOPTS_H
// 1. The Unikernel Mode (No OS threads)
#define NO_SYS 1
#define LWIP_TIMERS 1 // We must call sys_check_timeouts() manually
// 1.1 Disable Sequential/Socket APIs
#define LWIP_NETCONN 0
#define LWIP_SOCKET 0
#define LWIP_STATS 0
#define SYS_LIGHTWEIGHT_PROT 0
#define LWIP_ETHERNET 1
// 2. Memory Strategy (Static Slabs - No Heap)
#define MEM_LIBC_MALLOC 0
#define MEMP_MEM_MALLOC 0
#define MEM_ALIGNMENT 64 // Cache Line Alignment (Critical for Disruptor)
// 3. Performance Tuning (Sovereign Scale)
#define TCP_MSS 1460
#define TCP_WND (8 * TCP_MSS)
#define LWIP_TCP_KEEPALIVE 1
// 4. Checksum Offload (Let Hardware do it if VirtIO supports it)
// For now, software checksums to be safe on QEMU
#define CHECKSUM_GEN_IP 1
#define CHECKSUM_GEN_TCP 1
// 6. Freestanding overrides
#define LWIP_NO_INTTYPES_H 1
// 5. Debugging (The HUD Needs Logs)
#define LWIP_DEBUG 1
#define LWIP_PLATFORM_DIAG(x) do { printf x; } while(0)
#define LWIP_PLATFORM_ASSERT(x) do { printf("ASSERT: %s\n", x); } while(0)
#endif