39 #define COMCH_NUM_TASKS 1024
40 #define SLEEP_IN_NANOS (10 * 1000)
105 struct doca_comch_connection *comch_connection,
106 uint8_t change_successful)
115 if (change_successful == 0) {
128 DOCA_LOG_ERR(
"Failed to get configuration from server context");
133 DOCA_LOG_ERR(
"A connection already exists on the server - rejecting new attempt");
159 struct doca_comch_connection *comch_connection,
160 uint8_t change_successful)
168 (void)change_successful;
198 if (connection ==
NULL) {
207 DOCA_LOG_ERR(
"Failed to get user data from connection");
215 struct doca_comch_task_send *task;
297 const char *pci_addr,
298 const char *rep_pci_addr,
308 struct timespec ts = {
314 if (server_name ==
NULL) {
319 if (pci_addr ==
NULL) {
330 if (rep_pci_addr ==
NULL) {
336 DOCA_LOG_ERR(
"Init: server recv event callback is NULL");
341 DOCA_LOG_ERR(
"Init: server recv event callback is NULL");
356 cfg->app_user_data = user_data;
357 comch_user_data.
ptr =
cfg;
362 goto destroy_comch_cfg;
367 DOCA_LOG_ERR(
"Failed to open Comm Channel DOCA device based on PCI address: %s",
378 if (
cfg->is_server) {
390 DOCA_LOG_ERR(
"Failed to open Comm Channel DOCA device representor based on PCI address: %s",
398 goto close_rep_device;
404 goto destroy_comch_ep;
411 DOCA_LOG_ERR(
"Failed to connect comch server context to progress engine: %s",
413 goto destroy_comch_ep;
422 goto destroy_comch_ep;
427 DOCA_LOG_ERR(
"Failed to register comch server receive event callback: %s",
429 goto destroy_comch_ep;
436 DOCA_LOG_ERR(
"Failed to register comch server event callback: %s",
438 goto destroy_comch_ep;
442 if (new_consumer_event_cb !=
NULL || expired_consumer_event_cb !=
NULL) {
445 new_consumer_event_cb,
446 expired_consumer_event_cb);
448 DOCA_LOG_ERR(
"Failed to register comch server consumer callback: %s",
450 goto destroy_comch_ep;
461 goto destroy_comch_ep;
467 while (
cfg->active_connection ==
NULL) {
490 goto destroy_comch_ep;
497 DOCA_LOG_ERR(
"Failed to connect comch client context to progress engine: %s",
499 goto destroy_comch_ep;
508 goto destroy_comch_ep;
513 DOCA_LOG_ERR(
"Failed to register comch client receive event callback: %s",
515 goto destroy_comch_ep;
519 if (new_consumer_event_cb !=
NULL || expired_consumer_event_cb !=
NULL) {
522 new_consumer_event_cb,
523 expired_consumer_event_cb);
525 DOCA_LOG_ERR(
"Failed to register comch client consumer callback: %s",
527 goto destroy_comch_ep;
536 goto destroy_comch_ep;
574 const char *pci_addr,
575 const char *rep_pci_addr,
595 struct timespec ts = {
void * comch_utils_get_user_data(struct doca_comch_connection *connection)
static void comch_send_completion_err(struct doca_comch_task_send *task, union doca_data task_user_data, union doca_data ctx_user_data)
doca_error_t comch_utils_fast_path_init(const char *server_name, const char *pci_addr, const char *rep_pci_addr, void *user_data, doca_comch_event_msg_recv_cb_t client_recv_event_cb, doca_comch_event_msg_recv_cb_t server_recv_event_cb, doca_comch_event_consumer_cb_t new_consumer_event_cb, doca_comch_event_consumer_cb_t expired_consumer_event_cb, struct comch_cfg **comch_cfg)
doca_error_t comch_utils_progress_connection(struct doca_comch_connection *connection)
doca_error_t comch_utils_destroy(struct comch_cfg *comch_cfg)
struct doca_comch_connection * comch_util_get_connection(struct comch_cfg *comch_cfg)
DOCA_LOG_REGISTER(COMCH_UTILS)
static void server_connection_cb(struct doca_comch_event_connection_status_changed *event, struct doca_comch_connection *comch_connection, uint8_t change_successful)
static struct comch_cfg * get_comch_cfg_from_connection(struct doca_comch_connection *connection)
doca_error_t comch_utils_init(const char *server_name, const char *pci_addr, const char *rep_pci_addr, void *user_data, doca_comch_event_msg_recv_cb_t client_recv_event_cb, doca_comch_event_msg_recv_cb_t server_recv_event_cb, struct comch_cfg **comch_cfg)
static void server_disconnection_cb(struct doca_comch_event_connection_status_changed *event, struct doca_comch_connection *comch_connection, uint8_t change_successful)
doca_error_t comch_utils_send(struct doca_comch_connection *connection, const void *msg, uint32_t len)
uint32_t comch_utils_get_max_buffer_size(struct comch_cfg *comch_cfg)
static void comch_send_completion(struct doca_comch_task_send *task, union doca_data task_user_data, union doca_data ctx_user_data)
doca_error_t open_doca_device_rep_with_pci(struct doca_dev *local, enum doca_devinfo_rep_filter filter, const char *pci_addr, struct doca_dev_rep **retval)
static doca_error_t open_doca_device_with_pci(const char *pcie_value, struct doca_dev **retval)
if(bitoffset % 64+bitlength > 64) result|
void server_recv_event_cb(struct doca_comch_event_msg_recv *event, uint8_t *recv_buffer, uint32_t msg_len, struct doca_comch_connection *comch_connection)
void client_recv_event_cb(struct doca_comch_event_msg_recv *event, uint8_t *recv_buffer, uint32_t msg_len, struct doca_comch_connection *comch_connection)
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_event_consumer_register(struct doca_comch_client *comch_client, doca_comch_event_consumer_cb_t new_consumer_event_cb, doca_comch_event_consumer_cb_t expired_consumer_event_cb)
Configure the doca_comch callback for for receiving consumer events on client context.
DOCA_STABLE doca_error_t doca_comch_connection_set_user_data(struct doca_comch_connection *connection, union doca_data user_data)
DOCA_STABLE union doca_data doca_comch_connection_get_user_data(const struct doca_comch_connection *connection)
DOCA_STABLE struct doca_ctx * doca_comch_client_as_ctx(struct doca_comch_client *comch_client)
DOCA_STABLE doca_error_t doca_comch_server_event_consumer_register(struct doca_comch_server *comch_server, doca_comch_event_consumer_cb_t new_consumer_event_cb, doca_comch_event_consumer_cb_t expired_consumer_event_cb)
Configure the doca_comch callback for for receiving consumer events on server context.
void(* doca_comch_event_consumer_cb_t)(struct doca_comch_event_consumer *event, struct doca_comch_connection *comch_connection, uint32_t id)
DOCA_STABLE doca_error_t doca_comch_client_task_send_alloc_init(struct doca_comch_client *comch_client, struct doca_comch_connection *peer, const void *msg, uint32_t len, struct doca_comch_task_send **task)
DOCA_STABLE doca_error_t doca_comch_cap_get_max_msg_size(const struct doca_devinfo *devinfo, uint32_t *size)
DOCA_STABLE doca_error_t doca_comch_server_destroy(struct doca_comch_server *comch_server)
DOCA_STABLE doca_error_t doca_comch_cap_client_is_supported(const struct doca_devinfo *devinfo)
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_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.
void(* doca_comch_event_msg_recv_cb_t)(struct doca_comch_event_msg_recv *event, uint8_t *recv_buffer, uint32_t msg_len, struct doca_comch_connection *comch_connection)
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_cap_server_is_supported(const struct doca_devinfo *devinfo)
DOCA_STABLE doca_error_t doca_comch_client_create(struct doca_dev *dev, const char *name, struct doca_comch_client **comch_client)
DOCA_STABLE doca_error_t doca_comch_server_task_send_alloc_init(struct doca_comch_server *comch_server, struct doca_comch_connection *peer, const void *msg, uint32_t len, struct doca_comch_task_send **task)
DOCA_STABLE struct doca_ctx * doca_comch_server_as_ctx(struct doca_comch_server *comch_server)
DOCA_STABLE doca_error_t doca_comch_server_disconnect(struct doca_comch_server *comch_server, struct doca_comch_connection *connection)
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_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.
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.
@ DOCA_DEVINFO_REP_FILTER_NET
enum doca_error doca_error_t
DOCA API return codes.
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.
#define DOCA_LOG_TRC(format,...)
Generates a TRACE 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.
const struct ip_frag_config * cfg
struct doca_dev_rep * dev_rep
struct doca_comch_connection * active_connection
struct doca_comch_client * client
struct doca_comch_server * server
Convenience type for representing opaque data.