ibv_alloc_null_mr(3)
π ibv_alloc_null_mr(3) β the Libibverbs Programmer's Manual, bestie edition
Okay so real talk, this one lives in the Libibverbs Programmer's Manual and it's literally called ibv_alloc_null_mr β¨
πΈ NAME πΈ
ibv_alloc_null_mr β allocate a null memory region (MR) π«Ά
π SYNOPSIS π
#include <infiniband/verbs.h>
struct ibv_mr *ibv_alloc_null_mr(struct ibv_pd *pd);
No cap, that's the whole thing. One include, one function call, one pd. Clean. π
π¦ DESCRIPTION π¦
So ibv_alloc_null_mr() allocates a null memory region (MR) that's associated with the protection domain pd. Think of it as the MR that's too cool to actually hold your data π
Here's the vibe: a null MR discards all data written to it, and it always returns 0 on read. Iconic behavior honestly. It has the maximum length, and only the lkey is valid β the MR is not exposed as an rkey. Periodt. π
A device should implement the null MR in a way that bypasses PCI transfers, internally discarding or sourcing 0 data. Why do we care? Because this gives you a way to avoid PCI bus transfers by using a scatter/gather list in commands β super useful if your app doesn't actually intend to access the data, or if it needs the data to be 0 filled. π§
Specifically bestie, pay attention:
- upon
ibv_post_send()the device skips PCI read cycles π₯ - upon
ibv_post_recv()the device skips PCI write cycles π₯
...which finally improves performance. We love a glow-up that's also a speed-up. β
ibv_dereg_mr() deregisters the MR. That's your cleanup era. π§Ή
π¨ Heads up, bestie: the use ofibv_rereg_mr()oribv_bind_mw()with this MR is invalid. Don't do it. Just don't. π
β¨ RETURN VALUE β¨
ibv_alloc_null_mr() returns a pointer to the allocated MR, or NULL if the request fails. π That's it, that's the return value. Simple. Elegant. Main character energy. π
π SEE ALSO π
(yes, the trailing comma is canon, iykyk π)
π AUTHOR π
Yonatan Cohen <yonatanc@mellanox.com> β thank you for your service π«Ά
Alright bestie, that's the whole page! This little gem comes to you courtesy of libibverbs, dated 2018-6-1, and it's filed under ibv_alloc_null_mr(3) in the Libibverbs Programmer's Manual. Go forth and allocate your nulls πβ¨π
π¦ where this page comes from
- alpine 3.24: rdma-core-doc 61.0-r0 Β· GPL-2.0-only OR BSD-2-Clause
- 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
- ubuntu jammy: libibverbs-dev 39.0-1 Β· BSD-MIT OR GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms