NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
rdma_write_immediate_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 #define EXAMPLE_IMMEDIATE_VALUE (0xABCD) /* Example immediate value to send */
35 
36 DOCA_LOG_REGISTER(RDMA_WRITE_IMMEDIATE_REQUESTER::SAMPLE);
37 
38 /*
39  * Write the connection details for the responder to read,
40  * and read the connection details and the remote mmap string of the responder
41  * In DC transport mode it is only needed to read the remote connection details
42  *
43  * @cfg [in]: Configuration parameters
44  * @resources [in/out]: RDMA resources
45  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
46  */
48 {
50 
51  if (cfg->transport_type == DOCA_RDMA_TRANSPORT_TYPE_RC) {
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 responder", cfg->local_connection_desc_path);
62  }
63 
65  "Please copy %s and %s from the receiver and then press enter after pressing enter in the responder side",
66  cfg->remote_connection_desc_path,
67  cfg->remote_resource_desc_path);
68 
69  /* Wait for enter */
71 
72  /* Read the remote RDMA connection details */
73  result = read_file(cfg->remote_connection_desc_path,
76  if (result != DOCA_SUCCESS) {
77  DOCA_LOG_ERR("Failed to read the remote RDMA connection details: %s", doca_error_get_descr(result));
78  return result;
79  }
80 
81  /* Read the remote mmap connection details */
82  result = read_file(cfg->remote_resource_desc_path,
85  if (result != DOCA_SUCCESS) {
86  DOCA_LOG_ERR("Failed to read the remote RDMA mmap connection details: %s",
88  return result;
89  }
90 
91  return result;
92 }
93 
94 /*
95  * RDMA write with immediate task completed callback
96  *
97  * @rdma_write_imm_task [in]: Completed task
98  * @task_user_data [in]: doca_data from the task
99  * @ctx_user_data [in]: doca_data from the context
100  */
101 static void rdma_write_imm_completed_callback(struct doca_rdma_task_write_imm *rdma_write_imm_task,
102  union doca_data task_user_data,
103  union doca_data ctx_user_data)
104 {
105  struct rdma_resources *resources = (struct rdma_resources *)ctx_user_data.ptr;
107  doca_error_t result = DOCA_SUCCESS, tmp_result;
108 
109  DOCA_LOG_INFO("RDMA write task with immediate was done Successfully");
110  DOCA_LOG_INFO("Written to responder \"%s\" with immediate value %u",
113 
114  doca_task_free(doca_rdma_task_write_imm_as_task(rdma_write_imm_task));
116  if (tmp_result != DOCA_SUCCESS) {
117  DOCA_LOG_ERR("Failed to decrease dst_buf count: %s", doca_error_get_descr(tmp_result));
118  DOCA_ERROR_PROPAGATE(result, tmp_result);
119  }
121  if (tmp_result != DOCA_SUCCESS) {
122  DOCA_LOG_ERR("Failed to decrease src_buf count: %s", doca_error_get_descr(tmp_result));
123  DOCA_ERROR_PROPAGATE(result, tmp_result);
124  }
125 
126  /* Update that an error was encountered, if any */
128 
130  /* Stop context once all tasks are completed */
131  if (resources->num_remaining_tasks == 0) {
132  if (resources->cfg->use_rdma_cm == true)
135  }
136 }
137 
138 /*
139  * RDMA write with immediate task error callback
140  *
141  * @rdma_write_imm_task [in]: failed task
142  * @task_user_data [in]: doca_data from the task
143  * @ctx_user_data [in]: doca_data from the context
144  */
145 static void rdma_write_imm_error_callback(struct doca_rdma_task_write_imm *rdma_write_imm_task,
146  union doca_data task_user_data,
147  union doca_data ctx_user_data)
148 {
149  struct rdma_resources *resources = (struct rdma_resources *)ctx_user_data.ptr;
150  struct doca_task *task = doca_rdma_task_write_imm_as_task(rdma_write_imm_task);
153 
154  /* Update that an error was encountered */
157  DOCA_LOG_ERR("RDMA write with immediate task failed: %s", doca_error_get_descr(result));
158 
160  if (result != DOCA_SUCCESS)
161  DOCA_LOG_ERR("Failed to decrease dst_buf count: %s", doca_error_get_descr(result));
163  if (result != DOCA_SUCCESS)
164  DOCA_LOG_ERR("Failed to decrease src_buf count: %s", doca_error_get_descr(result));
165  doca_task_free(task);
166 
168  /* Stop context once all tasks are completed */
169  if (resources->num_remaining_tasks == 0) {
170  if (resources->cfg->use_rdma_cm == true)
173  }
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 
186  if (resources->cfg->use_rdma_cm == true)
187  return rdma_cm_connect(resources);
188 
189  /* Export RDMA connection details */
193  &(resources->connections[0]));
194  if (result != DOCA_SUCCESS) {
195  DOCA_LOG_ERR("Failed to export RDMA: %s", doca_error_get_descr(result));
196  return result;
197  }
198 
199  /* write and read connection details to the responder */
201  if (result != DOCA_SUCCESS) {
202  DOCA_LOG_ERR("Failed to write and read connection details from responder: %s",
204  return result;
205  }
206 
207  /* Connect RDMA */
211  resources->connections[0]);
212  if (result != DOCA_SUCCESS)
213  DOCA_LOG_ERR("Failed to connect the requester's RDMA to the responder's RDMA: %s",
215 
216  return result;
217 }
218 
219 /*
220  * Prepare and submit RDMA write with immediate task
221  *
222  * @resources [in]: RDMA resources
223  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
224  */
226 {
227  struct doca_rdma_task_write_imm *rdma_write_imm_task = NULL;
228  union doca_data task_user_data = {0};
229  char *remote_mmap_range;
230  size_t remote_mmap_range_len;
231  void *src_buf_data;
232  size_t write_string_len = strlen(resources->cfg->write_string) + 1;
233  doca_error_t result, tmp_result;
234 
235  /* Create remote mmap */
240  &(resources->remote_mmap));
241  if (result != DOCA_SUCCESS) {
242  DOCA_LOG_ERR("Failed to create mmap from export: %s", doca_error_get_descr(result));
243  return result;
244  }
245 
246  /* Get the remote mmap memory range */
247  result = doca_mmap_get_memrange(resources->remote_mmap, (void **)&remote_mmap_range, &remote_mmap_range_len);
248  if (result != DOCA_SUCCESS) {
249  DOCA_LOG_ERR("Failed to get DOCA memory map range: %s", doca_error_get_descr(result));
250  return result;
251  }
252 
253  /* Add src buffer to DOCA buffer inventory from the remote mmap */
255  resources->mmap,
257  write_string_len,
258  &resources->src_buf);
259  if (result != DOCA_SUCCESS) {
260  DOCA_LOG_ERR("Failed to allocate DOCA buffer to DOCA buffer inventory: %s",
262  return result;
263  }
264 
265  /* Set data of src buffer to be the string we want to write */
266  result = doca_buf_get_data(resources->src_buf, &src_buf_data);
267  if (result != DOCA_SUCCESS) {
268  DOCA_LOG_ERR("Failed to get source buffer data: %s", doca_error_get_descr(result));
269  goto destroy_src_buf;
270  }
271  strncpy(src_buf_data, resources->cfg->write_string, write_string_len);
272 
273  /* Add dst buffer to DOCA buffer inventory */
276  remote_mmap_range,
277  write_string_len,
278  &resources->dst_buf);
279  if (result != DOCA_SUCCESS) {
280  DOCA_LOG_ERR("Failed to allocate DOCA buffer to DOCA buffer inventory: %s",
282  goto destroy_src_buf;
283  }
284 
285  /* Include first_encountered_error in user data of task to be used in the callbacks */
286  task_user_data.ptr = &(resources->first_encountered_error);
287  /* Allocate and construct RDMA write with immediate task */
293  task_user_data,
294  &rdma_write_imm_task);
295  if (result != DOCA_SUCCESS) {
296  DOCA_LOG_ERR("Failed to allocate RDMA write with immediate task: %s", doca_error_get_descr(result));
297  goto destroy_dst_buf;
298  }
299 
300  /* Submit RDMA write with immediate task */
302  "Submitting RDMA write with immediate task that writes \"%s\" with immediate value %u to responder",
307  if (result != DOCA_SUCCESS) {
308  DOCA_LOG_ERR("Failed to submit RDMA write with immediate task: %s", doca_error_get_descr(result));
309  goto free_task;
310  }
311 
312  return result;
313 
314 free_task:
315  doca_task_free(doca_rdma_task_write_imm_as_task(rdma_write_imm_task));
316 destroy_dst_buf:
318  if (tmp_result != DOCA_SUCCESS) {
319  DOCA_LOG_ERR("Failed to decrease dst_buf count: %s", doca_error_get_descr(tmp_result));
320  DOCA_ERROR_PROPAGATE(result, tmp_result);
321  }
322 destroy_src_buf:
324  if (tmp_result != DOCA_SUCCESS) {
325  DOCA_LOG_ERR("Failed to decrease src_buf count: %s", doca_error_get_descr(tmp_result));
326  DOCA_ERROR_PROPAGATE(result, tmp_result);
327  }
328  return result;
329 }
330 
331 /*
332  * RDMA write with immediate requester state change callback
333  * This function represents the state machine for this RDMA program
334  *
335  * @user_data [in]: doca_data from the context
336  * @ctx [in]: DOCA context
337  * @prev_state [in]: Previous DOCA context state
338  * @next_state [in]: Next DOCA context state
339  */
341  struct doca_ctx *ctx,
342  enum doca_ctx_states prev_state,
343  enum doca_ctx_states next_state)
344 {
345  struct rdma_resources *resources = (struct rdma_resources *)user_data.ptr;
346  struct rdma_config *cfg = resources->cfg;
348  (void)prev_state;
349  (void)ctx;
350 
351  switch (next_state) {
353  DOCA_LOG_INFO("RDMA context entered starting state");
354  break;
356  DOCA_LOG_INFO("RDMA context is running");
357 
359  if (result != DOCA_SUCCESS) {
360  DOCA_LOG_ERR("rdma_write_imm_requester_export_and_connect() failed: %s",
362  break;
363  } else
364  DOCA_LOG_INFO("RDMA context finished initialization");
365 
366  if (cfg->use_rdma_cm == true)
367  break;
368 
370  if (result != DOCA_SUCCESS)
371  DOCA_LOG_ERR("rdma_write_imm_prepare_and_submit_task() failed: %s",
373  break;
382  DOCA_LOG_INFO("RDMA context entered into stopping state. Any inflight tasks will be flushed");
383  break;
384  case DOCA_CTX_STATE_IDLE:
385  DOCA_LOG_INFO("RDMA context has been stopped");
386 
387  /* We can stop progressing the PE */
388  resources->run_pe_progress = false;
389  break;
390  default:
391  break;
392  }
393 
394  /* If something failed - update that an error was encountered and stop the ctx */
395  if (result != DOCA_SUCCESS) {
397  (void)doca_ctx_stop(ctx);
398  }
399 }
400 
401 /*
402  * Requester side of the RDMA write immediate
403  *
404  * @cfg [in]: Configuration parameters
405  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
406  */
408 {
409  struct rdma_resources resources = {0};
410  union doca_data ctx_user_data = {0};
411  const uint32_t mmap_permissions = DOCA_ACCESS_FLAG_LOCAL_READ_WRITE;
412  const uint32_t rdma_permissions = DOCA_ACCESS_FLAG_LOCAL_READ_WRITE;
413  struct timespec ts = {
414  .tv_sec = 0,
415  .tv_nsec = SLEEP_IN_NANOS,
416  };
417  doca_error_t result, tmp_result;
418 
419  /* Allocating resources */
421  mmap_permissions,
422  rdma_permissions,
424  &resources);
425  if (result != DOCA_SUCCESS) {
426  DOCA_LOG_ERR("Failed to allocate RDMA Resources: %s", doca_error_get_descr(result));
427  return result;
428  }
429 
434  if (result != DOCA_SUCCESS) {
435  DOCA_LOG_ERR("Unable to set configurations for RDMA write task: %s", doca_error_get_descr(result));
436  goto destroy_resources;
437  }
438 
440  if (result != DOCA_SUCCESS) {
441  DOCA_LOG_ERR("Unable to set state change callback for RDMA context: %s", doca_error_get_descr(result));
442  goto destroy_resources;
443  }
444 
445  /* Create DOCA buffer inventory */
447  if (result != DOCA_SUCCESS) {
448  DOCA_LOG_ERR("Failed to create DOCA buffer inventory: %s", doca_error_get_descr(result));
449  goto destroy_resources;
450  }
451 
452  /* Start DOCA buffer inventory */
454  if (result != DOCA_SUCCESS) {
455  DOCA_LOG_ERR("Failed to start DOCA buffer inventory: %s", doca_error_get_descr(result));
456  goto destroy_buf_inventory;
457  }
458 
459  if (cfg->use_rdma_cm == true) {
460  resources.is_requester = true;
464  /* need_send_mmap_info */ false,
465  /* need_recv_mmap_info */ true);
466  if (result != DOCA_SUCCESS) {
467  DOCA_LOG_ERR("Failed to config RDMA CM callbacks and negotiation functions: %s",
469  goto destroy_buf_inventory;
470  }
471  }
472 
473  /* Include the program's resources in user data of context to be used in callbacks */
474  ctx_user_data.ptr = &(resources);
476  if (result != DOCA_SUCCESS) {
477  DOCA_LOG_ERR("Failed to set context user data: %s", doca_error_get_descr(result));
478  goto destroy_resources;
479  }
480 
481  /* Start RDMA context */
483  if (result != DOCA_SUCCESS) {
484  DOCA_LOG_ERR("Failed to start RDMA context: %s", doca_error_get_descr(result));
485  goto stop_buf_inventory;
486  }
487 
488  /*
489  * Run the progress engine which will run the state machine defined in
490  * rdma_write_imm_requester_state_change_callback() When the context moves to idle, the context change callback
491  * call will signal to stop running the progress engine.
492  */
493  while (resources.run_pe_progress) {
494  if (doca_pe_progress(resources.pe) == 0)
495  nanosleep(&ts, &ts);
496  }
497 
498  /* Assign the result we update in the callbacks */
500 
501 stop_buf_inventory:
503  if (tmp_result != DOCA_SUCCESS) {
504  DOCA_LOG_ERR("Failed to stop DOCA buffer inventory: %s", doca_error_get_descr(tmp_result));
505  DOCA_ERROR_PROPAGATE(result, tmp_result);
506  }
507 destroy_buf_inventory:
509  if (tmp_result != DOCA_SUCCESS) {
510  DOCA_LOG_ERR("Failed to destroy DOCA buffer inventory: %s", doca_error_get_descr(tmp_result));
511  DOCA_ERROR_PROPAGATE(result, tmp_result);
512  }
513 destroy_resources:
514  tmp_result = destroy_rdma_resources(&resources, cfg);
515  if (tmp_result != DOCA_SUCCESS) {
516  DOCA_LOG_ERR("Failed to destroy DOCA RDMA resources: %s", doca_error_get_descr(tmp_result));
517  DOCA_ERROR_PROPAGATE(result, tmp_result);
518  }
519  return result;
520 }
#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 doca_error_t doca_rdma_task_write_imm_set_conf(struct doca_rdma *rdma, doca_rdma_task_write_imm_completion_cb_t successful_task_completion_cb, doca_rdma_task_write_imm_completion_cb_t error_task_completion_cb, uint32_t num_tasks)
This method sets the write with immediate tasks configuration.
DOCA_EXPERIMENTAL doca_error_t doca_rdma_task_write_imm_allocate_init(struct doca_rdma *rdma, struct doca_rdma_connection *rdma_connection, const struct doca_buf *src_buf, struct doca_buf *dst_buf, doca_be32_t immediate_data, union doca_data user_data, struct doca_rdma_task_write_imm **task)
This method allocates and initializes a write with immediate task.
DOCA_EXPERIMENTAL struct doca_task * doca_rdma_task_write_imm_as_task(struct doca_rdma_task_write_imm *task)
This method converts a write with immediate task to a doca_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_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_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
doca_error_t rdma_write_immediate_requester(struct rdma_config *cfg)
static doca_error_t rdma_write_imm_requester_export_and_connect(struct rdma_resources *resources)
static doca_error_t rdma_write_imm_prepare_and_submit_task(struct rdma_resources *resources)
static void rdma_write_imm_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 doca_error_t write_read_connection(struct rdma_config *cfg, struct rdma_resources *resources)
static void rdma_write_imm_error_callback(struct doca_rdma_task_write_imm *rdma_write_imm_task, union doca_data task_user_data, union doca_data ctx_user_data)
static void rdma_write_imm_completed_callback(struct doca_rdma_task_write_imm *rdma_write_imm_task, union doca_data task_user_data, union doca_data ctx_user_data)
DOCA_LOG_REGISTER(RDMA_WRITE_IMMEDIATE_REQUESTER::SAMPLE)
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