setup_umem

Function setup_umem 

Source
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

  1. It calls OwnedMmap::mmap to create a memory-mapped region, optionally backed by huge pages.
  2. It populates an xdp_umem_reg struct with the address and size of the UMEM.
  3. It calls setsockopt with XDP_UMEM_REG to 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.