NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
comch_data_path_high_speed_server_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_server_sample.c:

Go to the source code of this file.

Data Structures

struct  comch_data_path_server_objects
 

Functions

 DOCA_LOG_REGISTER (COMCH_DATA_PATH_HIGH_SPEED_SERVER)
 
static void server_send_task_completion_callback (struct doca_comch_task_send *task, union doca_data task_user_data, union doca_data ctx_user_data)
 
static void server_send_task_completion_err_callback (struct doca_comch_task_send *task, union doca_data task_user_data, union doca_data ctx_user_data)
 
static doca_error_t server_send_msg (struct comch_data_path_server_objects *sample_objects, const char *msg, size_t len)
 
static void server_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 void server_connection_event_callback (struct doca_comch_event_connection_status_changed *event, struct doca_comch_connection *comch_connection, uint8_t change_success)
 
static void server_disconnection_event_callback (struct doca_comch_event_connection_status_changed *event, struct doca_comch_connection *comch_connection, uint8_t change_success)
 
static void server_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_server_objects (struct comch_data_path_server_objects *sample_objects)
 
static doca_error_t init_comch_data_path_server_objects (const char *server_name, const char *dev_pci_addr, const char *dev_rep_pci_addr, const char *text, struct comch_data_path_server_objects *sample_objects)
 
static void handle_error_state (struct comch_data_path_server_objects *sample_objects)
 
doca_error_t start_comch_data_path_server_sample (const char *server_name, const char *dev_pci_addr, const char *rep_pci_addr, const char *text)
 

Function Documentation

◆ clean_comch_data_path_server_objects()

static void clean_comch_data_path_server_objects ( struct comch_data_path_server_objects sample_objects)
static

Clean all sample resources

@sample_objects [in]: Sample objects struct to clean

Definition at line 349 of file comch_data_path_high_speed_server_sample.c.

◆ DOCA_LOG_REGISTER()

DOCA_LOG_REGISTER ( COMCH_DATA_PATH_HIGH_SPEED_SERVER  )

◆ 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 334 of file comch_data_path_high_speed_server_sample.c.

◆ handle_error_state()

static void handle_error_state ( struct comch_data_path_server_objects sample_objects)
static

Definition at line 485 of file comch_data_path_high_speed_server_sample.c.

◆ init_comch_data_path_server_objects()

static doca_error_t init_comch_data_path_server_objects ( const char *  server_name,
const char *  dev_pci_addr,
const char *  dev_rep_pci_addr,
const char *  text,
struct comch_data_path_server_objects sample_objects 
)
static

Initialize sample resources

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

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 402 of file comch_data_path_high_speed_server_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 301 of file comch_data_path_high_speed_server_sample.c.

◆ server_connection_event_callback()

static void server_connection_event_callback ( struct doca_comch_event_connection_status_changed *  event,
struct doca_comch_connection *  comch_connection,
uint8_t  change_success 
)
static

Callback for connection event

@event [in]: Connection event object @comch_connection [in]: Connection object @change_success [in]: Whether the connection was successful or not

Definition at line 203 of file comch_data_path_high_speed_server_sample.c.

◆ server_disconnection_event_callback()

static void server_disconnection_event_callback ( struct doca_comch_event_connection_status_changed *  event,
struct doca_comch_connection *  comch_connection,
uint8_t  change_success 
)
static

Callback for disconnection event

@event [in]: Connection event object @comch_connection [in]: Connection object @change_success [in]: Whether the disconnection was successful or not

Definition at line 238 of file comch_data_path_high_speed_server_sample.c.

◆ server_message_recv_callback()

static void server_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 server 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 148 of file comch_data_path_high_speed_server_sample.c.

◆ server_send_msg()

static doca_error_t server_send_msg ( struct comch_data_path_server_objects sample_objects,
const char *  msg,
size_t  len 
)
static

Server sends a message to client

@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 115 of file comch_data_path_high_speed_server_sample.c.

◆ server_send_task_completion_callback()

static void server_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 server 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 71 of file comch_data_path_high_speed_server_sample.c.

◆ server_send_task_completion_err_callback()

static void server_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 server 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 92 of file comch_data_path_high_speed_server_sample.c.

◆ server_state_changed_callback()

static void server_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 server context state changes

@user_data [in]: User data associated with the CC server context. @ctx [in]: The CC server 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, this is unexpected for CC server.

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 257 of file comch_data_path_high_speed_server_sample.c.

◆ start_comch_data_path_server_sample()

doca_error_t start_comch_data_path_server_sample ( const char *  server_name,
const char *  dev_pci_addr,
const char *  rep_pci_addr,
const char *  text 
)

Run comch_client sample

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

Returns
: DOCA_SUCCESS on success and DOCA_ERROR otherwise

Definition at line 506 of file comch_data_path_high_speed_server_sample.c.