NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
comch_data_path_high_speed_common.c File Reference
#include <time.h>
#include <doca_buf.h>
#include <doca_comch.h>
#include <doca_comch_consumer.h>
#include <doca_comch_producer.h>
#include <doca_ctx.h>
#include <doca_dev.h>
#include <doca_error.h>
#include <doca_log.h>
#include <doca_pe.h>
#include "comch_ctrl_path_common.h"
#include "comch_data_path_high_speed_common.h"
#include "common.h"
Include dependency graph for comch_data_path_high_speed_common.c:

Go to the source code of this file.

Functions

 DOCA_LOG_REGISTER (COMCH_DATA_PATH_HIGH_SPEED_COMMON)
 
void clean_local_mem_bufs (struct local_mem_bufs *local)
 
doca_error_t init_local_mem_bufs (struct local_mem_bufs *local, struct doca_dev *dev, size_t buf_len, size_t max_bufs)
 
void clean_comch_producer (struct doca_comch_producer *producer, struct doca_pe *pe)
 
doca_error_t init_comch_producer (struct doca_comch_connection *connection, struct comch_producer_cb_config *cfg, struct doca_comch_producer **producer, struct doca_pe **pe)
 
void clean_comch_consumer (struct doca_comch_consumer *consumer, struct doca_pe *pe)
 
doca_error_t init_comch_consumer (struct doca_comch_connection *connection, struct doca_mmap *user_mmap, struct comch_consumer_cb_config *cfg, struct doca_comch_consumer **consumer, struct doca_pe **pe)
 
static void producer_send_task_completion_callback (struct doca_comch_producer_task_send *task, union doca_data task_user_data, union doca_data ctx_user_data)
 
static void producer_send_task_completion_err_callback (struct doca_comch_producer_task_send *task, union doca_data task_user_data, union doca_data ctx_user_data)
 
static doca_error_t producer_send_msg (struct comch_data_path_objects *data_path)
 
static void producer_state_changed_callback (const union doca_data user_data, struct doca_ctx *ctx, enum doca_ctx_states prev_state, enum doca_ctx_states next_state)
 
static void consumer_recv_task_completion_callback (struct doca_comch_consumer_task_post_recv *task, union doca_data task_user_data, union doca_data ctx_user_data)
 
static void consumer_recv_task_completion_err_callback (struct doca_comch_consumer_task_post_recv *task, union doca_data task_user_data, union doca_data ctx_user_data)
 
static doca_error_t consumer_recv_msg (struct comch_data_path_objects *data_path)
 
static void consumer_state_changed_callback (const union doca_data user_data, struct doca_ctx *ctx, enum doca_ctx_states prev_state, enum doca_ctx_states next_state)
 
doca_error_t comch_data_path_send_msg (struct comch_data_path_objects *data_path)
 
doca_error_t comch_data_path_recv_msg (struct comch_data_path_objects *data_path)
 

Function Documentation

◆ clean_comch_consumer()

void clean_comch_consumer ( struct doca_comch_consumer *  consumer,
struct doca_pe *  pe 
)

Clean consumer and its PE

@consumer [in]: Consumer object to clean @pe [in]: Consumer PE object to clean

Definition at line 234 of file comch_data_path_high_speed_common.c.

◆ clean_comch_producer()

void clean_comch_producer ( struct doca_comch_producer *  producer,
struct doca_pe *  pe 
)

Clean producer and its PE

@producer [in]: Producer object to clean @pe [in]: Producer PE object to clean

Definition at line 149 of file comch_data_path_high_speed_common.c.

◆ clean_local_mem_bufs()

void clean_local_mem_bufs ( struct local_mem_bufs local)

Clean a local memory object

@local [in]: The local memory object to clean

Definition at line 44 of file comch_data_path_high_speed_common.c.

◆ comch_data_path_recv_msg()

doca_error_t comch_data_path_recv_msg ( struct comch_data_path_objects data_path)

Use cc high speed data path to recv a msg

@data_path [in]: CC data path resources

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 709 of file comch_data_path_high_speed_common.c.

◆ comch_data_path_send_msg()

doca_error_t comch_data_path_send_msg ( struct comch_data_path_objects data_path)

Use cc high speed data path to send a msg

@data_path [in]: CC data path resources

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 650 of file comch_data_path_high_speed_common.c.

◆ consumer_recv_msg()

static doca_error_t consumer_recv_msg ( struct comch_data_path_objects data_path)
static

Use consumer to recv a msg

@data_path [in]: CC data path resources

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 557 of file comch_data_path_high_speed_common.c.

◆ consumer_recv_task_completion_callback()

static void consumer_recv_task_completion_callback ( struct doca_comch_consumer_task_post_recv *  task,
union doca_data  task_user_data,
union doca_data  ctx_user_data 
)
static

Callback for consumer post recv task successful completion

@task [in]: Recv task object @task_user_data [in]: User data for task @ctx_user_data [in]: User data for context

Definition at line 488 of file comch_data_path_high_speed_common.c.

◆ consumer_recv_task_completion_err_callback()

static void consumer_recv_task_completion_err_callback ( struct doca_comch_consumer_task_post_recv *  task,
union doca_data  task_user_data,
union doca_data  ctx_user_data 
)
static

Callback for consumer post recv task completion with error

@task [in]: Send task object @task_user_data [in]: User data for task @ctx_user_data [in]: User data for context

Definition at line 531 of file comch_data_path_high_speed_common.c.

◆ consumer_state_changed_callback()

static void consumer_state_changed_callback ( const union doca_data  user_data,
struct doca_ctx *  ctx,
enum doca_ctx_states  prev_state,
enum doca_ctx_states  next_state 
)
static

Callback triggered whenever CC consumer context state changes

@user_data [in]: User data associated with the CC consumer context @ctx [in]: The CC consumer context that had a state change @prev_state [in]: Previous context state @next_state [in]: Next context state (context is already in this state when the callback is called)

The context is in starting state.

The context is in stopping, this can happen when fatal error encountered or when stopping context. doca_pe_progress() will cause all tasks to be flushed, and finally transition state to idle

Definition at line 601 of file comch_data_path_high_speed_common.c.

◆ DOCA_LOG_REGISTER()

DOCA_LOG_REGISTER ( COMCH_DATA_PATH_HIGH_SPEED_COMMON  )

◆ init_comch_consumer()

doca_error_t init_comch_consumer ( struct doca_comch_connection *  connection,
struct doca_mmap *  user_mmap,
struct comch_consumer_cb_config cb_cfg,
struct doca_comch_consumer **  consumer,
struct doca_pe **  pe 
)

Initialize a cc producer and its PE

@connection [in]: CC connection the consumer is built on @user_mmap [in]: The local memory mmap required by consumer @cb_cfg [in]: Consumer callback configuration @consumer [out]: Consumer objects struct to initialize @pe [out]: Consumer PE objects struct to initialize

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 252 of file comch_data_path_high_speed_common.c.

◆ init_comch_producer()

doca_error_t init_comch_producer ( struct doca_comch_connection *  connection,
struct comch_producer_cb_config cb_cfg,
struct doca_comch_producer **  producer,
struct doca_pe **  pe 
)

Initialize a cc producer and its PE

@connection [in]: CC connection the producer is built on @cb_cfg [in]: Producer callback configuration @producer [out]: Producer objects struct to initialize @pe [out]: Producer PE objects struct to initialize

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 166 of file comch_data_path_high_speed_common.c.

◆ init_local_mem_bufs()

doca_error_t init_local_mem_bufs ( struct local_mem_bufs local,
struct doca_dev *  dev,
size_t  buf_len,
size_t  max_bufs 
)

Initialize a local memory mmap

@local [in]: Local_memory object to initialize @dev [in]: Device to add for this memory mmap @buf_len [in]: Length of each DOCA buf @max_bufs [in]: Number of DOCA buf

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 78 of file comch_data_path_high_speed_common.c.

◆ producer_send_msg()

static doca_error_t producer_send_msg ( struct comch_data_path_objects data_path)
static

Use producers to send a msg

@data_path [in]: CC data path resources

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 380 of file comch_data_path_high_speed_common.c.

◆ producer_send_task_completion_callback()

static void producer_send_task_completion_callback ( struct doca_comch_producer_task_send *  task,
union doca_data  task_user_data,
union doca_data  ctx_user_data 
)
static

Callback for producer send task successful completion

@task [in]: Send task object @task_user_data [in]: User data for task @ctx_user_data [in]: User data for context

Definition at line 328 of file comch_data_path_high_speed_common.c.

◆ producer_send_task_completion_err_callback()

static void producer_send_task_completion_err_callback ( struct doca_comch_producer_task_send *  task,
union doca_data  task_user_data,
union doca_data  ctx_user_data 
)
static

Callback for producer send task completion with error

@task [in]: Send task object @task_user_data [in]: User data for task @ctx_user_data [in]: User data for context

Definition at line 354 of file comch_data_path_high_speed_common.c.

◆ producer_state_changed_callback()

static void producer_state_changed_callback ( const union doca_data  user_data,
struct doca_ctx *  ctx,
enum doca_ctx_states  prev_state,
enum doca_ctx_states  next_state 
)
static

Callback triggered whenever CC producer context state changes

@user_data [in]: User data associated with the CC producer context. @ctx [in]: The CC client context that had a state change @prev_state [in]: Previous context state @next_state [in]: Next context state (context is already in this state when the callback is called)

The context is in starting state.

The context is in stopping, this can happen when fatal error encountered or when stopping context. doca_pe_progress() will cause all tasks to be flushed, and finally transition state to idle

Definition at line 438 of file comch_data_path_high_speed_common.c.