NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
comch_data_path_high_speed_client_sample.c File Reference
#include <signal.h>
#include <stdbool.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <doca_buf.h>
#include <doca_buf_inventory.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_mmap.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_client_sample.c:

Go to the source code of this file.

Data Structures

struct  comch_data_path_client_objects
 

Functions

 DOCA_LOG_REGISTER (COMCH_DATA_PATH_HIGH_SPEED_CLIENT)
 
static void client_send_task_completion_callback (struct doca_comch_task_send *task, union doca_data task_user_data, union doca_data ctx_user_data)
 
static void client_send_task_completion_err_callback (struct doca_comch_task_send *task, union doca_data task_user_data, union doca_data ctx_user_data)
 
static void client_message_recv_callback (struct doca_comch_event_msg_recv *event, uint8_t *recv_buffer, uint32_t msg_len, struct doca_comch_connection *comch_connection)
 
static doca_error_t client_send_msg (struct comch_data_path_client_objects *sample_objects, const char *msg, size_t len)
 
static void client_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 new_consumer_callback (struct doca_comch_event_consumer *event, struct doca_comch_connection *comch_connection, uint32_t id)
 
void expired_consumer_callback (struct doca_comch_event_consumer *event, struct doca_comch_connection *comch_connection, uint32_t id)
 
static void clean_comch_data_path_client_objects (struct comch_data_path_client_objects *sample_objects)
 
static doca_error_t init_comch_data_path_client_objects (const char *server_name, const char *dev_pci_addr, const char *text, struct comch_data_path_client_objects *sample_objects)
 
doca_error_t start_comch_data_path_client_sample (const char *server_name, const char *dev_pci_addr, const char *text)
 

Function Documentation

◆ clean_comch_data_path_client_objects()

static void clean_comch_data_path_client_objects ( struct comch_data_path_client_objects sample_objects)
static

Clean all sample resources

@sample_objects [in]: Sample objects struct to clean

Definition at line 291 of file comch_data_path_high_speed_client_sample.c.

◆ client_message_recv_callback()

static void client_message_recv_callback ( struct doca_comch_event_msg_recv *  event,
uint8_t *  recv_buffer,
uint32_t  msg_len,
struct doca_comch_connection *  comch_connection 
)
static

Callback for client message recv event

@event [in]: Recv event object @recv_buffer [in]: Message buffer @msg_len [in]: Message len @comch_connection [in]: Connection the message was received on

Definition at line 114 of file comch_data_path_high_speed_client_sample.c.

◆ client_send_msg()

static doca_error_t client_send_msg ( struct comch_data_path_client_objects sample_objects,
const char *  msg,
size_t  len 
)
static

Client sends a message to server

@sample_objects [in]: The sample object to use @msg [in]: The msg to send @len [in]: The msg length

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 157 of file comch_data_path_high_speed_client_sample.c.

◆ client_send_task_completion_callback()

static void client_send_task_completion_callback ( struct doca_comch_task_send *  task,
union doca_data  task_user_data,
union doca_data  ctx_user_data 
)
static

Callback for client 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 70 of file comch_data_path_high_speed_client_sample.c.

◆ client_send_task_completion_err_callback()

static void client_send_task_completion_err_callback ( struct doca_comch_task_send *  task,
union doca_data  task_user_data,
union doca_data  ctx_user_data 
)
static

Callback for client 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 91 of file comch_data_path_high_speed_client_sample.c.

◆ client_state_changed_callback()

static void client_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 client context state changes

@user_data [in]: User data associated with the CC client 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, need to progress until connection with server is established.

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 190 of file comch_data_path_high_speed_client_sample.c.

◆ DOCA_LOG_REGISTER()

DOCA_LOG_REGISTER ( COMCH_DATA_PATH_HIGH_SPEED_CLIENT  )

◆ expired_consumer_callback()

void expired_consumer_callback ( struct doca_comch_event_consumer *  event,
struct doca_comch_connection *  comch_connection,
uint32_t  id 
)

Callback for expired consumer arrival event

@event [in]: Expired remote consumer event object @comch_connection [in]: The connection related to the consumer @id [in]: The ID of the expired remote consumer

Definition at line 276 of file comch_data_path_high_speed_client_sample.c.

◆ init_comch_data_path_client_objects()

static doca_error_t init_comch_data_path_client_objects ( const char *  server_name,
const char *  dev_pci_addr,
const char *  text,
struct comch_data_path_client_objects sample_objects 
)
static

Initialize sample resources

@server_name [in]: Server name to connect to @dev_pci_addr [in]: PCI address to connect over @text [in]: Message to send to the server @sample_objects [in]: Sample objects struct to initialize

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 344 of file comch_data_path_high_speed_client_sample.c.

◆ new_consumer_callback()

static void new_consumer_callback ( struct doca_comch_event_consumer *  event,
struct doca_comch_connection *  comch_connection,
uint32_t  id 
)
static

Callback for new consumer arrival event

@event [in]: New remote consumer event object @comch_connection [in]: The connection related to the consumer @id [in]: The ID of the new remote consumer

Definition at line 244 of file comch_data_path_high_speed_client_sample.c.

◆ start_comch_data_path_client_sample()

doca_error_t start_comch_data_path_client_sample ( const char *  server_name,
const char *  dev_pci_addr,
const char *  text 
)

Run comch_data_path_client sample

@server_name [in]: Server name to connect to @dev_pci_addr [in]: PCI address to connect over @text [in]: Message to send to the server

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 430 of file comch_data_path_high_speed_client_sample.c.