pub struct IbvQueuePair {
pub send_cq: usize,
pub recv_cq: usize,
pub dv_qp: usize,
pub dv_send_cq: usize,
pub dv_recv_cq: usize,
/* private fields */
}Expand description
An RDMA Queue Pair (QP) for communication between two endpoints.
Encapsulates the send/receive queues, completion queues, and mlx5dv device-specific structures needed for RDMA communication.
§Connection Lifecycle
- Create with
new()from context and protection domain pointers - Get connection info with
get_qp_info() - Exchange connection info with remote peer
- Connect to remote endpoint with
connect() - Perform RDMA operations with
put()orget() - Poll for completions with
poll_completion()
§Notes
- The
qpfield stores a pointer tordmaxcel_qp_t(notibv_qp). It is private; external callers reach it viaSelf::as_ptr. rdmaxcel_qp_tcontains atomic counters and completion caches internallyIbvQueuePairis single-owner: itsDropdestroys the FFI QP, so the type is intentionally!Clone(and not sent across the wire).
Fields§
§send_cq: usize§recv_cq: usize§dv_qp: usize§dv_send_cq: usize§dv_recv_cq: usizeImplementations§
Source§impl IbvQueuePair
impl IbvQueuePair
Sourcepub unsafe fn as_ptr(&self) -> *mut rdmaxcel_qp
pub unsafe fn as_ptr(&self) -> *mut rdmaxcel_qp
Returns the underlying rdmaxcel_qp_t pointer for callers
driving the device doorbell or building FFI parameter blocks
directly.
§Safety
The returned pointer is only valid for as long as the borrow
of self lives. The caller must ensure all reads/writes
through the pointer complete before this IbvQueuePair is
dropped, since Drop calls rdmaxcel_qp_destroy on it.
Sourcepub fn new<I: IbvDomainImpl>(
domain: &IbvDomain<I>,
config: IbvConfig,
) -> Result<Self, Error>
pub fn new<I: IbvDomainImpl>( domain: &IbvDomain<I>, config: IbvConfig, ) -> Result<Self, Error>
Creates a new IbvQueuePair.
Initializes a new Queue Pair (QP) and associated Completion Queues (CQ)
using the provided context and protection domain. The QP is created in
the RESET state and must be transitioned via connect() before use.
§Errors
Returns errors if CQ or QP creation fails.
Sourcepub fn get_qp_info(&mut self) -> Result<IbvQpInfo, Error>
pub fn get_qp_info(&mut self) -> Result<IbvQpInfo, Error>
Returns the connection info needed by a remote peer to connect to this QP.
Sourcepub fn connect(&mut self, connection_info: &IbvQpInfo) -> Result<(), Error>
pub fn connect(&mut self, connection_info: &IbvQpInfo) -> Result<(), Error>
Transitions the QP through INIT -> RTR -> RTS to establish a connection.
§Arguments
connection_info- The remote connection info to connect to
pub fn recv( &mut self, lhandle: IbvBuffer, rhandle: IbvBuffer, ) -> Result<u64, Error>
pub fn put_with_recv( &mut self, lhandle: IbvBuffer, rhandle: IbvBuffer, ) -> Result<Vec<u64>, Error>
pub fn put( &mut self, lhandle: IbvBuffer, rhandle: IbvBuffer, ) -> Result<Vec<u64>, Error>
Sourcepub fn ring_doorbell(&mut self) -> Result<(), Error>
pub fn ring_doorbell(&mut self) -> Result<(), Error>
Rings the doorbell to execute all enqueued operations.
Sourcepub fn enqueue_put(
&mut self,
lhandle: IbvBuffer,
rhandle: IbvBuffer,
) -> Result<Vec<u64>, Error>
pub fn enqueue_put( &mut self, lhandle: IbvBuffer, rhandle: IbvBuffer, ) -> Result<Vec<u64>, Error>
Enqueues a put operation without ringing the doorbell.
Sourcepub fn enqueue_put_with_recv(
&mut self,
lhandle: IbvBuffer,
rhandle: IbvBuffer,
) -> Result<Vec<u64>, Error>
pub fn enqueue_put_with_recv( &mut self, lhandle: IbvBuffer, rhandle: IbvBuffer, ) -> Result<Vec<u64>, Error>
Enqueues a put-with-receive operation without ringing the doorbell.
Sourcepub fn enqueue_get(
&mut self,
lhandle: IbvBuffer,
rhandle: IbvBuffer,
) -> Result<Vec<u64>, Error>
pub fn enqueue_get( &mut self, lhandle: IbvBuffer, rhandle: IbvBuffer, ) -> Result<Vec<u64>, Error>
Enqueues a get operation without ringing the doorbell.
pub fn get( &mut self, lhandle: IbvBuffer, rhandle: IbvBuffer, ) -> Result<Vec<u64>, Error>
Sourcepub fn poll_completion(
&mut self,
target: PollTarget,
) -> Result<Option<Result<IbvWc, WorkRequestError>>, PollCompletionError>
pub fn poll_completion( &mut self, target: PollTarget, ) -> Result<Option<Result<IbvWc, WorkRequestError>>, PollCompletionError>
Polls target’s completion queue for a single work completion.
This is a thin wrapper over one ibv_poll_cq call. It does no
per-WR bookkeeping: the caller owns matching each completion back
to the work request it posted (by IbvWc::wr_id) and must keep
polling until the queue drains so that no completion is lost.
§Returns
Ok(None)— the CQ is currently empty.Ok(Some(Ok(wc)))— a completion landed with success status.Ok(Some(Err(_)))— a completion landed with a non-success status; theWorkRequestErrornames the failed request.Err(_)—ibv_poll_cqitself failed; the QP should be treated as poisoned.
Trait Implementations§
Source§impl Debug for IbvQueuePair
impl Debug for IbvQueuePair
Source§impl Drop for IbvQueuePair
impl Drop for IbvQueuePair
Source§impl IbvQueuePair for IbvQueuePair
impl IbvQueuePair for IbvQueuePair
Source§unsafe fn new<I: IbvDomainImpl<QueuePair = Self>>(
domain: &IbvDomain<I>,
config: IbvConfig,
) -> Result<Self, Error>
unsafe fn new<I: IbvDomainImpl<QueuePair = Self>>( domain: &IbvDomain<I>, config: IbvConfig, ) -> Result<Self, Error>
domain in the RESET state;
Self::connect transitions it to RTS before use. Read moreSource§fn connect(&mut self, info: &IbvQpInfo) -> Result<(), Error>
fn connect(&mut self, info: &IbvQpInfo) -> Result<(), Error>
INIT -> RTR -> RTS, connected to info.Source§fn get_qp_info(&mut self) -> Result<IbvQpInfo, Error>
fn get_qp_info(&mut self) -> Result<IbvQpInfo, Error>
Source§fn put(
&mut self,
remote_dst: IbvBuffer,
local_src: IbvBuffer,
) -> Result<Vec<u64>, Error>
fn put( &mut self, remote_dst: IbvBuffer, local_src: IbvBuffer, ) -> Result<Vec<u64>, Error>
local_src into remote_dst. The request may
be chunked into multiple WRs. This method returns the list of WR ids
that were posted.Source§fn get(
&mut self,
local_dst: IbvBuffer,
remote_src: IbvBuffer,
) -> Result<Vec<u64>, Error>
fn get( &mut self, local_dst: IbvBuffer, remote_src: IbvBuffer, ) -> Result<Vec<u64>, Error>
remote_src into local_dst. The request may
be chunked into multiple WRs. This method returns the list of WR ids
that were posted.Source§fn poll_completion(
&mut self,
target: PollTarget,
) -> Result<Option<Result<IbvWc, WorkRequestError>>, PollCompletionError>
fn poll_completion( &mut self, target: PollTarget, ) -> Result<Option<Result<IbvWc, WorkRequestError>>, PollCompletionError>
target’s completion queue for a single work completion. Read moreAuto Trait Implementations§
impl Freeze for IbvQueuePair
impl RefUnwindSafe for IbvQueuePair
impl Send for IbvQueuePair
impl Sync for IbvQueuePair
impl Unpin for IbvQueuePair
impl UnsafeUnpin for IbvQueuePair
impl UnwindSafe for IbvQueuePair
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§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>
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].