winverbs: add new windows based verbs library and driver
[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_ADDRESS_QUERY,\r
85         WV_IO_FUNCTION_EP_CREATE,\r
86         WV_IO_FUNCTION_EP_DESTROY,\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_LISTEN,\r
99         WV_IO_FUNCTION_LISTEN_DESTROY,\r
100         WV_IO_FUNCTION_LISTEN_GET_REQUEST,\r
101         WV_IO_FUNCTION_LISTEN_CANCEL,\r
102         WV_IO_FUNCTION_MAX\r
103 };\r
104 \r
105 // none / WV_IO_GUID_LIST\r
106 #define WV_IOCTL_GUID_QUERY                             WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
107                                                                                                  WV_IO_FUNCTION_GUID_QUERY)\r
108 \r
109 // NET64 Guid / LibraryName\r
110 #define WV_IOCTL_LIBRARY_QUERY                  WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
111                                                                                                  WV_IO_FUNCTION_LIBRARY_QUERY)\r
112 \r
113 // WV_IO_ID / WV_IO_ID\r
114 #define WV_IOCTL_DEVICE_OPEN                    WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
115                                                                                                  WV_IO_FUNCTION_DEVICE_OPEN)\r
116 \r
117 // UINT64 Id / none\r
118 #define WV_IOCTL_DEVICE_CLOSE                   WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
119                                                                                                  WV_IO_FUNCTION_DEVICE_CLOSE)\r
120 \r
121 // UINT64 Id / WV_IO_DEVICE_ATTRIBUTES\r
122 #define WV_IOCTL_DEVICE_QUERY                   WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
123                                                                                                  WV_IO_FUNCTION_DEVICE_QUERY)\r
124 \r
125 // WV_IO_DEVICE_PORT_QUERY / WV_IO_PORT_ATTRIBUTES == WV_PORT_ATTRIBUTES\r
126 #define WV_IOCTL_DEVICE_PORT_QUERY              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
127                                                                                                  WV_IO_FUNCTION_DEVICE_PORT_QUERY)\r
128 \r
129 // WV_IO_DEVICE_PORT_QUERY / WV_IO_GID[] == WV_GID[]\r
130 #define WV_IOCTL_DEVICE_GID_QUERY               WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
131                                                                                                  WV_IO_FUNCTION_DEVICE_GID_QUERY)\r
132 \r
133 // WV_IO_DEVICE_PORT_QUERY / NET16 Pkey[]\r
134 #define WV_IOCTL_DEVICE_PKEY_QUERY              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
135                                                                                                  WV_IO_FUNCTION_DEVICE_PKEY_QUERY)\r
136 \r
137 // WV_IO_ID / DWORD\r
138 #define WV_IOCTL_DEVICE_NOTIFY                  WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
139                                                                                                  WV_IO_FUNCTION_DEVICE_NOTIFY)\r
140 \r
141 // UINT64 Id / none\r
142 #define WV_IOCTL_DEVICE_CANCEL                  WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
143                                                                                                  WV_IO_FUNCTION_DEVICE_CANCEL)\r
144 \r
145 // WV_IO_ID / WV_IO_ID\r
146 #define WV_IOCTL_PD_ALLOCATE                    WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
147                                                                                                  WV_IO_FUNCTION_PD_ALLOCATE)\r
148 \r
149 // UINT64 Id / none\r
150 #define WV_IOCTL_PD_DEALLOCATE                  WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
151                                                                                                  WV_IO_FUNCTION_PD_DEALLOCATE)\r
152 \r
153 // WV_IO_MEMORY_REGISTER / WV_IO_MEMORY_KEYS\r
154 #define WV_IOCTL_MEMORY_REGISTER                WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
155                                                                                                  WV_IO_FUNCTION_MEMORY_REGISTER)\r
156 \r
157 // WV_IO_ID / none\r
158 #define WV_IOCTL_MEMORY_DEREGISTER              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
159                                                                                                  WV_IO_FUNCTION_MEMORY_DEREGISTER)\r
160 \r
161 // WV_IO_ID / WV_IO_ID\r
162 #define WV_IOCTL_MW_ALLOCATE                    WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
163                                                                                                  WV_IO_FUNCTION_MW_ALLOCATE)\r
164 \r
165 // UINT64 Id / none\r
166 #define WV_IOCTL_MW_DEALLOCATE                  WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
167                                                                                                  WV_IO_FUNCTION_MW_DEALLOCATE)\r
168 \r
169 // WV_IO_AH_CREATE / WV_IO_AH_CREATE\r
170 #define WV_IOCTL_AH_CREATE                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
171                                                                                                  WV_IO_FUNCTION_AH_CREATE)\r
172 \r
173 // UINT64 Id / none\r
174 #define WV_IOCTL_AH_DESTROY                             WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
175                                                                                                  WV_IO_FUNCTION_AH_DESTROY)\r
176 \r
177 // WV_IO_ID / WV_IO_ID\r
178 #define WV_IOCTL_CQ_CREATE                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
179                                                                                                  WV_IO_FUNCTION_CQ_CREATE)\r
180 \r
181 // UINT64 Id / none\r
182 #define WV_IOCTL_CQ_DESTROY                             WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
183                                                                                                  WV_IO_FUNCTION_CQ_DESTROY)\r
184 \r
185 // WV_IO_ID / WV_IO_ID\r
186 #define WV_IOCTL_CQ_RESIZE                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
187                                                                                                  WV_IO_FUNCTION_CQ_RESIZE)\r
188 \r
189 // WV_IO_ID / none\r
190 #define WV_IOCTL_CQ_NOTIFY                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
191                                                                                                  WV_IO_FUNCTION_CQ_NOTIFY)\r
192 \r
193 // UINT64 Id / none\r
194 #define WV_IOCTL_CQ_CANCEL                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
195                                                                                                  WV_IO_FUNCTION_CQ_CANCEL)\r
196 \r
197 // WV_IO_SRQ_ATTRIBUTES / WV_IO_SRQ_ATTRIBUTES\r
198 #define WV_IOCTL_SRQ_CREATE                             WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
199                                                                                                  WV_IO_FUNCTION_SRQ_CREATE)\r
200 \r
201 // UINT64 Id / none\r
202 #define WV_IOCTL_SRQ_DESTROY                    WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
203                                                                                                  WV_IO_FUNCTION_SRQ_DESTROY)\r
204 \r
205 // WV_IO_SRQ_ATTRIBUTES / WV_IO_SRQ_ATTRIBUTES\r
206 #define WV_IOCTL_SRQ_QUERY                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
207                                                                                                  WV_IO_FUNCTION_SRQ_QUERY)\r
208 \r
209 // WV_IO_SRQ_ATTRIBUTES / WV_IO_SRQ_ATTRIBUTES\r
210 #define WV_IOCTL_SRQ_MODIFY                             WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
211                                                                                                  WV_IO_FUNCTION_SRQ_MODIFY)\r
212 \r
213 // UINT64 Id / none\r
214 #define WV_IOCTL_SRQ_NOTIFY                             WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
215                                                                                                  WV_IO_FUNCTION_SRQ_NOTIFY)\r
216 \r
217 // UINT64 Id / none\r
218 #define WV_IOCTL_SRQ_CANCEL                             WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
219                                                                                                  WV_IO_FUNCTION_SRQ_CANCEL)\r
220 \r
221 // WV_IO_QP_CREATE / WV_IO_QP_CREATE\r
222 #define WV_IOCTL_QP_CREATE                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
223                                                                                                  WV_IO_FUNCTION_QP_CREATE)\r
224 \r
225 // UINT64 Id / none\r
226 #define WV_IOCTL_QP_DESTROY                             WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
227                                                                                                  WV_IO_FUNCTION_QP_DESTROY)\r
228 \r
229 // WV_IO_ID / WV_IO_QP_ATTRIBUTES\r
230 #define WV_IOCTL_QP_QUERY                               WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
231                                                                                                  WV_IO_FUNCTION_QP_QUERY)\r
232 \r
233 // WV_IO_QP_ATTRIBUTES / none\r
234 #define WV_IOCTL_QP_MODIFY                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
235                                                                                                  WV_IO_FUNCTION_QP_MODIFY)\r
236 \r
237 // WV_IO_QP_MULTICAST / none\r
238 #define WV_IOCTL_QP_ATTACH                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
239                                                                                                  WV_IO_FUNCTION_QP_ATTACH)\r
240 \r
241 // WV_IO_QP_MULTICAST / none\r
242 #define WV_IOCTL_QP_DETACH                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
243                                                                                                  WV_IO_FUNCTION_QP_DETACH)\r
244 \r
245 // UINT64 Id / none\r
246 #define WV_IOCTL_QP_CANCEL                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
247                                                                                                  WV_IO_FUNCTION_QP_CANCEL)\r
248 \r
249 // TODO\r
250 #define WV_IOCTL_ADDRESS_QUERY                  WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
251                                                                                                  WV_IO_FUNCTION_ADDRESS_QUERY)\r
252 #define WV_IOCTL_EP_CREATE                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
253                                                                                                  WV_IO_FUNCTION_EP_CREATE)\r
254 #define WV_IOCTL_EP_DESTROY                             WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
255                                                                                                  WV_IO_FUNCTION_EP_DESTROY)\r
256 #define WV_IOCTL_EP_BIND                                WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
257                                                                                                  WV_IO_FUNCTION_EP_BIND)\r
258 #define WV_IOCTL_EP_REJECT                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
259                                                                                                  WV_IO_FUNCTION_EP_REJECT)\r
260 #define WV_IOCTL_EP_CONNECT                             WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
261                                                                                                  WV_IO_FUNCTION_EP_CONNECT)\r
262 #define WV_IOCTL_EP_ACCEPT                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
263                                                                                                  WV_IO_FUNCTION_EP_ACCEPT)\r
264 #define WV_IOCTL_EP_DISCONNECT                  WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
265                                                                                                  WV_IO_FUNCTION_EP_DISCONNECT)\r
266 #define WV_IOCTL_EP_DISCONNECT_NOTIFY   WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
267                                                                                                  WV_IO_FUNCTION_EP_DISCONNECT_NOTIFY)\r
268 #define WV_IOCTL_EP_QUERY                               WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
269                                                                                                  WV_IO_FUNCTION_EP_QUERY)\r
270 #define WV_IOCTL_EP_LOOKUP                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
271                                                                                                  WV_IO_FUNCTION_EP_LOOKUP)\r
272 #define WV_IOCTL_EP_MULTICAST_JOIN              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
273                                                                                                  WV_IO_FUNCTION_EP_MULTICAST_JOIN)\r
274 #define WV_IOCTL_EP_MULTICAST_LEAVE             WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
275                                                                                                  WV_IO_FUNCTION_EP_MULTICAST_LEAVE)\r
276 #define WV_IOCTL_EP_CANCEL                              WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
277                                                                                                  WV_IO_FUNCTION_EP_CANCEL)\r
278 #define WV_IOCTL_LISTEN                                 WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
279                                                                                                  WV_IO_FUNCTION_LISTEN)\r
280 #define WV_IOCTL_LISTEN_DESTROY                 WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
281                                                                                                  WV_IO_FUNCTION_LISTEN_DESTROY)\r
282 #define WV_IOCTL_LISTEN_GET_REQUEST             WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
283                                                                                                  WV_IO_FUNCTION_LISTEN_GET_REQUEST)\r
284 #define WV_IOCTL_LISTEN_CANCEL                  WV_IOCTL(WV_IO_FUNCTION_BASE + \\r
285                                                                                                  WV_IO_FUNCTION_LISTEN_CANCEL)\r
286 \r
287 #define WV_IOCTL_MIN                                    WV_IO_FUNCTION_BASE + WV_IO_FUNCTION_MIN\r
288 #define WV_IOCTL_MAX                                    WV_IO_FUNCTION_BASE + WV_IO_FUNCTION_MAX\r
289 \r
290 // Device specific data follows input / output structures.\r
291 typedef struct _WV_IO_ID\r
292 {\r
293         UINT64                  Id;\r
294         UINT32                  VerbInfo;\r
295         UINT32                  Data;\r
296 \r
297 }       WV_IO_ID;\r
298 \r
299 typedef struct _WV_IO_GUID_LIST\r
300 {\r
301         UINT64                  Count;\r
302         NET64                   Guid[1];\r
303 \r
304 }       WV_IO_GUID_LIST;\r
305 \r
306 #define WV_MAX_LIB_NAME                         32\r
307 \r
308 // Device/port capability flags\r
309 #define WV_IO_RESIZE_MAX_WR                     0x00000001\r
310 #define WV_IO_BAD_PKEY_COUNTER          0x00000002\r
311 #define WV_IO_BAD_QKEY_COUNTER          0x00000004\r
312 // reserved                                                     0x00000008\r
313 #define WV_IO_PATH_MIGRATION            0x00000010\r
314 #define WV_IO_CHANGE_PHYSICAL_PORT      0x00000020\r
315 #define WV_IO_AH_PORT_CHECKING          0x00000040\r
316 #define WV_IO_QP_STATE_MODIFIER         0x00000080\r
317 #define WV_IO_SHUTDOWN_PORT                     0x00000100\r
318 #define WV_IO_INIT_TYPE                         0x00000200\r
319 #define WV_IO_PORT_ACTIVE_EVENT         0x00000400\r
320 #define WV_IO_SYSTEM_IMAGE_GUID         0x00000800\r
321 #define WV_IO_RC_RNR_NAK_GENERATION     0x00001000\r
322 #define WV_IO_SRQ_RESIZE                        0x00002000\r
323 #define WV_IO_BATCH_NOTIFY_CQ           0x00004000\r
324 \r
325 #define WV_DEVICE_UNKNOWN                       0\r
326 #define WV_DEVICE_INFINIBAND            1\r
327 #define WV_DEVICE_IWARP                         2\r
328 \r
329 #define WV_IO_ATOMIC_NONE                       0\r
330 #define WV_IO_ATOMIC_HCA                        1\r
331 #define WV_IO_ATOMIC_NODE                       2\r
332 \r
333 typedef struct _WV_IO_DEVICE_ATTRIBUTES\r
334 {\r
335         UINT64                  FwVersion;\r
336         NET64                   NodeGuid;\r
337         NET64                   SystemImageGuid;\r
338         UINT32                  VendorId;\r
339         UINT32                  VendorPartId;\r
340         UINT32                  HwVersion;\r
341         UINT32                  CapabilityFlags;\r
342         UINT32                  AtomicCapability;\r
343         UINT32                  PageSizeCapabilityFlags;\r
344         UINT64                  MaxMrSize;\r
345         UINT32                  MaxQp;\r
346         UINT32                  MaxQpWr;\r
347         UINT32                  MaxSge;\r
348         UINT32                  MaxCq;\r
349         UINT32                  MaxCqEntries;\r
350         UINT32                  MaxMr;\r
351         UINT32                  MaxPd;\r
352         UINT32                  MaxQpResponderResources;\r
353         UINT32                  MaxResponderResources;\r
354         UINT32                  MaxQpInitiatorDepth;\r
355         UINT32                  MaxInlineSend;\r
356         UINT32                  MaxMw;\r
357         UINT32                  MaxMulticast;\r
358         UINT32                  MaxQpAttach;\r
359         UINT32                  MaxMulticastQp;\r
360         UINT32                  MaxAh;\r
361         UINT32                  MaxFmr;\r
362         UINT32                  MaxMapPerFmr;\r
363         UINT32                  MaxSrq;\r
364         UINT32                  MaxSrqWr;\r
365         UINT32                  MaxSrqSge;\r
366         UINT32                  MaxPkeys;\r
367         UINT32                  DeviceType;\r
368         UINT8                   LocalAckDelay;\r
369         UINT8                   PhysPortCount;\r
370         UINT8                   Reserved[2];\r
371 \r
372 }       WV_IO_DEVICE_ATTRIBUTES;\r
373 \r
374 typedef struct _WV_IO_DEVICE_PORT_QUERY\r
375 {\r
376         UINT64                  Id;\r
377         UINT8                   PortNumber;\r
378         UINT8                   Reserved[7];\r
379 \r
380 }       WV_IO_DEVICE_PORT_QUERY;\r
381 \r
382 #define WV_IO_PORT_NOP                  0\r
383 #define WV_IO_PORT_DOWN                 1\r
384 #define WV_IO_PORT_INIT                 2\r
385 #define WV_IO_PORT_ARMED                3\r
386 #define WV_IO_PORT_ACTIVE               4\r
387 #define WV_IO_PORT_ACTIVEDEFER  5\r
388 \r
389 typedef struct _WV_IO_PORT_ATTRIBUTES\r
390 {\r
391         UINT32                  PortCabilityFlags;\r
392         UINT32                  State;\r
393         UINT32                  MaxMtu;\r
394         UINT32                  ActiveMtu;\r
395         UINT32                  GidTableLength;\r
396         UINT32                  MaxMessageSize;\r
397         UINT32                  BadPkeyCounter;\r
398         UINT32                  QkeyViolationCounter;\r
399         UINT16                  PkeyTableLength;\r
400         NET16                   Lid;\r
401         NET16                   SmLid;\r
402         UINT8                   Lmc;\r
403         UINT8                   MaxVls;\r
404         UINT8                   SmSl;\r
405         UINT8                   SubnetTimeout;\r
406         UINT8                   InitTypeReply;\r
407         UINT8                   ActiveWidth;\r
408         UINT8                   ActiveSpeed;\r
409         UINT8                   PhysicalState;\r
410         UINT8                   Reserved[2];\r
411 \r
412 }       WV_IO_PORT_ATTRIBUTES;\r
413 \r
414 // Port notification flags\r
415 #define WV_IO_EVENT_ERROR                       0x00000001\r
416 #define WV_IO_EVENT_STATE                       0x00000002\r
417 #define WV_IO_EVENT_ADDRESS                     0x00000004\r
418 #define WV_IO_EVENT_LINK_ADDRESS        0x00000008\r
419 #define WV_IO_EVENT_PARTITION           0x00000010\r
420 #define WV_IO_EVENT_MANAGEMENT          0x00000020\r
421 \r
422 typedef struct _WV_IO_GID\r
423 {\r
424         UINT8                   Raw[16];\r
425 \r
426 }       WV_IO_GID;\r
427 \r
428 typedef struct _WV_IO_EVENT\r
429 {\r
430         UINT32                  Status;\r
431         UINT32                  Type;\r
432         UINT8                   PortNumber;\r
433         UINT8                   Reserved[3];\r
434 \r
435 }       WV_IO_EVENT;\r
436 \r
437 typedef struct _WV_IO_MEMORY_REGISTER\r
438 {\r
439         UINT64                  Id;\r
440         UINT64                  Address;\r
441         UINT64                  BufferLength;\r
442         UINT32                  AccessFlags;\r
443         UINT32                  Reserved;                       \r
444 \r
445 }       WV_IO_MEMORY_REGISTER;\r
446 \r
447 typedef struct _WV_IO_MEMORY_KEYS\r
448 {\r
449         UINT32                  Lkey;\r
450         NET32                   Rkey;\r
451 \r
452 }       WV_IO_MEMORY_KEYS;\r
453 \r
454 typedef struct _WV_IO_AV\r
455 {\r
456         UINT8                   NetworkRouteValid;\r
457         UINT8                   Reserved1;\r
458         UINT8                   HopLimit;\r
459         UINT8                   TrafficClass;\r
460         NET32                   FlowLabel;\r
461         UINT8                   SGid[16];\r
462         UINT8                   DGid[16];\r
463 \r
464         UINT16                  Reserved2;\r
465         NET16                   DLid;\r
466         UINT8                   ServiceLevel;\r
467         UINT8                   SourcePathBits;\r
468         UINT8                   StaticRate;\r
469         UINT8                   PortNumber;\r
470 \r
471 }       WV_IO_AV;\r
472 \r
473 typedef struct _WV_IO_AH_CREATE\r
474 {\r
475         WV_IO_ID                Id;\r
476         WV_IO_AV                AddressVector;\r
477 \r
478 }       WV_IO_AH_CREATE;\r
479 \r
480 #define WV_CQ_ERROR                             0\r
481 #define WV_CQ_SOLICITED                 1\r
482 #define WV_CQ_NEXT_COMPLETION   2\r
483 \r
484 typedef struct _WV_IO_SRQ_ATTRIBUTES\r
485 {\r
486         WV_IO_ID                Id;\r
487         UINT32                  MaxWr;\r
488         UINT32                  MaxSge;\r
489         UINT32                  SrqLimit;\r
490         UINT32                  Reserved;\r
491 \r
492 }       WV_IO_SRQ_ATTRIBUTES;\r
493 \r
494 #define WV_IO_QP_SIGNAL_SENDS                   0x00000001\r
495 #define WV_IO_QP_MEMORY_MANAGEMENT              0x00000002\r
496 \r
497 typedef struct _WV_IO_QP_CREATE\r
498 {\r
499         WV_IO_ID                Id;\r
500         UINT64                  SendCqId;\r
501         UINT64                  ReceiveCqId;\r
502         UINT64                  SrqId;\r
503 \r
504         UINT32                  SendDepth;\r
505         UINT32                  SendSge;\r
506         UINT32                  ReceiveDepth;\r
507         UINT32                  ReceiveSge;\r
508         UINT32                  MaxInlineSend;\r
509         UINT32                  InitiatorDepth;\r
510         UINT32                  ResponderResources;\r
511 \r
512         UINT8                   QpType;\r
513         UINT8                   QpFlags;\r
514         UINT16                  Reserved;\r
515 \r
516 }       WV_IO_QP_CREATE;\r
517 \r
518 #define WV_IO_QP_STATE_RESET    0\r
519 #define WV_IO_QP_STATE_INIT             1\r
520 #define WV_IO_QP_STATE_RTR              2\r
521 #define WV_IO_QP_STATE_RTS              3\r
522 #define WV_IO_QP_STATE_SQD              4\r
523 #define WV_IO_QP_STATE_SQERROR  5\r
524 #define WV_IO_QP_STATE_ERROR    6\r
525 \r
526 #define WV_IO_QP_ATTR_CAPABILITIES                      0x00000001\r
527 #define WV_IO_QP_ATTR_INITIATOR_DEPTH           0x00000002\r
528 #define WV_IO_QP_ATTR_RESPONDER_RESOURCES       0x00000004\r
529 #define WV_IO_QP_ATTR_CURRENT_STATE                     0x00000008\r
530 #define WV_IO_QP_ATTR_STATE                                     0x00000010\r
531 #define WV_IO_QP_ATTR_PATH_MIG_STATE            0x00000020\r
532 #define WV_IO_QP_ATTR_DESTINATION_QPN           0x00000040\r
533 #define WV_IO_QP_ATTR_QKEY                                      0x00000080\r
534 #define WV_IO_QP_ATTR_SEND_PSN                          0x00000100\r
535 #define WV_IO_QP_ATTR_RECEIVE_PSN                       0x00000200\r
536 #define WV_IO_QP_ATTR_FLAGS                                     0x00000400\r
537 #define WV_IO_QP_ATTR_ACCESS_FLAGS                      0x00000800\r
538 #define WV_IO_QP_ATTR_AV                                        0x00001000\r
539 #define WV_IO_QP_ATTR_ALTERNATE_AV                      0x00002000\r
540 #define WV_IO_QP_ATTR_PORT_NUMBER                       0x00004000\r
541 #define WV_IO_QP_ATTR_PKEY_INDEX                        0x00008000\r
542 #define WV_IO_QP_ATTR_ACK_TIMEOUT                       0x00010000\r
543 #define WV_IO_QP_ATTR_RNR_NAK_TIMEOUT           0x00020000\r
544 #define WV_IO_QP_ATTR_ERROR_RETRY_COUNT         0x00040000\r
545 #define WV_IO_QP_ATTR_RNR_RETRY_COUNT           0x00080000\r
546 \r
547 typedef struct _WV_IO_QP_ATTRIBUTES\r
548 {\r
549         WV_IO_ID                Id;\r
550         UINT32                  SendDepth;\r
551         UINT32                  SendSge;\r
552         UINT32                  ReceiveDepth;\r
553         UINT32                  ReceiveSge;\r
554         UINT32                  MaxInlineSend;\r
555         UINT32                  InitiatorDepth;\r
556         UINT32                  ResponderResources;\r
557 \r
558         UINT32                  Options;\r
559         UINT8                   QpType;\r
560         UINT8                   CurrentQpState;\r
561         UINT8                   QpState;\r
562         UINT8                   ApmState;\r
563         NET32                   Qpn;\r
564         NET32                   DestinationQpn;\r
565         NET32                   Qkey;\r
566         NET32                   SendPsn;\r
567         NET32                   ReceivePsn;\r
568 \r
569         WV_IO_AV                AddressVector;\r
570         WV_IO_AV                AlternateAddressVector;\r
571         UINT32                  PathMtu;\r
572         UINT32                  AlternatePathMtu;\r
573         UINT16                  PkeyIndex;\r
574         UINT16                  AlternatePkeyIndex;\r
575         UINT8                   LocalAckTimeout;\r
576         UINT8                   AlternateLocalAckTimeout;\r
577 \r
578         UINT8                   RnrNakTimeout;\r
579         UINT8                   SequenceErrorRetryCount;\r
580         UINT8                   RnrRetryCount;\r
581 \r
582         UINT8                   AccessFlags;\r
583         UINT8                   QpFlags;\r
584         UINT8                   Reserved[5];\r
585 \r
586 }       WV_IO_QP_ATTRIBUTES;\r
587 \r
588 typedef struct _WV_IO_QP_MULTICAST\r
589 {\r
590         WV_IO_ID                Id;\r
591         WV_IO_GID               Gid;\r
592 \r
593 }       WV_IO_QP_MULTICAST;\r
594 \r
595 // TODO:\r
596 //WV_IO_ADDRESS_QUERY\r
597 //WV_IO_EP_CREATE\r
598 //WV_IO_EP_BIND\r
599 //WV_IO_EP_REJECT\r
600 //WV_IO_EP_CONNECT\r
601 //WV_IO_EP_ACCEPT\r
602 //WV_IO_EP_DISCONNECT\r
603 //WV_IO_EP_DISCONNECT_NOTIFY\r
604 //WV_IO_EP_QUERY\r
605 //WV_IO_EP_LOOKUP\r
606 //WV_IO_EP_MULTICAST_JOIN\r
607 //WV_IO_EP_MULTICAST_LEAVE\r
608 //WV_IO_LISTEN\r
609 //WV_IO_LISTEN_GET_REQUEST\r
610 \r
611 #endif // _WV_IOCTL_H_\r