NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
worker_sandbox.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 WORKER_SANDBOX_H_
27 #define WORKER_SANDBOX_H_
28 
29 #include "ucp/api/ucp.h"
30 
31 #include <doca_urom.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /*
38  * Tag send task callback function, will be called once the send task is finished
39  *
40  * @result [in]: task status
41  * @cookie [in]: user cookie
42  * @context [in]: task user context
43  * @status [in]: UCX status
44  */
46  union doca_data cookie,
47  union doca_data context,
48  ucs_status_t status);
49 
50 /*
51  * Tag recv task callback function, will be called once the recv task is finished
52  *
53  * @result [in]: task status
54  * @cookie [in]: user cookie
55  * @context [in]: task user context
56  * @buffer [in]: inline receive data, NULL if RDMA
57  * @count [in]: data bytes count
58  * @sender_tag [in]: sender tag
59  * @status [in]: UCX status
60  */
62  union doca_data cookie,
63  union doca_data context,
64  void *buffer,
65  uint64_t count,
66  uint64_t sender_tag,
67  ucs_status_t status);
68 
69 /*
70  * Memory map task callback function, will be called once the mem map task is finished
71  *
72  * @result [in]: task status
73  * @cookie [in]: user cookie
74  * @context [in]: task user context
75  * @memh_id [out]: UCX memory ID
76  */
78  union doca_data cookie,
79  union doca_data context,
80  uint64_t memh_id);
81 
82 /*
83  * Create send sandbox tag task
84  *
85  * @worker_ctx [in]: DOCA UROM worker context
86  * @cookie [in]: user cookie
87  * @context [in]: task user context
88  * @dest [in]: destination id
89  * @buffer [in]: data pointer
90  * @count [in]: data bytes count
91  * @tag [in]: tag send
92  * @memh_id [in]: memory handle id
93  * @cb [in]: program callback to call once the task is finished
94  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
95  */
96 doca_error_t urom_sandbox_tag_task_send(struct doca_urom_worker *worker_ctx,
97  union doca_data cookie,
98  union doca_data context,
99  uint64_t dest,
100  uint64_t buffer,
101  uint64_t count,
102  uint64_t tag,
103  uint64_t memh_id,
105 
106 /*
107  * Create recv sandbox tag task
108  *
109  * @worker_ctx [in]: DOCA UROM worker context
110  * @cookie [in]: user cookie
111  * @context [in]: task user context
112  * @buffer [in]: data pointer
113  * @count [in]: data bytes count
114  * @tag [in]: tag recv
115  * @tag_mask [in]: tag recv mask
116  * @memh_id [in]: memory handle id
117  * @cb [in]: program callback to call once the task is finished
118  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
119  *
120  * @NOTE: If buffer data is included as part of the notification (inline), it is the user's responsibility to copy
121  * the buffer data.
122  */
123 doca_error_t urom_sandbox_tag_task_recv(struct doca_urom_worker *worker_ctx,
124  union doca_data cookie,
125  union doca_data context,
126  uint64_t buffer,
127  uint64_t count,
128  uint64_t tag,
129  uint64_t tag_mask,
130  uint64_t memh_id,
132 
133 /*
134  * Create recv sandbox tag task
135  *
136  * @worker_ctx [in]: DOCA UROM worker context
137  * @cookie [in]: user cookie
138  * @context [in]: task user context
139  * @map_params [in]: memory map parameters
140  * @exported_memh_buffer_len [in]: exported buffer length
141  * @cb [in]: program callback to call once the task is finished
142  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
143  */
144 doca_error_t urom_sandbox_task_mem_map(struct doca_urom_worker *worker_ctx,
145  union doca_data cookie,
146  union doca_data context,
147  ucp_mem_map_params_t map_params,
148  size_t exported_memh_buffer_len,
150 
151 /*
152  * This method inits sandbox plugin.
153  *
154  * @plugin_id [in]: UROM plugin ID
155  * @version [in]: plugin version on DPU side
156  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
157  */
158 doca_error_t urom_sandbox_init(uint64_t plugin_id, uint64_t version);
159 
160 #ifdef __cplusplus
161 } /* extern "C" */
162 #endif
163 
164 #endif /* WORKER_SANDBOX_H_ */
int32_t result
static const char tag[DOCA_VFS_TAG_SIZE+1]
uint64_t cookie
enum doca_error doca_error_t
DOCA API return codes.
Convenience type for representing opaque data.
Definition: doca_types.h:56
doca_error_t urom_sandbox_tag_task_send(struct doca_urom_worker *worker_ctx, union doca_data cookie, union doca_data context, uint64_t dest, uint64_t buffer, uint64_t count, uint64_t tag, uint64_t memh_id, urom_sandbox_send_finished cb)
doca_error_t urom_sandbox_init(uint64_t plugin_id, uint64_t version)
doca_error_t urom_sandbox_task_mem_map(struct doca_urom_worker *worker_ctx, union doca_data cookie, union doca_data context, ucp_mem_map_params_t map_params, size_t exported_memh_buffer_len, urom_sandbox_mem_map_finished cb)
doca_error_t urom_sandbox_tag_task_recv(struct doca_urom_worker *worker_ctx, union doca_data cookie, union doca_data context, uint64_t buffer, uint64_t count, uint64_t tag, uint64_t tag_mask, uint64_t memh_id, urom_sandbox_recv_finished cb)
void(* urom_sandbox_recv_finished)(doca_error_t result, union doca_data cookie, union doca_data context, void *buffer, uint64_t count, uint64_t sender_tag, ucs_status_t status)
void(* urom_sandbox_send_finished)(doca_error_t result, union doca_data cookie, union doca_data context, ucs_status_t status)
void(* urom_sandbox_mem_map_finished)(doca_error_t result, union doca_data cookie, union doca_data context, uint64_t memh_id)