109 uint8_t *recv_buffer,
111 struct doca_comch_connection *comch_connection)
119 DOCA_LOG_INFO(
"Message received: '%.*s'", (
int)msg_len, recv_buffer);
132 struct doca_comch_task_send *task;
133 struct doca_task *task_obj;
134 struct doca_comch_connection *connection;
137 const char *text = sample_objects->
text;
138 size_t msg_len = sample_objects->
text_len;
146 user_data.
ptr = (
void *)sample_objects;
182 sample_objects->
pe =
NULL;
202 struct doca_ctx *
ctx,
211 switch (next_state) {
215 sample_objects->
finish =
true;
221 DOCA_LOG_INFO(
"CC client context entered into starting state. Waiting for connection establishment");
224 DOCA_LOG_INFO(
"CC client context is running. Sending message");
227 DOCA_LOG_ERR(
"Failed to submit send task with error = %s",
237 DOCA_LOG_INFO(
"CC client context entered into stopping state. Waiting for connection termination");
253 const char *dev_pci_addr,
260 .data_path_mode =
false,
261 .new_consumer_cb =
NULL,
262 .expired_consumer_cb =
NULL,
263 .ctx_user_data = sample_objects,
269 DOCA_LOG_ERR(
"Failed to open Comm Channel DOCA device based on PCI address");
276 &(sample_objects->
client),
277 &(sample_objects->
pe));
297 const char *dev_pci_addr,
299 const uint32_t text_len)
303 uint32_t max_msg_size;
305 struct timespec ts = {
324 if (text_len > max_msg_size) {
326 "Failed to run sample, text size is larger than supported message size. text_len = %u, supported message size = %u",
332 sample_objects.
text = text;
334 sample_objects.
finish =
false;
336 while (!sample_objects.
finish) {
342 return sample_objects.
result;
DOCA_LOG_REGISTER(COMCH_CTRL_PATH_CLIENT)
static void send_task_completion_callback(struct doca_comch_task_send *task, union doca_data task_user_data, union doca_data ctx_user_data)
static void send_task_completion_err_callback(struct doca_comch_task_send *task, union doca_data task_user_data, union doca_data ctx_user_data)
static void clean_comch_sample_objects(struct comch_ctrl_path_objects *sample_objects)
static doca_error_t init_comch_ctrl_path_objects(const char *server_name, const char *dev_pci_addr, struct comch_ctrl_path_objects *sample_objects)
static doca_error_t client_send_ping_pong(struct comch_ctrl_path_objects *sample_objects)
static void comch_client_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 message_recv_callback(struct doca_comch_event_msg_recv *event, uint8_t *recv_buffer, uint32_t msg_len, struct doca_comch_connection *comch_connection)
doca_error_t start_comch_ctrl_path_client_sample(const char *server_name, const char *dev_pci_addr, const char *text, const uint32_t text_len)
doca_error_t init_comch_ctrl_path_client(const char *server_name, struct doca_dev *hw_dev, struct comch_ctrl_path_client_cb_config *cb_cfg, struct doca_comch_client **client, struct doca_pe **pe)
void clean_comch_ctrl_path_client(struct doca_comch_client *client, struct doca_pe *pe)
static doca_error_t open_doca_device_with_pci(const char *pcie_value, struct doca_dev **retval)
DOCA_STABLE doca_error_t doca_comch_client_get_connection(const struct doca_comch_client *comch_client, struct doca_comch_connection **connection)
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_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 struct doca_task * doca_comch_task_send_as_task(struct doca_comch_task_send *task)
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_CTX_STATE_STARTING
@ DOCA_CTX_STATE_STOPPING
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_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_task_get_status(const struct doca_task *task)
Get task status.
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 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_comch_client * client
Convenience type for representing opaque data.
struct upf_accel_ctx * ctx