IBV_CREATE_QP(3)
π IBV_CREATE_QP(3) β the libibverbs programmer's manual, but make it make sense π
okay bestie, so we're in the libibverbs programmer's manual and today's main character is the queue pair. yes, that queue pair. the QP. the icon, the moment, the whole entire vibe of your RDMA life. two functions, one page, let's go π¦
β¨ NAME β¨
ibv_create_qp, ibv_destroy_qp β create or destroy a queue pair (QP)
likeβ¦ making a QP and un-making a QP. birth and departure. that's the whole thing πΈ
β¨ SYNOPSIS β¨
#include <infiniband/verbs.h>
struct ibv_qp *ibv_create_qp(struct ibv_pd *pd,
struct ibv_qp_init_attr *qp_init_attr);
int ibv_destroy_qp(struct ibv_qp *qp);
β¨ DESCRIPTION β¨
so ibv_create_qp() creates a queue pair (QP) that's associated with the protection domain pd. the qp_init_attr argument is an ibv_qp_init_attr struct, and it's defined in <infiniband/verbs.h>. slay π
struct ibv_qp_init_attr {
void *qp_context; /* Associated context of the QP */
struct ibv_cq *send_cq; /* CQ to be associated with the Send Queue (SQ) */
struct ibv_cq *recv_cq; /* CQ to be associated with the Receive Queue (RQ) */
struct ibv_srq *srq; /* SRQ handle if QP is to be associated with an SRQ, otherwise NULL */
struct ibv_qp_cap cap; /* QP capabilities */
enum ibv_qp_type qp_type; /* QP Transport Service Type: IBV_QPT_RC, IBV_QPT_UC, IBV_QPT_UD, IBV_QPT_RAW_PACKET or IBV_QPT_DRIVER */
int sq_sig_all; /* If set, each Work Request (WR) submitted to the SQ generates a completion entry */
};
and inside that there's ibv_qp_cap, the little struct holding all your hopes, dreams, and queue sizes:
struct ibv_qp_cap {
uint32_t max_send_wr; /* Requested max number of outstanding WRs in the SQ */
uint32_t max_recv_wr; /* Requested max number of outstanding WRs in the RQ */
uint32_t max_send_sge; /* Requested max number of scatter/gather (s/g) elements in a WR in the SQ */
uint32_t max_recv_sge; /* Requested max number of s/g elements in a WR in the RQ */
uint32_t max_inline_data;/* Requested max number of data (bytes) that can be posted inline to the SQ, otherwise 0 */
};
the way that ibv_create_qp() updates the qp_init_attr->cap struct with the actual QP values of the QP it just createdβ¦ obsessed. and here's the tea: those values will be greater than or equal to the values you requested. you asked for a snack, the universe gave you a feast π
and then ibv_destroy_qp() destroys the QP qp. goodbye queen, you served π
β¨ RETURN VALUE β¨
ibv_create_qp() returns a pointer to the created QP, or NULL if the request fails. and please, please bestie, check the QP number (qp_num) in the returned QP. do not skip that step, i'm begging π
ibv_destroy_qp() returns 0 on success, or the value of errno on failure (which is basically the universe telling you why it went wrong).
β¨ NOTES β¨
ibv_create_qp()will fail if it's asked to create a QP of a type other thanIBV_QPT_RCorIBV_QPT_UDassociated with an SRQ. so likeβ¦ don't do that. not the vibe π«- the attributes
max_recv_wrandmax_recv_sgeare ignored byibv_create_qp()if the QP is going to be associated with an SRQ. they're just standing there, unread, minding their business π ibv_destroy_qp()fails if the QP is attached to a multicast group. detach first, girl.IBV_QPT_DRIVERdoes not represent a specific service and is used for vendor specific QP logic. it's giving "mystery flavor" iykyk π§
β¨ SEE ALSO β¨
ibv_alloc_pd(3), ibv_modify_qp(3), ibv_query_qp(3)
the friend group π«Ά go read them, they're all part of the same storyline.
β¨ AUTHORS β¨
Dotan Barak <dotanba@gmail.com> β thank you for your service π
and that's the page, bestie! this little bundle of joy came to you from libibverbs, dated 2006-10-31, and it lives its life as IBV_CREATE_QP(3) in the Libibverbs Programmer's Manual. go forth and create (and destroy) responsibly πβ¨
π¦ where this page comes from
- alpine 3.24: rdma-core-doc 61.0-r0 Β· GPL-2.0-only OR BSD-2-Clause
- centos-stream 10: rdma-core-devel 62.0-3.el10 Β· GPLv2 or BSD
- centos-stream 9: rdma-core-devel 61.0-3.el9 Β· GPLv2 or BSD
- centos-stream 9: rdma-core-devel 61.0-3.el9 Β· GPLv2 or BSD
- debian bookworm: libibverbs-dev 44.0-2 Β· BSD-MIT OR GPL-2.0-only
- debian trixie: libibverbs-dev 56.1-1 Β· BSD-MIT OR GPL-2.0-only
- fedora 43: rdma-core-devel 58.0-4.fc43 Β· GPL-2.0-only OR BSD-2-Clause AND BSD-3-Clause
- fedora 43: rdma-core-devel 58.0-4.fc43 Β· GPL-2.0-only OR BSD-2-Clause AND BSD-3-Clause
- fedora 44: rdma-core-devel 61.0-2.fc44 Β· GPL-2.0-only OR BSD-2-Clause AND BSD-3-Clause
- fedora 44: rdma-core-devel 61.0-2.fc44 Β· GPL-2.0-only OR BSD-2-Clause AND BSD-3-Clause
- fedora 44: rdma-core-devel 61.1^20260812git975bdaf-1.fc44 Β· GPL-2.0-only OR BSD-2-Clause AND BSD-3-Clause
- fedora 44: rdma-core-devel 61.1^20260812git975bdaf-1.fc44 Β· GPL-2.0-only OR BSD-2-Clause AND BSD-3-Clause
- nixos 26.05: rdma-core 62.0
- opensuse-leap 16.0: rdma-core-devel 56.1-160000.2.2 Β· BSD-2-Clause OR GPL-2.0-only
- opensuse-leap 16.0: rdma-core-devel 56.1-160000.2.2 Β· BSD-2-Clause OR GPL-2.0-only
- opensuse-leap 16.0: rdma-core-devel 56.1-160000.2.2 Β· BSD-2-Clause OR GPL-2.0-only
- opensuse-leap 16.0: rdma-core-devel 56.1-160000.2.2 Β· BSD-2-Clause OR GPL-2.0-only
- ubuntu jammy: libibverbs-dev 39.0-1 Β· BSD-MIT OR GPL-2.0-only
- ubuntu noble: libibverbs-dev 50.0-2build2 Β· BSD-MIT OR GPL-2.0-only
- ubuntu noble: libibverbs-dev 50.0-2ubuntu0.2 Β· BSD-MIT OR GPL-2.0-only
- ubuntu questing: libibverbs-dev 56.1-1ubuntu1
- ubuntu resolute: libibverbs-dev 61.0-2ubuntu3 Β· BSD-MIT OR GPL-2.0-only
- ubuntu stonking: libibverbs-dev 64.0-1ubuntu1 Β· BSD-MIT OR GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms