Skip to main content

QueuePair

Struct QueuePair 

Source
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

Source

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 — Invalid ProtectionDomain, invalid Context, or invalid configuration values (e.g., max_send_wr exceeds 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., ENOSYS if the transport type isn’t supported).
Source§

impl QueuePair

Source

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.

Source

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).

Source

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.

Source

pub unsafe fn post_read( &mut self, wr: ReadWorkRequest<'_, '_>, wr_id: u64, ) -> IbvResult<()>

Posts an RDMA Read request.

§Safety

The buffers referenced by the scatter_elements must remain valid and exclusive (mutable) until the work is finished by the hardware.

Trait Implementations§

Source§

impl Debug for QueuePair

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Drop for QueuePair

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for QueuePair

SAFETY: libibverbs resources are thread-safe.

Source§

impl Sync for QueuePair

SAFETY: libibverbs resources are thread-safe.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.