Skip to main content

Crate arcbox_datapath

Crate arcbox_datapath 

Source
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 PacketPool or a heap Vec<u8>.
pool
Pre-allocated packet buffer pool.
ring
Lock-free ring buffer for high-performance packet passing.
stats
Performance statistics for the datapath.

Structs§

CachePadded
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.