.\" Automatically generated by Pandoc 3.8.2.1
.\"
.TH "ibv_alloc_dmah" "3" "2025\-5\-8" "libibverbs" "Libibverbs Programmer\(cqs Manual"
.SH NAME
ibv_alloc_dmah \- allocate a dma handle
.PP
int ibv_dealloc_dmah \- deallocate a dma handle
.SH SYNOPSIS
.IP
.EX
#include \f[B]<infiniband/verbs.h>\f[R]

\f[B]struct\f[R] ibv_dmah *ibv_alloc_dmah(\f[B]struct\f[R] ibv_context *context, \f[B]struct\f[R] ibv_dmah_init_attr *attr);

int ibv_dealloc_dmah(\f[B]struct\f[R] ibv_dmah *dmah);
.EE
.SH DESCRIPTION
\f[B]ibv_alloc_dmah()\f[R] allocates an \f[I]ibv_dmah\f[R] object that
is associated with the given \f[I]context\f[R] and the input
\f[I]attr\f[R] parameter.
.PP
The allocated handle can be later used for optimizing DMA and RDMA
operations associated with a registered memory region.
.PP
Once the \f[I]ibv_dmah\f[R] usage has been ended
\f[I]ibv_dealloc_dmah()\f[R] should be called.
.PP
This call will release resources that were earlier allocated using the
\f[B]ibv_alloc_dmah()\f[R] API.
.SH ARGUMENTS
.SS attr
.IP
.EX

\f[B]enum\f[R] ibv_tph_mem_type {
    IBV_TPH_MEM_TYPE_VM, \f[I]/* volatile memory */\f[R]
    IBV_TPH_MEM_TYPE_PM, \f[I]/* persistent memory */\f[R]
};

\f[B]enum\f[R] 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,
};

\f[B]struct\f[R] ibv_dmah_init_attr {
    uint32_t comp_mask; \f[I]/* From ibv_dmah_init_attr_mask */\f[R]
    uint32_t cpu_id;
    uint8_t ph;
    uint8_t tph_mem_type; \f[I]/* From enum ibv_tph_mem_type */\f[R]
};
.EE
.TP
\f[I]comp_mask\f[R]
Bitmask specifying what fields in the structure are valid.
.TP
\f[I]cpu_id\f[R]
The cpu id that the dma handle refers to.
.TP
\f[I]ph\f[R]
Processing hints, used to aid in optimizing the handling of transactions
over PCIe.
.TP
\f[I]tph_mem_type\f[R]
The target memory type, one among \f[I]enum ibv_tph_mem_type\f[R].
.SH RETURN VALUE
\f[B]ibv_alloc_dmah()\f[R] returns a pointer to the allocated dma handle
object, or NULL if the request fails.
.PP
\f[B]ibv_dealloc_dmah()\f[R] returns 0 upon success, otherwise the errno
value.
.SH SEE ALSO
\f[B]ibv_reg_mr_ex\f[R](3)
.SH AUTHOR
Yishai Hadas \c
.MT yishaih@nvidia.com
.ME \c
