IBV_CREATE_WQ(3)
π ibv_create_wq(3) β the Libibverbs Programmer's Manual era π
okay bestie, so this one lives in the Libibverbs Programmer's Manual and it's literally the manual page for ibv_create_wq and ibv_destroy_wq. two functions. one page. main character energy fr fr. π
β¨ NAME β¨
ibv_create_wq, ibv_destroy_wq β create or destroy a Work Queue (WQ).
likeβ¦ you can make a WQ and you can un-make a WQ. that's the whole vibe. π¦
β¨ SYNOPSIS β¨
#include <infiniband/verbs.h>
struct ibv_wq *ibv_create_wq(struct ibv_context *context,
struct ibv_wq_init_attr *wq_init_attr);
int ibv_destroy_wq(struct ibv_wq *wq);
see how one of them gives you back a pointer and the other one just gives you an int? π
that's the whole personality of this pair ngl.
β¨ DESCRIPTION β¨
ibv_create_wq() creates a WQ that's associated with the ibv_context context. π«Ά
the wq_init_attr argument is an ibv_wq_init_attr struct, and it's defined in <infiniband/verbs.h> β so yes, that's where you go looking for it, don't @ me.
struct ibv_wq_init_attr {
void *wq_context; /* Associated context of the WQ */
enum ibv_wq_type wq_type; /* WQ type */
uint32_t max_wr; /* Requested max number of outstanding WRs in the WQ */
uint32_t max_sge; /* Requested max number of scatter/gather (s/g) elements per WR in the WQ */
struct ibv_pd *pd; /* PD to be associated with the WQ */
struct ibv_cq *cq; /* CQ to be associated with the WQ */
uint32_t comp_mask; /* Identifies valid fields. Use ibv_wq_init_attr_mask */
uint32_t create_flags /* Creation flags for this WQ, use enum ibv_wq_flags */
};
okay so field by field, no skipping, we go through ALL of them:
wq_contextβ the associated context of the WQ.wq_typeβ the WQ type, bestie. it's anenum ibv_wq_type.max_wrβ the requested max number of outstanding WRs in the WQ.max_sgeβ the requested max number of scatter/gather (s/g) elements per WR in the WQ.pdβ the PD to be associated with the WQ. (struct ibv_pd *)cqβ the CQ to be associated with the WQ. (struct ibv_cq *)comp_maskβ identifies valid fields. useibv_wq_init_attr_mask.create_flagsβ creation flags for this WQ, useenum ibv_wq_flags.
and then the flags enum, which is where it gets spicy πΆοΈ:
enum ibv_wq_flags {
IBV_WQ_FLAGS_CVLAN_STRIPPING = 1 << 0, /* CVLAN field will be stripped from incoming packets */
IBV_WQ_FLAGS_SCATTER_FCS = 1 << 1, /* FCS field will be scattered to host memory */
IBV_WQ_FLAGS_DELAY_DROP = 1 << 2, /* Packets won't be dropped immediately if no receive WQEs */
IBV_WQ_FLAGS_PCI_WRITE_END_PADDING = 1 << 3, /* Incoming packets will be padded to cacheline size */
IBV_WQ_FLAGS_RESERVED = 1 << 4,
};
breaking those down because we're thorough in this group chat:
IBV_WQ_FLAGS_CVLAN_STRIPPINGβ1 << 0, the CVLAN field will be stripped from incoming packets. π§ΉIBV_WQ_FLAGS_SCATTER_FCSβ1 << 1, the FCS field will be scattered to host memory.IBV_WQ_FLAGS_DELAY_DROPβ1 << 2, packets won't be dropped immediately if no receive WQEs. the packets are getting a lil grace period, periodt. β³IBV_WQ_FLAGS_PCI_WRITE_END_PADDINGβ1 << 3, incoming packets will be padded to cacheline size.IBV_WQ_FLAGS_RESERVEDβ1 << 4. reserved. that's it. that's the whole note. π
the plot twist tho: the function ibv_create_wq() will update the wq_init_attr->max_wr and wq_init_attr->max_sge fields with the actual WQ values of the WQ that was created β and those values will be greater than or equal to the values you requested. so it's not ignoring you, it's just doing β¨moreβ¨ than you asked. icon behaviour honestly. π
and then ibv_destroy_wq() destroys the WQ wq. bye bestie π (affectionate).
β¨ RETURN VALUE β¨
ibv_create_wq()returns a pointer to the created WQ, orNULLif the request fails. πibv_destroy_wq()returns0on success, or the value oferrnoon failure (which indicates the failure reason).
so like, if you get NULL back, that's your vibe check failing. check errno on the destroy side, that's where the tea is. π΅
β¨ SEE ALSO β¨
(yes that's the one β go read it next, iykyk πΈ)
β¨ AUTHORS β¨
Yishai Hadas <yishaih@mellanox.com> π
lowkey reminder bestie: keep every field, flag and value exactly as written when you actually use this stuff. the vibes are mine, the API is not. π
and that's the whole page, slay π β this was libibverbs, dated 2016-07-27, signing off πβ¨π
π¦ where this page comes from
- alpine 3.24: rdma-core-doc 61.0-r0 Β· GPL-2.0-only OR BSD-2-Clause
- arch rolling: rdma-core 65.0-1 Β· GPL-2.0-or-later OR LicenseRef-OpenIB.org-BSD-MIT AND GPL-2.0-or-later OR LicenseRef-OpenIB.org-BSD-FreeBSD AND GPL-2.0-or-later OR LicenseRef-Intel-BSD-3-Clause AND GPL-2.0-or-later OR LicenseRef-PathScale-BSD-Patent-License AND CC0-1.0 AND MIT AND BSD-2-Clause AND CPL-1.0 OR BSD-2-Clause OR GPL-2.0-or-later
- 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
- nixpkgs unstable: rdma-core 65.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