| NVIDIA DOCA SDK | Data Center on a Chip Framework Documentation |
#include <stdio.h>#include <stdlib.h>#include <stdint.h>#include <stdbool.h>#include <doca_mmap.h>#include <doca_buf.h>#include <doca_buf_inventory.h>#include <doca_ctx.h>#include <doca_dma.h>#include <doca_types.h>#include <doca_log.h>#include <doca_pe.h>#include <doca_mmap_advise.h>#include <samples/common.h>
Go to the source code of this file.
Data Structures | |
| struct | cache_invalidate_sample_state |
Macros | |
| #define | EXIT_ON_FAILURE(_expression_) |
| #define | NUM_TASKS (1) |
| #define | DMA_BUFFER_SIZE (1024) |
| #define | BUFFER_SIZE (DMA_BUFFER_SIZE * 2 * NUM_TASKS) |
| #define | BUF_INVENTORY_SIZE (NUM_TASKS * 2) |
| #define BUF_INVENTORY_SIZE (NUM_TASKS * 2) |
Definition at line 66 of file cache_invalidate_sample.c.
| #define BUFFER_SIZE (DMA_BUFFER_SIZE * 2 * NUM_TASKS) |
Definition at line 65 of file cache_invalidate_sample.c.
| #define DMA_BUFFER_SIZE (1024) |
Definition at line 64 of file cache_invalidate_sample.c.
| #define EXIT_ON_FAILURE | ( | _expression_ | ) |
This sample demonstrates how to invalidate a cache of a buffer after DMA operation This macro is used to minimize code size. The macro runs an expression and returns error if the expression status is not DOCA_SUCCESS
Definition at line 53 of file cache_invalidate_sample.c.
| #define NUM_TASKS (1) |
Definition at line 63 of file cache_invalidate_sample.c.
|
static |
Allocates a buffer that will be used for the source and destination buffers.
@state [in]: sample state
Definition at line 103 of file cache_invalidate_sample.c.
|
static |
This method allocate the DMA tasks but does not submit them. This is a sample choice. A task can be submitted immediately after it is allocated.
@state [in]: sample state
Definition at line 395 of file cache_invalidate_sample.c.
|
static |
This method allocate the DMA tasks but does not submit them. This is a sample choice. A task can be submitted immediately after it is allocated.
@state [in]: sample state
Using doca_buf_inventory_buf_get_by_addr leaves the buffer head uninitialized. The DMA context will set the head and length at the task completion.
Definition at line 357 of file cache_invalidate_sample.c.
|
static |
Definition at line 281 of file cache_invalidate_sample.c.
|
static |
Definition at line 302 of file cache_invalidate_sample.c.
|
static |
Definition at line 120 of file cache_invalidate_sample.c.
|
static |
This method cleans up the sample resources in reverse order of their creation. This method does not check for destroy return values for simplify. Real code should check the return value and act accordingly (e.g. if doca_ctx_stop failed with DOCA_ERROR_IN_PROGRESS it means that some contexts are still added or even that there are still in flight tasks in the progress engine).
@state [in]: sample state
Definition at line 458 of file cache_invalidate_sample.c.
|
static |
Create buffer inventory, initialize and start it.
@state [in]: sample state
Definition at line 174 of file cache_invalidate_sample.c.
|
static |
Create DMA
@state [in]: sample state
The ctx user data is received in the task completion callback. Setting the state to the user data binds the program to the callback. See dma_memcpy_completed_callback for usage.
Definition at line 246 of file cache_invalidate_sample.c.
|
static |
Create MMAP, initialize and start it.
@state [in]: sample state
Definition at line 155 of file cache_invalidate_sample.c.
|
static |
Create MMAP advise
@state [in]: sample state
The ctx user data is received in the task completion callback. Setting the state to the user data binds the program to the callback. See cache_invalidate_completed_callback for usage.
Definition at line 322 of file cache_invalidate_sample.c.
|
static |
Creates a progress engine
@state [in]: sample state
Definition at line 190 of file cache_invalidate_sample.c.
|
static |
Definition at line 206 of file cache_invalidate_sample.c.
|
static |
Definition at line 226 of file cache_invalidate_sample.c.
| DOCA_LOG_REGISTER | ( | CACHE_INVALIDATE::SAMPLE | ) |
|
static |
Opens a device that supports cache invalidate and DMA
@state [in]: sample state
Definition at line 140 of file cache_invalidate_sample.c.
|
static |
Poll the PE until all tasks are completed.
@state [in]: sample state
doca_pe_progress shall return 1 if a task was completed and 0 if not. In this case the sample does not have anything to do with the return value because it is a polling sample.
Definition at line 430 of file cache_invalidate_sample.c.
|
static |
Run the sample The method (and the method it calls) does not cleanup anything in case of failures. It assumes that cleanup is called after it at any case.
@state [in]: sample state
Definition at line 514 of file cache_invalidate_sample.c.
| doca_error_t run_cache_invalidate_sample | ( | void | ) |
Run the PE polling sample
Definition at line 540 of file cache_invalidate_sample.c.
|
static |
This method submits the DMA task
@state [in]: sample state
Definition at line 415 of file cache_invalidate_sample.c.