NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
rdma_multi_conn_receive_sample.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2024 NVIDIA CORPORATION AND AFFILIATES. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without modification, are permitted
5  * provided that the following conditions are met:
6  * * Redistributions of source code must retain the above copyright notice, this list of
7  * conditions and the following disclaimer.
8  * * Redistributions in binary form must reproduce the above copyright notice, this list of
9  * conditions and the following disclaimer in the documentation and/or other materials
10  * provided with the distribution.
11  * * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
12  * to endorse or promote products derived from this software without specific prior written
13  * permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
17  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
19  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
21  * STRICT LIABILITY, OR TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  *
24  */
25 
26 #include <doca_error.h>
27 #include <doca_log.h>
28 #include <doca_buf_inventory.h>
29 #include <doca_buf.h>
30 #include <doca_ctx.h>
31 #include <doca_argp.h>
32 
33 #include "rdma_common.h"
34 
35 #define MAX_BUFF_SIZE (256) /* Maximum DOCA buffer size */
36 
37 DOCA_LOG_REGISTER(RDMA_MULTI_CONN_RECEIVE::SAMPLE);
38 
39 /*
40  * Write the connection details for the sender to read, and read the connection details of the sender
41  * To differentiate each local and remote connection details, we append the connection_id so the file-name
42  * follows the syntax <local/remote>_connection_desc_path.txt-<connection_id>
43  *
44  * @cfg [in]: Configuration parameters
45  * @resources [in/out]: RDMA resources
46  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
47  */
49  struct rdma_resources *resources,
50  uint32_t connection_id)
51 {
53  char tmp_file_path[MAX_ARG_SIZE * 2];
54 
55  /* Write the RDMA connection details */
56  memset(tmp_file_path, 0, sizeof(tmp_file_path));
57  sprintf(tmp_file_path, "%s-%04u", cfg->local_connection_desc_path, connection_id);
58  result = write_file(tmp_file_path,
61  if (result != DOCA_SUCCESS) {
62  DOCA_LOG_ERR("Failed to write the RDMA connection details: %s", doca_error_get_descr(result));
63  return result;
64  }
65 
66  DOCA_LOG_INFO("You can now copy %s to the sender", tmp_file_path);
67 
68  memset(tmp_file_path, 0, sizeof(tmp_file_path));
69  sprintf(tmp_file_path, "%s-%04u", cfg->remote_connection_desc_path, connection_id);
70  DOCA_LOG_INFO("Please copy %s from the sender and then press enter", tmp_file_path);
71 
72  /* Wait for enter */
74 
75  /* Read the remote RDMA connection details */
76  result = read_file(tmp_file_path,
79  if (result != DOCA_SUCCESS)
80  DOCA_LOG_ERR("Failed to read the remote RDMA connection details: %s", doca_error_get_descr(result));
81 
82  return result;
83 }
84 
85 /*
86  * RDMA receive task completed callback
87  *
88  * @rdma_receive_task [in]: Completed task
89  * @task_user_data [in]: doca_data from the task
90  * @ctx_user_data [in]: doca_data from the context
91  */
92 static void rdma_multi_conn_receive_completed_callback(struct doca_rdma_task_receive *rdma_receive_task,
93  union doca_data task_user_data,
94  union doca_data ctx_user_data)
95 {
96  struct rdma_resources *resources = (struct rdma_resources *)ctx_user_data.ptr;
97  void *dst_buf_data = NULL;
99  doca_error_t result = DOCA_SUCCESS, tmp_result;
100  const struct doca_rdma_connection *rdma_connection;
101  struct doca_buf *dst_buf = NULL;
102 
103  DOCA_LOG_INFO("RDMA receive task was done successfully");
104 
105  /* Read the data that was received */
106  rdma_connection = doca_rdma_task_receive_get_result_rdma_connection(rdma_receive_task);
107  dst_buf = doca_rdma_task_receive_get_dst_buf(rdma_receive_task);
108  result = doca_buf_get_data(dst_buf, &dst_buf_data);
109  if (result != DOCA_SUCCESS) {
110  DOCA_LOG_ERR("Failed to get destination buffer data: %s", doca_error_get_descr(result));
111  goto free_task;
112  }
113 
114  /* Check if dst_buf_data is null terminated and of legal size */
115  if (strnlen(dst_buf_data, MAX_BUFF_SIZE) == MAX_BUFF_SIZE) {
116  DOCA_LOG_ERR("The message that was received from sender exceeds buffer size %d", MAX_BUFF_SIZE);
118  goto free_task;
119  }
120 
121  DOCA_LOG_INFO("Got from sender: \"%s\", sender's rdma_connection address [%p]",
122  (char *)dst_buf_data,
123  rdma_connection);
124 
125 free_task:
126  tmp_result = doca_buf_dec_refcount(dst_buf, NULL);
127  if (tmp_result != DOCA_SUCCESS) {
128  DOCA_LOG_ERR("Failed to decrease dst_buf count: %s", doca_error_get_descr(tmp_result));
129  DOCA_ERROR_PROPAGATE(result, tmp_result);
130  }
132 
133  /* Update that an error was encountered, if any */
134  DOCA_ERROR_PROPAGATE(*first_encountered_error, tmp_result);
135 
137  /* Stop context once all tasks are completed */
138  if (resources->num_remaining_tasks == 0)
140 }
141 
142 /*
143  * RDMA receive task error callback
144  *
145  * @rdma_receive_task [in]: failed task
146  * @task_user_data [in]: doca_data from the task
147  * @ctx_user_data [in]: doca_data from the context
148  */
149 static void rdma_multi_conn_receive_error_callback(struct doca_rdma_task_receive *rdma_receive_task,
150  union doca_data task_user_data,
151  union doca_data ctx_user_data)
152 {
153  struct rdma_resources *resources = (struct rdma_resources *)ctx_user_data.ptr;
154  struct doca_task *task = doca_rdma_task_receive_as_task(rdma_receive_task);
156  struct doca_buf *dst_buf = NULL;
158 
159  /* Update that an error was encountered */
162  DOCA_LOG_ERR("RDMA receive task failed: %s", doca_error_get_descr(result));
163 
164  dst_buf = doca_rdma_task_receive_get_dst_buf(rdma_receive_task);
166  if (result != DOCA_SUCCESS)
167  DOCA_LOG_ERR("Failed to decrease dst_buf count: %s", doca_error_get_descr(result));
168 
169  doca_task_free(task);
171  /* Stop context once all tasks are completed */
172  if (resources->num_remaining_tasks == 0)
174 }
175 
176 /*
177  * Export and receive connection details, and connect to the remote RDMA
178  *
179  * @resources [in]: RDMA resources
180  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
181  */
183 {
185  uint32_t i = 0;
186 
187  if (resources->cfg->use_rdma_cm == true)
188  return rdma_cm_connect(resources);
189 
190  /* 1-by-1 to setup all the connections */
191  for (i = 0; i < resources->cfg->num_connections; i++) {
192  DOCA_LOG_INFO("Start to establish RDMA connection [%d]", i);
193  /* Export RDMA connection details */
197  &(resources->connections[i]));
198  if (result != DOCA_SUCCESS) {
199  DOCA_LOG_ERR("Failed to export RDMA: %s", doca_error_get_descr(result));
200  return result;
201  }
202 
203  /* write and read connection details to the sender */
205  if (result != DOCA_SUCCESS) {
206  DOCA_LOG_ERR("Failed to write and read connection details from sender: %s",
208  return result;
209  }
210 
211  /* Connect RDMA */
215  resources->connections[i]);
216  if (result != DOCA_SUCCESS)
217  DOCA_LOG_ERR("Failed to connect the receiver's RDMA to the sender's RDMA: %s",
219 
220  /* Free remote connection descriptor */
223 
224  DOCA_LOG_INFO("RDMA connection [%d] is establshed", i);
225  }
226  DOCA_LOG_INFO("All [%d] RDMA connections have been establshed", resources->cfg->num_connections);
227 
228  return result;
229 }
230 
231 /*
232  * Prepare and submit RDMA receive task
233  *
234  * @resources [in]: RDMA resources
235  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
236  */
238 {
239  struct doca_rdma_task_receive *rdma_receive_tasks[MAX_NUM_CONNECTIONS] = {0};
240  struct doca_buf *dst_bufs[MAX_NUM_CONNECTIONS] = {0};
241  union doca_data task_user_data = {0};
242  doca_error_t result, tmp_result;
243  uint32_t i = 0;
244 
245  for (i = 0; i < resources->cfg->num_connections; i++) {
246  /* Add dst buffer to DOCA buffer inventory */
248  resources->mmap,
251  &dst_bufs[i]);
252  if (result != DOCA_SUCCESS) {
253  DOCA_LOG_ERR("Failed to allocate DOCA buffer [%d] to DOCA buffer inventory: %s",
254  i,
256  return result;
257  }
258 
259  /* Include first_encountered_error in user data of task to be used in the callbacks */
260  task_user_data.ptr = &(resources->first_encountered_error);
261  /* Allocate and construct RDMA receive task */
263  dst_bufs[i],
264  task_user_data,
265  &rdma_receive_tasks[i]);
266  if (result != DOCA_SUCCESS) {
267  DOCA_LOG_ERR("Failed to allocate RDMA receive task [%d]: %s", i, doca_error_get_descr(result));
268  goto destroy_dst_buf;
269  }
270 
271  /* Submit RDMA receive task */
272  DOCA_LOG_INFO("Submitting RDMA receive task [%d]", i);
274  result = doca_task_submit(doca_rdma_task_receive_as_task(rdma_receive_tasks[i]));
275  if (result != DOCA_SUCCESS) {
276  DOCA_LOG_ERR("Failed to submit RDMA receive task [%d]: %s", i, doca_error_get_descr(result));
277  goto free_task;
278  }
279  DOCA_LOG_INFO("RDMA receive task [%d] successfully submitted", i);
280  }
281  DOCA_LOG_INFO("All RDMA receive tasks have been successfully submitted");
282 
283  return result;
284 
285 free_task:
286  doca_task_free(doca_rdma_task_receive_as_task(rdma_receive_tasks[i]));
287 destroy_dst_buf:
288  tmp_result = doca_buf_dec_refcount(dst_bufs[i], NULL);
289  if (tmp_result != DOCA_SUCCESS) {
290  DOCA_LOG_ERR("Failed to decrease dst_buf count: %s", doca_error_get_descr(tmp_result));
291  DOCA_ERROR_PROPAGATE(result, tmp_result);
292  }
293 
294  return result;
295 }
296 
297 /*
298  * RDMA receive state change callback
299  * This function represents the state machine for this RDMA program
300  *
301  * @user_data [in]: doca_data from the context
302  * @ctx [in]: DOCA context
303  * @prev_state [in]: Previous DOCA context state
304  * @next_state [in]: Next DOCA context state
305  */
307  struct doca_ctx *ctx,
308  enum doca_ctx_states prev_state,
309  enum doca_ctx_states next_state)
310 {
311  struct rdma_resources *resources = (struct rdma_resources *)user_data.ptr;
312  struct rdma_config *cfg = resources->cfg;
314  (void)prev_state;
315  (void)ctx;
316 
317  switch (next_state) {
319  DOCA_LOG_INFO("RDMA context entered starting state");
320  break;
322  DOCA_LOG_INFO("RDMA context is running");
323 
325  if (result != DOCA_SUCCESS) {
326  DOCA_LOG_ERR("rdma_multi_conn_receive_export_and_connect() failed: %s",
328  break;
329  } else
330  DOCA_LOG_INFO("RDMA context finished initialization");
331 
332  if (cfg->use_rdma_cm == true)
333  break;
334 
336  if (result != DOCA_SUCCESS)
337  DOCA_LOG_ERR("rdma_multi_conn_receive_prepare_and_submit_task() failed: %s",
339  break;
348  DOCA_LOG_INFO("RDMA context entered into stopping state. Any inflight tasks will be flushed");
349 
350  if (resources->cfg->use_rdma_cm == true)
352  break;
353  case DOCA_CTX_STATE_IDLE:
354  DOCA_LOG_INFO("RDMA context has been stopped");
355 
356  /* We can stop progressing the PE */
357  resources->run_pe_progress = false;
358  break;
359  default:
360  break;
361  }
362 
363  /* If something failed - update that an error was encountered and stop the ctx */
364  if (result != DOCA_SUCCESS) {
366  (void)doca_ctx_stop(ctx);
367  }
368 }
369 
370 /*
371  * Receive a message from the sender
372  *
373  * @cfg [in]: Configuration parameters
374  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
375  */
377 {
378  struct rdma_resources resources = {0};
379  union doca_data ctx_user_data = {0};
380  uint32_t mmap_permissions = DOCA_ACCESS_FLAG_LOCAL_READ_WRITE;
381  uint32_t rdma_permissions = DOCA_ACCESS_FLAG_LOCAL_READ_WRITE;
382  struct timespec ts = {
383  .tv_sec = 0,
384  .tv_nsec = SLEEP_IN_NANOS,
385  };
386  doca_error_t result, tmp_result;
387 
388  /* Allocating resources */
390  mmap_permissions,
391  rdma_permissions,
393  &resources);
394  if (result != DOCA_SUCCESS) {
395  DOCA_LOG_ERR("Failed to allocate RDMA Resources: %s", doca_error_get_descr(result));
396  return result;
397  }
398 
402  NUM_RDMA_TASKS * cfg->num_connections);
403  if (result != DOCA_SUCCESS) {
404  DOCA_LOG_ERR("Unable to set configurations for RDMA receive task: %s", doca_error_get_descr(result));
405  goto destroy_resources;
406  }
407 
409  if (result != DOCA_SUCCESS) {
410  DOCA_LOG_ERR("Unable to set state change callback for RDMA context: %s", doca_error_get_descr(result));
411  goto destroy_resources;
412  }
413 
414  /* Include the program's resources in user data of context to be used in callbacks */
415  ctx_user_data.ptr = &(resources);
417  if (result != DOCA_SUCCESS) {
418  DOCA_LOG_ERR("Failed to set context user data: %s", doca_error_get_descr(result));
419  goto destroy_resources;
420  }
421 
422  /* Create DOCA buffer inventory */
425  if (result != DOCA_SUCCESS) {
426  DOCA_LOG_ERR("Failed to create DOCA buffer inventory: %s", doca_error_get_descr(result));
427  goto destroy_resources;
428  }
429 
430  /* Start DOCA buffer inventory */
432  if (result != DOCA_SUCCESS) {
433  DOCA_LOG_ERR("Failed to start DOCA buffer inventory: %s", doca_error_get_descr(result));
434  goto destroy_buf_inventory;
435  }
436 
437  if (cfg->use_rdma_cm == true) {
438  /* Set rdma cm connection configuration callbacks */
442  /* need_send_mmap_info */ false,
443  /* need_recv_mmap_info */ false);
444  if (result != DOCA_SUCCESS) {
445  DOCA_LOG_ERR("Failed to config RDMA CM callbacks and negotiation functions: %s",
447  goto destroy_buf_inventory;
448  }
449  }
450 
451  /* Start RDMA context */
453  if (result != DOCA_SUCCESS) {
454  DOCA_LOG_ERR("Failed to start RDMA context: %s", doca_error_get_descr(result));
455  goto stop_buf_inventory;
456  }
457 
458  /*
459  * Run the progress engine which will run the state machine defined in rdma_receive_state_change_callback()
460  * When the context moves to idle, the context change callback call will signal to stop running the progress
461  * engine.
462  */
463  while (resources.run_pe_progress) {
464  if (doca_pe_progress(resources.pe) == 0)
465  nanosleep(&ts, &ts);
466  }
467 
468  /* Assign the result we update in the callbacks */
470 
471 stop_buf_inventory:
473  if (tmp_result != DOCA_SUCCESS) {
474  DOCA_LOG_ERR("Failed to stop DOCA buffer inventory: %s", doca_error_get_descr(tmp_result));
475  DOCA_ERROR_PROPAGATE(result, tmp_result);
476  }
477 destroy_buf_inventory:
479  if (tmp_result != DOCA_SUCCESS) {
480  DOCA_LOG_ERR("Failed to destroy DOCA buffer inventory: %s", doca_error_get_descr(tmp_result));
481  DOCA_ERROR_PROPAGATE(result, tmp_result);
482  }
483 destroy_resources:
484  tmp_result = destroy_rdma_resources(&resources, cfg);
485  if (tmp_result != DOCA_SUCCESS) {
486  DOCA_LOG_ERR("Failed to destroy DOCA RDMA resources: %s", doca_error_get_descr(tmp_result));
487  DOCA_ERROR_PROPAGATE(result, tmp_result);
488  }
489  return result;
490 }
#define NULL
Definition: __stddef_null.h:26
int32_t result
#define SLEEP_IN_NANOS
Definition: comch_utils.c:40
#define MAX_ARG_SIZE
Definition: dma_copy_core.h:39
doca_error_t destroy_rdma_resources(struct rdma_resources *resources)
Definition: rdma_common.c:470
void wait_for_enter(void)
Definition: rdma_common.c:1771
doca_error_t write_file(const char *file_path, const char *string, size_t string_len)
Definition: rdma_common.c:1087
doca_error_t rdma_cm_connect(struct rdma_resources *resources)
Definition: rdma_common.c:1172
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)
Definition: rdma_common.c:758
doca_error_t config_rdma_cm_callback_and_negotiation_task(struct rdma_resources *resources, bool need_send_task, bool need_recv_task)
Definition: rdma_common.c:1720
doca_error_t rdma_cm_disconnect(struct rdma_resources *resources)
Definition: rdma_common.c:1244
#define MAX_NUM_CONNECTIONS
Definition: rdma_common.h:67
#define INVENTORY_NUM_INITIAL_ELEMENTS
Definition: rdma_common.h:47
#define NUM_RDMA_TASKS
Definition: rdma_common.h:57
struct rdma_resources resources
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...
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_inventory_stop(struct doca_buf_inventory *inventory)
Stop element retrieval from inventory.
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_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.
Definition: doca_ctx.h:83
@ DOCA_CTX_STATE_STARTING
Definition: doca_ctx.h:93
@ DOCA_CTX_STATE_STOPPING
Definition: doca_ctx.h:106
@ DOCA_CTX_STATE_IDLE
Definition: doca_ctx.h:88
@ DOCA_CTX_STATE_RUNNING
Definition: doca_ctx.h:98
#define DOCA_ERROR_PROPAGATE(r, t)
Save the first encountered doca_error_t.
Definition: doca_error.h:83
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
Definition: doca_error.h:44
@ DOCA_SUCCESS
Definition: doca_error.h:38
#define DOCA_LOG_ERR(format,...)
Generates an ERROR application log message.
Definition: doca_log.h:466
#define DOCA_LOG_INFO(format,...)
Generates an INFO application log message.
Definition: doca_log.h:486
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 struct doca_buf * doca_rdma_task_receive_get_dst_buf(const struct doca_rdma_task_receive *task)
This method gets the destination buffer of a receive 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 const struct doca_rdma_connection * doca_rdma_task_receive_get_result_rdma_connection(const struct doca_rdma_task_receive *task)
This method gets the rdma connection of a receive 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_ACCESS_FLAG_LOCAL_READ_WRITE
Definition: doca_types.h:83
const struct ip_frag_config * cfg
Definition: ip_frag_dp.c:0
static void rdma_multi_conn_receive_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)
#define MAX_BUFF_SIZE
DOCA_LOG_REGISTER(RDMA_MULTI_CONN_RECEIVE::SAMPLE)
static void rdma_multi_conn_receive_error_callback(struct doca_rdma_task_receive *rdma_receive_task, union doca_data task_user_data, union doca_data ctx_user_data)
static doca_error_t rdma_multi_conn_receive_export_and_connect(struct rdma_resources *resources)
static doca_error_t rdma_multi_conn_receive_prepare_and_submit_task(struct rdma_resources *resources)
doca_error_t rdma_multi_conn_receive(struct rdma_config *cfg)
static doca_error_t write_read_connection(struct rdma_config *cfg, struct rdma_resources *resources, uint32_t connection_id)
static void rdma_multi_conn_receive_completed_callback(struct doca_rdma_task_receive *rdma_receive_task, union doca_data task_user_data, union doca_data ctx_user_data)
uint32_t num_connections
Definition: rdma_common.h:88
bool use_rdma_cm
Definition: rdma_common.h:71
size_t remote_rdma_conn_descriptor_size
Definition: rdma_common.h:127
doca_error_t first_encountered_error
Definition: rdma_common.h:132
bool require_remote_mmap
Definition: rdma_common.h:152
struct doca_ctx * rdma_ctx
Definition: rdma_common.h:85
size_t num_remaining_tasks
Definition: rdma_common.h:134
prepare_and_submit_task_fn task_fn
Definition: rdma_common.h:150
const void * rdma_conn_descriptor
Definition: rdma_common.h:124
void * remote_rdma_conn_descriptor
Definition: rdma_common.h:126
struct doca_rdma_connection * connections[MAX_NUM_CONNECTIONS]
Definition: rdma_common.h:138
struct doca_buf * dst_buf
Definition: rdma_common.h:123
struct rdma_config * cfg
Definition: rdma_common.h:80
struct doca_rdma * rdma
Definition: rdma_common.h:83
struct doca_pe * pe
Definition: rdma_common.h:86
struct doca_mmap * mmap
Definition: rdma_common.h:112
bool run_pe_progress
Definition: rdma_common.h:133
struct doca_buf_inventory * buf_inventory
Definition: rdma_common.h:117
size_t rdma_conn_descriptor_size
Definition: rdma_common.h:125
char * mmap_memrange
Definition: rdma_common.h:116
Convenience type for representing opaque data.
Definition: doca_types.h:56
void * ptr
Definition: doca_types.h:57
struct upf_accel_ctx * ctx
doca_error_t read_file(char const *path, char **out_bytes, size_t *out_bytes_len)
Definition: utils.c:56