NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
worker_rdmo.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2024 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_RDMO_H_
27 #define WORKER_RDMO_H_
28 
29 #include <doca_log.h>
30 #include <doca_error.h>
31 
32 #include <doca_urom.h>
33 
34 #include "urom_rdmo.h"
35 
36 /*
37  * RDMO client init task callback function, will be called once the send task is finished
38  *
39  * @result [in]: task status
40  * @cookie [in]: user cookie
41  * @addr [in]: Device UCP worker address
42  * @addr_len [in]: address length
43  */
45  union doca_data cookie,
46  void *addr,
47  uint64_t addr_len);
48 
49 /*
50  * RDMO receive queue create task callback function, will be called once the send task is finished
51  *
52  * @result [in]: task status
53  * @cookie [in]: user cookie
54  * @rq_id [in]: RQ id
55  */
56 typedef void (*urom_rdmo_rq_create_finished)(doca_error_t result, union doca_data cookie, uint64_t rq_id);
57 
58 /*
59  * RDMO receive queue destroy task callback function, will be called once the send task is finished
60  *
61  * @result [in]: task status
62  * @cookie [in]: user cookie
63  * @rq_id [in]: destroyed RQ id
64  */
65 typedef void (*urom_rdmo_rq_destroy_finished)(doca_error_t result, union doca_data cookie, uint64_t rq_id);
66 
67 /*
68  * RDMO memory region register task callback function, will be called once the send task is finished
69  *
70  * @result [in]: task status
71  * @cookie [in]: user cookie
72  * @rkey [in]: memory remote key
73  */
74 typedef void (*urom_rdmo_mr_register_finished)(doca_error_t result, union doca_data cookie, uint64_t rkey);
75 
76 /*
77  * RDMO memory region deregister task callback function, will be called once the send task is finished
78  *
79  * @result [in]: task status
80  * @cookie [in]: user cookie
81  * @rkey [in]: deregistered memory remote key
82  */
83 typedef void (*urom_rdmo_mr_deregister_finished)(doca_error_t result, union doca_data cookie, uint64_t rkey);
84 
85 /*
86  * Create client init RDMO task
87  *
88  * @worker_ctx [in]: DOCA UROM worker context
89  * @cookie [in]: user cookie
90  * @id [in]: id is used to identify client in requests
91  * @addr [in]: local UCP worker address
92  * @addr_len [in]: worker address length
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_rdmo_task_client_init(struct doca_urom_worker *worker_ctx,
97  union doca_data cookie,
98  uint64_t id,
99  void *addr,
100  uint64_t addr_len,
102 
103 /*
104  * Create RDMO receive queue task
105  *
106  * @worker_ctx [in]: DOCA UROM worker context
107  * @cookie [in]: user cookie
108  * @addr [in]: peer UCP worker address
109  * @addr_len [in]: worker address length
110  * @cb [in]: program callback to call once the task is finished
111  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
112  */
113 doca_error_t urom_rdmo_task_rq_create(struct doca_urom_worker *worker_ctx,
114  union doca_data cookie,
115  void *addr,
116  uint64_t addr_len,
118 
119 /*
120  * Create receive queue destroy RDMO task
121  *
122  * @worker_ctx [in]: DOCA UROM worker context
123  * @cookie [in]: user cookie
124  * @rq_id [in]: receive queue id, program receives it from RQ create notification
125  * @cb [in]: program callback to call once the task is finished
126  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
127  */
128 doca_error_t urom_rdmo_task_rq_destroy(struct doca_urom_worker *worker_ctx,
129  union doca_data cookie,
130  uint64_t rq_id,
132 
133 /*
134  * Create memory region register RDMO task
135  *
136  * @worker_ctx [in]: DOCA UROM worker context
137  * @cookie [in]: user cookie
138  * @va [in]: Host virtual address
139  * @len [in]: address length
140  * @rkey [in]: packed memory remote key
141  * @rkey_len [in]: remote key length
142  * @memh [in]: packed memory handle
143  * @memh_len [in]: memory handle length
144  * @cb [in]: program callback to call once the task is finished
145  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
146  */
147 doca_error_t urom_rdmo_task_mr_register(struct doca_urom_worker *worker_ctx,
148  union doca_data cookie,
149  uint64_t va,
150  uint64_t len,
151  void *rkey,
152  uint64_t rkey_len,
153  void *memh,
154  uint64_t memh_len,
156 
157 /*
158  * Create memory region deregister RDMO task
159  *
160  * @worker_ctx [in]: DOCA UROM worker context
161  * @cookie [in]: user cookie
162  * @rkey_id [in]: remote key id, program receives it from MR register notification
163  * @cb [in]: program callback to call once the task is finished
164  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
165  */
166 doca_error_t urom_rdmo_task_mr_deregister(struct doca_urom_worker *worker_ctx,
167  union doca_data cookie,
168  uint64_t rkey_id,
170 
171 /*
172  * This method inits RDMO plugin.
173  *
174  * @plugin_id [in]: UROM plugin ID
175  * @version [in]: plugin version on DPU side
176  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
177  */
178 doca_error_t urom_rdmo_init(uint64_t plugin_id, uint64_t version);
179 
180 #endif /* WORKER_RDMO_H_ */
int32_t result
uintptr_t addr
uint64_t len
uint64_t cookie
enum doca_error doca_error_t
DOCA API return codes.
doca_error_t urom_rdmo_task_mr_deregister(struct doca_urom_worker *worker_ctx, union doca_data cookie, uint64_t rkey_id, urom_rdmo_mr_deregister_finished cb)
Definition: worker_rdmo.c:552
doca_error_t urom_rdmo_init(uint64_t plugin_id, uint64_t version)
Definition: worker_rdmo.c:603
doca_error_t urom_rdmo_task_rq_destroy(struct doca_urom_worker *worker_ctx, union doca_data cookie, uint64_t rq_id, urom_rdmo_rq_destroy_finished cb)
Definition: worker_rdmo.c:406
doca_error_t urom_rdmo_task_client_init(struct doca_urom_worker *worker_ctx, union doca_data cookie, uint64_t id, void *addr, uint64_t addr_len, urom_rdmo_client_init_finished cb)
Definition: worker_rdmo.c:264
doca_error_t urom_rdmo_task_mr_register(struct doca_urom_worker *worker_ctx, union doca_data cookie, uint64_t va, uint64_t len, void *rkey, uint64_t rkey_len, void *memh, uint64_t memh_len, urom_rdmo_mr_register_finished cb)
Definition: worker_rdmo.c:474
void(* urom_rdmo_mr_deregister_finished)(doca_error_t result, union doca_data cookie, uint64_t rkey)
Definition: worker_rdmo.h:83
void(* urom_rdmo_client_init_finished)(doca_error_t result, union doca_data cookie, void *addr, uint64_t addr_len)
Definition: worker_rdmo.h:44
void(* urom_rdmo_mr_register_finished)(doca_error_t result, union doca_data cookie, uint64_t rkey)
Definition: worker_rdmo.h:74
doca_error_t urom_rdmo_task_rq_create(struct doca_urom_worker *worker_ctx, union doca_data cookie, void *addr, uint64_t addr_len, urom_rdmo_rq_create_finished cb)
Definition: worker_rdmo.c:336
void(* urom_rdmo_rq_create_finished)(doca_error_t result, union doca_data cookie, uint64_t rq_id)
Definition: worker_rdmo.h:56
void(* urom_rdmo_rq_destroy_finished)(doca_error_t result, union doca_data cookie, uint64_t rq_id)
Definition: worker_rdmo.h:65
Convenience type for representing opaque data.
Definition: doca_types.h:56