xref: /freebsd/sys/ofed/include/uapi/rdma/ib_user_cm.h (revision 81ad6265)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0
3  *
4  * Copyright (c) 2005 Topspin Communications.  All rights reserved.
5  * Copyright (c) 2005 Intel Corporation.  All rights reserved.
6  *
7  * This software is available to you under a choice of one of two
8  * licenses.  You may choose to be licensed under the terms of the GNU
9  * General Public License (GPL) Version 2, available from the file
10  * COPYING in the main directory of this source tree, or the
11  * OpenIB.org BSD license below:
12  *
13  *     Redistribution and use in source and binary forms, with or
14  *     without modification, are permitted provided that the following
15  *     conditions are met:
16  *
17  *      - Redistributions of source code must retain the above
18  *        copyright notice, this list of conditions and the following
19  *        disclaimer.
20  *
21  *      - Redistributions in binary form must reproduce the above
22  *        copyright notice, this list of conditions and the following
23  *        disclaimer in the documentation and/or other materials
24  *        provided with the distribution.
25  *
26  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
30  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
31  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
32  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33  * SOFTWARE.
34  *
35  * $FreeBSD$
36  */
37 
38 #ifndef IB_USER_CM_H
39 #define IB_USER_CM_H
40 
41 #ifdef _KERNEL
42 #include <linux/types.h>
43 #else
44 #include <infiniband/types.h>
45 #endif
46 #include <rdma/ib_user_sa.h>
47 
48 #define IB_USER_CM_ABI_VERSION 5
49 
50 enum {
51 	IB_USER_CM_CMD_CREATE_ID,
52 	IB_USER_CM_CMD_DESTROY_ID,
53 	IB_USER_CM_CMD_ATTR_ID,
54 
55 	IB_USER_CM_CMD_LISTEN,
56 	IB_USER_CM_CMD_NOTIFY,
57 
58 	IB_USER_CM_CMD_SEND_REQ,
59 	IB_USER_CM_CMD_SEND_REP,
60 	IB_USER_CM_CMD_SEND_RTU,
61 	IB_USER_CM_CMD_SEND_DREQ,
62 	IB_USER_CM_CMD_SEND_DREP,
63 	IB_USER_CM_CMD_SEND_REJ,
64 	IB_USER_CM_CMD_SEND_MRA,
65 	IB_USER_CM_CMD_SEND_LAP,
66 	IB_USER_CM_CMD_SEND_APR,
67 	IB_USER_CM_CMD_SEND_SIDR_REQ,
68 	IB_USER_CM_CMD_SEND_SIDR_REP,
69 
70 	IB_USER_CM_CMD_EVENT,
71 	IB_USER_CM_CMD_INIT_QP_ATTR,
72 };
73 /*
74  * command ABI structures.
75  */
76 struct ib_ucm_cmd_hdr {
77 	__u32 cmd;
78 	__u16 in;
79 	__u16 out;
80 };
81 
82 struct ib_ucm_create_id {
83 	__u64 uid;
84 	__u64 response;
85 };
86 
87 struct ib_ucm_create_id_resp {
88 	__u32 id;
89 };
90 
91 struct ib_ucm_destroy_id {
92 	__u64 response;
93 	__u32 id;
94 	__u32 reserved;
95 };
96 
97 struct ib_ucm_destroy_id_resp {
98 	__u32 events_reported;
99 };
100 
101 struct ib_ucm_attr_id {
102 	__u64 response;
103 	__u32 id;
104 	__u32 reserved;
105 };
106 
107 struct ib_ucm_attr_id_resp {
108 	__be64 service_id;
109 	__be64 service_mask;
110 	__be32 local_id;
111 	__be32 remote_id;
112 };
113 
114 struct ib_ucm_init_qp_attr {
115 	__u64 response;
116 	__u32 id;
117 	__u32 qp_state;
118 };
119 
120 struct ib_ucm_listen {
121 	__be64 service_id;
122 	__be64 service_mask;
123 	__u32 id;
124 	__u32 reserved;
125 };
126 
127 struct ib_ucm_notify {
128 	__u32 id;
129 	__u32 event;
130 };
131 
132 struct ib_ucm_private_data {
133 	__u64 data;
134 	__u32 id;
135 	__u8  len;
136 	__u8  reserved[3];
137 };
138 
139 struct ib_ucm_req {
140 	__u32 id;
141 	__u32 qpn;
142 	__u32 qp_type;
143 	__u32 psn;
144 	__be64 sid;
145 	__u64 data;
146 	__u64 primary_path;
147 	__u64 alternate_path;
148 	__u8  len;
149 	__u8  peer_to_peer;
150 	__u8  responder_resources;
151 	__u8  initiator_depth;
152 	__u8  remote_cm_response_timeout;
153 	__u8  flow_control;
154 	__u8  local_cm_response_timeout;
155 	__u8  retry_count;
156 	__u8  rnr_retry_count;
157 	__u8  max_cm_retries;
158 	__u8  srq;
159 	__u8  reserved[5];
160 };
161 
162 struct ib_ucm_rep {
163 	__u64 uid;
164 	__u64 data;
165 	__u32 id;
166 	__u32 qpn;
167 	__u32 psn;
168 	__u8  len;
169 	__u8  responder_resources;
170 	__u8  initiator_depth;
171 	__u8  target_ack_delay;
172 	__u8  failover_accepted;
173 	__u8  flow_control;
174 	__u8  rnr_retry_count;
175 	__u8  srq;
176 	__u8  reserved[4];
177 };
178 
179 struct ib_ucm_info {
180 	__u32 id;
181 	__u32 status;
182 	__u64 info;
183 	__u64 data;
184 	__u8  info_len;
185 	__u8  data_len;
186 	__u8  reserved[6];
187 };
188 
189 struct ib_ucm_mra {
190 	__u64 data;
191 	__u32 id;
192 	__u8  len;
193 	__u8  timeout;
194 	__u8  reserved[2];
195 };
196 
197 struct ib_ucm_lap {
198 	__u64 path;
199 	__u64 data;
200 	__u32 id;
201 	__u8  len;
202 	__u8  reserved[3];
203 };
204 
205 struct ib_ucm_sidr_req {
206 	__u32 id;
207 	__u32 timeout;
208 	__be64 sid;
209 	__u64 data;
210 	__u64 path;
211 	__u16 reserved_pkey;
212 	__u8  len;
213 	__u8  max_cm_retries;
214 	__u8  reserved[4];
215 };
216 
217 struct ib_ucm_sidr_rep {
218 	__u32 id;
219 	__u32 qpn;
220 	__u32 qkey;
221 	__u32 status;
222 	__u64 info;
223 	__u64 data;
224 	__u8  info_len;
225 	__u8  data_len;
226 	__u8  reserved[6];
227 };
228 /*
229  * event notification ABI structures.
230  */
231 struct ib_ucm_event_get {
232 	__u64 response;
233 	__u64 data;
234 	__u64 info;
235 	__u8  data_len;
236 	__u8  info_len;
237 	__u8  reserved[6];
238 };
239 
240 struct ib_ucm_req_event_resp {
241 	struct ib_user_path_rec primary_path;
242 	struct ib_user_path_rec alternate_path;
243 	__be64                 remote_ca_guid;
244 	__u32                  remote_qkey;
245 	__u32                  remote_qpn;
246 	__u32                  qp_type;
247 	__u32                  starting_psn;
248 	__u8  responder_resources;
249 	__u8  initiator_depth;
250 	__u8  local_cm_response_timeout;
251 	__u8  flow_control;
252 	__u8  remote_cm_response_timeout;
253 	__u8  retry_count;
254 	__u8  rnr_retry_count;
255 	__u8  srq;
256 	__u8  port;
257 	__u8  reserved[7];
258 };
259 
260 struct ib_ucm_rep_event_resp {
261 	__be64 remote_ca_guid;
262 	__u32 remote_qkey;
263 	__u32 remote_qpn;
264 	__u32 starting_psn;
265 	__u8  responder_resources;
266 	__u8  initiator_depth;
267 	__u8  target_ack_delay;
268 	__u8  failover_accepted;
269 	__u8  flow_control;
270 	__u8  rnr_retry_count;
271 	__u8  srq;
272 	__u8  reserved[5];
273 };
274 
275 struct ib_ucm_rej_event_resp {
276 	__u32 reason;
277 	/* ari in ib_ucm_event_get info field. */
278 };
279 
280 struct ib_ucm_mra_event_resp {
281 	__u8  timeout;
282 	__u8  reserved[3];
283 };
284 
285 struct ib_ucm_lap_event_resp {
286 	struct ib_user_path_rec path;
287 };
288 
289 struct ib_ucm_apr_event_resp {
290 	__u32 status;
291 	/* apr info in ib_ucm_event_get info field. */
292 };
293 
294 struct ib_ucm_sidr_req_event_resp {
295 	__u16 pkey;
296 	__u8  port;
297 	__u8  reserved;
298 };
299 
300 struct ib_ucm_sidr_rep_event_resp {
301 	__u32 status;
302 	__u32 qkey;
303 	__u32 qpn;
304 	/* info in ib_ucm_event_get info field. */
305 };
306 
307 #define IB_UCM_PRES_DATA      0x01
308 #define IB_UCM_PRES_INFO      0x02
309 #define IB_UCM_PRES_PRIMARY   0x04
310 #define IB_UCM_PRES_ALTERNATE 0x08
311 
312 struct ib_ucm_event_resp {
313 	__u64 uid;
314 	__u32 id;
315 	__u32 event;
316 	__u32 present;
317 	__u32 reserved;
318 	union {
319 		struct ib_ucm_req_event_resp req_resp;
320 		struct ib_ucm_rep_event_resp rep_resp;
321 		struct ib_ucm_rej_event_resp rej_resp;
322 		struct ib_ucm_mra_event_resp mra_resp;
323 		struct ib_ucm_lap_event_resp lap_resp;
324 		struct ib_ucm_apr_event_resp apr_resp;
325 
326 		struct ib_ucm_sidr_req_event_resp sidr_req_resp;
327 		struct ib_ucm_sidr_rep_event_resp sidr_rep_resp;
328 
329 		__u32                             send_status;
330 	} u;
331 };
332 
333 #endif /* IB_USER_CM_H */
334