| Crates.io | quick_afxdp |
| lib.rs | quick_afxdp |
| version | 0.4.0 |
| created_at | 2025-12-02 17:05:03.749442+00 |
| updated_at | 2025-12-02 17:05:03.749442+00 |
| description | AF XDP for Rust |
| homepage | https://github.com/aterlo/afxdp-rs |
| repository | https://github.com/aterlo/afxdp-rs |
| max_upload_size | |
| id | 1962192 |
| size | 182,995 |
This module provides a Rust interface for AF_XDP which wraps libbpf built on libbpf-sys.
Author: Dan Siemon <dan@coverfire.com>
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 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.You can run with cargo run --release --example <example_name> -- [example options] to
see a list of options run cargo run --release --example <example_name> -- --help
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.