NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
urom_common.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023 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 #ifndef _GNU_SOURCE
27 #define _GNU_SOURCE
28 #endif
29 
30 #ifndef UROM_COMMON_H_
31 #define UROM_COMMON_H_
32 
33 #include <doca_dev.h>
34 #include <doca_urom.h>
35 #include <doca_pe.h>
36 
37 /*
38  * Struct contains all the common configurations that needed for DOCA UROM samples.
39  */
41  char device_name[DOCA_DEVINFO_IBDEV_NAME_SIZE]; /* DOCA device name */
42 };
43 
44 /*
45  * Struct contains domain shared buffer details
46  */
48  void *buffer; /* Buffer address */
49  size_t buf_len; /* Buffer length */
50  void *memh; /* Buffer packed memory handle */
51  size_t memh_len; /* Buffer packed memory handle length */
52  void *mkey; /* Buffer packed memory key */
53  size_t mkey_len; /* Buffer packed memory key length*/
54 };
55 
56 /*
57  * Register the common command line parameter for the sample.
58  *
59  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
60  */
62 
63 /*
64  * Start UROM service context
65  *
66  * @pe [in]: Progress engine
67  * @dev [in]: service DOCA device
68  * @nb_workers [in]: number of workers
69  * @service [out]: service context
70  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
71  */
72 doca_error_t start_urom_service(struct doca_pe *pe,
73  struct doca_dev *dev,
74  uint64_t nb_workers,
75  struct doca_urom_service **service);
76 
77 /*
78  * Start UROM worker context
79  *
80  * @pe [in]: Progress engine
81  * @service [in]: service context
82  * @worker_id [in]: Worker id
83  * @gid [in]: worker group id (optional attribute)
84  * @nb_tasks [in]: number of tasks
85  * @cpuset [in]: worker CPU affinity to set
86  * @env [in]: worker environment variables array
87  * @env_count [in]: worker environment variables array size
88  * @plugins [in]: worker plugins
89  * @worker [out]: set worker context
90  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
91  */
92 doca_error_t start_urom_worker(struct doca_pe *pe,
93  struct doca_urom_service *service,
94  uint64_t worker_id,
95  uint32_t *gid,
96  uint64_t nb_tasks,
97  doca_cpu_set_t *cpuset,
98  char **env,
99  size_t env_count,
100  uint64_t plugins,
101  struct doca_urom_worker **worker);
102 
103 /*
104  * Start UROM domain context
105  *
106  * @pe [in]: Progress engine
107  * @oob [in]: OOB allgather operations
108  * @worker_ids [in]: workers ids participate in domain
109  * @workers [in]: workers participate in domain
110  * @nb_workers [in]: number of workers in domain
111  * @buffers [in]: shared buffers
112  * @nb_buffers [out]: number of shared buffers
113  * @domain [out]: domain context
114  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
115  */
116 doca_error_t start_urom_domain(struct doca_pe *pe,
117  struct doca_urom_domain_oob_coll *oob,
118  uint64_t *worker_ids,
119  struct doca_urom_worker **workers,
120  size_t nb_workers,
121  struct urom_domain_buffer_attrs *buffers,
122  size_t nb_buffers,
123  struct doca_urom_domain **domain);
124 #endif /* UROM_COMMON_H_ */
static enum doca_flow_pipe_domain domain
static struct doca_pe * pe
#define DOCA_DEVINFO_IBDEV_NAME_SIZE
Buffer size to hold Infiniband/RoCE device name. Including a null terminator.
Definition: doca_dev.h:309
enum doca_error doca_error_t
DOCA API return codes.
ucs_cpu_set_t doca_cpu_set_t
DOCA CPU set structure.
Definition: doca_urom.h:98
Out-of-band communication descriptor for Domain creation.
Definition: doca_urom.h:1058
char device_name[DOCA_DEVINFO_IBDEV_NAME_SIZE]
Definition: urom_common.h:41
doca_error_t start_urom_service(struct doca_pe *pe, struct doca_dev *dev, uint64_t nb_workers, struct doca_urom_service **service)
Definition: urom_common.c:95
doca_error_t register_urom_common_params(void)
Definition: urom_common.c:69
doca_error_t start_urom_worker(struct doca_pe *pe, struct doca_urom_service *service, uint64_t worker_id, uint32_t *gid, uint64_t nb_tasks, doca_cpu_set_t *cpuset, char **env, size_t env_count, uint64_t plugins, struct doca_urom_worker **worker)
Definition: urom_common.c:148
doca_error_t start_urom_domain(struct doca_pe *pe, struct doca_urom_domain_oob_coll *oob, uint64_t *worker_ids, struct doca_urom_worker **workers, size_t nb_workers, struct urom_domain_buffer_attrs *buffers, size_t nb_buffers, struct doca_urom_domain **domain)
Definition: urom_common.c:243