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>
impl<'res> QueuePair<'res>
Sourcepub unsafe fn post_send<T, R>(
&mut self,
mr: &mut MemoryRegion<T>,
range: R,
wr_id: u64,
) -> Result<()>
pub unsafe fn post_send<T, R>( &mut self, mr: &mut MemoryRegion<T>, range: R, wr_id: u64, ) -> Result<()>
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 inQueuePair
.
Sourcepub unsafe fn post_receive<T, R>(
&mut self,
mr: &mut MemoryRegion<T>,
range: R,
wr_id: u64,
) -> Result<()>
pub unsafe fn post_receive<T, R>( &mut self, mr: &mut MemoryRegion<T>, range: R, wr_id: u64, ) -> Result<()>
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 inQueuePair
.