30 #include "rdma_common.h"
32 #define MAX_BUFF_SIZE (256)
33 #define EXPECTED_IMMEDIATE_VALUE (0xABCD)
69 cfg->local_connection_desc_path,
70 cfg->remote_resource_desc_path);
75 DOCA_LOG_INFO(
"Please copy %s from the receiver and then press enter",
cfg->remote_connection_desc_path);
123 "RDMA receive task failed: immediate value that was received isn't the expected immediate value");
142 DOCA_LOG_INFO(
"Requester has written: \"%s\" with immediate data: %u", (
char *)buffer, immediate_data);
226 DOCA_LOG_ERR(
"Failed to write and read connection details from the requester: %s",
240 DOCA_LOG_ERR(
"Failed to connect the responder's RDMA to the requester's RDMA: %s",
254 struct doca_rdma_task_receive *rdma_receive_task =
NULL;
297 struct doca_ctx *
ctx,
307 switch (next_state) {
316 DOCA_LOG_ERR(
"rdma_write_immediate_export_and_connect() failed: %s",
322 if (
cfg->use_rdma_cm ==
true)
337 DOCA_LOG_INFO(
"RDMA context entered into stopping state. Any inflight tasks will be flushed");
368 struct timespec ts = {
391 goto destroy_resources;
397 goto destroy_resources;
405 goto destroy_resources;
408 if (
cfg->use_rdma_cm ==
true) {
416 DOCA_LOG_ERR(
"Failed to config RDMA CM callbacks and negotiation functions: %s",
418 goto destroy_resources;
426 goto destroy_resources;
doca_error_t destroy_rdma_resources(struct rdma_resources *resources)
void wait_for_enter(void)
doca_error_t write_file(const char *file_path, const char *string, size_t string_len)
doca_error_t rdma_cm_connect(struct rdma_resources *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)
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_cm_disconnect(struct rdma_resources *resources)
struct rdma_resources resources
DOCA_STABLE doca_error_t doca_buf_inventory_destroy(struct doca_buf_inventory *inventory)
Destroy buffer inventory structure.
DOCA_STABLE doca_error_t doca_buf_inventory_stop(struct doca_buf_inventory *inventory)
Stop element retrieval from inventory.
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
#define DOCA_ERROR_PROPAGATE(r, t)
Save the first encountered doca_error_t.
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.
DOCA_STABLE doca_error_t doca_mmap_export_rdma(struct doca_mmap *mmap, const struct doca_dev *dev, const void **export_desc, size_t *export_desc_len)
Compose memory map representation for later import with doca_mmap_create_from_export() for one of the...
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.
DOCA_EXPERIMENTAL doca_be32_t doca_rdma_task_receive_get_result_immediate_data(const struct doca_rdma_task_receive *task)
This method gets the immediate data received by the task.
DOCA_EXPERIMENTAL enum doca_rdma_opcode doca_rdma_task_receive_get_result_opcode(const struct doca_rdma_task_receive *task)
This method gets the opcode of the operation executed by the peer and received by the task.
DOCA_EXPERIMENTAL struct doca_task * doca_rdma_task_receive_as_task(struct doca_rdma_task_receive *task)
This method converts a receive task to a doca_task.
DOCA_EXPERIMENTAL doca_error_t doca_rdma_task_receive_set_conf(struct doca_rdma *rdma, doca_rdma_task_receive_completion_cb_t successful_task_completion_cb, doca_rdma_task_receive_completion_cb_t error_task_completion_cb, uint32_t num_tasks)
This method sets the receive tasks configuration.
DOCA_EXPERIMENTAL doca_error_t doca_rdma_task_receive_allocate_init(struct doca_rdma *rdma, struct doca_buf *dst_buf, union doca_data user_data, struct doca_rdma_task_receive **task)
This method allocates and initializes a receive task.
DOCA_EXPERIMENTAL doca_error_t doca_rdma_export(struct doca_rdma *rdma, const void **local_rdma_conn_details, size_t *local_rdma_conn_details_size, struct doca_rdma_connection **rdma_connection)
Export doca_rdma connection details object The doca_rdma_conn_details are used in doca_rdma_connect()...
DOCA_EXPERIMENTAL doca_error_t doca_rdma_cap_task_receive_is_supported(const struct doca_devinfo *devinfo)
DOCA_EXPERIMENTAL doca_error_t doca_rdma_connect(struct doca_rdma *rdma, const void *remote_rdma_conn_details, size_t remote_rdma_conn_details_size, struct doca_rdma_connection *rdma_connection)
Connect to remote doca_rdma peer. Can only be called when the ctx is in DOCA_CTX_STATE_STARTING state...
@ DOCA_RDMA_OPCODE_RECV_WRITE_WITH_IMM
@ DOCA_RDMA_TRANSPORT_TYPE_DC
@ DOCA_ACCESS_FLAG_LOCAL_READ_WRITE
@ DOCA_ACCESS_FLAG_RDMA_WRITE
const struct ip_frag_config * cfg
enum doca_rdma_transport_type transport_type
size_t remote_rdma_conn_descriptor_size
doca_error_t first_encountered_error
struct doca_ctx * rdma_ctx
const void * mmap_descriptor
size_t num_remaining_tasks
prepare_and_submit_task_fn task_fn
const void * rdma_conn_descriptor
void * remote_rdma_conn_descriptor
struct doca_rdma_connection * connections[MAX_NUM_CONNECTIONS]
size_t mmap_descriptor_size
struct doca_dev * doca_device
struct doca_buf_inventory * buf_inventory
size_t rdma_conn_descriptor_size
Convenience type for representing opaque data.
struct upf_accel_ctx * ctx
doca_error_t read_file(char const *path, char **out_bytes, size_t *out_bytes_len)