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