blob: f79014aa28f9928da0a72904c8cbf2ebe9b7fb36 [file] [log] [blame]
Hal Rosenstock8aa00912005-07-27 11:45:43 -07001/*
2 * Copyright (c) 2005 Topspin Communications. All rights reserved.
Sean Hefty0b2b35f2005-09-01 09:28:03 -07003 * Copyright (c) 2005 Intel Corporation. All rights reserved.
Hal Rosenstock8aa00912005-07-27 11:45:43 -07004 *
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.
Hal Rosenstock8aa00912005-07-27 11:45:43 -070032 */
33
34#ifndef IB_USER_CM_H
35#define IB_USER_CM_H
36
Roland Dreier9a7147b2011-05-10 12:36:01 -070037#include <linux/types.h>
Sean Hefty6a9af2e2006-06-17 20:37:27 -070038#include <rdma/ib_user_sa.h>
Hal Rosenstock8aa00912005-07-27 11:45:43 -070039
Sean Heftye1444b52006-11-28 14:57:13 -080040#define IB_USER_CM_ABI_VERSION 5
Hal Rosenstock8aa00912005-07-27 11:45:43 -070041
42enum {
43 IB_USER_CM_CMD_CREATE_ID,
44 IB_USER_CM_CMD_DESTROY_ID,
45 IB_USER_CM_CMD_ATTR_ID,
46
47 IB_USER_CM_CMD_LISTEN,
Sean Heftye1444b52006-11-28 14:57:13 -080048 IB_USER_CM_CMD_NOTIFY,
Hal Rosenstock8aa00912005-07-27 11:45:43 -070049
50 IB_USER_CM_CMD_SEND_REQ,
51 IB_USER_CM_CMD_SEND_REP,
52 IB_USER_CM_CMD_SEND_RTU,
53 IB_USER_CM_CMD_SEND_DREQ,
54 IB_USER_CM_CMD_SEND_DREP,
55 IB_USER_CM_CMD_SEND_REJ,
56 IB_USER_CM_CMD_SEND_MRA,
57 IB_USER_CM_CMD_SEND_LAP,
58 IB_USER_CM_CMD_SEND_APR,
59 IB_USER_CM_CMD_SEND_SIDR_REQ,
60 IB_USER_CM_CMD_SEND_SIDR_REP,
61
62 IB_USER_CM_CMD_EVENT,
Sean Hefty0b2b35f2005-09-01 09:28:03 -070063 IB_USER_CM_CMD_INIT_QP_ATTR,
Hal Rosenstock8aa00912005-07-27 11:45:43 -070064};
65/*
66 * command ABI structures.
67 */
68struct ib_ucm_cmd_hdr {
69 __u32 cmd;
70 __u16 in;
71 __u16 out;
72};
73
74struct ib_ucm_create_id {
Sean Hefty0b2b35f2005-09-01 09:28:03 -070075 __u64 uid;
Hal Rosenstock8aa00912005-07-27 11:45:43 -070076 __u64 response;
77};
78
79struct ib_ucm_create_id_resp {
80 __u32 id;
81};
82
83struct ib_ucm_destroy_id {
Sean Hefty0b2b35f2005-09-01 09:28:03 -070084 __u64 response;
Hal Rosenstock8aa00912005-07-27 11:45:43 -070085 __u32 id;
Sean Hefty7b28b0d2005-11-01 13:18:54 -080086 __u32 reserved;
Hal Rosenstock8aa00912005-07-27 11:45:43 -070087};
88
Sean Hefty0b2b35f2005-09-01 09:28:03 -070089struct ib_ucm_destroy_id_resp {
90 __u32 events_reported;
91};
92
Hal Rosenstock8aa00912005-07-27 11:45:43 -070093struct ib_ucm_attr_id {
94 __u64 response;
95 __u32 id;
Sean Hefty7b28b0d2005-11-01 13:18:54 -080096 __u32 reserved;
Hal Rosenstock8aa00912005-07-27 11:45:43 -070097};
98
99struct ib_ucm_attr_id_resp {
Sean Hefty97f52eb2005-08-13 21:05:57 -0700100 __be64 service_id;
101 __be64 service_mask;
102 __be32 local_id;
103 __be32 remote_id;
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700104};
105
Sean Hefty0b2b35f2005-09-01 09:28:03 -0700106struct ib_ucm_init_qp_attr {
107 __u64 response;
108 __u32 id;
109 __u32 qp_state;
110};
111
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700112struct ib_ucm_listen {
Sean Hefty97f52eb2005-08-13 21:05:57 -0700113 __be64 service_id;
114 __be64 service_mask;
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700115 __u32 id;
Sean Hefty7b28b0d2005-11-01 13:18:54 -0800116 __u32 reserved;
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700117};
118
Sean Heftye1444b52006-11-28 14:57:13 -0800119struct ib_ucm_notify {
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700120 __u32 id;
Sean Heftye1444b52006-11-28 14:57:13 -0800121 __u32 event;
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700122};
123
124struct ib_ucm_private_data {
125 __u64 data;
126 __u32 id;
127 __u8 len;
128 __u8 reserved[3];
129};
130
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700131struct ib_ucm_req {
132 __u32 id;
133 __u32 qpn;
134 __u32 qp_type;
135 __u32 psn;
Sean Hefty97f52eb2005-08-13 21:05:57 -0700136 __be64 sid;
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700137 __u64 data;
138 __u64 primary_path;
139 __u64 alternate_path;
140 __u8 len;
141 __u8 peer_to_peer;
142 __u8 responder_resources;
143 __u8 initiator_depth;
144 __u8 remote_cm_response_timeout;
145 __u8 flow_control;
146 __u8 local_cm_response_timeout;
147 __u8 retry_count;
148 __u8 rnr_retry_count;
149 __u8 max_cm_retries;
150 __u8 srq;
Sean Hefty7b28b0d2005-11-01 13:18:54 -0800151 __u8 reserved[5];
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700152};
153
154struct ib_ucm_rep {
Sean Hefty0b2b35f2005-09-01 09:28:03 -0700155 __u64 uid;
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700156 __u64 data;
157 __u32 id;
158 __u32 qpn;
159 __u32 psn;
160 __u8 len;
161 __u8 responder_resources;
162 __u8 initiator_depth;
163 __u8 target_ack_delay;
164 __u8 failover_accepted;
165 __u8 flow_control;
166 __u8 rnr_retry_count;
167 __u8 srq;
Sean Hefty7b28b0d2005-11-01 13:18:54 -0800168 __u8 reserved[4];
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700169};
170
171struct ib_ucm_info {
172 __u32 id;
173 __u32 status;
174 __u64 info;
175 __u64 data;
176 __u8 info_len;
177 __u8 data_len;
Sean Hefty7b28b0d2005-11-01 13:18:54 -0800178 __u8 reserved[6];
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700179};
180
181struct ib_ucm_mra {
182 __u64 data;
183 __u32 id;
184 __u8 len;
185 __u8 timeout;
186 __u8 reserved[2];
187};
188
189struct ib_ucm_lap {
190 __u64 path;
191 __u64 data;
192 __u32 id;
193 __u8 len;
194 __u8 reserved[3];
195};
196
197struct ib_ucm_sidr_req {
198 __u32 id;
199 __u32 timeout;
Sean Hefty97f52eb2005-08-13 21:05:57 -0700200 __be64 sid;
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700201 __u64 data;
202 __u64 path;
Sean Hefty75af9082006-06-17 20:37:39 -0700203 __u16 reserved_pkey;
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700204 __u8 len;
205 __u8 max_cm_retries;
Sean Hefty7b28b0d2005-11-01 13:18:54 -0800206 __u8 reserved[4];
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700207};
208
209struct ib_ucm_sidr_rep {
210 __u32 id;
211 __u32 qpn;
212 __u32 qkey;
213 __u32 status;
214 __u64 info;
215 __u64 data;
216 __u8 info_len;
217 __u8 data_len;
Sean Hefty7b28b0d2005-11-01 13:18:54 -0800218 __u8 reserved[6];
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700219};
220/*
221 * event notification ABI structures.
222 */
223struct ib_ucm_event_get {
224 __u64 response;
225 __u64 data;
226 __u64 info;
227 __u8 data_len;
228 __u8 info_len;
Sean Hefty7b28b0d2005-11-01 13:18:54 -0800229 __u8 reserved[6];
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700230};
231
232struct ib_ucm_req_event_resp {
Sean Hefty6a9af2e2006-06-17 20:37:27 -0700233 struct ib_user_path_rec primary_path;
234 struct ib_user_path_rec alternate_path;
Sean Hefty97f52eb2005-08-13 21:05:57 -0700235 __be64 remote_ca_guid;
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700236 __u32 remote_qkey;
237 __u32 remote_qpn;
238 __u32 qp_type;
239 __u32 starting_psn;
240 __u8 responder_resources;
241 __u8 initiator_depth;
242 __u8 local_cm_response_timeout;
243 __u8 flow_control;
244 __u8 remote_cm_response_timeout;
245 __u8 retry_count;
246 __u8 rnr_retry_count;
247 __u8 srq;
Sean Hefty07d357d2005-10-17 15:37:43 -0700248 __u8 port;
Sean Hefty7b28b0d2005-11-01 13:18:54 -0800249 __u8 reserved[7];
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700250};
251
252struct ib_ucm_rep_event_resp {
Sean Hefty97f52eb2005-08-13 21:05:57 -0700253 __be64 remote_ca_guid;
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700254 __u32 remote_qkey;
255 __u32 remote_qpn;
256 __u32 starting_psn;
257 __u8 responder_resources;
258 __u8 initiator_depth;
259 __u8 target_ack_delay;
260 __u8 failover_accepted;
261 __u8 flow_control;
262 __u8 rnr_retry_count;
263 __u8 srq;
Sean Hefty7b28b0d2005-11-01 13:18:54 -0800264 __u8 reserved[5];
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700265};
266
267struct ib_ucm_rej_event_resp {
268 __u32 reason;
269 /* ari in ib_ucm_event_get info field. */
270};
271
272struct ib_ucm_mra_event_resp {
273 __u8 timeout;
274 __u8 reserved[3];
275};
276
277struct ib_ucm_lap_event_resp {
Sean Hefty6a9af2e2006-06-17 20:37:27 -0700278 struct ib_user_path_rec path;
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700279};
280
281struct ib_ucm_apr_event_resp {
282 __u32 status;
283 /* apr info in ib_ucm_event_get info field. */
284};
285
286struct ib_ucm_sidr_req_event_resp {
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700287 __u16 pkey;
Sean Hefty07d357d2005-10-17 15:37:43 -0700288 __u8 port;
289 __u8 reserved;
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700290};
291
292struct ib_ucm_sidr_rep_event_resp {
293 __u32 status;
294 __u32 qkey;
295 __u32 qpn;
296 /* info in ib_ucm_event_get info field. */
297};
298
299#define IB_UCM_PRES_DATA 0x01
300#define IB_UCM_PRES_INFO 0x02
301#define IB_UCM_PRES_PRIMARY 0x04
302#define IB_UCM_PRES_ALTERNATE 0x08
303
304struct ib_ucm_event_resp {
Sean Hefty0b2b35f2005-09-01 09:28:03 -0700305 __u64 uid;
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700306 __u32 id;
307 __u32 event;
308 __u32 present;
Sean Hefty7b28b0d2005-11-01 13:18:54 -0800309 __u32 reserved;
Hal Rosenstock8aa00912005-07-27 11:45:43 -0700310 union {
311 struct ib_ucm_req_event_resp req_resp;
312 struct ib_ucm_rep_event_resp rep_resp;
313 struct ib_ucm_rej_event_resp rej_resp;
314 struct ib_ucm_mra_event_resp mra_resp;
315 struct ib_ucm_lap_event_resp lap_resp;
316 struct ib_ucm_apr_event_resp apr_resp;
317
318 struct ib_ucm_sidr_req_event_resp sidr_req_resp;
319 struct ib_ucm_sidr_rep_event_resp sidr_rep_resp;
320
321 __u32 send_status;
322 } u;
323};
324
325#endif /* IB_USER_CM_H */