NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
rdma_receive_immediate_sample.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023 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 #define EXPECTED_IMMEDIATE_VALUE (0xABCD) /* Expected immediate value to receive */
37 
38 DOCA_LOG_REGISTER(RDMA_RECEIVE_IMMEDIATE::SAMPLE);
39 
40 /*
41  * Write the connection details for the sender to read, and read the connection details of the sender
42  * In DC transport mode it is only needed to read the remote connection details
43  *
44  * @cfg [in]: Configuration parameters
45  * @resources [in/out]: RDMA resources
46  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
47  */
49 {
51 
52  /* Write the RDMA connection details */
53  result = write_file(cfg->local_connection_desc_path,
56  if (result != DOCA_SUCCESS) {
57  DOCA_LOG_ERR("Failed to write the RDMA connection details: %s", doca_error_get_descr(result));
58  return result;
59  }
60 
61  DOCA_LOG_INFO("You can now copy %s to the sender", cfg->local_connection_desc_path);
62 
63  if (cfg->transport_type == DOCA_RDMA_TRANSPORT_TYPE_DC) {
64  return result;
65  }
66  DOCA_LOG_INFO("Please copy %s from the sender and then press enter", cfg->remote_connection_desc_path);
67 
68  /* Wait for enter */
70 
71  /* Read the remote RDMA connection details */
72  result = read_file(cfg->remote_connection_desc_path,
75  if (result != DOCA_SUCCESS)
76  DOCA_LOG_ERR("Failed to read the remote RDMA connection details: %s", doca_error_get_descr(result));
77 
78  return result;
79 }
80 
81 /*
82  * RDMA receive task completed callback
83  *
84  * @rdma_receive_task [in]: Completed task
85  * @task_user_data [in]: doca_data from the task
86  * @ctx_user_data [in]: doca_data from the context
87  */
88 static void rdma_receive_completed_callback(struct doca_rdma_task_receive *rdma_receive_task,
89  union doca_data task_user_data,
90  union doca_data ctx_user_data)
91 {
92  struct rdma_resources *resources = (struct rdma_resources *)ctx_user_data.ptr;
93  void *dst_buf_data;
94  doca_be32_t immediate_data;
95  enum doca_rdma_opcode op_code;
97  doca_error_t result = DOCA_SUCCESS, tmp_result;
98 
99  /*
100  * Retrieve immediate data.
101  * Immediate data is only valid if the task result is success and the task contains the correct opcode
102  */
103  op_code = doca_rdma_task_receive_get_result_opcode(rdma_receive_task);
104  if (op_code != DOCA_RDMA_OPCODE_RECV_SEND_WITH_IMM) {
106  DOCA_LOG_ERR("Got incorrect opcode: %s", doca_error_get_descr(result));
107  goto free_task;
108  }
109 
110  immediate_data = doca_rdma_task_receive_get_result_immediate_data(rdma_receive_task);
111  if (immediate_data != EXPECTED_IMMEDIATE_VALUE) {
113  DOCA_LOG_ERR(
114  "RDMA receive task failed: immediate value that was received isn't the expected immediate value");
115  goto free_task;
116  }
117 
118  DOCA_LOG_INFO("RDMA receive task was done Successfully");
119 
120  /* Read the data that was received */
121  result = doca_buf_get_data(resources->dst_buf, &dst_buf_data);
122  if (result != DOCA_SUCCESS) {
123  DOCA_LOG_ERR("Failed to get destination buffer data: %s", doca_error_get_descr(result));
124  goto free_task;
125  }
126 
127  /* Check if dst_buf_data is null terminated and of legal size */
128  if (strnlen(dst_buf_data, MAX_BUFF_SIZE) == MAX_BUFF_SIZE) {
129  DOCA_LOG_ERR("The message that was received from sender exceeds buffer size %d", MAX_BUFF_SIZE);
131  goto free_task;
132  }
133 
134  DOCA_LOG_INFO("Got from sender: \"%s\" with immediate: %u", (char *)dst_buf_data, immediate_data);
135 
136 free_task:
139  if (tmp_result != DOCA_SUCCESS) {
140  DOCA_LOG_ERR("Failed to decrease dst_buf count: %s", doca_error_get_descr(tmp_result));
141  DOCA_ERROR_PROPAGATE(result, tmp_result);
142  }
143 
144  /* Update that an error was encountered, if any */
146 
148  /* Stop context once all tasks are completed */
149  if (resources->num_remaining_tasks == 0) {
150  if (resources->cfg->use_rdma_cm == true)
153  }
154 }
155 
156 /*
157  * RDMA receive task error callback
158  *
159  * @rdma_receive_task [in]: failed task
160  * @task_user_data [in]: doca_data from the task
161  * @ctx_user_data [in]: doca_data from the context
162  */
163 static void rdma_receive_error_callback(struct doca_rdma_task_receive *rdma_receive_task,
164  union doca_data task_user_data,
165  union doca_data ctx_user_data)
166 {
167  struct rdma_resources *resources = (struct rdma_resources *)ctx_user_data.ptr;
168  struct doca_task *task = doca_rdma_task_receive_as_task(rdma_receive_task);
171 
172  /* Update that an error was encountered */
175  DOCA_LOG_ERR("RDMA receive task failed: %s", doca_error_get_descr(result));
176 
177  doca_task_free(task);
179  if (result != DOCA_SUCCESS)
180  DOCA_LOG_ERR("Failed to decrease dst_buf count: %s", doca_error_get_descr(result));
181 
183  /* Stop context once all tasks are completed */
184  if (resources->num_remaining_tasks == 0) {
185  if (resources->cfg->use_rdma_cm == true)
188  }
189 }
190 
191 /*
192  * Export and receive connection details, and connect to the remote RDMA
193  *
194  * @resources [in]: RDMA resources
195  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
196  */
198 {
200 
201  if (resources->cfg->use_rdma_cm == true)
202  return rdma_cm_connect(resources);
203 
204  /* Export RDMA connection details */
208  &(resources->connections[0]));
209  if (result != DOCA_SUCCESS) {
210  DOCA_LOG_ERR("Failed to export RDMA: %s", doca_error_get_descr(result));
211  return result;
212  }
213 
214  /* write and read connection details to the sender */
216  if (result != DOCA_SUCCESS) {
217  DOCA_LOG_ERR("Failed to write and read connection details from sender: %s",
219  return result;
220  }
221 
223  return result;
224  }
225  /* Connect RDMA */
229  resources->connections[0]);
230  if (result != DOCA_SUCCESS)
231  DOCA_LOG_ERR("Failed to connect the receiver's RDMA to the sender's RDMA: %s",
233 
234  return result;
235 }
236 
237 /*
238  * Prepare and submit RDMA receive task
239  *
240  * @resources [in]: RDMA resources
241  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
242  */
244 {
245  struct doca_rdma_task_receive *rdma_receive_task = NULL;
246  union doca_data task_user_data = {0};
247  doca_error_t result, tmp_result;
248 
249  /* Add dst buffer to DOCA buffer inventory */
251  resources->mmap,
254  &resources->dst_buf);
255  if (result != DOCA_SUCCESS) {
256  DOCA_LOG_ERR("Failed to allocate DOCA buffer to DOCA buffer inventory: %s",
258  return result;
259  }
260 
261  /* Include first_encountered_error in user data of task to be used in the callbacks */
262  task_user_data.ptr = &(resources->first_encountered_error);
263  /* Allocate and construct RDMA receive task */
266  task_user_data,
267  &rdma_receive_task);
268  if (result != DOCA_SUCCESS) {
269  DOCA_LOG_ERR("Failed to allocate RDMA receive task: %s", doca_error_get_descr(result));
270  goto destroy_dst_buf;
271  }
272 
273  /* Submit RDMA receive task */
274  DOCA_LOG_INFO("Submitting RDMA receive task");
277  if (result != DOCA_SUCCESS) {
278  DOCA_LOG_ERR("Failed to submit RDMA receive task: %s", doca_error_get_descr(result));
279  goto free_task;
280  }
281 
282  if (resources->cfg->use_rdma_cm == true)
283  DOCA_LOG_INFO("RDMA receive task successfully submitted");
284 
285  return result;
286 
287 free_task:
289 destroy_dst_buf:
291  if (tmp_result != DOCA_SUCCESS) {
292  DOCA_LOG_ERR("Failed to decrease dst_buf count: %s", doca_error_get_descr(tmp_result));
293  DOCA_ERROR_PROPAGATE(result, tmp_result);
294  }
295  return result;
296 }
297 
298 /*
299  * RDMA receive state change callback
300  * This function represents the state machine for this RDMA program
301  *
302  * @user_data [in]: doca_data from the context
303  * @ctx [in]: DOCA context
304  * @prev_state [in]: Previous DOCA context state
305  * @next_state [in]: Next DOCA context state
306  */
307 static void rdma_receive_state_change_callback(const union doca_data user_data,
308  struct doca_ctx *ctx,
309  enum doca_ctx_states prev_state,
310  enum doca_ctx_states next_state)
311 {
312  struct rdma_resources *resources = (struct rdma_resources *)user_data.ptr;
313  struct rdma_config *cfg = resources->cfg;
315  (void)prev_state;
316  (void)ctx;
317 
318  switch (next_state) {
320  DOCA_LOG_INFO("RDMA context entered starting state");
321  break;
323  DOCA_LOG_INFO("RDMA context is running");
324 
326  if (result != DOCA_SUCCESS) {
327  DOCA_LOG_ERR("rdma_receive_immediate_export_and_connect() failed: %s",
329  break;
330  } else
331  DOCA_LOG_INFO("RDMA context finished initialization");
332 
333  if (cfg->use_rdma_cm == true)
334  break;
335 
337  if (result != DOCA_SUCCESS) {
338  DOCA_LOG_ERR("rdma_receive_prepare_and_submit_task() failed: %s", doca_error_get_descr(result));
339  break;
340  }
341  break;
350  DOCA_LOG_INFO("RDMA context entered into stopping state. Any inflight tasks will be flushed");
351  break;
352  case DOCA_CTX_STATE_IDLE:
353  DOCA_LOG_INFO("RDMA context has been stopped");
354 
355  /* We can stop progressing the PE */
356  resources->run_pe_progress = false;
357  break;
358  default:
359  break;
360  }
361 
362  /* If something failed - update that an error was encountered and stop the ctx */
363  if (result != DOCA_SUCCESS) {
365  (void)doca_ctx_stop(ctx);
366  }
367 }
368 
369 /*
370  * Receive a message from the sender with immediate
371  *
372  * @cfg [in]: Configuration parameters
373  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
374  */
376 {
377  struct rdma_resources resources = {0};
378  union doca_data ctx_user_data = {0};
379  uint32_t mmap_permissions = DOCA_ACCESS_FLAG_LOCAL_READ_WRITE;
380  uint32_t rdma_permissions = DOCA_ACCESS_FLAG_LOCAL_READ_WRITE;
381  struct timespec ts = {
382  .tv_sec = 0,
383  .tv_nsec = SLEEP_IN_NANOS,
384  };
385  doca_error_t result, tmp_result;
386 
387  /* Allocating resources */
389  mmap_permissions,
390  rdma_permissions,
392  &resources);
393  if (result != DOCA_SUCCESS) {
394  DOCA_LOG_ERR("Failed to allocate RDMA Resources: %s", doca_error_get_descr(result));
395  return result;
396  }
397 
402  if (result != DOCA_SUCCESS) {
403  DOCA_LOG_ERR("Unable to set configurations for RDMA receive task: %s", doca_error_get_descr(result));
404  goto destroy_resources;
405  }
406 
408  if (result != DOCA_SUCCESS) {
409  DOCA_LOG_ERR("Unable to set state change callback for RDMA context: %s", doca_error_get_descr(result));
410  goto destroy_resources;
411  }
412 
413  /* Include the program's resources in user data of context to be used in callbacks */
414  ctx_user_data.ptr = &(resources);
416  if (result != DOCA_SUCCESS) {
417  DOCA_LOG_ERR("Failed to set context user data: %s", doca_error_get_descr(result));
418  goto destroy_resources;
419  }
420 
421  /* Create DOCA buffer inventory */
423  if (result != DOCA_SUCCESS) {
424  DOCA_LOG_ERR("Failed to create DOCA buffer inventory: %s", doca_error_get_descr(result));
425  goto destroy_resources;
426  }
427 
428  /* Start DOCA buffer inventory */
430  if (result != DOCA_SUCCESS) {
431  DOCA_LOG_ERR("Failed to start DOCA buffer inventory: %s", doca_error_get_descr(result));
432  goto destroy_buf_inventory;
433  }
434 
435  if (cfg->use_rdma_cm == true) {
436  /* Set rdma cm connection configuration callbacks */
440  /* need_send_mmap_info */ false,
441  /* need_recv_mmap_info */ false);
442  if (result != DOCA_SUCCESS) {
443  DOCA_LOG_ERR("Failed to config RDMA CM callbacks and negotiation functions: %s",
445  goto destroy_buf_inventory;
446  }
447  }
448 
449  /* Start RDMA context */
451  if (result != DOCA_SUCCESS) {
452  DOCA_LOG_ERR("Failed to start RDMA context: %s", doca_error_get_descr(result));
453  goto stop_buf_inventory;
454  }
455 
456  /*
457  * Run the progress engine which will run the state machine defined in rdma_receive_state_change_callback()
458  * When the context moves to idle, the context change callback call will signal to stop running the progress
459  * engine.
460  */
461  while (resources.run_pe_progress) {
462  if (doca_pe_progress(resources.pe) == 0)
463  nanosleep(&ts, &ts);
464  }
465 
466  /* Assign the result we update in the callbacks */
468 
469 stop_buf_inventory:
471  if (tmp_result != DOCA_SUCCESS) {
472  DOCA_LOG_ERR("Failed to stop DOCA buffer inventory: %s", doca_error_get_descr(tmp_result));
473  DOCA_ERROR_PROPAGATE(result, tmp_result);
474  }
475 destroy_buf_inventory:
477  if (tmp_result != DOCA_SUCCESS) {
478  DOCA_LOG_ERR("Failed to destroy DOCA buffer inventory: %s", doca_error_get_descr(tmp_result));
479  DOCA_ERROR_PROPAGATE(result, tmp_result);
480  }
481 destroy_resources:
482  tmp_result = destroy_rdma_resources(&resources, cfg);
483  if (tmp_result != DOCA_SUCCESS) {
484  DOCA_LOG_ERR("Failed to destroy DOCA RDMA resources: %s", doca_error_get_descr(tmp_result));
485  DOCA_ERROR_PROPAGATE(result, tmp_result);
486  }
487  return result;
488 }
#define NULL
Definition: __stddef_null.h:26
int32_t result
#define SLEEP_IN_NANOS
Definition: comch_utils.c:40
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 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_ERROR_UNEXPECTED
Definition: doca_error.h:60
@ 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 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_rdma_opcode
Definition: doca_rdma.h:1318
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_SEND_WITH_IMM
Definition: doca_rdma.h:1320
@ DOCA_RDMA_TRANSPORT_TYPE_DC
Definition: doca_rdma.h:47
uint32_t doca_be32_t
Definition: doca_types.h:121
@ 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_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_RECEIVE_IMMEDIATE::SAMPLE)
static doca_error_t rdma_receive_prepare_and_submit_task(struct rdma_resources *resources)
static void rdma_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_receive_immediate_export_and_connect(struct rdma_resources *resources)
#define EXPECTED_IMMEDIATE_VALUE
static doca_error_t write_read_connection(struct rdma_config *cfg, struct rdma_resources *resources)
static void rdma_receive_completed_callback(struct doca_rdma_task_receive *rdma_receive_task, union doca_data task_user_data, union doca_data ctx_user_data)
doca_error_t rdma_receive_immediate(struct rdma_config *cfg)
enum doca_rdma_transport_type transport_type
Definition: rdma_common.h:90
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