NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
rdma_read_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 MAX_BUFF_SIZE (256) /* Maximum DOCA buffer size */
35 
36 DOCA_LOG_REGISTER(RDMA_READ_REQUESTER::SAMPLE);
37 
38 /*
39  * Write the connection details for the responder to read,
40  * and read the connection details and the remote mmap details 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 responder 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 read task completed callback
96  *
97  * @rdma_read_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_read_completed_callback(struct doca_rdma_task_read *rdma_read_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;
106  void *dst_buf_data;
108  doca_error_t result = DOCA_SUCCESS, tmp_result;
109 
110  DOCA_LOG_INFO("RDMA read task was done Successfully");
111 
112  /* Read the data that was read */
113  result = doca_buf_get_data(resources->dst_buf, &dst_buf_data);
114  if (result != DOCA_SUCCESS) {
115  DOCA_LOG_ERR("Failed to get destination buffer data: %s", doca_error_get_descr(result));
116  goto free_task;
117  }
118 
119  /* Check if dst_buf_data is null terminated and of legal size */
120  if (strnlen(dst_buf_data, MAX_BUFF_SIZE) == MAX_BUFF_SIZE) {
121  DOCA_LOG_ERR("The message that we read from the responder exceeds buffer size %d", MAX_BUFF_SIZE);
123  goto free_task;
124  }
125 
126  DOCA_LOG_INFO("Read from responder: \"%s\"", (char *)dst_buf_data);
127 
128 free_task:
131  if (tmp_result != DOCA_SUCCESS) {
132  DOCA_LOG_ERR("Failed to decrease dst_buf count: %s", doca_error_get_descr(tmp_result));
133  DOCA_ERROR_PROPAGATE(result, tmp_result);
134  }
136  if (tmp_result != DOCA_SUCCESS) {
137  DOCA_LOG_ERR("Failed to decrease src_buf count: %s", doca_error_get_descr(tmp_result));
138  DOCA_ERROR_PROPAGATE(result, tmp_result);
139  }
140 
141  /* Update that an error was encountered, if any */
143 
145  /* Stop context once all tasks are completed */
146  if (resources->num_remaining_tasks == 0) {
147  if (resources->cfg->use_rdma_cm == true)
150  }
151 }
152 
153 /*
154  * RDMA read task error callback
155  *
156  * @rdma_read_task [in]: failed task
157  * @task_user_data [in]: doca_data from the task
158  * @ctx_user_data [in]: doca_data from the context
159  */
160 static void rdma_read_error_callback(struct doca_rdma_task_read *rdma_read_task,
161  union doca_data task_user_data,
162  union doca_data ctx_user_data)
163 {
164  struct rdma_resources *resources = (struct rdma_resources *)ctx_user_data.ptr;
165  struct doca_task *task = doca_rdma_task_read_as_task(rdma_read_task);
168 
169  /* Update that an error was encountered */
172  DOCA_LOG_ERR("RDMA read task failed: %s", doca_error_get_descr(result));
173 
174  doca_task_free(task);
176  if (result != DOCA_SUCCESS)
177  DOCA_LOG_ERR("Failed to decrease dst_buf count: %s", doca_error_get_descr(result));
179  if (result != DOCA_SUCCESS)
180  DOCA_LOG_ERR("Failed to decrease src_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  struct rdma_config *cfg = resources->cfg;
201 
202  if (cfg->use_rdma_cm == true)
203  return rdma_cm_connect(resources);
204 
205  /* Export RDMA connection details */
209  &(resources->connections[0]));
210  if (result != DOCA_SUCCESS) {
211  DOCA_LOG_ERR("Failed to export RDMA: %s", doca_error_get_descr(result));
212  return result;
213  }
214 
215  /* Write and read connection details from the responder */
217  if (result != DOCA_SUCCESS) {
218  DOCA_LOG_ERR("Failed to write and read connection details from the responder: %s",
220  return result;
221  }
222 
223  /* Connect RDMA */
227  resources->connections[0]);
228  if (result != DOCA_SUCCESS)
229  DOCA_LOG_ERR("Failed to connect the sender's RDMA to the responder's RDMA: %s",
231 
232  return result;
233 }
234 
235 /*
236  * Prepare and submit RDMA read task
237  *
238  * @resources [in]: RDMA resources
239  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
240  */
242 {
243  struct doca_rdma_task_read *rdma_read_task = NULL;
244  union doca_data task_user_data = {0};
245  char *remote_mmap_range;
246  size_t remote_mmap_range_len;
247  doca_error_t result, tmp_result;
248 
249  /* Create remote mmap */
254  &(resources->remote_mmap));
255  if (result != DOCA_SUCCESS) {
256  DOCA_LOG_ERR("Failed to create mmap from export: %s", doca_error_get_descr(result));
257  return result;
258  }
259 
260  /* Get the remote mmap memory range */
261  result = doca_mmap_get_memrange(resources->remote_mmap, (void **)&remote_mmap_range, &remote_mmap_range_len);
262  if (result != DOCA_SUCCESS) {
263  DOCA_LOG_ERR("Failed to get DOCA memory map range: %s", doca_error_get_descr(result));
264  return result;
265  }
266 
267  /* Add src buffer to DOCA buffer inventory from the remote mmap */
270  remote_mmap_range,
272  &resources->src_buf);
273  if (result != DOCA_SUCCESS) {
274  DOCA_LOG_ERR("Failed to allocate DOCA buffer to DOCA buffer inventory: %s",
276  return result;
277  }
278 
279  /* Add dst buffer to DOCA buffer inventory */
281  resources->mmap,
284  &resources->dst_buf);
285  if (result != DOCA_SUCCESS) {
286  DOCA_LOG_ERR("Failed to allocate DOCA buffer to DOCA buffer inventory: %s",
288  goto destroy_src_buf;
289  }
290 
291  /* Include first_encountered_error in user data of task to be used in the callbacks */
292  task_user_data.ptr = &(resources->first_encountered_error);
293  /* Allocate and construct RDMA read task */
298  task_user_data,
299  &rdma_read_task);
300  if (result != DOCA_SUCCESS) {
301  DOCA_LOG_ERR("Failed to allocate RDMA read task: %s", doca_error_get_descr(result));
302  goto destroy_dst_buf;
303  }
304 
305  /* Submit RDMA read task */
306  DOCA_LOG_INFO("Submitting RDMA read task");
309  if (result != DOCA_SUCCESS) {
310  DOCA_LOG_ERR("Failed to submit RDMA read task: %s", doca_error_get_descr(result));
311  goto free_task;
312  }
313 
314  return result;
315 
316 free_task:
318 destroy_dst_buf:
320  if (tmp_result != DOCA_SUCCESS) {
321  DOCA_LOG_ERR("Failed to decrease dst_buf count: %s", doca_error_get_descr(tmp_result));
322  DOCA_ERROR_PROPAGATE(result, tmp_result);
323  }
324 destroy_src_buf:
326  if (tmp_result != DOCA_SUCCESS) {
327  DOCA_LOG_ERR("Failed to decrease src_buf count: %s", doca_error_get_descr(tmp_result));
328  DOCA_ERROR_PROPAGATE(result, tmp_result);
329  }
330  return result;
331 }
332 
333 /*
334  * RDMA read requester state change callback
335  * This function represents the state machine for this RDMA program
336  *
337  * @user_data [in]: doca_data from the context
338  * @ctx [in]: DOCA context
339  * @prev_state [in]: Previous DOCA context state
340  * @next_state [in]: Next DOCA context state
341  */
342 static void rdma_read_requester_state_change_callback(const union doca_data user_data,
343  struct doca_ctx *ctx,
344  enum doca_ctx_states prev_state,
345  enum doca_ctx_states next_state)
346 {
347  struct rdma_resources *resources = (struct rdma_resources *)user_data.ptr;
348  struct rdma_config *cfg = resources->cfg;
350  (void)prev_state;
351 
352  switch (next_state) {
354  DOCA_LOG_INFO("RDMA context entered starting state");
355  break;
357  DOCA_LOG_INFO("RDMA context is running");
358 
360  if (result != DOCA_SUCCESS) {
361  DOCA_LOG_ERR("rdma_read_requester_export_and_connect() failed: %s",
363  break;
364  } else
365  DOCA_LOG_INFO("RDMA context finished initialization");
366 
367  if (cfg->use_rdma_cm == true)
368  break;
369 
371  if (result != DOCA_SUCCESS)
372  DOCA_LOG_ERR("rdma_read_prepare_and_submit_task() failed: %s", doca_error_get_descr(result));
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 read
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 read 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  /* Include the program's resources in user data of context to be used in callbacks */
446  ctx_user_data.ptr = &(resources);
448  if (result != DOCA_SUCCESS) {
449  DOCA_LOG_ERR("Failed to set context user data: %s", doca_error_get_descr(result));
450  goto destroy_resources;
451  }
452 
453  /* Create DOCA buffer inventory */
455  if (result != DOCA_SUCCESS) {
456  DOCA_LOG_ERR("Failed to create DOCA buffer inventory: %s", doca_error_get_descr(result));
457  goto destroy_resources;
458  }
459 
460  /* Start DOCA buffer inventory */
462  if (result != DOCA_SUCCESS) {
463  DOCA_LOG_ERR("Failed to start DOCA buffer inventory: %s", doca_error_get_descr(result));
464  goto destroy_buf_inventory;
465  }
466 
467  /* Set send&recv task configuration, they are used for transferring the mmap desc */
468  if (cfg->use_rdma_cm == true) {
469  resources.is_requester = true;
473  /* need_send_mmap_info */ false,
474  /* need_recv_mmap_info */ true);
475  if (result != DOCA_SUCCESS) {
476  DOCA_LOG_ERR("Failed to config RDMA CM callbacks and negotiation functions: %s",
478  goto destroy_buf_inventory;
479  }
480  }
481 
482  /* Start RDMA context */
484  if (result != DOCA_SUCCESS) {
485  DOCA_LOG_ERR("Failed to start RDMA context: %s", doca_error_get_descr(result));
486  goto stop_buf_inventory;
487  }
488 
489  /*
490  * Run the progress engine which will run the state machine defined in
491  * rdma_read_requester_state_change_callback() When the context moves to idle, the context change callback call
492  * will signal to stop running the progress engine.
493  */
494  while (resources.run_pe_progress) {
495  if (doca_pe_progress(resources.pe) == 0)
496  nanosleep(&ts, &ts);
497  }
498 
499  /* Assign the result we update in the callbacks */
501 
502 stop_buf_inventory:
504  if (tmp_result != DOCA_SUCCESS) {
505  DOCA_LOG_ERR("Failed to stop DOCA buffer inventory: %s", doca_error_get_descr(tmp_result));
506  DOCA_ERROR_PROPAGATE(result, tmp_result);
507  }
508 destroy_buf_inventory:
510  if (tmp_result != DOCA_SUCCESS) {
511  DOCA_LOG_ERR("Failed to destroy DOCA buffer inventory: %s", doca_error_get_descr(tmp_result));
512  DOCA_ERROR_PROPAGATE(result, tmp_result);
513  }
514 destroy_resources:
515  tmp_result = destroy_rdma_resources(&resources, cfg);
516  if (tmp_result != DOCA_SUCCESS) {
517  DOCA_LOG_ERR("Failed to destroy DOCA RDMA resources: %s", doca_error_get_descr(tmp_result));
518  DOCA_ERROR_PROPAGATE(result, tmp_result);
519  }
520  return result;
521 }
#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_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_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_read_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_read **task)
This method allocates and initializes a read task.
DOCA_EXPERIMENTAL doca_error_t doca_rdma_task_read_set_conf(struct doca_rdma *rdma, doca_rdma_task_read_completion_cb_t successful_task_completion_cb, doca_rdma_task_read_completion_cb_t error_task_completion_cb, uint32_t num_tasks)
This method sets the read 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 struct doca_task * doca_rdma_task_read_as_task(struct doca_rdma_task_read *task)
This method converts a read task to a doca_task.
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_cap_task_read_is_supported(const struct doca_devinfo *devinfo)
@ 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_read_completed_callback(struct doca_rdma_task_read *rdma_read_task, union doca_data task_user_data, union doca_data ctx_user_data)
#define MAX_BUFF_SIZE
static void rdma_read_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 rdma_read_prepare_and_submit_task(struct rdma_resources *resources)
static doca_error_t rdma_read_requester_export_and_connect(struct rdma_resources *resources)
DOCA_LOG_REGISTER(RDMA_READ_REQUESTER::SAMPLE)
doca_error_t rdma_read_requester(struct rdma_config *cfg)
static doca_error_t write_read_connection(struct rdma_config *cfg, struct rdma_resources *resources)
static void rdma_read_error_callback(struct doca_rdma_task_read *rdma_read_task, union doca_data task_user_data, union doca_data ctx_user_data)
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
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