Skip to main content

Module batch

Module batch 

Source
Expand description

Vectorized recvmmsg and sendmmsg socket engine.

Provides BatchUdpSocket to send and receive datagram bursts of up to BATCH_SIZE (32 datagrams) in a single syscall, reducing syscall overhead and maximizing throughput in multi-core packet pipelines.

Structs§

BatchUdpSocket
A non-owning wrapper around a UDP socket file descriptor providing vectorized batch send and receive operations via libc::sendmmsg and libc::recvmmsg.
ReceivedDatagram
Metadata for a single datagram received via BatchUdpSocket::recvmmsg_batch.

Constants§

BATCH_SIZE
Maximum number of datagrams transferred in a single default batched syscall.
BATCH_SIZE_64
Expanded 64-datagram burst size for high-packet-rate 10G/25G interfaces.
BATCH_SIZE_128
Ultra-high 128-datagram burst size for maximum syscall amortization at 40G+ line rate.

Functions§

send_gso_superpacket
Send a GSO superpacket using a UDP_SEGMENT cmsg header. Returns Ok(bytes_sent) on success.
set_udp_gso_segment
Probe and optionally set socket-level UDP_SEGMENT size if supported by kernel. Returns Ok(true) if supported and configured, Ok(false) if unsupported by kernel/NIC.