pub fn setup_umem(
raw_fd: c_int,
config: Option<&XdpConfig>,
) -> Result<OwnedMmap>Expand description
Allocates and registers the UMEM (Userspace Memory) region with the kernel.
§How it works
- It calls
OwnedMmap::mmapto create a memory-mapped region, optionally backed by huge pages. - It populates an
xdp_umem_regstruct with the address and size of the UMEM. - It calls
setsockoptwithXDP_UMEM_REGto register the UMEM with the kernel, making it available for zero-copy operations.
§Arguments
raw_fd- The raw file descriptor of the AF_XDP socket.config- Optional configuration, used to determine if huge pages should be used.