NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
rdma_common.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <time.h>
#include <unistd.h>
#include <doca_buf.h>
#include <doca_buf_inventory.h>
#include <doca_dev.h>
#include <doca_error.h>
#include <doca_mmap.h>
#include <doca_pe.h>
#include <doca_rdma.h>
#include <doca_sync_event.h>
#include "common.h"
Include dependency graph for rdma_common.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  rdma_config
 
struct  rdma_resources
 

Macros

#define MEM_RANGE_LEN   (4096) /* DOCA mmap memory range length */
 
#define INVENTORY_NUM_INITIAL_ELEMENTS   (16) /* Number of DOCA inventory initial elements */
 
#define MAX_USER_ARG_SIZE   (256) /* Maximum size of user input argument */
 
#define MAX_ARG_SIZE   (MAX_USER_ARG_SIZE + 1) /* Maximum size of input argument */
 
#define DEFAULT_STRING   "Hi DOCA RDMA!" /* Default string to use in our samples */
 
#define DEFAULT_LOCAL_CONNECTION_DESC_PATH   "/tmp/local_connection_desc_path.txt"
 
#define DEFAULT_REMOTE_CONNECTION_DESC_PATH   "/tmp/remote_connection_desc_path.txt"
 
#define DEFAULT_REMOTE_RESOURCE_CONNECTION_DESC_PATH   "/tmp/remote_resource_desc_path.txt"
 
#define NUM_RDMA_TASKS   (1) /* Number of RDMA tasks*/
 
#define SLEEP_IN_NANOS   (10 * 1000) /* Sample the task every 10 microseconds */
 
#define MAX(a, b)   (((a) > (b)) ? (a) : (b))
 
#define SERVER_ADDR_LEN   (128)
 
#define SERVER_ADDR_TYPE_LEN   (6)
 
#define NUM_NEGOTIATION_RDMA_TASKS   (1)
 
#define SERVER_NAME   "Server"
 
#define CLIENT_NAME   "Client"
 
#define DEFAULT_RDMA_CM_PORT   (13579)
 
#define MAX_NUM_CONNECTIONS   (8)
 

Typedefs

typedef doca_error_t(* task_check) (const struct doca_devinfo *)
 
typedef doca_error_t(* prepare_and_submit_task_fn) (struct rdma_resources *)
 

Functions

doca_error_t allocate_rdma_resources (struct rdma_config *cfg, const uint32_t mmap_permissions, const uint32_t rdma_permissions, task_check func, struct rdma_resources *resources)
 
doca_error_t destroy_rdma_resources (struct rdma_resources *resources, struct rdma_config *cfg)
 
doca_error_t register_rdma_common_params (void)
 
doca_error_t register_rdma_send_string_param (void)
 
doca_error_t register_rdma_read_string_param (void)
 
doca_error_t register_rdma_write_string_param (void)
 
doca_error_t register_rdma_num_connections_param (void)
 
doca_error_t write_file (const char *file_path, const char *string, size_t string_len)
 
doca_error_t read_file (const char *file_path, char **string, size_t *string_len)
 
doca_error_t delete_file (const char *file_path)
 
doca_error_t rdma_cm_connect (struct rdma_resources *resources)
 
doca_error_t rdma_cm_disconnect (struct rdma_resources *resources)
 
doca_error_t send_msg (struct doca_rdma *rdma, struct doca_rdma_connection *rdma_connection, struct doca_mmap *mmap, struct doca_buf_inventory *buf_inv, void *msg, uint32_t msg_len, void *user_data)
 
doca_error_t recv_msg (struct doca_rdma *rdma, struct doca_mmap *mmap, struct doca_buf_inventory *buf_inv, void *msg, uint32_t msg_len, void *user_data)
 
void receive_task_completion_cb (struct doca_rdma_task_receive *task, union doca_data task_user_data, union doca_data ctx_user_data)
 
void receive_task_error_cb (struct doca_rdma_task_receive *task, union doca_data task_user_data, union doca_data ctx_user_data)
 
void send_task_completion_cb (struct doca_rdma_task_send *task, union doca_data task_user_data, union doca_data ctx_user_data)
 
void send_task_error_cb (struct doca_rdma_task_send *task, union doca_data task_user_data, union doca_data ctx_user_data)
 
void rdma_cm_connect_request_cb (struct doca_rdma_connection *connection, union doca_data ctx_user_data)
 
void rdma_cm_connect_established_cb (struct doca_rdma_connection *connection, union doca_data connection_user_data, union doca_data ctx_user_data)
 
void rdma_cm_connect_failure_cb (struct doca_rdma_connection *connection, union doca_data connection_user_data, union doca_data ctx_user_data)
 
void rdma_cm_disconnect_cb (struct doca_rdma_connection *connection, union doca_data connection_user_data, union doca_data ctx_user_data)
 
doca_error_t set_default_config_value (struct rdma_config *cfg)
 
doca_error_t create_local_mmap (struct doca_mmap **mmap, const uint32_t mmap_permissions, void *data_buffer, size_t data_buffer_size, struct doca_dev *dev)
 
doca_error_t config_rdma_cm_callback_and_negotiation_task (struct rdma_resources *resources, bool need_send_task, bool need_recv_task)
 
doca_error_t rdma_requester_recv_data_from_rdma_responder (struct rdma_resources *resources)
 
doca_error_t rdma_responder_send_data_to_rdma_requester (struct rdma_resources *resources)
 
void wait_for_enter (void)
 

Macro Definition Documentation

◆ CLIENT_NAME

#define CLIENT_NAME   "Client"

Definition at line 65 of file rdma_common.h.

◆ DEFAULT_LOCAL_CONNECTION_DESC_PATH

#define DEFAULT_LOCAL_CONNECTION_DESC_PATH   "/tmp/local_connection_desc_path.txt"

Definition at line 52 of file rdma_common.h.

◆ DEFAULT_RDMA_CM_PORT

#define DEFAULT_RDMA_CM_PORT   (13579)

Definition at line 66 of file rdma_common.h.

◆ DEFAULT_REMOTE_CONNECTION_DESC_PATH

#define DEFAULT_REMOTE_CONNECTION_DESC_PATH   "/tmp/remote_connection_desc_path.txt"

Definition at line 54 of file rdma_common.h.

◆ DEFAULT_REMOTE_RESOURCE_CONNECTION_DESC_PATH

#define DEFAULT_REMOTE_RESOURCE_CONNECTION_DESC_PATH   "/tmp/remote_resource_desc_path.txt"

Definition at line 56 of file rdma_common.h.

◆ DEFAULT_STRING

#define DEFAULT_STRING   "Hi DOCA RDMA!" /* Default string to use in our samples */

Definition at line 50 of file rdma_common.h.

◆ INVENTORY_NUM_INITIAL_ELEMENTS

#define INVENTORY_NUM_INITIAL_ELEMENTS   (16) /* Number of DOCA inventory initial elements */

Definition at line 47 of file rdma_common.h.

◆ MAX

#define MAX (   a,
 
)    (((a) > (b)) ? (a) : (b))

Definition at line 59 of file rdma_common.h.

◆ MAX_ARG_SIZE

#define MAX_ARG_SIZE   (MAX_USER_ARG_SIZE + 1) /* Maximum size of input argument */

Definition at line 49 of file rdma_common.h.

◆ MAX_NUM_CONNECTIONS

#define MAX_NUM_CONNECTIONS   (8)

Definition at line 67 of file rdma_common.h.

◆ MAX_USER_ARG_SIZE

#define MAX_USER_ARG_SIZE   (256) /* Maximum size of user input argument */

Definition at line 48 of file rdma_common.h.

◆ MEM_RANGE_LEN

#define MEM_RANGE_LEN   (4096) /* DOCA mmap memory range length */

Definition at line 46 of file rdma_common.h.

◆ NUM_NEGOTIATION_RDMA_TASKS

#define NUM_NEGOTIATION_RDMA_TASKS   (1)

Definition at line 63 of file rdma_common.h.

◆ NUM_RDMA_TASKS

#define NUM_RDMA_TASKS   (1) /* Number of RDMA tasks*/

Definition at line 57 of file rdma_common.h.

◆ SERVER_ADDR_LEN

#define SERVER_ADDR_LEN   (128)

Definition at line 61 of file rdma_common.h.

◆ SERVER_ADDR_TYPE_LEN

#define SERVER_ADDR_TYPE_LEN   (6)

Definition at line 62 of file rdma_common.h.

◆ SERVER_NAME

#define SERVER_NAME   "Server"

Definition at line 64 of file rdma_common.h.

◆ SLEEP_IN_NANOS

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

Definition at line 58 of file rdma_common.h.

Typedef Documentation

◆ prepare_and_submit_task_fn

typedef doca_error_t(* prepare_and_submit_task_fn) (struct rdma_resources *)

Definition at line 76 of file rdma_common.h.

◆ task_check

typedef doca_error_t(* task_check) (const struct doca_devinfo *)

Definition at line 70 of file rdma_common.h.

Function Documentation

◆ allocate_rdma_resources()

doca_error_t allocate_rdma_resources ( struct rdma_config cfg,
const uint32_t  mmap_permissions,
const uint32_t  rdma_permissions,
task_check  func,
struct rdma_resources resources 
)

Definition at line 758 of file rdma_common.c.

◆ config_rdma_cm_callback_and_negotiation_task()

doca_error_t config_rdma_cm_callback_and_negotiation_task ( struct rdma_resources resources,
bool  need_send_task,
bool  need_recv_task 
)

Set send&recv task configuration they are used for transferring the mmap desc between client and server for non-sync-event task also used for transferring the sync-event desc between client and server for syn-event task

Definition at line 1720 of file rdma_common.c.

◆ create_local_mmap()

doca_error_t create_local_mmap ( struct doca_mmap **  mmap,
const uint32_t  mmap_permissions,
void *  data_buffer,
size_t  data_buffer_size,
struct doca_dev *  dev 
)

Definition at line 1665 of file rdma_common.c.

◆ delete_file()

doca_error_t delete_file ( const char *  file_path)

Definition at line 899 of file rdma_common.c.

◆ destroy_rdma_resources()

doca_error_t destroy_rdma_resources ( struct rdma_resources resources,
struct rdma_config cfg 
)

Definition at line 1002 of file rdma_common.c.

◆ rdma_cm_connect()

doca_error_t rdma_cm_connect ( struct rdma_resources resources)

Definition at line 1172 of file rdma_common.c.

◆ rdma_cm_connect_established_cb()

void rdma_cm_connect_established_cb ( struct doca_rdma_connection *  connection,
union doca_data  connection_user_data,
union doca_data  ctx_user_data 
)

Definition at line 75 of file rdma_common.c.

◆ rdma_cm_connect_failure_cb()

void rdma_cm_connect_failure_cb ( struct doca_rdma_connection *  connection,
union doca_data  connection_user_data,
union doca_data  ctx_user_data 
)

Definition at line 101 of file rdma_common.c.

◆ rdma_cm_connect_request_cb()

void rdma_cm_connect_request_cb ( struct doca_rdma_connection *  connection,
union doca_data  ctx_user_data 
)

Definition at line 47 of file rdma_common.c.

◆ rdma_cm_disconnect()

doca_error_t rdma_cm_disconnect ( struct rdma_resources resources)

Definition at line 1244 of file rdma_common.c.

◆ rdma_cm_disconnect_cb()

void rdma_cm_disconnect_cb ( struct doca_rdma_connection *  connection,
union doca_data  connection_user_data,
union doca_data  ctx_user_data 
)

Definition at line 128 of file rdma_common.c.

◆ rdma_requester_recv_data_from_rdma_responder()

doca_error_t rdma_requester_recv_data_from_rdma_responder ( struct rdma_resources resources)

Definition at line 1332 of file rdma_common.c.

◆ rdma_responder_send_data_to_rdma_requester()

doca_error_t rdma_responder_send_data_to_rdma_requester ( struct rdma_resources resources)

Definition at line 1387 of file rdma_common.c.

◆ read_file()

doca_error_t read_file ( const char *  file_path,
char **  string,
size_t string_len 
)

Definition at line 56 of file utils.c.

◆ receive_task_completion_cb()

void receive_task_completion_cb ( struct doca_rdma_task_receive *  task,
union doca_data  task_user_data,
union doca_data  ctx_user_data 
)

Definition at line 1477 of file rdma_common.c.

◆ receive_task_error_cb()

void receive_task_error_cb ( struct doca_rdma_task_receive *  task,
union doca_data  task_user_data,
union doca_data  ctx_user_data 
)

Definition at line 1510 of file rdma_common.c.

◆ recv_msg()

doca_error_t recv_msg ( struct doca_rdma *  rdma,
struct doca_mmap *  mmap,
struct doca_buf_inventory *  buf_inv,
void *  msg,
uint32_t  msg_len,
void *  user_data 
)

Definition at line 1297 of file rdma_common.c.

◆ register_rdma_common_params()

doca_error_t register_rdma_common_params ( void  )

Definition at line 580 of file rdma_common.c.

◆ register_rdma_num_connections_param()

doca_error_t register_rdma_num_connections_param ( void  )

Definition at line 338 of file rdma_common.c.

◆ register_rdma_read_string_param()

doca_error_t register_rdma_read_string_param ( void  )

Definition at line 260 of file rdma_common.c.

◆ register_rdma_send_string_param()

doca_error_t register_rdma_send_string_param ( void  )

Definition at line 232 of file rdma_common.c.

◆ register_rdma_write_string_param()

doca_error_t register_rdma_write_string_param ( void  )

Definition at line 288 of file rdma_common.c.

◆ send_msg()

doca_error_t send_msg ( struct doca_rdma *  rdma,
struct doca_rdma_connection *  rdma_connection,
struct doca_mmap *  mmap,
struct doca_buf_inventory *  buf_inv,
void *  msg,
uint32_t  msg_len,
void *  user_data 
)

Definition at line 1262 of file rdma_common.c.

◆ send_task_completion_cb()

void send_task_completion_cb ( struct doca_rdma_task_send *  task,
union doca_data  task_user_data,
union doca_data  ctx_user_data 
)

Definition at line 1525 of file rdma_common.c.

◆ send_task_error_cb()

void send_task_error_cb ( struct doca_rdma_task_send *  task,
union doca_data  task_user_data,
union doca_data  ctx_user_data 
)

Definition at line 1541 of file rdma_common.c.

◆ set_default_config_value()

doca_error_t set_default_config_value ( struct rdma_config cfg)

Definition at line 1640 of file rdma_common.c.

◆ wait_for_enter()

void wait_for_enter ( void  )

Definition at line 1771 of file rdma_common.c.

◆ write_file()

doca_error_t write_file ( const char *  file_path,
const char *  string,
size_t  string_len 
)

Definition at line 1087 of file rdma_common.c.