rdma_create_qp

Allocates a queue pair (QP).

Syntax

#include <rdma/rdma_cma.h>
int rdma_create_qp(struct rdma_cm_id *id, struct ibv_pd *pd, struct ibv_qp_init_attr *qp_init_attr);

Description

The rdma_create_qp function allocates a queue pair (QP) that is associated with a specified rdma_cm_id identifier, and transitions it for sending and receiving.

Notes:
  • The rdma_cm_id identifier must be associated with a local RDMA device before running the rdma_create_qp function, and the protection domain must be for the same device.
  • QPs that are allocated to an rdma_cm_id identifier are automatically transitioned by the librdmacm library through their states. The QP is ready to handle posting of received data after the QP is allocated. If the QP is not connected, it is ready to post send data.
  • If a protection domain is not specified then the - pd parameter is NULL, then the rdma_cm_id identifer is created by using a default protection domain. One default protection domain is allocated per RDMA device. The initial QP attributes are specified by using theqp_init_attr parameter. The send_cq and recv_cq fields in the ibv_qp_init_attr are optional. If a send or receive completion queue (CQ) is not specified, then a CQ is allocated by the rdma_cm for the QP, along with corresponding completion channels. Completion channels and CQ data created by the rdma_cm can be accessed by user by using the rdma_cm_id structure. The actual capabilities and properties of the QP that is created is returned to the user through the qp_init_attr parameter.

Parameters

Item Description
id Specifies the communication identifier to create.
pd Specifies the optional protection domain for the QP.
qp_init_attr Specifies the initial QP attributes.

Return Values

The rdma_destroy_event_channel function returns 0 on success, or -1 on error. If an error occurs, errno indicates the reason for failure.