NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
rdma_write_requester_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 
32 #include "rdma_common.h"
33 
34 DOCA_LOG_REGISTER(RDMA_WRITE_REQUESTER::SAMPLE);
35 
36 /*
37  * Write the connection details for the responder to read,
38  * and read the connection details and the remote mmap string of the responder
39  * In DC transport mode it is only needed to read the remote connection details
40  *
41  * @cfg [in]: Configuration parameters
42  * @resources [in/out]: RDMA resources
43  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
44  */
46 {
48 
49  if (cfg->transport_type == DOCA_RDMA_TRANSPORT_TYPE_RC) {
50  /* Write the RDMA connection details */
51  result = write_file(cfg->local_connection_desc_path,
54  if (result != DOCA_SUCCESS) {
55  DOCA_LOG_ERR("Failed to write the RDMA connection details: %s", doca_error_get_descr(result));
56  return result;
57  }
58 
59  DOCA_LOG_INFO("You can now copy %s to the responder", cfg->local_connection_desc_path);
60  }
61 
63  "Please copy %s and %s from the responder and then press enter after pressing enter in the responder side",
64  cfg->remote_connection_desc_path,
65  cfg->remote_resource_desc_path);
66 
67  /* Wait for enter */
69 
70  /* Read the remote RDMA connection details */
71  result = read_file(cfg->remote_connection_desc_path,
74  if (result != DOCA_SUCCESS) {
75  DOCA_LOG_ERR("Failed to read the remote RDMA connection details: %s", doca_error_get_descr(result));
76  return result;
77  }
78 
79  /* Read the remote mmap connection details */
80  result = read_file(cfg->remote_resource_desc_path,
83  if (result != DOCA_SUCCESS) {
84  DOCA_LOG_ERR("Failed to read the remote RDMA mmap connection details: %s",
86  return result;
87  }
88 
89  return result;
90 }
91 
92 /*
93  * RDMA write task completed callback
94  *
95  * @rdma_write_task [in]: Completed task
96  * @task_user_data [in]: doca_data from the task
97  * @ctx_user_data [in]: doca_data from the context
98  */
99 static void rdma_write_completed_callback(struct doca_rdma_task_write *rdma_write_task,
100  union doca_data task_user_data,
101  union doca_data ctx_user_data)
102 {
103  struct rdma_resources *resources = (struct rdma_resources *)ctx_user_data.ptr;
105  doca_error_t result = DOCA_SUCCESS, tmp_result;
106 
107  DOCA_LOG_INFO("RDMA write task was done Successfully");
108  DOCA_LOG_INFO("Written to responder \"%s\"", resources->cfg->write_string);
109 
112  if (tmp_result != DOCA_SUCCESS) {
113  DOCA_LOG_ERR("Failed to decrease dst_buf count: %s", doca_error_get_descr(tmp_result));
114  DOCA_ERROR_PROPAGATE(result, tmp_result);
115  }
117  if (tmp_result != DOCA_SUCCESS) {
118  DOCA_LOG_ERR("Failed to decrease src_buf count: %s", doca_error_get_descr(tmp_result));
119  DOCA_ERROR_PROPAGATE(result, tmp_result);
120  }
121 
122  /* Update that an error was encountered, if any */
124 
126  /* Stop context once all tasks are completed */
127  if (resources->num_remaining_tasks == 0) {
128  if (resources->cfg->use_rdma_cm == true)
131  }
132 }
133 
134 /*
135  * RDMA write task error callback
136  *
137  * @rdma_write_task [in]: failed task
138  * @task_user_data [in]: doca_data from the task
139  * @ctx_user_data [in]: doca_data from the context
140  */
141 static void rdma_write_error_callback(struct doca_rdma_task_write *rdma_write_task,
142  union doca_data task_user_data,
143  union doca_data ctx_user_data)
144 {
145  struct rdma_resources *resources = (struct rdma_resources *)ctx_user_data.ptr;
146  struct doca_task *task = doca_rdma_task_write_as_task(rdma_write_task);
149 
150  /* Update that an error was encountered */
153  DOCA_LOG_ERR("RDMA write task failed: %s", doca_error_get_descr(result));
154 
156  if (result != DOCA_SUCCESS)
157  DOCA_LOG_ERR("Failed to decrease dst_buf count: %s", doca_error_get_descr(result));
159  if (result != DOCA_SUCCESS)
160  DOCA_LOG_ERR("Failed to decrease src_buf count: %s", doca_error_get_descr(result));
161  doca_task_free(task);
162 
164  /* Stop context once all tasks are completed */
165  if (resources->num_remaining_tasks == 0) {
166  if (resources->cfg->use_rdma_cm == true)
169  }
170 }
171 
172 /*
173  * Export and receive connection details, and connect to the remote RDMA
174  *
175  * @resources [in]: RDMA resources
176  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
177  */
179 {
181 
182  if (resources->cfg->use_rdma_cm == true)
183  return rdma_cm_connect(resources);
184 
185  /* Export RDMA connection details */
189  &(resources->connections[0]));
190  if (result != DOCA_SUCCESS) {
191  DOCA_LOG_ERR("Failed to export RDMA: %s", doca_error_get_descr(result));
192  return result;
193  }
194 
195  /* write and read connection details to the responder */
197  if (result != DOCA_SUCCESS) {
198  DOCA_LOG_ERR("Failed to write and read connection details from responder: %s",
200  return result;
201  }
202 
203  /* Connect RDMA */
207  resources->connections[0]);
208  if (result != DOCA_SUCCESS)
209  DOCA_LOG_ERR("Failed to connect the requester's RDMA to the responder's RDMA: %s",
211 
212  return result;
213 }
214 
215 /*
216  * Prepare and submit RDMA write task
217  *
218  * @resources [in]: RDMA resources
219  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
220  */
222 {
223  struct doca_rdma_task_write *rdma_write_task = NULL;
224  union doca_data task_user_data = {0};
225  char *remote_mmap_range;
226  size_t remote_mmap_range_len;
227  void *src_buf_data;
228  size_t write_string_len = strlen(resources->cfg->write_string) + 1;
229  doca_error_t result, tmp_result;
230 
231  /* Create remote mmap */
236  &(resources->remote_mmap));
237  if (result != DOCA_SUCCESS) {
238  DOCA_LOG_ERR("Failed to create mmap from export: %s", doca_error_get_descr(result));
239  return result;
240  }
241 
242  /* Get the remote mmap memory range */
243  result = doca_mmap_get_memrange(resources->remote_mmap, (void **)&remote_mmap_range, &remote_mmap_range_len);
244  if (result != DOCA_SUCCESS) {
245  DOCA_LOG_ERR("Failed to get DOCA memory map range: %s", doca_error_get_descr(result));
246  return result;
247  }
248 
249  /* Add src buffer to DOCA buffer inventory from the remote mmap */
251  resources->mmap,
253  write_string_len,
254  &resources->src_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  /* Set data of src buffer to be the string we want to write */
262  result = doca_buf_get_data(resources->src_buf, &src_buf_data);
263  if (result != DOCA_SUCCESS) {
264  DOCA_LOG_ERR("Failed to get source buffer data: %s", doca_error_get_descr(result));
265  goto destroy_src_buf;
266  }
267  strncpy(src_buf_data, resources->cfg->write_string, write_string_len);
268 
269  /* Add dst buffer to DOCA buffer inventory */
272  remote_mmap_range,
273  write_string_len,
274  &resources->dst_buf);
275  if (result != DOCA_SUCCESS) {
276  DOCA_LOG_ERR("Failed to allocate DOCA buffer to DOCA buffer inventory: %s",
278  goto destroy_src_buf;
279  }
280 
281  /* Include first_encountered_error in user data of task to be used in the callbacks */
282  task_user_data.ptr = &(resources->first_encountered_error);
283  /* Allocate and construct RDMA write task */
288  task_user_data,
289  &rdma_write_task);
290  if (result != DOCA_SUCCESS) {
291  DOCA_LOG_ERR("Failed to allocate RDMA write task: %s", doca_error_get_descr(result));
292  goto destroy_dst_buf;
293  }
294 
295  /* Submit RDMA write task */
296  DOCA_LOG_INFO("Submitting RDMA write task that writes \"%s\" to the responder", resources->cfg->write_string);
299  if (result != DOCA_SUCCESS) {
300  DOCA_LOG_ERR("Failed to submit RDMA write task: %s", doca_error_get_descr(result));
301  goto free_task;
302  }
303 
304  return result;
305 
306 free_task:
308 destroy_dst_buf:
310  if (tmp_result != DOCA_SUCCESS) {
311  DOCA_LOG_ERR("Failed to decrease dst_buf count: %s", doca_error_get_descr(tmp_result));
312  DOCA_ERROR_PROPAGATE(result, tmp_result);
313  }
314 destroy_src_buf:
316  if (tmp_result != DOCA_SUCCESS) {
317  DOCA_LOG_ERR("Failed to decrease src_buf count: %s", doca_error_get_descr(tmp_result));
318  DOCA_ERROR_PROPAGATE(result, tmp_result);
319  }
320  return result;
321 }
322 
323 /*
324  * RDMA write requester state change callback
325  * This function represents the state machine for this RDMA program
326  *
327  * @user_data [in]: doca_data from the context
328  * @ctx [in]: DOCA context
329  * @prev_state [in]: Previous DOCA context state
330  * @next_state [in]: Next DOCA context state
331  */
332 static void rdma_write_requester_state_change_callback(const union doca_data user_data,
333  struct doca_ctx *ctx,
334  enum doca_ctx_states prev_state,
335  enum doca_ctx_states next_state)
336 {
337  struct rdma_resources *resources = (struct rdma_resources *)user_data.ptr;
338  struct rdma_config *cfg = resources->cfg;
340  (void)prev_state;
341  (void)ctx;
342 
343  switch (next_state) {
345  DOCA_LOG_INFO("RDMA context entered starting state");
346  break;
348  DOCA_LOG_INFO("RDMA context is running");
349 
351  if (result != DOCA_SUCCESS) {
352  DOCA_LOG_ERR("rdma_write_requester_export_and_connect() failed: %s",
354  break;
355  } else
356  DOCA_LOG_INFO("RDMA context finished initialization");
357 
358  if (cfg->use_rdma_cm == true)
359  break;
360 
362  if (result != DOCA_SUCCESS)
363  DOCA_LOG_ERR("rdma_write_prepare_and_submit_task() failed: %s", doca_error_get_descr(result));
364  break;
373  DOCA_LOG_INFO("RDMA context entered into stopping state. Any inflight tasks will be flushed");
374  break;
375  case DOCA_CTX_STATE_IDLE:
376  DOCA_LOG_INFO("RDMA context has been stopped");
377 
378  /* We can stop progressing the PE */
379  resources->run_pe_progress = false;
380  break;
381  default:
382  break;
383  }
384 
385  /* If something failed - update that an error was encountered and stop the ctx */
386  if (result != DOCA_SUCCESS) {
388  (void)doca_ctx_stop(ctx);
389  }
390 }
391 
392 /*
393  * Requester side of the RDMA write
394  *
395  * @cfg [in]: Configuration parameters
396  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
397  */
399 {
400  struct rdma_resources resources = {0};
401  union doca_data ctx_user_data = {0};
402  const uint32_t mmap_permissions = DOCA_ACCESS_FLAG_LOCAL_READ_WRITE;
403  const uint32_t rdma_permissions = DOCA_ACCESS_FLAG_LOCAL_READ_WRITE;
404  struct timespec ts = {
405  .tv_sec = 0,
406  .tv_nsec = SLEEP_IN_NANOS,
407  };
408  doca_error_t result, tmp_result;
409 
410  /* Allocating resources */
412  mmap_permissions,
413  rdma_permissions,
415  &resources);
416  if (result != DOCA_SUCCESS) {
417  DOCA_LOG_ERR("Failed to allocate RDMA Resources: %s", doca_error_get_descr(result));
418  return result;
419  }
420 
425  if (result != DOCA_SUCCESS) {
426  DOCA_LOG_ERR("Unable to set configurations for RDMA write task: %s", doca_error_get_descr(result));
427  goto destroy_resources;
428  }
429 
431  if (result != DOCA_SUCCESS) {
432  DOCA_LOG_ERR("Unable to set state change callback for RDMA context: %s", doca_error_get_descr(result));
433  goto destroy_resources;
434  }
435 
436  /* Create DOCA buffer inventory */
438  if (result != DOCA_SUCCESS) {
439  DOCA_LOG_ERR("Failed to create DOCA buffer inventory: %s", doca_error_get_descr(result));
440  goto destroy_resources;
441  }
442 
443  /* Start DOCA buffer inventory */
445  if (result != DOCA_SUCCESS) {
446  DOCA_LOG_ERR("Failed to start DOCA buffer inventory: %s", doca_error_get_descr(result));
447  goto destroy_buf_inventory;
448  }
449 
450  if (cfg->use_rdma_cm == true) {
451  resources.is_requester = true;
455  /* need_send_mmap_info */ false,
456  /* need_recv_mmap_info */ true);
457  if (result != DOCA_SUCCESS) {
458  DOCA_LOG_ERR("Failed to config RDMA CM callbacks and negotiation functions: %s",
460  goto destroy_buf_inventory;
461  }
462  }
463 
464  /* Include the program's resources in user data of context to be used in callbacks */
465  ctx_user_data.ptr = &(resources);
467  if (result != DOCA_SUCCESS) {
468  DOCA_LOG_ERR("Failed to set context user data: %s", doca_error_get_descr(result));
469  goto destroy_resources;
470  }
471 
472  /* Start RDMA context */
474  if (result != DOCA_SUCCESS) {
475  DOCA_LOG_ERR("Failed to start RDMA context: %s", doca_error_get_descr(result));
476  goto stop_buf_inventory;
477  }
478 
479  /*
480  * Run the progress engine which will run the state machine defined in
481  * rdma_write_requester_state_change_callback() When the context moves to idle, the context change callback call
482  * will signal to stop running the progress engine.
483  */
484  while (resources.run_pe_progress) {
485  if (doca_pe_progress(resources.pe) == 0)
486  nanosleep(&ts, &ts);
487  }
488 
489  /* Assign the result we update in the callbacks */
491 
492 stop_buf_inventory:
494  if (tmp_result != DOCA_SUCCESS) {
495  DOCA_LOG_ERR("Failed to stop DOCA buffer inventory: %s", doca_error_get_descr(tmp_result));
496  DOCA_ERROR_PROPAGATE(result, tmp_result);
497  }
498 destroy_buf_inventory:
500  if (tmp_result != DOCA_SUCCESS) {
501  DOCA_LOG_ERR("Failed to destroy DOCA buffer inventory: %s", doca_error_get_descr(tmp_result));
502  DOCA_ERROR_PROPAGATE(result, tmp_result);
503  }
504 destroy_resources:
505  tmp_result = destroy_rdma_resources(&resources, cfg);
506  if (tmp_result != DOCA_SUCCESS) {
507  DOCA_LOG_ERR("Failed to destroy DOCA RDMA resources: %s", doca_error_get_descr(tmp_result));
508  DOCA_ERROR_PROPAGATE(result, tmp_result);
509  }
510  return result;
511 }
#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...
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_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_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_mmap_create_from_export(const union doca_data *user_data, const void *export_desc, size_t export_desc_len, struct doca_dev *dev, struct doca_mmap **mmap)
Creates a memory map object representing memory ranges in remote system memory space.
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_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_task * doca_rdma_task_write_as_task(struct doca_rdma_task_write *task)
This method converts a write task to a doca_task.
DOCA_EXPERIMENTAL doca_error_t doca_rdma_task_write_set_conf(struct doca_rdma *rdma, doca_rdma_task_write_completion_cb_t successful_task_completion_cb, doca_rdma_task_write_completion_cb_t error_task_completion_cb, uint32_t num_tasks)
This method sets the write tasks configuration.
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_write_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_EXPERIMENTAL doca_error_t doca_rdma_task_write_allocate_init(struct doca_rdma *rdma, struct doca_rdma_connection *rdma_connection, const struct doca_buf *src_buf, struct doca_buf *dst_buf, union doca_data user_data, struct doca_rdma_task_write **task)
This method allocates and initializes a write task.
@ DOCA_RDMA_TRANSPORT_TYPE_RC
Definition: doca_rdma.h:46
@ 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_write_requester_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 void rdma_write_error_callback(struct doca_rdma_task_write *rdma_write_task, union doca_data task_user_data, union doca_data ctx_user_data)
static void rdma_write_completed_callback(struct doca_rdma_task_write *rdma_write_task, union doca_data task_user_data, union doca_data ctx_user_data)
doca_error_t rdma_write_requester(struct rdma_config *cfg)
DOCA_LOG_REGISTER(RDMA_WRITE_REQUESTER::SAMPLE)
static doca_error_t write_read_connection(struct rdma_config *cfg, struct rdma_resources *resources)
static doca_error_t rdma_write_requester_export_and_connect(struct rdma_resources *resources)
static doca_error_t rdma_write_prepare_and_submit_task(struct rdma_resources *resources)
bool use_rdma_cm
Definition: rdma_common.h:71
char write_string[MAX_ARG_SIZE]
Definition: rdma_common.h:82
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
struct doca_mmap * remote_mmap
Definition: rdma_common.h:113
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
size_t remote_mmap_descriptor_size
Definition: rdma_common.h:129
void * remote_mmap_descriptor
Definition: rdma_common.h:128
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_dev * doca_device
Definition: rdma_common.h:81
struct doca_buf * src_buf
Definition: rdma_common.h:122
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