pub struct RdmaQueuePair {
pub send_cq: usize,
pub recv_cq: usize,
pub qp: usize,
pub dv_qp: usize,
pub dv_send_cq: usize,
pub dv_recv_cq: usize,
pub send_wqe_idx: u32,
pub send_db_idx: u32,
pub send_cq_idx: u32,
pub recv_wqe_idx: u32,
pub recv_db_idx: u32,
pub recv_cq_idx: u32,
/* private fields */
}
Expand description
Represents an RDMA Queue Pair (QP) that enables communication between two endpoints.
An RdmaQueuePair
encapsulates the send and receive queues, completion queue,
and other resources needed for RDMA communication. It provides methods for
establishing connections and performing RDMA operations like read and write.
§Fields
send_cq
- Send Completion Queue pointer for tracking send operation completionsrecv_cq
- Receive Completion Queue pointer for tracking receive operation completionsqp
- Queue Pair pointer that manages send and receive operationsdv_qp
- Pointer to the mlx5 device-specific queue pair structuredv_send_cq
- Pointer to the mlx5 device-specific send completion queue structuredv_recv_cq
- Pointer to the mlx5 device-specific receive completion queue structurecontext
- RDMA device context pointerconfig
- Configuration settings for the queue pair
§Connection Lifecycle
- Create with
new()
from anRdmaDomain
- Get connection info with
get_qp_info()
- Exchange connection info with remote peer (application must handle this)
- Connect to remote endpoint with
connect()
- Perform RDMA operations with
put()
orget()
- Poll for completions with
poll_send_completion()
orpoll_recv_completion()
Fields§
§send_cq: usize
§recv_cq: usize
§qp: usize
§dv_qp: usize
§dv_send_cq: usize
§dv_recv_cq: usize
§send_wqe_idx: u32
§send_db_idx: u32
§send_cq_idx: u32
§recv_wqe_idx: u32
§recv_db_idx: u32
§recv_cq_idx: u32
Implementations§
Source§impl RdmaQueuePair
impl RdmaQueuePair
Sourcepub fn new(
context: *mut ibv_context,
pd: *mut ibv_pd,
config: IbverbsConfig,
) -> Result<Self, Error>
pub fn new( context: *mut ibv_context, pd: *mut ibv_pd, config: IbverbsConfig, ) -> Result<Self, Error>
Creates a new RdmaQueuePair from a given RdmaDomain.
This function initializes a new Queue Pair (QP) and associated Completion Queue (CQ)
using the resources from the provided RdmaDomain. The QP is created in the RESET state
and must be transitioned to other states via the connect()
method before use.
§Arguments
domain
- Reference to an RdmaDomain that provides the context, protection domain, and memory region for this queue pair
§Returns
Result<Self>
- A new RdmaQueuePair instance or an error if creation fails
§Errors
This function may return errors if:
- Completion queue (CQ) creation fails
- Queue pair (QP) creation fails
Sourcepub fn get_qp_info(&mut self) -> Result<RdmaQpInfo, Error>
pub fn get_qp_info(&mut self) -> Result<RdmaQpInfo, Error>
Returns the information required for a remote peer to connect to this queue pair.
This method retrieves the local queue pair attributes and port information needed by
a remote peer to establish an RDMA connection. The returned RdmaQpInfo
contains
the queue pair number, LID, GID, and other necessary connection parameters.
§Returns
Result<RdmaQpInfo>
- Connection information for the remote peer or an error
§Errors
This function may return errors if:
- Port attribute query fails
- GID query fails
pub fn state(&mut self) -> Result<u32, Error>
Sourcepub fn connect(&mut self, connection_info: &RdmaQpInfo) -> Result<(), Error>
pub fn connect(&mut self, connection_info: &RdmaQpInfo) -> Result<(), Error>
Connect to a remote Rdma connection point.
This performs the necessary QP state transitions (INIT->RTR->RTS) to establish a connection.
§Arguments
connection_info
- The remote connection info to connect to
pub fn recv( &mut self, lhandle: RdmaBuffer, rhandle: RdmaBuffer, ) -> Result<(), Error>
pub fn put_with_recv( &mut self, lhandle: RdmaBuffer, rhandle: RdmaBuffer, ) -> Result<(), Error>
pub fn put( &mut self, lhandle: RdmaBuffer, rhandle: RdmaBuffer, ) -> Result<(), Error>
Sourcepub fn ring_doorbell(&mut self) -> Result<(), Error>
pub fn ring_doorbell(&mut self) -> Result<(), Error>
Get a doorbell for the queue pair.
This method returns a doorbell that can be used to trigger the execution of previously enqueued operations.
§Returns
Result<DoorBell, anyhow::Error>
- A doorbell for the queue pair
Sourcepub fn enqueue_put(
&mut self,
lhandle: RdmaBuffer,
rhandle: RdmaBuffer,
) -> Result<(), Error>
pub fn enqueue_put( &mut self, lhandle: RdmaBuffer, rhandle: RdmaBuffer, ) -> Result<(), Error>
Sourcepub fn enqueue_put_with_recv(
&mut self,
lhandle: RdmaBuffer,
rhandle: RdmaBuffer,
) -> Result<(), Error>
pub fn enqueue_put_with_recv( &mut self, lhandle: RdmaBuffer, rhandle: RdmaBuffer, ) -> Result<(), Error>
Enqueues a put with receive operation without ringing the doorbell.
This method prepares a put with receive operation but does not execute it.
Use get_doorbell().ring()
to execute the operation.
§Arguments
lhandle
- Local buffer handlerhandle
- Remote buffer handle
§Returns
Result<(), anyhow::Error>
- Success or error
Sourcepub fn enqueue_get(
&mut self,
lhandle: RdmaBuffer,
rhandle: RdmaBuffer,
) -> Result<(), Error>
pub fn enqueue_get( &mut self, lhandle: RdmaBuffer, rhandle: RdmaBuffer, ) -> Result<(), Error>
pub fn get( &mut self, lhandle: RdmaBuffer, rhandle: RdmaBuffer, ) -> Result<(), Error>
Sourcepub fn poll_completion_target(
&mut self,
target: PollTarget,
) -> Result<Option<IbvWc>, Error>
pub fn poll_completion_target( &mut self, target: PollTarget, ) -> Result<Option<IbvWc>, Error>
pub fn poll_send_completion(&mut self) -> Result<Option<IbvWc>, Error>
pub fn poll_recv_completion(&mut self) -> Result<Option<IbvWc>, Error>
Trait Implementations§
Source§impl Clone for RdmaQueuePair
impl Clone for RdmaQueuePair
Source§fn clone(&self) -> RdmaQueuePair
fn clone(&self) -> RdmaQueuePair
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for RdmaQueuePair
impl Debug for RdmaQueuePair
Source§impl<'de> Deserialize<'de> for RdmaQueuePair
impl<'de> Deserialize<'de> for RdmaQueuePair
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Named for RdmaQueuePair
impl Named for RdmaQueuePair
Source§fn typename() -> &'static str
fn typename() -> &'static str
Source§fn typehash() -> u64
fn typehash() -> u64
Source§fn typeid() -> TypeId
fn typeid() -> TypeId
Source§fn port() -> u64
fn port() -> u64
Auto Trait Implementations§
impl Freeze for RdmaQueuePair
impl RefUnwindSafe for RdmaQueuePair
impl Send for RdmaQueuePair
impl Sync for RdmaQueuePair
impl Unpin for RdmaQueuePair
impl UnwindSafe for RdmaQueuePair
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Checkpointable for Twhere
T: RemoteMessage + Clone,
impl<T> Checkpointable for Twhere
T: RemoteMessage + Clone,
Source§type State = T
type State = T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<A, M> Handler<IndexedErasedUnbound<M>> for A
impl<A, M> Handler<IndexedErasedUnbound<M>> for A
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more