IBV_CREATE_CQ(3)

πŸ“¦
version 64.0 Β· 2 versions
  • 64.0 Β· alpine 3.24, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 65.0 Β· arch rolling, nixpkgs unstable
, in alpine 3.24, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– IBV_CREATE_CQ(3) πŸ’–

okay bestie, welcome to the Libibverbs Programmer's Manual ✨ today we're doing completion queues, and honestly? iconic behavior. this page lives in section 3, and its whole personality is ibv_create_cq and ibv_destroy_cq β€” making CQs and un-making them πŸŽ€


🌸 NAME 🌸

ibv_create_cq, ibv_destroy_cq β€” create or destroy a completion queue (CQ) 🫢


✨ SYNOPSIS ✨

#include <infiniband/verbs.h>

struct ibv_cq *ibv_create_cq(struct ibv_context *context, int cqe,
                             void *cq_context,
                             struct ibv_comp_channel *channel,
                             int comp_vector);

int ibv_destroy_cq(struct ibv_cq *cq);

πŸ¦‹ DESCRIPTION πŸ¦‹

so ibv_create_cq() is the main character here πŸ’… it creates a completion queue (CQ) with at least cqe entries for the RDMA device context context.

that cq_context pointer? yeah, it gets used to set the user context pointer of the CQ structure. no cap.

the channel argument is optional β€” if it's not NULL, then the completion channel channel will be used to return completion events 🌈 and your CQ will use the completion vector comp_vector for signaling completion events. important: comp_vector must be at least zero and less than context->num_comp_vectors. like, fr fr, don't be out here out of range πŸ™ˆ

then ibv_destroy_cq() destroys the CQ cq. that's it, that's the job, she's done ✨


πŸ’€ RETURN VALUE πŸ’€

ibv_create_cq() returns a pointer to the CQ, or NULL if the request fails 😭

ibv_destroy_cq() returns 0 on success, or the value of errno on failure (and that errno tells you the failure reason, bestie 🫢).


πŸ‘‘ NOTES πŸ‘‘

  • ibv_create_cq() may create a CQ with size greater than or equal to the requested size. so check the cqe attribute in the returned CQ for the actual size. the way that "at least" is doing heavy lifting 😭
  • ibv_destroy_cq() fails if any queue pair is still associated with this CQ. so clean up your QPs first, periodt πŸ’…

πŸ”₯ SEE ALSO πŸ”₯


πŸ’œ AUTHORS πŸ’œ

Dotan Barak <dotanba@gmail.com> 🌟


and that's the whole vibe, bestie β€” this page came from libibverbs, dated 2006-10-31 πŸŽ€ she's been slaying since 2006 and she's still serving. mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from