38 #define SLEEP_IN_NANOS (10 * 1000)
39 #define TIMEOUT_IN_NANOS (1 * 1000000000)
219 strncpy(pci_addr_dest, pci_addr_src,
len + 1);
302 struct doca_argp_param *dev_pci_addr_param =
NULL, *is_async_mode_param =
NULL, *async_num_tasks =
NULL,
303 *is_update_atomic =
NULL;
325 struct doca_argp_param *rep_pci_addr_param =
NULL;
355 "Start DOCA Sync Event in asynchronous mode (synchronous mode by default)");
390 "Update DOCA Sync Event using Add operation (Set operation by default)");
420 DOCA_LOG_ERR(
"DOCA Sync Event asynchronous wait is not supported (%s) on the given device",
426 DOCA_LOG_ERR(
"Please specify num async tasksin the range [0, 4294967295] (asynchronous mode)");
463 union doca_data ctx_user_data = {.
ptr = (
void *)se_rt_objs};
529 (void)task_user_data;
549 (void)task_user_data;
564 static void comch_server_connection_cb(
struct doca_comch_event_connection_status_changed *event,
565 struct doca_comch_connection *comch_connection,
566 uint8_t change_successful)
574 (void)change_successful;
595 static void comch_server_disconnection_cb(
struct doca_comch_event_connection_status_changed *event,
597 uint8_t change_successful)
605 (void)change_successful;
659 DOCA_LOG_ERR(
"Failed to connect comch server context to progress engine: %s",
675 DOCA_LOG_ERR(
"Failed to register comch server receive event callback: %s",
681 comch_server_connection_cb,
682 comch_server_disconnection_cb);
688 user_data.
ptr = se_rt_objs;
723 DOCA_LOG_ERR(
"Failed to receive connection from host: timeout");
772 DOCA_LOG_ERR(
"Failed to connect comch client context to progress engine: %s",
788 DOCA_LOG_ERR(
"Failed to register comch client receive event callback: %s",
793 user_data.
ptr = se_rt_objs;
858 struct timespec ts = {
871 DOCA_LOG_ERR(
"Failed to retrieve set task progress: timeout");
880 DOCA_LOG_ERR(
"Failed to execute set task for sync event: %s",
909 DOCA_LOG_ERR(
"Server did not get client disconnection: timeout");
925 DOCA_LOG_ERR(
"Server could not move to idle state: timeout");
947 DOCA_LOG_ERR(
"Client could not move to idle state: timeout");
968 size_t inflight_tasks;
971 struct timespec ts = {
985 }
while (inflight_tasks != 0 && timeout > 0);
1001 if (se_rt_objs->
se !=
NULL) {
1018 if (se_rt_objs->
rep !=
NULL) {
1024 if (se_rt_objs->
dev !=
NULL) {
static void task_error_cb(struct doca_task *se_task, union doca_data task_user_data, union doca_data ctx_user_data)
static void task_get_completion_cb(struct doca_sync_event_task_get *task, union doca_data task_user_data, union doca_data ctx_user_data)
void sync_event_tear_down(struct sync_event_runtime_objects *se_rt_objs)
static doca_error_t dev_pci_addr_cb(void *param, void *config)
DOCA_LOG_REGISTER(SYNC_EVENT::COMMON)
doca_error_t sync_event_async_task_submit(struct sync_event_runtime_objects *se_rt_objs, struct doca_task *se_task)
static doca_error_t pci_addr_cb(const char *pci_addr_src, char pci_addr_dest[DOCA_DEVINFO_PCI_ADDR_SIZE])
static doca_error_t sync_event_cc_init(struct sync_event_runtime_objects *se_rt_objs)
doca_error_t sync_event_params_register(void)
static doca_error_t is_update_atomic_cb(void *param, void *config)
static void task_wait_eq_error_cb(struct doca_sync_event_task_wait_eq *task, union doca_data task_user_data, union doca_data ctx_user_data)
doca_error_t sync_event_start_async(const struct sync_event_config *se_cfg, struct sync_event_runtime_objects *se_rt_objs)
static doca_error_t async_num_tasks_cb(void *param, void *config)
doca_error_t sync_event_cc_handshake(struct sync_event_runtime_objects *se_rt_objs)
static void task_notify_add_error_cb(struct doca_sync_event_task_notify_add *task, union doca_data task_user_data, union doca_data ctx_user_data)
static void comch_send_completion_cb(struct doca_comch_task_send *task, union doca_data task_user_data, union doca_data ctx_user_data)
static void task_completion_cb(struct doca_task *se_task, union doca_data task_user_data, union doca_data ctx_user_data)
static void task_notify_set_completion_cb(struct doca_sync_event_task_notify_set *task, union doca_data task_user_data, union doca_data ctx_user_data)
static void task_notify_add_completion_cb(struct doca_sync_event_task_notify_add *task, union doca_data task_user_data, union doca_data ctx_user_data)
static void task_get_error_cb(struct doca_sync_event_task_get *task, union doca_data task_user_data, union doca_data ctx_user_data)
static void task_notify_set_error_cb(struct doca_sync_event_task_notify_set *task, union doca_data task_user_data, union doca_data ctx_user_data)
doca_error_t sync_event_config_validate(const struct sync_event_config *se_cfg, const struct sync_event_runtime_objects *se_rt_objs)
static void task_wait_eq_completion_cb(struct doca_sync_event_task_wait_eq *task, union doca_data task_user_data, union doca_data ctx_user_data)
static void comch_send_completion_err_cb(struct doca_comch_task_send *task, union doca_data task_user_data, union doca_data ctx_user_data)
static doca_error_t is_async_mode_cb(void *param, void *config)
static doca_error_t rep_pci_addr_cb(void *param, void *config)
#define SYNC_EVENT_CC_MAX_QUEUE_SIZE
#define SYNC_EVENT_CC_MAX_TASKS
#define SYNC_EVENT_CC_SERVICE_NAME
#define SYNC_EVENT_CC_MAX_MSG_SIZE
#define SYNC_EVENT_CC_TIMEOUT_SEC
DOCA_EXPERIMENTAL void doca_argp_param_set_description(struct doca_argp_param *param, const char *description)
Set the description of the program param, used during program usage.
DOCA_EXPERIMENTAL void doca_argp_param_set_long_name(struct doca_argp_param *param, const char *name)
Set the long name of the program param.
DOCA_EXPERIMENTAL void doca_argp_param_set_callback(struct doca_argp_param *param, doca_argp_param_cb_t callback)
Set the callback function of the program param.
DOCA_EXPERIMENTAL void doca_argp_param_set_mandatory(struct doca_argp_param *param)
Mark the program param as mandatory.
DOCA_EXPERIMENTAL doca_error_t doca_argp_param_create(struct doca_argp_param **param)
Create new program param.
DOCA_EXPERIMENTAL void doca_argp_param_set_type(struct doca_argp_param *param, enum doca_argp_type type)
Set the type of the param arguments.
DOCA_EXPERIMENTAL void doca_argp_param_set_short_name(struct doca_argp_param *param, const char *name)
Set the short name of the program param.
DOCA_EXPERIMENTAL doca_error_t doca_argp_register_param(struct doca_argp_param *input_param)
Register a program flag.
DOCA_STABLE doca_error_t doca_comch_client_set_max_msg_size(struct doca_comch_client *comch_client, uint32_t size)
DOCA_STABLE doca_error_t doca_comch_client_get_connection(const struct doca_comch_client *comch_client, struct doca_comch_connection **connection)
DOCA_STABLE struct doca_comch_server * doca_comch_server_get_server_ctx(const struct doca_comch_connection *connection)
DOCA_STABLE doca_error_t doca_comch_server_event_msg_recv_register(struct doca_comch_server *comch_server, doca_comch_event_msg_recv_cb_t recv_event_cb)
Configure the doca_comch recv event callback for server context.
DOCA_STABLE doca_error_t doca_comch_server_event_connection_status_changed_register(struct doca_comch_server *comch_server, doca_comch_event_connection_status_changed_cb_t connect_event_cb, doca_comch_event_connection_status_changed_cb_t disconnect_event_cb)
Configure the doca_comch recv event callback for server context.
DOCA_STABLE doca_error_t doca_comch_client_set_recv_queue_size(struct doca_comch_client *comch_client, uint32_t size)
DOCA_STABLE struct doca_ctx * doca_comch_client_as_ctx(struct doca_comch_client *comch_client)
DOCA_STABLE doca_error_t doca_comch_server_destroy(struct doca_comch_server *comch_server)
DOCA_STABLE doca_error_t doca_comch_server_task_send_set_conf(struct doca_comch_server *comch_server, doca_comch_task_send_completion_cb_t task_completion_cb, doca_comch_task_send_completion_cb_t task_error_cb, uint32_t num_send_tasks)
DOCA_STABLE doca_error_t doca_comch_client_task_send_set_conf(struct doca_comch_client *comch_client, doca_comch_task_send_completion_cb_t task_completion_cb, doca_comch_task_send_completion_cb_t task_error_cb, uint32_t num_send_tasks)
DOCA_STABLE doca_error_t doca_comch_server_set_recv_queue_size(struct doca_comch_server *comch_server, uint32_t size)
DOCA_STABLE doca_error_t doca_comch_client_event_msg_recv_register(struct doca_comch_client *comch_client, doca_comch_event_msg_recv_cb_t recv_event_cb)
Configure the doca_comch recv event callback for client context.
DOCA_STABLE doca_error_t doca_comch_client_destroy(struct doca_comch_client *comch_client)
DOCA_STABLE doca_error_t doca_comch_server_create(struct doca_dev *dev, struct doca_dev_rep *repr, const char *name, struct doca_comch_server **comch_server)
DOCA_STABLE struct doca_task * doca_comch_task_send_as_task(struct doca_comch_task_send *task)
DOCA_STABLE doca_error_t doca_comch_server_set_max_msg_size(struct doca_comch_server *comch_server, uint32_t size)
DOCA_STABLE doca_error_t doca_comch_client_create(struct doca_dev *dev, const char *name, struct doca_comch_client **comch_client)
DOCA_STABLE struct doca_ctx * doca_comch_server_as_ctx(struct doca_comch_server *comch_server)
DOCA_STABLE doca_error_t doca_ctx_start(struct doca_ctx *ctx)
Finalizes all configurations, and starts the DOCA CTX.
DOCA_STABLE doca_error_t doca_ctx_get_state(const struct doca_ctx *ctx, enum doca_ctx_states *state)
Get context state.
DOCA_STABLE doca_error_t doca_ctx_set_user_data(struct doca_ctx *ctx, union doca_data user_data)
set user data to context
DOCA_STABLE doca_error_t doca_ctx_get_num_inflight_tasks(const struct doca_ctx *ctx, size_t *num_inflight_tasks)
Get number of in flight tasks in a doca context.
DOCA_STABLE doca_error_t doca_ctx_stop(struct doca_ctx *ctx)
Stops the context allowing reconfiguration.
doca_ctx_states
This enum defines the states of a context.
DOCA_STABLE doca_error_t doca_ctx_get_user_data(const struct doca_ctx *ctx, union doca_data *user_data)
get user data from context
DOCA_STABLE doca_error_t doca_dev_rep_close(struct doca_dev_rep *dev)
Destroy allocated representor device instance.
#define DOCA_DEVINFO_PCI_ADDR_SIZE
Buffer size to hold PCI BDF format: "XXXX:XX:XX.X". Including a null terminator.
DOCA_STABLE struct doca_devinfo * doca_dev_as_devinfo(const struct doca_dev *dev)
Get local device info from device. This should be useful when wanting to query information about devi...
DOCA_STABLE doca_error_t doca_dev_close(struct doca_dev *dev)
Destroy allocated local device instance.
enum doca_error doca_error_t
DOCA API return codes.
DOCA_STABLE const char * doca_error_get_name(doca_error_t error)
Returns the string representation of an error code name.
DOCA_STABLE const char * doca_error_get_descr(doca_error_t error)
Returns the description string of an error code.
@ DOCA_ERROR_INVALID_VALUE
#define DOCA_LOG_ERR(format,...)
Generates an ERROR application log message.
#define DOCA_LOG_INFO(format,...)
Generates an INFO application log message.
DOCA_STABLE doca_error_t doca_pe_destroy(struct doca_pe *pe)
Destroy doca progress engine.
DOCA_STABLE doca_error_t doca_pe_connect_ctx(struct doca_pe *pe, struct doca_ctx *ctx)
This method connects a context to a progress engine.
DOCA_STABLE doca_error_t doca_task_submit(struct doca_task *task)
Submit a task to a progress engine.
DOCA_STABLE uint8_t doca_pe_progress(struct doca_pe *pe)
Run the progress engine.
DOCA_STABLE doca_error_t doca_pe_create(struct doca_pe **pe)
Creates DOCA progress engine.
DOCA_STABLE void doca_task_free(struct doca_task *task)
Free a task back to where it was allocated from.
DOCA_EXPERIMENTAL struct doca_task * doca_sync_event_task_notify_set_as_doca_task(struct doca_sync_event_task_notify_set *task)
Convert a DOCA Sync Event notify-set task to a DOCA Task.
DOCA_EXPERIMENTAL doca_error_t doca_sync_event_task_notify_add_set_conf(struct doca_sync_event *event, doca_sync_event_task_notify_add_completion_cb_t completion_cb, doca_sync_event_task_notify_add_completion_cb_t error_cb, uint32_t num_tasks)
Set the DOCA Sync Event notify-add task configuration.
DOCA_EXPERIMENTAL struct doca_task * doca_sync_event_task_wait_eq_as_doca_task(struct doca_sync_event_task_wait_eq *task)
Convert a DOCA Sync Event wait-equal task to a DOCA Task.
DOCA_EXPERIMENTAL doca_error_t doca_sync_event_task_get_set_conf(struct doca_sync_event *event, doca_sync_event_task_get_completion_cb_t completion_cb, doca_sync_event_task_get_completion_cb_t error_cb, uint32_t num_tasks)
Set the DOCA Sync Event get task configuration.
DOCA_EXPERIMENTAL struct doca_task * doca_sync_event_task_get_as_doca_task(struct doca_sync_event_task_get *task)
Convert a DOCA Sync Event get task to a DOCA Task.
DOCA_EXPERIMENTAL doca_error_t doca_sync_event_task_wait_eq_set_conf(struct doca_sync_event *event, doca_sync_event_task_wait_eq_completion_cb_t completion_cb, doca_sync_event_task_wait_eq_completion_cb_t error_cb, uint32_t num_tasks)
Set the DOCA Sync Event wait-equal task configuration.
DOCA_EXPERIMENTAL doca_error_t doca_sync_event_cap_task_wait_eq_is_supported(const struct doca_devinfo *devinfo)
Check if a given device supports submitting a DOCA Sync Event wait-equal task.
DOCA_EXPERIMENTAL doca_error_t doca_sync_event_task_notify_set_set_conf(struct doca_sync_event *event, doca_sync_event_task_notify_set_completion_cb_t completion_cb, doca_sync_event_task_notify_set_completion_cb_t error_cb, uint32_t num_tasks)
Set the DOCA Sync Event notify-set task configuration.
DOCA_EXPERIMENTAL doca_error_t doca_sync_event_stop(struct doca_sync_event *event)
Stop a Sync Event which has been previously started with 'doca_sync_event_start'.
DOCA_EXPERIMENTAL struct doca_ctx * doca_sync_event_as_ctx(struct doca_sync_event *event)
Convert a Sync Event to a DOCA context.
DOCA_EXPERIMENTAL struct doca_task * doca_sync_event_task_notify_add_as_doca_task(struct doca_sync_event_task_notify_add *task)
Convert a DOCA Sync Event notify-add task to a DOCA Task.
DOCA_EXPERIMENTAL doca_error_t doca_sync_event_destroy(struct doca_sync_event *event)
Destroy a Sync Event instance.
struct doca_comch_connection * comch_connection
doca_error_t se_task_result
struct doca_comch_server * server
struct doca_pe * comch_pe
doca_comch_event_msg_recv_cb_t comch_recv_event_cb
struct doca_comch_client * client
struct doca_sync_event * se
struct doca_dev_rep * rep
Convenience type for representing opaque data.