43 #define SLEEP_IN_NANOS (10 * 1000)
55 const char *dst_range_end = dst_buffer +
length;
56 const char *src_range_end = src_buffer +
length;
58 if (((dst_buffer >= src_buffer) && (dst_buffer < src_range_end)) ||
59 ((src_buffer >= dst_buffer) && (src_buffer < dst_range_end))) {
105 struct doca_dma_task_memcpy *dma_task =
NULL;
106 struct doca_task *task =
NULL;
108 struct doca_buf *src_doca_buf =
NULL;
109 struct doca_buf *dst_doca_buf =
NULL;
110 struct timespec ts = {
117 DOCA_LOG_ERR(
"Invalid input values, addresses and sizes must not be 0");
138 goto destroy_resources;
144 goto destroy_resources;
160 memset(dst_buffer, 0,
length);
171 DOCA_LOG_ERR(
"Unable to acquire DOCA buffer representing source buffer: %s",
185 DOCA_LOG_ERR(
"Unable to acquire DOCA buffer representing destination buffer: %s",
187 goto destroy_src_buf;
191 task_user_data.
ptr = &task_result;
200 goto destroy_dst_buf;
212 goto destroy_dst_buf;
225 DOCA_LOG_INFO(
"Success, memory copied and verified as correct");
235 DOCA_LOG_ERR(
"Failed to decrease DOCA destination buffer reference count: %s",
242 DOCA_LOG_ERR(
"Failed to decrease DOCA source buffer reference count: %s",
doca_error_t allocat_doca_buf_list(struct doca_buf_inventory *buf_inv, struct doca_mmap *mmap, void *buf_addr, size_t buf_len, int num_buf, bool set_data_pos, struct doca_buf **dbuf)
doca_error_t destroy_dma_resources(struct dma_resources *resources)
doca_error_t allocate_dma_resources(const char *pcie_addr, int num_buf, struct dma_resources *resources)
DOCA_LOG_REGISTER(DPU_LOCAL_DMA_COPY)
static doca_error_t memory_ranges_overlap(const char *dst_buffer, const char *src_buffer, size_t length)
static doca_error_t register_memory_range_and_start_mmap(struct doca_mmap *mmap, char *buffer, size_t length)
doca_error_t dma_local_copy(const char *pcie_addr, char *dst_buffer, char *src_buffer, size_t length, int num_src_buf, int num_dst_buf)
struct rdma_resources resources
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_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 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.
#define DOCA_ERROR_PROPAGATE(r, t)
Save the first encountered doca_error_t.
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
#define DOCA_LOG_ERR(format,...)
Generates an ERROR application log message.
#define DOCA_LOG_INFO(format,...)
Generates an INFO application log message.
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_start(struct doca_mmap *mmap)
Start DOCA Memory Map.
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 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.
struct doca_mmap * src_mmap
struct doca_buf_inventory * buf_inv
struct doca_mmap * dst_mmap
size_t num_remaining_tasks
Convenience type for representing opaque data.