NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
comch_ctrl_path_client_sample.c File Reference
#include <signal.h>
#include <stdbool.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <doca_comch.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 "common.h"
Include dependency graph for comch_ctrl_path_client_sample.c:

Go to the source code of this file.

Data Structures

struct  comch_ctrl_path_objects
 

Functions

 DOCA_LOG_REGISTER (COMCH_CTRL_PATH_CLIENT)
 
static void send_task_completion_callback (struct doca_comch_task_send *task, union doca_data task_user_data, union doca_data ctx_user_data)
 
static void 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 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_ping_pong (struct comch_ctrl_path_objects *sample_objects)
 
static void clean_comch_sample_objects (struct comch_ctrl_path_objects *sample_objects)
 
static void comch_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 doca_error_t init_comch_ctrl_path_objects (const char *server_name, const char *dev_pci_addr, struct comch_ctrl_path_objects *sample_objects)
 
doca_error_t start_comch_ctrl_path_client_sample (const char *server_name, const char *dev_pci_addr, const char *text, const uint32_t text_len)
 

Function Documentation

◆ clean_comch_sample_objects()

static void clean_comch_sample_objects ( struct comch_ctrl_path_objects sample_objects)
static

Clean all sample resources

@sample_objects [in]: Sample objects struct to clean

Definition at line 176 of file comch_ctrl_path_client_sample.c.

◆ client_send_ping_pong()

static doca_error_t client_send_ping_pong ( struct comch_ctrl_path_objects sample_objects)
static

Send and receive message on client

@sample_objects [in]: Sample objects struct

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 130 of file comch_ctrl_path_client_sample.c.

◆ comch_client_state_changed_callback()

static void comch_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. Will hold struct comch_ctrl_path_objects * @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 201 of file comch_ctrl_path_client_sample.c.

◆ DOCA_LOG_REGISTER()

DOCA_LOG_REGISTER ( COMCH_CTRL_PATH_CLIENT  )

◆ init_comch_ctrl_path_objects()

static doca_error_t init_comch_ctrl_path_objects ( const char *  server_name,
const char *  dev_pci_addr,
struct comch_ctrl_path_objects sample_objects 
)
static

Initialize sample resources

@server_name [in]: Server name to connect to @dev_pci_addr [in]: PCI address to connect over @sample_objects [in]: Sample objects struct to initialize

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 252 of file comch_ctrl_path_client_sample.c.

◆ message_recv_callback()

static void 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 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 108 of file comch_ctrl_path_client_sample.c.

◆ send_task_completion_callback()

static void 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 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 62 of file comch_ctrl_path_client_sample.c.

◆ send_task_completion_err_callback()

static void 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 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 84 of file comch_ctrl_path_client_sample.c.

◆ start_comch_ctrl_path_client_sample()

doca_error_t start_comch_ctrl_path_client_sample ( const char *  server_name,
const char *  dev_pci_addr,
const char *  text,
const uint32_t  text_len 
)

Run comch_ctrl_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 @text_len [in]: Message length

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 296 of file comch_ctrl_path_client_sample.c.