NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
DOCA DMA Engine

Typedefs

typedef void(* doca_dma_task_memcpy_completion_cb_t) (struct doca_dma_task_memcpy *task, union doca_data task_user_data, union doca_data ctx_user_data)
 Function to execute on DMA memcpy task completion. More...
 

Functions

DOCA_STABLE doca_error_t doca_dma_create (struct doca_dev *dev, struct doca_dma **dma)
 
DOCA_STABLE doca_error_t doca_dma_destroy (struct doca_dma *dma)
 
DOCA_STABLE doca_error_t doca_dma_cap_task_memcpy_is_supported (const struct doca_devinfo *devinfo)
 
DOCA_STABLE struct doca_ctx * doca_dma_as_ctx (struct doca_dma *dma)
 
DOCA_STABLE doca_error_t doca_dma_cap_get_max_num_tasks (struct doca_dma *dma, uint32_t *max_num_tasks)
 
DOCA_STABLE doca_error_t doca_dma_cap_task_memcpy_get_max_buf_list_len (const struct doca_devinfo *devinfo, uint32_t *max_buf_list_len)
 
DOCA_STABLE doca_error_t doca_dma_cap_task_memcpy_get_max_buf_size (const struct doca_devinfo *devinfo, uint64_t *buf_size)
 
DOCA_STABLE doca_error_t doca_dma_task_memcpy_set_conf (struct doca_dma *dma, doca_dma_task_memcpy_completion_cb_t task_completion_cb, doca_dma_task_memcpy_completion_cb_t task_error_cb, uint32_t num_memcpy_tasks)
 This method sets the DMA memcpy tasks configuration. More...
 
DOCA_STABLE doca_error_t doca_dma_task_memcpy_alloc_init (struct doca_dma *dma, const struct doca_buf *src, struct doca_buf *dst, union doca_data user_data, struct doca_dma_task_memcpy **task)
 This method allocates and initializes a DMA memcpy task. More...
 
DOCA_STABLE struct doca_task * doca_dma_task_memcpy_as_task (struct doca_dma_task_memcpy *task)
 This method converts a memcpy task to doca_task. More...
 
DOCA_STABLE void doca_dma_task_memcpy_set_src (struct doca_dma_task_memcpy *task, const struct doca_buf *src)
 This method sets source buffer to memcpy task. More...
 
DOCA_STABLE const struct doca_buf * doca_dma_task_memcpy_get_src (const struct doca_dma_task_memcpy *task)
 This method gets source buffer from memcpy task. More...
 
DOCA_STABLE void doca_dma_task_memcpy_set_dst (struct doca_dma_task_memcpy *task, struct doca_buf *dst)
 This method sets destination buffer to memcpy task. More...
 
DOCA_STABLE struct doca_buf * doca_dma_task_memcpy_get_dst (const struct doca_dma_task_memcpy *task)
 This method gets destination buffer from memcpy task. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_dma_get_gpu_handle (struct doca_dma *dma, struct doca_gpu_dma **gpu_dma)
 Retrieve the handle in the GPU memory space of a doca_dma. More...
 

Detailed Description

DOCA DMA library. For more details please refer to the user guide on DOCA devzone.

Typedef Documentation

◆ doca_dma_task_memcpy_completion_cb_t

typedef void(* doca_dma_task_memcpy_completion_cb_t) (struct doca_dma_task_memcpy *task, union doca_data task_user_data, union doca_data ctx_user_data)

Function to execute on DMA memcpy task completion.

This function is called by doca_pe_progress() when related task identified as completed successfully. When this function called the ownership of the task object passed from DOCA back to user. Inside this callback user may decide on the task object:

  • re-submit task with doca_task_submit(); task object ownership passed to DOCA
  • release task with doca_task_free(); task object ownership passed to DOCA
  • keep the task object for future re-use; user keeps the ownership on the task object Inside this callback the user shouldn't call doca_pe_progress(). Please see doca_pe_progress for details.

Any failure/error inside this function should be handled internally or deferred; due to the mode of nested in doca_pe_progress() execution this callback doesn't return error.

NOTE: this callback type utilized for both successful & failed task completions.

Parameters
[in]taskDMA memcpy task.
[in]task_user_dataThe task user data
[in]ctx_user_dataDMA context user data

Definition at line 77 of file doca_dma.h.

Function Documentation

◆ doca_dma_as_ctx()

DOCA_STABLE struct doca_ctx* doca_dma_as_ctx ( struct doca_dma *  dma)

Convert doca_dma instance into a generalized context for use with doca core objects.

Parameters
[in]dmaDMA instance. This must remain valid until after the context is no longer required.
Returns
Non NULL upon success, NULL otherwise.

◆ doca_dma_cap_get_max_num_tasks()

DOCA_STABLE doca_error_t doca_dma_cap_get_max_num_tasks ( struct doca_dma *  dma,
uint32_t *  max_num_tasks 
)

Get the maximum log number of tasks

This method retrieves the maximum number of tasks for a device.

Parameters
[in]dmaThe dma context
[out]max_num_tasksMax number of memcpy tasks
Returns
DOCA_SUCCESS - in case of success. doca_error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - in case of invalid input.

◆ doca_dma_cap_task_memcpy_get_max_buf_list_len()

DOCA_STABLE doca_error_t doca_dma_cap_task_memcpy_get_max_buf_list_len ( const struct doca_devinfo *  devinfo,
uint32_t *  max_buf_list_len 
)

Get the maximum supported number of elements in a given DOCA linked-list buffer for DMA memcpy task.

Parameters
[in]devinfoThe DOCA device information.
[out]max_buf_list_lenThe maximum supported number of elements in a given DOCA linked-list buffer, such that 1 indicates no linked-list buffer support.
Returns
DOCA_SUCCESS - upon success Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - in case of invalid input.

◆ doca_dma_cap_task_memcpy_get_max_buf_size()

DOCA_STABLE doca_error_t doca_dma_cap_task_memcpy_get_max_buf_size ( const struct doca_devinfo *  devinfo,
uint64_t *  buf_size 
)

Get the maximum supported buffer size for DMA memcpy task.

Parameters
[in]devinfoThe DOCA device information.
[out]buf_sizeThe maximum supported buffer size in bytes.
Returns
DOCA_SUCCESS - upon success Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - in case of invalid input.

◆ doca_dma_cap_task_memcpy_is_supported()

DOCA_STABLE doca_error_t doca_dma_cap_task_memcpy_is_supported ( const struct doca_devinfo *  devinfo)

Check if given device is capable of executing DMA memcpy task.

Parameters
[in]devinfoThe DOCA device information
Returns
DOCA_SUCCESS - in case device supports memcpy. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_DRIVER - failed to query the device for its capabilities.
  • DOCA_ERROR_NOT_SUPPORTED - provided devinfo does not support memcpy.

◆ doca_dma_create()

DOCA_STABLE doca_error_t doca_dma_create ( struct doca_dev *  dev,
struct doca_dma **  dma 
)

Create a DOCA DMA instance.

Parameters
[in]devThe device to attach to the DMA context
[out]dmaPointer to pointer to be set to point to the created doca_dma instance.
Returns
DOCA_SUCCESS - in case of success. doca_error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - dma argument is a NULL pointer.
  • DOCA_ERROR_NO_MEMORY - failed to alloc doca_dma.
  • DOCA_ERROR_INITIALIZATION - failed to initialize a mutex.

◆ doca_dma_destroy()

DOCA_STABLE doca_error_t doca_dma_destroy ( struct doca_dma *  dma)
Parameters
[in]dmaPointer to instance to be destroyed.
Returns
DOCA_SUCCESS - in case of success. doca_error code - in case of failure:
  • DOCA_ERROR_IN_USE - Unable to gain exclusive access to the dma instance.
  • DOCA_ERROR_IN_USE - One or more work queues are still attached. These must be detached first.

◆ doca_dma_get_gpu_handle()

DOCA_EXPERIMENTAL doca_error_t doca_dma_get_gpu_handle ( struct doca_dma *  dma,
struct doca_gpu_dma **  gpu_dma 
)

Retrieve the handle in the GPU memory space of a doca_dma.

Parameters
[in]dmadoca_dma context to get the GPU handle from.
[out]gpu_dmaA 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 parameter was given.
  • DOCA_ERROR_BAD_STATE - if called before calling ctx_start(), or if not assigned to gpu datapath.

◆ doca_dma_task_memcpy_alloc_init()

DOCA_STABLE doca_error_t doca_dma_task_memcpy_alloc_init ( struct doca_dma *  dma,
const struct doca_buf *  src,
struct doca_buf *  dst,
union doca_data  user_data,
struct doca_dma_task_memcpy **  task 
)

This method allocates and initializes a DMA memcpy task.

Parameters
[in]dmaThe DMA to allocate the task for
[in]srcsource buffer
[in]dstdestination buffer
[in]user_datadoca_data to attach to the task
[out]taskmemcpy task to allocate
Returns
DOCA_SUCCESS - in case of success. doca_error code - in case of failure:
  • DOCA_ERROR_NO_MEMEORY - No more tasks to allocate

◆ doca_dma_task_memcpy_as_task()

DOCA_STABLE struct doca_task* doca_dma_task_memcpy_as_task ( struct doca_dma_task_memcpy *  task)

This method converts a memcpy task to doca_task.

Parameters
[in]taskdoca_dma_task_memcpy task
Returns
doca_task

◆ doca_dma_task_memcpy_get_dst()

DOCA_STABLE struct doca_buf* doca_dma_task_memcpy_get_dst ( const struct doca_dma_task_memcpy *  task)

This method gets destination buffer from memcpy task.

Parameters
[in]taskThe task to get
Returns
destination buffer

◆ doca_dma_task_memcpy_get_src()

DOCA_STABLE const struct doca_buf* doca_dma_task_memcpy_get_src ( const struct doca_dma_task_memcpy *  task)

This method gets source buffer from memcpy task.

Parameters
[in]taskThe task to get
Returns
source buffer

◆ doca_dma_task_memcpy_set_conf()

DOCA_STABLE doca_error_t doca_dma_task_memcpy_set_conf ( struct doca_dma *  dma,
doca_dma_task_memcpy_completion_cb_t  task_completion_cb,
doca_dma_task_memcpy_completion_cb_t  task_error_cb,
uint32_t  num_memcpy_tasks 
)

This method sets the DMA memcpy tasks configuration.

Parameters
[in]dmaThe DMA context to config
[in]task_completion_cbTask completion callback
[in]task_error_cbTask error callback
[in]num_memcpy_tasksNumber of memcpy tasks that the DMA can allocate
Returns
DOCA_SUCCESS - in case of success. doca_error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - doca_pe_dma argument is a NULL pointer.
  • DOCA_ERROR_NOT_SUPPORTED - context is in work queue mode

◆ doca_dma_task_memcpy_set_dst()

DOCA_STABLE void doca_dma_task_memcpy_set_dst ( struct doca_dma_task_memcpy *  task,
struct doca_buf *  dst 
)

This method sets destination buffer to memcpy task.

Parameters
[in]taskThe task to set
[in]dstDestination buffer

◆ doca_dma_task_memcpy_set_src()

DOCA_STABLE void doca_dma_task_memcpy_set_src ( struct doca_dma_task_memcpy *  task,
const struct doca_buf *  src 
)

This method sets source buffer to memcpy task.

Parameters
[in]taskThe task to set
[in]srcSource buffer