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