rdma-io
Safe Rust bindings for RDMA programming over libibverbs and librdmacm, with async support and tonic gRPC integration.
Features
- Safe RAII wrappers —
ProtectionDomain,CompletionQueue,MemoryRegion,QueuePair,CmId, etc. withArc-based ownership enforcing correct destruction order - Async stream —
AsyncRdmaStreamimplementstokio::io::AsyncRead+AsyncWriteandfutures::AsyncRead+AsyncWritewith dual completion queues for full-duplex I/O - Low-level async —
AsyncCq(completion queue polling via epoll) andAsyncQpfor custom RDMA verb patterns (Send/Recv, RDMA Read/Write, atomics) - tonic gRPC transport —
RdmaConnectorandRdmaIncomingfor drop-in RDMA transport with tonic, including optional TLS viatonic-tls+ OpenSSL - Generated FFI —
rdma-io-sysprovides bindings generated with bnd, including wrappers foribverbsinline functions
Workspace Crates
| Crate | Description |
|---|---|
rdma-io |
Safe high-level API (async streams, connection management, QP verbs) |
rdma-io-tonic |
tonic gRPC transport over RDMA (connector, incoming, optional TLS) |
rdma-io-sys |
Raw FFI bindings (libibverbs + librdmacm) |
bnd-rdma-gen |
Binding generator (dev-only) |
rdma-io-tests |
Integration tests (streams, QP verbs, tonic gRPC, TLS) |
Quick Start
Async Stream (tokio)
use ;
use ;
// Server
let listener = bind.await.unwrap;
let addr = listener.local_addr.unwrap;
let = listener.accept.await.unwrap;
// Client
let mut client = connect.await.unwrap;
client.write_all.await.unwrap;
tonic gRPC over RDMA
use ;
// Server
let incoming = bind.await.unwrap;
builder
.add_service
.serve_with_incoming.await?;
// Client
let connector = RdmaConnector;
let channel = from_static
.connect_with_connector.await?;
Prerequisites
# Ubuntu/Debian
# For protobuf compilation (tonic tests)
Software RDMA Providers
For development and testing without RDMA hardware, use one of the software providers:
| Provider | Type | Script | Notes |
|---|---|---|---|
| siw (Soft-iWARP) | iWARP | sudo ./scripts/setup-siw.sh |
Recommended for testing; works on any Linux |
| rxe (Soft-RoCE) | InfiniBand/RoCE | sudo ./scripts/setup-rxe.sh |
Supports atomics and Write+Imm; can build from source via CMake |
Both scripts check for kernel modules, load them, create a device, and verify with ibv_devices.
Build
To build the rxe kernel module from source (optional):
Test
Tests require a software RDMA provider (siw or rxe) and must run single-threaded due to kernel resource contention:
# Set up a provider first
# Run tests
RUST_TEST_THREADS=1
Documentation
Design documents and background research are in docs/:
| Document | Description |
|---|---|
| SafeApi.md | Safe API design and RAII ownership model |
| RdmaOperations.md | RDMA verb operations and data path patterns |
| Testing.md | Test strategy and provider compatibility matrix |
| RingBufferStream.md | Ring buffer stream design (RDMA Write alternative) |
| BndBindings.md | FFI binding generation with bnd |
| siw-vs-rxe.md | Software provider comparison |
| msquic-rdma.md | msquic RDMA transport architecture analysis |
CI
CI runs on GitHub Actions with two jobs:
- build-and-test — builds on siw, runs clippy, tests (×5 for flakiness), doc tests
- build-rxe — builds rxe kernel module from source, tests on Soft-RoCE
License
MIT