NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
doca_urom_plugin.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 
21 #ifndef DOCA_UROM_PLUGIN_H_
22 #define DOCA_UROM_PLUGIN_H_
23 
24 #include <limits.h>
25 
26 #include <ucs/datastruct/list.h>
27 
28 #include <doca_error.h>
29 #include <doca_compat.h>
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 #define DOCA_UROM_PLUGIN_NAME_MAX_LEN 48
40 struct urom_worker_ctx;
41 
44  uint64_t id;
45  uint64_t version;
47 };
48 
53  uint64_t type;
54  uint64_t urom_context;
55  uint64_t len;
56  uint8_t plugin_cmd[];
57 };
58 
59 /* Suppress clang compilation warning on flexible-array-extensions plugin_cmd[]
60  * is a flexible-array-extensions at it is at the end of the struct urom_worker_cmd.
61  * It declared last in every struct that instantiate it so this warning is just
62  * too strict here.
63  */
64 #ifdef __clang__
65 #pragma clang diagnostic push
66 #pragma clang diagnostic ignored "-Wflexible-array-extensions"
67 #endif
68 
73  ucs_list_link_t entry;
74  uint64_t dest_id;
76 };
77 
82  uint64_t type;
83  uint64_t urom_context;
85  uint64_t len;
87  uint32_t reserved;
88  uint8_t plugin_notif[];
89 };
90 
95  ucs_list_link_t entry;
96  uint64_t dest_id;
99 };
100 
101 #ifdef __clang__
102 #pragma clang diagnostic pop
103 #endif
104 
113 
118 
122  void (*close)(struct urom_worker_ctx *ctx);
123 
127  doca_error_t (*addr)(struct urom_worker_ctx *ctx, void *addr, size_t *addr_len);
128 
135  doca_error_t (*worker_cmd)(struct urom_worker_ctx *ctx, ucs_list_link_t *cmd_list);
136 
143  doca_error_t (*progress)(struct urom_worker_ctx *ctx, ucs_list_link_t *notif_list);
144 
148  doca_error_t (*notif_pack)(struct urom_worker_notify *notif, size_t *packed_notif_len, void *packed_notif);
149 };
150 
158  doca_error_t (*addr_lookup)(struct urom_worker_ctx *ctx, uint64_t domain_id, void **addr);
159 
163  doca_error_t (*seg_lookup)(struct urom_worker_ctx *ctx, uint64_t domain_id, uint64_t va, int *seg);
164 
168  doca_error_t (*memh_lookup)(struct urom_worker_ctx *ctx, uint64_t domain_id, int seg, size_t *len, void **memh);
169 
173  doca_error_t (*mkey_lookup)(struct urom_worker_ctx *ctx, uint64_t domain_id, int seg, size_t *len, void **rkey);
174 };
175 
180  struct urom_plugin_iface iface;
182  void *plugin_ctx;
183 };
184 
202  uint64_t domain_id,
203  void **addr)
204 {
205  return ctx->domain_iface.addr_lookup(ctx, domain_id, addr);
206 }
207 
227  uint64_t domain_id,
228  uint64_t va,
229  int *seg)
230 {
231  return ctx->domain_iface.seg_lookup(ctx, domain_id, va, seg);
232 }
233 
255  uint64_t domain_id,
256  int seg,
257  size_t *len,
258  void **memh)
259 {
260  return ctx->domain_iface.memh_lookup(ctx, domain_id, seg, len, memh);
261 }
262 
284  uint64_t domain_id,
285  int seg,
286  size_t *len,
287  void **rkey)
288 {
289  return ctx->domain_iface.mkey_lookup(ctx, domain_id, seg, len, rkey);
290 }
291 
292 #ifdef __cplusplus
293 }
294 #endif
295 
296 #endif /* DOCA_UROM_PLUGIN_H_ */
297 
uintptr_t addr
uint64_t len
enum doca_error doca_error_t
DOCA API return codes.
static doca_error_t doca_urom_worker_domain_memh_lookup(struct urom_worker_ctx *ctx, uint64_t domain_id, int seg, size_t *len, void **memh)
Worker domain segment memory handle lookup according to the domain and segment ids.
#define DOCA_UROM_PLUGIN_NAME_MAX_LEN
static doca_error_t doca_urom_worker_domain_mkey_lookup(struct urom_worker_ctx *ctx, uint64_t domain_id, int seg, size_t *len, void **rkey)
Worker domain segment remote memory key lookup according to the segment and seg ids.
static doca_error_t doca_urom_worker_domain_seg_lookup(struct urom_worker_ctx *ctx, uint64_t domain_id, uint64_t va, int *seg)
Worker domain segment id lookup according to the domain id and segment virtual address.
static doca_error_t doca_urom_worker_domain_addr_lookup(struct urom_worker_ctx *ctx, uint64_t domain_id, void **addr)
Worker domain address lookup.
char plugin_name[DOCA_UROM_PLUGIN_NAME_MAX_LEN]
UROM Worker domain lookups interface.
doca_error_t(* memh_lookup)(struct urom_worker_ctx *ctx, uint64_t domain_id, int seg, size_t *len, void **memh)
doca_error_t(* mkey_lookup)(struct urom_worker_ctx *ctx, uint64_t domain_id, int seg, size_t *len, void **rkey)
doca_error_t(* seg_lookup)(struct urom_worker_ctx *ctx, uint64_t domain_id, uint64_t va, int *seg)
doca_error_t(* addr_lookup)(struct urom_worker_ctx *ctx, uint64_t domain_id, void **addr)
UROM Worker plugin interface.
doca_error_t(* open)(struct urom_worker_ctx *ctx)
doca_error_t(* worker_cmd)(struct urom_worker_ctx *ctx, ucs_list_link_t *cmd_list)
doca_error_t(* progress)(struct urom_worker_ctx *ctx, ucs_list_link_t *notif_list)
doca_error_t(* notif_pack)(struct urom_worker_notify *notif, size_t *packed_notif_len, void *packed_notif)
doca_error_t(* addr)(struct urom_worker_ctx *ctx, void *addr, size_t *addr_len)
void(* close)(struct urom_worker_ctx *ctx)
UROM Worker command descriptor structure.
struct urom_worker_cmd worker_cmd
ucs_list_link_t entry
UROM Worker command structure.
uint8_t plugin_cmd[]
UROM worker context.
struct urom_domain_lookups_iface domain_iface
struct urom_plugin_iface iface
UROM Worker notification descriptor structure.
struct urom_worker_notify worker_notif
UROM Worker notification structure.
struct upf_accel_ctx * ctx