NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
secure_channel_core.c File Reference
#include <arpa/inet.h>
#include <errno.h>
#include <signal.h>
#include <stdbool.h>
#include <string.h>
#include <sys/epoll.h>
#include <sys/signalfd.h>
#include <doca_argp.h>
#include <doca_buf.h>
#include <doca_buf_inventory.h>
#include <doca_comch_consumer.h>
#include <doca_comch_producer.h>
#include <doca_ctx.h>
#include <doca_dev.h>
#include <doca_log.h>
#include <doca_mmap.h>
#include <doca_pe.h>
#include <samples/common.h>
#include <utils.h>
#include "secure_channel_core.h"
Include dependency graph for secure_channel_core.c:

Go to the source code of this file.

Data Structures

struct  local_memory_bufs
 

Macros

#define MAX_MSG_SIZE   65535 /* Max message size */
 
#define SLEEP_IN_NANOS   (10 * 1000) /* Sample the connection every 10 microseconds */
 
#define MAX_FASTPATH_TASKS   1024 /* Maximum number of producer/consumer tasks to use */
 
#define CACHE_ALIGN   64 /* Cache line alignment for producer/consumer performance */
 
#define NS_PER_SEC   1E9 /* Nano-seconds per second */
 
#define NS_PER_MSEC   1E6 /* Nano-seconds per millisecond */
 
#define CLOCK_TYPE_ID   CLOCK_MONOTONIC
 

Functions

 DOCA_LOG_REGISTER (SECURE_CHANNEL::Core)
 
static doca_error_t messages_number_callback (void *param, void *config)
 
static doca_error_t message_size_callback (void *param, void *config)
 
static doca_error_t dev_pci_addr_callback (void *param, void *config)
 
static doca_error_t rep_pci_addr_callback (void *param, void *config)
 
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)
 
void comch_recv_event_cb (struct doca_comch_event_msg_recv *event, uint8_t *recv_buffer, uint32_t msg_len, struct doca_comch_connection *comch_connection)
 
static void destroy_local_memory (struct local_memory_bufs *local_mem)
 
static doca_error_t prepare_local_memory (struct local_memory_bufs *local_mem, const char *pci_addr, size_t buf_len, uint32_t num_bufs, uint32_t permissions)
 
static void send_task_completed_callback (struct doca_comch_producer_task_send *task, union doca_data task_user_data, union doca_data ctx_user_data)
 
static void send_task_fail_callback (struct doca_comch_producer_task_send *task, union doca_data task_user_data, union doca_data ctx_user_data)
 
static void * run_producer (void *context)
 
static void recv_task_completed_callback (struct doca_comch_consumer_task_post_recv *task, union doca_data task_user_data, union doca_data ctx_user_data)
 
static void recv_task_fail_callback (struct doca_comch_consumer_task_post_recv *task, union doca_data task_user_data, union doca_data ctx_user_data)
 
static void * run_consumer (void *context)
 
static doca_error_t start_threads (struct cc_ctx *ctx, struct comch_cfg *comch_cfg)
 
static double calculate_timediff_ms (struct timespec *end, struct timespec *start)
 
doca_error_t sc_start (struct comch_cfg *comch_cfg, struct sc_config *cfg, struct cc_ctx *ctx)
 
doca_error_t register_secure_channel_params (void)
 

Macro Definition Documentation

◆ CACHE_ALIGN

#define CACHE_ALIGN   64 /* Cache line alignment for producer/consumer performance */

Definition at line 54 of file secure_channel_core.c.

◆ CLOCK_TYPE_ID

#define CLOCK_TYPE_ID   CLOCK_MONOTONIC

Definition at line 61 of file secure_channel_core.c.

◆ MAX_FASTPATH_TASKS

#define MAX_FASTPATH_TASKS   1024 /* Maximum number of producer/consumer tasks to use */

Definition at line 53 of file secure_channel_core.c.

◆ MAX_MSG_SIZE

#define MAX_MSG_SIZE   65535 /* Max message size */

Definition at line 51 of file secure_channel_core.c.

◆ NS_PER_MSEC

#define NS_PER_MSEC   1E6 /* Nano-seconds per millisecond */

Definition at line 57 of file secure_channel_core.c.

◆ NS_PER_SEC

#define NS_PER_SEC   1E9 /* Nano-seconds per second */

Definition at line 56 of file secure_channel_core.c.

◆ SLEEP_IN_NANOS

#define SLEEP_IN_NANOS   (10 * 1000) /* Sample the connection every 10 microseconds */

Definition at line 52 of file secure_channel_core.c.

Function Documentation

◆ calculate_timediff_ms()

static double calculate_timediff_ms ( struct timespec *  end,
struct timespec *  start 
)
static

Definition at line 922 of file secure_channel_core.c.

◆ comch_recv_event_cb()

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

Definition at line 187 of file secure_channel_core.c.

◆ destroy_local_memory()

static void destroy_local_memory ( struct local_memory_bufs local_mem)
static

Definition at line 222 of file secure_channel_core.c.

◆ dev_pci_addr_callback()

static doca_error_t dev_pci_addr_callback ( void *  param,
void *  config 
)
static

Definition at line 124 of file secure_channel_core.c.

◆ DOCA_LOG_REGISTER()

DOCA_LOG_REGISTER ( SECURE_CHANNEL::Core  )

◆ expired_consumer_callback()

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

Definition at line 176 of file secure_channel_core.c.

◆ message_size_callback()

static doca_error_t message_size_callback ( void *  param,
void *  config 
)
static

Definition at line 103 of file secure_channel_core.c.

◆ messages_number_callback()

static doca_error_t messages_number_callback ( void *  param,
void *  config 
)
static

Definition at line 81 of file secure_channel_core.c.

◆ new_consumer_callback()

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

Definition at line 165 of file secure_channel_core.c.

◆ prepare_local_memory()

static doca_error_t prepare_local_memory ( struct local_memory_bufs local_mem,
const char *  pci_addr,
size_t  buf_len,
uint32_t  num_bufs,
uint32_t  permissions 
)
static

Definition at line 240 of file secure_channel_core.c.

◆ recv_task_completed_callback()

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

Definition at line 604 of file secure_channel_core.c.

◆ recv_task_fail_callback()

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

Definition at line 650 of file secure_channel_core.c.

◆ register_secure_channel_params()

doca_error_t register_secure_channel_params ( void  )

Definition at line 1022 of file secure_channel_core.c.

◆ rep_pci_addr_callback()

static doca_error_t rep_pci_addr_callback ( void *  param,
void *  config 
)
static

Definition at line 147 of file secure_channel_core.c.

◆ run_consumer()

static void* run_consumer ( void *  context)
static

Definition at line 673 of file secure_channel_core.c.

◆ run_producer()

static void* run_producer ( void *  context)
static

Definition at line 397 of file secure_channel_core.c.

◆ sc_start()

doca_error_t sc_start ( struct comch_cfg comch_cfg,
struct sc_config cfg,
struct cc_ctx ctx 
)

Definition at line 933 of file secure_channel_core.c.

◆ send_task_completed_callback()

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

Definition at line 330 of file secure_channel_core.c.

◆ send_task_fail_callback()

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

Definition at line 374 of file secure_channel_core.c.

◆ start_threads()

static doca_error_t start_threads ( struct cc_ctx ctx,
struct comch_cfg comch_cfg 
)
static

Definition at line 870 of file secure_channel_core.c.