32 #include "rdma_common.h"
36 #define EXAMPLE_SET_VALUE (0xD0CA)
144 cfg->local_connection_desc_path,
145 cfg->remote_resource_desc_path);
150 DOCA_LOG_INFO(
"Please copy %s from the requester and then press enter",
cfg->remote_connection_desc_path);
200 DOCA_LOG_ERR(
"Failed to write and read connection details from the requester: %s",
214 DOCA_LOG_ERR(
"Failed to connect the responder's DOCA RDMA to the requester's DOCA RDMA: %s",
232 DOCA_LOG_INFO(
"Waiting for sync event to be signaled from remote");
235 DOCA_LOG_ERR(
"Waiting for sync event to be signaled from remote failed");
246 DOCA_LOG_INFO(
"Waiting for sync event to be notified for completion");
249 DOCA_LOG_ERR(
"Waiting for sync event to be notified for completion failed");
300 struct doca_ctx *
ctx,
309 switch (next_state) {
318 DOCA_LOG_ERR(
"rdma_sync_event_responder_export_and_connect() failed: %s",
340 DOCA_LOG_INFO(
"RDMA context entered into stopping state. Any inflight tasks will be flushed");
373 struct timespec ts = {
394 goto destroy_sync_event_resources;
402 goto destroy_sync_event_resources;
405 if (
cfg->use_rdma_cm ==
true) {
414 DOCA_LOG_ERR(
"Failed to config RDMA CM callbacks and negotiation functions: %s",
416 goto destroy_sync_event_resources;
424 goto destroy_sync_event_resources;
447 destroy_sync_event_resources:
doca_error_t request_stop_ctx(struct doca_pe *pe, struct doca_ctx *ctx)
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.
#define DOCA_LOG_ERR(format,...)
Generates an ERROR application log message.
#define DOCA_LOG_INFO(format,...)
Generates an INFO application log message.
DOCA_STABLE uint8_t doca_pe_progress(struct doca_pe *pe)
Run the progress engine.
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_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_TRANSPORT_TYPE_DC
DOCA_EXPERIMENTAL doca_error_t doca_sync_event_start(struct doca_sync_event *event)
Start a Sync Event to be operate as stand-alone DOCA Core object only.
DOCA_EXPERIMENTAL doca_error_t doca_sync_event_create(struct doca_sync_event **event)
Create a Sync Event handle.
DOCA_EXPERIMENTAL doca_error_t doca_sync_event_update_set(struct doca_sync_event *event, uint64_t value)
Set the value of a Sync Event to some value synchronously.
DOCA_EXPERIMENTAL doca_error_t doca_sync_event_wait_gt(struct doca_sync_event *event, uint64_t value, uint64_t mask)
Wait for the value of a Sync Event to be grater than some threshold value synchronously in a polling ...
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 doca_error_t doca_sync_event_add_publisher_location_remote_net(struct doca_sync_event *event)
Declare Sync Event publisher as a remote peer.
DOCA_EXPERIMENTAL doca_error_t doca_sync_event_add_subscriber_location_cpu(struct doca_sync_event *event, struct doca_dev *dev)
DOCA_EXPERIMENTAL doca_error_t doca_sync_event_destroy(struct doca_sync_event *event)
Destroy a Sync Event instance.
DOCA_EXPERIMENTAL doca_error_t doca_sync_event_export_to_remote_net(struct doca_sync_event *event, const uint8_t **data, size_t *sz)
Export Sync Event to be shared with a remote peer.
@ DOCA_ACCESS_FLAG_LOCAL_READ_WRITE
@ DOCA_ACCESS_FLAG_RDMA_READ
@ DOCA_ACCESS_FLAG_RDMA_WRITE
const struct ip_frag_config * cfg
doca_error_t rdma_sync_event_responder(struct rdma_config *cfg)
DOCA_LOG_REGISTER(RDMA_READ_RESPONDER::SAMPLE)
doca_error_t rdma_sync_event_responder_destroy_sync_event_resources(struct rdma_resources *resources)
static void rdma_sync_event_responder_state_change_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 responder_wait_for_requester_finish(struct rdma_resources *resources)
static doca_error_t write_read_connection(struct rdma_config *cfg, struct rdma_resources *resources)
static doca_error_t rdma_sync_event_responder_export_and_connect(struct rdma_resources *resources)
static doca_error_t rdma_sync_event_responder_handle_event(struct doca_sync_event *sync_event)
doca_error_t rdma_sync_event_responder_allocate_sync_event_resources(struct rdma_resources *resources)
#define EXAMPLE_SET_VALUE
enum doca_rdma_transport_type transport_type
struct doca_sync_event * sync_event
size_t remote_rdma_conn_descriptor_size
doca_error_t first_encountered_error
struct doca_ctx * rdma_ctx
size_t sync_event_descriptor_size
prepare_and_submit_task_fn task_fn
const void * rdma_conn_descriptor
bool recv_sync_event_desc
void * remote_rdma_conn_descriptor
struct doca_rdma_connection * connections[MAX_NUM_CONNECTIONS]
struct doca_dev * doca_device
struct doca_buf_inventory * buf_inventory
size_t rdma_conn_descriptor_size
void * sync_event_descriptor
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)