| Crates.io | afxdp |
| lib.rs | afxdp |
| version | 0.4.0 |
| created_at | 2020-01-12 04:36:55.802575+00 |
| updated_at | 2021-03-14 19:45:39.526144+00 |
| description | AF XDP for Rust |
| homepage | https://github.com/aterlo/afxdp-rs |
| repository | https://github.com/aterlo/afxdp-rs |
| max_upload_size | |
| id | 197662 |
| size | 179,600 |
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.