MLX4DV_INIT_OBJ(3)

πŸ’– MLX4DV_INIT_OBJ πŸ’–

okay bestie, this is a page from the Library Functions Manual β€” specifically the MLX4DV_INIT_OBJ(3) one β€” and it's all about setting up your mlx4 direct verbs object. no cap, it's giving "low-level but make it cute". let's get into it πŸ¦‹


✨ NAME ✨

mlx4dv_init_obj β€” Initialize mlx4 direct verbs object from ibv_xxx structures


🌸 SYNOPSIS 🌸

#include <infiniband/mlx4dv.h>

int mlx4dv_init_obj(struct mlx4dv_obj *obj, uint64_t obj_type);

πŸ’… DESCRIPTION πŸ’…

so mlx4dv_init_obj() will initialize all the mlx4dv_xxx structs based on the type you supply. where does the info for that initialization come from? it's taken from the ibv_xx structs you pass in as part of the input. literally, that's the source. 🫢

when you request information of a CQ, that marks it as owned by direct verbs for all consumer index related actions. and here's the tea: the initialization type can be a combination of several types together. so you're not locked into just one, you can stack 'em. πŸ‘‘

struct mlx4dv_qp {
        uint32_t         *rdb;
        uint32_t         *sdb;
        struct {
                uint32_t        wqe_cnt;
                int             wqe_shift;
                int             offset;
        } sq;
        struct {
                uint32_t        wqe_cnt;
                int             wqe_shift;
                int             offset;
        } rq;
        struct {
                void            *buf;
                size_t          length;
        } buf;
        uint64_t        comp_mask; /* Use enum mlx4dv_qp_comp_mask */
        off_t           uar_mmap_offset; /* If MLX4DV_QP_MASK_UAR_MMAP_OFFSET is set in comp_mask, this will contain the mmap offset of *sdb* */
};
struct mlx4dv_cq {
        struct {
                void            *buf;
                size_t          length;
        } buf;
        uint32_t        cqe_cnt;
        uint32_t        cqn;
        uint32_t        *set_ci_db;
        uint32_t        *arm_db;
        int             arm_sn;
        int             cqe_size;
        uint64_t        comp_mask; /* Use enum mlx4dv_cq_comp_mask */
        void            *cq_uar;
};
struct mlx4dv_srq {
        struct {
                void            *buf;
                size_t          length;
        } buf;
        int             wqe_shift;
        int             head;
        int             tail;
        uint32_t        *db;
        uint64_t        comp_mask;
};
struct mlx4dv_rwq {
        __be32          *rdb;
        struct {
                uint32_t        wqe_cnt;
                int             wqe_shift;
                int             offset;
        } rq;
        struct {
                void            *buf;
                size_t          length;
        } buf;
        uint64_t        comp_mask;
};
struct mlx4dv_obj {
        struct {
                struct ibv_qp      *in;
                struct mlx4dv_qp   *out;
        } qp;
        struct {
                struct ibv_cq      *in;
                struct mlx4dv_cq   *out;
        } cq;
};
enum mlx4dv_obj_type {
        MLX4DV_OBJ_QP   = 1 << 0,
        MLX4DV_OBJ_CQ   = 1 << 1,
        MLX4DV_OBJ_SRQ  = 1 << 2,
};

🌈 RETURN VALUE 🌈

returns 0 on success, or the value of errno on failure β€” and that errno is literally telling you why it flopped. periodt. πŸ’€


πŸŽ€ NOTES πŸŽ€

  • Compatibility masks (comp_mask) are in/out fields. yes bestie, they go both ways. πŸ™ˆ

πŸ’œ SEE ALSO πŸ’œ

mlx4dv(7)


πŸ‘‘ AUTHORS πŸ‘‘

Maor Gottlieb <maorg@mellanox.com>


and that's a wrap on MLX4DV_INIT_OBJ(3) fr fr πŸ“ β€” this page is version 1.0.0, dated 2017-02-02, and it's living in the MLX4DV_INIT_OBJ(3) manual. slay, go init some objects πŸ’–βœ¨

πŸ“¦ where this page comes from