IBV_POST_SRQ_RECV(3)
π ibv_post_srq_recv β the Libibverbs Programmer's Manual, bestie edition π
okay so picture this: you've got a shared receive queue (SRQ for short, we're all friends here) and you need to feed it a whole lil linked list of work requests. that's literally this function. ibv_post_srq_recv(3) is the moment. let's get into it π«Ά
β¨ NAME β¨
ibv_post_srq_recv β post a list of work requests (WRs) to a shared receive queue (SRQ)
πΈ SYNOPSIS πΈ
#include <infiniband/verbs.h>
int ibv_post_srq_recv(struct ibv_srq *srq, struct ibv_recv_wr *wr,
struct ibv_recv_wr **bad_wr);
π¦ DESCRIPTION π¦
so ibv_post_srq_recv() takes that linked list of work requests (WRs) β starting with wr β and posts the whole thing to the shared receive queue (SRQ) called srq. it's giving assembly line, it's giving "i have a to-do list and i'm doing it".
but β and this is important β it stops processing WRs from the list at the first failure (the kind that can be detected immediately while the requests are being posted), and it hands you back that failing WR through bad_wr. so like, it doesn't ghost you, it tells you exactly where things went sideways π
the wr argument is an ibv_recv_wr struct, as defined in <infiniband/verbs.h>. here's the fit:
struct ibv_recv_wr {
uint64_t wr_id; /* User defined WR ID */
struct ibv_recv_wr *next; /* Pointer to next WR in list, NULL if last WR */
struct ibv_sge *sg_list; /* Pointer to the s/g array */
int num_sge; /* Size of the s/g array */
};
and because every WR needs somewhere to actually put the data, here's the scatter/gather element situation too:
struct ibv_sge {
uint64_t addr; /* Start address of the local memory buffer */
uint32_t length; /* Length of the buffer */
uint32_t lkey; /* Key of the local Memory Region */
};
iconic structs. no notes. π
π₯ RETURN VALUE π₯
ibv_post_srq_recv() returns 0 on success β slay β or the value of errno on failure (which is the universe telling you the failure reason, very helpful of it).
π NOTES π
bestie listen. the buffers used by a WR can only be safely reused after the WR request is fully executed and a work completion has been retrieved from the corresponding completion queue (CQ). do not touch those buffers early. i'm serious. don't. π
and one more thing, this one's a lil spicy: if a WR is being posted to a UD QP, the Global Routing Header (GRH) of the incoming message will be placed in the first 40 bytes of the buffer(s) in the scatter list. if no GRH is present in the incoming message, then the first bytes will be undefined. which means β in all cases β the actual data of the incoming message will start at an offset of 40 bytes into the buffer(s) in the scatter list. so yes, 40. always 40. write it down. β
π SEE ALSO π
the whole friend group fr fr π§
π AUTHORS π
Dotan Barak <dotanba@gmail.com> β king behavior honestly π
and that's the page, bestie!! this was libibverbs, dated 2006-10-31, and it ate. periodt. πβ¨
π¦ 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 bookworm: libibverbs-dev 44.0-2 Β· BSD-MIT OR GPL-2.0-only
- 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
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- 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 jammy: libibverbs-dev 39.0-1 Β· BSD-MIT OR GPL-2.0-only
- ubuntu noble: libibverbs-dev 50.0-2build2 Β· BSD-MIT OR GPL-2.0-only
- ubuntu noble: libibverbs-dev 50.0-2ubuntu0.2 Β· BSD-MIT 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