Skip to main content

Crate yip_io

Crate yip_io 

Source
Expand description

Kernel-bypass-ready packet I/O. M4 adds the io_uring backend (single ring servicing UDP + TUN/TAP), then AF_XDP. This is the only crate permitted to contain unsafe; every unsafe block must carry a // SAFETY: comment.

Re-exports§

pub use addr::sockaddr_to_std;
pub use addr::std_to_sockaddr;
pub use bpf::BpfFilterStatus;
pub use bpf::XdpRedirectFilter;

Modules§

addr
sockaddr ⇄ SocketAddr conversions for the addressed socket seam.
af_xdp
AF_XDP (XSK) kernel-bypass driver and UMEM shared memory pool.
batch
Vectorized recvmmsg and sendmmsg socket engine.
bpf
Self-contained eBPF XSK redirect driver and map loader.
epoll
A minimal, safe epoll primitive for the QUIC-mimicry driver (3c.1).
nonce
poll
Single-threaded epoll-driven event loop for the yip data plane.
spsc
Lock-free Single-Producer Single-Consumer (SPSC) bounded ring buffer.
tun_offload
Local TUN virtio_net_hdr (GSO/GRO) framing + the RX coalescer / TX splitter. Purely local to the yipd↔kernel-TUN boundary — never touches the wire.
uring
io_uring driver using one ring over UDP + TUN with provided-buffer receives.

Structs§

IoUringIo
A DataPlaneIo backend that submits Read/Write ops on a connected UDP socket through an io_uring ring.
PlainIo
A portable fallback backend over a plain (connected) UDP socket.

Enums§

Backend
Selected I/O backend, in fallback-preference order.

Constants§

MAX_DATAGRAM_BATCH
Maximum number of datagrams in a single batched send/recv call.
MAX_WIRE_DATAGRAM
Maximum size (bytes) of a single wire datagram. 2 KiB is ample for any encapsulated MTU-1500 payload plus yip-wire framing overhead.

Traits§

DataPlaneIo
Sends and receives wire datagrams via the selected backend. Implemented in M4.

Functions§

pin_current_thread
Pin the calling thread to core via libc::sched_setaffinity.
select_backend
Choose the lowest-latency backend that initializes: io_uring if its ring builds on this kernel, else the portable plain-socket fallback.
set_socket_buffers
Set the OS send and receive socket buffer sizes to bytes bytes on sock.