This module provides a Rust interface for AF_XDP which wraps libbpf built on libbpf-sys.
Author: Dan Siemon \ AF_XDP (XSK): The goals of this crate, in order, are: The API works for my current use cases but I expect it will change to achieve higher performance and better usability. If you have knowledge of Rust FFI and general Rust unsafe things I would greatly appreciate some help auditing this crate as my experience in this area is limited. There are several programs in You can run with Test System: Traffic Generator: Scenario 1: l2fwd-2link on a single core running userspace and NAPI Small amounts of packet loss starts at about 6.5M PPS unidirectional and 6.0M PPS bi-directionally (3M each direction). Little effort has been put into optimizing this so I expect there are some easy performance wins.
Current Status
Sample Programs
examples/
:
l2fwd-1link
: Receives frames on a single link/queue, swaps the MAC and writes back to the same link/queue. This is roughly like the kernel xdpsock_user.c sample program in l2fwd mode.l2fwd-2link
: Receives frames from two link/queue pairs (separate devices) and forwards the frames to the opposite link.l2fwd-2link-multicore
: Multi-core/multi-queue version of l2fwd-2link.dump
: Receives frames on a single link/queue, parses with Pnet and prints packet.rxdrop
: Receives packets on one or more links and queues and drops then while counting and printing the packet rate.cargo run --release --example <example_name> -- [example options]
to
see a list of options run cargo run --release --example <example_name> -- --help
Performance
Supported Features
Required AF_XDP Features
Supported AF_XDP Features
Unsupported AF_XDP Features (for now)
To Do