Struct ibverbs::QueuePair

source ·
pub struct QueuePair<'res> { /* private fields */ }
Expand description

A fully initialized and ready QueuePair.

A queue pair is the actual object that sends and receives data in the RDMA architecture (something like a socket). It’s not exactly like a socket, however. A socket is an abstraction, which is maintained by the network stack and doesn’t have a physical resource behind it. A QP is a resource of an RDMA device and a QP number can be used by one process at the same time (similar to a socket that is associated with a specific TCP or UDP port number)

Implementations§

source§

impl<'res> QueuePair<'res>

source

pub unsafe fn post_send<T, R>( &mut self, mr: &mut MemoryRegion<T>, range: R, wr_id: u64 ) -> Result<()>
where R: SliceIndex<[T], Output = [T]>,

Posts a linked list of Work Requests (WRs) to the Send Queue of this Queue Pair.

Generates a HW-specific Send Request for the memory at mr[range], and adds it to the tail of the Queue Pair’s Send Queue without performing any context switch. The RDMA device will handle it (later) in asynchronous way. If there is a failure in one of the WRs because the Send Queue is full or one of the attributes in the WR is bad, it stops immediately and return the pointer to that WR.

wr_id is a 64 bits value associated with this WR. If a Work Completion will be generated when this Work Request ends, it will contain this value.

Internally, the memory at mr[range] will be sent as a single ibv_send_wr using IBV_WR_SEND. The send has IBV_SEND_SIGNALED set, so a work completion will also be triggered as a result of this send.

See also RDMAmojo’s ibv_post_send documentation.

§Safety

The memory region can only be safely reused or dropped after the request is fully executed and a work completion has been retrieved from the corresponding completion queue (i.e., until CompletionQueue::poll returns a completion for this send).

§Errors
  • EINVAL: Invalid value provided in the Work Request.
  • ENOMEM: Send Queue is full or not enough resources to complete this operation.
  • EFAULT: Invalid value provided in QueuePair.
source

pub unsafe fn post_receive<T, R>( &mut self, mr: &mut MemoryRegion<T>, range: R, wr_id: u64 ) -> Result<()>
where R: SliceIndex<[T], Output = [T]>,

Posts a linked list of Work Requests (WRs) to the Receive Queue of this Queue Pair.

Generates a HW-specific Receive Request out of it and add it to the tail of the Queue Pair’s Receive Queue without performing any context switch. The RDMA device will take one of those Work Requests as soon as an incoming opcode to that QP will consume a Receive Request (RR). If there is a failure in one of the WRs because the Receive Queue is full or one of the attributes in the WR is bad, it stops immediately and return the pointer to that WR.

wr_id is a 64 bits value associated with this WR. When a Work Completion is generated when this Work Request ends, it will contain this value.

Internally, the memory at mr[range] will be received into as a single ibv_recv_wr.

See also DDMAmojo’s ibv_post_recv documentation.

§Safety

The memory region can only be safely reused or dropped after the request is fully executed and a work completion has been retrieved from the corresponding completion queue (i.e., until CompletionQueue::poll returns a completion for this receive).

§Errors
  • EINVAL: Invalid value provided in the Work Request.
  • ENOMEM: Receive Queue is full or not enough resources to complete this operation.
  • EFAULT: Invalid value provided in QueuePair.

Trait Implementations§

source§

impl<'a> Drop for QueuePair<'a>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'a> Send for QueuePair<'a>

source§

impl<'a> Sync for QueuePair<'a>

Auto Trait Implementations§

§

impl<'res> RefUnwindSafe for QueuePair<'res>

§

impl<'res> Unpin for QueuePair<'res>

§

impl<'res> UnwindSafe for QueuePair<'res>

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>,

§

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>,

§

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.