pub struct AsyncCmId { /* private fields */ }Expand description
An async RDMA CM ID for client-side connections.
Wraps CmId + EventChannel and provides async versions of the CM
operations (resolve_addr, resolve_route, connect). Use with
AsyncQp for direct async RDMA verb access, or use AsyncRdmaStream
for a higher-level TCP-like interface.
§Example
use rdma_io::async_cm::AsyncCmId;
let cm_id = AsyncCmId::connect_to(&"10.0.0.1:9999".parse().unwrap()).await?;
// Access the inner CmId for QP setup, verb operations, etc.
let ctx = cm_id.verbs_context().unwrap();
let pd = cm_id.alloc_pd()?;Implementations§
Source§impl AsyncCmId
impl AsyncCmId
Sourcepub fn new(port_space: PortSpace) -> Result<Self>
pub fn new(port_space: PortSpace) -> Result<Self>
Create a new async CM ID on its own event channel.
Sourcepub async fn resolve_addr(
&self,
src: Option<&SocketAddr>,
dst: &SocketAddr,
timeout_ms: i32,
) -> Result<()>
pub async fn resolve_addr( &self, src: Option<&SocketAddr>, dst: &SocketAddr, timeout_ms: i32, ) -> Result<()>
Resolve the destination address asynchronously.
Sourcepub async fn resolve_route(&self, timeout_ms: i32) -> Result<()>
pub async fn resolve_route(&self, timeout_ms: i32) -> Result<()>
Resolve the route asynchronously.
Sourcepub async fn connect(&self, param: &ConnParam) -> Result<()>
pub async fn connect(&self, param: &ConnParam) -> Result<()>
Perform the RDMA connect handshake asynchronously.
Sourcepub async fn connect_to(addr: &SocketAddr) -> Result<Self>
pub async fn connect_to(addr: &SocketAddr) -> Result<Self>
Full async connect: resolve_addr → resolve_route → connect.
Convenience method that performs all three CM phases.
Sourcepub fn event_channel(&self) -> &EventChannel
pub fn event_channel(&self) -> &EventChannel
Access the inner EventChannel.
Sourcepub fn verbs_context(&self) -> Option<Arc<Context>>
pub fn verbs_context(&self) -> Option<Arc<Context>>
Get the verbs context (device) associated with this CM ID.
Sourcepub fn alloc_pd(&self) -> Result<Arc<ProtectionDomain>>
pub fn alloc_pd(&self) -> Result<Arc<ProtectionDomain>>
Allocate a protection domain on this CM ID’s device.
Sourcepub fn create_qp_with_cq(
&self,
pd: &Arc<ProtectionDomain>,
init_attr: &QpInitAttr,
send_cq: Option<&Arc<CompletionQueue>>,
recv_cq: Option<&Arc<CompletionQueue>>,
) -> Result<CmQueuePair>
pub fn create_qp_with_cq( &self, pd: &Arc<ProtectionDomain>, init_attr: &QpInitAttr, send_cq: Option<&Arc<CompletionQueue>>, recv_cq: Option<&Arc<CompletionQueue>>, ) -> Result<CmQueuePair>
Create a QP with separate send/recv CQs on this CM ID.
Returns an owned [CmQueuePair] that the caller must keep alive.
Sourcepub fn qp_raw(&self) -> *mut ibv_qp
pub fn qp_raw(&self) -> *mut ibv_qp
Raw QP pointer (from the cm_id, for low-level use before QP is transferred).
Sourcepub fn disconnect(&self) -> Result<()>
pub fn disconnect(&self) -> Result<()>
Disconnect the connection (fire-and-forget, synchronous).
Sourcepub async fn disconnect_async(&self) -> Result<()>
pub async fn disconnect_async(&self) -> Result<()>
Disconnect and await the DISCONNECTED event from the peer.
This performs a graceful disconnect: sends the disconnect request,
then waits for the peer to acknowledge it. Analogous to TCP’s
shutdown() + await FIN-ACK.
Sourcepub async fn next_event(&self) -> Result<CmEvent>
pub async fn next_event(&self) -> Result<CmEvent>
Await the next CM event on this connection’s event channel.
Returns any event (disconnect, error, etc.). The caller must ack the
event via [CmEvent::ack()]. Useful for monitoring connection
lifecycle (e.g., detecting peer disconnect via select!).
Sourcepub fn into_parts(self) -> (EventChannel, CmId)
pub fn into_parts(self) -> (EventChannel, CmId)
Decompose into the inner EventChannel and CmId.
Used when transferring ownership to a higher-level type (e.g., AsyncRdmaStream).