|
| 1 | +--- |
| 2 | +layout: page |
| 3 | +title: EFADV_CREATE_COMP_CNTR |
| 4 | +section: 3 |
| 5 | +tagline: Verbs |
| 6 | +date: 2026-04-27 |
| 7 | +header: "EFA Direct Verbs Manual" |
| 8 | +footer: efa |
| 9 | +--- |
| 10 | + |
| 11 | +# NAME |
| 12 | + |
| 13 | +efadv_create_comp_cntr - Create EFA specific Completion Counter |
| 14 | + |
| 15 | +# SYNOPSIS |
| 16 | + |
| 17 | +```c |
| 18 | +#include <infiniband/efadv.h> |
| 19 | + |
| 20 | +struct ibv_comp_cntr *efadv_create_comp_cntr(struct ibv_context *context, |
| 21 | + struct ibv_comp_cntr_init_attr *attr, |
| 22 | + struct efadv_comp_cntr_init_attr *efa_attr, |
| 23 | + uint32_t inlen); |
| 24 | +``` |
| 25 | +
|
| 26 | +# DESCRIPTION |
| 27 | +
|
| 28 | +**efadv_create_comp_cntr()** creates a Completion Counter with EFA specific |
| 29 | +properties, such as external memory for the counter values. |
| 30 | +
|
| 31 | +The argument *attr* is an ibv_comp_cntr_init_attr struct, as defined in |
| 32 | +<infiniband/verbs.h>. |
| 33 | +
|
| 34 | +Compatibility is handled using the comp_mask and inlen fields. |
| 35 | +
|
| 36 | +```c |
| 37 | +enum { |
| 38 | + EFADV_MEMORY_LOCATION_VA, |
| 39 | + EFADV_MEMORY_LOCATION_DMABUF, |
| 40 | +}; |
| 41 | +
|
| 42 | +struct efadv_memory_location { |
| 43 | + uint8_t *ptr; |
| 44 | + struct { |
| 45 | + uint64_t offset; |
| 46 | + int32_t fd; |
| 47 | + uint32_t reserved; |
| 48 | + } dmabuf; |
| 49 | + uint8_t type; |
| 50 | + uint8_t reserved[7]; |
| 51 | +}; |
| 52 | +
|
| 53 | +struct efadv_comp_cntr_init_attr { |
| 54 | + uint64_t comp_mask; |
| 55 | + uint32_t flags; |
| 56 | + uint32_t reserved; |
| 57 | + struct efadv_memory_location comp_cntr_ext_mem; |
| 58 | + struct efadv_memory_location err_cntr_ext_mem; |
| 59 | +}; |
| 60 | +``` |
| 61 | + |
| 62 | +*inlen* |
| 63 | +: In: Size of struct efadv_comp_cntr_init_attr. |
| 64 | + |
| 65 | +*comp_mask* |
| 66 | +: Compatibility mask. |
| 67 | + |
| 68 | +*flags* |
| 69 | +: A bitwise OR of the various values described below. |
| 70 | + |
| 71 | + **EFADV_COMP_CNTR_INIT_WITH_COMP_EXTERNAL_MEM**: |
| 72 | + Use application-provided memory for the completion count, as |
| 73 | + described by *comp_cntr_ext_mem*. |
| 74 | + |
| 75 | + **EFADV_COMP_CNTR_INIT_WITH_ERR_EXTERNAL_MEM**: |
| 76 | + Use application-provided memory for the error count, as |
| 77 | + described by *err_cntr_ext_mem*. |
| 78 | + |
| 79 | +*comp_cntr_ext_mem* |
| 80 | +: Memory location for the completion count when using external memory. |
| 81 | + |
| 82 | +*err_cntr_ext_mem* |
| 83 | +: Memory location for the error count when using external memory. |
| 84 | + |
| 85 | +## efadv_memory_location |
| 86 | + |
| 87 | +The external memory is described by an **efadv_memory_location** structure |
| 88 | +which supports two modes: |
| 89 | + |
| 90 | +*type* |
| 91 | +: **EFADV_MEMORY_LOCATION_VA** for a virtual address, or |
| 92 | + **EFADV_MEMORY_LOCATION_DMABUF** for a DMA-BUF reference. |
| 93 | + |
| 94 | +*ptr* |
| 95 | +: Virtual address pointer. Required when type is |
| 96 | + **EFADV_MEMORY_LOCATION_VA**. When type is |
| 97 | + **EFADV_MEMORY_LOCATION_DMABUF**, may optionally be set to provide a |
| 98 | + process-accessible mapping of the DMA-BUF memory. |
| 99 | + |
| 100 | +*dmabuf.fd* |
| 101 | +: DMA-BUF file descriptor (used when type is |
| 102 | + **EFADV_MEMORY_LOCATION_DMABUF**). |
| 103 | + |
| 104 | +*dmabuf.offset* |
| 105 | +: Offset within the DMA-BUF. |
| 106 | + |
| 107 | +# RETURN VALUE |
| 108 | + |
| 109 | +efadv_create_comp_cntr() returns a pointer to the created ibv_comp_cntr, or |
| 110 | +NULL if the request fails. |
| 111 | + |
| 112 | +# SEE ALSO |
| 113 | + |
| 114 | +**efadv**(7), **ibv_create_comp_cntr**(3), **ibv_qp_attach_comp_cntr**(3) |
| 115 | + |
| 116 | +# AUTHORS |
| 117 | + |
| 118 | +Michael Margolin <mrgolin@amazon.com> |
0 commit comments