NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
doca_urom.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023-2024 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 
26 #ifndef DOCA_UROM_H_
27 #define DOCA_UROM_H_
28 
29 #include <ucs/type/cpu_set.h>
30 
31 #include <doca_error.h>
32 #include <doca_types.h>
33 #include <doca_urom_plugin.h>
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
98 typedef ucs_cpu_set_t doca_cpu_set_t;
99 
105 #define DOCA_CPU_ZERO(_cpusetp) UCS_CPU_ZERO(_cpusetp)
106 
112 #define DOCA_CPU_SET(_cpu, _cpusetp) UCS_CPU_SET(_cpu, _cpusetp)
113 
119 #define doca_cpu_is_set(_cpu, _cpusetp) ucs_cpu_is_set(_cpu, _cpusetp)
120 
121 /**********************************************************************************************************************
122  * DOCA core opaque types
123  *********************************************************************************************************************/
124 
125 struct doca_buf;
126 struct doca_ctx;
127 struct doca_dev;
128 
134 struct doca_urom_service;
135 
141 struct doca_urom_service_get_workers_by_gid_task;
142 
149  struct doca_urom_service_get_workers_by_gid_task *task,
150  union doca_data task_user_data,
151  union doca_data ctx_user_data);
152 
180 doca_error_t doca_urom_service_create(struct doca_urom_service **service_ctx);
181 
197 doca_error_t doca_urom_service_destroy(struct doca_urom_service *service_ctx);
198 
221 doca_error_t doca_urom_service_set_max_comm_msg_size(struct doca_urom_service *service_ctx, size_t msg_size);
222 
242 doca_error_t doca_urom_service_set_max_workers(struct doca_urom_service *service_ctx, uint32_t max_workers);
243 
265 doca_error_t doca_urom_service_set_dev(struct doca_urom_service *service_ctx, struct doca_dev *dev);
266 
281 struct doca_ctx *doca_urom_service_as_ctx(struct doca_urom_service *service_ctx);
282 
300 doca_error_t doca_urom_service_get_plugins_list(struct doca_urom_service *service_ctx,
301  const struct doca_urom_service_plugin_info **plugins,
302  size_t *plugins_count);
303 
319 doca_error_t doca_urom_service_get_cpuset(struct doca_urom_service *service_ctx, doca_cpu_set_t *cpuset);
320 
338  struct doca_urom_service_get_workers_by_gid_task **task);
339 
361  struct doca_urom_service *service_ctx,
362  uint32_t gid,
364  struct doca_urom_service_get_workers_by_gid_task **task);
365 
380 doca_error_t doca_urom_service_get_workers_by_gid_task_release(struct doca_urom_service_get_workers_by_gid_task *task);
381 
393 void doca_urom_service_get_workers_by_gid_task_set_gid(struct doca_urom_service_get_workers_by_gid_task *task,
394  uint32_t gid);
395 
407 void doca_urom_service_get_workers_by_gid_task_set_cb(struct doca_urom_service_get_workers_by_gid_task *task,
409 
420  struct doca_urom_service_get_workers_by_gid_task *task);
421 
435  struct doca_urom_service_get_workers_by_gid_task *task);
436 
450  struct doca_urom_service_get_workers_by_gid_task *task);
451 
471 struct doca_urom_worker;
472 
478 struct doca_urom_worker_cmd_task;
479 
485 typedef void (*doca_urom_worker_cmd_task_completion_cb_t)(struct doca_urom_worker_cmd_task *task,
486  union doca_data task_user_data,
487  union doca_data ctx_user_data);
488 
512 
528 
549 doca_error_t doca_urom_worker_set_service(struct doca_urom_worker *worker_ctx, struct doca_urom_service *service_ctx);
550 
556 #define DOCA_UROM_WORKER_ID_ANY -1ULL
557 
595 doca_error_t doca_urom_worker_set_id(struct doca_urom_worker *worker_ctx, uint64_t worker_id);
596 
614 doca_error_t doca_urom_worker_set_plugins(struct doca_urom_worker *worker_ctx, uint64_t plugins);
615 
633 
649 doca_error_t doca_urom_worker_set_gid(struct doca_urom_worker *worker_ctx, uint32_t gid);
650 
666 doca_error_t doca_urom_worker_set_max_inflight_tasks(struct doca_urom_worker *worker_ctx, uint32_t max_tasks);
667 
690 doca_error_t doca_urom_worker_set_env(struct doca_urom_worker *worker_ctx, char *const env[], size_t count);
691 
712 doca_error_t doca_urom_worker_get_id(struct doca_urom_worker *worker_ctx, uint64_t *worker_id);
713 
731 doca_error_t doca_urom_worker_get_gid(struct doca_urom_worker *worker_ctx, uint32_t *worker_gid);
732 
747 struct doca_ctx *doca_urom_worker_as_ctx(struct doca_urom_worker *worker_ctx);
748 
786  struct doca_urom_worker_cmd_task **task);
787 
807  uint64_t plugin,
808  struct doca_urom_worker_cmd_task **task);
809 
824 doca_error_t doca_urom_worker_cmd_task_release(struct doca_urom_worker_cmd_task *task);
825 
837 void doca_urom_worker_cmd_task_set_plugin(struct doca_urom_worker_cmd_task *task, uint64_t plugin);
838 
850 void doca_urom_worker_cmd_task_set_cb(struct doca_urom_worker_cmd_task *task,
852 
865 struct doca_buf *doca_urom_worker_cmd_task_get_payload(struct doca_urom_worker_cmd_task *task);
866 
879 struct doca_buf *doca_urom_worker_cmd_task_get_response(struct doca_urom_worker_cmd_task *task);
880 
893 void *doca_urom_worker_cmd_task_get_user_data(struct doca_urom_worker_cmd_task *task);
894 
904 struct doca_task *doca_urom_worker_cmd_task_as_task(struct doca_urom_worker_cmd_task *task);
905 
932 struct doca_urom_domain;
933 
957 doca_error_t doca_urom_domain_create(struct doca_urom_domain **domain_ctx);
958 
972 doca_error_t doca_urom_domain_destroy(struct doca_urom_domain *domain_ctx);
973 
992 doca_error_t doca_urom_domain_set_buffers_count(struct doca_urom_domain *domain_ctx, size_t buffers_cnt);
993 
1023 doca_error_t doca_urom_domain_add_buffer(struct doca_urom_domain *domain_ctx,
1024  void *buffer,
1025  size_t buf_len,
1026  void *memh,
1027  size_t memh_len,
1028  void *mkey,
1029  size_t mkey_len);
1030 
1036 typedef doca_error_t (
1037  *doca_urom_domain_allgather_cb_t)(void *sbuf, void *rbuf, size_t msglen, void *coll_info, void **req);
1038 
1045 
1052 
1061 
1064 
1067 
1069  void *coll_info;
1070 
1074  uint32_t n_oob_indexes;
1075 
1082  uint32_t oob_index;
1083 };
1084 
1103 doca_error_t doca_urom_domain_set_oob(struct doca_urom_domain *domain_ctx, struct doca_urom_domain_oob_coll *oob);
1104 
1127 doca_error_t doca_urom_domain_set_workers(struct doca_urom_domain *domain_ctx,
1128  uint64_t *domain_worker_ids,
1129  struct doca_urom_worker **workers,
1130  size_t workers_cnt);
1131 
1146 struct doca_ctx *doca_urom_domain_as_ctx(struct doca_urom_domain *domain_ctx);
1147 
1148 #ifdef __cplusplus
1149 }
1150 #endif
1151 
1152 #endif /* DOCA_UROM_H_ */
1153 
#define DOCA_EXPERIMENTAL
To set a Symbol (or specifically a function) as experimental.
Definition: doca_compat.h:103
enum doca_error doca_error_t
DOCA API return codes.
DOCA_EXPERIMENTAL struct doca_ctx * doca_urom_domain_as_ctx(struct doca_urom_domain *domain_ctx)
DOCA_EXPERIMENTAL doca_error_t doca_urom_domain_destroy(struct doca_urom_domain *domain_ctx)
doca_error_t(* doca_urom_domain_allgather_cb_t)(void *sbuf, void *rbuf, size_t msglen, void *coll_info, void **req)
Callback for a non-blocking allgather operation.
Definition: doca_urom.h:1037
doca_error_t(* doca_urom_domain_req_free_cb_t)(void *req)
Callback to free a non-blocking allgather request.
Definition: doca_urom.h:1051
DOCA_EXPERIMENTAL doca_error_t doca_urom_domain_set_oob(struct doca_urom_domain *domain_ctx, struct doca_urom_domain_oob_coll *oob)
Set OOB communication info to be used for Domain initialization.
DOCA_EXPERIMENTAL doca_error_t doca_urom_domain_create(struct doca_urom_domain **domain_ctx)
This method creates a UROM Domain context.
doca_error_t(* doca_urom_domain_req_test_cb_t)(void *req)
Callback to test the status of a non-blocking allgather request.
Definition: doca_urom.h:1044
DOCA_EXPERIMENTAL doca_error_t doca_urom_domain_add_buffer(struct doca_urom_domain *domain_ctx, void *buffer, size_t buf_len, void *memh, size_t memh_len, void *mkey, size_t mkey_len)
This method attaches local buffer attributes to the Domain. Should be called after calling doca_urom_...
DOCA_EXPERIMENTAL doca_error_t doca_urom_domain_set_workers(struct doca_urom_domain *domain_ctx, uint64_t *domain_worker_ids, struct doca_urom_worker **workers, size_t workers_cnt)
Set the list of Workers in the domain.
DOCA_EXPERIMENTAL doca_error_t doca_urom_domain_set_buffers_count(struct doca_urom_domain *domain_ctx, size_t buffers_cnt)
This method attaches the number of local buffers that will be added to the Domain.
DOCA_EXPERIMENTAL doca_error_t doca_urom_service_set_dev(struct doca_urom_service *service_ctx, struct doca_dev *dev)
This method attaches a DOCA Device to the UROM Service context.
ucs_cpu_set_t doca_cpu_set_t
DOCA CPU set structure.
Definition: doca_urom.h:98
DOCA_EXPERIMENTAL doca_error_t doca_urom_service_get_plugins_list(struct doca_urom_service *service_ctx, const struct doca_urom_service_plugin_info **plugins, size_t *plugins_count)
This method gets the list of supported plugins on service's DPU side.
DOCA_EXPERIMENTAL doca_error_t doca_urom_service_get_cpuset(struct doca_urom_service *service_ctx, doca_cpu_set_t *cpuset)
Get the allowed CPU set for the service.
void(* doca_urom_service_get_workers_by_gid_task_completion_cb_t)(struct doca_urom_service_get_workers_by_gid_task *task, union doca_data task_user_data, union doca_data ctx_user_data)
Service get workers task completion callback type.
Definition: doca_urom.h:148
DOCA_EXPERIMENTAL struct doca_ctx * doca_urom_service_as_ctx(struct doca_urom_service *service_ctx)
Convert service_ctx instance into a generalized context for use with DOCA core objects.
DOCA_EXPERIMENTAL doca_error_t doca_urom_service_destroy(struct doca_urom_service *service_ctx)
This method destroys a UROM Service context.
DOCA_EXPERIMENTAL doca_error_t doca_urom_service_set_max_comm_msg_size(struct doca_urom_service *service_ctx, size_t msg_size)
Set the maximum message size for the UROM communication channel.
DOCA_EXPERIMENTAL doca_error_t doca_urom_service_set_max_workers(struct doca_urom_service *service_ctx, uint32_t max_workers)
Set maximum number of UROM workers.
DOCA_EXPERIMENTAL doca_error_t doca_urom_service_create(struct doca_urom_service **service_ctx)
This method creates a UROM Service context.
DOCA_EXPERIMENTAL doca_error_t doca_urom_worker_cmd_task_release(struct doca_urom_worker_cmd_task *task)
Release Worker Command task.
DOCA_EXPERIMENTAL void doca_urom_worker_cmd_task_set_cb(struct doca_urom_worker_cmd_task *task, doca_urom_worker_cmd_task_completion_cb_t cb)
Set Worker Command task callback.
DOCA_EXPERIMENTAL struct doca_buf * doca_urom_worker_cmd_task_get_response(struct doca_urom_worker_cmd_task *task)
Get Worker Command task response.
DOCA_EXPERIMENTAL void * doca_urom_worker_cmd_task_get_user_data(struct doca_urom_worker_cmd_task *task)
Get Worker Command user data to populate.
DOCA_EXPERIMENTAL doca_error_t doca_urom_worker_cmd_task_allocate_init(struct doca_urom_worker *worker_ctx, uint64_t plugin, struct doca_urom_worker_cmd_task **task)
Allocate and initialize Worker Command task.
DOCA_EXPERIMENTAL void doca_urom_worker_cmd_task_set_plugin(struct doca_urom_worker_cmd_task *task, uint64_t plugin)
Set Worker Command task plugin.
DOCA_EXPERIMENTAL struct doca_buf * doca_urom_worker_cmd_task_get_payload(struct doca_urom_worker_cmd_task *task)
Get Worker Command task payload.
DOCA_EXPERIMENTAL doca_error_t doca_urom_worker_cmd_task_allocate(struct doca_urom_worker *worker_ctx, struct doca_urom_worker_cmd_task **task)
Allocate Worker Command task.
DOCA_EXPERIMENTAL doca_error_t doca_urom_worker_set_service(struct doca_urom_worker *worker_ctx, struct doca_urom_service *service_ctx)
This method attaches a UROM Service to the Worker context.
DOCA_EXPERIMENTAL doca_error_t doca_urom_worker_set_cpuset(struct doca_urom_worker *worker_ctx, doca_cpu_set_t cpuset)
Set the allowed CPUs for the Worker. The cpuset must be a subset of the service's allowed CPUs.
DOCA_EXPERIMENTAL doca_error_t doca_urom_worker_destroy(struct doca_urom_worker *worker_ctx)
This method destroys a UROM Worker context.
DOCA_EXPERIMENTAL doca_error_t doca_urom_worker_set_env(struct doca_urom_worker *worker_ctx, char *const env[], size_t count)
Set worker env variables when spawning worker on DPU side.
DOCA_EXPERIMENTAL doca_error_t doca_urom_worker_get_gid(struct doca_urom_worker *worker_ctx, uint32_t *worker_gid)
This method gets the Worker context group ID to be used to identify the Worker group that belongs to.
DOCA_EXPERIMENTAL doca_error_t doca_urom_worker_create(struct doca_urom_worker **worker_ctx)
This method creates a UROM Worker context.
DOCA_EXPERIMENTAL doca_error_t doca_urom_worker_set_gid(struct doca_urom_worker *worker_ctx, uint32_t gid)
Set worker group ID, must be set before starting the worker context.
DOCA_EXPERIMENTAL doca_error_t doca_urom_worker_set_max_inflight_tasks(struct doca_urom_worker *worker_ctx, uint32_t max_tasks)
Set Worker maximum in-flight tasks.
DOCA_EXPERIMENTAL doca_error_t doca_urom_worker_set_id(struct doca_urom_worker *worker_ctx, uint64_t worker_id)
This method sets the Worker context ID to be used to identify the Worker. Worker IDs enable an applic...
DOCA_EXPERIMENTAL doca_error_t doca_urom_worker_set_plugins(struct doca_urom_worker *worker_ctx, uint64_t plugins)
This method adds plugins mask for the supported plugins by the UROM Worker on the DPU.
void(* doca_urom_worker_cmd_task_completion_cb_t)(struct doca_urom_worker_cmd_task *task, union doca_data task_user_data, union doca_data ctx_user_data)
Worker Command task completion callback type.
Definition: doca_urom.h:485
DOCA_EXPERIMENTAL doca_error_t doca_urom_worker_get_id(struct doca_urom_worker *worker_ctx, uint64_t *worker_id)
This method gets the Worker context ID to be used to identify the Worker. Worker IDs enable an applic...
DOCA_EXPERIMENTAL struct doca_ctx * doca_urom_worker_as_ctx(struct doca_urom_worker *worker_ctx)
DOCA_EXPERIMENTAL void doca_urom_service_get_workers_by_gid_task_set_gid(struct doca_urom_service_get_workers_by_gid_task *task, uint32_t gid)
Set Service get workers task group id.
DOCA_EXPERIMENTAL struct doca_task * doca_urom_service_get_workers_by_gid_task_as_task(struct doca_urom_service_get_workers_by_gid_task *task)
This method converts a service get workers task to doca_task.
DOCA_EXPERIMENTAL doca_error_t doca_urom_service_get_workers_by_gid_task_allocate_init(struct doca_urom_service *service_ctx, uint32_t gid, doca_urom_service_get_workers_by_gid_task_completion_cb_t cb, struct doca_urom_service_get_workers_by_gid_task **task)
Allocate Service get workers by gid task and set task attributes.
DOCA_EXPERIMENTAL doca_error_t doca_urom_service_get_workers_by_gid_task_release(struct doca_urom_service_get_workers_by_gid_task *task)
Release Service get workers by gid task.
DOCA_EXPERIMENTAL doca_error_t doca_urom_service_get_workers_by_gid_task_allocate(struct doca_urom_service *service_ctx, struct doca_urom_service_get_workers_by_gid_task **task)
Allocate Service get workers by gid task.
DOCA_EXPERIMENTAL const uint64_t * doca_urom_service_get_workers_by_gid_task_get_worker_ids(struct doca_urom_service_get_workers_by_gid_task *task)
Get Service get workers task ids array.
DOCA_EXPERIMENTAL size_t doca_urom_service_get_workers_by_gid_task_get_workers_count(struct doca_urom_service_get_workers_by_gid_task *task)
Get the number of workers returned for the requested gid.
DOCA_EXPERIMENTAL struct doca_task * doca_urom_worker_cmd_task_as_task(struct doca_urom_worker_cmd_task *task)
This method converts a worker cmd task to doca_task.
DOCA_EXPERIMENTAL void doca_urom_service_get_workers_by_gid_task_set_cb(struct doca_urom_service_get_workers_by_gid_task *task, doca_urom_service_get_workers_by_gid_task_completion_cb_t cb)
Set Service get workers task completion callback.
Out-of-band communication descriptor for Domain creation.
Definition: doca_urom.h:1058
doca_urom_domain_req_free_cb_t req_free
Definition: doca_urom.h:1066
doca_urom_domain_allgather_cb_t allgather
Definition: doca_urom.h:1060
doca_urom_domain_req_test_cb_t req_test
Definition: doca_urom.h:1063
Convenience type for representing opaque data.
Definition: doca_types.h:56