NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
graph_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 <stdio.h>
27 #include <stdlib.h>
28 #include <stdint.h>
29 
30 #include <doca_mmap.h>
31 #include <doca_buf.h>
32 #include <doca_buf_inventory.h>
33 #include <doca_ctx.h>
34 #include <doca_pe.h>
35 #include <doca_dma.h>
36 #include <doca_graph.h>
37 #include <doca_types.h>
38 #include <doca_log.h>
39 
40 #include <samples/common.h>
41 
42 DOCA_LOG_REGISTER(GRAPH::SAMPLE);
43 
68 #define EXIT_ON_FAILURE(_expression_) \
69  { \
70  doca_error_t _status_ = _expression_; \
71 \
72  if (_status_ != DOCA_SUCCESS) { \
73  DOCA_LOG_ERR("%s failed with status %s", __func__, doca_error_get_descr(_status_)); \
74  return _status_; \
75  } \
76  }
77 
78 #define NUM_DMA_NODES 2
79 
80 #define NUM_GRAPH_INSTANCES 10
81 
82 #define DMA_BUFFER_SIZE 1024
83 
84 #define REQUIRED_ENTRY_SIZE (DMA_BUFFER_SIZE + (DMA_BUFFER_SIZE * NUM_DMA_NODES))
85 
86 #define BUFFER_SIZE (REQUIRED_ENTRY_SIZE * NUM_GRAPH_INSTANCES)
87 
88 /* One buffer for source + one buffer for each DMA node (destination) */
89 #define GRAPH_INSTANCE_NUM_BUFFERS (1 + NUM_DMA_NODES)
90 #define BUF_INVENTORY_SIZE (GRAPH_INSTANCE_NUM_BUFFERS * NUM_GRAPH_INSTANCES)
91 
97  uint32_t index; /* Index is used for printing */
98  struct doca_graph_instance *graph_instance;
99  struct doca_buf *source;
100  uint8_t *source_addr;
101 
102  struct doca_dma_task_memcpy *dma_task[NUM_DMA_NODES];
103  struct doca_buf *dma_dest[NUM_DMA_NODES];
105 };
106 
114  struct doca_dev *device;
115  struct doca_mmap *mmap;
116  struct doca_buf_inventory *inventory;
117  struct doca_pe *pe;
118  struct doca_ctx *contexts[NUM_DMA_NODES];
119  struct doca_dma *dma[NUM_DMA_NODES];
120 
126  uint8_t *buffer;
127  uint8_t *available_buffer; /* Points to the available location in the buffer, used during initialization */
128 
134  struct doca_graph *graph;
135  struct doca_graph_node *dma_node[NUM_DMA_NODES];
136  struct doca_graph_node *user_node;
137 
138  /* Array of graph instances. All will be submitted to the work queue at once */
140 
142 };
143 
151 {
152  DOCA_LOG_INFO("Allocating buffer");
153 
154  state->buffer = (uint8_t *)malloc(BUFFER_SIZE);
155  if (state->buffer == NULL)
156  return DOCA_ERROR_NO_MEMORY;
157 
158  state->available_buffer = state->buffer;
159 
160  return DOCA_SUCCESS;
161 }
162 
163 /*
164  * Check if DOCA device is DMA capable
165  *
166  * @devinfo [in]: Device to check
167  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
168  */
169 static doca_error_t check_dev_dma_capable(struct doca_devinfo *devinfo)
170 {
172 }
173 
181 {
182  DOCA_LOG_INFO("Opening device");
183 
185 
186  return DOCA_SUCCESS;
187 }
188 
196 {
197  DOCA_LOG_INFO("Creating progress engine");
198 
200 
201  return DOCA_SUCCESS;
202 }
203 
211 {
212  DOCA_LOG_INFO("Creating MMAP");
213 
216  EXIT_ON_FAILURE(doca_mmap_add_dev(state->mmap, state->device));
219 
220  return DOCA_SUCCESS;
221 }
222 
230 {
231  DOCA_LOG_INFO("Creating buf inventory");
232 
235 
236  return DOCA_SUCCESS;
237 }
238 
249 static void dma_task_completed_callback(struct doca_dma_task_memcpy *task,
250  union doca_data task_user_data,
251  union doca_data ctx_user_data)
252 {
253  (void)task;
254  (void)task_user_data;
255  (void)ctx_user_data;
256 }
257 
265 static doca_error_t create_dma(struct graph_sample_state *state, uint32_t idx)
266 {
267  DOCA_LOG_INFO("Creating DMA %d", idx);
268 
269  EXIT_ON_FAILURE(doca_dma_create(state->device, &state->dma[idx]));
270  state->contexts[idx] = doca_dma_as_ctx(state->dma[idx]);
271 
272  EXIT_ON_FAILURE(doca_pe_connect_ctx(state->pe, state->contexts[idx]));
273 
278 
279  return DOCA_SUCCESS;
280 }
281 
289 {
290  uint32_t i = 0;
291 
292  for (i = 0; i < NUM_DMA_NODES; i++)
293  EXIT_ON_FAILURE(create_dma(state, i));
294 
295  return DOCA_SUCCESS;
296 }
297 
306 {
307  uint32_t i = 0;
308 
309  DOCA_LOG_INFO("Starting contexts");
310 
311  for (i = 0; i < NUM_DMA_NODES; i++)
313 
314  return DOCA_SUCCESS;
315 }
316 
323 static void stop_contexts(struct graph_sample_state *state)
324 {
325  uint32_t i = 0;
326 
327  /* Assumption: this method is called when contexts can be stopped synchronously */
328  for (i = 0; i < NUM_DMA_NODES; i++)
329  if (state->contexts[i] != NULL)
330  (void)doca_ctx_stop(state->contexts[i]);
331 }
332 
342 {
343  uint32_t i = 0;
344 
345  struct graph_instance_data *instance = (struct graph_instance_data *)cookie;
346  size_t dma_length = 0;
347 
348  DOCA_LOG_INFO("Instance %d user callback", instance->index);
349 
350  for (i = 0; i < NUM_DMA_NODES; i++) {
351  EXIT_ON_FAILURE(doca_buf_get_data_len(instance->dma_dest[i], &dma_length));
352 
353  if (dma_length != DMA_BUFFER_SIZE) {
354  DOCA_LOG_ERR("DMA destination buffer length %zu should be %d", dma_length, DMA_BUFFER_SIZE);
355  return DOCA_ERROR_BAD_STATE;
356  }
357 
358  if (memcmp(instance->dma_dest_addr[i], instance->source_addr, dma_length) != 0) {
359  DOCA_LOG_ERR("DMA source and destination mismatch");
360  return DOCA_ERROR_BAD_STATE;
361  }
362  }
363 
364  return DOCA_SUCCESS;
365 }
366 
373 static void destroy_graph_instance(struct graph_sample_state *state, uint32_t index)
374 {
375  struct graph_instance_data *instance = &state->instances[index];
376  uint32_t i = 0;
377 
378  if (instance->graph_instance != NULL) {
380  instance->graph_instance = NULL;
381  }
382  for (i = 0; i < NUM_DMA_NODES; i++) {
383  if (instance->dma_task[i] != NULL) {
385  instance->dma_task[i] = NULL;
386  }
387 
388  if (instance->dma_dest[i] != NULL) {
389  (void)doca_buf_dec_refcount(instance->dma_dest[i], NULL);
390  instance->dma_dest[i] = NULL;
391  }
392  }
393 
394  if (instance->source != NULL) {
395  (void)doca_buf_dec_refcount(instance->source, NULL);
396  instance->source = NULL;
397  }
398 }
399 
408 static void graph_completion_callback(struct doca_graph_instance *graph_instance,
409  union doca_data instance_user_data,
410  union doca_data graph_user_data)
411 {
412  struct graph_sample_state *state = (struct graph_sample_state *)graph_user_data.ptr;
413  (void)graph_instance;
414  (void)instance_user_data;
415 
416  state->num_completed_instances++;
417 
418  /* Graph instance and tasks are destroyed at cleanup */
419 }
420 
432 {
433  union doca_data graph_user_data = {};
434  uint32_t i = 0;
435 
436  DOCA_LOG_INFO("Creating graph");
437 
438  EXIT_ON_FAILURE(doca_graph_create(state->pe, &state->graph));
439 
441 
442  /* Creating nodes and building the graph */
443  for (i = 0; i < NUM_DMA_NODES; i++) {
445 
446  /* Setting between the user node and the DMA node */
448  }
449 
450  /* Notice that the sample uses the same callback for success & failure. Program can supply different cb */
455 
456  graph_user_data.ptr = state;
457  EXIT_ON_FAILURE(doca_graph_set_user_data(state->graph, graph_user_data));
458 
459  /* Graph must be started before it is added to the work queue. The graph is validated during this call */
461 
462  return DOCA_SUCCESS;
463 }
464 
470 static void destroy_graph(struct graph_sample_state *state)
471 {
472  if (state->graph == NULL)
473  return;
474 
475  doca_graph_stop(state->graph);
476  doca_graph_destroy(state->graph);
477 }
478 
487 static doca_error_t create_graph_instance(struct graph_sample_state *state, uint32_t index)
488 {
489  struct graph_instance_data *instance = &state->instances[index];
490  union doca_data task_user_data = {};
491  union doca_data graph_instance_user_data = {};
492  uint32_t i = 0;
493 
494  instance->index = index;
495 
497 
498  /* Use doca_buf_inventory_buf_get_by_data to initialize the source buffer */
500  state->mmap,
501  state->available_buffer,
503  &instance->source));
504  memset(state->available_buffer, (index + 1), DMA_BUFFER_SIZE);
505  instance->source_addr = state->available_buffer;
507 
508  /* Initialize DMA tasks */
509  for (i = 0; i < NUM_DMA_NODES; i++) {
511  state->mmap,
512  state->available_buffer,
514  &instance->dma_dest[i]));
515  instance->dma_dest_addr[i] = state->available_buffer;
517 
519  instance->source,
520  instance->dma_dest[i],
521  task_user_data,
522  &instance->dma_task[i]));
525  state->dma_node[i],
526  doca_dma_task_memcpy_as_task(instance->dma_task[i])));
527  }
528 
529  /* Initialize user callback */
530  /* The sample uses the instance as a cookie. From there it can get all the information it needs */
532 
533  graph_instance_user_data.ptr = instance;
534  doca_graph_instance_set_user_data(instance->graph_instance, graph_instance_user_data);
535 
536  return DOCA_SUCCESS;
537 }
538 
546 {
547  uint32_t i = 0;
548 
549  DOCA_LOG_INFO("Creating graph instances");
550 
551  for (i = 0; i < NUM_GRAPH_INSTANCES; i++)
553 
554  return DOCA_SUCCESS;
555 }
556 
562 static void destroy_graph_instances(struct graph_sample_state *state)
563 {
564  uint32_t i = 0;
565 
566  for (i = 0; i < NUM_GRAPH_INSTANCES; i++)
567  destroy_graph_instance(state, i);
568 }
569 
577 {
578  uint32_t i = 0;
579 
580  DOCA_LOG_INFO("Submitting all graph instances");
581 
582  for (i = 0; i < NUM_GRAPH_INSTANCES; i++)
584 
585  return DOCA_SUCCESS;
586 }
587 
593 static void poll_for_completion(struct graph_sample_state *state)
594 {
595  state->num_completed_instances = 0;
596 
597  DOCA_LOG_INFO("Waiting until all instances are complete");
598 
600  (void)doca_pe_progress(state->pe);
601 
602  DOCA_LOG_INFO("All instances completed");
603 }
604 
612 static void cleanup(struct graph_sample_state *state)
613 {
614  uint32_t i = 0;
615 
617 
618  destroy_graph(state);
619 
620  stop_contexts(state);
621 
622  for (i = 0; i < NUM_DMA_NODES; i++)
623  if (state->dma[i] != NULL)
624  (void)doca_dma_destroy(state->dma[i]);
625 
626  if (state->pe != NULL)
627  (void)doca_pe_destroy(state->pe);
628 
629  if (state->inventory != NULL) {
630  (void)doca_buf_inventory_stop(state->inventory);
632  }
633 
634  if (state->mmap != NULL) {
635  (void)doca_mmap_stop(state->mmap);
636  (void)doca_mmap_destroy(state->mmap);
637  }
638 
639  if (state->device != NULL)
640  (void)doca_dev_close(state->device);
641 
642  if (state->buffer != NULL)
643  free(state->buffer);
644 }
645 
654 static doca_error_t run(struct graph_sample_state *state)
655 {
660  EXIT_ON_FAILURE(create_pe(state));
666  poll_for_completion(state);
667 
668  return DOCA_SUCCESS;
669 }
670 
677 {
678  struct graph_sample_state state = {0};
679  doca_error_t status = run(&state);
680 
681  cleanup(&state);
682 
683  return status;
684 }
#define NULL
Definition: __stddef_null.h:26
doca_error_t open_doca_device_with_capabilities(tasks_check func, struct doca_dev **retval)
Definition: common.c:188
uint64_t cookie
static doca_error_t create_graph_instances(struct graph_sample_state *state)
Definition: graph_sample.c:545
#define EXIT_ON_FAILURE(_expression_)
Definition: graph_sample.c:68
static doca_error_t create_mmap(struct graph_sample_state *state)
Definition: graph_sample.c:210
static doca_error_t run(struct graph_sample_state *state)
Definition: graph_sample.c:654
#define BUF_INVENTORY_SIZE
Definition: graph_sample.c:90
#define NUM_GRAPH_INSTANCES
Definition: graph_sample.c:80
static void destroy_graph_instance(struct graph_sample_state *state, uint32_t index)
Definition: graph_sample.c:373
static doca_error_t allocate_buffer(struct graph_sample_state *state)
Definition: graph_sample.c:150
#define NUM_DMA_NODES
Definition: graph_sample.c:78
static void cleanup(struct graph_sample_state *state)
Definition: graph_sample.c:612
static void stop_contexts(struct graph_sample_state *state)
Definition: graph_sample.c:323
static doca_error_t start_contexts(struct graph_sample_state *state)
Definition: graph_sample.c:305
#define BUFFER_SIZE
Definition: graph_sample.c:86
static void destroy_graph_instances(struct graph_sample_state *state)
Definition: graph_sample.c:562
static void poll_for_completion(struct graph_sample_state *state)
Definition: graph_sample.c:593
doca_error_t run_graph_sample(void)
Definition: graph_sample.c:676
static void dma_task_completed_callback(struct doca_dma_task_memcpy *task, union doca_data task_user_data, union doca_data ctx_user_data)
Definition: graph_sample.c:249
static doca_error_t submit_instances(struct graph_sample_state *state)
Definition: graph_sample.c:576
static doca_error_t create_pe(struct graph_sample_state *state)
Definition: graph_sample.c:195
static doca_error_t create_graph_instance(struct graph_sample_state *state, uint32_t index)
Definition: graph_sample.c:487
static doca_error_t user_node_callback(void *cookie)
Definition: graph_sample.c:341
static void destroy_graph(struct graph_sample_state *state)
Definition: graph_sample.c:470
static doca_error_t create_dma(struct graph_sample_state *state, uint32_t idx)
Definition: graph_sample.c:265
static doca_error_t create_graph(struct graph_sample_state *state)
Definition: graph_sample.c:431
#define DMA_BUFFER_SIZE
Definition: graph_sample.c:82
static doca_error_t create_dmas(struct graph_sample_state *state)
Definition: graph_sample.c:288
static doca_error_t check_dev_dma_capable(struct doca_devinfo *devinfo)
Definition: graph_sample.c:169
static doca_error_t open_device(struct graph_sample_state *state)
Definition: graph_sample.c:180
DOCA_LOG_REGISTER(GRAPH::SAMPLE)
static doca_error_t create_buf_inventory(struct graph_sample_state *state)
Definition: graph_sample.c:229
static void graph_completion_callback(struct doca_graph_instance *graph_instance, union doca_data instance_user_data, union doca_data graph_user_data)
Definition: graph_sample.c:408
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_len(const struct doca_buf *buf, size_t *data_len)
Get buffer's data length.
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_stop(struct doca_ctx *ctx)
Stops the context allowing reconfiguration.
DOCA_STABLE doca_error_t doca_dev_close(struct doca_dev *dev)
Destroy allocated local device instance.
DOCA_STABLE struct doca_task * doca_dma_task_memcpy_as_task(struct doca_dma_task_memcpy *task)
This method converts a memcpy task to doca_task.
DOCA_STABLE doca_error_t doca_dma_task_memcpy_alloc_init(struct doca_dma *dma, const struct doca_buf *src, struct doca_buf *dst, union doca_data user_data, struct doca_dma_task_memcpy **task)
This method allocates and initializes a DMA memcpy task.
DOCA_STABLE struct doca_ctx * doca_dma_as_ctx(struct doca_dma *dma)
DOCA_STABLE doca_error_t doca_dma_task_memcpy_set_conf(struct doca_dma *dma, doca_dma_task_memcpy_completion_cb_t task_completion_cb, doca_dma_task_memcpy_completion_cb_t task_error_cb, uint32_t num_memcpy_tasks)
This method sets the DMA memcpy tasks configuration.
DOCA_STABLE doca_error_t doca_dma_cap_task_memcpy_is_supported(const struct doca_devinfo *devinfo)
DOCA_STABLE doca_error_t doca_dma_create(struct doca_dev *dev, struct doca_dma **dma)
DOCA_STABLE doca_error_t doca_dma_destroy(struct doca_dma *dma)
enum doca_error doca_error_t
DOCA API return codes.
@ DOCA_ERROR_BAD_STATE
Definition: doca_error.h:56
@ DOCA_SUCCESS
Definition: doca_error.h:38
@ DOCA_ERROR_NO_MEMORY
Definition: doca_error.h:45
DOCA_EXPERIMENTAL doca_error_t doca_graph_instance_set_ctx_node_data(struct doca_graph_instance *graph_instance, struct doca_graph_node *node, struct doca_task *task)
Set context node data.
DOCA_EXPERIMENTAL doca_error_t doca_graph_stop(struct doca_graph *graph)
Stop a graph.
DOCA_EXPERIMENTAL doca_error_t doca_graph_instance_set_user_node_data(struct doca_graph_instance *graph_instance, struct doca_graph_node *node, void *cookie)
Set user node data.
DOCA_EXPERIMENTAL doca_error_t doca_graph_instance_destroy(struct doca_graph_instance *graph_instance)
Destroy graph instance.
DOCA_EXPERIMENTAL doca_error_t doca_graph_instance_submit(struct doca_graph_instance *graph_instance)
Submit graph instance to a progress engine.
DOCA_EXPERIMENTAL doca_error_t doca_graph_create(struct doca_pe *pe, struct doca_graph **graph)
Creates a DOCA graph.
DOCA_EXPERIMENTAL doca_error_t doca_graph_set_conf(struct doca_graph *graph, doca_graph_completion_cb_t graph_completion_cb, doca_graph_completion_cb_t graph_error_cb, uint32_t num_instances)
Set graph configuration.
DOCA_EXPERIMENTAL doca_error_t doca_graph_start(struct doca_graph *graph)
Start a graph.
DOCA_EXPERIMENTAL doca_error_t doca_graph_add_dependency(struct doca_graph *graph, struct doca_graph_node *from, struct doca_graph_node *to)
Set dependencies.
DOCA_EXPERIMENTAL doca_error_t doca_graph_node_create_from_ctx(struct doca_graph *graph, const struct doca_ctx *ctx, struct doca_graph_node **node)
Create a context node.
DOCA_EXPERIMENTAL doca_error_t doca_graph_destroy(struct doca_graph *graph)
Destroys a previously created doca_graph.
DOCA_EXPERIMENTAL doca_error_t doca_graph_instance_set_user_data(struct doca_graph_instance *graph_instance, union doca_data user_data)
Set user data to the graph instance.
DOCA_EXPERIMENTAL doca_error_t doca_graph_node_create_from_user(struct doca_graph *graph, doca_graph_user_node_cb_t cb, struct doca_graph_node **node)
Create a user node.
DOCA_EXPERIMENTAL doca_error_t doca_graph_set_user_data(struct doca_graph *graph, union doca_data user_data)
Set user data to the graph.
DOCA_EXPERIMENTAL doca_error_t doca_graph_instance_create(const struct doca_graph *graph, struct doca_graph_instance **graph_instance)
Create a graph instance.
#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_set_memrange(struct doca_mmap *mmap, void *addr, size_t len)
Set the memory range of DOCA memory map.
DOCA_STABLE doca_error_t doca_mmap_destroy(struct doca_mmap *mmap)
Destroy DOCA Memory Map structure.
DOCA_STABLE doca_error_t doca_mmap_create(struct doca_mmap **mmap)
Allocates zero size memory map object with default/unset attributes.
DOCA_STABLE doca_error_t doca_mmap_set_permissions(struct doca_mmap *mmap, uint32_t access_mask)
Set access flags of the registered memory.
DOCA_STABLE doca_error_t doca_mmap_start(struct doca_mmap *mmap)
Start DOCA Memory Map.
DOCA_STABLE doca_error_t doca_mmap_stop(struct doca_mmap *mmap)
Stop DOCA Memory Map.
DOCA_STABLE doca_error_t doca_mmap_add_dev(struct doca_mmap *mmap, struct doca_dev *dev)
Register DOCA memory map on a given device.
DOCA_STABLE doca_error_t doca_pe_destroy(struct doca_pe *pe)
Destroy doca progress engine.
DOCA_STABLE doca_error_t doca_pe_connect_ctx(struct doca_pe *pe, struct doca_ctx *ctx)
This method connects a context to a progress engine.
DOCA_STABLE uint8_t doca_pe_progress(struct doca_pe *pe)
Run the progress engine.
DOCA_STABLE doca_error_t doca_pe_create(struct doca_pe **pe)
Creates DOCA progress engine.
DOCA_STABLE void doca_task_free(struct doca_task *task)
Free a task back to where it was allocated from.
@ DOCA_ACCESS_FLAG_LOCAL_READ_WRITE
Definition: doca_types.h:83
uint8_t * dma_dest_addr[NUM_DMA_NODES]
Definition: graph_sample.c:104
struct doca_graph_instance * graph_instance
Definition: graph_sample.c:98
struct doca_dma_task_memcpy * dma_task[NUM_DMA_NODES]
Definition: graph_sample.c:102
struct doca_buf * source
Definition: graph_sample.c:99
struct doca_buf * dma_dest[NUM_DMA_NODES]
Definition: graph_sample.c:103
struct doca_buf_inventory * inventory
Definition: graph_sample.c:116
struct doca_ctx * contexts[NUM_DMA_NODES]
Definition: graph_sample.c:118
uint32_t num_completed_instances
Definition: graph_sample.c:141
struct graph_instance_data instances[NUM_GRAPH_INSTANCES]
Definition: graph_sample.c:139
struct doca_mmap * mmap
Definition: graph_sample.c:115
struct doca_dev * device
Definition: graph_sample.c:114
uint8_t * available_buffer
Definition: graph_sample.c:127
struct doca_dma * dma[NUM_DMA_NODES]
Definition: graph_sample.c:119
struct doca_graph * graph
Definition: graph_sample.c:134
struct doca_pe * pe
Definition: graph_sample.c:117
struct doca_graph_node * user_node
Definition: graph_sample.c:136
struct doca_graph_node * dma_node[NUM_DMA_NODES]
Definition: graph_sample.c:135
Convenience type for representing opaque data.
Definition: doca_types.h:56
void * ptr
Definition: doca_types.h:57