Debian Codegraph @

libibverbs/man/ibv_alloc_dmah.3.md

raw symbols SCIP
1 ---
2 date: 2025-5-8
3 footer: libibverbs
4 header: "Libibverbs Programmer's Manual"
5 layout: page
6 license: 'Licensed under the OpenIB.org BSD license (FreeBSD Variant) - See COPYING.md'
7 section: 3
8 title: ibv_alloc_dmah
9 ---
10
11 # NAME
12
13 ibv_alloc_dmah - allocate a dma handle
14
15 int ibv_dealloc_dmah - deallocate a dma handle
16
17 # SYNOPSIS
18
19 ```c
20 #include <infiniband/verbs.h>
21
22 struct ibv_dmah *ibv_alloc_dmah(struct ibv_context *context, struct ibv_dmah_init_attr *attr);
23
24 int ibv_dealloc_dmah(struct ibv_dmah *dmah);
25
26 ```
27
28 # DESCRIPTION
29
30 **ibv_alloc_dmah()** allocates an *ibv_dmah* object that is associated with the given
31 *context* and the input *attr* parameter.
32
33 The allocated handle can be later used for optimizing DMA and RDMA operations associated
34 with a registered memory region.
35
36 Once the *ibv_dmah* usage has been ended *ibv_dealloc_dmah()* should be called.
37
38 This call will release resources that were earlier allocated using the **ibv_alloc_dmah()** API.
39
40 # ARGUMENTS
41
42 ## attr
43
44 ```c
45
46 enum ibv_tph_mem_type {
47 IBV_TPH_MEM_TYPE_VM, /* volatile memory */
48 IBV_TPH_MEM_TYPE_PM, /* persistent memory */
49 };
50
51 enum ibv_dmah_init_attr_mask {
52 IBV_DMAH_INIT_ATTR_MASK_CPU_ID = 1 << 0,
53 IBV_DMAH_INIT_ATTR_MASK_PH = 1 << 1,
54 IBV_DMAH_INIT_ATTR_MASK_TPH_MEM_TYPE = 1 << 2,
55 };
56
57 struct ibv_dmah_init_attr {
58 uint32_t comp_mask; /* From ibv_dmah_init_attr_mask */
59 uint32_t cpu_id;
60 uint8_t ph;
61 uint8_t tph_mem_type; /* From enum ibv_tph_mem_type */
62 };
63 ```
64 *comp_mask*
65 : Bitmask specifying what fields in the structure are valid.
66
67 *cpu_id*
68 : The cpu id that the dma handle refers to.
69
70 *ph*
71 : Processing hints, used to aid in optimizing the handling of transactions over PCIe.
72
73 *tph_mem_type*
74 : The target memory type, one among *enum ibv_tph_mem_type*.
75
76 # RETURN VALUE
77
78 **ibv_alloc_dmah()** returns a pointer to the allocated dma handle object, or NULL if the request fails.
79
80 **ibv_dealloc_dmah()** returns 0 upon success, otherwise the errno value.
81
82 # SEE ALSO
83
84 **ibv_reg_mr_ex**(3)
85
86 # AUTHOR
87
88 Yishai Hadas <[email protected]>