mlx5dv_create_cq(3)

✨ mlx5dv_create_cq β€” it's giving completion queue energy ✨

okay so bestie, this one's from the mlx5 Programmer's Manual, and it's lowkey iconic. sit down, grab a boba, we're making a completion queue πŸŽ€

πŸ’– NAME πŸ’–

mlx5dv_create_cq β€” creates a completion queue (CQ). that's it. that's the vibe. πŸ¦‹


🌸 SYNOPSIS 🌸

#include <infiniband/mlx5dv.h>

struct ibv_cq_ex *mlx5dv_create_cq(struct ibv_context *context,
                                   struct ibv_cq_init_attr_ex *cq_attr,
                                   struct mlx5dv_cq_init_attr *mlx5_cq_attr);

three args, one CQ, no cap πŸ’…


✨ DESCRIPTION ✨

mlx5dv_create_cq() creates a completion queue (CQ) β€” but like, with specific driver properties. not your basic CQ, a customized CQ. main character behavior honestly πŸ‘‘


🫢 ARGUMENTS 🫢

so for context and cq_attr, please see the ibv_create_cq_ex(3) man page, mwah πŸ’‹

🧚 mlx5_cq_attr 🧚

here's the struct, look at her:

struct mlx5dv_cq_init_attr {
    uint64_t comp_mask;
    uint8_t  cqe_comp_res_format;
    uint32_t flags;
    uint16_t cqe_size;
};

comp_mask

it's a bitmask specifying which fields in the struct are actually valid (like a vibe check for your struct πŸ‘€):

  • MLX5DV_CQ_INIT_ATTR_MASK_COMPRESSED_CQE β€” enables creating a CQ in a mode where, like, a few CQEs may be compressed into a single CQE. valid values live in cqe_comp_res_format (see below, bestie ⬇️)
  • MLX5DV_CQ_INIT_ATTR_MASK_FLAGS β€” valid values live in flags
  • MLX5DV_CQ_INIT_ATTR_MASK_CQE_SIZE β€” valid values live in cqe_size

cqe_comp_res_format

a bitwise OR of the various CQE response formats of the responder side (yes, you can stack them, we love a bitwise OR πŸ”₯):

  • MLX5DV_CQE_RES_FORMAT_HASH β€” CQE compression with hash
  • MLX5DV_CQE_RES_FORMAT_CSUM β€” CQE compression with RX checksum
  • MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX β€” CQE compression with stride index

flags

a bitwise OR of the various values described below:

  • MLX5DV_CQ_INIT_ATTR_FLAGS_CQE_PAD β€” create a padded 128B CQE

cqe_size

configure the CQE size to be 64 or 128 bytes. and like β€” other values will fail mlx5dv_create_cq. no in-between, no "but what if I want 96", just no πŸ’€ the function said what it said.


🌈 RETURN VALUE 🌈

mlx5dv_create_cq() returns a pointer to the created CQ β€” slay πŸŽ‰ β€” or NULL if the request fails, and errno will be set. (so check your returns, bestie, don't just vibe and hope 😭)


πŸ‘€ SEE ALSO πŸ‘€


πŸ’œ AUTHOR πŸ’œ

Yonatan Cohen <yonatanc@mellanox.com> β€” thank you for your service 🫑


and that's the whole page, periodt πŸ’… this icon dropped in mlx5, dated 2018-9-1 β€” a classic, honestly. go forth and make your CQs, bestie, you got this πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from