NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
DOCA Buffer Array
Collaboration diagram for DOCA Buffer Array:

Typedefs

typedef uint64_t doca_dpa_dev_buf_arr_t
 Type representing a doca_buf_arr handle on the DPA. More...
 

Functions

DOCA_EXPERIMENTAL doca_error_t doca_buf_arr_create (size_t num_elem, struct doca_buf_arr **buf_arr)
 Allocates a doca_buf_arr. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_buf_arr_set_target_gpu (struct doca_buf_arr *buf_arr, struct doca_gpu *gpu_handler)
 Configures the buf array to be created on the gpu device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_buf_arr_set_target_dpa (struct doca_buf_arr *buf_arr, struct doca_dpa *dpa_handler)
 Configures the buf array to be created on the dpa device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_buf_arr_set_params (struct doca_buf_arr *buf_arr, struct doca_mmap *mmap, size_t elem_size, uint64_t start_offset)
 Sets the buf array params. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_buf_arr_start (struct doca_buf_arr *buf_arr)
 This method enables the allocation of doca_bufs. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_buf_arr_stop (struct doca_buf_arr *buf_arr)
 Stops a started doca buf array. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_buf_arr_destroy (struct doca_buf_arr *buf_arr)
 Destroys a doca buf array instance. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_buf_arr_get_gpu_handle (const struct doca_buf_arr *buf_arr, struct doca_gpu_buf_arr **gpu_buf_arr)
 Retrieves the handle in the gpu memory space of a doca_buf_arr. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_buf_arr_get_dpa_handle (const struct doca_buf_arr *buf_arr, doca_dpa_dev_buf_arr_t *dpa_buf_arr)
 Retrieves the handle in the dpa memory space of a doca_buf_arr. More...
 

Detailed Description

The DOCA buffer array represents an array of fixed size doca_bufs (for multiple doca_dev). Can act as a free list or direct access mode.

Typedef Documentation

◆ doca_dpa_dev_buf_arr_t

typedef uint64_t doca_dpa_dev_buf_arr_t

Type representing a doca_buf_arr handle on the DPA.

Definition at line 53 of file doca_buf_array.h.

Function Documentation

◆ doca_buf_arr_create()

DOCA_EXPERIMENTAL doca_error_t doca_buf_arr_create ( size_t  num_elem,
struct doca_buf_arr **  buf_arr 
)

Allocates a doca_buf_arr.

Parameters
[in]num_elemNumber of elements in the doca_buf_arr (must be > 0).
[out]buf_arrThe newly created doca_buf_arr.
Returns
DOCA_SUCCESS - in case of success. doca_error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - if an invalid input had been received.
  • DOCA_ERROR_NO_MEMORY - failed to allocate a doca_buf_arr.

◆ doca_buf_arr_destroy()

DOCA_EXPERIMENTAL doca_error_t doca_buf_arr_destroy ( struct doca_buf_arr *  buf_arr)

Destroys a doca buf array instance.

Destroy implicitly stops the buf array.

Parameters
[in]buf_arrThe doca_buf_arr to destroy
Returns
DOCA_SUCCESS - in case of success. doca_error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - if an invalid input had been received.

◆ doca_buf_arr_get_dpa_handle()

DOCA_EXPERIMENTAL doca_error_t doca_buf_arr_get_dpa_handle ( const struct doca_buf_arr *  buf_arr,
doca_dpa_dev_buf_arr_t dpa_buf_arr 
)

Retrieves the handle in the dpa memory space of a doca_buf_arr.

Parameters
[in]buf_arrThe doca_buf_arr
[out]dpa_buf_arrA pointer to the handle in the dpa memory space
Returns
DOCA_SUCCESS - in case of success. doca_error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - if an invalid input had been received.
  • DOCA_ERROR_BAD_STATE - if doca_buf_arr is not started.

◆ doca_buf_arr_get_gpu_handle()

DOCA_EXPERIMENTAL doca_error_t doca_buf_arr_get_gpu_handle ( const struct doca_buf_arr *  buf_arr,
struct doca_gpu_buf_arr **  gpu_buf_arr 
)

Retrieves the handle in the gpu memory space of a doca_buf_arr.

Parameters
[in]buf_arrThe doca_buf_arr
[out]gpu_buf_arrA pointer to the handle in the gpu memory space
Returns
DOCA_SUCCESS - in case of success. doca_error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - if an invalid input had been received.
  • DOCA_ERROR_BAD_STATE - if doca_buf_arr is not started.

◆ doca_buf_arr_set_params()

DOCA_EXPERIMENTAL doca_error_t doca_buf_arr_set_params ( struct doca_buf_arr *  buf_arr,
struct doca_mmap *  mmap,
size_t  elem_size,
uint64_t  start_offset 
)

Sets the buf array params.

Parameters
[in]buf_arrThe doca_buf_arr
[in]mmapThe mmap managing the memory chunk. Must be populated with memory chunk.
[in]elem_sizeSize in bytes of a single element (must be > 0).
[in]start_offsetOffset from mmap start to set doca_buf_arr.
Returns
DOCA_SUCCESS - in case of success. doca_error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - if an invalid input had been received.
  • DOCA_ERROR_BAD_STATE - if doca_buf_arr is already started

◆ doca_buf_arr_set_target_dpa()

DOCA_EXPERIMENTAL doca_error_t doca_buf_arr_set_target_dpa ( struct doca_buf_arr *  buf_arr,
struct doca_dpa *  dpa_handler 
)

Configures the buf array to be created on the dpa device.

Parameters
[in]buf_arrThe doca_buf_arr
[in]dpa_handlerThe dpa device handler.
Returns
DOCA_SUCCESS - in case of success. doca_error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - if an invalid input had been received.
  • DOCA_ERROR_BAD_STATE - if doca_buf_arr is already started

◆ doca_buf_arr_set_target_gpu()

DOCA_EXPERIMENTAL doca_error_t doca_buf_arr_set_target_gpu ( struct doca_buf_arr *  buf_arr,
struct doca_gpu *  gpu_handler 
)

Configures the buf array to be created on the gpu device.

Parameters
[in]buf_arrThe doca_buf_arr
[in]gpu_handlerThe gpu device handler.
Returns
DOCA_SUCCESS - in case of success. doca_error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - if an invalid input had been received.
  • DOCA_ERROR_BAD_STATE - if doca_buf_arr is already started

◆ doca_buf_arr_start()

DOCA_EXPERIMENTAL doca_error_t doca_buf_arr_start ( struct doca_buf_arr *  buf_arr)

This method enables the allocation of doca_bufs.

Note
Before calling this function, the mmap with which the buf array was created must be started.
Parameters
[in]buf_arrThe doca_buf_arr to start
Returns
DOCA_SUCCESS - in case of success. doca_error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - if an invalid input had been received.
  • DOCA_ERROR_BAD_STATE -
    • if doca_buf_arr is already started once.
    • if target device is missing
    • if mmap is not started.
  • DOCA_ERROR_NO_MEMORY -
    • failed to allocate enough space for configuration structure
    • (if set) mmap's size is too small

◆ doca_buf_arr_stop()

DOCA_EXPERIMENTAL doca_error_t doca_buf_arr_stop ( struct doca_buf_arr *  buf_arr)

Stops a started doca buf array.

Note
Stop does not have to be called before destroy (which implicitly stops the buf array).
Parameters
[in]buf_arrThe doca_buf_arr to stop
Returns
DOCA_SUCCESS - in case of success. doca_error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - if an invalid input had been received.