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

# mlx5dv\_reserved\_qpn\_alloc(3)

Allocate a reserved QP number from device mlx5dv\_reserved\_qpn\_dealloc - Release the reserved QP number

## NAME

mlx5dv\_reserved\_qpn\_alloc - Allocate a reserved QP number from device

mlx5dv\_reserved\_qpn\_dealloc - Release the reserved QP number

## SYNOPSIS

-

  ```
  #include <infiniband/mlx5dv.h>
  int mlx5dv_reserved_qpn_alloc(struct ibv_context *ctx, uint32_t *qpn);
  int mlx5dv_reserved_qpn_dealloc(struct ibv_context *ctx, uint32_t qpn);
  ```

## DESCRIPTION

When work with RDMA\_CM RDMA\_TCP\_PS + external QP support, a client node needs GUID level unique QP numbers to comply with the CM’s timewait logic.

If a real unique QP is not allocated, a device global QPN value is required and can be allocated via this interface.

The mlx5 DCI QP is such an example, which could connect to the remote DCT’s multiple times as long as the application provides unique QPN for each new RDMA\_CM connection.

These 2 APIs provide the allocation/deallocation of a unique QP number from/to device. This qpn can be used with DC QPN in RDMA\_CM connection establishment, which will comply with the CM timewait kernel logic.

## ARGUMENTS

- *ctx*

  The device context to issue the action on.

- *qpn*

  The allocated QP number (for alloc API), or the QP number to be deallocated (for dealloc API).

## RETURN VALUE

0 on success; EOPNOTSUPP if not supported, or other errno value on other failures.

## AUTHOR

Mark Zhang ⟨markzhang@nvidia.com⟩\\c

Alex Rosenbaum ⟨alexr@nvidia.com⟩\\c
