MLX5DV_INIT_OBJ(3)
π MLX5DV_INIT_OBJ(3) π
okay bestie, so this one is mlx5dv_init_obj β it lives in the Library Functions Manual, and it's the little function that hands you all the raw, unfiltered direct-verbs tea about your hardware objects. let's get into it π«Ά
β¨ NAME β¨
mlx5dv_init_obj β Initialize mlx5 direct verbs object from ibv_xxx or mlx5dv_xxx structures
like, it takes your normal boring verbs struct and gives you back the juicy direct-verbs one. it's giving glow-up. π
πΈ SYNOPSIS πΈ
#include <infiniband/mlx5dv.h>
int mlx5dv_init_obj(struct mlx5dv_obj *obj, uint64_t obj_type);
π¦ DESCRIPTION π¦
mlx5dv_init_obj() β this function will initialize mlx5dv_xxx structs based on supplied type. The information for initialization is taken from ibv_xx or mlx5dv_xxx structs supplied as part of input.
Request information of CQ marks its owned by direct verbs for all consumer index related actions. The initialization type can be combination of several types together.
bestie, that last bit is lowkey the whole point: you can OR together several types in one call and get a whole bundle of structs filled in. iconic behavior, no cap. π₯
and now, the structs. all of them. every field. i would never gatekeep:
struct mlx5dv_qp {
uint32_t *dbrec;
struct {
void *buf;
uint32_t wqe_cnt;
uint32_t stride;
} sq;
struct {
void *buf;
uint32_t wqe_cnt;
uint32_t stride;
} rq;
struct {
void *reg;
uint32_t size;
} bf;
uint64_t comp_mask;
off_t uar_mmap_offset;
uint32_t tirn;
uint32_t tisn;
uint32_t rqn;
uint32_t sqn;
uint64_t tir_icm_address;
};
struct mlx5dv_cq {
void *buf;
uint32_t *dbrec;
uint32_t cqe_cnt;
uint32_t cqe_size;
void *cq_uar;
uint32_t cqn;
uint64_t comp_mask;
};
struct mlx5dv_srq {
void *buf;
uint32_t *dbrec;
uint32_t stride;
uint32_t head;
uint32_t tail;
uint64_t comp_mask;
uint32_t srqn;
};
struct mlx5dv_rwq {
void *buf;
uint32_t *dbrec;
uint32_t wqe_cnt;
uint32_t stride;
uint64_t comp_mask;
};
struct mlx5dv_dm {
void *buf;
uint64_t length;
uint64_t comp_mask;
uint64_t remote_va;
};
struct mlx5dv_ah {
struct mlx5_wqe_av *av;
uint64_t comp_mask;
};
struct mlx5dv_pd {
uint32_t pdn;
uint64_t comp_mask;
};
struct mlx5dv_devx {
uint32_t handle; /* The kernel handle, can be used upon direct ioctl destroy */
};
and here's the big input/output wrapper β the one you actually pass in. note that each lil nested struct has an in (what you give it) and an out (what it gives you back). it's giving exchange student energy π
struct mlx5dv_obj {
struct {
struct ibv_qp *in;
struct mlx5dv_qp *out;
} qp;
struct {
struct ibv_cq *in;
struct mlx5dv_cq *out;
} cq;
struct {
struct ibv_srq *in;
struct mlx5dv_srq *out;
} srq;
struct {
struct ibv_wq *in;
struct mlx5dv_rwq *out;
} rwq;
struct {
struct ibv_dm *in;
struct mlx5dv_dm *out;
} dm;
struct {
struct ibv_ah *in;
struct mlx5dv_ah *out;
} ah;
struct {
struct ibv_pd *in;
struct mlx5dv_pd *out;
} pd;
struct {
struct mlx5dv_devx_obj *in;
struct mlx5dv_devx *out;
} devx;
};
and last but absolutely not least, the obj_type enum, aka the β¨menuβ¨ of things you can ask for. these are bit flags, so OR them together like the multitasking queen you are π
enum mlx5dv_obj_type {
MLX5DV_OBJ_QP = 1 << 0,
MLX5DV_OBJ_CQ = 1 << 1,
MLX5DV_OBJ_SRQ = 1 << 2,
MLX5DV_OBJ_RWQ = 1 << 3,
MLX5DV_OBJ_DM = 1 << 4,
MLX5DV_OBJ_AH = 1 << 5,
MLX5DV_OBJ_PD = 1 << 6,
MLX5DV_OBJ_DEVX = 1 << 7,
};
π RETURN VALUE π
0 on success or the value of errno on failure (which indicates the failure reason).
so if you get a nonzero back, that's errno talking, and it's telling you exactly why it's upset. check it, don't ignore it, we don't do that here π
π NOTES π
- The information if doorbell is blueflame is based on
mlx5dv_qp->bf->size, in case of0it's not a BF. - Compatibility masks (
comp_mask) are in/out fields.
fr fr on that first one β ifbf->sizeis0, it's not a blueflame doorbell. that's the vibe check right there, don't skip it πΈ
π SEE ALSO π
π AUTHORS π
Leon Romanovsky <leonro@mellanox.com>
so yeah bestie, that's the whole page, nothing left out, we ate and left no crumbs π
β¨ this version of MLX5DV_INIT_OBJ(3) came from version 1.0.0, dated 2017-02-02 β and remember, it's in the Library Functions Manual, so you always know where to find it again π¦π
ily, go write some direct verbs code π«Ά
π¦ 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 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 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