ax-net 0.13.1

Unified network stack for TGOSKits (ArceOS, StarryOS, Axvisor)
//! Shared buffer sizes and queue limits.
//!
//! These constants define ax-net's default memory budget for protocol sockets,
//! smoltcp packet buffers, listen queues, and pending ARP packets. They are
//! intentionally centralized so embedded targets can
//! audit memory growth without chasing per-protocol magic numbers.
//!
//! # Sizing Policy
//!
//! The values favor predictable bounded memory over unbounded allocation. Socket
//! buffers are large enough for common POSIX workloads. Hardware queue and DMA
//! ring capacities come from `NetPollGroupParts` rather than protocol-layer
//! constants. If a value is raised, consider the total cost across all sockets,
//! not only the cost of one queue.

pub const STANDARD_MTU: usize = 1500;

pub const TCP_RX_BUF_LEN: usize = 256 * 1024;
pub const TCP_TX_BUF_LEN: usize = 256 * 1024;
pub const UDP_RX_BUF_LEN: usize = 64 * 1024;
pub const UDP_TX_BUF_LEN: usize = 64 * 1024;
pub const RAW_RX_BUF_LEN: usize = 64 * 1024;
pub const RAW_TX_BUF_LEN: usize = 64 * 1024;
pub const LISTEN_QUEUE_SIZE: usize = 512;

pub const SOCKET_BUFFER_SIZE: usize = 64;

/// Number of outbound packets that can be queued while waiting for ARP
/// resolution of the next hop.
///
/// 32 was too small in practice: applications that fan out 10-20 concurrent
/// TCP connections at startup (browsers, HTTP clients, CLIs that talk to an
/// AI/cloud API) overflow the queue with their first SYN burst before the
/// gateway ARP reply arrives, and the excess packets are silently dropped.
/// Long-running streams that outlive [`NEIGHBOR_TTL`] also re-enter the
/// queue when the cached neighbour expires mid-flow.
///
/// 128 slots (~189 KiB at 1514 bytes per packet) covers the bursts these
/// applications produce while keeping the boot-time heap footprint small
/// enough for the 128 MiB QEMU defaults that the test rigs use.
pub const ETHERNET_MAX_PENDING_PACKETS: usize = 128;