winverbs: fixes to support OFED compatibility libraries and ND
[mirror/winof/.git] / core / winverbs / wv_ioctl.h
1 /*\r
2  * Copyright (c) 2008 Intel Corporation. All rights reserved.\r
3  *\r
4  * This software is available to you under the OpenIB.org BSD license\r
5  * below:\r
6  *\r
7  *     Redistribution and use in source and binary forms, with or\r
8  *     without modification, are permitted provided that the following\r
9  *     conditions are met:\r
10  *\r
11  *      - Redistributions of source code must retain the above\r
12  *        copyright notice, this list of conditions and the following\r
13  *        disclaimer.\r
14  *\r
15  *      - Redistributions in binary form must reproduce the above\r
16  *        copyright notice, this list of conditions and the following\r
17  *        disclaimer in the documentation and/or other materials\r
18  *        provided with the distribution.\r
19  *\r
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AWV\r
23  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
24  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
25  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
26  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
27  * SOFTWARE.\r
28  */\r
29 \r
30 #pragma once\r
31 \r
32 #ifndef _WV_IOCTL_H_\r
33 #define _WV_IOCTL_H_\r
34 \r
35 typedef UINT16 NET16;\r
36 typedef UINT32 NET32;\r
37 typedef UINT64 NET64;\r
38 \r
39 #define WV_IOCTL(f)     CTL_CODE(FILE_DEVICE_INFINIBAND, f, METHOD_BUFFERED,\\r
40                                                          FILE_READ_DATA | FILE_WRITE_DATA)\r
41 \r
42 // input parameter / output parameter\r
43 // IOCTL\r
44 #define WV_IO_FUNCTION_BASE                             0x800\r
45 \r
46 enum {\r
47         WV_IO_FUNCTION_MIN,\r
48         WV_IO_FUNCTION_GUID_QUERY,\r
49         WV_IO_FUNCTION_LIBRARY_QUERY,\r
50         WV_IO_FUNCTION_DEVICE_OPEN,\r
51         WV_IO_FUNCTION_DEVICE_CLOSE,\r
52         WV_IO_FUNCTION_DEVICE_QUERY,\r
53         WV_IO_FUNCTION_DEVICE_PORT_QUERY,\r
54         WV_IO_FUNCTION_DEVICE_GID_QUERY,\r
55         WV_IO_FUNCTION_DEVICE_PKEY_QUERY,\r
56         WV_IO_FUNCTION_DEVICE_NOTIFY,\r
57         WV_IO_FUNCTION_DEVICE_CANCEL,\r
58         WV_IO_FUNCTION_PD_ALLOCATE,\r
59         WV_IO_FUNCTION_PD_DEALLOCATE,\r
60         WV_IO_FUNCTION_MEMORY_REGISTER,\r
61         WV_IO_FUNCTION_MEMORY_DEREGISTER,\r
62         WV_IO_FUNCTION_MW_ALLOCATE,\r
63         WV_IO_FUNCTION_MW_DEALLOCATE,\r
64         WV_IO_FUNCTION_AH_CREATE,\r
65         WV_IO_FUNCTION_AH_DESTROY,\r
66         WV_IO_FUNCTION_CQ_CREATE,\r
67         WV_IO_FUNCTION_CQ_DESTROY,\r
68         WV_IO_FUNCTION_CQ_RESIZE,\r
69         WV_IO_FUNCTION_CQ_NOTIFY,\r
70         WV_IO_FUNCTION_CQ_CANCEL,\r
71         WV_IO_FUNCTION_SRQ_CREATE,\r
72         WV_IO_FUNCTION_SRQ_DESTROY,\r
73         WV_IO_FUNCTION_SRQ_QUERY,\r
74         WV_IO_FUNCTION_SRQ_MODIFY,\r
75         WV_IO_FUNCTION_SRQ_NOTIFY,\r
76         WV_IO_FUNCTION_SRQ_CANCEL,\r
77         WV_IO_FUNCTION_QP_CREATE,\r
78         WV_IO_FUNCTION_QP_DESTROY,\r
79         WV_IO_FUNCTION_QP_QUERY,\r
80         WV_IO_FUNCTION_QP_MODIFY,\r
81         WV_IO_FUNCTION_QP_ATTACH,\r
82         WV_IO_FUNCTION_QP_DETACH,\r
83         WV_IO_FUNCTION_QP_CANCEL,\r
84         WV_IO_FUNCTION_EP_CREATE,\r
85         WV_IO_FUNCTION_EP_DESTROY,\r
86         WV_IO_FUNCTION_EP_MODIFY,\r
87         WV_IO_FUNCTION_EP_BIND,\r
88         WV_IO_FUNCTION_EP_REJECT,\r
89         WV_IO_FUNCTION_EP_CONNECT,\r
90         WV_IO_FUNCTION_EP_ACCEPT,\r
91         WV_IO_FUNCTION_EP_DISCONNECT,\r
92         WV_IO_FUNCTION_EP_DISCONNECT_NOTIFY,\r
93         WV_IO_FUNCTION_EP_QUERY,\r
94         WV_IO_FUNCTION_EP_LOOKUP,\r
95         WV_IO_FUNCTION_EP_MULTICAST_JOIN,\r
96         WV_IO_FUNCTION_EP_MULTICAST_LEAVE,\r
97         WV_IO_FUNCTION_EP_CANCEL,\r
98         WV_IO_FUNCTION_EP_LISTEN,\r
99         WV_IO_FUNCTION_EP_GET_REQUEST,\r
100         WV_IO_FUNCTION_MAX\r
101 };\r
102 \r
103 // none / WV_IO_GUID_LIST\r
104 #define WV_IOCTL_GUID_QUERY                             WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
105                                                                                                  WV_IO_FUNCTION_GUID_QUERY)\r
106 \r
107 // NET64 Guid / LibraryName\r
108 #define WV_IOCTL_LIBRARY_QUERY                  WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
109                                                                                                  WV_IO_FUNCTION_LIBRARY_QUERY)\r
110 \r
111 // WV_IO_ID / WV_IO_ID\r
112 #define WV_IOCTL_DEVICE_OPEN                    WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
113                                                                                                  WV_IO_FUNCTION_DEVICE_OPEN)\r
114 \r
115 // UINT64 Id / none\r
116 #define WV_IOCTL_DEVICE_CLOSE                   WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
117                                                                                                  WV_IO_FUNCTION_DEVICE_CLOSE)\r
118 \r
119 // UINT64 Id / WV_IO_DEVICE_ATTRIBUTES\r
120 #define WV_IOCTL_DEVICE_QUERY                   WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
121                                                                                                  WV_IO_FUNCTION_DEVICE_QUERY)\r
122 \r
123 // WV_IO_DEVICE_PORT_QUERY / WV_IO_PORT_ATTRIBUTES == WV_PORT_ATTRIBUTES\r
124 #define WV_IOCTL_DEVICE_PORT_QUERY              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
125                                                                                                  WV_IO_FUNCTION_DEVICE_PORT_QUERY)\r
126 \r
127 // WV_IO_DEVICE_PORT_QUERY / WV_IO_GID[] == WV_GID[]\r
128 #define WV_IOCTL_DEVICE_GID_QUERY               WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
129                                                                                                  WV_IO_FUNCTION_DEVICE_GID_QUERY)\r
130 \r
131 // WV_IO_DEVICE_PORT_QUERY / NET16 Pkey[]\r
132 #define WV_IOCTL_DEVICE_PKEY_QUERY              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
133                                                                                                  WV_IO_FUNCTION_DEVICE_PKEY_QUERY)\r
134 \r
135 // WV_IO_ID / DWORD\r
136 #define WV_IOCTL_DEVICE_NOTIFY                  WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
137                                                                                                  WV_IO_FUNCTION_DEVICE_NOTIFY)\r
138 \r
139 // UINT64 Id / none\r
140 #define WV_IOCTL_DEVICE_CANCEL                  WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
141                                                                                                  WV_IO_FUNCTION_DEVICE_CANCEL)\r
142 \r
143 // WV_IO_ID / WV_IO_ID\r
144 #define WV_IOCTL_PD_ALLOCATE                    WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
145                                                                                                  WV_IO_FUNCTION_PD_ALLOCATE)\r
146 \r
147 // UINT64 Id / none\r
148 #define WV_IOCTL_PD_DEALLOCATE                  WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
149                                                                                                  WV_IO_FUNCTION_PD_DEALLOCATE)\r
150 \r
151 // WV_IO_MEMORY_REGISTER / WV_IO_MEMORY_KEYS\r
152 #define WV_IOCTL_MEMORY_REGISTER                WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
153                                                                                                  WV_IO_FUNCTION_MEMORY_REGISTER)\r
154 \r
155 // WV_IO_ID / none\r
156 #define WV_IOCTL_MEMORY_DEREGISTER              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
157                                                                                                  WV_IO_FUNCTION_MEMORY_DEREGISTER)\r
158 \r
159 // WV_IO_ID / WV_IO_ID\r
160 #define WV_IOCTL_MW_ALLOCATE                    WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
161                                                                                                  WV_IO_FUNCTION_MW_ALLOCATE)\r
162 \r
163 // UINT64 Id / none\r
164 #define WV_IOCTL_MW_DEALLOCATE                  WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
165                                                                                                  WV_IO_FUNCTION_MW_DEALLOCATE)\r
166 \r
167 // WV_IO_AH_CREATE / WV_IO_AH_CREATE\r
168 #define WV_IOCTL_AH_CREATE                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
169                                                                                                  WV_IO_FUNCTION_AH_CREATE)\r
170 \r
171 // UINT64 Id / none\r
172 #define WV_IOCTL_AH_DESTROY                             WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
173                                                                                                  WV_IO_FUNCTION_AH_DESTROY)\r
174 \r
175 // WV_IO_ID / WV_IO_ID\r
176 #define WV_IOCTL_CQ_CREATE                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
177                                                                                                  WV_IO_FUNCTION_CQ_CREATE)\r
178 \r
179 // UINT64 Id / none\r
180 #define WV_IOCTL_CQ_DESTROY                             WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
181                                                                                                  WV_IO_FUNCTION_CQ_DESTROY)\r
182 \r
183 // WV_IO_ID / WV_IO_ID\r
184 #define WV_IOCTL_CQ_RESIZE                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
185                                                                                                  WV_IO_FUNCTION_CQ_RESIZE)\r
186 \r
187 // WV_IO_ID / none\r
188 #define WV_IOCTL_CQ_NOTIFY                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
189                                                                                                  WV_IO_FUNCTION_CQ_NOTIFY)\r
190 \r
191 // UINT64 Id / none\r
192 #define WV_IOCTL_CQ_CANCEL                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
193                                                                                                  WV_IO_FUNCTION_CQ_CANCEL)\r
194 \r
195 // WV_IO_SRQ_ATTRIBUTES / WV_IO_SRQ_ATTRIBUTES\r
196 #define WV_IOCTL_SRQ_CREATE                             WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
197                                                                                                  WV_IO_FUNCTION_SRQ_CREATE)\r
198 \r
199 // UINT64 Id / none\r
200 #define WV_IOCTL_SRQ_DESTROY                    WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
201                                                                                                  WV_IO_FUNCTION_SRQ_DESTROY)\r
202 \r
203 // WV_IO_SRQ_ATTRIBUTES / WV_IO_SRQ_ATTRIBUTES\r
204 #define WV_IOCTL_SRQ_QUERY                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
205                                                                                                  WV_IO_FUNCTION_SRQ_QUERY)\r
206 \r
207 // WV_IO_SRQ_ATTRIBUTES / WV_IO_SRQ_ATTRIBUTES\r
208 #define WV_IOCTL_SRQ_MODIFY                             WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
209                                                                                                  WV_IO_FUNCTION_SRQ_MODIFY)\r
210 \r
211 // UINT64 Id / none\r
212 #define WV_IOCTL_SRQ_NOTIFY                             WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
213                                                                                                  WV_IO_FUNCTION_SRQ_NOTIFY)\r
214 \r
215 // UINT64 Id / none\r
216 #define WV_IOCTL_SRQ_CANCEL                             WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
217                                                                                                  WV_IO_FUNCTION_SRQ_CANCEL)\r
218 \r
219 // WV_IO_QP_CREATE / WV_IO_QP_CREATE\r
220 #define WV_IOCTL_QP_CREATE                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
221                                                                                                  WV_IO_FUNCTION_QP_CREATE)\r
222 \r
223 // UINT64 Id / none\r
224 #define WV_IOCTL_QP_DESTROY                             WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
225                                                                                                  WV_IO_FUNCTION_QP_DESTROY)\r
226 \r
227 // WV_IO_ID / WV_IO_QP_ATTRIBUTES\r
228 #define WV_IOCTL_QP_QUERY                               WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
229                                                                                                  WV_IO_FUNCTION_QP_QUERY)\r
230 \r
231 // WV_IO_QP_ATTRIBUTES / verbs specific\r
232 #define WV_IOCTL_QP_MODIFY                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
233                                                                                                  WV_IO_FUNCTION_QP_MODIFY)\r
234 \r
235 // WV_IO_QP_MULTICAST / none\r
236 #define WV_IOCTL_QP_ATTACH                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
237                                                                                                  WV_IO_FUNCTION_QP_ATTACH)\r
238 \r
239 // WV_IO_QP_MULTICAST / none\r
240 #define WV_IOCTL_QP_DETACH                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
241                                                                                                  WV_IO_FUNCTION_QP_DETACH)\r
242 \r
243 // UINT64 Id / none\r
244 #define WV_IOCTL_QP_CANCEL                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
245                                                                                                  WV_IO_FUNCTION_QP_CANCEL)\r
246 \r
247 // UINT64 EpType / UINT64 Id\r
248 #define WV_IOCTL_EP_CREATE                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
249                                                                                                  WV_IO_FUNCTION_EP_CREATE)\r
250 \r
251 // UINT64 Id / none\r
252 #define WV_IOCTL_EP_DESTROY                             WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
253                                                                                                  WV_IO_FUNCTION_EP_DESTROY)\r
254 \r
255 // WV_IO_ID + UINT8[] / none\r
256 #define WV_IOCTL_EP_MODIFY                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
257                                                                                                  WV_IO_FUNCTION_EP_MODIFY)\r
258 \r
259 // WV_IO_EP_BIND / WV_IO_EP_BIND\r
260 #define WV_IOCTL_EP_BIND                                WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
261                                                                                                  WV_IO_FUNCTION_EP_BIND)\r
262 \r
263 // WV_IO_ID + UINT8[] / none\r
264 #define WV_IOCTL_EP_REJECT                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
265                                                                                                  WV_IO_FUNCTION_EP_REJECT)\r
266 \r
267 // WV_IO_EP_CONNECT / none\r
268 #define WV_IOCTL_EP_CONNECT                             WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
269                                                                                                  WV_IO_FUNCTION_EP_CONNECT)\r
270 \r
271 // WV_IO_EP_ACCEPT / verbs specific\r
272 #define WV_IOCTL_EP_ACCEPT                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
273                                                                                                  WV_IO_FUNCTION_EP_ACCEPT)\r
274 \r
275 // UINT64 Id / none\r
276 #define WV_IOCTL_EP_DISCONNECT                  WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
277                                                                                                  WV_IO_FUNCTION_EP_DISCONNECT)\r
278 \r
279 // UINT64 Id / none\r
280 #define WV_IOCTL_EP_DISCONNECT_NOTIFY   WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
281                                                                                                  WV_IO_FUNCTION_EP_DISCONNECT_NOTIFY)\r
282 \r
283 // UINT64 Id / WV_IO_EP_ATTRIBUTES\r
284 #define WV_IOCTL_EP_QUERY                               WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
285                                                                                                  WV_IO_FUNCTION_EP_QUERY)\r
286 \r
287 // TODO\r
288 #define WV_IOCTL_EP_LOOKUP                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
289                                                                                                  WV_IO_FUNCTION_EP_LOOKUP)\r
290 \r
291 // TODO\r
292 #define WV_IOCTL_EP_MULTICAST_JOIN              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
293                                                                                                  WV_IO_FUNCTION_EP_MULTICAST_JOIN)\r
294 \r
295 // TODO\r
296 #define WV_IOCTL_EP_MULTICAST_LEAVE             WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
297                                                                                                  WV_IO_FUNCTION_EP_MULTICAST_LEAVE)\r
298 \r
299 // UINT64 Id / none\r
300 #define WV_IOCTL_EP_CANCEL                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
301                                                                                                  WV_IO_FUNCTION_EP_CANCEL)\r
302 \r
303 // WV_IO_EP_LISTEN / none\r
304 #define WV_IOCTL_EP_LISTEN                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
305                                                                                                  WV_IO_FUNCTION_EP_LISTEN)\r
306 \r
307 // WV_IO_EP_GET_REQUEST / none\r
308 #define WV_IOCTL_EP_GET_REQUEST                 WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
309                                                                                                  WV_IO_FUNCTION_EP_GET_REQUEST)\r
310 \r
311 #define WV_IOCTL_MIN                                    WV_IO_FUNCTION_BASE + WV_IO_FUNCTION_MIN\r
312 #define WV_IOCTL_MAX                                    WV_IO_FUNCTION_BASE + WV_IO_FUNCTION_MAX\r
313 \r
314 // Device specific data follows input / output structures.\r
315 typedef struct _WV_IO_ID\r
316 {\r
317         UINT64                  Id;\r
318         UINT32                  VerbInfo;\r
319         UINT32                  Data;\r
320 \r
321 }       WV_IO_ID;\r
322 \r
323 typedef struct _WV_IO_GUID_LIST\r
324 {\r
325         UINT64                  Count;\r
326         NET64                   Guid[1];\r
327 \r
328 }       WV_IO_GUID_LIST;\r
329 \r
330 #define WV_MAX_LIB_NAME                         32\r
331 \r
332 // Device/port capability flags\r
333 #define WV_IO_RESIZE_MAX_WR                     0x00000001\r
334 #define WV_IO_BAD_PKEY_COUNTER          0x00000002\r
335 #define WV_IO_BAD_QKEY_COUNTER          0x00000004\r
336 // reserved                                                     0x00000008\r
337 #define WV_IO_PATH_MIGRATION            0x00000010\r
338 #define WV_IO_CHANGE_PHYSICAL_PORT      0x00000020\r
339 #define WV_IO_AH_PORT_CHECKING          0x00000040\r
340 #define WV_IO_QP_STATE_MODIFIER         0x00000080\r
341 #define WV_IO_SHUTDOWN_PORT                     0x00000100\r
342 #define WV_IO_INIT_TYPE                         0x00000200\r
343 #define WV_IO_PORT_ACTIVE_EVENT         0x00000400\r
344 #define WV_IO_SYSTEM_IMAGE_GUID         0x00000800\r
345 #define WV_IO_RC_RNR_NAK_GENERATION     0x00001000\r
346 #define WV_IO_SRQ_RESIZE                        0x00002000\r
347 #define WV_IO_BATCH_NOTIFY_CQ           0x00004000\r
348 \r
349 #define WV_DEVICE_UNKNOWN                       0\r
350 #define WV_DEVICE_INFINIBAND            1\r
351 #define WV_DEVICE_IWARP                         2\r
352 \r
353 #define WV_IO_ATOMIC_NONE                       0\r
354 #define WV_IO_ATOMIC_HCA                        1\r
355 #define WV_IO_ATOMIC_NODE                       2\r
356 \r
357 typedef struct _WV_IO_DEVICE_ATTRIBUTES\r
358 {\r
359         UINT64                  FwVersion;\r
360         NET64                   NodeGuid;\r
361         NET64                   SystemImageGuid;\r
362         UINT32                  VendorId;\r
363         UINT32                  VendorPartId;\r
364         UINT32                  HwVersion;\r
365         UINT32                  CapabilityFlags;\r
366         UINT32                  AtomicCapability;\r
367         UINT32                  PageSizeCapabilityFlags;\r
368         UINT64                  MaxMrSize;\r
369         UINT32                  MaxQp;\r
370         UINT32                  MaxQpWr;\r
371         UINT32                  MaxSge;\r
372         UINT32                  MaxCq;\r
373         UINT32                  MaxCqEntries;\r
374         UINT32                  MaxMr;\r
375         UINT32                  MaxPd;\r
376         UINT32                  MaxQpResponderResources;\r
377         UINT32                  MaxResponderResources;\r
378         UINT32                  MaxQpInitiatorDepth;\r
379         UINT32                  MaxInlineSend;\r
380         UINT32                  MaxMw;\r
381         UINT32                  MaxMulticast;\r
382         UINT32                  MaxQpAttach;\r
383         UINT32                  MaxMulticastQp;\r
384         UINT32                  MaxAh;\r
385         UINT32                  MaxFmr;\r
386         UINT32                  MaxMapPerFmr;\r
387         UINT32                  MaxSrq;\r
388         UINT32                  MaxSrqWr;\r
389         UINT32                  MaxSrqSge;\r
390         UINT32                  MaxPkeys;\r
391         UINT32                  DeviceType;\r
392         UINT8                   LocalAckDelay;\r
393         UINT8                   PhysPortCount;\r
394         UINT8                   Reserved[2];\r
395 \r
396 }       WV_IO_DEVICE_ATTRIBUTES;\r
397 \r
398 typedef struct _WV_IO_DEVICE_PORT_QUERY\r
399 {\r
400         UINT64                  Id;\r
401         UINT8                   PortNumber;\r
402         UINT8                   Reserved[7];\r
403 \r
404 }       WV_IO_DEVICE_PORT_QUERY;\r
405 \r
406 #define WV_IO_PORT_NOP                  0\r
407 #define WV_IO_PORT_DOWN                 1\r
408 #define WV_IO_PORT_INIT                 2\r
409 #define WV_IO_PORT_ARMED                3\r
410 #define WV_IO_PORT_ACTIVE               4\r
411 #define WV_IO_PORT_ACTIVEDEFER  5\r
412 \r
413 typedef struct _WV_IO_PORT_ATTRIBUTES\r
414 {\r
415         UINT32                  PortCabilityFlags;\r
416         UINT32                  State;\r
417         UINT32                  MaxMtu;\r
418         UINT32                  ActiveMtu;\r
419         UINT32                  GidTableLength;\r
420         UINT32                  MaxMessageSize;\r
421         UINT32                  BadPkeyCounter;\r
422         UINT32                  QkeyViolationCounter;\r
423         UINT16                  PkeyTableLength;\r
424         NET16                   Lid;\r
425         NET16                   SmLid;\r
426         UINT8                   Lmc;\r
427         UINT8                   MaxVls;\r
428         UINT8                   SmSl;\r
429         UINT8                   SubnetTimeout;\r
430         UINT8                   InitTypeReply;\r
431         UINT8                   ActiveWidth;\r
432         UINT8                   ActiveSpeed;\r
433         UINT8                   PhysicalState;\r
434         UINT8                   Reserved[2];\r
435 \r
436 }       WV_IO_PORT_ATTRIBUTES;\r
437 \r
438 // Port notification flags\r
439 #define WV_IO_EVENT_ERROR                       0x00000001\r
440 #define WV_IO_EVENT_STATE                       0x00000002\r
441 #define WV_IO_EVENT_ADDRESS                     0x00000004\r
442 #define WV_IO_EVENT_LINK_ADDRESS        0x00000008\r
443 #define WV_IO_EVENT_PARTITION           0x00000010\r
444 #define WV_IO_EVENT_MANAGEMENT          0x00000020\r
445 \r
446 typedef struct _WV_IO_GID\r
447 {\r
448         UINT8                   Raw[16];\r
449 \r
450 }       WV_IO_GID;\r
451 \r
452 typedef struct _WV_IO_EVENT\r
453 {\r
454         UINT32                  Status;\r
455         UINT32                  Type;\r
456         UINT8                   PortNumber;\r
457         UINT8                   Reserved[3];\r
458 \r
459 }       WV_IO_EVENT;\r
460 \r
461 typedef struct _WV_IO_MEMORY_REGISTER\r
462 {\r
463         UINT64                  Id;\r
464         UINT64                  Address;\r
465         UINT64                  BufferLength;\r
466         UINT32                  AccessFlags;\r
467         UINT32                  Reserved;                       \r
468 \r
469 }       WV_IO_MEMORY_REGISTER;\r
470 \r
471 typedef struct _WV_IO_MEMORY_KEYS\r
472 {\r
473         UINT32                  Lkey;\r
474         NET32                   Rkey;\r
475 \r
476 }       WV_IO_MEMORY_KEYS;\r
477 \r
478 typedef struct _WV_IO_AV\r
479 {\r
480         UINT8                   NetworkRouteValid;\r
481         UINT8                   Reserved1;\r
482         UINT8                   HopLimit;\r
483         UINT8                   TrafficClass;\r
484         NET32                   FlowLabel;\r
485         UINT8                   SGid[16];\r
486         UINT8                   DGid[16];\r
487 \r
488         UINT16                  Reserved2;\r
489         NET16                   DLid;\r
490         UINT8                   ServiceLevel;\r
491         UINT8                   SourcePathBits;\r
492         UINT8                   StaticRate;\r
493         UINT8                   PortNumber;\r
494 \r
495 }       WV_IO_AV;\r
496 \r
497 typedef struct _WV_IO_AH_CREATE\r
498 {\r
499         WV_IO_ID                Id;\r
500         WV_IO_AV                AddressVector;\r
501 \r
502 }       WV_IO_AH_CREATE;\r
503 \r
504 #define WV_CQ_ERROR                             0\r
505 #define WV_CQ_NEXT_COMPLETION   1\r
506 #define WV_CQ_SOLICITED                 2\r
507 \r
508 typedef struct _WV_IO_SRQ_ATTRIBUTES\r
509 {\r
510         WV_IO_ID                Id;\r
511         UINT32                  MaxWr;\r
512         UINT32                  MaxSge;\r
513         UINT32                  SrqLimit;\r
514         UINT32                  Reserved;\r
515 \r
516 }       WV_IO_SRQ_ATTRIBUTES;\r
517 \r
518 #define WV_IO_QP_SIGNAL_SENDS                   0x00000001\r
519 #define WV_IO_QP_MEMORY_MANAGEMENT              0x00000002\r
520 \r
521 typedef struct _WV_IO_QP_CREATE\r
522 {\r
523         WV_IO_ID                Id;\r
524         UINT64                  SendCqId;\r
525         UINT64                  ReceiveCqId;\r
526         UINT64                  SrqId;\r
527 \r
528         UINT32                  SendDepth;\r
529         UINT32                  SendSge;\r
530         UINT32                  ReceiveDepth;\r
531         UINT32                  ReceiveSge;\r
532         UINT32                  MaxInlineSend;\r
533         UINT32                  InitiatorDepth;\r
534         UINT32                  ResponderResources;\r
535 \r
536         UINT8                   QpType;\r
537         UINT8                   QpFlags;\r
538         UINT16                  Reserved;\r
539 \r
540 }       WV_IO_QP_CREATE;\r
541 \r
542 #define WV_IO_QP_STATE_RESET    0\r
543 #define WV_IO_QP_STATE_INIT             1\r
544 #define WV_IO_QP_STATE_RTR              2\r
545 #define WV_IO_QP_STATE_RTS              3\r
546 #define WV_IO_QP_STATE_SQD              4\r
547 #define WV_IO_QP_STATE_SQERROR  5\r
548 #define WV_IO_QP_STATE_ERROR    6\r
549 \r
550 #define WV_IO_QP_ATTR_CAPABILITIES                      0x00000001\r
551 #define WV_IO_QP_ATTR_INITIATOR_DEPTH           0x00000002\r
552 #define WV_IO_QP_ATTR_RESPONDER_RESOURCES       0x00000004\r
553 #define WV_IO_QP_ATTR_CURRENT_STATE                     0x00000008\r
554 #define WV_IO_QP_ATTR_STATE                                     0x00000010\r
555 #define WV_IO_QP_ATTR_PATH_MIG_STATE            0x00000020\r
556 #define WV_IO_QP_ATTR_DESTINATION_QPN           0x00000040\r
557 #define WV_IO_QP_ATTR_QKEY                                      0x00000080\r
558 #define WV_IO_QP_ATTR_SEND_PSN                          0x00000100\r
559 #define WV_IO_QP_ATTR_RECEIVE_PSN                       0x00000200\r
560 #define WV_IO_QP_ATTR_FLAGS                                     0x00000400\r
561 #define WV_IO_QP_ATTR_ACCESS_FLAGS                      0x00000800\r
562 #define WV_IO_QP_ATTR_AV                                        0x00001000\r
563 #define WV_IO_QP_ATTR_ALTERNATE_AV                      0x00002000\r
564 #define WV_IO_QP_ATTR_PORT_NUMBER                       0x00004000\r
565 #define WV_IO_QP_ATTR_PKEY_INDEX                        0x00008000\r
566 #define WV_IO_QP_ATTR_ACK_TIMEOUT                       0x00010000\r
567 #define WV_IO_QP_ATTR_RNR_NAK_TIMEOUT           0x00020000\r
568 #define WV_IO_QP_ATTR_ERROR_RETRY_COUNT         0x00040000\r
569 #define WV_IO_QP_ATTR_RNR_RETRY_COUNT           0x00080000\r
570 \r
571 typedef struct _WV_IO_QP_ATTRIBUTES\r
572 {\r
573         WV_IO_ID                Id;\r
574         UINT32                  SendDepth;\r
575         UINT32                  SendSge;\r
576         UINT32                  ReceiveDepth;\r
577         UINT32                  ReceiveSge;\r
578         UINT32                  MaxInlineSend;\r
579         UINT32                  InitiatorDepth;\r
580         UINT32                  ResponderResources;\r
581 \r
582         UINT32                  Options;\r
583         UINT8                   QpType;\r
584         UINT8                   CurrentQpState;\r
585         UINT8                   QpState;\r
586         UINT8                   ApmState;\r
587         NET32                   Qpn;\r
588         NET32                   DestinationQpn;\r
589         NET32                   Qkey;\r
590         NET32                   SendPsn;\r
591         NET32                   ReceivePsn;\r
592 \r
593         WV_IO_AV                AddressVector;\r
594         WV_IO_AV                AlternateAddressVector;\r
595         UINT32                  PathMtu;\r
596         UINT32                  AlternatePathMtu;\r
597         UINT16                  PkeyIndex;\r
598         UINT16                  AlternatePkeyIndex;\r
599         UINT8                   LocalAckTimeout;\r
600         UINT8                   AlternateLocalAckTimeout;\r
601 \r
602         UINT8                   RnrNakTimeout;\r
603         UINT8                   SequenceErrorRetryCount;\r
604         UINT8                   RnrRetryCount;\r
605 \r
606         UINT8                   AccessFlags;\r
607         UINT8                   QpFlags;\r
608         UINT8                   Reserved[5];\r
609 \r
610 }       WV_IO_QP_ATTRIBUTES;\r
611 \r
612 typedef struct _WV_IO_QP_MULTICAST\r
613 {\r
614         WV_IO_ID                Id;\r
615         WV_IO_GID               Gid;\r
616 \r
617 }       WV_IO_QP_MULTICAST;\r
618 \r
619 // Windows kernel does not define sockaddr* pre-Vista\r
620 typedef struct _WV_IO_SOCKADDR\r
621 {\r
622         UINT16                  SaFamily;\r
623         UINT8                   SaData[14];\r
624 \r
625 }       WV_IO_SOCKADDR;\r
626 \r
627 typedef struct _WV_IO_SOCKADDR_IN\r
628 {\r
629         UINT16                  SinFamily;\r
630         UINT16                  SinPort;\r
631         UINT32                  SinAddr;\r
632         UINT8                   SinZero[8];\r
633 \r
634 }       WV_IO_SOCKADDR_IN;\r
635 \r
636 typedef struct _WV_IO_SOCKADDR_IN6\r
637 {\r
638         UINT16                  Sin6Family;\r
639         UINT16                  Sin6Port;\r
640         UINT32                  Sin6FlowInfo;\r
641         UINT8                   Sin6Addr[16];\r
642         UINT32                  Sin6ScopeId;\r
643 \r
644 }       WV_IO_SOCKADDR_IN6;\r
645 \r
646 typedef struct _WV_IO_SOCKADDR_DATA\r
647 {\r
648         union\r
649         {\r
650                 WV_IO_SOCKADDR          Sa;\r
651                 WV_IO_SOCKADDR_IN       In;\r
652                 WV_IO_SOCKADDR_IN6      In6;\r
653 \r
654         }       SockAddr;\r
655 \r
656         UINT32                                  Reserved;\r
657 \r
658 }       WV_IO_SOCKADDR_DATA;\r
659 \r
660 typedef struct _WV_IO_DEVICE_ADDRESS\r
661 {\r
662         NET64                   DeviceGuid;\r
663         NET16                   Pkey;\r
664         UINT8                   PortNumber;\r
665         UINT8                   Reserved[5];\r
666 \r
667 }       WV_IO_DEVICE_ADDRESS;\r
668 \r
669 typedef struct _WV_IO_EP_BIND\r
670 {\r
671         UINT64                                  Id;\r
672         WV_IO_SOCKADDR_DATA             Address;\r
673         WV_IO_DEVICE_ADDRESS    Device;\r
674 \r
675 }       WV_IO_EP_BIND;\r
676 \r
677 #define WV_IO_EP_OPTION_ROUTE           0x00000001\r
678 \r
679 #define WV_IO_EP_TYPE_CONNECT           0x0106\r
680 #define WV_IO_EP_TYPE_DATAGRAM          0x0111\r
681 \r
682 typedef struct _WV_IO_EP_LISTEN\r
683 {\r
684         UINT64                  Id;\r
685         UINT64                  Backlog;\r
686 \r
687 }       WV_IO_EP_LISTEN;\r
688 \r
689 typedef struct _WV_IO_EP_GET_REQUEST\r
690 {\r
691         UINT64                  Id;\r
692         UINT64                  EpId;\r
693 \r
694 }       WV_IO_EP_GET_REQUEST;\r
695 \r
696 typedef struct _WV_IO_CONNECT_PARAM\r
697 {\r
698         UINT64                  ResponderResources;\r
699         UINT64                  InitiatorDepth;\r
700         UINT8                   RetryCount;\r
701         UINT8                   RnrRetryCount;\r
702         UINT8                   DataLength;\r
703         UINT8                   Reserved[5];\r
704         UINT8                   Data[56];\r
705 \r
706 }       WV_IO_CONNECT_PARAM;\r
707 \r
708 typedef struct _WV_IO_EP_CONNECT\r
709 {\r
710         UINT64                                  Id;\r
711         UINT64                                  QpId;\r
712         WV_IO_SOCKADDR_DATA             PeerAddress;\r
713         WV_IO_CONNECT_PARAM             Param;\r
714 \r
715 }       WV_IO_EP_CONNECT;\r
716 \r
717 typedef struct _WV_IO_EP_ACCEPT\r
718 {\r
719         UINT64                                  Id;\r
720         UINT64                                  QpId;\r
721         WV_IO_CONNECT_PARAM             Param;\r
722 \r
723 }       WV_IO_EP_ACCEPT;\r
724 \r
725 typedef struct _WV_IO_EP_ATTRIBUTES\r
726 {\r
727         WV_IO_SOCKADDR_DATA             LocalAddress;\r
728         WV_IO_SOCKADDR_DATA             PeerAddress;\r
729         WV_IO_DEVICE_ADDRESS    Device;\r
730 \r
731         union {\r
732                 WV_IO_CONNECT_PARAM     Connect;\r
733                 UINT64                          Backlog;\r
734 \r
735         }       Param;\r
736 \r
737 \r
738 }       WV_IO_EP_ATTRIBUTES;\r
739 \r
740 #endif // _WV_IOCTL_H_\r