---
name: "rdma_create_qp"
section: "3"
platform: "linux"
package: "rdma-core"
version: "65.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/rdma_create_qp"
---

# rdma\_create\_qp(3)

Allocate a QP.

## NAME

rdma\_create\_qp - Allocate a QP.

## SYNOPSIS

**#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***);**

## ARGUMENTS

- id

  RDMA identifier.

- pd

  Optional protection domain for the QP.

- qp\_init\_attr

  Initial QP attributes.

## DESCRIPTION

Allocate a QP associated with the specified rdma\_cm\_id and transition it for sending and receiving.

## RETURN VALUE

Returns 0 on success, or -1 on error.  If an error occurs, errno will be set to indicate the failure reason.

## NOTES

The rdma\_cm\_id must be bound to a local RDMA device before calling this function, and the protection domain must be for that same device. QPs allocated to an rdma\_cm\_id are automatically transitioned by the librdmacm through their states.  After being allocated, the QP will be ready to handle posting of receives.  If the QP is unconnected, it will be ready to post sends.

If a protection domain is not given - pd parameter is NULL - then the rdma\_cm\_id will be created using a default protection domain.  One default protection domain is allocated per RDMA device.

The initial QP attributes are specified by the qp\_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 is not specified, then a CQ will be allocated by the rdma\_cm for the QP, along with corresponding completion channels.  Completion channels and CQ data created by the rdma\_cm are exposed to the user through the rdma\_cm\_id structure.

The actual capabilities and properties of the created QP will be returned to the user through the qp\_init\_attr parameter.  An rdma\_cm\_id may only be associated with a single QP.

## SEE ALSO

[rdma\_bind\_addr(3)](/rdma_bind_addr/3.md), [rdma\_resolve\_addr(3)](/rdma_resolve_addr/3.md), [rdma\_destroy\_qp(3)](/rdma_destroy_qp/3.md), [ibv\_create\_qp(3)](/ibv_create_qp/3.md), [ibv\_modify\_qp(3)](/ibv_modify_qp/3.md)
