NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
dpa_common.h File Reference
#include <stdlib.h>
#include <unistd.h>
#include <doca_dev.h>
#include <doca_dpa.h>
#include <doca_error.h>
#include <doca_log.h>
#include <doca_types.h>
#include <doca_argp.h>
#include <doca_sync_event.h>
#include <doca_mmap.h>
#include <doca_rdma.h>
#include <doca_ctx.h>
Include dependency graph for dpa_common.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dpa_resources
 A struct that includes all the resources needed for DPA. More...
 
struct  dpa_config
 Configuration struct. More...
 
struct  dpa_thread_obj
 A struct that includes all the resources needed for DPA thread. More...
 
struct  dpa_completion_obj
 A struct that includes all the resources needed for DPA completion. More...
 
struct  dpa_notification_completion_obj
 A struct that includes all the resources needed for DPA notification completion. More...
 
struct  dpa_rdma_obj
 A struct that includes all the resources needed for DPA RDMA. More...
 
struct  doca_mmap_obj
 A struct that includes all the resources needed for DOCA Mmap. More...
 

Macros

#define SLEEP(SECONDS)   for (int i = 0; i < 1 + SECONDS * 30000; i++)
 Macro for sleep (wait) in seconds. More...
 
#define DEVICE_DEFAULT_NAME   "NOT_SET"
 device default name More...
 
#define SYNC_EVENT_MASK_FFS   (0xFFFFFFFFFFFFFFFF)
 Mask for doca_sync_event_wait_gt() wait value. More...
 
#define RDMA_DEVICE_DEFAULT_GID_INDEX   (1)
 default RDMA device GID index More...
 
#define RDMA_DEFAULT_BUF_LIST_LEN   (1)
 default RDMA connection receive buffer length More...
 
#define DPA_RESOURCES_PATH_MAX_SIZE   1024
 DPA resources file path size. More...
 
#define DPA_APP_KEY_MAX_SIZE   1024
 DPA application key size. More...
 

Enumerations

enum  mmap_type { MMAP_TYPE_CPU , MMAP_TYPE_DPA }
 DOCA Mmap type definition. More...
 

Functions

doca_error_t register_dpa_params (void)
 Register the command line parameters for the sample. More...
 
doca_error_t create_doca_dpa_wait_sync_event (struct doca_dpa *doca_dpa, struct doca_dev *doca_device, struct doca_sync_event **wait_event)
 Create DOCA sync event to be published by the CPU and subscribed by the DPA. More...
 
doca_error_t create_doca_dpa_completion_sync_event (struct doca_dpa *doca_dpa, struct doca_dev *doca_device, struct doca_sync_event **comp_event, doca_dpa_dev_sync_event_t *handle)
 Create DOCA sync event to be published by the DPA and subscribed by the CPU. More...
 
doca_error_t create_doca_dpa_kernel_sync_event (struct doca_dpa *doca_dpa, struct doca_sync_event **kernel_event)
 Create DOCA sync event to be published and subscribed by the DPA. More...
 
doca_error_t create_doca_remote_net_sync_event (struct doca_dev *doca_device, struct doca_sync_event **remote_net_event)
 Create DOCA sync event to be published by a remote net and subscribed by the CPU. More...
 
doca_error_t export_doca_remote_net_sync_event_to_dpa (struct doca_dev *doca_device, struct doca_dpa *doca_dpa, struct doca_sync_event *remote_net_event, struct doca_sync_event_remote_net **remote_net_exported_event, doca_dpa_dev_sync_event_remote_net_t *remote_net_event_dpa_handle)
 Create DOCA sync event to be published by a remote net and subscribed by the CPU. More...
 
doca_error_t allocate_dpa_resources (struct dpa_config *cfg, struct dpa_resources *resources)
 Allocate DOCA DPA resources. More...
 
doca_error_t destroy_dpa_resources (struct dpa_resources *resources)
 Destroy DOCA DPA resources. More...
 
doca_error_t dpa_thread_obj_init (struct dpa_thread_obj *dpa_thread_obj)
 Initialize DPA thread. More...
 
doca_error_t dpa_thread_obj_destroy (struct dpa_thread_obj *dpa_thread_obj)
 Destroy DPA thread. More...
 
doca_error_t dpa_completion_obj_init (struct dpa_completion_obj *dpa_completion_obj)
 Initialize DPA completion. More...
 
doca_error_t dpa_completion_obj_destroy (struct dpa_completion_obj *dpa_completion_obj)
 Destroy DPA completion. More...
 
doca_error_t dpa_notification_completion_obj_init (struct dpa_notification_completion_obj *notification_completion_obj)
 Initialize DPA notification completion. More...
 
doca_error_t dpa_notification_completion_obj_destroy (struct dpa_notification_completion_obj *notification_completion_obj)
 Destroy DPA notification completion. More...
 
doca_error_t dpa_rdma_obj_init (struct dpa_rdma_obj *dpa_rdma_obj)
 Initialize DPA RDMA without starting it. More...
 
doca_error_t dpa_rdma_obj_start (struct dpa_rdma_obj *dpa_rdma_obj)
 Start DPA RDMA. More...
 
doca_error_t dpa_rdma_obj_destroy (struct dpa_rdma_obj *dpa_rdma_obj)
 Destroy DPA RDMA. More...
 
doca_error_t doca_mmap_obj_init (struct doca_mmap_obj *doca_mmap_obj)
 Initialize DOCA Mmap. More...
 
doca_error_t doca_mmap_obj_destroy (struct doca_mmap_obj *doca_mmap_obj)
 Destroy DOCA Mmap. More...
 

Macro Definition Documentation

◆ DEVICE_DEFAULT_NAME

#define DEVICE_DEFAULT_NAME   "NOT_SET"

device default name

Definition at line 55 of file dpa_common.h.

◆ DPA_APP_KEY_MAX_SIZE

#define DPA_APP_KEY_MAX_SIZE   1024

DPA application key size.

Definition at line 80 of file dpa_common.h.

◆ DPA_RESOURCES_PATH_MAX_SIZE

#define DPA_RESOURCES_PATH_MAX_SIZE   1024

DPA resources file path size.

Definition at line 75 of file dpa_common.h.

◆ RDMA_DEFAULT_BUF_LIST_LEN

#define RDMA_DEFAULT_BUF_LIST_LEN   (1)

default RDMA connection receive buffer length

Definition at line 70 of file dpa_common.h.

◆ RDMA_DEVICE_DEFAULT_GID_INDEX

#define RDMA_DEVICE_DEFAULT_GID_INDEX   (1)

default RDMA device GID index

Definition at line 65 of file dpa_common.h.

◆ SLEEP

#define SLEEP (   SECONDS)    for (int i = 0; i < 1 + SECONDS * 30000; i++)

Macro for sleep (wait) in seconds.

Definition at line 50 of file dpa_common.h.

◆ SYNC_EVENT_MASK_FFS

#define SYNC_EVENT_MASK_FFS   (0xFFFFFFFFFFFFFFFF)

Mask for doca_sync_event_wait_gt() wait value.

Definition at line 60 of file dpa_common.h.

Enumeration Type Documentation

◆ mmap_type

enum mmap_type

DOCA Mmap type definition.

Enumerator
MMAP_TYPE_CPU 
MMAP_TYPE_DPA 

Definition at line 170 of file dpa_common.h.

Function Documentation

◆ allocate_dpa_resources()

doca_error_t allocate_dpa_resources ( struct dpa_config cfg,
struct dpa_resources resources 
)

Allocate DOCA DPA resources.

@cfg [in]: DOCA DPA configurations @resources [out]: DOCA DPA resources to allocate

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 660 of file dpa_common.c.

◆ create_doca_dpa_completion_sync_event()

doca_error_t create_doca_dpa_completion_sync_event ( struct doca_dpa *  doca_dpa,
struct doca_dev *  doca_device,
struct doca_sync_event **  comp_event,
doca_dpa_dev_sync_event_t handle 
)

Create DOCA sync event to be published by the DPA and subscribed by the CPU.

@doca_dpa [in]: DOCA DPA context @doca_device [in]: DOCA device @comp_event [out]: Created DOCA sync event that is published by the DPA and subscribed by the CPU @handle [out]: Created DOCA sync event handle

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 354 of file dpa_common.c.

◆ create_doca_dpa_kernel_sync_event()

doca_error_t create_doca_dpa_kernel_sync_event ( struct doca_dpa *  doca_dpa,
struct doca_sync_event **  kernel_event 
)

Create DOCA sync event to be published and subscribed by the DPA.

@doca_dpa [in]: DOCA DPA context @kernel_event [out]: Created DOCA sync event that is published and subscribed by the DPA

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 404 of file dpa_common.c.

◆ create_doca_dpa_wait_sync_event()

doca_error_t create_doca_dpa_wait_sync_event ( struct doca_dpa *  doca_dpa,
struct doca_dev *  doca_device,
struct doca_sync_event **  wait_event 
)

Create DOCA sync event to be published by the CPU and subscribed by the DPA.

@doca_dpa [in]: DOCA DPA context @doca_device [in]: DOCA device @wait_event [out]: Created DOCA sync event that is published by the CPU and subscribed by the DPA

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 313 of file dpa_common.c.

◆ create_doca_remote_net_sync_event()

doca_error_t create_doca_remote_net_sync_event ( struct doca_dev *  doca_device,
struct doca_sync_event **  remote_net_event 
)

Create DOCA sync event to be published by a remote net and subscribed by the CPU.

@doca_device [in]: DOCA device @remote_net_event [out]: Created DOCA sync event that is published by a remote net and subscribed by the CPU

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 443 of file dpa_common.c.

◆ destroy_dpa_resources()

doca_error_t destroy_dpa_resources ( struct dpa_resources resources)

Destroy DOCA DPA resources.

@resources [in]: DOCA DPA resources to destroy

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 769 of file dpa_common.c.

◆ doca_mmap_obj_destroy()

doca_error_t doca_mmap_obj_destroy ( struct doca_mmap_obj doca_mmap_obj)

Destroy DOCA Mmap.

@doca_mmap_obj [in]: DOCA Mmap object

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 1209 of file dpa_common.c.

◆ doca_mmap_obj_init()

doca_error_t doca_mmap_obj_init ( struct doca_mmap_obj doca_mmap_obj)

Initialize DOCA Mmap.

@doca_mmap_obj [in/out]: DOCA Mmap object

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 1126 of file dpa_common.c.

◆ dpa_completion_obj_destroy()

doca_error_t dpa_completion_obj_destroy ( struct dpa_completion_obj dpa_completion_obj)

Destroy DPA completion.

@dpa_completion_obj [in]: DPA completion object

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 916 of file dpa_common.c.

◆ dpa_completion_obj_init()

doca_error_t dpa_completion_obj_init ( struct dpa_completion_obj dpa_completion_obj)

Initialize DPA completion.

@dpa_completion_obj [in/out]: DPA completion object

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 877 of file dpa_common.c.

◆ dpa_notification_completion_obj_destroy()

doca_error_t dpa_notification_completion_obj_destroy ( struct dpa_notification_completion_obj notification_completion_obj)

Destroy DPA notification completion.

@notification_completion_obj [in]: DPA notification completion object

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 962 of file dpa_common.c.

◆ dpa_notification_completion_obj_init()

doca_error_t dpa_notification_completion_obj_init ( struct dpa_notification_completion_obj notification_completion_obj)

Initialize DPA notification completion.

@notification_completion_obj [in/out]: DPA notification completion object

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 929 of file dpa_common.c.

◆ dpa_rdma_obj_destroy()

doca_error_t dpa_rdma_obj_destroy ( struct dpa_rdma_obj dpa_rdma_obj)

Destroy DPA RDMA.

@dpa_rdma_obj [in]: DPA RDMA object

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 1107 of file dpa_common.c.

◆ dpa_rdma_obj_init()

doca_error_t dpa_rdma_obj_init ( struct dpa_rdma_obj dpa_rdma_obj)

Initialize DPA RDMA without starting it.

This function creates DPA RDMA object. Please note that this function doesn't start the created DPA RDMA object, this need to be done using dpa_rdma_obj_start() API

@dpa_rdma_obj [in/out]: DPA RDMA object

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 976 of file dpa_common.c.

◆ dpa_rdma_obj_start()

doca_error_t dpa_rdma_obj_start ( struct dpa_rdma_obj dpa_rdma_obj)

Start DPA RDMA.

@dpa_rdma_obj [in]: DPA RDMA object

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 1058 of file dpa_common.c.

◆ dpa_thread_obj_destroy()

doca_error_t dpa_thread_obj_destroy ( struct dpa_thread_obj dpa_thread_obj)

Destroy DPA thread.

@dpa_thread_obj [in]: DPA thread object

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 864 of file dpa_common.c.

◆ dpa_thread_obj_init()

doca_error_t dpa_thread_obj_init ( struct dpa_thread_obj dpa_thread_obj)

Initialize DPA thread.

@dpa_thread_obj [in/out]: DPA thread object

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 817 of file dpa_common.c.

◆ export_doca_remote_net_sync_event_to_dpa()

doca_error_t export_doca_remote_net_sync_event_to_dpa ( struct doca_dev *  doca_device,
struct doca_dpa *  doca_dpa,
struct doca_sync_event *  remote_net_event,
struct doca_sync_event_remote_net **  remote_net_exported_event,
doca_dpa_dev_sync_event_remote_net_t remote_net_event_dpa_handle 
)

Create DOCA sync event to be published by a remote net and subscribed by the CPU.

@doca_device [in]: DOCA device @doca_dpa [in]: DOCA DPA context @remote_net_event [in]: remote net DOCA sync event @remote_net_exported_event [out]: Created from export remote net DOCA sync event @remote_net_event_dpa_handle [out]: DPA handle of the created from export remote net DOCA sync event

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 483 of file dpa_common.c.

◆ register_dpa_params()

doca_error_t register_dpa_params ( void  )

Register the command line parameters for the sample.

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 126 of file dpa_common.c.