83 local->
mem = (
char *)malloc(max_bufs * buf_len);
153 if (producer !=
NULL) {
168 struct doca_comch_producer **producer,
172 struct doca_ctx *
ctx;
192 goto destroy_producer;
198 goto destroy_producer;
202 cfg->send_task_comp_cb,
203 cfg->send_task_comp_err_cb,
207 goto destroy_producer;
210 user_data.
ptr =
cfg->ctx_user_data;
214 goto destroy_producer;
220 goto destroy_producer;
238 if (consumer !=
NULL) {
241 DOCA_LOG_ERR(
"Failed to destroy consumer properly with error = %s",
253 struct doca_mmap *user_mmap,
255 struct doca_comch_consumer **consumer,
259 struct doca_ctx *
ctx;
279 goto destroy_consumer;
285 goto destroy_consumer;
289 cfg->recv_task_comp_cb,
290 cfg->recv_task_comp_err_cb,
294 goto destroy_consumer;
297 user_data.
ptr =
cfg->ctx_user_data;
301 goto destroy_consumer;
307 goto destroy_consumer;
333 const struct doca_buf *buf;
335 (void)task_user_data;
359 const struct doca_buf *buf;
361 (void)task_user_data;
365 DOCA_LOG_ERR(
"Producer message failed to send with error = %s",
382 struct doca_comch_producer_task_send *producer_task;
383 struct doca_buf *buf;
384 struct doca_task *task_obj;
387 struct timespec ts = {
394 (
void *)(data_path->
text),
439 struct doca_ctx *
ctx,
448 switch (next_state) {
458 DOCA_LOG_INFO(
"CC producer context entered into starting state");
461 DOCA_LOG_INFO(
"CC producer context is running. Posting message to consumer, waiting finish");
464 DOCA_LOG_ERR(
"Failed to submit producer send task with error = %s",
474 DOCA_LOG_INFO(
"CC producer context entered into stopping state");
495 struct doca_buf *buf;
497 (void)task_user_data;
505 DOCA_LOG_ERR(
"Failed to get data address from DOCA buf with error = %s",
512 DOCA_LOG_ERR(
"Failed to get data length from DOCA buf with error = %s",
536 struct doca_buf *buf;
538 (void)task_user_data;
542 DOCA_LOG_ERR(
"Consumer failed to recv message with error = %s",
559 struct doca_comch_consumer_task_post_recv *consumer_task;
560 struct doca_buf *buf;
561 struct doca_task *task_obj;
602 struct doca_ctx *
ctx,
611 switch (next_state) {
627 "CC consumer context entered into starting state. Waiting consumer producer negotiation finish");
630 DOCA_LOG_INFO(
"CC consumer context is running. Receiving message from producer, waiting finish");
633 DOCA_LOG_ERR(
"Failed to submit consumer recv task with error = %s",
643 DOCA_LOG_INFO(
"CC consumer context entered into stopping state");
654 struct timespec ts = {
659 .send_task_comp_err_cb =
661 .ctx_user_data = data_path,
677 pmem->
mem = (
void *)data_path->
text;
713 struct timespec ts = {
718 .recv_task_comp_err_cb =
720 .ctx_user_data = data_path,
doca_error_t init_comch_producer(struct doca_comch_connection *connection, struct comch_producer_cb_config *cfg, struct doca_comch_producer **producer, struct doca_pe **pe)
void clean_comch_producer(struct doca_comch_producer *producer, struct doca_pe *pe)
doca_error_t init_local_mem_bufs(struct local_mem_bufs *local, struct doca_dev *dev, size_t buf_len, size_t max_bufs)
static void producer_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 producer_send_task_completion_err_callback(struct doca_comch_producer_task_send *task, union doca_data task_user_data, union doca_data ctx_user_data)
static doca_error_t consumer_recv_msg(struct comch_data_path_objects *data_path)
static void producer_send_task_completion_callback(struct doca_comch_producer_task_send *task, union doca_data task_user_data, union doca_data ctx_user_data)
static void consumer_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 doca_error_t producer_send_msg(struct comch_data_path_objects *data_path)
DOCA_LOG_REGISTER(COMCH_DATA_PATH_HIGH_SPEED_COMMON)
static void consumer_recv_task_completion_err_callback(struct doca_comch_consumer_task_post_recv *task, union doca_data task_user_data, union doca_data ctx_user_data)
void clean_comch_consumer(struct doca_comch_consumer *consumer, struct doca_pe *pe)
void clean_local_mem_bufs(struct local_mem_bufs *local)
doca_error_t comch_data_path_send_msg(struct comch_data_path_objects *data_path)
doca_error_t init_comch_consumer(struct doca_comch_connection *connection, struct doca_mmap *user_mmap, struct comch_consumer_cb_config *cfg, struct doca_comch_consumer **consumer, struct doca_pe **pe)
static void consumer_recv_task_completion_callback(struct doca_comch_consumer_task_post_recv *task, union doca_data task_user_data, union doca_data ctx_user_data)
doca_error_t comch_data_path_recv_msg(struct comch_data_path_objects *data_path)
#define CC_DATA_PATH_TASK_NUM
#define CC_DATA_PATH_MAX_MSG_SIZE
#define INVALID_CONSUMER_ID
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)
static struct doca_pe * pe
DOCA_STABLE doca_error_t doca_buf_inventory_destroy(struct doca_buf_inventory *inventory)
Destroy buffer inventory structure.
static doca_error_t doca_buf_inventory_buf_get_by_addr(struct doca_buf_inventory *inventory, struct doca_mmap *mmap, void *addr, size_t len, struct doca_buf **buf)
Allocate single element from buffer inventory and point it to the buffer defined by addr & len argume...
static doca_error_t doca_buf_inventory_buf_get_by_data(struct doca_buf_inventory *inventory, struct doca_mmap *mmap, void *data, size_t data_len, struct doca_buf **buf)
Allocate single element from buffer inventory and point it to the buffer defined by data & data_len a...
DOCA_STABLE doca_error_t doca_buf_inventory_start(struct doca_buf_inventory *inventory)
Start element retrieval from inventory.
DOCA_STABLE doca_error_t doca_buf_inventory_create(size_t num_elements, struct doca_buf_inventory **inventory)
Allocates buffer inventory with default/unset attributes.
DOCA_STABLE doca_error_t doca_buf_dec_refcount(struct doca_buf *buf, uint16_t *refcount)
Decrease the object reference count by 1, if 0 reached, return the element back to the inventory.
DOCA_STABLE doca_error_t doca_buf_get_data(const struct doca_buf *buf, void **data)
Get the buffer's data.
DOCA_STABLE doca_error_t doca_buf_get_data_len(const struct doca_buf *buf, size_t *data_len)
Get buffer's data length.
DOCA_STABLE struct doca_buf * doca_comch_consumer_task_post_recv_get_buf(const struct doca_comch_consumer_task_post_recv *task)
DOCA_STABLE doca_error_t doca_comch_consumer_create(struct doca_comch_connection *comch_connection, struct doca_mmap *buf_mmap, struct doca_comch_consumer **consumer)
DOCA_STABLE doca_error_t doca_comch_consumer_destroy(struct doca_comch_consumer *consumer)
DOCA_STABLE doca_error_t doca_comch_consumer_task_post_recv_set_conf(struct doca_comch_consumer *consumer, doca_comch_consumer_task_post_recv_completion_cb_t task_completion_cb, doca_comch_consumer_task_post_recv_completion_cb_t task_error_cb, uint32_t num_post_recv_tasks)
DOCA_STABLE doca_error_t doca_comch_consumer_task_post_recv_alloc_init(struct doca_comch_consumer *consumer, struct doca_buf *buf, struct doca_comch_consumer_task_post_recv **task)
Allocate and initialize a doca_consumer post receive task.
DOCA_STABLE struct doca_ctx * doca_comch_consumer_as_ctx(struct doca_comch_consumer *consumer)
DOCA_STABLE struct doca_task * doca_comch_consumer_task_post_recv_as_task(struct doca_comch_consumer_task_post_recv *task)
DOCA_STABLE doca_error_t doca_comch_producer_create(struct doca_comch_connection *comch_connection, struct doca_comch_producer **producer)
DOCA_STABLE const struct doca_buf * doca_comch_producer_task_send_get_buf(const struct doca_comch_producer_task_send *task)
DOCA_STABLE struct doca_task * doca_comch_producer_task_send_as_task(struct doca_comch_producer_task_send *task)
DOCA_STABLE doca_error_t doca_comch_producer_task_send_set_conf(struct doca_comch_producer *producer, doca_comch_producer_task_send_completion_cb_t task_completion_cb, doca_comch_producer_task_send_completion_cb_t task_error_cb, uint32_t num_send_tasks)
DOCA_STABLE doca_error_t doca_comch_producer_destroy(struct doca_comch_producer *producer)
DOCA_STABLE struct doca_ctx * doca_comch_producer_as_ctx(struct doca_comch_producer *producer)
DOCA_STABLE doca_error_t doca_comch_producer_task_send_alloc_init(struct doca_comch_producer *producer, const struct doca_buf *buf, uint8_t *imm_data, uint32_t imm_data_len, uint32_t consumer_id, struct doca_comch_producer_task_send **task)
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_set_state_changed_cb(struct doca_ctx *ctx, doca_ctx_state_changed_callback_t cb)
Set state changed callback.
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_CTX_STATE_STARTING
@ DOCA_CTX_STATE_STOPPING
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.
#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_mmap_set_memrange(struct doca_mmap *mmap, void *addr, size_t len)
Set the memory range of DOCA memory map.
DOCA_STABLE doca_error_t doca_mmap_destroy(struct doca_mmap *mmap)
Destroy DOCA Memory Map structure.
DOCA_STABLE doca_error_t doca_mmap_create(struct doca_mmap **mmap)
Allocates zero size memory map object with default/unset attributes.
DOCA_STABLE doca_error_t doca_mmap_set_permissions(struct doca_mmap *mmap, uint32_t access_mask)
Set access flags of the registered memory.
DOCA_STABLE doca_error_t doca_mmap_start(struct doca_mmap *mmap)
Start DOCA Memory Map.
DOCA_STABLE doca_error_t doca_mmap_get_memrange(const struct doca_mmap *mmap, void **addr, size_t *len)
Get the memory range of DOCA memory map.
DOCA_STABLE doca_error_t doca_mmap_add_dev(struct doca_mmap *mmap, struct doca_dev *dev)
Register DOCA memory map on a given device.
DOCA_STABLE doca_error_t doca_pe_destroy(struct doca_pe *pe)
Destroy doca progress engine.
DOCA_STABLE doca_error_t doca_task_get_status(const struct doca_task *task)
Get task status.
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_ACCESS_FLAG_PCI_READ_WRITE
const struct ip_frag_config * cfg
doca_comch_consumer_task_post_recv_completion_cb_t recv_task_comp_cb
struct local_mem_bufs consumer_mem
struct local_mem_bufs producer_mem
uint32_t remote_consumer_id
struct doca_comch_consumer * consumer
struct doca_comch_producer * producer
struct doca_comch_connection * connection
doca_error_t consumer_result
doca_error_t producer_result
struct doca_pe * producer_pe
struct doca_pe * consumer_pe
doca_comch_producer_task_send_completion_cb_t send_task_comp_cb
struct doca_buf_inventory * buf_inv
Convenience type for representing opaque data.
struct upf_accel_ctx * ctx