NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
doca_pe.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES, ALL RIGHTS RESERVED.
3  *
4  * This software product is a proprietary product of NVIDIA CORPORATION &
5  * AFFILIATES (the "Company") and all right, title, and interest in and to the
6  * software product, including all associated intellectual property rights, are
7  * and shall remain exclusively with the Company.
8  *
9  * This software product is governed by the End User License Agreement
10  * provided with the software product.
11  *
12  */
13 
22 #ifndef DOCA_PE_H_
23 #define DOCA_PE_H_
24 
25 #include <stdint.h>
26 #include <stdlib.h>
27 
28 #include <doca_compat.h>
29 #include <doca_error.h>
30 #include <doca_types.h>
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
39 struct doca_ctx;
40 struct doca_pe;
41 struct doca_task;
42 struct doca_task_batch;
43 struct doca_devinfo;
44 
53 };
54 
67 };
68 
96 };
97 
102  DOCA_PE_EVENT_MODE_PROGRESS_SELECTIVE, /* PE shall progress only contexts that received an event or that had
103  * tasks to progress when doca_pe_request_notification was called.
104  * doca_pe_clear_notification must be called after an event was
105  * triggered. */
106  DOCA_PE_EVENT_MODE_PROGRESS_ALL /* PE shall progress all contexts when doca_pe_progress is called. No need to
107  * call doca_pe_clear_notification after an event was triggered. */
108 };
109 
136 typedef void (*doca_task_completion_cb_t)(struct doca_task *task,
137  union doca_data task_user_data,
138  union doca_data ctx_user_data);
139 
156 doca_error_t doca_pe_create(struct doca_pe **pe);
157 
171 doca_error_t doca_pe_destroy(struct doca_pe *pe);
172 
189 uint8_t doca_pe_progress(struct doca_pe *pe);
190 
191 #ifdef __linux__
210 doca_error_t doca_pe_get_notification_handle(const struct doca_pe *pe, doca_notification_handle_t *handle);
211 
212 #endif /* __linux__ */
213 
214 #ifdef _WIN32
215 
239 doca_error_t doca_pe_set_notification_handle(struct doca_pe *pe,
241  union doca_data completion_key);
242 
243 #endif /* _WIN32 */
244 
265 
286 
303 doca_error_t doca_pe_get_num_inflight_tasks(const struct doca_pe *pe, size_t *num_inflight_tasks);
304 
322 doca_error_t doca_task_submit(struct doca_task *task);
323 
340 doca_error_t doca_task_submit_ex(struct doca_task *task, uint32_t flags);
341 
359 doca_error_t doca_task_batch_submit(struct doca_task_batch *task_batch);
360 
380 doca_error_t doca_task_try_submit(struct doca_task *task);
381 
401 doca_error_t doca_task_batch_try_submit(struct doca_task_batch *task_batch);
402 
415 void doca_task_free(struct doca_task *task);
416 
430 void doca_task_batch_free(struct doca_task_batch *task_batch);
431 
445 doca_error_t doca_task_get_status(const struct doca_task *task);
446 
460 doca_error_t doca_task_batch_get_status(const struct doca_task_batch *task_batch);
461 
473 void doca_task_set_user_data(struct doca_task *task, union doca_data user_data);
474 
486 void doca_task_batch_set_user_data(struct doca_task_batch *task_batch, union doca_data user_data);
487 
499 union doca_data doca_task_get_user_data(const struct doca_task *task);
500 
512 union doca_data doca_task_batch_get_user_data(const struct doca_task_batch *task_batch);
513 
525 struct doca_ctx *doca_task_get_ctx(const struct doca_task *task);
526 
538 struct doca_ctx *doca_task_batch_get_ctx(const struct doca_task_batch *task_batch);
539 
551 union doca_data doca_task_batch_get_ctx_user_data(const struct doca_task_batch *task_batch);
552 
564 uint16_t doca_task_batch_get_tasks_num(struct doca_task_batch *task_batch);
565 
585 doca_error_t doca_pe_connect_ctx(struct doca_pe *pe, struct doca_ctx *ctx);
586 
604 doca_error_t doca_pe_set_event_mode(struct doca_pe *pe, enum doca_pe_event_mode event_mode);
605 
606 #ifdef __cplusplus
607 }
608 #endif
609 
612 #endif /* DOCA_PE_H_ */
static struct doca_pe * pe
#define DOCA_EXPERIMENTAL
To set a Symbol (or specifically a function) as experimental.
Definition: doca_compat.h:103
#define DOCA_STABLE
To set a Symbol (or specifically a function) as stable API, i.e. it won't be changed.
Definition: doca_compat.h:96
enum doca_error doca_error_t
DOCA API return codes.
doca_task_submit_flag
Flags used when submitting a doca_task.
Definition: doca_pe.h:74
DOCA_EXPERIMENTAL doca_error_t doca_task_submit_ex(struct doca_task *task, uint32_t flags)
Extended version of doca_task_submit.
DOCA_STABLE doca_error_t doca_pe_destroy(struct doca_pe *pe)
Destroy doca progress engine.
DOCA_STABLE doca_error_t doca_pe_request_notification(struct doca_pe *pe)
Arm the progress engine to wait for completion.
DOCA_EXPERIMENTAL doca_error_t doca_task_batch_try_submit(struct doca_task_batch *task_batch)
Try to submit a task_batch to a progress engine.
DOCA_STABLE doca_error_t doca_task_get_status(const struct doca_task *task)
Get task status.
DOCA_STABLE doca_error_t doca_pe_clear_notification(struct doca_pe *pe, doca_notification_handle_t handle)
Clear triggered completions after wait.
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_EXPERIMENTAL doca_error_t doca_task_batch_get_status(const struct doca_task_batch *task_batch)
Get task_batch status.
DOCA_EXPERIMENTAL union doca_data doca_task_batch_get_user_data(const struct doca_task_batch *task_batch)
Get user data from a task_batch.
DOCA_STABLE doca_error_t doca_task_try_submit(struct doca_task *task)
Try to submit a task to a progress engine.
doca_task_batch_max_tasks_number
Definition: doca_pe.h:48
DOCA_EXPERIMENTAL struct doca_ctx * doca_task_batch_get_ctx(const struct doca_task_batch *task_batch)
Get context from a doca task_batch.
DOCA_EXPERIMENTAL union doca_data doca_task_batch_get_ctx_user_data(const struct doca_task_batch *task_batch)
Get context user data from a doca task_batch.
DOCA_EXPERIMENTAL void doca_task_batch_free(struct doca_task_batch *task_batch)
Free a task_batch back to where it was allocated from.
DOCA_STABLE uint8_t doca_pe_progress(struct doca_pe *pe)
Run the progress engine.
DOCA_EXPERIMENTAL uint16_t doca_task_batch_get_tasks_num(struct doca_task_batch *task_batch)
Get actual tasks number from a doca task_batch.
DOCA_EXPERIMENTAL doca_error_t doca_task_batch_submit(struct doca_task_batch *task_batch)
Submit a task_batch to a progress engine.
DOCA_STABLE doca_error_t doca_pe_get_num_inflight_tasks(const struct doca_pe *pe, size_t *num_inflight_tasks)
Get number of in flight tasks.
DOCA_STABLE void doca_task_set_user_data(struct doca_task *task, union doca_data user_data)
Set user data to a task.
DOCA_STABLE union doca_data doca_task_get_user_data(const struct doca_task *task)
Get user data from a task.
DOCA_EXPERIMENTAL doca_error_t doca_pe_set_event_mode(struct doca_pe *pe, enum doca_pe_event_mode event_mode)
Set event mode.
DOCA_STABLE doca_error_t doca_pe_create(struct doca_pe **pe)
Creates DOCA progress engine.
DOCA_EXPERIMENTAL void doca_task_batch_set_user_data(struct doca_task_batch *task_batch, union doca_data user_data)
Set user data to a task_batch.
doca_pe_event_mode
Progress engine event modes.
Definition: doca_pe.h:101
doca_event_batch_events_number
Definition: doca_pe.h:58
DOCA_STABLE void doca_task_free(struct doca_task *task)
Free a task back to where it was allocated from.
DOCA_STABLE struct doca_ctx * doca_task_get_ctx(const struct doca_task *task)
Get context from a doca task.
void(* doca_task_completion_cb_t)(struct doca_task *task, union doca_data task_user_data, union doca_data ctx_user_data)
Function to execute on task completion.
Definition: doca_pe.h:136
@ DOCA_TASK_SUBMIT_FLAG_NONE
Definition: doca_pe.h:75
@ DOCA_TASK_SUBMIT_FLAG_FLUSH
Definition: doca_pe.h:76
@ DOCA_TASK_SUBMIT_FLAG_OPTIMIZE_REPORTS
Definition: doca_pe.h:84
@ DOCA_TASK_BATCH_MAX_TASKS_NUMBER_32
Definition: doca_pe.h:50
@ DOCA_TASK_BATCH_MAX_TASKS_NUMBER_128
Definition: doca_pe.h:52
@ DOCA_TASK_BATCH_MAX_TASKS_NUMBER_16
Definition: doca_pe.h:49
@ DOCA_TASK_BATCH_MAX_TASKS_NUMBER_64
Definition: doca_pe.h:51
@ DOCA_PE_EVENT_MODE_PROGRESS_SELECTIVE
Definition: doca_pe.h:102
@ DOCA_PE_EVENT_MODE_PROGRESS_ALL
Definition: doca_pe.h:106
@ DOCA_EVENT_BATCH_EVENTS_NUMBER_4
Definition: doca_pe.h:61
@ DOCA_EVENT_BATCH_EVENTS_NUMBER_16
Definition: doca_pe.h:63
@ DOCA_EVENT_BATCH_EVENTS_NUMBER_1
Definition: doca_pe.h:59
@ DOCA_EVENT_BATCH_EVENTS_NUMBER_64
Definition: doca_pe.h:65
@ DOCA_EVENT_BATCH_EVENTS_NUMBER_2
Definition: doca_pe.h:60
@ DOCA_EVENT_BATCH_EVENTS_NUMBER_8
Definition: doca_pe.h:62
@ DOCA_EVENT_BATCH_EVENTS_NUMBER_32
Definition: doca_pe.h:64
@ DOCA_EVENT_BATCH_EVENTS_NUMBER_128
Definition: doca_pe.h:66
doca_event_handle_t doca_notification_handle_t
Definition: doca_types.h:51
Convenience type for representing opaque data.
Definition: doca_types.h:56
struct upf_accel_ctx * ctx