NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
urom_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 UROM_RDMO_H_
27 #define UROM_RDMO_H_
28 
29 #include "ucp/api/ucp.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 /* RDMO serializing next raw, iter points to the offset place and returns the buffer start */
36 #define urom_rdmo_serialize_next_raw(_iter, _type, _offset) \
37  ({ \
38  _type *_result = (_type *)(*(_iter)); \
39  *(_iter) = UCS_PTR_BYTE_OFFSET(*(_iter), _offset); \
40  _result; \
41  })
42 
43 /* RDMO command types */
45  UROM_WORKER_CMD_RDMO_CLIENT_INIT, /* Establish host<->DPU RDMA channel command */
46  UROM_WORKER_CMD_RDMO_RQ_CREATE, /* Create RQ connected to peer worker command */
47  UROM_WORKER_CMD_RDMO_RQ_DESTROY, /* Destroy RQ command */
48  UROM_WORKER_CMD_RDMO_MR_REG, /* Register target memory region command */
49  UROM_WORKER_CMD_RDMO_MR_DEREG, /* Deregister target memory region command */
50 };
51 
52 /* RDMO client init command structure */
54  uint64_t id; /* ID used to identify client in requests */
55  void *addr; /* Local UCP worker address */
56  uint64_t addr_len; /* Local UCP worker address length */
57 };
58 
59 /* RDMO create RQ command structure */
61  void *addr; /* Peer UCP worker address */
62  uint64_t addr_len; /* Peer UCP worker address length */
63 };
64 
65 /* RDMO destroy RQ command structure */
67  uint64_t rq_id; /* RQ id to destroy on DPU worker side */
68 };
69 
70 /* RDMO register MR command structure */
72  uint64_t va; /* Memory virtual address to register */
73  uint64_t len; /* Memory length */
74  void *packed_rkey; /* Packed memory remote key, generated by UCX API */
75  uint64_t packed_rkey_len; /* Packed memory remote key length */
76  void *packed_memh; /* Packed memory handle for XGVMI, generated by UCX API */
77  uint64_t packed_memh_len; /* Packed memory handle length */
78 };
79 
80 /* RDMO client init command structure */
82  uint64_t rkey; /* Remote memory key to deregister */
83 };
84 
85 /* UROM RDMO worker command structure */
87  uint64_t type; /* Type of command as defined by urom_worker_rdmo_cmd_type */
88  union {
89  struct urom_worker_rdmo_cmd_client_init client_init; /* Client init command */
90  struct urom_worker_rdmo_cmd_rq_create rq_create; /* RQ create command */
91  struct urom_worker_rdmo_cmd_rq_destroy rq_destroy; /* RQ destroy command */
92  struct urom_worker_rdmo_cmd_mr_reg mr_reg; /* Memory region register command */
93  struct urom_worker_rdmo_cmd_mr_dereg mr_dereg; /* Memory region deregister command */
94  };
95 };
96 
97 /* RDMO notification types */
99  UROM_WORKER_NOTIFY_RDMO_CLIENT_INIT, /* Establish host<->DPU RDMA channel notification */
100 
101  UROM_WORKER_NOTIFY_RDMO_RQ_CREATE, /* Create RQ connected to peer worker notification */
102 
103  UROM_WORKER_NOTIFY_RDMO_RQ_DESTROY, /* Destroy RQ notification */
104 
105  UROM_WORKER_NOTIFY_RDMO_MR_REG, /* Register target memory region notification */
106  UROM_WORKER_NOTIFY_RDMO_MR_DEREG, /* Deregister target memory region notification */
107 };
108 
109 /* RDMO client init notification structure */
111  void *addr; /* Device UCP worker address */
112  uint64_t addr_len; /* Device UCP worker address length */
113 };
114 
115 /* RDMO create RQ notification structure */
117  uint64_t rq_id; /* Receive queue id */
118 };
119 
120 /* RDMO destroy RQ notification structure */
122  uint64_t rq_id; /* Destroyed receive queue id */
123 };
124 
125 /* RDMO register MR notification structure */
127  uint64_t rkey; /* Memory region remote key */
128 };
129 
130 /* RDMO deregister MR notification structure */
132  uint64_t rkey; /* Memory region remote key */
133 };
134 
135 /* UROM RDMO worker notification structure */
137  uint64_t type; /* Notify type as defined by urom_worker_rdmo_notify_type */
138  union {
139  struct urom_worker_rdmo_notify_client_init client_init; /* Client init notification */
140  struct urom_worker_rdmo_notify_rq_create rq_create; /* RQ create notification */
141  struct urom_worker_rdmo_notify_rq_destroy rq_destroy; /* RQ destroy notification */
142  struct urom_worker_rdmo_notify_mr_reg mr_reg; /* MR register notification */
143  struct urom_worker_rdmo_notify_mr_dereg mr_dereg; /* MR deregister notification */
144  };
145 };
146 
147 /* RDMO request flags */
149  UROM_RDMO_REQ_FLAG_FENCE = 1 << 0, /* Complete outstanding ops on this connection before executing request */
150 };
151 
152 /* RDMO operations id */
154  UROM_RDMO_OP_FLUSH, /* RDMO flush operation */
155  UROM_RDMO_OP_APPEND, /* RDMO append operation */
156  UROM_RDMO_OP_SCATTER, /* RDMO scatter operation */
157 };
158 
159 /* RDMO header structure */
161  uint64_t id; /* Client id */
162  uint32_t op_id; /* operation id */
163  uint32_t flags; /* operation flag */
164 };
165 
166 /* RDMO flush header structure */
168  uint64_t flush_id; /* Flush id */
169 };
170 
171 /* RDMO append header structure */
173  uint64_t ptr_addr; /* Memory pointer for append operation */
174  uint64_t ptr_rkey; /* Pointer remote key */
175  uint64_t data_rkey; /* Data remote key */
176 };
177 
178 /* RDMO scatter header structure */
180  uint64_t count; /* Number of IOVs in the payload */
181 };
182 
183 /*
184  * IOVs are packed into the Scatter request payload, descriptor followed by data:
185  *
186  * | iov 0 | data | iov 1 | data | iov 2 | data |
187  */
189  uint64_t addr; /* Scattered data address */
190  uint64_t rkey; /* Data remote key */
191  uint16_t len; /* Data length */
192 };
193 
194 /* RDMO response id */
196  UROM_RDMO_RSP_FLUSH, /* RDMO flush response id */
197 };
198 
199 /* RDMO response header */
201  uint32_t rsp_id; /* RDMO response id */
202 };
203 
204 /* RDMO flush response header */
206  uint64_t flush_id; /* Flush id */
207 };
208 
209 #ifdef __cplusplus
210 } /* extern "C" */
211 #endif
212 
213 #endif /* UROM_RDMO_H_ */
uint32_t flags
Definition: urom_rdmo.h:163
uint64_t id
Definition: urom_rdmo.h:161
uint32_t op_id
Definition: urom_rdmo.h:162
uint32_t rsp_id
Definition: urom_rdmo.h:201
struct urom_worker_rdmo_notify_mr_reg mr_reg
Definition: urom_rdmo.h:142
struct urom_worker_rdmo_notify_rq_create rq_create
Definition: urom_rdmo.h:140
struct urom_worker_rdmo_notify_rq_destroy rq_destroy
Definition: urom_rdmo.h:141
struct urom_worker_rdmo_notify_mr_dereg mr_dereg
Definition: urom_rdmo.h:143
struct urom_worker_rdmo_notify_client_init client_init
Definition: urom_rdmo.h:139
struct urom_worker_rdmo_cmd_mr_dereg mr_dereg
Definition: urom_rdmo.h:93
struct urom_worker_rdmo_cmd_mr_reg mr_reg
Definition: urom_rdmo.h:92
struct urom_worker_rdmo_cmd_client_init client_init
Definition: urom_rdmo.h:89
struct urom_worker_rdmo_cmd_rq_destroy rq_destroy
Definition: urom_rdmo.h:91
struct urom_worker_rdmo_cmd_rq_create rq_create
Definition: urom_rdmo.h:90
urom_rdmo_rsp_id
Definition: urom_rdmo.h:195
@ UROM_RDMO_RSP_FLUSH
Definition: urom_rdmo.h:196
urom_worker_rdmo_notify_type
Definition: urom_rdmo.h:98
@ UROM_WORKER_NOTIFY_RDMO_CLIENT_INIT
Definition: urom_rdmo.h:99
@ UROM_WORKER_NOTIFY_RDMO_RQ_CREATE
Definition: urom_rdmo.h:101
@ UROM_WORKER_NOTIFY_RDMO_RQ_DESTROY
Definition: urom_rdmo.h:103
@ UROM_WORKER_NOTIFY_RDMO_MR_REG
Definition: urom_rdmo.h:105
@ UROM_WORKER_NOTIFY_RDMO_MR_DEREG
Definition: urom_rdmo.h:106
urom_worker_rdmo_cmd_type
Definition: urom_rdmo.h:44
@ UROM_WORKER_CMD_RDMO_MR_REG
Definition: urom_rdmo.h:48
@ UROM_WORKER_CMD_RDMO_MR_DEREG
Definition: urom_rdmo.h:49
@ UROM_WORKER_CMD_RDMO_RQ_CREATE
Definition: urom_rdmo.h:46
@ UROM_WORKER_CMD_RDMO_RQ_DESTROY
Definition: urom_rdmo.h:47
@ UROM_WORKER_CMD_RDMO_CLIENT_INIT
Definition: urom_rdmo.h:45
urom_rdmo_op_id
Definition: urom_rdmo.h:153
@ UROM_RDMO_OP_APPEND
Definition: urom_rdmo.h:155
@ UROM_RDMO_OP_SCATTER
Definition: urom_rdmo.h:156
@ UROM_RDMO_OP_FLUSH
Definition: urom_rdmo.h:154
urom_rdmo_req_flags
Definition: urom_rdmo.h:148
@ UROM_RDMO_REQ_FLAG_FENCE
Definition: urom_rdmo.h:149