---
name: "ibv_alloc_dmah"
section: "3"
platform: "linux"
package: "rdma-core"
version: "65.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/ibv_alloc_dmah"
---

# ibv\_alloc\_dmah(3)

allocate a dma handle int ibv\_dealloc\_dmah - deallocate a dma handle

## NAME

ibv\_alloc\_dmah - allocate a dma handle

int 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

**ibv\_alloc\_dmah()** allocates an *ibv\_dmah* object that is associated with the given *context* and the input *attr* parameter.

The allocated handle can be later used for optimizing DMA and RDMA operations associated with a registered memory region.

Once the *ibv\_dmah* usage has been ended *ibv\_dealloc\_dmah()* should be called.

This call will release resources that were earlier allocated using the **ibv\_alloc\_dmah()** API.

## ARGUMENTS

### attr

-

  ```
  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*

  Bitmask specifying what fields in the structure are valid.

- *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)](/ibv_reg_mr_ex/3.md)

## AUTHOR

Yishai Hadas ⟨yishaih@nvidia.com⟩\\c
