rdma-io
Safe Rust bindings for RDMA programming over libibverbs and librdmacm, with async support, tonic gRPC integration, and Quinn QUIC 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 - Transport trait — Generic
Transport/TransportBuilderabstraction decoupling RDMA mechanics from consumers; three concrete implementations:SendRecvTransport(Send/Recv verbs),CreditRingTransport(RDMA Write ring + credits),ReadRingTransport(RDMA Write ring + Read flow control) - 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 - Quinn QUIC transport —
RdmaUdpSocketimplements Quinn'sAsyncUdpSockettrait, enabling QUIC over RDMA without modifying Quinn - tonic-h3 gRPC over HTTP/3 — Full stack: tonic gRPC → HTTP/3 → QUIC (Quinn) → RDMA, via
tonic-h3integration - 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, Transport trait, connection management, QP verbs) |
rdma-io-tonic |
tonic gRPC transport over RDMA (connector, incoming, optional TLS) |
rdma-io-quinn |
Quinn QUIC over RDMA (AsyncUdpSocket implementation via Transport trait) |
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, Quinn QUIC, tonic-h3) |
Quick Start
Async Stream (tokio)
use AsyncCmListener;
use AsyncRdmaStream;
use SendRecvConfig;
let config = stream;
// Server
let listener = bind.unwrap;
let transport = config.accept.await.unwrap;
let mut server = new;
// Client
let addr = "10.0.0.1:9999".parse.unwrap;
let transport = config.connect.await.unwrap;
let mut client = new;
client.write_all.await.unwrap;
tonic gRPC over RDMA
use SendRecvConfig;
use ;
// Server
let incoming = bind?;
builder
.add_service
.serve_with_incoming.await?;
// Client
let connector = new;
let channel = from_static
.connect_with_connector.await?;
Quinn QUIC over RDMA
use SendRecvConfig;
use RdmaUdpSocket;
use ;
// Server: bind RDMA socket with transport builder, create Quinn endpoint
let server_socket = new;
let server_endpoint = new_with_abstract_socket?;
let incoming = server_endpoint.accept.await.unwrap;
// Client: pre-connect RDMA, then create Quinn endpoint
let client_socket = bind?;
client_socket.connect_to.await?;
let client_endpoint = new_with_abstract_socket?;
let connection = client_endpoint.connect?.await?;
tonic gRPC over HTTP/3 over RDMA
use SendRecvConfig;
use RdmaUdpSocket;
use ;
// Server: RDMA socket → Quinn endpoint → tonic-h3 acceptor
let socket = new;
let endpoint = new_with_abstract_socket?;
let acceptor = new;
new.serve.await?;
// Client: pre-connect RDMA → Quinn endpoint → H3 channel → gRPC client
let socket = bind?;
socket.connect_to.await?;
let endpoint = new_with_abstract_socket?;
let connector = new;
let channel = new;
let client = new;
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 |
| rdma-transport-layer.md | Transport trait architecture and transport implementations |
| quinn-rdma.md | Quinn QUIC over RDMA design (includes tonic-h3 integration) |
| rdma-transport-comparison.md | Three-way transport comparison (rdma-io vs msquic vs ring) |
| 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