Crate afxdp[][src]

afxdp-rs

A Rust library for using AF_XDP (XSK) Linux sockets.

For information on AF_XDP, see the Linux kernel docs.

This implementation is focused on routing, switching and other high packet rate use cases. This implies:

  • It must be possible to receive packets on one NIC and write them out any another (shared umem or shared MMAP area)
  • It is appropriate to dedicate threads or cores to packet processing tasks
  • There is a focus on low latency

Several example programs exist in the examples/ directory.

Modules

buf

Buf is the trait that is used to represent a packet buffer.

buf_mmap

BufMMap is the primary implementation of Buf for use with AF_XDP sockets.

buf_pool

BufPool is a trait which represents a pool of buffers.

buf_pool_vec

BufPoolVec is an implementation of the BufPool trait based on Vec.

buf_vec

BufVec is an implementation of the Buf trait that is easier to use in tests because it doesn’t require the all of the AF_XDP infrastructure to be configured.

mmap_area

MMapArea is a region of memory that is shared with one or more NICs via one or more UMems.

socket

The Socket module represents an AF_XDP (XSK) socket which is used to transmit or receive packets.

umem

The Umem module represents a shared memory area shared with the NIC and one or more sockets (shared Umem).

Constants

PENDING_LEN

PENDING_LEN is the size of the circular buffer used when reading from and writing to the socket.