IBV_CREATE_SRQ(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_srq, ibv_destroy_srq β€” the SRQ glow-up guide πŸ’–

okay bestie, welcome to IBV_CREATE_SRQ(3), straight out of the Libibverbs Programmer's Manual ✨ this is the page about making and unmaking a shared receive queue, aka an SRQ, and it is genuinely so much less scary than it sounds. sit down, sip ur strawberry drink πŸ“, let's go.


🌸 NAME 🌸

ibv_create_srq, ibv_destroy_srq β€” create or destroy a shared receive queue (SRQ)

no cap, that's the whole job. one makes it, one yeets it. πŸ’…


✨ SYNOPSIS ✨

#include <infiniband/verbs.h>

struct ibv_srq *ibv_create_srq(struct ibv_pd *pd, struct
                               ibv_srq_init_attr *srq_init_attr);

int ibv_destroy_srq(struct ibv_srq *srq);

like. two functions. that's it. ur faves could never be this concise 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so ibv_create_srq() creates a shared receive queue (SRQ) that is associated with the protection domain pd. yes, protection domain, the pd bestie, u gotta bring one.

the argument srq_init_attr is an ibv_srq_init_attr struct, as defined in <infiniband/verbs.h>. here's what it looks like, verbatim, no notes:

struct ibv_srq_init_attr {
        void                   *srq_context;    /* Associated context of the SRQ */
        struct ibv_srq_attr     attr;           /* SRQ attributes */
};

and inside that attr field lives the ibv_srq_attr struct, which is giving very much "here are my boundaries" energy:

struct ibv_srq_attr {
        uint32_t                max_wr;         /* Requested max number of outstanding work requests (WRs) in the SRQ */
        uint32_t                max_sge;        /* Requested max number of scatter elements per WR */
        uint32_t                srq_limit;      /* The limit value of the SRQ (irrelevant for ibv_create_srq) */
};

note that srq_limit is irrelevant for ibv_create_srq β€” she's just there for the vibes on this particular function, ok? don't come for her.

the way that ibv_create_srq() works is that it will update the srq_init_attr struct with the original values of the SRQ that was created πŸ‘‘ and the values of max_wr and max_sge will be greater than or equal to the values you requested. so like, u ask for a snack, u might get a bigger snack. iconic behavior honestly.

and ibv_destroy_srq() destroys the SRQ srq. that's it. that's the whole function. goodbye SRQ πŸ’€


πŸ”₯ RETURN VALUE πŸ”₯

  • ibv_create_srq() returns a pointer to the created SRQ, or NULL if the request fails. (crying in null pointer 😭)
  • ibv_destroy_srq() returns 0 on success, or the value of errno on failure (which indicates the failure reason).

fr fr, always check ur returns. main character energy includes error handling.


πŸ’€ NOTES πŸ’€

ibv_destroy_srq() fails if any queue pair is still associated with this SRQ.

read that again bestie. u cannot destroy the SRQ while a queue pair is still holding onto it. that's a situationship, not a breakup. untangle them first 🧚


🌈 SEE ALSO 🌈

the whole friend group, go say hi πŸ’œ


πŸŽ€ AUTHORS πŸŽ€

Dotan Barak <dotanba@gmail.com> β€” thank u king, we appreciate u πŸ™


and that's the page, bestie!! libibverbs, dated 2006-10-31 🌟 go forth and queue ur receives, and remember: create responsibly, destroy only when ur queue pairs have moved on. periodt πŸ’…βœ¨

πŸ“¦ where this page comes from