ibv_alloc_dmah(3)

✨ ibv_alloc_dmah(3) β€” alloc & dealloc a dma handle ✨

okay so this is from the Libibverbs Programmer's Manual, bestie, and it's literally the whole glow-up guide to ibv_alloc_dmah and its partner-in-crime ibv_dealloc_dmah. two functions, one page, let's go πŸ’…

🌸 NAME 🌸

  • ibv_alloc_dmah β€” allocate a dma handle
  • ibv_dealloc_dmah β€” deallocate a dma handle

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <infiniband/verbs.h>

struct ibv_dmah *ibv_alloc_dmah(struct ibv_context *context, struct ibv_dmah_init_attr *attr);

int ibv_dealloc_dmah(struct ibv_dmah *dmah);

πŸ’– DESCRIPTION πŸ’–

so ibv_alloc_dmah() allocates an ibv_dmah object, and that object is associated with the context you hand it plus the attr parameter you pass in. no cap, that's the whole vibe check 🫢

the allocated handle can later be used for optimizing DMA and RDMA operations associated with a registered memory region. it's giving performance main character energy ✨

once the ibv_dmah usage has ended, you should call ibv_dealloc_dmah(). periodt β€” don't just leave it hanging πŸ™ˆ

that call releases the resources that were earlier allocated using the ibv_alloc_dmah() API. clean up after yourself, icon behavior πŸ‘‘

πŸŽ€ ARGUMENTS πŸŽ€

attr

okay this is the big one, so let's look at the actual definitions, verbatim, no edits bestie:

enum ibv_tph_mem_type {
    IBV_TPH_MEM_TYPE_VM, /* volatile memory */
    IBV_TPH_MEM_TYPE_PM, /* persistent memory */
};

enum ibv_dmah_init_attr_mask {
    IBV_DMAH_INIT_ATTR_MASK_CPU_ID = 1 << 0,
    IBV_DMAH_INIT_ATTR_MASK_PH = 1 << 1,
    IBV_DMAH_INIT_ATTR_MASK_TPH_MEM_TYPE = 1 << 2,
};

struct ibv_dmah_init_attr {
    uint32_t comp_mask; /* From ibv_dmah_init_attr_mask */
    uint32_t cpu_id;
    uint8_t ph;
    uint8_t tph_mem_type; /* From enum ibv_tph_mem_type */
};
  • comp_mask β€” the bitmask that specifies which fields in the structure are actually valid. like, which ones are showing up to the party πŸ’…
  • cpu_id β€” the cpu id that the dma handle refers to
  • ph β€” processing hints, used to aid in optimizing the handling of transactions over PCIe πŸ”₯
  • tph_mem_type β€” the target memory type, one among enum ibv_tph_mem_type

⭐ RETURN VALUE ⭐

  • ibv_alloc_dmah() returns a pointer to the allocated dma handle object, or NULL if the request fails 😭
  • ibv_dealloc_dmah() returns 0 upon success, otherwise the errno value

🌈 SEE ALSO 🌈

ibv_reg_mr_ex(3) β€” go read that one too, iykyk 🧚

πŸ’œ AUTHOR πŸ’œ

Yishai Hadas yishaih@nvidia.com


and that's the page, bestie! signed, sealed, and delivered by libibverbs, dated 2025-5-8 β€” see you in the next man page πŸ“πŸ’–

πŸ“¦ where this page comes from
  • 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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms