Struct ibverbs::PreparedQueuePair
source · pub struct PreparedQueuePair<'res> { /* private fields */ }
Expand description
An allocated but uninitialized QueuePair
.
Specifically, this QueuePair
has been allocated with ibv_create_qp
, but has not yet been
initialized with calls to ibv_modify_qp
.
To complete the construction of the QueuePair
, you will need to obtain the
QueuePairEndpoint
of the remote end (by using PreparedQueuePair::endpoint
), and then call
PreparedQueuePair::handshake
on both sides with the other side’s QueuePairEndpoint
:
// on host 1
let pqp: PreparedQueuePair = ...;
let host1end = pqp.endpoint();
host2.send(host1end);
let host2end = host2.recv();
let qp = pqp.handshake(host2end);
// on host 2
let pqp: PreparedQueuePair = ...;
let host2end = pqp.endpoint();
host1.send(host2end);
let host1end = host1.recv();
let qp = pqp.handshake(host1end);
Implementations§
source§impl<'res> PreparedQueuePair<'res>
impl<'res> PreparedQueuePair<'res>
sourcepub fn endpoint(&self) -> QueuePairEndpoint
pub fn endpoint(&self) -> QueuePairEndpoint
Get the network endpoint for this QueuePair
.
This endpoint will need to be communicated to the QueuePair
on the remote end.
sourcepub fn handshake(self, remote: QueuePairEndpoint) -> Result<QueuePair<'res>>
pub fn handshake(self, remote: QueuePairEndpoint) -> Result<QueuePair<'res>>
Set up the QueuePair
such that it is ready to exchange packets with a remote QueuePair
.
Internally, this uses ibv_modify_qp
to mark the QueuePair
as initialized
(IBV_QPS_INIT
), ready to receive (IBV_QPS_RTR
), and ready to send (IBV_QPS_RTS
).
Further discussion of the protocol can be found on RDMAmojo.
If the endpoint contains a Gid, the routing will be global. This means:
ah_attr.is_global = 1;
ah_attr.grh.hop_limit = 0xff;
The handshake also sets the following parameters, which are currently not configurable:
§Examples
port_num = PORT_NUM;
pkey_index = 0;
rq_psn = 0;
sq_psn = 0;
max_dest_rd_atomic = 1;
max_rd_atomic = 1;
ah_attr.sl = 0;
ah_attr.src_path_bits = 0;
§Errors
EINVAL
: Invalid value provided inattr
or inattr_mask
.ENOMEM
: Not enough resources to complete this operation.