Expand description
Lock-free datapath primitives for high-performance packet processing.
Zero-copy buffer pools, SPSC/MPMC ring buffers, cache-line-aligned
statistics, and the CachePadded primitive — pure, with no VM, VirtIO,
or I/O dependencies. Extracted from arcbox-net so any high-throughput
consumer (host-side proxy, VM datapath, packet tools) can reuse them.
§Performance Targets
- Ring buffer throughput: >100M ops/sec
- Packet pool allocation: O(1) constant time
- Zero memory copies in hot path
Re-exports§
pub use error::Error;pub use error::Result;pub use frame_buf::FrameBuf;pub use pool::PacketBuffer;pub use pool::PacketPool;pub use pool::PacketRef;pub use ring::LockFreeRing;pub use stats::DatapathStats;
Modules§
- error
- Error type for the datapath buffer pool.
- frame_
buf - Owned frame buffer backed by
PacketPoolor a heapVec<u8>. - pool
- Pre-allocated packet buffer pool.
- ring
- Lock-free ring buffer for high-performance packet passing.
- stats
- Performance statistics for the datapath.
Structs§
- Cache
Padded - Cache line padding to prevent false sharing.
Constants§
- CACHE_
LINE_ SIZE - Cache line size for padding (64 bytes on most architectures).
- DEFAULT_
BATCH_ SIZE - Default batch size for packet processing.
- DEFAULT_
POOL_ CAPACITY - Default packet pool capacity.
- DEFAULT_
RING_ CAPACITY - Default ring buffer capacity (must be power of 2).
- MAX_
PACKET_ SIZE - Maximum packet size (MTU + headers).
Functions§
- is_
power_ of_ two - Checks if a value is a power of 2.
- next_
power_ of_ two - Rounds up to the next power of 2.
- prefetch_
read - Software prefetch for upcoming data access.
- prefetch_
write - Software prefetch for write access.