pub struct QueuePair { /* private fields */ }Expand description
An RDMA Queue Pair.
This struct manages the lifecycle of the QP resource. It holds strong references to its
dependencies (ProtectionDomain and CompletionQueue) to ensure they remain
allocated as long as this QP exists.
Implementations§
Source§impl QueuePair
impl QueuePair
Sourcepub fn builder<'f1, 'f2, 'f3>() -> QueuePairBuilder<'f1, 'f2, 'f3>
pub fn builder<'f1, 'f2, 'f3>() -> QueuePairBuilder<'f1, 'f2, 'f3>
Configures and allocates a new Queue Pair.
This builder creates the QP hardware resources.
It returns a PreparedQueuePair which must be connected via a handshake before it can be used.
§Arguments
pd— The Protection Domain this QP belongs to.send_cq/recv_cq— The completion queues for operation results.access— The operations allowed on this QP (e.g., Remote Write).max_*— Hardware limits for the Work Queues.
§Errors
IbvError::InvalidInput— InvalidProtectionDomain, invalid Context, or invalid configuration values (e.g.,max_send_wrexceeds hardware limits).IbvError::Resource— Insufficient memory or hardware resources to create the QP.IbvError::Permission— Not enough permissions to create this type of QP.IbvError::Driver— Underlying driver failure (e.g.,ENOSYSif the transport type isn’t supported).
Source§impl QueuePair
impl QueuePair
Sourcepub unsafe fn post_send(
&mut self,
wr: SendWorkRequest<'_, '_>,
wr_id: u64,
) -> IbvResult<()>
pub unsafe fn post_send( &mut self, wr: SendWorkRequest<'_, '_>, wr_id: u64, ) -> IbvResult<()>
Posts a Send request to the Send Queue.
§Safety
The buffers referenced by the gather_elements must remain valid and immutable
until the work is finished by the hardware (signaled via the Send CQ).
You must ensure that the lifetime of the data, which was tied to the
GatherElement, is manually extended until completion.
Sourcepub unsafe fn post_receive(
&mut self,
wr: ReceiveWorkRequest<'_, '_>,
wr_id: u64,
) -> IbvResult<()>
pub unsafe fn post_receive( &mut self, wr: ReceiveWorkRequest<'_, '_>, wr_id: u64, ) -> IbvResult<()>
Posts a Receive request to the Receive Queue.
§Safety
The buffers referenced by the scatter_elements must remain valid and exclusive
(mutable) until the work is finished by the hardware (signaled via the Recv CQ).
Accessing these buffers before completion results in a data race (Undefined Behavior).
Sourcepub unsafe fn post_write(
&mut self,
wr: WriteWorkRequest<'_, '_>,
wr_id: u64,
) -> IbvResult<()>
pub unsafe fn post_write( &mut self, wr: WriteWorkRequest<'_, '_>, wr_id: u64, ) -> IbvResult<()>
Posts an RDMA Write request.
§Safety
The buffers referenced by the gather_elements must remain valid and immutable
until the work is finished by the hardware.
Additionally, the remote address range must be valid on the remote peer; otherwise, a Remote Access Error will occur.
Trait Implementations§
impl Send for QueuePair
SAFETY: libibverbs resources are thread-safe.
impl Sync for QueuePair
SAFETY: libibverbs resources are thread-safe.