diff options
Diffstat (limited to 'include/rdma')
-rw-r--r-- | include/rdma/Kbuild | 6 | ||||
-rw-r--r-- | include/rdma/ib_user_cm.h | 325 | ||||
-rw-r--r-- | include/rdma/ib_user_mad.h | 203 | ||||
-rw-r--r-- | include/rdma/ib_user_sa.h | 76 | ||||
-rw-r--r-- | include/rdma/ib_user_verbs.h | 690 | ||||
-rw-r--r-- | include/rdma/rdma_user_cm.h | 247 |
6 files changed, 1547 insertions, 0 deletions
diff --git a/include/rdma/Kbuild b/include/rdma/Kbuild new file mode 100644 index 00000000000..ea56f76c0c2 --- /dev/null +++ b/include/rdma/Kbuild | |||
@@ -0,0 +1,6 @@ | |||
1 | header-y += ib_user_cm.h | ||
2 | header-y += ib_user_mad.h | ||
3 | header-y += ib_user_sa.h | ||
4 | header-y += ib_user_verbs.h | ||
5 | header-y += rdma_netlink.h | ||
6 | header-y += rdma_user_cm.h | ||
diff --git a/include/rdma/ib_user_cm.h b/include/rdma/ib_user_cm.h new file mode 100644 index 00000000000..f79014aa28f --- /dev/null +++ b/include/rdma/ib_user_cm.h | |||
@@ -0,0 +1,325 @@ | |||
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 | #include <linux/types.h> | ||
38 | #include <rdma/ib_user_sa.h> | ||
39 | |||
40 | #define IB_USER_CM_ABI_VERSION 5 | ||
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_NOTIFY, | ||
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 | IB_USER_CM_CMD_INIT_QP_ATTR, | ||
64 | }; | ||
65 | /* | ||
66 | * command ABI structures. | ||
67 | */ | ||
68 | struct ib_ucm_cmd_hdr { | ||
69 | __u32 cmd; | ||
70 | __u16 in; | ||
71 | __u16 out; | ||
72 | }; | ||
73 | |||
74 | struct ib_ucm_create_id { | ||
75 | __u64 uid; | ||
76 | __u64 response; | ||
77 | }; | ||
78 | |||
79 | struct ib_ucm_create_id_resp { | ||
80 | __u32 id; | ||
81 | }; | ||
82 | |||
83 | struct ib_ucm_destroy_id { | ||
84 | __u64 response; | ||
85 | __u32 id; | ||
86 | __u32 reserved; | ||
87 | }; | ||
88 | |||
89 | struct ib_ucm_destroy_id_resp { | ||
90 | __u32 events_reported; | ||
91 | }; | ||
92 | |||
93 | struct ib_ucm_attr_id { | ||
94 | __u64 response; | ||
95 | __u32 id; | ||
96 | __u32 reserved; | ||
97 | }; | ||
98 | |||
99 | struct ib_ucm_attr_id_resp { | ||
100 | __be64 service_id; | ||
101 | __be64 service_mask; | ||
102 | __be32 local_id; | ||
103 | __be32 remote_id; | ||
104 | }; | ||
105 | |||
106 | struct ib_ucm_init_qp_attr { | ||
107 | __u64 response; | ||
108 | __u32 id; | ||
109 | __u32 qp_state; | ||
110 | }; | ||
111 | |||
112 | struct ib_ucm_listen { | ||
113 | __be64 service_id; | ||
114 | __be64 service_mask; | ||
115 | __u32 id; | ||
116 | __u32 reserved; | ||
117 | }; | ||
118 | |||
119 | struct ib_ucm_notify { | ||
120 | __u32 id; | ||
121 | __u32 event; | ||
122 | }; | ||
123 | |||
124 | struct ib_ucm_private_data { | ||
125 | __u64 data; | ||
126 | __u32 id; | ||
127 | __u8 len; | ||
128 | __u8 reserved[3]; | ||
129 | }; | ||
130 | |||
131 | struct ib_ucm_req { | ||
132 | __u32 id; | ||
133 | __u32 qpn; | ||
134 | __u32 qp_type; | ||
135 | __u32 psn; | ||
136 | __be64 sid; | ||
137 | __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; | ||
151 | __u8 reserved[5]; | ||
152 | }; | ||
153 | |||
154 | struct ib_ucm_rep { | ||
155 | __u64 uid; | ||
156 | __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; | ||
168 | __u8 reserved[4]; | ||
169 | }; | ||
170 | |||
171 | struct ib_ucm_info { | ||
172 | __u32 id; | ||
173 | __u32 status; | ||
174 | __u64 info; | ||
175 | __u64 data; | ||
176 | __u8 info_len; | ||
177 | __u8 data_len; | ||
178 | __u8 reserved[6]; | ||
179 | }; | ||
180 | |||
181 | struct ib_ucm_mra { | ||
182 | __u64 data; | ||
183 | __u32 id; | ||
184 | __u8 len; | ||
185 | __u8 timeout; | ||
186 | __u8 reserved[2]; | ||
187 | }; | ||
188 | |||
189 | struct ib_ucm_lap { | ||
190 | __u64 path; | ||
191 | __u64 data; | ||
192 | __u32 id; | ||
193 | __u8 len; | ||
194 | __u8 reserved[3]; | ||
195 | }; | ||
196 | |||
197 | struct ib_ucm_sidr_req { | ||
198 | __u32 id; | ||
199 | __u32 timeout; | ||
200 | __be64 sid; | ||
201 | __u64 data; | ||
202 | __u64 path; | ||
203 | __u16 reserved_pkey; | ||
204 | __u8 len; | ||
205 | __u8 max_cm_retries; | ||
206 | __u8 reserved[4]; | ||
207 | }; | ||
208 | |||
209 | struct 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; | ||
218 | __u8 reserved[6]; | ||
219 | }; | ||
220 | /* | ||
221 | * event notification ABI structures. | ||
222 | */ | ||
223 | struct ib_ucm_event_get { | ||
224 | __u64 response; | ||
225 | __u64 data; | ||
226 | __u64 info; | ||
227 | __u8 data_len; | ||
228 | __u8 info_len; | ||
229 | __u8 reserved[6]; | ||
230 | }; | ||
231 | |||
232 | struct ib_ucm_req_event_resp { | ||
233 | struct ib_user_path_rec primary_path; | ||
234 | struct ib_user_path_rec alternate_path; | ||
235 | __be64 remote_ca_guid; | ||
236 | __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; | ||
248 | __u8 port; | ||
249 | __u8 reserved[7]; | ||
250 | }; | ||
251 | |||
252 | struct ib_ucm_rep_event_resp { | ||
253 | __be64 remote_ca_guid; | ||
254 | __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; | ||
264 | __u8 reserved[5]; | ||
265 | }; | ||
266 | |||
267 | struct ib_ucm_rej_event_resp { | ||
268 | __u32 reason; | ||
269 | /* ari in ib_ucm_event_get info field. */ | ||
270 | }; | ||
271 | |||
272 | struct ib_ucm_mra_event_resp { | ||
273 | __u8 timeout; | ||
274 | __u8 reserved[3]; | ||
275 | }; | ||
276 | |||
277 | struct ib_ucm_lap_event_resp { | ||
278 | struct ib_user_path_rec path; | ||
279 | }; | ||
280 | |||
281 | struct ib_ucm_apr_event_resp { | ||
282 | __u32 status; | ||
283 | /* apr info in ib_ucm_event_get info field. */ | ||
284 | }; | ||
285 | |||
286 | struct ib_ucm_sidr_req_event_resp { | ||
287 | __u16 pkey; | ||
288 | __u8 port; | ||
289 | __u8 reserved; | ||
290 | }; | ||
291 | |||
292 | struct 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 | |||
304 | struct ib_ucm_event_resp { | ||
305 | __u64 uid; | ||
306 | __u32 id; | ||
307 | __u32 event; | ||
308 | __u32 present; | ||
309 | __u32 reserved; | ||
310 | 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 */ | ||
diff --git a/include/rdma/ib_user_mad.h b/include/rdma/ib_user_mad.h new file mode 100644 index 00000000000..d6fce1cbdb9 --- /dev/null +++ b/include/rdma/ib_user_mad.h | |||
@@ -0,0 +1,203 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2004 Topspin Communications. All rights reserved. | ||
3 | * Copyright (c) 2005 Voltaire, Inc. 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_MAD_H | ||
35 | #define IB_USER_MAD_H | ||
36 | |||
37 | #include <linux/types.h> | ||
38 | #include <linux/ioctl.h> | ||
39 | |||
40 | /* | ||
41 | * Increment this value if any changes that break userspace ABI | ||
42 | * compatibility are made. | ||
43 | */ | ||
44 | #define IB_USER_MAD_ABI_VERSION 5 | ||
45 | |||
46 | /* | ||
47 | * Make sure that all structs defined in this file remain laid out so | ||
48 | * that they pack the same way on 32-bit and 64-bit architectures (to | ||
49 | * avoid incompatibility between 32-bit userspace and 64-bit kernels). | ||
50 | */ | ||
51 | |||
52 | /** | ||
53 | * ib_user_mad_hdr_old - Old version of MAD packet header without pkey_index | ||
54 | * @id - ID of agent MAD received with/to be sent with | ||
55 | * @status - 0 on successful receive, ETIMEDOUT if no response | ||
56 | * received (transaction ID in data[] will be set to TID of original | ||
57 | * request) (ignored on send) | ||
58 | * @timeout_ms - Milliseconds to wait for response (unset on receive) | ||
59 | * @retries - Number of automatic retries to attempt | ||
60 | * @qpn - Remote QP number received from/to be sent to | ||
61 | * @qkey - Remote Q_Key to be sent with (unset on receive) | ||
62 | * @lid - Remote lid received from/to be sent to | ||
63 | * @sl - Service level received with/to be sent with | ||
64 | * @path_bits - Local path bits received with/to be sent with | ||
65 | * @grh_present - If set, GRH was received/should be sent | ||
66 | * @gid_index - Local GID index to send with (unset on receive) | ||
67 | * @hop_limit - Hop limit in GRH | ||
68 | * @traffic_class - Traffic class in GRH | ||
69 | * @gid - Remote GID in GRH | ||
70 | * @flow_label - Flow label in GRH | ||
71 | */ | ||
72 | struct ib_user_mad_hdr_old { | ||
73 | __u32 id; | ||
74 | __u32 status; | ||
75 | __u32 timeout_ms; | ||
76 | __u32 retries; | ||
77 | __u32 length; | ||
78 | __be32 qpn; | ||
79 | __be32 qkey; | ||
80 | __be16 lid; | ||
81 | __u8 sl; | ||
82 | __u8 path_bits; | ||
83 | __u8 grh_present; | ||
84 | __u8 gid_index; | ||
85 | __u8 hop_limit; | ||
86 | __u8 traffic_class; | ||
87 | __u8 gid[16]; | ||
88 | __be32 flow_label; | ||
89 | }; | ||
90 | |||
91 | /** | ||
92 | * ib_user_mad_hdr - MAD packet header | ||
93 | * This layout allows specifying/receiving the P_Key index. To use | ||
94 | * this capability, an application must call the | ||
95 | * IB_USER_MAD_ENABLE_PKEY ioctl on the user MAD file handle before | ||
96 | * any other actions with the file handle. | ||
97 | * @id - ID of agent MAD received with/to be sent with | ||
98 | * @status - 0 on successful receive, ETIMEDOUT if no response | ||
99 | * received (transaction ID in data[] will be set to TID of original | ||
100 | * request) (ignored on send) | ||
101 | * @timeout_ms - Milliseconds to wait for response (unset on receive) | ||
102 | * @retries - Number of automatic retries to attempt | ||
103 | * @qpn - Remote QP number received from/to be sent to | ||
104 | * @qkey - Remote Q_Key to be sent with (unset on receive) | ||
105 | * @lid - Remote lid received from/to be sent to | ||
106 | * @sl - Service level received with/to be sent with | ||
107 | * @path_bits - Local path bits received with/to be sent with | ||
108 | * @grh_present - If set, GRH was received/should be sent | ||
109 | * @gid_index - Local GID index to send with (unset on receive) | ||
110 | * @hop_limit - Hop limit in GRH | ||
111 | * @traffic_class - Traffic class in GRH | ||
112 | * @gid - Remote GID in GRH | ||
113 | * @flow_label - Flow label in GRH | ||
114 | * @pkey_index - P_Key index | ||
115 | */ | ||
116 | struct ib_user_mad_hdr { | ||
117 | __u32 id; | ||
118 | __u32 status; | ||
119 | __u32 timeout_ms; | ||
120 | __u32 retries; | ||
121 | __u32 length; | ||
122 | __be32 qpn; | ||
123 | __be32 qkey; | ||
124 | __be16 lid; | ||
125 | __u8 sl; | ||
126 | __u8 path_bits; | ||
127 | __u8 grh_present; | ||
128 | __u8 gid_index; | ||
129 | __u8 hop_limit; | ||
130 | __u8 traffic_class; | ||
131 | __u8 gid[16]; | ||
132 | __be32 flow_label; | ||
133 | __u16 pkey_index; | ||
134 | __u8 reserved[6]; | ||
135 | }; | ||
136 | |||
137 | /** | ||
138 | * ib_user_mad - MAD packet | ||
139 | * @hdr - MAD packet header | ||
140 | * @data - Contents of MAD | ||
141 | * | ||
142 | */ | ||
143 | struct ib_user_mad { | ||
144 | struct ib_user_mad_hdr hdr; | ||
145 | __u64 data[0]; | ||
146 | }; | ||
147 | |||
148 | /* | ||
149 | * Earlier versions of this interface definition declared the | ||
150 | * method_mask[] member as an array of __u32 but treated it as a | ||
151 | * bitmap made up of longs in the kernel. This ambiguity meant that | ||
152 | * 32-bit big-endian applications that can run on both 32-bit and | ||
153 | * 64-bit kernels had no consistent ABI to rely on, and 64-bit | ||
154 | * big-endian applications that treated method_mask as being made up | ||
155 | * of 32-bit words would have their bitmap misinterpreted. | ||
156 | * | ||
157 | * To clear up this confusion, we change the declaration of | ||
158 | * method_mask[] to use unsigned long and handle the conversion from | ||
159 | * 32-bit userspace to 64-bit kernel for big-endian systems in the | ||
160 | * compat_ioctl method. Unfortunately, to keep the structure layout | ||
161 | * the same, we need the method_mask[] array to be aligned only to 4 | ||
162 | * bytes even when long is 64 bits, which forces us into this ugly | ||
163 | * typedef. | ||
164 | */ | ||
165 | typedef unsigned long __attribute__((aligned(4))) packed_ulong; | ||
166 | #define IB_USER_MAD_LONGS_PER_METHOD_MASK (128 / (8 * sizeof (long))) | ||
167 | |||
168 | /** | ||
169 | * ib_user_mad_reg_req - MAD registration request | ||
170 | * @id - Set by the kernel; used to identify agent in future requests. | ||
171 | * @qpn - Queue pair number; must be 0 or 1. | ||
172 | * @method_mask - The caller will receive unsolicited MADs for any method | ||
173 | * where @method_mask = 1. | ||
174 | * @mgmt_class - Indicates which management class of MADs should be receive | ||
175 | * by the caller. This field is only required if the user wishes to | ||
176 | * receive unsolicited MADs, otherwise it should be 0. | ||
177 | * @mgmt_class_version - Indicates which version of MADs for the given | ||
178 | * management class to receive. | ||
179 | * @oui: Indicates IEEE OUI when mgmt_class is a vendor class | ||
180 | * in the range from 0x30 to 0x4f. Otherwise not used. | ||
181 | * @rmpp_version: If set, indicates the RMPP version used. | ||
182 | * | ||
183 | */ | ||
184 | struct ib_user_mad_reg_req { | ||
185 | __u32 id; | ||
186 | packed_ulong method_mask[IB_USER_MAD_LONGS_PER_METHOD_MASK]; | ||
187 | __u8 qpn; | ||
188 | __u8 mgmt_class; | ||
189 | __u8 mgmt_class_version; | ||
190 | __u8 oui[3]; | ||
191 | __u8 rmpp_version; | ||
192 | }; | ||
193 | |||
194 | #define IB_IOCTL_MAGIC 0x1b | ||
195 | |||
196 | #define IB_USER_MAD_REGISTER_AGENT _IOWR(IB_IOCTL_MAGIC, 1, \ | ||
197 | struct ib_user_mad_reg_req) | ||
198 | |||
199 | #define IB_USER_MAD_UNREGISTER_AGENT _IOW(IB_IOCTL_MAGIC, 2, __u32) | ||
200 | |||
201 | #define IB_USER_MAD_ENABLE_PKEY _IO(IB_IOCTL_MAGIC, 3) | ||
202 | |||
203 | #endif /* IB_USER_MAD_H */ | ||
diff --git a/include/rdma/ib_user_sa.h b/include/rdma/ib_user_sa.h new file mode 100644 index 00000000000..cfc7c9ba781 --- /dev/null +++ b/include/rdma/ib_user_sa.h | |||
@@ -0,0 +1,76 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005 Intel Corporation. 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 | |||
33 | #ifndef IB_USER_SA_H | ||
34 | #define IB_USER_SA_H | ||
35 | |||
36 | #include <linux/types.h> | ||
37 | |||
38 | enum { | ||
39 | IB_PATH_GMP = 1, | ||
40 | IB_PATH_PRIMARY = (1<<1), | ||
41 | IB_PATH_ALTERNATE = (1<<2), | ||
42 | IB_PATH_OUTBOUND = (1<<3), | ||
43 | IB_PATH_INBOUND = (1<<4), | ||
44 | IB_PATH_INBOUND_REVERSE = (1<<5), | ||
45 | IB_PATH_BIDIRECTIONAL = IB_PATH_OUTBOUND | IB_PATH_INBOUND_REVERSE | ||
46 | }; | ||
47 | |||
48 | struct ib_path_rec_data { | ||
49 | __u32 flags; | ||
50 | __u32 reserved; | ||
51 | __u32 path_rec[16]; | ||
52 | }; | ||
53 | |||
54 | struct ib_user_path_rec { | ||
55 | __u8 dgid[16]; | ||
56 | __u8 sgid[16]; | ||
57 | __be16 dlid; | ||
58 | __be16 slid; | ||
59 | __u32 raw_traffic; | ||
60 | __be32 flow_label; | ||
61 | __u32 reversible; | ||
62 | __u32 mtu; | ||
63 | __be16 pkey; | ||
64 | __u8 hop_limit; | ||
65 | __u8 traffic_class; | ||
66 | __u8 numb_path; | ||
67 | __u8 sl; | ||
68 | __u8 mtu_selector; | ||
69 | __u8 rate_selector; | ||
70 | __u8 rate; | ||
71 | __u8 packet_life_time_selector; | ||
72 | __u8 packet_life_time; | ||
73 | __u8 preference; | ||
74 | }; | ||
75 | |||
76 | #endif /* IB_USER_SA_H */ | ||
diff --git a/include/rdma/ib_user_verbs.h b/include/rdma/ib_user_verbs.h new file mode 100644 index 00000000000..fe5b05177a2 --- /dev/null +++ b/include/rdma/ib_user_verbs.h | |||
@@ -0,0 +1,690 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005 Topspin Communications. All rights reserved. | ||
3 | * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved. | ||
4 | * Copyright (c) 2005 PathScale, Inc. All rights reserved. | ||
5 | * Copyright (c) 2006 Mellanox Technologies. 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 | |||
36 | #ifndef IB_USER_VERBS_H | ||
37 | #define IB_USER_VERBS_H | ||
38 | |||
39 | #include <linux/types.h> | ||
40 | |||
41 | /* | ||
42 | * Increment this value if any changes that break userspace ABI | ||
43 | * compatibility are made. | ||
44 | */ | ||
45 | #define IB_USER_VERBS_ABI_VERSION 6 | ||
46 | |||
47 | enum { | ||
48 | IB_USER_VERBS_CMD_GET_CONTEXT, | ||
49 | IB_USER_VERBS_CMD_QUERY_DEVICE, | ||
50 | IB_USER_VERBS_CMD_QUERY_PORT, | ||
51 | IB_USER_VERBS_CMD_ALLOC_PD, | ||
52 | IB_USER_VERBS_CMD_DEALLOC_PD, | ||
53 | IB_USER_VERBS_CMD_CREATE_AH, | ||
54 | IB_USER_VERBS_CMD_MODIFY_AH, | ||
55 | IB_USER_VERBS_CMD_QUERY_AH, | ||
56 | IB_USER_VERBS_CMD_DESTROY_AH, | ||
57 | IB_USER_VERBS_CMD_REG_MR, | ||
58 | IB_USER_VERBS_CMD_REG_SMR, | ||
59 | IB_USER_VERBS_CMD_REREG_MR, | ||
60 | IB_USER_VERBS_CMD_QUERY_MR, | ||
61 | IB_USER_VERBS_CMD_DEREG_MR, | ||
62 | IB_USER_VERBS_CMD_ALLOC_MW, | ||
63 | IB_USER_VERBS_CMD_BIND_MW, | ||
64 | IB_USER_VERBS_CMD_DEALLOC_MW, | ||
65 | IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL, | ||
66 | IB_USER_VERBS_CMD_CREATE_CQ, | ||
67 | IB_USER_VERBS_CMD_RESIZE_CQ, | ||
68 | IB_USER_VERBS_CMD_DESTROY_CQ, | ||
69 | IB_USER_VERBS_CMD_POLL_CQ, | ||
70 | IB_USER_VERBS_CMD_PEEK_CQ, | ||
71 | IB_USER_VERBS_CMD_REQ_NOTIFY_CQ, | ||
72 | IB_USER_VERBS_CMD_CREATE_QP, | ||
73 | IB_USER_VERBS_CMD_QUERY_QP, | ||
74 | IB_USER_VERBS_CMD_MODIFY_QP, | ||
75 | IB_USER_VERBS_CMD_DESTROY_QP, | ||
76 | IB_USER_VERBS_CMD_POST_SEND, | ||
77 | IB_USER_VERBS_CMD_POST_RECV, | ||
78 | IB_USER_VERBS_CMD_ATTACH_MCAST, | ||
79 | IB_USER_VERBS_CMD_DETACH_MCAST, | ||
80 | IB_USER_VERBS_CMD_CREATE_SRQ, | ||
81 | IB_USER_VERBS_CMD_MODIFY_SRQ, | ||
82 | IB_USER_VERBS_CMD_QUERY_SRQ, | ||
83 | IB_USER_VERBS_CMD_DESTROY_SRQ, | ||
84 | IB_USER_VERBS_CMD_POST_SRQ_RECV | ||
85 | }; | ||
86 | |||
87 | /* | ||
88 | * Make sure that all structs defined in this file remain laid out so | ||
89 | * that they pack the same way on 32-bit and 64-bit architectures (to | ||
90 | * avoid incompatibility between 32-bit userspace and 64-bit kernels). | ||
91 | * Specifically: | ||
92 | * - Do not use pointer types -- pass pointers in __u64 instead. | ||
93 | * - Make sure that any structure larger than 4 bytes is padded to a | ||
94 | * multiple of 8 bytes. Otherwise the structure size will be | ||
95 | * different between 32-bit and 64-bit architectures. | ||
96 | */ | ||
97 | |||
98 | struct ib_uverbs_async_event_desc { | ||
99 | __u64 element; | ||
100 | __u32 event_type; /* enum ib_event_type */ | ||
101 | __u32 reserved; | ||
102 | }; | ||
103 | |||
104 | struct ib_uverbs_comp_event_desc { | ||
105 | __u64 cq_handle; | ||
106 | }; | ||
107 | |||
108 | /* | ||
109 | * All commands from userspace should start with a __u32 command field | ||
110 | * followed by __u16 in_words and out_words fields (which give the | ||
111 | * length of the command block and response buffer if any in 32-bit | ||
112 | * words). The kernel driver will read these fields first and read | ||
113 | * the rest of the command struct based on these value. | ||
114 | */ | ||
115 | |||
116 | struct ib_uverbs_cmd_hdr { | ||
117 | __u32 command; | ||
118 | __u16 in_words; | ||
119 | __u16 out_words; | ||
120 | }; | ||
121 | |||
122 | struct ib_uverbs_get_context { | ||
123 | __u64 response; | ||
124 | __u64 driver_data[0]; | ||
125 | }; | ||
126 | |||
127 | struct ib_uverbs_get_context_resp { | ||
128 | __u32 async_fd; | ||
129 | __u32 num_comp_vectors; | ||
130 | }; | ||
131 | |||
132 | struct ib_uverbs_query_device { | ||
133 | __u64 response; | ||
134 | __u64 driver_data[0]; | ||
135 | }; | ||
136 | |||
137 | struct ib_uverbs_query_device_resp { | ||
138 | __u64 fw_ver; | ||
139 | __be64 node_guid; | ||
140 | __be64 sys_image_guid; | ||
141 | __u64 max_mr_size; | ||
142 | __u64 page_size_cap; | ||
143 | __u32 vendor_id; | ||
144 | __u32 vendor_part_id; | ||
145 | __u32 hw_ver; | ||
146 | __u32 max_qp; | ||
147 | __u32 max_qp_wr; | ||
148 | __u32 device_cap_flags; | ||
149 | __u32 max_sge; | ||
150 | __u32 max_sge_rd; | ||
151 | __u32 max_cq; | ||
152 | __u32 max_cqe; | ||
153 | __u32 max_mr; | ||
154 | __u32 max_pd; | ||
155 | __u32 max_qp_rd_atom; | ||
156 | __u32 max_ee_rd_atom; | ||
157 | __u32 max_res_rd_atom; | ||
158 | __u32 max_qp_init_rd_atom; | ||
159 | __u32 max_ee_init_rd_atom; | ||
160 | __u32 atomic_cap; | ||
161 | __u32 max_ee; | ||
162 | __u32 max_rdd; | ||
163 | __u32 max_mw; | ||
164 | __u32 max_raw_ipv6_qp; | ||
165 | __u32 max_raw_ethy_qp; | ||
166 | __u32 max_mcast_grp; | ||
167 | __u32 max_mcast_qp_attach; | ||
168 | __u32 max_total_mcast_qp_attach; | ||
169 | __u32 max_ah; | ||
170 | __u32 max_fmr; | ||
171 | __u32 max_map_per_fmr; | ||
172 | __u32 max_srq; | ||
173 | __u32 max_srq_wr; | ||
174 | __u32 max_srq_sge; | ||
175 | __u16 max_pkeys; | ||
176 | __u8 local_ca_ack_delay; | ||
177 | __u8 phys_port_cnt; | ||
178 | __u8 reserved[4]; | ||
179 | }; | ||
180 | |||
181 | struct ib_uverbs_query_port { | ||
182 | __u64 response; | ||
183 | __u8 port_num; | ||
184 | __u8 reserved[7]; | ||
185 | __u64 driver_data[0]; | ||
186 | }; | ||
187 | |||
188 | struct ib_uverbs_query_port_resp { | ||
189 | __u32 port_cap_flags; | ||
190 | __u32 max_msg_sz; | ||
191 | __u32 bad_pkey_cntr; | ||
192 | __u32 qkey_viol_cntr; | ||
193 | __u32 gid_tbl_len; | ||
194 | __u16 pkey_tbl_len; | ||
195 | __u16 lid; | ||
196 | __u16 sm_lid; | ||
197 | __u8 state; | ||
198 | __u8 max_mtu; | ||
199 | __u8 active_mtu; | ||
200 | __u8 lmc; | ||
201 | __u8 max_vl_num; | ||
202 | __u8 sm_sl; | ||
203 | __u8 subnet_timeout; | ||
204 | __u8 init_type_reply; | ||
205 | __u8 active_width; | ||
206 | __u8 active_speed; | ||
207 | __u8 phys_state; | ||
208 | __u8 link_layer; | ||
209 | __u8 reserved[2]; | ||
210 | }; | ||
211 | |||
212 | struct ib_uverbs_alloc_pd { | ||
213 | __u64 response; | ||
214 | __u64 driver_data[0]; | ||
215 | }; | ||
216 | |||
217 | struct ib_uverbs_alloc_pd_resp { | ||
218 | __u32 pd_handle; | ||
219 | }; | ||
220 | |||
221 | struct ib_uverbs_dealloc_pd { | ||
222 | __u32 pd_handle; | ||
223 | }; | ||
224 | |||
225 | struct ib_uverbs_reg_mr { | ||
226 | __u64 response; | ||
227 | __u64 start; | ||
228 | __u64 length; | ||
229 | __u64 hca_va; | ||
230 | __u32 pd_handle; | ||
231 | __u32 access_flags; | ||
232 | __u64 driver_data[0]; | ||
233 | }; | ||
234 | |||
235 | struct ib_uverbs_reg_mr_resp { | ||
236 | __u32 mr_handle; | ||
237 | __u32 lkey; | ||
238 | __u32 rkey; | ||
239 | }; | ||
240 | |||
241 | struct ib_uverbs_dereg_mr { | ||
242 | __u32 mr_handle; | ||
243 | }; | ||
244 | |||
245 | struct ib_uverbs_create_comp_channel { | ||
246 | __u64 response; | ||
247 | }; | ||
248 | |||
249 | struct ib_uverbs_create_comp_channel_resp { | ||
250 | __u32 fd; | ||
251 | }; | ||
252 | |||
253 | struct ib_uverbs_create_cq { | ||
254 | __u64 response; | ||
255 | __u64 user_handle; | ||
256 | __u32 cqe; | ||
257 | __u32 comp_vector; | ||
258 | __s32 comp_channel; | ||
259 | __u32 reserved; | ||
260 | __u64 driver_data[0]; | ||
261 | }; | ||
262 | |||
263 | struct ib_uverbs_create_cq_resp { | ||
264 | __u32 cq_handle; | ||
265 | __u32 cqe; | ||
266 | }; | ||
267 | |||
268 | struct ib_uverbs_resize_cq { | ||
269 | __u64 response; | ||
270 | __u32 cq_handle; | ||
271 | __u32 cqe; | ||
272 | __u64 driver_data[0]; | ||
273 | }; | ||
274 | |||
275 | struct ib_uverbs_resize_cq_resp { | ||
276 | __u32 cqe; | ||
277 | __u32 reserved; | ||
278 | __u64 driver_data[0]; | ||
279 | }; | ||
280 | |||
281 | struct ib_uverbs_poll_cq { | ||
282 | __u64 response; | ||
283 | __u32 cq_handle; | ||
284 | __u32 ne; | ||
285 | }; | ||
286 | |||
287 | struct ib_uverbs_wc { | ||
288 | __u64 wr_id; | ||
289 | __u32 status; | ||
290 | __u32 opcode; | ||
291 | __u32 vendor_err; | ||
292 | __u32 byte_len; | ||
293 | union { | ||
294 | __u32 imm_data; | ||
295 | __u32 invalidate_rkey; | ||
296 | } ex; | ||
297 | __u32 qp_num; | ||
298 | __u32 src_qp; | ||
299 | __u32 wc_flags; | ||
300 | __u16 pkey_index; | ||
301 | __u16 slid; | ||
302 | __u8 sl; | ||
303 | __u8 dlid_path_bits; | ||
304 | __u8 port_num; | ||
305 | __u8 reserved; | ||
306 | }; | ||
307 | |||
308 | struct ib_uverbs_poll_cq_resp { | ||
309 | __u32 count; | ||
310 | __u32 reserved; | ||
311 | struct ib_uverbs_wc wc[0]; | ||
312 | }; | ||
313 | |||
314 | struct ib_uverbs_req_notify_cq { | ||
315 | __u32 cq_handle; | ||
316 | __u32 solicited_only; | ||
317 | }; | ||
318 | |||
319 | struct ib_uverbs_destroy_cq { | ||
320 | __u64 response; | ||
321 | __u32 cq_handle; | ||
322 | __u32 reserved; | ||
323 | }; | ||
324 | |||
325 | struct ib_uverbs_destroy_cq_resp { | ||
326 | __u32 comp_events_reported; | ||
327 | __u32 async_events_reported; | ||
328 | }; | ||
329 | |||
330 | struct ib_uverbs_global_route { | ||
331 | __u8 dgid[16]; | ||
332 | __u32 flow_label; | ||
333 | __u8 sgid_index; | ||
334 | __u8 hop_limit; | ||
335 | __u8 traffic_class; | ||
336 | __u8 reserved; | ||
337 | }; | ||
338 | |||
339 | struct ib_uverbs_ah_attr { | ||
340 | struct ib_uverbs_global_route grh; | ||
341 | __u16 dlid; | ||
342 | __u8 sl; | ||
343 | __u8 src_path_bits; | ||
344 | __u8 static_rate; | ||
345 | __u8 is_global; | ||
346 | __u8 port_num; | ||
347 | __u8 reserved; | ||
348 | }; | ||
349 | |||
350 | struct ib_uverbs_qp_attr { | ||
351 | __u32 qp_attr_mask; | ||
352 | __u32 qp_state; | ||
353 | __u32 cur_qp_state; | ||
354 | __u32 path_mtu; | ||
355 | __u32 path_mig_state; | ||
356 | __u32 qkey; | ||
357 | __u32 rq_psn; | ||
358 | __u32 sq_psn; | ||
359 | __u32 dest_qp_num; | ||
360 | __u32 qp_access_flags; | ||
361 | |||
362 | struct ib_uverbs_ah_attr ah_attr; | ||
363 | struct ib_uverbs_ah_attr alt_ah_attr; | ||
364 | |||
365 | /* ib_qp_cap */ | ||
366 | __u32 max_send_wr; | ||
367 | __u32 max_recv_wr; | ||
368 | __u32 max_send_sge; | ||
369 | __u32 max_recv_sge; | ||
370 | __u32 max_inline_data; | ||
371 | |||
372 | __u16 pkey_index; | ||
373 | __u16 alt_pkey_index; | ||
374 | __u8 en_sqd_async_notify; | ||
375 | __u8 sq_draining; | ||
376 | __u8 max_rd_atomic; | ||
377 | __u8 max_dest_rd_atomic; | ||
378 | __u8 min_rnr_timer; | ||
379 | __u8 port_num; | ||
380 | __u8 timeout; | ||
381 | __u8 retry_cnt; | ||
382 | __u8 rnr_retry; | ||
383 | __u8 alt_port_num; | ||
384 | __u8 alt_timeout; | ||
385 | __u8 reserved[5]; | ||
386 | }; | ||
387 | |||
388 | struct ib_uverbs_create_qp { | ||
389 | __u64 response; | ||
390 | __u64 user_handle; | ||
391 | __u32 pd_handle; | ||
392 | __u32 send_cq_handle; | ||
393 | __u32 recv_cq_handle; | ||
394 | __u32 srq_handle; | ||
395 | __u32 max_send_wr; | ||
396 | __u32 max_recv_wr; | ||
397 | __u32 max_send_sge; | ||
398 | __u32 max_recv_sge; | ||
399 | __u32 max_inline_data; | ||
400 | __u8 sq_sig_all; | ||
401 | __u8 qp_type; | ||
402 | __u8 is_srq; | ||
403 | __u8 reserved; | ||
404 | __u64 driver_data[0]; | ||
405 | }; | ||
406 | |||
407 | struct ib_uverbs_create_qp_resp { | ||
408 | __u32 qp_handle; | ||
409 | __u32 qpn; | ||
410 | __u32 max_send_wr; | ||
411 | __u32 max_recv_wr; | ||
412 | __u32 max_send_sge; | ||
413 | __u32 max_recv_sge; | ||
414 | __u32 max_inline_data; | ||
415 | __u32 reserved; | ||
416 | }; | ||
417 | |||
418 | /* | ||
419 | * This struct needs to remain a multiple of 8 bytes to keep the | ||
420 | * alignment of the modify QP parameters. | ||
421 | */ | ||
422 | struct ib_uverbs_qp_dest { | ||
423 | __u8 dgid[16]; | ||
424 | __u32 flow_label; | ||
425 | __u16 dlid; | ||
426 | __u16 reserved; | ||
427 | __u8 sgid_index; | ||
428 | __u8 hop_limit; | ||
429 | __u8 traffic_class; | ||
430 | __u8 sl; | ||
431 | __u8 src_path_bits; | ||
432 | __u8 static_rate; | ||
433 | __u8 is_global; | ||
434 | __u8 port_num; | ||
435 | }; | ||
436 | |||
437 | struct ib_uverbs_query_qp { | ||
438 | __u64 response; | ||
439 | __u32 qp_handle; | ||
440 | __u32 attr_mask; | ||
441 | __u64 driver_data[0]; | ||
442 | }; | ||
443 | |||
444 | struct ib_uverbs_query_qp_resp { | ||
445 | struct ib_uverbs_qp_dest dest; | ||
446 | struct ib_uverbs_qp_dest alt_dest; | ||
447 | __u32 max_send_wr; | ||
448 | __u32 max_recv_wr; | ||
449 | __u32 max_send_sge; | ||
450 | __u32 max_recv_sge; | ||
451 | __u32 max_inline_data; | ||
452 | __u32 qkey; | ||
453 | __u32 rq_psn; | ||
454 | __u32 sq_psn; | ||
455 | __u32 dest_qp_num; | ||
456 | __u32 qp_access_flags; | ||
457 | __u16 pkey_index; | ||
458 | __u16 alt_pkey_index; | ||
459 | __u8 qp_state; | ||
460 | __u8 cur_qp_state; | ||
461 | __u8 path_mtu; | ||
462 | __u8 path_mig_state; | ||
463 | __u8 sq_draining; | ||
464 | __u8 max_rd_atomic; | ||
465 | __u8 max_dest_rd_atomic; | ||
466 | __u8 min_rnr_timer; | ||
467 | __u8 port_num; | ||
468 | __u8 timeout; | ||
469 | __u8 retry_cnt; | ||
470 | __u8 rnr_retry; | ||
471 | __u8 alt_port_num; | ||
472 | __u8 alt_timeout; | ||
473 | __u8 sq_sig_all; | ||
474 | __u8 reserved[5]; | ||
475 | __u64 driver_data[0]; | ||
476 | }; | ||
477 | |||
478 | struct ib_uverbs_modify_qp { | ||
479 | struct ib_uverbs_qp_dest dest; | ||
480 | struct ib_uverbs_qp_dest alt_dest; | ||
481 | __u32 qp_handle; | ||
482 | __u32 attr_mask; | ||
483 | __u32 qkey; | ||
484 | __u32 rq_psn; | ||
485 | __u32 sq_psn; | ||
486 | __u32 dest_qp_num; | ||
487 | __u32 qp_access_flags; | ||
488 | __u16 pkey_index; | ||
489 | __u16 alt_pkey_index; | ||
490 | __u8 qp_state; | ||
491 | __u8 cur_qp_state; | ||
492 | __u8 path_mtu; | ||
493 | __u8 path_mig_state; | ||
494 | __u8 en_sqd_async_notify; | ||
495 | __u8 max_rd_atomic; | ||
496 | __u8 max_dest_rd_atomic; | ||
497 | __u8 min_rnr_timer; | ||
498 | __u8 port_num; | ||
499 | __u8 timeout; | ||
500 | __u8 retry_cnt; | ||
501 | __u8 rnr_retry; | ||
502 | __u8 alt_port_num; | ||
503 | __u8 alt_timeout; | ||
504 | __u8 reserved[2]; | ||
505 | __u64 driver_data[0]; | ||
506 | }; | ||
507 | |||
508 | struct ib_uverbs_modify_qp_resp { | ||
509 | }; | ||
510 | |||
511 | struct ib_uverbs_destroy_qp { | ||
512 | __u64 response; | ||
513 | __u32 qp_handle; | ||
514 | __u32 reserved; | ||
515 | }; | ||
516 | |||
517 | struct ib_uverbs_destroy_qp_resp { | ||
518 | __u32 events_reported; | ||
519 | }; | ||
520 | |||
521 | /* | ||
522 | * The ib_uverbs_sge structure isn't used anywhere, since we assume | ||
523 | * the ib_sge structure is packed the same way on 32-bit and 64-bit | ||
524 | * architectures in both kernel and user space. It's just here to | ||
525 | * document the ABI. | ||
526 | */ | ||
527 | struct ib_uverbs_sge { | ||
528 | __u64 addr; | ||
529 | __u32 length; | ||
530 | __u32 lkey; | ||
531 | }; | ||
532 | |||
533 | struct ib_uverbs_send_wr { | ||
534 | __u64 wr_id; | ||
535 | __u32 num_sge; | ||
536 | __u32 opcode; | ||
537 | __u32 send_flags; | ||
538 | union { | ||
539 | __u32 imm_data; | ||
540 | __u32 invalidate_rkey; | ||
541 | } ex; | ||
542 | union { | ||
543 | struct { | ||
544 | __u64 remote_addr; | ||
545 | __u32 rkey; | ||
546 | __u32 reserved; | ||
547 | } rdma; | ||
548 | struct { | ||
549 | __u64 remote_addr; | ||
550 | __u64 compare_add; | ||
551 | __u64 swap; | ||
552 | __u32 rkey; | ||
553 | __u32 reserved; | ||
554 | } atomic; | ||
555 | struct { | ||
556 | __u32 ah; | ||
557 | __u32 remote_qpn; | ||
558 | __u32 remote_qkey; | ||
559 | __u32 reserved; | ||
560 | } ud; | ||
561 | } wr; | ||
562 | }; | ||
563 | |||
564 | struct ib_uverbs_post_send { | ||
565 | __u64 response; | ||
566 | __u32 qp_handle; | ||
567 | __u32 wr_count; | ||
568 | __u32 sge_count; | ||
569 | __u32 wqe_size; | ||
570 | struct ib_uverbs_send_wr send_wr[0]; | ||
571 | }; | ||
572 | |||
573 | struct ib_uverbs_post_send_resp { | ||
574 | __u32 bad_wr; | ||
575 | }; | ||
576 | |||
577 | struct ib_uverbs_recv_wr { | ||
578 | __u64 wr_id; | ||
579 | __u32 num_sge; | ||
580 | __u32 reserved; | ||
581 | }; | ||
582 | |||
583 | struct ib_uverbs_post_recv { | ||
584 | __u64 response; | ||
585 | __u32 qp_handle; | ||
586 | __u32 wr_count; | ||
587 | __u32 sge_count; | ||
588 | __u32 wqe_size; | ||
589 | struct ib_uverbs_recv_wr recv_wr[0]; | ||
590 | }; | ||
591 | |||
592 | struct ib_uverbs_post_recv_resp { | ||
593 | __u32 bad_wr; | ||
594 | }; | ||
595 | |||
596 | struct ib_uverbs_post_srq_recv { | ||
597 | __u64 response; | ||
598 | __u32 srq_handle; | ||
599 | __u32 wr_count; | ||
600 | __u32 sge_count; | ||
601 | __u32 wqe_size; | ||
602 | struct ib_uverbs_recv_wr recv[0]; | ||
603 | }; | ||
604 | |||
605 | struct ib_uverbs_post_srq_recv_resp { | ||
606 | __u32 bad_wr; | ||
607 | }; | ||
608 | |||
609 | struct ib_uverbs_create_ah { | ||
610 | __u64 response; | ||
611 | __u64 user_handle; | ||
612 | __u32 pd_handle; | ||
613 | __u32 reserved; | ||
614 | struct ib_uverbs_ah_attr attr; | ||
615 | }; | ||
616 | |||
617 | struct ib_uverbs_create_ah_resp { | ||
618 | __u32 ah_handle; | ||
619 | }; | ||
620 | |||
621 | struct ib_uverbs_destroy_ah { | ||
622 | __u32 ah_handle; | ||
623 | }; | ||
624 | |||
625 | struct ib_uverbs_attach_mcast { | ||
626 | __u8 gid[16]; | ||
627 | __u32 qp_handle; | ||
628 | __u16 mlid; | ||
629 | __u16 reserved; | ||
630 | __u64 driver_data[0]; | ||
631 | }; | ||
632 | |||
633 | struct ib_uverbs_detach_mcast { | ||
634 | __u8 gid[16]; | ||
635 | __u32 qp_handle; | ||
636 | __u16 mlid; | ||
637 | __u16 reserved; | ||
638 | __u64 driver_data[0]; | ||
639 | }; | ||
640 | |||
641 | struct ib_uverbs_create_srq { | ||
642 | __u64 response; | ||
643 | __u64 user_handle; | ||
644 | __u32 pd_handle; | ||
645 | __u32 max_wr; | ||
646 | __u32 max_sge; | ||
647 | __u32 srq_limit; | ||
648 | __u64 driver_data[0]; | ||
649 | }; | ||
650 | |||
651 | struct ib_uverbs_create_srq_resp { | ||
652 | __u32 srq_handle; | ||
653 | __u32 max_wr; | ||
654 | __u32 max_sge; | ||
655 | __u32 reserved; | ||
656 | }; | ||
657 | |||
658 | struct ib_uverbs_modify_srq { | ||
659 | __u32 srq_handle; | ||
660 | __u32 attr_mask; | ||
661 | __u32 max_wr; | ||
662 | __u32 srq_limit; | ||
663 | __u64 driver_data[0]; | ||
664 | }; | ||
665 | |||
666 | struct ib_uverbs_query_srq { | ||
667 | __u64 response; | ||
668 | __u32 srq_handle; | ||
669 | __u32 reserved; | ||
670 | __u64 driver_data[0]; | ||
671 | }; | ||
672 | |||
673 | struct ib_uverbs_query_srq_resp { | ||
674 | __u32 max_wr; | ||
675 | __u32 max_sge; | ||
676 | __u32 srq_limit; | ||
677 | __u32 reserved; | ||
678 | }; | ||
679 | |||
680 | struct ib_uverbs_destroy_srq { | ||
681 | __u64 response; | ||
682 | __u32 srq_handle; | ||
683 | __u32 reserved; | ||
684 | }; | ||
685 | |||
686 | struct ib_uverbs_destroy_srq_resp { | ||
687 | __u32 events_reported; | ||
688 | }; | ||
689 | |||
690 | #endif /* IB_USER_VERBS_H */ | ||
diff --git a/include/rdma/rdma_user_cm.h b/include/rdma/rdma_user_cm.h new file mode 100644 index 00000000000..fc82c1896f7 --- /dev/null +++ b/include/rdma/rdma_user_cm.h | |||
@@ -0,0 +1,247 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005-2006 Intel Corporation. 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 | |||
33 | #ifndef RDMA_USER_CM_H | ||
34 | #define RDMA_USER_CM_H | ||
35 | |||
36 | #include <linux/types.h> | ||
37 | #include <linux/in6.h> | ||
38 | #include <rdma/ib_user_verbs.h> | ||
39 | #include <rdma/ib_user_sa.h> | ||
40 | |||
41 | #define RDMA_USER_CM_ABI_VERSION 4 | ||
42 | |||
43 | #define RDMA_MAX_PRIVATE_DATA 256 | ||
44 | |||
45 | enum { | ||
46 | RDMA_USER_CM_CMD_CREATE_ID, | ||
47 | RDMA_USER_CM_CMD_DESTROY_ID, | ||
48 | RDMA_USER_CM_CMD_BIND_ADDR, | ||
49 | RDMA_USER_CM_CMD_RESOLVE_ADDR, | ||
50 | RDMA_USER_CM_CMD_RESOLVE_ROUTE, | ||
51 | RDMA_USER_CM_CMD_QUERY_ROUTE, | ||
52 | RDMA_USER_CM_CMD_CONNECT, | ||
53 | RDMA_USER_CM_CMD_LISTEN, | ||
54 | RDMA_USER_CM_CMD_ACCEPT, | ||
55 | RDMA_USER_CM_CMD_REJECT, | ||
56 | RDMA_USER_CM_CMD_DISCONNECT, | ||
57 | RDMA_USER_CM_CMD_INIT_QP_ATTR, | ||
58 | RDMA_USER_CM_CMD_GET_EVENT, | ||
59 | RDMA_USER_CM_CMD_GET_OPTION, | ||
60 | RDMA_USER_CM_CMD_SET_OPTION, | ||
61 | RDMA_USER_CM_CMD_NOTIFY, | ||
62 | RDMA_USER_CM_CMD_JOIN_MCAST, | ||
63 | RDMA_USER_CM_CMD_LEAVE_MCAST, | ||
64 | RDMA_USER_CM_CMD_MIGRATE_ID | ||
65 | }; | ||
66 | |||
67 | /* | ||
68 | * command ABI structures. | ||
69 | */ | ||
70 | struct rdma_ucm_cmd_hdr { | ||
71 | __u32 cmd; | ||
72 | __u16 in; | ||
73 | __u16 out; | ||
74 | }; | ||
75 | |||
76 | struct rdma_ucm_create_id { | ||
77 | __u64 uid; | ||
78 | __u64 response; | ||
79 | __u16 ps; | ||
80 | __u8 reserved[6]; | ||
81 | }; | ||
82 | |||
83 | struct rdma_ucm_create_id_resp { | ||
84 | __u32 id; | ||
85 | }; | ||
86 | |||
87 | struct rdma_ucm_destroy_id { | ||
88 | __u64 response; | ||
89 | __u32 id; | ||
90 | __u32 reserved; | ||
91 | }; | ||
92 | |||
93 | struct rdma_ucm_destroy_id_resp { | ||
94 | __u32 events_reported; | ||
95 | }; | ||
96 | |||
97 | struct rdma_ucm_bind_addr { | ||
98 | __u64 response; | ||
99 | struct sockaddr_in6 addr; | ||
100 | __u32 id; | ||
101 | }; | ||
102 | |||
103 | struct rdma_ucm_resolve_addr { | ||
104 | struct sockaddr_in6 src_addr; | ||
105 | struct sockaddr_in6 dst_addr; | ||
106 | __u32 id; | ||
107 | __u32 timeout_ms; | ||
108 | }; | ||
109 | |||
110 | struct rdma_ucm_resolve_route { | ||
111 | __u32 id; | ||
112 | __u32 timeout_ms; | ||
113 | }; | ||
114 | |||
115 | struct rdma_ucm_query_route { | ||
116 | __u64 response; | ||
117 | __u32 id; | ||
118 | __u32 reserved; | ||
119 | }; | ||
120 | |||
121 | struct rdma_ucm_query_route_resp { | ||
122 | __u64 node_guid; | ||
123 | struct ib_user_path_rec ib_route[2]; | ||
124 | struct sockaddr_in6 src_addr; | ||
125 | struct sockaddr_in6 dst_addr; | ||
126 | __u32 num_paths; | ||
127 | __u8 port_num; | ||
128 | __u8 reserved[3]; | ||
129 | }; | ||
130 | |||
131 | struct rdma_ucm_conn_param { | ||
132 | __u32 qp_num; | ||
133 | __u32 reserved; | ||
134 | __u8 private_data[RDMA_MAX_PRIVATE_DATA]; | ||
135 | __u8 private_data_len; | ||
136 | __u8 srq; | ||
137 | __u8 responder_resources; | ||
138 | __u8 initiator_depth; | ||
139 | __u8 flow_control; | ||
140 | __u8 retry_count; | ||
141 | __u8 rnr_retry_count; | ||
142 | __u8 valid; | ||
143 | }; | ||
144 | |||
145 | struct rdma_ucm_ud_param { | ||
146 | __u32 qp_num; | ||
147 | __u32 qkey; | ||
148 | struct ib_uverbs_ah_attr ah_attr; | ||
149 | __u8 private_data[RDMA_MAX_PRIVATE_DATA]; | ||
150 | __u8 private_data_len; | ||
151 | __u8 reserved[7]; | ||
152 | }; | ||
153 | |||
154 | struct rdma_ucm_connect { | ||
155 | struct rdma_ucm_conn_param conn_param; | ||
156 | __u32 id; | ||
157 | __u32 reserved; | ||
158 | }; | ||
159 | |||
160 | struct rdma_ucm_listen { | ||
161 | __u32 id; | ||
162 | __u32 backlog; | ||
163 | }; | ||
164 | |||
165 | struct rdma_ucm_accept { | ||
166 | __u64 uid; | ||
167 | struct rdma_ucm_conn_param conn_param; | ||
168 | __u32 id; | ||
169 | __u32 reserved; | ||
170 | }; | ||
171 | |||
172 | struct rdma_ucm_reject { | ||
173 | __u32 id; | ||
174 | __u8 private_data_len; | ||
175 | __u8 reserved[3]; | ||
176 | __u8 private_data[RDMA_MAX_PRIVATE_DATA]; | ||
177 | }; | ||
178 | |||
179 | struct rdma_ucm_disconnect { | ||
180 | __u32 id; | ||
181 | }; | ||
182 | |||
183 | struct rdma_ucm_init_qp_attr { | ||
184 | __u64 response; | ||
185 | __u32 id; | ||
186 | __u32 qp_state; | ||
187 | }; | ||
188 | |||
189 | struct rdma_ucm_notify { | ||
190 | __u32 id; | ||
191 | __u32 event; | ||
192 | }; | ||
193 | |||
194 | struct rdma_ucm_join_mcast { | ||
195 | __u64 response; /* rdma_ucm_create_id_resp */ | ||
196 | __u64 uid; | ||
197 | struct sockaddr_in6 addr; | ||
198 | __u32 id; | ||
199 | }; | ||
200 | |||
201 | struct rdma_ucm_get_event { | ||
202 | __u64 response; | ||
203 | }; | ||
204 | |||
205 | struct rdma_ucm_event_resp { | ||
206 | __u64 uid; | ||
207 | __u32 id; | ||
208 | __u32 event; | ||
209 | __u32 status; | ||
210 | union { | ||
211 | struct rdma_ucm_conn_param conn; | ||
212 | struct rdma_ucm_ud_param ud; | ||
213 | } param; | ||
214 | }; | ||
215 | |||
216 | /* Option levels */ | ||
217 | enum { | ||
218 | RDMA_OPTION_ID = 0, | ||
219 | RDMA_OPTION_IB = 1 | ||
220 | }; | ||
221 | |||
222 | /* Option details */ | ||
223 | enum { | ||
224 | RDMA_OPTION_ID_TOS = 0, | ||
225 | RDMA_OPTION_ID_REUSEADDR = 1, | ||
226 | RDMA_OPTION_IB_PATH = 1 | ||
227 | }; | ||
228 | |||
229 | struct rdma_ucm_set_option { | ||
230 | __u64 optval; | ||
231 | __u32 id; | ||
232 | __u32 level; | ||
233 | __u32 optname; | ||
234 | __u32 optlen; | ||
235 | }; | ||
236 | |||
237 | struct rdma_ucm_migrate_id { | ||
238 | __u64 response; | ||
239 | __u32 id; | ||
240 | __u32 fd; | ||
241 | }; | ||
242 | |||
243 | struct rdma_ucm_migrate_resp { | ||
244 | __u32 events_reported; | ||
245 | }; | ||
246 | |||
247 | #endif /* RDMA_USER_CM_H */ | ||