NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
sha_create_sample.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022 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 <string.h>
27 #include <stdbool.h>
28 #include <stdlib.h>
29 #include <time.h>
30 #include <unistd.h>
31 
32 #include <doca_buf.h>
33 #include <doca_buf_inventory.h>
34 #include <doca_ctx.h>
35 #include <doca_mmap.h>
36 #include <doca_sha.h>
37 #include <doca_pe.h>
38 #include <doca_error.h>
39 #include <doca_log.h>
40 
41 #include "common.h"
42 
43 DOCA_LOG_REGISTER(SHA_CREATE);
44 
45 #define SLEEP_IN_NANOS (10 * 1000) /* Sample the task every 10 microseconds */
46 #define LOG_NUM_SHA_TASKS (0) /* Log of SHA tasks number */
47 #define SHA_SAMPLE_ALGORITHM (DOCA_SHA_ALGORITHM_SHA256) /* doca_sha_algorithm for the sample */
48 
49 struct sha_resources {
50  struct program_core_objects state; /* Core objects that manage our "state" */
51  struct doca_sha *sha_ctx; /* DOCA SHA context */
52  size_t num_remaining_tasks; /* Number of remaining tasks to process */
53  bool run_pe_progress; /* Should we keep on progressing the PE? */
54 };
55 
56 /*
57  * Free callback - free doca_buf allocated pointer
58  *
59  * @addr [in]: Memory range pointer
60  * @len [in]: Memory range length
61  * @opaque [in]: An opaque pointer passed to iterator
62  */
63 void free_cb(void *addr, size_t len, void *opaque)
64 {
65  (void)len;
66  (void)opaque;
67 
68  free(addr);
69 }
70 
71 /*
72  * Clean all the sample resources
73  *
74  * @resources [in]: sha_resources struct
75  * @return: DOCA_SUCCESS if the device supports SHA hash task and DOCA_ERROR otherwise.
76  */
78 {
79  struct program_core_objects *state = &resources->state;
80  doca_error_t result = DOCA_SUCCESS, tmp_result;
81 
82  if (state->pe != NULL && state->ctx != NULL) {
83  tmp_result = doca_ctx_stop(state->ctx);
84  if (tmp_result != DOCA_SUCCESS) {
85  DOCA_ERROR_PROPAGATE(result, tmp_result);
86  DOCA_LOG_ERR("Failed to destroy DOCA SHA: %s", doca_error_get_descr(tmp_result));
87  }
88 
89  state->ctx = NULL;
90  }
91 
92  if (resources->sha_ctx != NULL) {
93  tmp_result = doca_sha_destroy(resources->sha_ctx);
94  if (tmp_result != DOCA_SUCCESS) {
95  DOCA_ERROR_PROPAGATE(result, tmp_result);
96  DOCA_LOG_ERR("Failed to destroy DOCA SHA: %s", doca_error_get_descr(tmp_result));
97  }
98  }
99 
100  tmp_result = destroy_core_objects(state);
101  if (tmp_result != DOCA_SUCCESS) {
102  DOCA_ERROR_PROPAGATE(result, tmp_result);
103  DOCA_LOG_ERR("Failed to destroy DOCA SHA: %s", doca_error_get_descr(tmp_result));
104  }
105 
106  return result;
107 }
108 
109 /*
110  * SHA hash task completed callback
111  *
112  * @sha_hash_task [in]: Completed task
113  * @task_user_data [in]: doca_data from the task
114  * @ctx_user_data [in]: doca_data from the context
115  */
116 static void sha_hash_completed_callback(struct doca_sha_task_hash *sha_hash_task,
117  union doca_data task_user_data,
118  union doca_data ctx_user_data)
119 {
120  struct sha_resources *resources = (struct sha_resources *)ctx_user_data.ptr;
121  doca_error_t *result = (doca_error_t *)task_user_data.ptr;
122 
123  /* Assign success to the result */
124  *result = DOCA_SUCCESS;
125  DOCA_LOG_INFO("SHA hash task has completed successfully");
126 
127  /* Free task */
129  /* Decrement number of remaining tasks */
131  /* Stop context once all tasks are completed */
132  if (resources->num_remaining_tasks == 0)
133  (void)doca_ctx_stop(resources->state.ctx);
134 }
135 
136 /*
137  * SHA hash task error callback
138  *
139  * @sha_hash_task [in]: Failed task
140  * @task_user_data [in]: doca_data from the task
141  * @ctx_user_data [in]: doca_data from the context
142  */
143 static void sha_hash_error_callback(struct doca_sha_task_hash *sha_hash_task,
144  union doca_data task_user_data,
145  union doca_data ctx_user_data)
146 {
147  struct sha_resources *resources = (struct sha_resources *)ctx_user_data.ptr;
148  struct doca_task *task = doca_sha_task_hash_as_task(sha_hash_task);
149  doca_error_t *result = (doca_error_t *)task_user_data.ptr;
150 
151  /* Get the result of the task */
152  *result = doca_task_get_status(task);
153  DOCA_LOG_ERR("SHA hash task failed: %s", doca_error_get_descr(*result));
154 
155  /* Free task */
156  doca_task_free(task);
157  /* Decrement number of remaining tasks */
159  /* Stop context once all tasks are completed */
160  if (resources->num_remaining_tasks == 0)
161  (void)doca_ctx_stop(resources->state.ctx);
162 }
163 
164 /*
165  * Check if given device is capable of executing a SHA hash task.
166  *
167  * @devinfo [in]: The DOCA device information
168  * @return: DOCA_SUCCESS if the device supports SHA hash task and DOCA_ERROR otherwise.
169  */
170 static doca_error_t sha_hash_is_supported(struct doca_devinfo *devinfo)
171 {
173 }
174 
183 static void sha_state_changed_callback(const union doca_data user_data,
184  struct doca_ctx *ctx,
185  enum doca_ctx_states prev_state,
186  enum doca_ctx_states next_state)
187 {
188  (void)ctx;
189  (void)prev_state;
190 
191  struct sha_resources *resources = (struct sha_resources *)user_data.ptr;
192 
193  switch (next_state) {
194  case DOCA_CTX_STATE_IDLE:
195  DOCA_LOG_INFO("SHA context has been stopped");
196  /* We can stop progressing the PE */
197  resources->run_pe_progress = false;
198  break;
203  DOCA_LOG_ERR("SHA context entered into starting state. Unexpected transition");
204  break;
206  DOCA_LOG_INFO("SHA context is running");
207  break;
216  DOCA_LOG_INFO("SHA context entered into stopping state. Any inflight tasks will be flushed");
217  break;
218  default:
219  break;
220  }
221 }
222 
223 /*
224  * Run sha_create sample
225  *
226  * @src_buffer [in]: source data for the SHA task
227  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
228  */
230 {
231  struct sha_resources resources;
232  struct program_core_objects *state = &resources.state;
233  union doca_data ctx_user_data = {0};
234  struct doca_sha_task_hash *sha_hash_task;
235  struct doca_task *task;
236  union doca_data task_user_data = {0};
237  struct doca_buf *src_doca_buf = NULL;
238  struct doca_buf *dst_doca_buf = NULL;
239  uint8_t *dst_buffer = NULL;
240  uint8_t *dst_buffer_data = NULL;
241  char *sha_output = NULL;
242  uint32_t max_bufs = 2; /* The sample will use 2 doca buffers */
243  uint32_t min_dst_sha_buffer_size;
244  uint64_t max_source_buffer_size;
245  size_t src_buffer_len = strlen(src_buffer);
246  size_t hash_length;
247  size_t i;
248  struct timespec ts = {
249  .tv_sec = 0,
250  .tv_nsec = SLEEP_IN_NANOS,
251  };
252  doca_error_t result, task_result;
253 
254  memset(&resources, 0, sizeof(resources));
255 
256  /* Open DOCA device that supports SHA */
258  if (result != DOCA_SUCCESS) {
259  DOCA_LOG_ERR("Unable to open DOCA device for SHA hash task: %s", doca_error_get_descr(result));
260  return result;
261  }
262 
263  /* Make sure that the source buffer size is less than the maximum size */
264  result = doca_sha_cap_get_max_src_buf_size(doca_dev_as_devinfo(state->dev), &max_source_buffer_size);
265  if (result != DOCA_SUCCESS) {
266  DOCA_LOG_ERR("Failed to get maximum source buffer size for DOCA SHA: %s", doca_error_get_descr(result));
268  return result;
269  }
270  if (src_buffer_len > max_source_buffer_size) {
271  DOCA_LOG_ERR("User data length %lu exceeds the maximum length %lu for DOCA SHA: %s",
272  src_buffer_len,
273  max_source_buffer_size,
276  return result;
277  }
278 
281  &min_dst_sha_buffer_size);
282  if (result != DOCA_SUCCESS) {
283  DOCA_LOG_ERR("Failed to get minimum destination buffer size for DOCA SHA: %s",
286  return result;
287  }
288 
289  result = doca_sha_create(state->dev, &resources.sha_ctx);
290  if (result != DOCA_SUCCESS) {
291  DOCA_LOG_ERR("Unable to create sha engine: %s", doca_error_get_descr(result));
293  return result;
294  }
295 
296  state->ctx = doca_sha_as_ctx(resources.sha_ctx);
297 
298  result = create_core_objects(state, max_bufs);
299  if (result != DOCA_SUCCESS) {
301  return result;
302  }
303 
304  /* Connect context to progress engine */
305  result = doca_pe_connect_ctx(state->pe, state->ctx);
306  if (result != DOCA_SUCCESS) {
307  DOCA_LOG_ERR("Failed to connect progress engine to context: %s", doca_error_get_descr(result));
309  return result;
310  }
311 
316  if (result != DOCA_SUCCESS) {
318  return result;
319  }
320 
322  if (result != DOCA_SUCCESS) {
323  DOCA_LOG_ERR("Unable to set SHA state change callback: %s", doca_error_get_descr(result));
325  return result;
326  }
327 
328  dst_buffer = calloc(1, min_dst_sha_buffer_size);
329  if (dst_buffer == NULL) {
330  DOCA_LOG_ERR("Failed to allocate memory");
332  return DOCA_ERROR_NO_MEMORY;
333  }
334 
335  result = doca_mmap_set_memrange(state->dst_mmap, dst_buffer, min_dst_sha_buffer_size);
336  if (result != DOCA_SUCCESS) {
337  free(dst_buffer);
339  return result;
340  }
341 
343  if (result != DOCA_SUCCESS) {
344  free(dst_buffer);
346  return result;
347  }
348 
349  result = doca_mmap_start(state->dst_mmap);
350  if (result != DOCA_SUCCESS) {
351  free(dst_buffer);
353  return result;
354  }
355 
356  result = doca_mmap_set_memrange(state->src_mmap, src_buffer, src_buffer_len);
357  if (result != DOCA_SUCCESS) {
359  return result;
360  }
361 
362  result = doca_mmap_start(state->src_mmap);
363  if (result != DOCA_SUCCESS) {
365  return result;
366  }
367 
368  /* Construct DOCA source buffer */
370  state->src_mmap,
371  src_buffer,
372  src_buffer_len,
373  &src_doca_buf);
374  if (result != DOCA_SUCCESS) {
375  DOCA_LOG_ERR("Unable to acquire DOCA buffer representing source buffer: %s",
378  return result;
379  }
380 
381  /* Construct DOCA destination buffer */
383  state->dst_mmap,
384  dst_buffer,
385  min_dst_sha_buffer_size,
386  &dst_doca_buf);
387  if (result != DOCA_SUCCESS) {
388  DOCA_LOG_ERR("Unable to acquire DOCA buffer representing destination buffer: %s",
390  doca_buf_dec_refcount(src_doca_buf, NULL);
392  return result;
393  }
394 
395  /* Include tasks counter in user data of context to be decremented in callbacks */
396  ctx_user_data.ptr = &resources;
397  doca_ctx_set_user_data(state->ctx, ctx_user_data);
398 
399  /* Start the context */
400  result = doca_ctx_start(state->ctx);
401  if (result != DOCA_SUCCESS) {
402  doca_buf_dec_refcount(dst_doca_buf, NULL);
403  doca_buf_dec_refcount(src_doca_buf, NULL);
405  return result;
406  }
407 
408  /* Include result in user data of task to be used in the callbacks */
409  task_user_data.ptr = &task_result;
410  /* Allocate and construct SHA hash task */
413  src_doca_buf,
414  dst_doca_buf,
415  task_user_data,
416  &sha_hash_task);
417  if (result != DOCA_SUCCESS) {
418  DOCA_LOG_ERR("Failed to allocate SHA hash task: %s", doca_error_get_descr(result));
419  doca_buf_dec_refcount(dst_doca_buf, NULL);
420  doca_buf_dec_refcount(src_doca_buf, NULL);
422  return result;
423  }
424  /* Number of tasks submitted to progress engine */
426 
427  task = doca_sha_task_hash_as_task(sha_hash_task);
428  if (task == NULL) {
430  DOCA_LOG_ERR("Failed to get DOCA SHA hash task as DOCA task: %s", doca_error_get_descr(result));
431  doca_task_free(task);
432  doca_buf_dec_refcount(dst_doca_buf, NULL);
433  doca_buf_dec_refcount(src_doca_buf, NULL);
435  return result;
436  }
437 
438  /* Submit SHA hash task */
439  result = doca_task_submit(task);
440  if (result != DOCA_SUCCESS) {
441  DOCA_LOG_ERR("Failed to submit SHA hash task: %s", doca_error_get_descr(result));
442  doca_task_free(task);
443  doca_buf_dec_refcount(dst_doca_buf, NULL);
444  doca_buf_dec_refcount(src_doca_buf, NULL);
446  return result;
447  }
448 
449  resources.run_pe_progress = true;
450 
451  /* Wait for all tasks to be completed and for the context to be stopped */
452  while (resources.run_pe_progress) {
453  if (doca_pe_progress(state->pe) == 0)
454  nanosleep(&ts, &ts);
455  }
456 
457  result = task_result;
458 
459  /* Check result of task according to the result we update in the callbacks */
460  if (task_result != DOCA_SUCCESS) {
461  doca_buf_dec_refcount(dst_doca_buf, NULL);
462  doca_buf_dec_refcount(src_doca_buf, NULL);
464  return result;
465  }
466 
467  result = doca_buf_get_data_len(dst_doca_buf, &hash_length);
468  if (result != DOCA_SUCCESS) {
469  DOCA_LOG_ERR("Failed to get the data length of DOCA buffer: %s", doca_error_get_descr(result));
470  doca_buf_dec_refcount(dst_doca_buf, NULL);
472  return result;
473  }
474 
475  result = doca_buf_get_data(dst_doca_buf, (void **)&dst_buffer_data);
476  if (result != DOCA_SUCCESS) {
477  DOCA_LOG_ERR("Failed to get the data of DOCA buffer: %s", doca_error_get_descr(result));
478  doca_buf_dec_refcount(dst_doca_buf, NULL);
480  return result;
481  }
482 
483  /* Engine outputs hex format. For char format output, we need double the length */
484  sha_output = calloc(1, (hash_length * 2) + 1);
485  if (sha_output == NULL) {
486  DOCA_LOG_ERR("Failed to allocate memory");
487  doca_buf_dec_refcount(dst_doca_buf, NULL);
488  doca_buf_dec_refcount(src_doca_buf, NULL);
490  return DOCA_ERROR_NO_MEMORY;
491  }
492 
493  /* Convert the hex format to char format */
494  for (i = 0; i < hash_length; i++)
495  snprintf(sha_output + (2 * i), 3, "%02x", dst_buffer_data[i]);
496  DOCA_LOG_INFO("SHA256 output is: %s", sha_output);
497 
498  /* Clean and destroy all relevant objects */
499  free(sha_output);
500  if (doca_buf_dec_refcount(src_doca_buf, NULL) != DOCA_SUCCESS ||
501  doca_buf_dec_refcount(dst_doca_buf, NULL) != DOCA_SUCCESS)
502  DOCA_LOG_ERR("Failed to decrease DOCA buffer reference count");
504 
505  return result;
506 }
#define NULL
Definition: __stddef_null.h:26
int32_t result
doca_error_t destroy_core_objects(struct program_core_objects *state)
Definition: common.c:392
doca_error_t create_core_objects(struct program_core_objects *state, uint32_t max_bufs)
Definition: common.c:302
doca_error_t open_doca_device_with_capabilities(tasks_check func, struct doca_dev **retval)
Definition: common.c:188
uintptr_t addr
uint64_t len
struct rdma_resources resources
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_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_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_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
DOCA_STABLE struct doca_devinfo * doca_dev_as_devinfo(const struct doca_dev *dev)
Get local device info from device. This should be useful when wanting to query information about devi...
#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_UNEXPECTED
Definition: doca_error.h:60
@ DOCA_SUCCESS
Definition: doca_error.h:38
@ DOCA_ERROR_NO_MEMORY
Definition: doca_error.h:45
#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_start(struct doca_mmap *mmap)
Start DOCA Memory Map.
DOCA_STABLE doca_error_t doca_mmap_set_free_cb(struct doca_mmap *mmap, doca_mmap_memrange_free_cb_t *free_cb, void *opaque)
Set callback that will free the memory range when destroying 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_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.
DOCA_EXPERIMENTAL doca_error_t doca_sha_create(struct doca_dev *dev, struct doca_sha **sha)
DOCA_EXPERIMENTAL doca_error_t doca_sha_cap_get_min_dst_buf_size(struct doca_devinfo const *devinfo, enum doca_sha_algorithm algorithm, uint32_t *min_dst_buf_size)
DOCA_EXPERIMENTAL struct doca_task * doca_sha_task_hash_as_task(struct doca_sha_task_hash *task)
DOCA_EXPERIMENTAL doca_error_t doca_sha_cap_task_hash_get_supported(struct doca_devinfo const *devinfo, enum doca_sha_algorithm algorithm)
DOCA_EXPERIMENTAL doca_error_t doca_sha_task_hash_set_conf(struct doca_sha *sha, doca_sha_task_hash_completion_cb_t task_completion_cb, doca_sha_task_hash_completion_cb_t task_error_cb, uint8_t log_num_tasks)
This method sets the doca_sha hash task pool configuration.
DOCA_EXPERIMENTAL doca_error_t doca_sha_destroy(struct doca_sha *sha)
DOCA_EXPERIMENTAL doca_error_t doca_sha_task_hash_alloc_init(struct doca_sha *sha, enum doca_sha_algorithm algorithm, struct doca_buf const *src_buf, struct doca_buf *dst_buf, union doca_data user_data, struct doca_sha_task_hash **task)
DOCA_EXPERIMENTAL doca_error_t doca_sha_cap_get_max_src_buf_size(struct doca_devinfo const *devinfo, uint64_t *max_src_buf_size)
DOCA_EXPERIMENTAL struct doca_ctx * doca_sha_as_ctx(struct doca_sha *sha)
#define SHA_SAMPLE_ALGORITHM
doca_error_t sha_create(char *src_buffer)
static doca_error_t sha_cleanup(struct sha_resources *resources)
static doca_error_t sha_hash_is_supported(struct doca_devinfo *devinfo)
DOCA_LOG_REGISTER(SHA_CREATE)
static void sha_state_changed_callback(const union doca_data user_data, struct doca_ctx *ctx, enum doca_ctx_states prev_state, enum doca_ctx_states next_state)
static void sha_hash_completed_callback(struct doca_sha_task_hash *sha_hash_task, union doca_data task_user_data, union doca_data ctx_user_data)
#define LOG_NUM_SHA_TASKS
void free_cb(void *addr, size_t len, void *opaque)
static void sha_hash_error_callback(struct doca_sha_task_hash *sha_hash_task, union doca_data task_user_data, union doca_data ctx_user_data)
#define SLEEP_IN_NANOS
struct doca_pe * pe
Definition: common.h:51
struct doca_mmap * src_mmap
Definition: common.h:47
struct doca_buf_inventory * buf_inv
Definition: common.h:49
struct doca_dev * dev
Definition: common.h:46
struct doca_mmap * dst_mmap
Definition: common.h:48
struct doca_ctx * ctx
Definition: common.h:50
size_t num_remaining_tasks
Definition: rdma_common.h:134
bool run_pe_progress
Definition: rdma_common.h:133
struct doca_sha * sha_ctx
struct program_core_objects state
size_t num_remaining_tasks
Convenience type for representing opaque data.
Definition: doca_types.h:56
void * ptr
Definition: doca_types.h:57
struct upf_accel_ctx * ctx