[MTHCA\MT23108\IBAL] change to support TRAP and TRAP_REPRESS
[mirror/winof/.git] / inc / iba / ib_types.h
1 /*\r
2  * Copyright (c) 2005 SilverStorm Technologies.  All rights reserved.\r
3  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
4  *\r
5  * This software is available to you under the OpenIB.org BSD license\r
6  * below:\r
7  *\r
8  *     Redistribution and use in source and binary forms, with or\r
9  *     without modification, are permitted provided that the following\r
10  *     conditions are met:\r
11  *\r
12  *      - Redistributions of source code must retain the above\r
13  *        copyright notice, this list of conditions and the following\r
14  *        disclaimer.\r
15  *\r
16  *      - Redistributions in binary form must reproduce the above\r
17  *        copyright notice, this list of conditions and the following\r
18  *        disclaimer in the documentation and/or other materials\r
19  *        provided with the distribution.\r
20  *\r
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
22  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
24  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
25  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
26  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
27  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
28  * SOFTWARE.\r
29  *\r
30  * $Id$\r
31  */\r
32 \r
33 \r
34 #if !defined(__IB_TYPES_H__)\r
35 #define __IB_TYPES_H__\r
36 \r
37 #include <complib/cl_types.h>\r
38 #include <complib/cl_byteswap.h>\r
39 \r
40 #ifdef CL_KERNEL\r
41         #define AL_EXPORT\r
42         #define AL_API\r
43         #define AL_INLINE       static inline\r
44 #else\r
45         #if defined( EXPORT_AL_SYMBOLS )\r
46                 #define AL_EXPORT       __declspec(dllexport)\r
47         #else\r
48                 #define AL_EXPORT       __declspec(dllimport)\r
49         #endif\r
50         #define AL_API          __stdcall\r
51         #define AL_INLINE       AL_EXPORT inline\r
52 #endif  /* CL_KERNEL */\r
53 \r
54 \r
55 #ifdef __cplusplus\r
56 extern "C"\r
57 {\r
58 #endif  /* __cplusplus */\r
59 \r
60 \r
61 /****h* IBA Base/Constants\r
62 * NAME\r
63 *       Constants\r
64 *\r
65 * DESCRIPTION\r
66 *       The following constants are used throughout the IBA code base.\r
67 *\r
68 *       Definitions are from the InfiniBand Architecture Specification v1.1\r
69 *\r
70 *********/\r
71 \r
72 /****d* IBA Base: Constants/MAD_BLOCK_SIZE\r
73 * NAME\r
74 *       MAD_BLOCK_SIZE\r
75 *\r
76 * DESCRIPTION\r
77 *       Size of a non-RMPP MAD datagram.\r
78 *\r
79 * SOURCE\r
80 */\r
81 #define MAD_BLOCK_SIZE                                          256\r
82 /**********/\r
83 \r
84 /****d* IBA Base: Constants/MAD_RMPP_HDR_SIZE\r
85 * NAME\r
86 *       MAD_RMPP_HDR_SIZE\r
87 *\r
88 * DESCRIPTION\r
89 *       Size of an RMPP header, including the common MAD header.\r
90 *\r
91 * SOURCE\r
92 */\r
93 #define MAD_RMPP_HDR_SIZE                                       36\r
94 /**********/\r
95 \r
96 /****d* IBA Base: Constants/MAD_RMPP_DATA_SIZE\r
97 * NAME\r
98 *       MAD_RMPP_DATA_SIZE\r
99 *\r
100 * DESCRIPTION\r
101 *       Size of an RMPP transaction data section.\r
102 *\r
103 * SOURCE\r
104 */\r
105 #define MAD_RMPP_DATA_SIZE              (MAD_BLOCK_SIZE - MAD_RMPP_HDR_SIZE)\r
106 /**********/\r
107 \r
108 /****d* IBA Base: Constants/MAD_BLOCK_GRH_SIZE\r
109 * NAME\r
110 *       MAD_BLOCK_GRH_SIZE\r
111 *\r
112 * DESCRIPTION\r
113 *       Size of a MAD datagram, including the GRH.\r
114 *\r
115 * SOURCE\r
116 */\r
117 #define MAD_BLOCK_GRH_SIZE                                      296\r
118 /**********/\r
119 \r
120 /****d* IBA Base: Constants/IB_LID_PERMISSIVE\r
121 * NAME\r
122 *       IB_LID_PERMISSIVE\r
123 *\r
124 * DESCRIPTION\r
125 *       Permissive LID\r
126 *\r
127 * SOURCE\r
128 */\r
129 #define IB_LID_PERMISSIVE                                       0xFFFF\r
130 /**********/\r
131 \r
132 /****d* IBA Base: Constants/IB_DEFAULT_PKEY\r
133 * NAME\r
134 *       IB_DEFAULT_PKEY\r
135 *\r
136 * DESCRIPTION\r
137 *       P_Key value for the default partition.\r
138 *\r
139 * SOURCE\r
140 */\r
141 #define IB_DEFAULT_PKEY                                         0xFFFF\r
142 /**********/\r
143 \r
144 /****d* IBA Base: Constants/IB_QP1_WELL_KNOWN_Q_KEY\r
145 * NAME\r
146 *       IB_QP1_WELL_KNOWN_Q_KEY\r
147 *\r
148 * DESCRIPTION\r
149 *       Well-known Q_Key for QP1 privileged mode access (15.4.2).\r
150 *\r
151 * SOURCE\r
152 */\r
153 #define IB_QP1_WELL_KNOWN_Q_KEY                         CL_NTOH32(0x80010000)\r
154 /*********/\r
155 \r
156 #define IB_QP0                                                          0\r
157 #define IB_QP1                                                          CL_NTOH32(1)\r
158 \r
159 #define IB_QP_PRIVILEGED_Q_KEY                          CL_NTOH32(0x80000000)\r
160 \r
161 /****d* IBA Base: Constants/IB_LID_UCAST_START\r
162 * NAME\r
163 *       IB_LID_UCAST_START\r
164 *\r
165 * DESCRIPTION\r
166 *       Lowest valid unicast LID value.\r
167 *\r
168 * SOURCE\r
169 */\r
170 #define IB_LID_UCAST_START_HO                           0x0001\r
171 #define IB_LID_UCAST_START                                      (CL_HTON16(IB_LID_UCAST_START_HO))\r
172 /**********/\r
173 \r
174 /****d* IBA Base: Constants/IB_LID_UCAST_END\r
175 * NAME\r
176 *       IB_LID_UCAST_END\r
177 *\r
178 * DESCRIPTION\r
179 *       Highest valid unicast LID value.\r
180 *\r
181 * SOURCE\r
182 */\r
183 #define IB_LID_UCAST_END_HO                                     0xBFFF\r
184 #define IB_LID_UCAST_END                                        (CL_HTON16(IB_LID_UCAST_END_HO))\r
185 /**********/\r
186 \r
187 /****d* IBA Base: Constants/IB_LID_MCAST_START\r
188 * NAME\r
189 *       IB_LID_MCAST_START\r
190 *\r
191 * DESCRIPTION\r
192 *       Lowest valid multicast LID value.\r
193 *\r
194 * SOURCE\r
195 */\r
196 #define IB_LID_MCAST_START_HO                           0xC000\r
197 #define IB_LID_MCAST_START                                      (CL_HTON16(IB_LID_MCAST_START_HO))\r
198 /**********/\r
199 \r
200 /****d* IBA Base: Constants/IB_LID_MCAST_END\r
201 * NAME\r
202 *       IB_LID_MCAST_END\r
203 *\r
204 * DESCRIPTION\r
205 *       Highest valid multicast LID value.\r
206 *\r
207 * SOURCE\r
208 */\r
209 #define IB_LID_MCAST_END_HO                                     0xFFFE\r
210 #define IB_LID_MCAST_END                                        (CL_HTON16(IB_LID_MCAST_END_HO))\r
211 /**********/\r
212 \r
213 /****d* IBA Base: Constants/IB_DEFAULT_SUBNET_PREFIX\r
214 * NAME\r
215 *       IB_DEFAULT_SUBNET_PREFIX\r
216 *\r
217 * DESCRIPTION\r
218 *       Default subnet GID prefix.\r
219 *\r
220 * SOURCE\r
221 */\r
222 #define IB_DEFAULT_SUBNET_PREFIX                        (CL_HTON64(CL_CONST64(0xFE80000000000000)))\r
223 /**********/\r
224 \r
225 /****d* IBA Base: Constants/IB_NODE_NUM_PORTS_MAX\r
226 * NAME\r
227 *       IB_NODE_NUM_PORTS_MAX\r
228 *\r
229 * DESCRIPTION\r
230 *       Maximum number of ports in a single node (14.2.5.7).\r
231 * SOURCE\r
232 */\r
233 #define IB_NODE_NUM_PORTS_MAX                           0xFE\r
234 /**********/\r
235 \r
236 /****d* IBA Base: Constants/IB_INVALID_PORT_NUM\r
237 * NAME\r
238 *       IB_INVALID_PORT_NUM\r
239 *\r
240 * DESCRIPTION\r
241 *       Value used to indicate an invalid port number (14.2.5.10).\r
242 *\r
243 * SOURCE\r
244 */\r
245 #define IB_INVALID_PORT_NUM                                     0xFF\r
246 /*********/\r
247 \r
248 /****d* IBA Base: Constants/IB_SUBNET_PATH_HOPS_MAX\r
249 * NAME\r
250 *       IB_SUBNET_PATH_HOPS_MAX\r
251 *\r
252 * DESCRIPTION\r
253 *       Maximum number of directed route switch hops in a subnet (14.2.1.2).\r
254 *\r
255 * SOURCE\r
256 */\r
257 #define IB_SUBNET_PATH_HOPS_MAX                         64\r
258 /*********/\r
259 \r
260 /****d* IBA Base: Constants/IB_PKEY_MAX_BLOCKS\r
261 * NAME\r
262 *       IB_PKEY_MAX_BLOCKS\r
263 *\r
264 * DESCRIPTION\r
265 *       Maximum number of PKEY blocks (14.2.5.7).\r
266 *\r
267 * SOURCE\r
268 */\r
269 #define IB_PKEY_MAX_BLOCKS                                      2048\r
270 /*********/\r
271 \r
272 /****d* IBA Base: Constants/IB_MCAST_MAX_BLOCK_ID\r
273 * NAME\r
274 *       IB_MCAST_MAX_BLOCK_ID\r
275 *\r
276 * DESCRIPTION\r
277 *       Maximum number of Multicast port mask blocks\r
278 *\r
279 * SOURCE\r
280 */\r
281 #define IB_MCAST_MAX_BLOCK_ID                           511\r
282 /*********/\r
283 \r
284 /****d* IBA Base: Constants/IB_MCAST_BLOCK_ID_MASK_HO\r
285 * NAME\r
286 *       IB_MCAST_BLOCK_ID_MASK_HO\r
287 *\r
288 * DESCRIPTION\r
289 *       Mask (host order) to recover the Multicast block ID.\r
290 *\r
291 * SOURCE\r
292 */\r
293 #define IB_MCAST_BLOCK_ID_MASK_HO                       0x000001FF\r
294 /*********/\r
295 \r
296 /****d* IBA Base: Constants/IB_MCAST_BLOCK_SIZE\r
297 * NAME\r
298 *       IB_MCAST_BLOCK_SIZE\r
299 *\r
300 * DESCRIPTION\r
301 *       Number of port mask entries in a multicast forwarding table block.\r
302 *\r
303 * SOURCE\r
304 */\r
305 #define IB_MCAST_BLOCK_SIZE                                     32\r
306 /*********/\r
307 \r
308 /****d* IBA Base: Constants/IB_MCAST_MASK_SIZE\r
309 * NAME\r
310 *       IB_MCAST_MASK_SIZE\r
311 *\r
312 * DESCRIPTION\r
313 *       Number of port mask bits in each entry in the multicast forwarding table.\r
314 *\r
315 * SOURCE\r
316 */\r
317 #define IB_MCAST_MASK_SIZE                                      16\r
318 /*********/\r
319 \r
320 /****d* IBA Base: Constants/IB_MCAST_POSITION_MASK_HO\r
321 * NAME\r
322 *       IB_MCAST_POSITION_MASK_HO\r
323 *\r
324 * DESCRIPTION\r
325 *       Mask (host order) to recover the multicast block position.\r
326 *\r
327 * SOURCE\r
328 */\r
329 #define IB_MCAST_POSITION_MASK_HO                               0xF0000000\r
330 /*********/\r
331 \r
332 /****d* IBA Base: Constants/IB_MCAST_POSITION_MAX\r
333 * NAME\r
334 *       IB_MCAST_POSITION_MAX\r
335 *\r
336 * DESCRIPTION\r
337 *       Maximum value for the multicast block position.\r
338 *\r
339 * SOURCE\r
340 */\r
341 #define IB_MCAST_POSITION_MAX                           0xF\r
342 /*********/\r
343 \r
344 /****d* IBA Base: Constants/IB_MCAST_POSITION_SHIFT\r
345 * NAME\r
346 *       IB_MCAST_POSITION_SHIFT\r
347 *\r
348 * DESCRIPTION\r
349 *       Shift value to normalize the multicast block position value.\r
350 *\r
351 * SOURCE\r
352 */\r
353 #define IB_MCAST_POSITION_SHIFT                         28\r
354 /*********/\r
355 \r
356 /****d* IBA Base: Constants/IB_PKEY_ENTRIES_MAX\r
357 * NAME\r
358 *       IB_PKEY_ENTRIES_MAX\r
359 *\r
360 * DESCRIPTION\r
361 *       Maximum number of PKEY entries per port (14.2.5.7).\r
362 *\r
363 * SOURCE\r
364 */\r
365 #define IB_PKEY_ENTRIES_MAX (IB_PKEY_MAX_BLOCKS * IB_PKEY_BLOCK_SIZE)\r
366 /*********/\r
367 \r
368 /****d* IBA Base: Constants/IB_PKEY_BASE_MASK\r
369 * NAME\r
370 *       IB_PKEY_BASE_MASK\r
371 *\r
372 * DESCRIPTION\r
373 *       Masks for the base P_Key value given a P_Key Entry.\r
374 *\r
375 * SOURCE\r
376 */\r
377 #define IB_PKEY_BASE_MASK                                       (CL_NTOH16(0x7FFF))\r
378 /*********/\r
379 \r
380 /****d* IBA Base: Constants/IB_PKEY_TYPE_MASK\r
381 * NAME\r
382 *       IB_PKEY_TYPE_MASK\r
383 *\r
384 * DESCRIPTION\r
385 *       Masks for the P_Key membership type given a P_Key Entry.\r
386 *\r
387 * SOURCE\r
388 */\r
389 #define IB_PKEY_TYPE_MASK                                       (CL_NTOH16(0x8000))\r
390 /*********/\r
391 \r
392 /****d* IBA Base: Constants/IB_MCLASS_SUBN_LID\r
393 * NAME\r
394 *       IB_MCLASS_SUBN_LID\r
395 *\r
396 * DESCRIPTION\r
397 *       Subnet Management Class, Subnet Manager LID routed (13.4.4)\r
398 *\r
399 * SOURCE\r
400 */\r
401 #define IB_MCLASS_SUBN_LID                                      0x01\r
402 /**********/\r
403 \r
404 /****d* IBA Base: Constants/IB_MCLASS_SUBN_DIR\r
405 * NAME\r
406 *       IB_MCLASS_SUBN_DIR\r
407 *\r
408 * DESCRIPTION\r
409 *       Subnet Management Class, Subnet Manager directed route (13.4.4)\r
410 *\r
411 * SOURCE\r
412 */\r
413 #define IB_MCLASS_SUBN_DIR                                      0x81\r
414 /**********/\r
415 \r
416 /****d* IBA Base: Constants/IB_MCLASS_SUBN_ADM\r
417 * NAME\r
418 *       IB_MCLASS_SUBN_ADM\r
419 *\r
420 * DESCRIPTION\r
421 *       Subnet Management Class, Subnet Administration (13.4.4)\r
422 *\r
423 * SOURCE\r
424 */\r
425 #define IB_MCLASS_SUBN_ADM                                      0x03\r
426 /**********/\r
427 \r
428 /****d* IBA Base: Constants/IB_MCLASS_PERF\r
429 * NAME\r
430 *       IB_MCLASS_PERF\r
431 *\r
432 * DESCRIPTION\r
433 *       Subnet Management Class, Performance Manager (13.4.4)\r
434 *\r
435 * SOURCE\r
436 */\r
437 #define IB_MCLASS_PERF                                          0x04\r
438 /**********/\r
439 \r
440 /****d* IBA Base: Constants/IB_MCLASS_BM\r
441 * NAME\r
442 *       IB_MCLASS_BM\r
443 *\r
444 * DESCRIPTION\r
445 *       Subnet Management Class, Baseboard Manager (13.4.4)\r
446 *\r
447 * SOURCE\r
448 */\r
449 #define IB_MCLASS_BM                                            0x05\r
450 /**********/\r
451 \r
452 /****d* IBA Base: Constants/IB_MCLASS_DEV_MGMT\r
453 * NAME\r
454 *       IB_MCLASS_DEV_MGMT\r
455 *\r
456 * DESCRIPTION\r
457 *       Subnet Management Class, Device Management (13.4.4)\r
458 *\r
459 * SOURCE\r
460 */\r
461 #define IB_MCLASS_DEV_MGMT                                      0x06\r
462 /**********/\r
463 \r
464 /****d* IBA Base: Constants/IB_MCLASS_COMM_MGMT\r
465 * NAME\r
466 *       IB_MCLASS_COMM_MGMT\r
467 *\r
468 * DESCRIPTION\r
469 *       Subnet Management Class, Communication Management (13.4.4)\r
470 *\r
471 * SOURCE\r
472 */\r
473 #define IB_MCLASS_COMM_MGMT                                     0x07\r
474 /**********/\r
475 \r
476 /****d* IBA Base: Constants/IB_MCLASS_SNMP\r
477 * NAME\r
478 *       IB_MCLASS_SNMP\r
479 *\r
480 * DESCRIPTION\r
481 *       Subnet Management Class, SNMP Tunneling (13.4.4)\r
482 *\r
483 * SOURCE\r
484 */\r
485 #define IB_MCLASS_SNMP                                          0x08\r
486 /**********/\r
487 \r
488 /****d* IBA Base: Constants/IB_MCLASS_VENDOR_LOW_RANGE_MIN\r
489 * NAME\r
490 *       IB_MCLASS_VENDOR_LOW_RANGE_MIN\r
491 *\r
492 * DESCRIPTION\r
493 *       Subnet Management Class, Vendor Specific Low Range Start\r
494 *\r
495 * SOURCE\r
496 */\r
497 #define IB_MCLASS_VENDOR_LOW_RANGE_MIN 0x09\r
498 /**********/\r
499 \r
500 /****d* IBA Base: Constants/IB_MCLASS_VENDOR_LOW_RANGE_MAX\r
501 * NAME\r
502 *       IB_MCLASS_VENDOR_LOW_RANGE_MAX\r
503 *\r
504 * DESCRIPTION\r
505 *       Subnet Management Class, Vendor Specific Low Range End\r
506 *\r
507 * SOURCE\r
508 */\r
509 #define IB_MCLASS_VENDOR_LOW_RANGE_MAX 0x0f\r
510 /**********/\r
511 \r
512 /****d* IBA Base: Constants/IB_MCLASS_VENDOR_HIGH_RANGE_MIN\r
513 * NAME\r
514 *       IB_MCLASS_VENDOR_HIGH_RANGE_MIN\r
515 *\r
516 * DESCRIPTION\r
517 *       Subnet Management Class, Vendor Specific High Range Start\r
518 *\r
519 * SOURCE\r
520 */\r
521 #define IB_MCLASS_VENDOR_HIGH_RANGE_MIN 0x30\r
522 /**********/\r
523 \r
524 /****d* IBA Base: Constants/IB_MCLASS_VENDOR_HIGH_RANGE_MAX\r
525 * NAME\r
526 *       IB_MCLASS_VENDOR_HIGH_RANGE_MAX\r
527 *\r
528 * DESCRIPTION\r
529 *       Subnet Management Class, Vendor Specific High Range End\r
530 *\r
531 * SOURCE\r
532 */\r
533 #define IB_MCLASS_VENDOR_HIGH_RANGE_MAX 0x4f\r
534 /**********/\r
535 \r
536 /****f* IBA Base: Types/ib_class_is_vendor_specific_low\r
537 * NAME\r
538 *       ib_class_is_vendor_specific_low\r
539 *\r
540 * DESCRIPTION\r
541 *       Indicitates if the Class Code if a vendor specific class from \r
542 *  the low range\r
543 *\r
544 * SYNOPSIS\r
545 */\r
546 static inline boolean_t\r
547 ib_class_is_vendor_specific_low(\r
548         IN              const   uint8_t class_code )\r
549 {\r
550         return( (class_code >= IB_MCLASS_VENDOR_LOW_RANGE_MIN) &&\r
551            (class_code <= IB_MCLASS_VENDOR_LOW_RANGE_MAX)) ;\r
552 }\r
553 /*\r
554 * PARAMETERS\r
555 *       class_code\r
556 *               [in] The Management Datagram Class Code\r
557 *\r
558 * RETURN VALUE\r
559 *       TRUE if the class is in the Low range of Vendor Specific MADs \r
560 *       FALSE otherwise.\r
561 *\r
562 * NOTES\r
563 *\r
564 * SEE ALSO\r
565 * IB_MCLASS_VENDOR_LOW_RANGE_MIN, IB_MCLASS_VENDOR_LOW_RANGE_MAX\r
566 *********/\r
567 \r
568 /****f* IBA Base: Types/ib_class_is_vendor_specific_high\r
569 * NAME\r
570 *       ib_class_is_vendor_specific_high\r
571 *\r
572 * DESCRIPTION\r
573 *       Indicitates if the Class Code if a vendor specific class from \r
574 *  the high range\r
575 *\r
576 * SYNOPSIS\r
577 */\r
578 static inline boolean_t\r
579 ib_class_is_vendor_specific_high(\r
580         IN              const   uint8_t class_code )\r
581 {\r
582         return( (class_code >= IB_MCLASS_VENDOR_HIGH_RANGE_MIN) &&\r
583            (class_code <= IB_MCLASS_VENDOR_HIGH_RANGE_MAX)) ;\r
584 }\r
585 /*\r
586 * PARAMETERS\r
587 *       class_code\r
588 *               [in] The Management Datagram Class Code\r
589 *\r
590 * RETURN VALUE\r
591 *       TRUE if the class is in the High range of Vendor Specific MADs \r
592 *       FALSE otherwise.\r
593 *\r
594 * NOTES\r
595 *\r
596 * SEE ALSO\r
597 * IB_MCLASS_VENDOR_HIGH_RANGE_MIN, IB_MCLASS_VENDOR_HIGH_RANGE_MAX\r
598 *********/\r
599 \r
600 \r
601 /****f* IBA Base: Types/ib_class_is_vendor_specific\r
602 * NAME\r
603 *       ib_class_is_vendor_specific\r
604 *\r
605 * DESCRIPTION\r
606 *       Indicitates if the Class Code if a vendor specific class\r
607 *\r
608 * SYNOPSIS\r
609 */\r
610 static inline boolean_t\r
611 ib_class_is_vendor_specific(\r
612         IN              const   uint8_t class_code )\r
613 {\r
614   return( ib_class_is_vendor_specific_low(class_code) ||\r
615                          ib_class_is_vendor_specific_high(class_code) );\r
616 }\r
617 /*\r
618 * PARAMETERS\r
619 *       class_code\r
620 *               [in] The Management Datagram Class Code\r
621 *\r
622 * RETURN VALUE\r
623 *       TRUE if the class is a Vendor Specific MAD\r
624 *       FALSE otherwise.\r
625 *\r
626 * NOTES\r
627 *\r
628 * SEE ALSO\r
629 *  ib_class_is_vendor_specific_low, ib_class_is_vendor_specific_high\r
630 *********/\r
631 \r
632 /*\r
633  *      MAD methods\r
634  */\r
635 /****d* IBA Base: Constants/IB_MAX_METHOD\r
636 * NAME\r
637 *       IB_MAX_METHOD\r
638 *\r
639 * DESCRIPTION\r
640 *       Total number of methods available to a class, not including the R-bit.\r
641 *\r
642 * SOURCE\r
643 */\r
644 #define IB_MAX_METHODS                                          128\r
645 /**********/\r
646 /****d* IBA Base: Constants/IB_MAD_METHOD_RESP_MASK\r
647 * NAME\r
648 *       IB_MAD_METHOD_RESP_MASK\r
649 *\r
650 * DESCRIPTION\r
651 *       Response mask to extract 'R' bit from the method field. (13.4.5)\r
652 *\r
653 * SOURCE\r
654 */\r
655 #define IB_MAD_METHOD_RESP_MASK                         0x80\r
656 /**********/\r
657 /****d* IBA Base: Constants/IB_MAD_METHOD_GET\r
658 * NAME\r
659 *       IB_MAD_METHOD_GET\r
660 *\r
661 * DESCRIPTION\r
662 *       Get() Method (13.4.5)\r
663 *\r
664 * SOURCE\r
665 */\r
666 #define IB_MAD_METHOD_GET                                       0x01\r
667 /**********/\r
668 /****d* IBA Base: Constants/IB_MAD_METHOD_SET\r
669 * NAME\r
670 *       IB_MAD_METHOD_SET\r
671 *\r
672 * DESCRIPTION\r
673 *       Set() Method (13.4.5)\r
674 *\r
675 * SOURCE\r
676 */\r
677 #define IB_MAD_METHOD_SET                                       0x02\r
678 /**********/\r
679 /****d* IBA Base: Constants/IB_MAD_METHOD_GET_RESP\r
680 * NAME\r
681 *       IB_MAD_METHOD_GET_RESP\r
682 *\r
683 * DESCRIPTION\r
684 *       GetResp() Method (13.4.5)\r
685 *\r
686 * SOURCE\r
687 */\r
688 #define IB_MAD_METHOD_GET_RESP                          0x81\r
689 /**********/\r
690 \r
691 #define IB_MAD_METHOD_DELETE                            0x15\r
692 \r
693 /****d* IBA Base: Constants/IB_MAD_METHOD_GETTABLE\r
694 * NAME\r
695 *       IB_MAD_METHOD_GETTABLE\r
696 *\r
697 * DESCRIPTION\r
698 *       SubnAdmGetTable() Method (15.2.2)\r
699 *\r
700 * SOURCE\r
701 */\r
702 #define IB_MAD_METHOD_GETTABLE                          0x12\r
703 \r
704 /**********/\r
705 /****d* IBA Base: Constants/IB_MAD_METHOD_GETTABLE_RESP\r
706 * NAME\r
707 *       IB_MAD_METHOD_GETTABLE_RESP\r
708 *\r
709 * DESCRIPTION\r
710 *       SubnAdmGetTableResp() Method (15.2.2)\r
711 *\r
712 * SOURCE\r
713 */\r
714 #define IB_MAD_METHOD_GETTABLE_RESP                     0x92\r
715 \r
716 /**********/\r
717 \r
718 #define IB_MAD_METHOD_GETTRACETABLE                     0x13\r
719 #define IB_MAD_METHOD_GETMULTI                          0x14\r
720 #define IB_MAD_METHOD_GETMULTI_RESP                     0x94\r
721 \r
722 \r
723 /****d* IBA Base: Constants/IB_MAD_METHOD_SEND\r
724 * NAME\r
725 *       IB_MAD_METHOD_SEND\r
726 *\r
727 * DESCRIPTION\r
728 *       Send() Method (13.4.5)\r
729 *\r
730 * SOURCE\r
731 */\r
732 #define IB_MAD_METHOD_SEND                                      0x03\r
733 /**********/\r
734 /****d* IBA Base: Constants/IB_MAD_METHOD_TRAP\r
735 * NAME\r
736 *       IB_MAD_METHOD_TRAP\r
737 *\r
738 * DESCRIPTION\r
739 *       Trap() Method (13.4.5)\r
740 *\r
741 * SOURCE\r
742 */\r
743 #define IB_MAD_METHOD_TRAP                                      0x05\r
744 /**********/\r
745 /****d* IBA Base: Constants/IB_MAD_METHOD_REPORT\r
746 * NAME\r
747 *       IB_MAD_METHOD_REPORT\r
748 *\r
749 * DESCRIPTION\r
750 *       Report() Method (13.4.5)\r
751 *\r
752 * SOURCE\r
753 */\r
754 #define IB_MAD_METHOD_REPORT                            0x06\r
755 /**********/\r
756 /****d* IBA Base: Constants/IB_MAD_METHOD_REPORT_RESP\r
757 * NAME\r
758 *       IB_MAD_METHOD_REPORT_RESP\r
759 *\r
760 * DESCRIPTION\r
761 *       ReportResp() Method (13.4.5)\r
762 *\r
763 * SOURCE\r
764 */\r
765 #define IB_MAD_METHOD_REPORT_RESP                       0x86\r
766 /**********/\r
767 /****d* IBA Base: Constants/IB_MAD_METHOD_TRAP_REPRESS\r
768 * NAME\r
769 *       IB_MAD_METHOD_TRAP_REPRESS\r
770 *\r
771 * DESCRIPTION\r
772 *       TrapRepress() Method (13.4.5)\r
773 *\r
774 * SOURCE\r
775 */\r
776 #define IB_MAD_METHOD_TRAP_REPRESS                      0x07\r
777 /**********/\r
778 /****d* IBA Base: Constants/IB_MAD_STATUS_BUSY\r
779 * NAME\r
780 *       IB_MAD_STATUS_BUSY\r
781 *\r
782 * DESCRIPTION\r
783 *       Temporarily busy, MAD discarded (13.4.7)\r
784 *\r
785 * SOURCE\r
786 */\r
787 #define IB_MAD_STATUS_BUSY                                      (CL_HTON16(0x0001))\r
788 /**********/\r
789 /****d* IBA Base: Constants/IB_MAD_STATUS_REDIRECT\r
790 * NAME\r
791 *       IB_MAD_STATUS_REDIRECT\r
792 *\r
793 * DESCRIPTION\r
794 *       QP Redirection required (13.4.7)\r
795 *\r
796 * SOURCE\r
797 */\r
798 #define IB_MAD_STATUS_REDIRECT                          (CL_HTON16(0x0002))\r
799 /**********/\r
800 /****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_CLASS_VER\r
801 * NAME\r
802 *       IB_MAD_STATUS_UNSUP_CLASS_VER\r
803 *\r
804 * DESCRIPTION\r
805 *       Unsupported class version (13.4.7)\r
806 *\r
807 * SOURCE\r
808 */\r
809 #define IB_MAD_STATUS_UNSUP_CLASS_VER           (CL_HTON16(0x0004))\r
810 /**********/\r
811 /****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_METHOD\r
812 * NAME\r
813 *       IB_MAD_STATUS_UNSUP_METHOD\r
814 *\r
815 * DESCRIPTION\r
816 *       Unsupported method (13.4.7)\r
817 *\r
818 * SOURCE\r
819 */\r
820 #define IB_MAD_STATUS_UNSUP_METHOD                      (CL_HTON16(0x0008))\r
821 /**********/\r
822 /****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_METHOD_ATTR\r
823 * NAME\r
824 *       IB_MAD_STATUS_UNSUP_METHOD_ATTR\r
825 *\r
826 * DESCRIPTION\r
827 *       Unsupported method/attribute combination (13.4.7)\r
828 *\r
829 * SOURCE\r
830 */\r
831 #define IB_MAD_STATUS_UNSUP_METHOD_ATTR         (CL_HTON16(0x000C))\r
832 /**********/\r
833 /****d* IBA Base: Constants/IB_MAD_STATUS_INVALID_FIELD\r
834 * NAME\r
835 *       IB_MAD_STATUS_INVALID_FIELD\r
836 *\r
837 * DESCRIPTION\r
838 *       Attribute contains one or more invalid fields (13.4.7)\r
839 *\r
840 * SOURCE\r
841 */\r
842 #define IB_MAD_STATUS_INVALID_FIELD                     (CL_HTON16(0x001C))\r
843 /**********/\r
844 \r
845 #define IB_MAD_STATUS_CLASS_MASK                        (CL_HTON16(0xFF00))\r
846 \r
847 #define IB_SA_MAD_STATUS_SUCCESS                        (CL_HTON16(0x0000))\r
848 #define IB_SA_MAD_STATUS_NO_RESOURCES           (CL_HTON16(0x0100))\r
849 #define IB_SA_MAD_STATUS_REQ_INVALID            (CL_HTON16(0x0200))\r
850 #define IB_SA_MAD_STATUS_NO_RECORDS                     (CL_HTON16(0x0300))\r
851 #define IB_SA_MAD_STATUS_TOO_MANY_RECORDS       (CL_HTON16(0x0400))\r
852 #define IB_SA_MAD_STATUS_INVALID_GID            (CL_HTON16(0x0500))\r
853 #define IB_SA_MAD_STATUS_INSUF_COMPS            (CL_HTON16(0x0600))\r
854 \r
855 #define IB_DM_MAD_STATUS_NO_IOC_RESP            (CL_HTON16(0x0100))\r
856 #define IB_DM_MAD_STATUS_NO_SVC_ENTRIES         (CL_HTON16(0x0200))\r
857 #define IB_DM_MAD_STATUS_IOC_FAILURE            (CL_HTON16(0x8000))\r
858 \r
859 /****d* IBA Base: Constants/IB_MAD_ATTR_CLASS_PORT_INFO\r
860 * NAME\r
861 *       IB_MAD_ATTR_CLASS_PORT_INFO\r
862 *\r
863 * DESCRIPTION\r
864 *       ClassPortInfo attribute (13.4.8)\r
865 *\r
866 * SOURCE\r
867 */\r
868 #define IB_MAD_ATTR_CLASS_PORT_INFO                     (CL_NTOH16(0x0001))\r
869 /**********/\r
870 /****d* IBA Base: Constants/IB_MAD_ATTR_NOTICE\r
871 * NAME\r
872 *       IB_MAD_ATTR_NOTICE\r
873 *\r
874 * DESCRIPTION\r
875 *       Notice attribute (13.4.8)\r
876 *\r
877 * SOURCE\r
878 */\r
879 #define IB_MAD_ATTR_NOTICE                                      (CL_NTOH16(0x0002))\r
880 /**********/\r
881 /****d* IBA Base: Constants/IB_MAD_ATTR_INFORM_INFO\r
882 * NAME\r
883 *       IB_MAD_ATTR_INFORM_INFO\r
884 *\r
885 * DESCRIPTION\r
886 *       InformInfo attribute (13.4.8)\r
887 *\r
888 * SOURCE\r
889 */\r
890 #define IB_MAD_ATTR_INFORM_INFO                         (CL_NTOH16(0x0003))\r
891 /**********/\r
892 /****d* IBA Base: Constants/IB_MAD_ATTR_NODE_DESC\r
893 * NAME\r
894 *       IB_MAD_ATTR_NODE_DESC\r
895 *\r
896 * DESCRIPTION\r
897 *       NodeDescription attribute (14.2.5)\r
898 *\r
899 * SOURCE\r
900 */\r
901 #define IB_MAD_ATTR_NODE_DESC                           (CL_NTOH16(0x0010))\r
902 /*********/\r
903 /****d* IBA Base: Constants/IB_MAD_ATTR_PORT_SMPL_CTRL\r
904 * NAME\r
905 *       IB_MAD_ATTR_PORT_SMPL_CTRL\r
906 *\r
907 * DESCRIPTION\r
908 *       NodeDescription attribute (16.1.2)\r
909 *\r
910 * SOURCE\r
911 */\r
912 #define IB_MAD_ATTR_PORT_SMPL_CTRL                      (CL_NTOH16(0x0010))\r
913 /**********/\r
914 /****d* IBA Base: Constants/IB_MAD_ATTR_NODE_INFO\r
915 * NAME\r
916 *       IB_MAD_ATTR_NODE_INFO\r
917 *\r
918 * DESCRIPTION\r
919 *       NodeInfo attribute (14.2.5)\r
920 *\r
921 * SOURCE\r
922 */\r
923 #define IB_MAD_ATTR_NODE_INFO                           (CL_NTOH16(0x0011))\r
924 /**********/\r
925 /****d* IBA Base: Constants/IB_MAD_ATTR_PORT_SMPL_RSLT\r
926 * NAME\r
927 *       IB_MAD_ATTR_PORT_SMPL_RSLT\r
928 *\r
929 * DESCRIPTION\r
930 *       NodeInfo attribute (16.1.2)\r
931 *\r
932 * SOURCE\r
933 */\r
934 #define IB_MAD_ATTR_PORT_SMPL_RSLT                      (CL_NTOH16(0x0011))\r
935 /**********/\r
936 /****d* IBA Base: Constants/IB_MAD_ATTR_SWITCH_INFO\r
937 * NAME\r
938 *       IB_MAD_ATTR_SWITCH_INFO\r
939 *\r
940 * DESCRIPTION\r
941 *       SwitchInfo attribute (14.2.5)\r
942 *\r
943 * SOURCE\r
944 */\r
945 #define IB_MAD_ATTR_SWITCH_INFO                         (CL_NTOH16(0x0012))\r
946 /**********/\r
947 /****d* IBA Base: Constants/IB_MAD_ATTR_PORT_CNTRS\r
948 * NAME\r
949 *       IB_MAD_ATTR_PORT_CNTRS\r
950 *\r
951 * DESCRIPTION\r
952 *       SwitchInfo attribute (16.1.2)\r
953 *\r
954 * SOURCE\r
955 */\r
956 #define IB_MAD_ATTR_PORT_CNTRS                          (CL_NTOH16(0x0012))\r
957 /**********/\r
958 /****d* IBA Base: Constants/IB_MAD_ATTR_GUID_INFO\r
959 * NAME\r
960 *       IB_MAD_ATTR_GUID_INFO\r
961 *\r
962 * DESCRIPTION\r
963 *       GUIDInfo attribute (14.2.5)\r
964 *\r
965 * SOURCE\r
966 */\r
967 #define IB_MAD_ATTR_GUID_INFO                           (CL_NTOH16(0x0014))\r
968 /**********/\r
969 /****d* IBA Base: Constants/IB_MAD_ATTR_PORT_INFO\r
970 * NAME\r
971 *       IB_MAD_ATTR_PORT_INFO\r
972 *\r
973 * DESCRIPTION\r
974 *       PortInfo attribute (14.2.5)\r
975 *\r
976 * SOURCE\r
977 */\r
978 #define IB_MAD_ATTR_PORT_INFO                           (CL_NTOH16(0x0015))\r
979 /**********/\r
980 /****d* IBA Base: Constants/IB_MAD_ATTR_P_KEY_TABLE\r
981 * NAME\r
982 *       IB_MAD_ATTR_P_KEY_TABLE\r
983 *\r
984 * DESCRIPTION\r
985 *       PartitionTable attribute (14.2.5)\r
986 *\r
987 * SOURCE\r
988 */\r
989 #define IB_MAD_ATTR_P_KEY_TABLE                         (CL_NTOH16(0x0016))\r
990 /**********/\r
991 /****d* IBA Base: Constants/IB_MAD_ATTR_SLVL_TABLE\r
992 * NAME\r
993 *       IB_MAD_ATTR_SLVL_TABLE\r
994 *\r
995 * DESCRIPTION\r
996 *       SL VL Mapping Table attribute (14.2.5)\r
997 *\r
998 * SOURCE\r
999 */\r
1000 #define IB_MAD_ATTR_SLVL_TABLE                          (CL_NTOH16(0x0017))\r
1001 /**********/\r
1002 /****d* IBA Base: Constants/IB_MAD_ATTR_VL_ARBITRATION\r
1003 * NAME\r
1004 *       IB_MAD_ATTR_VL_ARBITRATION\r
1005 *\r
1006 * DESCRIPTION\r
1007 *       VL Arbitration Table attribute (14.2.5)\r
1008 *\r
1009 * SOURCE\r
1010 */\r
1011 #define IB_MAD_ATTR_VL_ARBITRATION                      (CL_NTOH16(0x0018))\r
1012 /**********/\r
1013 /****d* IBA Base: Constants/IB_MAD_ATTR_LIN_FWD_TBL\r
1014 * NAME\r
1015 *       IB_MAD_ATTR_LIN_FWD_TBL\r
1016 *\r
1017 * DESCRIPTION\r
1018 *       Switch linear forwarding table\r
1019 *\r
1020 * SOURCE\r
1021 */\r
1022 #define IB_MAD_ATTR_LIN_FWD_TBL                         (CL_NTOH16(0x0019))\r
1023 /**********/\r
1024 /****d* IBA Base: Constants/IB_MAD_ATTR_RND_FWD_TBL\r
1025 * NAME\r
1026 *       IB_MAD_ATTR_RND_FWD_TBL\r
1027 *\r
1028 * DESCRIPTION\r
1029 *       Switch random forwarding table\r
1030 *\r
1031 * SOURCE\r
1032 */\r
1033 #define IB_MAD_ATTR_RND_FWD_TBL                         (CL_NTOH16(0x001A))\r
1034 /**********/\r
1035 /****d* IBA Base: Constants/IB_MAD_ATTR_MCAST_FWD_TBL\r
1036 * NAME\r
1037 *       IB_MAD_ATTR_MCAST_FWD_TBL\r
1038 *\r
1039 * DESCRIPTION\r
1040 *       Switch multicast forwarding table\r
1041 *\r
1042 * SOURCE\r
1043 */\r
1044 #define IB_MAD_ATTR_MCAST_FWD_TBL                       (CL_NTOH16(0x001B))\r
1045 /**********/\r
1046 \r
1047 /****d* IBA Base: Constants/IB_MAD_ATTR_NODE_RECORD\r
1048 * NAME\r
1049 *       IB_MAD_ATTR_NODE_RECORD\r
1050 *\r
1051 * DESCRIPTION\r
1052 *       NodeRecord attribute (15.2.5)\r
1053 *\r
1054 * SOURCE\r
1055 */\r
1056 #define IB_MAD_ATTR_NODE_RECORD                         (CL_NTOH16(0x0011))\r
1057 /**********/\r
1058 /****d* IBA Base: Constants/IB_MAD_ATTR_PORTINFO_RECORD\r
1059 * NAME\r
1060 *       IB_MAD_ATTR_PORTINFO_RECORD\r
1061 *\r
1062 * DESCRIPTION\r
1063 *       PortInfoRecord attribute (15.2.5)\r
1064 *\r
1065 * SOURCE\r
1066 */\r
1067 #define IB_MAD_ATTR_PORTINFO_RECORD                     (CL_NTOH16(0x0012))\r
1068 /**********/\r
1069 \r
1070 \r
1071 /****d* IBA Base: Constants/IB_MAD_ATTR_LINK_RECORD\r
1072 * NAME\r
1073 *       IB_MAD_ATTR_LINK_RECORD\r
1074 *\r
1075 * DESCRIPTION\r
1076 *       LinkRecord attribute (15.2.5)\r
1077 *\r
1078 * SOURCE\r
1079 */\r
1080 #define IB_MAD_ATTR_LINK_RECORD                         (CL_NTOH16(0x0020))\r
1081 /**********/\r
1082 \r
1083 /****d* IBA Base: Constants/IB_MAD_ATTR_SM_INFO\r
1084 * NAME\r
1085 *       IB_MAD_ATTR_SM_INFO\r
1086 *\r
1087 * DESCRIPTION\r
1088 *       SMInfo attribute (14.2.5)\r
1089 *\r
1090 * SOURCE\r
1091 */\r
1092 #define IB_MAD_ATTR_SM_INFO                                     (CL_NTOH16(0x0020))\r
1093 /**********/\r
1094 \r
1095 /****d* IBA Base: Constants/IB_MAD_ATTR_SMINFO_RECORD\r
1096 * NAME\r
1097 *       IB_MAD_ATTR_SMINFO_RECORD\r
1098 *\r
1099 * DESCRIPTION\r
1100 *       SmInfoRecord attribute (15.2.5)\r
1101 *\r
1102 * SOURCE\r
1103 */\r
1104 #define IB_MAD_ATTR_SMINFO_RECORD                       (CL_NTOH16(0x0018))\r
1105 /**********/\r
1106 \r
1107 /****d* IBA Base: Constants/IB_MAD_ATTR_VENDOR_DIAG\r
1108 * NAME\r
1109 *       IB_MAD_ATTR_VENDOR_DIAG\r
1110 *\r
1111 * DESCRIPTION\r
1112 *       VendorDiag attribute (14.2.5)\r
1113 *\r
1114 * SOURCE\r
1115 */\r
1116 #define IB_MAD_ATTR_VENDOR_DIAG                         (CL_NTOH16(0x0030))\r
1117 /**********/\r
1118 /****d* IBA Base: Constants/IB_MAD_ATTR_LED_INFO\r
1119 * NAME\r
1120 *       IB_MAD_ATTR_LED_INFO\r
1121 *\r
1122 * DESCRIPTION\r
1123 *       LedInfo attribute (14.2.5)\r
1124 *\r
1125 * SOURCE\r
1126 */\r
1127 #define IB_MAD_ATTR_LED_INFO                            (CL_NTOH16(0x0031))\r
1128 /**********/\r
1129 /****d* IBA Base: Constants/IB_MAD_ATTR_SERVICE_RECORD\r
1130 * NAME\r
1131 *       IB_MAD_ATTR_SERVICE_RECORD\r
1132 *\r
1133 * DESCRIPTION\r
1134 *       ServiceRecord attribute (15.2.5)\r
1135 *\r
1136 * SOURCE\r
1137 */\r
1138 #define IB_MAD_ATTR_SERVICE_RECORD                      (CL_NTOH16(0x0031))\r
1139 /**********/\r
1140 /****d* IBA Base: Constants/IB_MAD_ATTR_LFT_RECORD\r
1141 * NAME\r
1142 *       IB_MAD_ATTR_LFT_RECORD\r
1143 *\r
1144 * DESCRIPTION\r
1145 *       LinearForwardingRecord attribute (15.2.5.6)\r
1146 *\r
1147 * SOURCE\r
1148 */\r
1149 #define IB_MAD_ATTR_LFT_RECORD                  (CL_NTOH16(0x0015))\r
1150 /**********/\r
1151 /****d* IBA Base: Constants/IB_MAD_ATTR_PKEYTBL_RECORD\r
1152 * NAME\r
1153 *       IB_MAD_ATTR_PKEYTBL_RECORD\r
1154 *\r
1155 * DESCRIPTION\r
1156 *       P-KEY table attribute (15.2.5)\r
1157 *\r
1158 * SOURCE\r
1159 */\r
1160 #define IB_MAD_ATTR_PKEY_TBL_RECORD                     (CL_NTOH16(0x0033))\r
1161 /**********/\r
1162 /****d* IBA Base: Constants/IB_MAD_ATTR_PATH_RECORD\r
1163 * NAME\r
1164 *       IB_MAD_ATTR_PATH_RECORD\r
1165 *\r
1166 * DESCRIPTION\r
1167 *       PathRecord attribute (15.2.5)\r
1168 *\r
1169 * SOURCE\r
1170 */\r
1171 #define IB_MAD_ATTR_PATH_RECORD                         (CL_NTOH16(0x0035))\r
1172 /**********/\r
1173 /****d* IBA Base: Constants/IB_MAD_ATTR_VLARB_RECORD\r
1174 * NAME\r
1175 *       IB_MAD_ATTR_VLARB_RECORD\r
1176 *\r
1177 * DESCRIPTION\r
1178 *       VL Arbitration Table attribute (15.2.5)\r
1179 *\r
1180 * SOURCE\r
1181 */\r
1182 #define IB_MAD_ATTR_VLARB_RECORD                        (CL_NTOH16(0x0036))\r
1183 /**********/\r
1184 /****d* IBA Base: Constants/IB_MAD_ATTR_SLVL_RECORD\r
1185 * NAME\r
1186 *       IB_MAD_ATTR_SLVL_RECORD\r
1187 *\r
1188 * DESCRIPTION\r
1189 *       VSLtoL Map Table attribute (15.2.5)\r
1190 *\r
1191 * SOURCE\r
1192 */\r
1193 #define IB_MAD_ATTR_SLVL_RECORD                         (CL_NTOH16(0x0013))\r
1194 /**********/\r
1195 /****d* IBA Base: Constants/IB_MAD_ATTR_MCMEMBER_RECORD\r
1196 * NAME\r
1197 *       IB_MAD_ATTR_MCMEMBER_RECORD\r
1198 *\r
1199 * DESCRIPTION\r
1200 *       MCMemberRecord attribute (15.2.5)\r
1201 *\r
1202 * SOURCE\r
1203 */\r
1204 #define IB_MAD_ATTR_MCMEMBER_RECORD                     (CL_NTOH16(0x0038))\r
1205 /**********/\r
1206 /****d* IBA Base: Constants/IB_MAD_ATTR_TRACE_RECORD\r
1207 * NAME\r
1208 *       IB_MAD_ATTR_MTRACE_RECORD\r
1209 *\r
1210 * DESCRIPTION\r
1211 *       TraceRecord attribute (15.2.5)\r
1212 *\r
1213 * SOURCE\r
1214 */\r
1215 #define IB_MAD_ATTR_TRACE_RECORD                        (CL_NTOH16(0x0039))\r
1216 /**********/\r
1217 /****d* IBA Base: Constants/IB_MAD_ATTR_MULTIPATH_RECORD\r
1218 * NAME\r
1219 *       IB_MAD_ATTR_MULTIPATH_RECORD\r
1220 *\r
1221 * DESCRIPTION\r
1222 *       MultiPath attribute (15.2.5)\r
1223 *\r
1224 * SOURCE\r
1225 */\r
1226 #define IB_MAD_ATTR_MULTIPATH_RECORD                    (CL_NTOH16(0x003A))\r
1227 /**********/\r
1228 /****d* IBA Base: Constants/IB_MAD_ATTR_SVC_ASSOCIATION_RECORD\r
1229 * NAME\r
1230 *       IB_MAD_ATTR_SVC_ASSOCIATION_RECORD\r
1231 *\r
1232 * DESCRIPTION\r
1233 *       Service Association attribute (15.2.5)\r
1234 *\r
1235 * SOURCE\r
1236 */\r
1237 #define IB_MAD_ATTR_SVC_ASSOCIATION_RECORD              (CL_NTOH16(0x003B))\r
1238 /**********/\r
1239 /****d* IBA Base: Constants/IB_MAD_ATTR_IO_UNIT_INFO\r
1240 * NAME\r
1241 *       IB_MAD_ATTR_IO_UNIT_INFO\r
1242 *\r
1243 * DESCRIPTION\r
1244 *       IOUnitInfo attribute (16.3.3)\r
1245 *\r
1246 * SOURCE\r
1247 */\r
1248 #define IB_MAD_ATTR_IO_UNIT_INFO                        (CL_NTOH16(0x0010))\r
1249 /**********/\r
1250 /****d* IBA Base: Constants/IB_MAD_ATTR_IOC_PROFILE\r
1251 * NAME\r
1252 *       IB_MAD_ATTR_IOC_PROFILE\r
1253 *\r
1254 * DESCRIPTION\r
1255 *       IOControllerProfile attribute (16.3.3)\r
1256 *\r
1257 * SOURCE\r
1258 */\r
1259 #define IB_MAD_ATTR_IOC_PROFILE                         (CL_NTOH16(0x0011))\r
1260 /**********/\r
1261 /****d* IBA Base: Constants/IB_MAD_ATTR_SERVICE_ENTRIES\r
1262 * NAME\r
1263 *       IB_MAD_ATTR_SERVICE_ENTRIES\r
1264 *\r
1265 * DESCRIPTION\r
1266 *       ServiceEntries attribute (16.3.3)\r
1267 *\r
1268 * SOURCE\r
1269 */\r
1270 #define IB_MAD_ATTR_SERVICE_ENTRIES                     (CL_NTOH16(0x0012))\r
1271 /**********/\r
1272 /****d* IBA Base: Constants/IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT\r
1273 * NAME\r
1274 *       IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT\r
1275 *\r
1276 * DESCRIPTION\r
1277 *       DiagnosticTimeout attribute (16.3.3)\r
1278 *\r
1279 * SOURCE\r
1280 */\r
1281 #define IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT          (CL_NTOH16(0x0020))\r
1282 /**********/\r
1283 /****d* IBA Base: Constants/IB_MAD_ATTR_PREPARE_TO_TEST\r
1284 * NAME\r
1285 *       IB_MAD_ATTR_PREPARE_TO_TEST\r
1286 *\r
1287 * DESCRIPTION\r
1288 *       PrepareToTest attribute (16.3.3)\r
1289 *\r
1290 * SOURCE\r
1291 */\r
1292 #define IB_MAD_ATTR_PREPARE_TO_TEST                     (CL_NTOH16(0x0021))\r
1293 /**********/\r
1294 /****d* IBA Base: Constants/IB_MAD_ATTR_TEST_DEVICE_ONCE\r
1295 * NAME\r
1296 *       IB_MAD_ATTR_TEST_DEVICE_ONCE\r
1297 *\r
1298 * DESCRIPTION\r
1299 *       TestDeviceOnce attribute (16.3.3)\r
1300 *\r
1301 * SOURCE\r
1302 */\r
1303 #define IB_MAD_ATTR_TEST_DEVICE_ONCE            (CL_NTOH16(0x0022))\r
1304 /**********/\r
1305 /****d* IBA Base: Constants/IB_MAD_ATTR_TEST_DEVICE_LOOP\r
1306 * NAME\r
1307 *       IB_MAD_ATTR_TEST_DEVICE_LOOP\r
1308 *\r
1309 * DESCRIPTION\r
1310 *       TestDeviceLoop attribute (16.3.3)\r
1311 *\r
1312 * SOURCE\r
1313 */\r
1314 #define IB_MAD_ATTR_TEST_DEVICE_LOOP            (CL_NTOH16(0x0023))\r
1315 /**********/\r
1316 /****d* IBA Base: Constants/IB_MAD_ATTR_DIAG_CODE\r
1317 * NAME\r
1318 *       IB_MAD_ATTR_DIAG_CODE\r
1319 *\r
1320 * DESCRIPTION\r
1321 *       DiagCode attribute (16.3.3)\r
1322 *\r
1323 * SOURCE\r
1324 */\r
1325 #define IB_MAD_ATTR_DIAG_CODE                           (CL_NTOH16(0x0024))\r
1326 /**********/\r
1327 /*** IBA Base: Constants/IB_MAD_ATTR_SVC_ASSOCIATION_RECORD\r
1328 * NAME\r
1329 *       IB_MAD_ATTR_SVC_ASSOCIATION_RECORD\r
1330 *\r
1331 * DESCRIPTION\r
1332 *       Service Association attribute (15.2.5)\r
1333 *\r
1334 * SOURCE\r
1335 */\r
1336 #define IB_MAD_ATTR_SVC_ASSOCIATION_RECORD      (CL_NTOH16(0x003B))\r
1337 /**********/\r
1338 /****d* IBA Base: Constants/IB_NODE_TYPE_CA\r
1339 * NAME\r
1340 *       IB_NODE_TYPE_CA\r
1341 *\r
1342 * DESCRIPTION\r
1343 *       Encoded generic node type used in MAD attributes (13.4.8.2)\r
1344 *\r
1345 * SOURCE\r
1346 */\r
1347 #define IB_NODE_TYPE_CA                                         0x01\r
1348 /**********/\r
1349 /****d* IBA Base: Constants/IB_NODE_TYPE_SWITCH\r
1350 * NAME\r
1351 *       IB_NODE_TYPE_SWITCH\r
1352 *\r
1353 * DESCRIPTION\r
1354 *       Encoded generic node type used in MAD attributes (13.4.8.2)\r
1355 *\r
1356 * SOURCE\r
1357 */\r
1358 #define IB_NODE_TYPE_SWITCH                                     0x02\r
1359 /**********/\r
1360 /****d* IBA Base: Constants/IB_NODE_TYPE_ROUTER\r
1361 * NAME\r
1362 *       IB_NODE_TYPE_ROUTER\r
1363 *\r
1364 * DESCRIPTION\r
1365 *       Encoded generic node type used in MAD attributes (13.4.8.2)\r
1366 *\r
1367 * SOURCE\r
1368 */\r
1369 #define IB_NODE_TYPE_ROUTER                                     0x03\r
1370 /**********/\r
1371 \r
1372 /****d* IBA Base: Constants/IB_NOTICE_NODE_TYPE_CA\r
1373 * NAME\r
1374 *       IB_NOTICE_NODE_TYPE_CA\r
1375 *\r
1376 * DESCRIPTION\r
1377 *       Encoded generic node type used in MAD attributes (13.4.8.2)\r
1378 *\r
1379 * SOURCE\r
1380 */\r
1381 #define IB_NOTICE_NODE_TYPE_CA                          (CL_NTOH32(0x000001))\r
1382 /**********/\r
1383 /****d* IBA Base: Constants/IB_NOTICE_NODE_TYPE_SWITCH\r
1384 * NAME\r
1385 *       IB_NOTICE_NODE_TYPE_SWITCH\r
1386 *\r
1387 * DESCRIPTION\r
1388 *       Encoded generic node type used in MAD attributes (13.4.8.2)\r
1389 *\r
1390 * SOURCE\r
1391 */\r
1392 #define IB_NOTICE_NODE_TYPE_SWITCH                      (CL_NTOH32(0x000002))\r
1393 /**********/\r
1394 /****d* IBA Base: Constants/IB_NOTICE_NODE_TYPE_ROUTER\r
1395 * NAME\r
1396 *       IB_NOTICE_NODE_TYPE_ROUTER\r
1397 *\r
1398 * DESCRIPTION\r
1399 *       Encoded generic node type used in MAD attributes (13.4.8.2)\r
1400 *\r
1401 * SOURCE\r
1402 */\r
1403 #define IB_NOTICE_NODE_TYPE_ROUTER                      (CL_NTOH32(0x000003))\r
1404 /**********/\r
1405 /****d* IBA Base: Constants/IB_NOTICE_NODE_TYPE_SUBN_MGMT\r
1406 * NAME\r
1407 *       IB_NOTICE_NODE_TYPE_SUBN_MGMT\r
1408 *\r
1409 * DESCRIPTION\r
1410 *       Encoded generic node type used in MAD attributes (13.4.8.2).\r
1411 *       Note that this value is not defined for the NodeType field\r
1412 *       of the NodeInfo attribute (14.2.5.3).\r
1413 *\r
1414 * SOURCE\r
1415 */\r
1416 #define IB_NOTICE_NODE_TYPE_SUBN_MGMT           (CL_NTOH32(0x000004))\r
1417 /**********/\r
1418 \r
1419 /****d* IBA Base: Constants/IB_MTU_TYPE\r
1420 * NAME\r
1421 *       IB_MTU_TYPE\r
1422 *\r
1423 * DESCRIPTION\r
1424 *       Encoded path MTU.\r
1425 *               1: 256\r
1426 *               2: 512\r
1427 *               3: 1024\r
1428 *               4: 2048\r
1429 *               5: 4096\r
1430 *               others: reserved\r
1431 *\r
1432 * SOURCE\r
1433 */\r
1434 #define IB_MTU_256                                                      1\r
1435 #define IB_MTU_512                                                      2\r
1436 #define IB_MTU_1024                                                     3\r
1437 #define IB_MTU_2048                                                     4\r
1438 #define IB_MTU_4096                                                     5\r
1439 /**********/\r
1440 \r
1441 /****d* IBA Base: Constants/IB_PATH_SELECTOR_TYPE\r
1442 * NAME\r
1443 *       IB_PATH_SELECTOR_TYPE\r
1444 *\r
1445 * DESCRIPTION\r
1446 *       Path selector.\r
1447 *               0: greater than rate specified\r
1448 *               1: less than rate specified\r
1449 *               2: exactly the rate specified\r
1450 *               3: largest rate available\r
1451 *\r
1452 * SOURCE\r
1453 */\r
1454 #define IB_PATH_SELECTOR_GREATER_THAN           0\r
1455 #define IB_PATH_SELECTOR_LESS_THAN                      1\r
1456 #define IB_PATH_SELECTOR_EXACTLY                        2\r
1457 #define IB_PATH_SELECTOR_LARGEST                        3\r
1458 /**********/\r
1459 \r
1460 /****d* IBA Base: Constants/IB_SMINFO_STATE_NOTACTIVE\r
1461 * NAME\r
1462 *       IB_SMINFO_STATE_NOTACTIVE\r
1463 *\r
1464 * DESCRIPTION\r
1465 *       Encoded state value used in the SMInfo attribute.\r
1466 *\r
1467 * SOURCE\r
1468 */\r
1469 #define IB_SMINFO_STATE_NOTACTIVE                       0\r
1470 /**********/\r
1471 /****d* IBA Base: Constants/IB_SMINFO_STATE_DISCOVERING\r
1472 * NAME\r
1473 *       IB_SMINFO_STATE_DISCOVERING\r
1474 *\r
1475 * DESCRIPTION\r
1476 *       Encoded state value used in the SMInfo attribute.\r
1477 *\r
1478 * SOURCE\r
1479 */\r
1480 #define IB_SMINFO_STATE_DISCOVERING                     1\r
1481 /**********/\r
1482 /****d* IBA Base: Constants/IB_SMINFO_STATE_STANDBY\r
1483 * NAME\r
1484 *       IB_SMINFO_STATE_STANDBY\r
1485 *\r
1486 * DESCRIPTION\r
1487 *       Encoded state value used in the SMInfo attribute.\r
1488 *\r
1489 * SOURCE\r
1490 */\r
1491 #define IB_SMINFO_STATE_STANDBY                         2\r
1492 /**********/\r
1493 /****d* IBA Base: Constants/IB_SMINFO_STATE_MASTER\r
1494 * NAME\r
1495 *       IB_SMINFO_STATE_MASTER\r
1496 *\r
1497 * DESCRIPTION\r
1498 *       Encoded state value used in the SMInfo attribute.\r
1499 *\r
1500 * SOURCE\r
1501 */\r
1502 #define IB_SMINFO_STATE_MASTER                          3\r
1503 /**********/\r
1504 /****d* IBA Base: Constants/IB_PATH_REC_SELECTOR_MASK\r
1505 * NAME\r
1506 *       IB_PATH_REC_SELECTOR_MASK\r
1507 *\r
1508 * DESCRIPTION\r
1509 *       Mask for the selector field for path record MTU, rate\r
1510 *       and packet lifetime.\r
1511 *\r
1512 * SOURCE\r
1513 */\r
1514 #define IB_PATH_REC_SELECTOR_MASK                       0xC0\r
1515 /**********/\r
1516 /****d* IBA Base: Constants/IB_PATH_REC_BASE_MASK\r
1517 * NAME\r
1518 *       IB_PATH_REC_BASE_MASK\r
1519 *\r
1520 * DESCRIPTION\r
1521 *       Mask for the base value field for path record MTU, rate\r
1522 *       and packet lifetime.\r
1523 *\r
1524 * SOURCE\r
1525 */\r
1526 #define IB_PATH_REC_BASE_MASK                           0x3F\r
1527 /**********/\r
1528 \r
1529 /****h* IBA Base/Type Definitions\r
1530 * NAME\r
1531 *       Type Definitions\r
1532 *\r
1533 * DESCRIPTION\r
1534 *       Definitions are from the InfiniBand Architecture Specification v1.1\r
1535 *\r
1536 *********/\r
1537 /****d* IBA Base: Types/ib_net16_t\r
1538 * NAME\r
1539 *       ib_net16_t\r
1540 *\r
1541 * DESCRIPTION\r
1542 *       Defines the network ordered type for 16-bit values.\r
1543 *\r
1544 * SOURCE\r
1545 */\r
1546 typedef uint16_t        ib_net16_t;\r
1547 /**********/\r
1548 /****d* IBA Base: Types/ib_net32_t\r
1549 * NAME\r
1550 *       ib_net32_t\r
1551 *\r
1552 * DESCRIPTION\r
1553 *       Defines the network ordered type for 32-bit values.\r
1554 *\r
1555 * SOURCE\r
1556 */\r
1557 typedef uint32_t        ib_net32_t;\r
1558 /**********/\r
1559 /****d* IBA Base: Types/ib_net64_t\r
1560 * NAME\r
1561 *       ib_net64_t\r
1562 *\r
1563 * DESCRIPTION\r
1564 *       Defines the network ordered type for 64-bit values.\r
1565 *\r
1566 * SOURCE\r
1567 */\r
1568 typedef uint64_t        ib_net64_t;\r
1569 /**********/\r
1570 /****d* IBA Base: Types/ib_gid_prefix_t\r
1571 * NAME\r
1572 *       ib_gid_prefix_t\r
1573 *\r
1574 * DESCRIPTION\r
1575 *\r
1576 * SOURCE\r
1577 */\r
1578 typedef ib_net64_t              ib_gid_prefix_t;\r
1579 /**********/\r
1580 \r
1581 /****d* IBA Base: Constants/ib_link_states_t\r
1582 * NAME\r
1583 *       ib_link_states_t\r
1584 *\r
1585 * DESCRIPTION\r
1586 *       Defines the link states of a port.\r
1587 *\r
1588 * SOURCE\r
1589 */\r
1590 #define IB_LINK_NO_CHANGE 0\r
1591 #define IB_LINK_DOWN      1\r
1592 #define IB_LINK_INIT      2\r
1593 #define IB_LINK_ARMED     3\r
1594 #define IB_LINK_ACTIVE    4\r
1595 #define IB_LINK_ACT_DEFER 5\r
1596 /**********/\r
1597 \r
1598 static const char* const __ib_node_type_str[] =\r
1599 {\r
1600         "UNKNOWN",\r
1601         "Channel Adapter",\r
1602         "Switch",\r
1603         "Router",\r
1604         "Subnet Management"\r
1605 };\r
1606 \r
1607 /****f* IBA Base: Types/ib_get_node_type_str\r
1608 * NAME\r
1609 *       ib_get_node_type_str\r
1610 *\r
1611 * DESCRIPTION\r
1612 *       Returns a string for the specified node type.\r
1613 *\r
1614 * SYNOPSIS\r
1615 */\r
1616 AL_INLINE const char* AL_API\r
1617 ib_get_node_type_str(\r
1618         IN                              uint8_t                                         node_type )\r
1619 {\r
1620         if( node_type >= IB_NODE_TYPE_ROUTER )\r
1621                 node_type = 0;\r
1622         return( __ib_node_type_str[node_type] );\r
1623 }\r
1624 /*\r
1625 * PARAMETERS\r
1626 *       node_type\r
1627 *               [in] Encoded node type as returned in the NodeInfo attribute.\r
1628 \r
1629 * RETURN VALUES\r
1630 *       Pointer to the node type string.\r
1631 *\r
1632 * NOTES\r
1633 *\r
1634 * SEE ALSO\r
1635 * ib_node_info_t\r
1636 *********/\r
1637 \r
1638 static const char* const __ib_port_state_str[] =\r
1639 {\r
1640         "No State Change (NOP)",\r
1641         "DOWN",\r
1642         "INIT",\r
1643         "ARMED",\r
1644         "ACTIVE",\r
1645         "ACTDEFER",\r
1646         "UNKNOWN"\r
1647 };\r
1648 \r
1649 /****f* IBA Base: Types/ib_get_port_state_str\r
1650 * NAME\r
1651 *       ib_get_port_state_str\r
1652 *\r
1653 * DESCRIPTION\r
1654 *       Returns a string for the specified port state.\r
1655 *\r
1656 * SYNOPSIS\r
1657 */\r
1658 AL_INLINE const char* AL_API\r
1659 ib_get_port_state_str(\r
1660         IN                              uint8_t                                         port_state )\r
1661 {\r
1662         if( port_state > IB_LINK_ACTIVE )\r
1663                 port_state = IB_LINK_ACTIVE + 1;\r
1664         return( __ib_port_state_str[port_state] );\r
1665 }\r
1666 /*\r
1667 * PARAMETERS\r
1668 *       port_state\r
1669 *               [in] Encoded port state as returned in the PortInfo attribute.\r
1670 \r
1671 * RETURN VALUES\r
1672 *       Pointer to the port state string.\r
1673 *\r
1674 * NOTES\r
1675 *\r
1676 * SEE ALSO\r
1677 * ib_port_info_t\r
1678 *********/\r
1679 \r
1680 /****f* IBA Base: Types/ib_get_port_state_from_str\r
1681 * NAME\r
1682 *       ib_get_port_state_from_str\r
1683 *\r
1684 * DESCRIPTION\r
1685 *       Returns a string for the specified port state.\r
1686 *\r
1687 * SYNOPSIS\r
1688 */\r
1689 AL_INLINE const uint8_t AL_API\r
1690 ib_get_port_state_from_str(\r
1691         IN                              char*                                           p_port_state_str )\r
1692 {\r
1693         if( !strncmp(p_port_state_str,"No State Change (NOP)",12) )\r
1694                 return(0);\r
1695         else if( !strncmp(p_port_state_str, "DOWN",4) )\r
1696                 return(1);\r
1697         else if( !strncmp(p_port_state_str, "INIT", 4) )\r
1698                 return(2);\r
1699         else if( !strncmp(p_port_state_str,"ARMED", 5) )\r
1700                 return(3);\r
1701         else if( !strncmp(p_port_state_str, "ACTIVE", 6) )\r
1702                 return(4);\r
1703         else if( !strncmp(p_port_state_str, "ACTDEFER", 8) )\r
1704                 return(5);\r
1705         return(6);\r
1706 }\r
1707 /*\r
1708 * PARAMETERS\r
1709 *       p_port_state_str\r
1710 *               [in] A string matching one returned by ib_get_port_state_str\r
1711 *\r
1712 * RETURN VALUES\r
1713 *       The appropriate code.\r
1714 *\r
1715 * NOTES\r
1716 *\r
1717 * SEE ALSO\r
1718 *       ib_port_info_t\r
1719 *********/\r
1720 \r
1721 /****d* IBA Base: Constants/Join States\r
1722 * NAME\r
1723 *       Join States\r
1724 *\r
1725 * DESCRIPTION\r
1726 *       Defines the join state flags for multicast group management.\r
1727 *\r
1728 * SOURCE\r
1729 */\r
1730 #define IB_JOIN_STATE_FULL                      1\r
1731 #define IB_JOIN_STATE_NON                       2\r
1732 #define IB_JOIN_STATE_SEND_ONLY         4\r
1733 /**********/\r
1734 \r
1735 /****f* IBA Base: Types/ib_pkey_get_base\r
1736 * NAME\r
1737 *       ib_pkey_get_base\r
1738 *\r
1739 * DESCRIPTION\r
1740 *       Returns the base P_Key value with the membership bit stripped.\r
1741 *\r
1742 * SYNOPSIS\r
1743 */\r
1744 AL_INLINE ib_net16_t AL_API\r
1745 ib_pkey_get_base(\r
1746         IN              const   ib_net16_t                                      pkey )\r
1747 {\r
1748         return( (ib_net16_t)(pkey & IB_PKEY_BASE_MASK) );\r
1749 }\r
1750 /*\r
1751 * PARAMETERS\r
1752 *       pkey\r
1753 *               [in] P_Key value\r
1754 *\r
1755 * RETURN VALUE\r
1756 *       Returns the base P_Key value with the membership bit stripped.\r
1757 *\r
1758 * NOTES\r
1759 *\r
1760 * SEE ALSO\r
1761 *********/\r
1762 /****f* IBA Base: Types/ib_pkey_is_full_member\r
1763 * NAME\r
1764 *       ib_pkey_is_full_member\r
1765 *\r
1766 * DESCRIPTION\r
1767 *       Indicitates if the port is a full member of the parition.\r
1768 *\r
1769 * SYNOPSIS\r
1770 */\r
1771 AL_INLINE boolean_t AL_API\r
1772 ib_pkey_is_full_member(\r
1773         IN              const   ib_net16_t                                      pkey )\r
1774 {\r
1775         return( (pkey & IB_PKEY_TYPE_MASK) == IB_PKEY_TYPE_MASK );\r
1776 }\r
1777 /*\r
1778 * PARAMETERS\r
1779 *       pkey\r
1780 *               [in] P_Key value\r
1781 *\r
1782 * RETURN VALUE\r
1783 *       TRUE if the port is a full member of the partition.\r
1784 *       FALSE otherwise.\r
1785 *\r
1786 * NOTES\r
1787 *\r
1788 * SEE ALSO\r
1789 * ib_pkey_get_base, ib_net16_t\r
1790 *********/\r
1791 \r
1792 /****d* IBA Base: Types/ib_gid_t\r
1793 * NAME\r
1794 *       ib_gid_t\r
1795 *\r
1796 * DESCRIPTION\r
1797 *\r
1798 * SYNOPSIS\r
1799 */\r
1800 #include <complib/cl_packon.h>\r
1801 typedef union _ib_gid\r
1802 {\r
1803         uint8_t                                 raw[16];\r
1804         struct _ib_gid_unicast\r
1805         {\r
1806                 ib_gid_prefix_t         prefix;\r
1807                 ib_net64_t                      interface_id;\r
1808 \r
1809         } PACK_SUFFIX unicast;\r
1810 \r
1811         struct _ib_gid_multicast\r
1812         {\r
1813                 uint8_t                         header[2];\r
1814                 uint8_t                         raw_group_id[14];\r
1815 \r
1816         } PACK_SUFFIX multicast;\r
1817 \r
1818 }       PACK_SUFFIX ib_gid_t;\r
1819 #include <complib/cl_packoff.h>\r
1820 /*\r
1821 * FIELDS\r
1822 *       raw\r
1823 *               GID represented as an unformated byte array.\r
1824 *\r
1825 *       unicast\r
1826 *               Typical unicast representation with subnet prefix and\r
1827 *               port GUID.\r
1828 *\r
1829 *       multicast\r
1830 *               Representation for multicast use.\r
1831 *\r
1832 * SEE ALSO\r
1833 *********/\r
1834 \r
1835 AL_INLINE boolean_t AL_API\r
1836 ib_gid_is_multicast(\r
1837         IN              const   ib_gid_t*                                       p_gid )\r
1838 {\r
1839         return( p_gid->raw[0] == 0xFF );\r
1840 }\r
1841 \r
1842 /****f* IBA Base: Types/ib_gid_set_default\r
1843 * NAME\r
1844 *       ib_gid_set_default\r
1845 *\r
1846 * DESCRIPTION\r
1847 *       Sets a GID to the default value.\r
1848 *\r
1849 * SYNOPSIS\r
1850 */\r
1851 AL_INLINE void AL_API\r
1852 ib_gid_set_default(\r
1853         IN                              ib_gid_t* const                         p_gid,\r
1854         IN              const   ib_net64_t                                      interface_id )\r
1855 {\r
1856         p_gid->unicast.prefix = IB_DEFAULT_SUBNET_PREFIX;\r
1857         p_gid->unicast.interface_id = interface_id;\r
1858 }\r
1859 /*\r
1860 * PARAMETERS\r
1861 *       p_gid\r
1862 *               [in] Pointer to the GID object.\r
1863 *\r
1864 *       interface_id\r
1865 *               [in] Manufacturer assigned EUI64 value of a port.\r
1866 *\r
1867 * RETURN VALUES\r
1868 *       None.\r
1869 *\r
1870 * NOTES\r
1871 *\r
1872 * SEE ALSO\r
1873 *       ib_gid_t\r
1874 *********/\r
1875 /****f* IBA Base: Types/ib_gid_get_subnet_prefix\r
1876 * NAME\r
1877 *       ib_gid_get_subnet_prefix\r
1878 *\r
1879 * DESCRIPTION\r
1880 *       Gets the subnet prefix from a GID.\r
1881 *\r
1882 * SYNOPSIS\r
1883 */\r
1884 AL_INLINE ib_net64_t AL_API\r
1885 ib_gid_get_subnet_prefix(\r
1886         IN              const   ib_gid_t* const                         p_gid )\r
1887 {\r
1888         return( p_gid->unicast.prefix );\r
1889 }\r
1890 /*\r
1891 * PARAMETERS\r
1892 *       p_gid\r
1893 *               [in] Pointer to the GID object.\r
1894 *\r
1895 * RETURN VALUES\r
1896 *       64-bit subnet prefix value.\r
1897 *\r
1898 * NOTES\r
1899 *\r
1900 * SEE ALSO\r
1901 *       ib_gid_t\r
1902 *********/\r
1903 /****f* IBA Base: Types/ib_gid_is_link_local\r
1904 * NAME\r
1905 *       ib_gid_is_link_local\r
1906 *\r
1907 * DESCRIPTION\r
1908 *       Returns TRUE if the unicast GID scoping indicates link local,\r
1909 *       FALSE otherwise.\r
1910 *\r
1911 * SYNOPSIS\r
1912 */\r
1913 static inline boolean_t\r
1914 ib_gid_is_link_local(\r
1915         IN              const   ib_gid_t* const                         p_gid )\r
1916 {\r
1917         return( ib_gid_get_subnet_prefix( p_gid ) == IB_DEFAULT_SUBNET_PREFIX );\r
1918 }\r
1919 /*\r
1920 * PARAMETERS\r
1921 *       p_gid\r
1922 *               [in] Pointer to the GID object.\r
1923 *\r
1924 * RETURN VALUES\r
1925 *       Returns TRUE if the unicast GID scoping indicates link local,\r
1926 *       FALSE otherwise.\r
1927 *\r
1928 * NOTES\r
1929 *\r
1930 * SEE ALSO\r
1931 *       ib_gid_t\r
1932 *********/\r
1933 /****f* IBA Base: Types/ib_gid_is_site_local\r
1934 * NAME\r
1935 *       ib_gid_is_site_local\r
1936 *\r
1937 * DESCRIPTION\r
1938 *       Returns TRUE if the unicast GID scoping indicates site local,\r
1939 *       FALSE otherwise.\r
1940 *\r
1941 * SYNOPSIS\r
1942 */\r
1943 static inline boolean_t\r
1944 ib_gid_is_site_local(\r
1945         IN              const   ib_gid_t* const                         p_gid )\r
1946 {\r
1947         return( ( ib_gid_get_subnet_prefix( p_gid ) &\r
1948                 CL_HTON64( CL_CONST64(0xFFFFFFFFFFFF0000) ) ) ==\r
1949                 CL_HTON64( CL_CONST64(0xFEC0000000000000) ) );\r
1950 }\r
1951 /*\r
1952 * PARAMETERS\r
1953 *       p_gid\r
1954 *               [in] Pointer to the GID object.\r
1955 *\r
1956 * RETURN VALUES\r
1957 *       Returns TRUE if the unicast GID scoping indicates link local,\r
1958 *       FALSE otherwise.\r
1959 *\r
1960 * NOTES\r
1961 *\r
1962 * SEE ALSO\r
1963 *       ib_gid_t\r
1964 *********/\r
1965 /****f* IBA Base: Types/ib_gid_get_guid\r
1966 * NAME\r
1967 *       ib_gid_get_guid\r
1968 *\r
1969 * DESCRIPTION\r
1970 *       Gets the guid from a GID.\r
1971 *\r
1972 * SYNOPSIS\r
1973 */\r
1974 AL_INLINE ib_net64_t AL_API\r
1975 ib_gid_get_guid(\r
1976         IN              const   ib_gid_t* const                         p_gid )\r
1977 {\r
1978         return( p_gid->unicast.interface_id );\r
1979 }\r
1980 /*\r
1981 * PARAMETERS\r
1982 *       p_gid\r
1983 *               [in] Pointer to the GID object.\r
1984 *\r
1985 * RETURN VALUES\r
1986 *       64-bit GUID value.\r
1987 *\r
1988 * NOTES\r
1989 *\r
1990 * SEE ALSO\r
1991 *       ib_gid_t\r
1992 *********/\r
1993 \r
1994 /****s* IBA Base: Types/ib_field32_t\r
1995 * NAME\r
1996 *       ib_field32_t\r
1997 *\r
1998 * DESCRIPTION\r
1999 *       Represents a 32-bit field, and allows access as a 32-bit network byte\r
2000 *       ordered or a 4-byte array.\r
2001 *\r
2002 * SYNOPSIS\r
2003 */\r
2004 #include <complib/cl_packon.h>\r
2005 typedef union _ib_field32_t\r
2006 {\r
2007         net32_t         val;\r
2008         uint8_t         bytes[4];\r
2009 \r
2010 }       PACK_SUFFIX ib_field32_t;\r
2011 #include <complib/cl_packoff.h>\r
2012 /*\r
2013 * FIELDS\r
2014 *       val\r
2015 *               Full field value.\r
2016 *\r
2017 *       bytes\r
2018 *               Byte array representing the field.  The byte array provides identical\r
2019 *               access independently from CPU byte-ordering.\r
2020 *********/\r
2021 \r
2022 /****s* IBA Base: Types/ib_path_rec_t\r
2023 * NAME\r
2024 *       ib_path_rec_t\r
2025 *\r
2026 * DESCRIPTION\r
2027 *       Path records encapsulate the properties of a given\r
2028 *       route between two end-points on a subnet.\r
2029 *\r
2030 * SYNOPSIS\r
2031 */\r
2032 #include <complib/cl_packon.h>\r
2033 typedef __declspec(align(8)) struct _ib_path_rec\r
2034 {\r
2035         uint64_t                                resv0;\r
2036         ib_gid_t                                dgid;\r
2037         ib_gid_t                                sgid;\r
2038         ib_net16_t                              dlid;\r
2039         ib_net16_t                              slid;\r
2040         ib_field32_t                    hop_flow_raw;\r
2041         uint8_t                                 tclass;\r
2042         uint8_t                                 num_path;\r
2043         ib_net16_t                              pkey;\r
2044         ib_net16_t                              sl;\r
2045         uint8_t                                 mtu;\r
2046         uint8_t                                 rate;\r
2047         uint8_t                                 pkt_life;\r
2048         uint8_t                                 preference;\r
2049         uint16_t                                resv1;\r
2050         uint32_t                                resv2;\r
2051 \r
2052 }       PACK_SUFFIX ib_path_rec_t;\r
2053 #include <complib/cl_packoff.h>\r
2054 /*\r
2055 * FIELDS\r
2056 *       resv0\r
2057 *               Reserved bytes.\r
2058 *\r
2059 *       dgid\r
2060 *               GID of destination port.\r
2061 *\r
2062 *       sgid\r
2063 *               GID of source port.\r
2064 *\r
2065 *       dlid\r
2066 *               LID of destination port.\r
2067 *\r
2068 *       slid\r
2069 *               LID of source port.\r
2070 *\r
2071 *       hop_flow_raw\r
2072 *               Global routing parameters: hop count, flow label and raw bit.\r
2073 *\r
2074 *       tclass\r
2075 *               Another global routing parameter.\r
2076 *\r
2077 *       num_path\r
2078 *               In queries, maximum number of paths to return.\r
2079 *               In responses, undefined.\r
2080 *\r
2081 *       pkey\r
2082 *               Partition key (P_Key) to use on this path.\r
2083 *\r
2084 *       resv1\r
2085 *               Reserved byte.\r
2086 *\r
2087 *       sl\r
2088 *               Service level to use on this path.\r
2089 *\r
2090 *       mtu\r
2091 *               MTU and MTU selector fields to use on this path\r
2092 *\r
2093 *       rate\r
2094 *               Rate and rate selector fields to use on this path.\r
2095 *\r
2096 *       pkt_life\r
2097 *               Packet lifetime\r
2098 *\r
2099 *       preference\r
2100 *               Indicates the relative merit of this path versus other path\r
2101 *               records returned from the SA.  Lower numbers are better.\r
2102 *\r
2103 *       resv1\r
2104 *               Reserved bytes.\r
2105 *\r
2106 *       resv2\r
2107 *               Reserved bytes.\r
2108 * SEE ALSO\r
2109 *********/\r
2110 \r
2111 /* Port Record Component Masks */\r
2112 #define IB_PR_COMPMASK_LID                                      (CL_HTON64(1<<0))\r
2113 #define IB_PR_COMPMASK_DGID                                     (CL_HTON64(1<<2))\r
2114 #define IB_PR_COMPMASK_SGID                                     (CL_HTON64(1<<3))\r
2115 #define IB_PR_COMPMASK_DLID                                     (CL_HTON64(1<<4))\r
2116 #define IB_PR_COMPMASK_SLID                                     (CL_HTON64(1<<5))\r
2117 #define IB_PR_COMPMASK_RAWTRAFIC                        (CL_HTON64(1<<6))\r
2118 #define IB_PR_COMPMASK_RESV0                            (CL_HTON64(1<<7))\r
2119 #define IB_PR_COMPMASK_FLOWLABEL                        (CL_HTON64(1<<8))\r
2120 #define IB_PR_COMPMASK_HOPLIMIT                         (CL_HTON64(1<<9))\r
2121 #define IB_PR_COMPMASK_TCLASS                           (CL_HTON64(1<<10))\r
2122 #define IB_PR_COMPMASK_REVERSIBLE                       (CL_HTON64(1<<11))\r
2123 #define IB_PR_COMPMASK_NUM_PATH                         (CL_HTON64(1<<12))\r
2124 #define IB_PR_COMPMASK_PKEY                                     (CL_HTON64(1<<13))\r
2125 #define IB_PR_COMPMASK_RESV1                            (CL_HTON64(1<<14))\r
2126 #define IB_PR_COMPMASK_SL                                       (CL_HTON64(1<<15))\r
2127 #define IB_PR_COMPMASK_MTU_SEL                          (CL_HTON64(1<<16))\r
2128 #define IB_PR_COMPMASK_MTU                                      (CL_HTON64(1<<17))\r
2129 #define IB_PR_COMPMASK_RATE_SEL                         (CL_HTON64(1<<18))\r
2130 #define IB_PR_COMPMASK_RATE                                     (CL_HTON64(1<<19))\r
2131 #define IB_PR_COMPMASK_PKTLIFETIME_SEL          (CL_HTON64(1<<20))\r
2132 #define IB_PR_COMPMASK_PFTLIFETIME                      (CL_HTON64(1<<21))\r
2133 \r
2134 /* Link Record Component Masks */\r
2135 #define IB_LR_COMPMASK_FROM_LID                         (CL_HTON64(1<<0))\r
2136 #define IB_LR_COMPMASK_FROM_PORT                        (CL_HTON64(1<<1))\r
2137 #define IB_LR_COMPMASK_TO_PORT                          (CL_HTON64(1<<2))\r
2138 #define IB_LR_COMPMASK_TO_LID                           (CL_HTON64(1<<3))\r
2139 \r
2140 /* VL Arbitration Record MASKs */\r
2141 #define IB_VLA_COMPMASK_LID                                     (CL_HTON64(1<<0))\r
2142 #define IB_VLA_COMPMASK_OUT_PORT                        (CL_HTON64(1<<1))\r
2143 #define IB_VLA_COMPMASK_BLOCK                           (CL_HTON64(1<<2))\r
2144 /* SLtoVL Mapping Record Masks */\r
2145 #define IB_SLVL_COMPMASK_LID                            (CL_HTON64(1<<0))\r
2146 #define IB_SLVL_COMPMASK_IN_PORT                        (CL_HTON64(1<<1))\r
2147 #define IB_SLVL_COMPMASK_OUT_PORT                       (CL_HTON64(1<<2))\r
2148 /* LFT Record MASKS */\r
2149 #define IB_LFTR_COMPMASK_LID                            (CL_HTON64(1<<0))\r
2150 #define IB_LFTR_COMPMASK_BLOCK                          (CL_HTON64(1<<1))\r
2151 /* ModeInfo Record MASKS */\r
2152 #define IB_NR_COMPMASK_LID                                      (CL_HTON64(1<<0))\r
2153 #define IB_NR_COMPMASK_RESERVED1                        (CL_HTON64(1<<1))\r
2154 #define IB_NR_COMPMASK_BASEVERSION                      (CL_HTON64(1<<2))\r
2155 #define IB_NR_COMPMASK_CLASSVERSION                     (CL_HTON64(1<<3))\r
2156 #define IB_NR_COMPMASK_NODETYPE                         (CL_HTON64(1<<4))\r
2157 #define IB_NR_COMPMASK_NUMPORTS                         (CL_HTON64(1<<5))\r
2158 #define IB_NR_COMPMASK_SYSIMAGEGUID                     (CL_HTON64(1<<6))\r
2159 #define IB_NR_COMPMASK_NODEGUID                         (CL_HTON64(1<<7))\r
2160 #define IB_NR_COMPMASK_PORTGUID                         (CL_HTON64(1<<8))\r
2161 #define IB_NR_COMPMASK_PARTCAP                          (CL_HTON64(1<<9))\r
2162 #define IB_NR_COMPMASK_DEVID                            (CL_HTON64(1<<10))\r
2163 #define IB_NR_COMPMASK_REV                                      (CL_HTON64(1<<11))\r
2164 #define IB_NR_COMPMASK_PORTNUM                          (CL_HTON64(1<<12))\r
2165 #define IB_NR_COMPMASK_VENDID                           (CL_HTON64(1<<13))\r
2166 #define IB_NR_COMPMASK_NODEDESC                         (CL_HTON64(1<<14))\r
2167 /* Service Record Component Mask Sec 15.2.5.14 Ver 1.1*/\r
2168 #define IB_SR_COMPMASK_SID                                      (CL_HTON64(1<<0))\r
2169 #define IB_SR_COMPMASK_SGID                                     (CL_HTON64(1<<1))\r
2170 #define IB_SR_COMPMASK_SPKEY                            (CL_HTON64(1<<2))\r
2171 #define IB_SR_COMPMASK_RES1                                     (CL_HTON64(1<<3))\r
2172 #define IB_SR_COMPMASK_SLEASE                           (CL_HTON64(1<<4))\r
2173 #define IB_SR_COMPMASK_SKEY                                     (CL_HTON64(1<<5))\r
2174 #define IB_SR_COMPMASK_SNAME                            (CL_HTON64(1<<6))\r
2175 #define IB_SR_COMPMASK_SDATA8_0                         (CL_HTON64(1<<7))\r
2176 #define IB_SR_COMPMASK_SDATA8_1                         (CL_HTON64(1<<8))\r
2177 #define IB_SR_COMPMASK_SDATA8_2                         (CL_HTON64(1<<9))\r
2178 #define IB_SR_COMPMASK_SDATA8_3                         (CL_HTON64(1<<10))\r
2179 #define IB_SR_COMPMASK_SDATA8_4                         (CL_HTON64(1<<11))\r
2180 #define IB_SR_COMPMASK_SDATA8_5                         (CL_HTON64(1<<12))\r
2181 #define IB_SR_COMPMASK_SDATA8_6                         (CL_HTON64(1<<13))\r
2182 #define IB_SR_COMPMASK_SDATA8_7                         (CL_HTON64(1<<14))\r
2183 #define IB_SR_COMPMASK_SDATA8_8                         (CL_HTON64(1<<15))\r
2184 #define IB_SR_COMPMASK_SDATA8_9                         (CL_HTON64(1<<16))\r
2185 #define IB_SR_COMPMASK_SDATA8_10                        (CL_HTON64(1<<17))\r
2186 #define IB_SR_COMPMASK_SDATA8_11                        (CL_HTON64(1<<18))\r
2187 #define IB_SR_COMPMASK_SDATA8_12                        (CL_HTON64(1<<19))\r
2188 #define IB_SR_COMPMASK_SDATA8_13                        (CL_HTON64(1<<20))\r
2189 #define IB_SR_COMPMASK_SDATA8_14                        (CL_HTON64(1<<21))\r
2190 #define IB_SR_COMPMASK_SDATA8_15                        (CL_HTON64(1<<22))\r
2191 #define IB_SR_COMPMASK_SDATA16_0                        (CL_HTON64(1<<23))\r
2192 #define IB_SR_COMPMASK_SDATA16_1                        (CL_HTON64(1<<24))\r
2193 #define IB_SR_COMPMASK_SDATA16_2                        (CL_HTON64(1<<25))\r
2194 #define IB_SR_COMPMASK_SDATA16_3                        (CL_HTON64(1<<26))\r
2195 #define IB_SR_COMPMASK_SDATA16_4                        (CL_HTON64(1<<27))\r
2196 #define IB_SR_COMPMASK_SDATA16_5                        (CL_HTON64(1<<28))\r
2197 #define IB_SR_COMPMASK_SDATA16_6                        (CL_HTON64(1<<29))\r
2198 #define IB_SR_COMPMASK_SDATA16_7                        (CL_HTON64(1<<30))\r
2199 #define IB_SR_COMPMASK_SDATA32_0                        (CL_HTON64(1<<31))\r
2200 #define IB_SR_COMPMASK_SDATA32_1                        (CL_HTON64(((uint64_t)1)<<32))\r
2201 #define IB_SR_COMPMASK_SDATA32_2                        (CL_HTON64(((uint64_t)1)<<33))\r
2202 #define IB_SR_COMPMASK_SDATA32_3                        (CL_HTON64(((uint64_t)1)<<34))\r
2203 #define IB_SR_COMPMASK_SDATA64_0                        (CL_HTON64(((uint64_t)1)<<35))\r
2204 #define IB_SR_COMPMASK_SDATA64_1                        (CL_HTON64(((uint64_t)1)<<36))\r
2205 /* Port Info Record Component Masks */\r
2206 #define IB_PIR_COMPMASK_LID                                     (CL_HTON64(1<<0))\r
2207 #define IB_PIR_COMPMASK_PORTNUM                         (CL_HTON64(1<<1))\r
2208 #define IB_PIR_COMPMASK_RESV1                           (CL_HTON64(1<<2))\r
2209 #define IB_PIR_COMPMASK_MKEY                            (CL_HTON64(1<<3))\r
2210 #define IB_PIR_COMPMASK_GIDPRE                          (CL_HTON64(1<<4))\r
2211 #define IB_PIR_COMPMASK_BASELID                         (CL_HTON64(1<<5))\r
2212 #define IB_PIR_COMPMASK_SMLID                           (CL_HTON64(1<<6))\r
2213 #define IB_PIR_COMPMASK_CAPMASK                         (CL_HTON64(1<<7))\r
2214 #define IB_PIR_COMPMASK_DIAGCODE                        (CL_HTON64(1<<8))\r
2215 #define IB_PIR_COMPMASK_MKEYLEASEPRD            (CL_HTON64(1<<9))\r
2216 #define IB_PIR_COMPMASK_LOCALPORTNUM            (CL_HTON64(1<<10))\r
2217 #define IB_PIR_COMPMASK_LNKWIDTHSUPPORT         (CL_HTON64(1<<11))\r
2218 #define IB_PIR_COMPMASK_LNKWIDTHACTIVE          (CL_HTON64(1<<12))\r
2219 #define IB_PIR_COMPMASK_LINKWIDTHENABLED        (CL_HTON64(1<<13))\r
2220 #define IB_PIR_COMPMASK_LNKSPEEDSUPPORT         (CL_HTON64(1<<14))\r
2221 #define IB_PIR_COMPMASK_PORTSTATE                       (CL_HTON64(1<<15))\r
2222 #define IB_PIR_COMPMASK_PORTPHYSTATE            (CL_HTON64(1<<16))\r
2223 #define IB_PIR_COMPMASK_LINKDWNDFLTSTATE        (CL_HTON64(1<<17))\r
2224 #define IB_PIR_COMPMASK_MKEYPROTBITS            (CL_HTON64(1<<18))\r
2225 #define IB_PIR_COMPMASK_LMC                                     (CL_HTON64(1<<19))\r
2226 #define IB_PIR_COMPMASK_LINKSPEEDACTIVE         (CL_HTON64(1<<20))\r
2227 #define IB_PIR_COMPMASK_LINKSPEEDENABLE         (CL_HTON64(1<<21))\r
2228 #define IB_PIR_COMPMASK_NEIGHBORMTU                     (CL_HTON64(1<<22))\r
2229 #define IB_PIR_COMPMASK_MASTERSMSL                      (CL_HTON64(1<<23))\r
2230 #define IB_PIR_COMPMASK_VLCAP                           (CL_HTON64(1<<24))\r
2231 #define IB_PIR_COMPMASK_INITTYPE                        (CL_HTON64(1<<25))\r
2232 #define IB_PIR_COMPMASK_VLHIGHLIMIT                     (CL_HTON64(1<<26))\r
2233 #define IB_PIR_COMPMASK_VLARBHIGHCAP            (CL_HTON64(1<<27))\r
2234 #define IB_PIR_COMPMASK_VLARBLOWCAP                     (CL_HTON64(1<<28))\r
2235 #define IB_PIR_COMPMASK_INITTYPEREPLY           (CL_HTON64(1<<29))\r
2236 #define IB_PIR_COMPMASK_MTUCAP                          (CL_HTON64(1<<30))\r
2237 #define IB_PIR_COMPMASK_VLSTALLCNT                      (CL_HTON64(1<<31))\r
2238 #define IB_PIR_COMPMASK_HOQLIFE                         (CL_HTON64(((uint64_t)1)<<32))\r
2239 #define IB_PIR_COMPMASK_OPVLS                           (CL_HTON64(((uint64_t)1)<<33))\r
2240 #define IB_PIR_COMPMASK_PARENFIN                        (CL_HTON64(((uint64_t)1)<<34))\r
2241 #define IB_PIR_COMPMASK_PARENFOUT                       (CL_HTON64(((uint64_t)1)<<35))\r
2242 #define IB_PIR_COMPMASK_FILTERRAWIN                     (CL_HTON64(((uint64_t)1)<<36))\r
2243 #define IB_PIR_COMPMASK_FILTERRAWOUT            (CL_HTON64(((uint64_t)1)<<37))\r
2244 #define IB_PIR_COMPMASK_MKEYVIO                         (CL_HTON64(((uint64_t)1)<<38))\r
2245 #define IB_PIR_COMPMASK_PKEYVIO                         (CL_HTON64(((uint64_t)1)<<39))\r
2246 #define IB_PIR_COMPMASK_QKEYVIO                         (CL_HTON64(((uint64_t)1)<<40))\r
2247 #define IB_PIR_COMPMASK_GUIDCAP                         (CL_HTON64(((uint64_t)1)<<41))\r
2248 #define IB_PIR_COMPMASK_RESV2                           (CL_HTON64(((uint64_t)1)<<42))\r
2249 #define IB_PIR_COMPMASK_SUBNTO                          (CL_HTON64(((uint64_t)1)<<43))\r
2250 #define IB_PIR_COMPMASK_RESV3                           (CL_HTON64(((uint64_t)1)<<44))\r
2251 #define IB_PIR_COMPMASK_RESPTIME                        (CL_HTON64(((uint64_t)1)<<45))\r
2252 #define IB_PIR_COMPMASK_LOCALPHYERR                     (CL_HTON64(((uint64_t)1)<<46))\r
2253 #define IB_PIR_COMPMASK_OVERRUNERR                      (CL_HTON64(((uint64_t)1)<<47))\r
2254 /* Multicast Member Record Component Masks */\r
2255 #define IB_MCR_COMPMASK_GID                                     (CL_HTON64(1<<0))\r
2256 #define IB_MCR_COMPMASK_MGID                            (CL_HTON64(1<<0))\r
2257 #define IB_MCR_COMPMASK_PORT_GID                        (CL_HTON64(1<<1))\r
2258 #define IB_MCR_COMPMASK_QKEY                            (CL_HTON64(1<<2))\r
2259 #define IB_MCR_COMPMASK_MLID                            (CL_HTON64(1<<3))\r
2260 #define IB_MCR_COMPMASK_MTU_SEL                         (CL_HTON64(1<<4))\r
2261 #define IB_MCR_COMPMASK_MTU                                     (CL_HTON64(1<<5))\r
2262 #define IB_MCR_COMPMASK_TCLASS                          (CL_HTON64(1<<6))\r
2263 #define IB_MCR_COMPMASK_PKEY                            (CL_HTON64(1<<7))\r
2264 #define IB_MCR_COMPMASK_RATE_SEL                        (CL_HTON64(1<<8))\r
2265 #define IB_MCR_COMPMASK_RATE                            (CL_HTON64(1<<9))\r
2266 #define IB_MCR_COMPMASK_LIFE_SEL                        (CL_HTON64(1<<10))\r
2267 #define IB_MCR_COMPMASK_LIFE                            (CL_HTON64(1<<11))\r
2268 #define IB_MCR_COMPMASK_SL                                      (CL_HTON64(1<<12))\r
2269 #define IB_MCR_COMPMASK_FLOW                            (CL_HTON64(1<<13))\r
2270 #define IB_MCR_COMPMASK_HOP                                     (CL_HTON64(1<<14))\r
2271 #define IB_MCR_COMPMASK_SCOPE                           (CL_HTON64(1<<15))\r
2272 #define IB_MCR_COMPMASK_JOIN_STATE                      (CL_HTON64(1<<16))\r
2273 #define IB_MCR_COMPMASK_PROXY                           (CL_HTON64(1<<17))\r
2274 \r
2275 /****f* IBA Base: Types/ib_path_rec_init_local\r
2276 * NAME\r
2277 *       ib_path_rec_init_local\r
2278 *\r
2279 * DESCRIPTION\r
2280 *       Initializes a subnet local path record.\r
2281 *\r
2282 * SYNOPSIS\r
2283 */\r
2284 AL_INLINE void AL_API\r
2285 ib_path_rec_init_local(\r
2286         IN                              ib_path_rec_t*  const           p_rec,\r
2287         IN              const   ib_gid_t*               const           p_dgid,\r
2288         IN              const   ib_gid_t*               const           p_sgid,\r
2289         IN              const   ib_net16_t                                      dlid,\r
2290         IN              const   ib_net16_t                                      slid,\r
2291         IN              const   uint8_t                                         num_path,\r
2292         IN              const   ib_net16_t                                      pkey,\r
2293         IN              const   uint8_t                                         sl,\r
2294         IN              const   uint8_t                                         mtu_selector,\r
2295         IN              const   uint8_t                                         mtu,\r
2296         IN              const   uint8_t                                         rate_selector,\r
2297         IN              const   uint8_t                                         rate,\r
2298         IN              const   uint8_t                                         pkt_life_selector,\r
2299         IN              const   uint8_t                                         pkt_life,\r
2300         IN              const   uint8_t                                         preference )\r
2301 {\r
2302         p_rec->dgid = *p_dgid;\r
2303         p_rec->sgid = *p_sgid;\r
2304         p_rec->dlid = dlid;\r
2305         p_rec->slid = slid;\r
2306         p_rec->num_path = num_path;\r
2307         p_rec->pkey = pkey;\r
2308         /* Lower 4 bits of path rec's SL are reserved. */\r
2309         p_rec->sl = cl_ntoh16( sl );\r
2310         p_rec->mtu = (uint8_t)((mtu & IB_PATH_REC_BASE_MASK) |\r
2311                         (uint8_t)(mtu_selector << 6));\r
2312         p_rec->rate = (uint8_t)((rate & IB_PATH_REC_BASE_MASK) |\r
2313                         (uint8_t)(rate_selector << 6));\r
2314         p_rec->pkt_life = (uint8_t)((pkt_life & IB_PATH_REC_BASE_MASK) |\r
2315                         (uint8_t)(pkt_life_selector << 6));\r
2316         p_rec->preference = preference;\r
2317 \r
2318         /* Clear global routing fields for local path records */\r
2319         p_rec->hop_flow_raw.val = 0;\r
2320         p_rec->tclass = 0;\r
2321 \r
2322         p_rec->resv0 = 0;\r
2323         p_rec->resv1 = 0;\r
2324         p_rec->resv2 = 0;\r
2325 }\r
2326 /*\r
2327 * PARAMETERS\r
2328 *       p_rec\r
2329 *               [in] Pointer to the path record object.\r
2330 *\r
2331 *       dgid\r
2332 *               [in] GID of destination port.\r
2333 *\r
2334 *       sgid\r
2335 *               [in] GID of source port.\r
2336 *\r
2337 *       dlid\r
2338 *               [in] LID of destination port.\r
2339 *\r
2340 *       slid\r
2341 *               [in] LID of source port.\r
2342 *\r
2343 *       num_path\r
2344 *               [in] In queries, maximum number of paths to return.\r
2345 *               In responses, undefined.\r
2346 *\r
2347 *       pkey\r
2348 *               [in] Partition key (P_Key) to use on this path.\r
2349 *\r
2350 *       sl\r
2351 *               [in] Service level to use on this path.  Lower 4-bits are valid.\r
2352 *\r
2353 *       mtu_selector\r
2354 *               [in] Encoded MTU selector value to use on this path\r
2355 *\r
2356 *       mtu\r
2357 *               [in] Encoded MTU to use on this path\r
2358 *\r
2359 *       rate_selector\r
2360 *               [in] Encoded rate selector value to use on this path.\r
2361 *\r
2362 *       rate\r
2363 *               [in] Encoded rate to use on this path.\r
2364 *\r
2365 *       pkt_life_selector\r
2366 *               [in] Encoded Packet selector value lifetime for this path.\r
2367 *\r
2368 *       pkt_life\r
2369 *               [in] Encoded Packet lifetime for this path.\r
2370 *\r
2371 *       preference\r
2372 *               [in] Indicates the relative merit of this path versus other path\r
2373 *               records returned from the SA.  Lower numbers are better.\r
2374 *\r
2375 * RETURN VALUES\r
2376 *       None.\r
2377 *\r
2378 * NOTES\r
2379 *\r
2380 * SEE ALSO\r
2381 *       ib_gid_t\r
2382 *********/\r
2383 \r
2384 /****f* IBA Base: Types/ib_path_rec_sl\r
2385 * NAME\r
2386 *       ib_path_rec_sl\r
2387 *\r
2388 * DESCRIPTION\r
2389 *       Get path service level.\r
2390 *\r
2391 * SYNOPSIS\r
2392 */\r
2393 AL_INLINE uint8_t AL_API\r
2394 ib_path_rec_sl(\r
2395         IN              const   ib_path_rec_t* const            p_rec )\r
2396 {\r
2397         return( (uint8_t)((cl_ntoh16( p_rec->sl )) & 0xF) );\r
2398 }\r
2399 /*\r
2400 * PARAMETERS\r
2401 *       p_rec\r
2402 *               [in] Pointer to the path record object.\r
2403 *\r
2404 * RETURN VALUES\r
2405 *       Encoded path MTU.\r
2406 *               1: 256\r
2407 *               2: 512\r
2408 *               3: 1024\r
2409 *               4: 2048\r
2410 *               5: 4096\r
2411 *               others: reserved\r
2412 *\r
2413 * NOTES\r
2414 *\r
2415 * SEE ALSO\r
2416 *       ib_path_rec_t\r
2417 *********/\r
2418 \r
2419 /****f* IBA Base: Types/ib_path_rec_mtu\r
2420 * NAME\r
2421 *       ib_path_rec_mtu\r
2422 *\r
2423 * DESCRIPTION\r
2424 *       Get encoded path MTU.\r
2425 *\r
2426 * SYNOPSIS\r
2427 */\r
2428 AL_INLINE uint8_t AL_API\r
2429 ib_path_rec_mtu(\r
2430         IN              const   ib_path_rec_t* const            p_rec )\r
2431 {\r
2432         return( (uint8_t)(p_rec->mtu & IB_PATH_REC_BASE_MASK) );\r
2433 }\r
2434 /*\r
2435 * PARAMETERS\r
2436 *       p_rec\r
2437 *               [in] Pointer to the path record object.\r
2438 *\r
2439 * RETURN VALUES\r
2440 *       Encoded path MTU.\r
2441 *               1: 256\r
2442 *               2: 512\r
2443 *               3: 1024\r
2444 *               4: 2048\r
2445 *               5: 4096\r
2446 *               others: reserved\r
2447 *\r
2448 * NOTES\r
2449 *\r
2450 * SEE ALSO\r
2451 *       ib_path_rec_t\r
2452 *********/\r
2453 \r
2454 /****f* IBA Base: Types/ib_path_rec_mtu_sel\r
2455 * NAME\r
2456 *       ib_path_rec_mtu_sel\r
2457 *\r
2458 * DESCRIPTION\r
2459 *       Get encoded path MTU selector.\r
2460 *\r
2461 * SYNOPSIS\r
2462 */\r
2463 AL_INLINE uint8_t AL_API\r
2464 ib_path_rec_mtu_sel(\r
2465         IN              const   ib_path_rec_t* const            p_rec )\r
2466 {\r
2467         return( (uint8_t)((p_rec->mtu & IB_PATH_REC_SELECTOR_MASK) >> 6) );\r
2468 }\r
2469 /*\r
2470 * PARAMETERS\r
2471 *       p_rec\r
2472 *               [in] Pointer to the path record object.\r
2473 *\r
2474 * RETURN VALUES\r
2475 *       Encoded path MTU selector value (for queries).\r
2476 *               0: greater than MTU specified\r
2477 *               1: less than MTU specified\r
2478 *               2: exactly the MTU specified\r
2479 *               3: largest MTU available\r
2480 *\r
2481 * NOTES\r
2482 *\r
2483 * SEE ALSO\r
2484 *       ib_path_rec_t\r
2485 *********/\r
2486 \r
2487 /****f* IBA Base: Types/ib_path_rec_rate\r
2488 * NAME\r
2489 *       ib_path_rec_rate\r
2490 *\r
2491 * DESCRIPTION\r
2492 *       Get encoded path rate.\r
2493 *\r
2494 * SYNOPSIS\r
2495 */\r
2496 AL_INLINE uint8_t AL_API\r
2497 ib_path_rec_rate(\r
2498         IN              const   ib_path_rec_t* const            p_rec )\r
2499 {\r
2500         return( (uint8_t)(p_rec->rate & IB_PATH_REC_BASE_MASK) );\r
2501 }\r
2502 /*\r
2503 * PARAMETERS\r
2504 *       p_rec\r
2505 *               [in] Pointer to the path record object.\r
2506 *\r
2507 * RETURN VALUES\r
2508 *       Encoded path rate.\r
2509 *               2: 2.5 Gb/sec.\r
2510 *               3: 10 Gb/sec.\r
2511 *               4: 30 Gb/sec.\r
2512 *               others: reserved\r
2513 *\r
2514 * NOTES\r
2515 *\r
2516 * SEE ALSO\r
2517 *       ib_path_rec_t\r
2518 *********/\r
2519 \r
2520 /****f* IBA Base: Types/ib_path_rec_rate_sel\r
2521 * NAME\r
2522 *       ib_path_rec_rate_sel\r
2523 *\r
2524 * DESCRIPTION\r
2525 *       Get encoded path rate selector.\r
2526 *\r
2527 * SYNOPSIS\r
2528 */\r
2529 AL_INLINE uint8_t AL_API\r
2530 ib_path_rec_rate_sel(\r
2531         IN              const   ib_path_rec_t* const            p_rec )\r
2532 {\r
2533         return( (uint8_t)((p_rec->rate & IB_PATH_REC_SELECTOR_MASK) >> 6) );\r
2534 }\r
2535 /*\r
2536 * PARAMETERS\r
2537 *       p_rec\r
2538 *               [in] Pointer to the path record object.\r
2539 *\r
2540 * RETURN VALUES\r
2541 *       Encoded path rate selector value (for queries).\r
2542 *               0: greater than rate specified\r
2543 *               1: less than rate specified\r
2544 *               2: exactly the rate specified\r
2545 *               3: largest rate available\r
2546 *\r
2547 * NOTES\r
2548 *\r
2549 * SEE ALSO\r
2550 *       ib_path_rec_t\r
2551 *********/\r
2552 \r
2553 /****f* IBA Base: Types/ib_path_rec_pkt_life\r
2554 * NAME\r
2555 *       ib_path_rec_pkt_life\r
2556 *\r
2557 * DESCRIPTION\r
2558 *       Get encoded path pkt_life.\r
2559 *\r
2560 * SYNOPSIS\r
2561 */\r
2562 AL_INLINE uint8_t AL_API\r
2563 ib_path_rec_pkt_life(\r
2564         IN              const   ib_path_rec_t* const            p_rec )\r
2565 {\r
2566         return( (uint8_t)(p_rec->pkt_life & IB_PATH_REC_BASE_MASK) );\r
2567 }\r
2568 /*\r
2569 * PARAMETERS\r
2570 *       p_rec\r
2571 *               [in] Pointer to the path record object.\r
2572 *\r
2573 * RETURN VALUES\r
2574 *       Encoded path pkt_life = 4.096 ┬Ásec * 2 PacketLifeTime.\r
2575 *\r
2576 * NOTES\r
2577 *\r
2578 * SEE ALSO\r
2579 *       ib_path_rec_t\r
2580 *********/\r
2581 \r
2582 /****f* IBA Base: Types/ib_path_rec_pkt_life_sel\r
2583 * NAME\r
2584 *       ib_path_rec_pkt_life_sel\r
2585 *\r
2586 * DESCRIPTION\r
2587 *       Get encoded path pkt_lifetime selector.\r
2588 *\r
2589 * SYNOPSIS\r
2590 */\r
2591 AL_INLINE uint8_t AL_API\r
2592 ib_path_rec_pkt_life_sel(\r
2593         IN              const   ib_path_rec_t* const            p_rec )\r
2594 {\r
2595         return( (uint8_t)((p_rec->pkt_life & IB_PATH_REC_SELECTOR_MASK) >> 6 ));\r
2596 }\r
2597 /*\r
2598 * PARAMETERS\r
2599 *       p_rec\r
2600 *               [in] Pointer to the path record object.\r
2601 *\r
2602 * RETURN VALUES\r
2603 *       Encoded path pkt_lifetime selector value (for queries).\r
2604 *               0: greater than rate specified\r
2605 *               1: less than rate specified\r
2606 *               2: exactly the rate specified\r
2607 *               3: smallest packet lifetime available\r
2608 *\r
2609 * NOTES\r
2610 *\r
2611 * SEE ALSO\r
2612 *       ib_path_rec_t\r
2613 *********/\r
2614 \r
2615 /****f* IBA Base: Types/ib_path_rec_flow_lbl\r
2616 * NAME\r
2617 *       ib_path_rec_flow_lbl\r
2618 *\r
2619 * DESCRIPTION\r
2620 *       Get flow label.\r
2621 *\r
2622 * SYNOPSIS\r
2623 */\r
2624 AL_INLINE net32_t AL_API\r
2625 ib_path_rec_flow_lbl(\r
2626         IN              const   ib_path_rec_t* const            p_rec )\r
2627 {\r
2628         return( cl_hton32( (cl_ntoh32(p_rec->hop_flow_raw.val) >> 8) & 0x000FFFFF ) );\r
2629 }\r
2630 /*\r
2631 * PARAMETERS\r
2632 *       p_rec\r
2633 *               [in] Pointer to the path record object.\r
2634 *\r
2635 * RETURN VALUES\r
2636 *       Flow label of the path record.\r
2637 *\r
2638 * NOTES\r
2639 *\r
2640 * SEE ALSO\r
2641 *       ib_path_rec_t\r
2642 *********/\r
2643 \r
2644 /****f* IBA Base: Types/ib_path_rec_hop_limit\r
2645 * NAME\r
2646 *       ib_path_rec_hop_limit\r
2647 *\r
2648 * DESCRIPTION\r
2649 *       Get hop limit.\r
2650 *\r
2651 * SYNOPSIS\r
2652 */\r
2653 AL_INLINE uint8_t AL_API\r
2654 ib_path_rec_hop_limit(\r
2655         IN              const   ib_path_rec_t* const            p_rec )\r
2656 {\r
2657         return( p_rec->hop_flow_raw.bytes[3] );\r
2658 }\r
2659 /*\r
2660 * PARAMETERS\r
2661 *       p_rec\r
2662 *               [in] Pointer to the path record object.\r
2663 *\r
2664 * RETURN VALUES\r
2665 *       Hop limit of the path record.\r
2666 *\r
2667 * NOTES\r
2668 *\r
2669 * SEE ALSO\r
2670 *       ib_path_rec_t\r
2671 *********/\r
2672 \r
2673 /****f* IBA Base: Types/ib_path_rec_set_hop_flow_raw\r
2674 * NAME\r
2675 *       ib_path_rec_set_hop_flow_raw\r
2676 *\r
2677 * DESCRIPTION\r
2678 *       Sets the hop limit, flow label, and raw traffic bits of a path record.\r
2679 *\r
2680 * SYNOPSIS\r
2681 */\r
2682 AL_INLINE void AL_API\r
2683 ib_path_rec_set_hop_flow_raw(\r
2684                 OUT                     ib_path_rec_t* const            p_rec,\r
2685         IN              const   uint8_t                                         hop_limit,\r
2686         IN              const   net32_t                                         flow_lbl,\r
2687         IN              const   boolean_t                                       raw )\r
2688 {\r
2689         p_rec->hop_flow_raw.val = (cl_ntoh32( flow_lbl ) & 0x000FFFFF) << 8;\r
2690         if( raw )\r
2691                 p_rec->hop_flow_raw.val |= 0x80000000;\r
2692         p_rec->hop_flow_raw.val = cl_hton32( p_rec->hop_flow_raw.val );\r
2693         p_rec->hop_flow_raw.bytes[3] = hop_limit;\r
2694 }\r
2695 /*\r
2696 * PARAMETERS\r
2697 *       p_rec\r
2698 *               Pointer to the path record whose hop limit, flow label, and rab\r
2699 *               traffic fields to set.\r
2700 *\r
2701 *       hop_limit\r
2702 *               Hop limit to set in the path record.\r
2703 *\r
2704 *       flow_lbl\r
2705 *               Flow label, in network byte order, to set in the path record.\r
2706 *\r
2707 *       raw\r
2708 *               Boolean flag to indicate whether the path record is for raw traffic.\r
2709 *\r
2710 * SEE ALSO\r
2711 *       ib_path_rec_t\r
2712 *********/\r
2713 \r
2714 \r
2715 /****s* IBA Base: Constants/IB_CLASS_CAP_TRAP\r
2716 * NAME\r
2717 *       IB_CLASS_CAP_TRAP\r
2718 *\r
2719 * DESCRIPTION\r
2720 *       ClassPortInfo CapabilityMask bits.  This bit will be set\r
2721 *       if the class supports Trap() MADs (13.4.8.1).\r
2722 *\r
2723 * SEE ALSO\r
2724 *       ib_class_port_info_t, IB_CLASS_CAP_GETSET\r
2725 *\r
2726 * SOURCE\r
2727 */\r
2728 #define IB_CLASS_CAP_TRAP                                       0x0001\r
2729 /*********/\r
2730 /****s* IBA Base: Constants/IB_CLASS_CAP_GETSET\r
2731 * NAME\r
2732 *       IB_CLASS_CAP_GETSET\r
2733 *\r
2734 * DESCRIPTION\r
2735 *       ClassPortInfo CapabilityMask bits.  This bit will be set\r
2736 *       if the class supports Get(Notice) and Set(Notice) MADs (13.4.8.1).\r
2737 *\r
2738 * SEE ALSO\r
2739 *       ib_class_port_info_t, IB_CLASS_CAP_TRAP\r
2740 *\r
2741 * SOURCE\r
2742 */\r
2743 #define IB_CLASS_CAP_GETSET                                     0x0002\r
2744 /*********/\r
2745 /****s* IBA Base: Constants/IB_CLASS_RESP_TIME_MASK\r
2746 * NAME\r
2747 *       IB_CLASS_RESP_TIME_MASK\r
2748 *\r
2749 * DESCRIPTION\r
2750 *       Mask bits to extract the reponse time value from the\r
2751 *       resp_time_val field of ib_class_port_info_t.\r
2752 *\r
2753 * SEE ALSO\r
2754 *       ib_class_port_info_t\r
2755 *\r
2756 * SOURCE\r
2757 */\r
2758 #define IB_CLASS_RESP_TIME_MASK                         0x1F\r
2759 /*********/\r
2760 /****s* IBA Base: Types/ib_class_port_info_t\r
2761 * NAME\r
2762 *       ib_class_port_info_t\r
2763 *\r
2764 * DESCRIPTION\r
2765 *       IBA defined ClassPortInfo attribute (13.4.8.1)\r
2766 *       route between two end-points on a subnet.\r
2767 *\r
2768 * SYNOPSIS\r
2769 */\r
2770 #include <complib/cl_packon.h>\r
2771 typedef struct _ib_class_port_info\r
2772 {\r
2773         uint8_t                                 base_ver;\r
2774         uint8_t                                 class_ver;\r
2775         ib_net16_t                              cap_mask;\r
2776         ib_net32_t                              resp_time_val;\r
2777         ib_gid_t                                redir_gid;\r
2778         ib_net32_t                              redir_tc_sl_fl;\r
2779         ib_net16_t                              redir_lid;\r
2780         ib_net16_t                              redir_pkey;\r
2781         ib_net32_t                              redir_qp;\r
2782         ib_net32_t                              redir_qkey;\r
2783         ib_gid_t                                trap_gid;\r
2784         ib_net32_t                              trap_tc_sl_fl;\r
2785         ib_net16_t                              trap_lid;\r
2786         ib_net16_t                              trap_pkey;\r
2787         ib_net32_t                              trap_hop_qp;\r
2788         ib_net32_t                              trap_qkey;\r
2789 \r
2790 }       PACK_SUFFIX ib_class_port_info_t;\r
2791 #include <complib/cl_packoff.h>\r
2792 /*\r
2793 * FIELDS\r
2794 *       base_ver\r
2795 *               Maximum supported MAD Base Version.\r
2796 *\r
2797 *       class_ver\r
2798 *               Maximum supported management class version.\r
2799 *\r
2800 *       cap_mask\r
2801 *               Supported capabilities of this management class.\r
2802 *\r
2803 *       resp_time_value\r
2804 *               Maximum expected response time.\r
2805 *\r
2806 *       redr_gid\r
2807 *               GID to use for redirection, or zero\r
2808 *\r
2809 *       recdir_tc_sl_fl\r
2810 *               Traffic class, service level and flow label the requester\r
2811 *               should use if the service is redirected.\r
2812 *\r
2813 *       redir_lid\r
2814 *               LID used for redirection, or zero\r
2815 *\r
2816 *       redir_pkey\r
2817 *               P_Key used for redirection\r
2818 *\r
2819 *       redir_qp\r
2820 *               QP number used for redirection\r
2821 *\r
2822 *       redir_qkey\r
2823 *               Q_Key associated with the redirected QP.  This shall be the\r
2824 *               well known Q_Key value.\r
2825 *\r
2826 *       trap_gid\r
2827 *               GID value used for trap messages from this service.\r
2828 *\r
2829 *       trap_tc_sl_fl\r
2830 *               Traffic class, service level and flow label used for\r
2831 *               trap messages originated by this service.\r
2832 *\r
2833 *       trap_lid\r
2834 *               LID used for trap messages, or zero\r
2835 *\r
2836 *       trap_pkey\r
2837 *               P_Key used for trap messages\r
2838 *\r
2839 *       trap_hop_qp\r
2840 *               Hop limit (upper 8 bits) and QP number used for trap messages\r
2841 *\r
2842 *       trap_qkey\r
2843 *               Q_Key associated with the trap messages QP.\r
2844 *\r
2845 * SEE ALSO\r
2846 *       IB_CLASS_CAP_GETSET, IB_CLASS_CAP_TRAP\r
2847 *\r
2848 *********/\r
2849 /****s* IBA Base: Types/ib_sm_info_t\r
2850 * NAME\r
2851 *       ib_sm_info_t\r
2852 *\r
2853 * DESCRIPTION\r
2854 *       SMInfo structure (14.2.5.13).\r
2855 *\r
2856 * SYNOPSIS\r
2857 */\r
2858 #include <complib/cl_packon.h>\r
2859 typedef struct _ib_sm_info\r
2860 {\r
2861         ib_net64_t                      guid;\r
2862         ib_net64_t                      sm_key;\r
2863         ib_net32_t                      act_count;\r
2864         uint8_t                         pri_state;\r
2865 \r
2866 }       PACK_SUFFIX ib_sm_info_t;\r
2867 #include <complib/cl_packoff.h>\r
2868 /*\r
2869 * FIELDS\r
2870 *       guid\r
2871 *               Port GUID for this SM.\r
2872 *\r
2873 *       sm_key\r
2874 *               SM_Key of this SM.\r
2875 *\r
2876 *       act_count\r
2877 *               Activity counter used as a heartbeat.\r
2878 *\r
2879 *       pri_state\r
2880 *               Priority and State information\r
2881 *\r
2882 * SEE ALSO\r
2883 *********/\r
2884 \r
2885 /****f* IBA Base: Types/ib_sminfo_get_priority\r
2886 * NAME\r
2887 *       ib_sminfo_get_priority\r
2888 *\r
2889 * DESCRIPTION\r
2890 *       Returns the priority value.\r
2891 *\r
2892 * SYNOPSIS\r
2893 */\r
2894 AL_INLINE uint8_t AL_API\r
2895 ib_sminfo_get_priority(\r
2896         IN              const   ib_sm_info_t* const                     p_smi )\r
2897 {\r
2898         return( (uint8_t)((p_smi->pri_state & 0xF0)>>4) );\r
2899 }\r
2900 /*\r
2901 * PARAMETERS\r
2902 *       p_smi\r
2903 *               [in] Pointer to the SMInfo Attribute.\r
2904 *\r
2905 * RETURN VALUES\r
2906 *       Returns the priority value.\r
2907 *\r
2908 * NOTES\r
2909 *\r
2910 * SEE ALSO\r
2911 *********/\r
2912 \r
2913 /****f* IBA Base: Types/ib_sminfo_get_state\r
2914 * NAME\r
2915 *       ib_sminfo_get_state\r
2916 *\r
2917 * DESCRIPTION\r
2918 *       Returns the state value.\r
2919 *\r
2920 * SYNOPSIS\r
2921 */\r
2922 AL_INLINE uint8_t AL_API\r
2923 ib_sminfo_get_state(\r
2924         IN              const   ib_sm_info_t* const                     p_smi )\r
2925 {\r
2926         return( (uint8_t)(p_smi->pri_state & 0x0F) );\r
2927 }\r
2928 /*\r
2929 * PARAMETERS\r
2930 *       p_smi\r
2931 *               [in] Pointer to the SMInfo Attribute.\r
2932 *\r
2933 * RETURN VALUES\r
2934 *       Returns the state value.\r
2935 *\r
2936 * NOTES\r
2937 *\r
2938 * SEE ALSO\r
2939 *********/\r
2940 \r
2941 /****s* IBA Base: Types/ib_mad_t\r
2942 * NAME\r
2943 *       ib_mad_t\r
2944 *\r
2945 * DESCRIPTION\r
2946 *       IBA defined MAD header (13.4.3)\r
2947 *\r
2948 * SYNOPSIS\r
2949 */\r
2950 #include <complib/cl_packon.h>\r
2951 typedef struct _ib_mad\r
2952 {\r
2953         uint8_t                                 base_ver;\r
2954         uint8_t                                 mgmt_class;\r
2955         uint8_t                                 class_ver;\r
2956         uint8_t                                 method;\r
2957         ib_net16_t                              status;\r
2958         ib_net16_t                              class_spec;\r
2959         ib_net64_t                              trans_id;\r
2960         ib_net16_t                              attr_id;\r
2961         ib_net16_t                              resv;\r
2962         ib_net32_t                              attr_mod;\r
2963 \r
2964 }       PACK_SUFFIX ib_mad_t;\r
2965 #include <complib/cl_packoff.h>\r
2966 /*\r
2967 * FIELDS\r
2968 *       base_ver\r
2969 *               MAD base format.\r
2970 *\r
2971 *       mgmt_class\r
2972 *               Class of operation.\r
2973 *\r
2974 *       class_ver\r
2975 *               Version of MAD class-specific format.\r
2976 *\r
2977 *       method\r
2978 *               Method to perform, including 'R' bit.\r
2979 *\r
2980 *       status\r
2981 *               Status of operation.\r
2982 *\r
2983 *       class_spec\r
2984 *               Reserved for subnet management.\r
2985 *\r
2986 *       trans_id\r
2987 *               Transaction ID.\r
2988 *\r
2989 *       attr_id\r
2990 *               Attribute ID.\r
2991 *\r
2992 *       resv\r
2993 *               Reserved field.\r
2994 *\r
2995 *       attr_mod\r
2996 *               Attribute modifier.\r
2997 *\r
2998 * SEE ALSO\r
2999 *********/\r
3000 \r
3001 \r
3002 /****s* IBA Base: Types/ib_rmpp_mad_t\r
3003 * NAME\r
3004 *       ib_rmpp_mad_t\r
3005 *\r
3006 * DESCRIPTION\r
3007 *       IBA defined MAD RMPP header (13.6.2.1)\r
3008 *\r
3009 * SYNOPSIS\r
3010 */\r
3011 #include <complib/cl_packon.h>\r
3012 typedef struct _ib_rmpp_mad\r
3013 {\r
3014         ib_mad_t                                common_hdr;\r
3015 \r
3016         uint8_t                                 rmpp_version;\r
3017         uint8_t                                 rmpp_type;\r
3018         uint8_t                                 rmpp_flags;\r
3019         uint8_t                                 rmpp_status;\r
3020 \r
3021         ib_net32_t                              seg_num;\r
3022         ib_net32_t                              paylen_newwin;\r
3023 \r
3024 }       PACK_SUFFIX ib_rmpp_mad_t;\r
3025 #include <complib/cl_packoff.h>\r
3026 /*\r
3027 * SEE ALSO\r
3028 *       ib_mad_t\r
3029 *********/\r
3030 \r
3031 \r
3032 /****f* IBA Base: Types/ib_mad_init_new\r
3033 * NAME\r
3034 *       ib_mad_init_new\r
3035 *\r
3036 * DESCRIPTION\r
3037 *       Initializes a MAD common header.\r
3038 *\r
3039 * SYNOPSIS\r
3040 */\r
3041 AL_INLINE void AL_API\r
3042 ib_mad_init_new(\r
3043         IN                              ib_mad_t* const                         p_mad,\r
3044         IN              const   uint8_t                                         mgmt_class,\r
3045         IN              const   uint8_t                                         class_ver,\r
3046         IN              const   uint8_t                                         method,\r
3047         IN              const   ib_net64_t                                      trans_id,\r
3048         IN              const   ib_net16_t                                      attr_id,\r
3049         IN              const   ib_net32_t                                      attr_mod )\r
3050 {\r
3051         CL_ASSERT( p_mad );\r
3052         p_mad->base_ver = 1;\r
3053         p_mad->mgmt_class = mgmt_class;\r
3054         p_mad->class_ver = class_ver;\r
3055         p_mad->method = method;\r
3056         p_mad->status = 0;\r
3057         p_mad->class_spec = 0;\r
3058         p_mad->trans_id = trans_id;\r
3059         p_mad->attr_id = attr_id;\r
3060         p_mad->resv = 0;\r
3061         p_mad->attr_mod = attr_mod;\r
3062 }\r
3063 /*\r
3064 * PARAMETERS\r
3065 *       p_mad\r
3066 *               [in] Pointer to the MAD common header.\r
3067 *\r
3068 *       mgmt_class\r
3069 *               [in] Class of operation.\r
3070 *\r
3071 *       class_ver\r
3072 *               [in] Version of MAD class-specific format.\r
3073 *\r
3074 *       method\r
3075 *               [in] Method to perform, including 'R' bit.\r
3076 *\r
3077 *       trans_Id\r
3078 *               [in] Transaction ID.\r
3079 *\r
3080 *       attr_id\r
3081 *               [in] Attribute ID.\r
3082 *\r
3083 *       attr_mod\r
3084 *               [in] Attribute modifier.\r
3085 *\r
3086 * RETURN VALUES\r
3087 *       None.\r
3088 *\r
3089 * NOTES\r
3090 *\r
3091 * SEE ALSO\r
3092 *       ib_mad_t\r
3093 *********/\r
3094 \r
3095 /****f* IBA Base: Types/ib_mad_init_response\r
3096 * NAME\r
3097 *       ib_mad_init_response\r
3098 *\r
3099 * DESCRIPTION\r
3100 *       Initializes a MAD common header as a response.\r
3101 *\r
3102 * SYNOPSIS\r
3103 */\r
3104 AL_INLINE void AL_API\r
3105 ib_mad_init_response(\r
3106         IN              const   ib_mad_t* const                         p_req_mad,\r
3107         IN                              ib_mad_t* const                         p_mad,\r
3108         IN              const   ib_net16_t                                      status )\r
3109 {\r
3110         CL_ASSERT( p_req_mad );\r
3111         CL_ASSERT( p_mad );\r
3112         *p_mad = *p_req_mad;\r
3113         p_mad->status = status;\r
3114         if( p_mad->method == IB_MAD_METHOD_SET )\r
3115                 p_mad->method = IB_MAD_METHOD_GET;\r
3116         p_mad->method |= IB_MAD_METHOD_RESP_MASK;\r
3117 }\r
3118 /*\r
3119 * PARAMETERS\r
3120 *       p_req_mad\r
3121 *               [in] Pointer to the MAD common header in the original request MAD.\r
3122 *\r
3123 *       p_mad\r
3124 *               [in] Pointer to the MAD common header to initialize.\r
3125 *\r
3126 *       status\r
3127 *               [in] MAD Status value to return;\r
3128 *\r
3129 * RETURN VALUES\r
3130 *       None.\r
3131 *\r
3132 * NOTES\r
3133 *       p_req_mad and p_mad may point to the same MAD.\r
3134 *\r
3135 * SEE ALSO\r
3136 *       ib_mad_t\r
3137 *********/\r
3138 \r
3139 /****f* IBA Base: Types/ib_mad_is_response\r
3140 * NAME\r
3141 *       ib_mad_is_response\r
3142 *\r
3143 * DESCRIPTION\r
3144 *       Returns TRUE if the MAD is a response ('R' bit set),\r
3145 *       FALSE otherwise.\r
3146 *\r
3147 * SYNOPSIS\r
3148 */\r
3149 AL_INLINE boolean_t AL_API\r
3150 ib_mad_is_response(\r
3151         IN              const   ib_mad_t* const                         p_mad )\r
3152 {\r
3153         CL_ASSERT( p_mad );\r
3154         return( (p_mad->method & IB_MAD_METHOD_RESP_MASK) ==\r
3155                         IB_MAD_METHOD_RESP_MASK );\r
3156 }\r
3157 /*\r
3158 * PARAMETERS\r
3159 *       p_mad\r
3160 *               [in] Pointer to the MAD.\r
3161 *\r
3162 * RETURN VALUES\r
3163 *       Returns TRUE if the MAD is a response ('R' bit set),\r
3164 *       FALSE otherwise.\r
3165 *\r
3166 * NOTES\r
3167 *\r
3168 * SEE ALSO\r
3169 *       ib_mad_t\r
3170 *********/\r
3171 \r
3172 \r
3173 #define IB_RMPP_TYPE_DATA                       1\r
3174 #define IB_RMPP_TYPE_ACK                        2\r
3175 #define IB_RMPP_TYPE_STOP                       3\r
3176 #define IB_RMPP_TYPE_ABORT                      4\r
3177 \r
3178 #define IB_RMPP_NO_RESP_TIME            0x1F\r
3179 #define IB_RMPP_FLAG_ACTIVE                     0x01\r
3180 #define IB_RMPP_FLAG_FIRST                      0x02\r
3181 #define IB_RMPP_FLAG_LAST                       0x04\r
3182 \r
3183 #define IB_RMPP_STATUS_SUCCESS          0\r
3184 #define IB_RMPP_STATUS_RESX                     1               /* resources exhausted */\r
3185 #define IB_RMPP_STATUS_T2L                      118             /* time too long */\r
3186 #define IB_RMPP_STATUS_BAD_LEN          119             /* incon. last and payload len */\r
3187 #define IB_RMPP_STATUS_BAD_SEG          120             /* incon. first and segment no */\r
3188 #define IB_RMPP_STATUS_BADT                     121             /* bad rmpp type */\r
3189 #define IB_RMPP_STATUS_W2S                      122             /* newwindowlast too small */\r
3190 #define IB_RMPP_STATUS_S2B                      123             /* segment no too big */\r
3191 #define IB_RMPP_STATUS_BAD_STATUS       124             /* illegal status */\r
3192 #define IB_RMPP_STATUS_UNV                      125             /* unsupported version */\r
3193 #define IB_RMPP_STATUS_TMR                      126             /* too many retries */\r
3194 #define IB_RMPP_STATUS_UNSPEC           127             /* unspecified */\r
3195 \r
3196 \r
3197 /****f* IBA Base: Types/ib_rmpp_is_flag_set\r
3198 * NAME\r
3199 *       ib_rmpp_is_flag_set\r
3200 *\r
3201 * DESCRIPTION\r
3202 *       Returns TRUE if the MAD has the given RMPP flag set.\r
3203 *\r
3204 * SYNOPSIS\r
3205 */\r
3206 AL_INLINE boolean_t AL_API\r
3207 ib_rmpp_is_flag_set(\r
3208         IN              const   ib_rmpp_mad_t* const            p_rmpp_mad,\r
3209         IN              const   uint8_t                                         flag )\r
3210 {\r
3211         CL_ASSERT( p_rmpp_mad );\r
3212         return( (p_rmpp_mad->rmpp_flags & flag) == flag );\r
3213 }\r
3214 /*\r
3215 * PARAMETERS\r
3216 *       ib_rmpp_mad_t\r
3217 *               [in] Pointer to a MAD with an RMPP header.\r
3218 *\r
3219 *       flag\r
3220 *               [in] The RMPP flag being examined.\r
3221 *\r
3222 * RETURN VALUES\r
3223 *       Returns TRUE if the MAD has the given RMPP flag set.\r
3224 *\r
3225 * NOTES\r
3226 *\r
3227 * SEE ALSO\r
3228 *       ib_mad_t, ib_rmpp_mad_t\r
3229 *********/\r
3230 \r
3231 AL_INLINE void AL_API\r
3232 ib_rmpp_set_resp_time(\r
3233         IN                              ib_rmpp_mad_t* const            p_rmpp_mad,\r
3234         IN              const   uint8_t                                         resp_time )\r
3235 {\r
3236         CL_ASSERT( p_rmpp_mad );\r
3237         p_rmpp_mad->rmpp_flags |= (resp_time << 3);\r
3238 }\r
3239 \r
3240 \r
3241 AL_INLINE uint8_t AL_API\r
3242 ib_rmpp_get_resp_time(\r
3243         IN              const   ib_rmpp_mad_t* const            p_rmpp_mad )\r
3244 {\r
3245         CL_ASSERT( p_rmpp_mad );\r
3246         return( (uint8_t)(p_rmpp_mad->rmpp_flags >> 3) );\r
3247 }\r
3248 \r
3249 \r
3250 /****d* IBA Base: Constants/IB_SMP_DIRECTION\r
3251 * NAME\r
3252 *       IB_SMP_DIRECTION\r
3253 *\r
3254 * DESCRIPTION\r
3255 *       The Direction bit for directed route SMPs.\r
3256 *\r
3257 * SOURCE\r
3258 */\r
3259 #define IB_SMP_DIRECTION                        (CL_HTON16(0x8000))\r
3260 /**********/\r
3261 \r
3262 /****d* IBA Base: Constants/IB_SMP_STATUS_MASK\r
3263 * NAME\r
3264 *       IB_SMP_STATUS_MASK\r
3265 *\r
3266 * DESCRIPTION\r
3267 *       Mask value for extracting status from a directed route SMP.\r
3268 *\r
3269 * SOURCE\r
3270 */\r
3271 #define IB_SMP_STATUS_MASK                      (CL_HTON16(0x7FFF))\r
3272 /**********/\r
3273 \r
3274 /****s* IBA Base: Types/ib_smp_t\r
3275 * NAME\r
3276 *       ib_smp_t\r
3277 *\r
3278 * DESCRIPTION\r
3279 *       IBA defined SMP. (14.2.1.2)\r
3280 *\r
3281 * SYNOPSIS\r
3282 */\r
3283 #define IB_SMP_DATA_SIZE 64\r
3284 #include <complib/cl_packon.h>\r
3285 typedef struct _ib_smp\r
3286 {\r
3287         uint8_t                                 base_ver;\r
3288         uint8_t                                 mgmt_class;\r
3289         uint8_t                                 class_ver;\r
3290         uint8_t                                 method;\r
3291         ib_net16_t                              status;\r
3292         uint8_t                                 hop_ptr;\r
3293         uint8_t                                 hop_count;\r
3294         ib_net64_t                              trans_id;\r
3295         ib_net16_t                              attr_id;\r
3296         ib_net16_t                              resv;\r
3297         ib_net32_t                              attr_mod;\r
3298         ib_net64_t                              m_key;\r
3299         ib_net16_t                              dr_slid;\r
3300         ib_net16_t                              dr_dlid;\r
3301         uint32_t                                resv1[7];\r
3302         uint8_t                                 data[IB_SMP_DATA_SIZE];\r
3303         uint8_t                                 initial_path[IB_SUBNET_PATH_HOPS_MAX];\r
3304         uint8_t                                 return_path[IB_SUBNET_PATH_HOPS_MAX];\r
3305 \r
3306 }       PACK_SUFFIX ib_smp_t;\r
3307 #include <complib/cl_packoff.h>\r
3308 /*\r
3309 * FIELDS\r
3310 *       base_ver\r
3311 *               MAD base format.\r
3312 *\r
3313 *       mgmt_class\r
3314 *               Class of operation.\r
3315 *\r
3316 *       class_ver\r
3317 *               Version of MAD class-specific format.\r
3318 *\r
3319 *       method\r
3320 *               Method to perform, including 'R' bit.\r
3321 *\r
3322 *       status\r
3323 *               Status of operation.\r
3324 *\r
3325 *       hop_ptr\r
3326 *               Hop pointer for directed route MADs.\r
3327 *\r
3328 *       hop_count\r
3329 *               Hop count for directed route MADs.\r
3330 *\r
3331 *       trans_Id\r
3332 *               Transaction ID.\r
3333 *\r
3334 *       attr_id\r
3335 *               Attribute ID.\r
3336 *\r
3337 *       resv\r
3338 *               Reserved field.\r
3339 *\r
3340 *       attr_mod\r
3341 *               Attribute modifier.\r
3342 *\r
3343 *       m_key\r
3344 *               Management key value.\r
3345 *\r
3346 *       dr_slid\r
3347 *               Directed route source LID.\r
3348 *\r
3349 *       dr_dlid\r
3350 *               Directed route destination LID.\r
3351 *\r
3352 *       resv0\r
3353 *               Reserved for 64 byte alignment.\r
3354 *\r
3355 *       data\r
3356 *               MAD data payload.\r
3357 *\r
3358 *       initial_path\r
3359 *               Outbound port list.\r
3360 *\r
3361 *       return_path\r
3362 *               Inbound port list.\r
3363 *\r
3364 * SEE ALSO\r
3365 *********/\r
3366 \r
3367 /****f* IBA Base: Types/ib_smp_get_status\r
3368 * NAME\r
3369 *       ib_smp_get_status\r
3370 *\r
3371 * DESCRIPTION\r
3372 *       Returns the SMP status value in network order.\r
3373 *\r
3374 * SYNOPSIS\r
3375 */\r
3376 AL_INLINE ib_net16_t AL_API\r
3377 ib_smp_get_status(\r
3378         IN              const   ib_smp_t* const                         p_smp )\r
3379 {\r
3380         return( (ib_net16_t)(p_smp->status & IB_SMP_STATUS_MASK) );\r
3381 }\r
3382 /*\r
3383 * PARAMETERS\r
3384 *       p_smp\r
3385 *               [in] Pointer to the SMP packet.\r
3386 *\r
3387 * RETURN VALUES\r
3388 *       Returns the SMP status value in network order.\r
3389 *\r
3390 * NOTES\r
3391 *\r
3392 * SEE ALSO\r
3393 *       ib_smp_t\r
3394 *********/\r
3395 \r
3396 /****f* IBA Base: Types/ib_smp_is_response\r
3397 * NAME\r
3398 *       ib_smp_is_response\r
3399 *\r
3400 * DESCRIPTION\r
3401 *       Returns TRUE if the SMP is a response MAD, FALSE otherwise.\r
3402 *\r
3403 * SYNOPSIS\r
3404 */\r
3405 AL_INLINE boolean_t AL_API\r
3406 ib_smp_is_response(\r
3407         IN              const   ib_smp_t* const                         p_smp )\r
3408 {\r
3409         return( ib_mad_is_response( (const ib_mad_t*)p_smp ) );\r
3410 }\r
3411 /*\r
3412 * PARAMETERS\r
3413 *       p_smp\r
3414 *               [in] Pointer to the SMP packet.\r
3415 *\r
3416 * RETURN VALUES\r
3417 *       Returns TRUE if the SMP is a response MAD, FALSE otherwise.\r
3418 *\r
3419 * NOTES\r
3420 *\r
3421 * SEE ALSO\r
3422 *       ib_smp_t\r
3423 *********/\r
3424 /****f* IBA Base: Types/ib_smp_is_d\r
3425 * NAME\r
3426 *       ib_smp_is_d\r
3427 *\r
3428 * DESCRIPTION\r
3429 *       Returns TRUE if the SMP 'D' (direction) bit is set.\r
3430 *\r
3431 * SYNOPSIS\r
3432 */\r
3433 AL_INLINE boolean_t AL_API\r
3434 ib_smp_is_d(\r
3435         IN              const   ib_smp_t* const                         p_smp )\r
3436 {\r
3437         return( (p_smp->status & IB_SMP_DIRECTION) == IB_SMP_DIRECTION );\r
3438 }\r
3439 /*\r
3440 * PARAMETERS\r
3441 *       p_smp\r
3442 *               [in] Pointer to the SMP packet.\r
3443 *\r
3444 * RETURN VALUES\r
3445 *       Returns TRUE if the SMP 'D' (direction) bit is set.\r
3446 *\r
3447 * NOTES\r
3448 *\r
3449 * SEE ALSO\r
3450 *       ib_smp_t\r
3451 *********/\r
3452 \r
3453 /****f* IBA Base: Types/ib_smp_init_new\r
3454 * NAME\r
3455 *       ib_smp_init_new\r
3456 *\r
3457 * DESCRIPTION\r
3458 *       Initializes a MAD common header.\r
3459 *\r
3460 * TODO\r
3461 *       This is too big for inlining, but leave it here for now\r
3462 *       since there is not yet another convient spot.\r
3463 *\r
3464 * SYNOPSIS\r
3465 */\r
3466 AL_INLINE void AL_API\r
3467 ib_smp_init_new(\r
3468         IN                              ib_smp_t* const                         p_smp,\r
3469         IN              const   uint8_t                                         method,\r
3470         IN              const   ib_net64_t                                      trans_id,\r
3471         IN              const   ib_net16_t                                      attr_id,\r
3472         IN              const   ib_net32_t                                      attr_mod,\r
3473         IN              const   uint8_t                                         hop_count,\r
3474         IN              const   ib_net64_t                                      m_key,\r
3475         IN              const   uint8_t*                                        path_out,\r
3476         IN              const   ib_net16_t                                      dr_slid,\r
3477         IN              const   ib_net16_t                                      dr_dlid )\r
3478 {\r
3479         CL_ASSERT( p_smp );\r
3480         CL_ASSERT( hop_count < IB_SUBNET_PATH_HOPS_MAX );\r
3481         p_smp->base_ver = 1;\r
3482         p_smp->mgmt_class = IB_MCLASS_SUBN_DIR;\r
3483         p_smp->class_ver = 1;\r
3484         p_smp->method = method;\r
3485         p_smp->status = 0;\r
3486         p_smp->hop_ptr = 0;\r
3487         p_smp->hop_count = hop_count;\r
3488         p_smp->trans_id = trans_id;\r
3489         p_smp->attr_id = attr_id;\r
3490         p_smp->resv = 0;\r
3491         p_smp->attr_mod = attr_mod;\r
3492         p_smp->m_key = m_key;\r
3493         p_smp->dr_slid = dr_slid;\r
3494         p_smp->dr_dlid = dr_dlid;\r
3495 \r
3496         cl_memclr( p_smp->resv1,\r
3497                         sizeof(p_smp->resv1) +\r
3498                         sizeof(p_smp->data) +\r
3499                         sizeof(p_smp->initial_path) +\r
3500                         sizeof(p_smp->return_path) );\r
3501 \r
3502         /* copy the path */\r
3503         cl_memcpy( &p_smp->initial_path, path_out,\r
3504                         sizeof( p_smp->initial_path ) );\r
3505 }\r
3506 /*\r
3507 * PARAMETERS\r
3508 *       p_smp\r
3509 *               [in] Pointer to the SMP packet.\r
3510 *\r
3511 *       method\r
3512 *               [in] Method to perform, including 'R' bit.\r
3513 *\r
3514 *       trans_Id\r
3515 *               [in] Transaction ID.\r
3516 *\r
3517 *       attr_id\r
3518 *               [in] Attribute ID.\r
3519 *\r
3520 *       attr_mod\r
3521 *               [in] Attribute modifier.\r
3522 *\r
3523 *       hop_count\r
3524 *               [in] Number of hops in the path.\r
3525 *\r
3526 *       m_key\r
3527 *               [in] Management key for this SMP.\r
3528 *\r
3529 *       path_out\r
3530 *               [in] Port array for outbound path.\r
3531 *\r
3532 *\r
3533 * RETURN VALUES\r
3534 *       None.\r
3535 *\r
3536 * NOTES\r
3537 *       Payload area is initialized to zero.\r
3538 *\r
3539 *\r
3540 * SEE ALSO\r
3541 *       ib_mad_t\r
3542 *********/\r
3543 /****f* IBA Base: Types/ib_smp_get_payload_ptr\r
3544 * NAME\r
3545 *       ib_smp_get_payload_ptr\r
3546 *\r
3547 * DESCRIPTION\r
3548 *       Gets a pointer to the SMP payload area.\r
3549 *\r
3550 * SYNOPSIS\r
3551 */\r
3552 AL_INLINE void* AL_API\r
3553 ib_smp_get_payload_ptr(\r
3554         IN              const   ib_smp_t* const                         p_smp )\r
3555 {\r
3556         return( (void*)p_smp->data );\r
3557 }\r
3558 /*\r
3559 * PARAMETERS\r
3560 *       p_smp\r
3561 *               [in] Pointer to the SMP packet.\r
3562 *\r
3563 * RETURN VALUES\r
3564 *       Pointer to SMP payload area.\r
3565 *\r
3566 * NOTES\r
3567 *\r
3568 * SEE ALSO\r
3569 *       ib_mad_t\r
3570 *********/\r
3571 \r
3572 /****s* IBA Base: Types/ib_node_info_t\r
3573 * NAME\r
3574 *       ib_node_info_t\r
3575 *\r
3576 * DESCRIPTION\r
3577 *       IBA defined NodeInfo. (14.2.5.3)\r
3578 *\r
3579 * SYNOPSIS\r
3580 */\r
3581 #include <complib/cl_packon.h>\r
3582 typedef struct _ib_node_info\r
3583 {\r
3584         uint8_t                         base_version;\r
3585         uint8_t                         class_version;\r
3586         uint8_t                         node_type;\r
3587         uint8_t                         num_ports;\r
3588         ib_net64_t                      sys_guid;\r
3589         ib_net64_t                      node_guid;\r
3590         ib_net64_t                      port_guid;\r
3591         ib_net16_t                      partition_cap;\r
3592         ib_net16_t                      device_id;\r
3593         ib_net32_t                      revision;\r
3594         ib_net32_t                      port_num_vendor_id;\r
3595 \r
3596 }       PACK_SUFFIX ib_node_info_t;\r
3597 #include <complib/cl_packoff.h>\r
3598 /************/\r
3599 /****s* IBA Base: Types/ib_sa_mad_t\r
3600 * NAME\r
3601 *       ib_sa_mad_t\r
3602 *\r
3603 * DESCRIPTION\r
3604 *       IBA defined SA MAD format. (15.2.1)\r
3605 *\r
3606 * SYNOPSIS\r
3607 */\r
3608 #define IB_SA_DATA_SIZE 200\r
3609 \r
3610 #include <complib/cl_packon.h>\r
3611 typedef struct _ib_sa_mad\r
3612 {\r
3613         uint8_t                                 base_ver;\r
3614         uint8_t                                 mgmt_class;\r
3615         uint8_t                                 class_ver;\r
3616         uint8_t                                 method;\r
3617         ib_net16_t                              status;\r
3618         ib_net16_t                              resv;\r
3619         ib_net64_t                              trans_id;\r
3620         ib_net16_t                              attr_id;\r
3621         ib_net16_t                              resv1;\r
3622         ib_net32_t                              attr_mod;\r
3623 \r
3624         uint8_t                                 rmpp_version;\r
3625         uint8_t                                 rmpp_type;\r
3626         uint8_t                                 rmpp_flags;\r
3627         uint8_t                                 rmpp_status;\r
3628 \r
3629         ib_net32_t                              seg_num;\r
3630         ib_net32_t                              paylen_newwin;\r
3631 \r
3632         ib_net64_t                              sm_key;\r
3633 \r
3634         ib_net16_t                              attr_offset;\r
3635         ib_net16_t                              resv3;\r
3636 \r
3637         ib_net64_t                              comp_mask;\r
3638 \r
3639         uint8_t                                 data[IB_SA_DATA_SIZE];\r
3640 }       PACK_SUFFIX ib_sa_mad_t;\r
3641 #include <complib/cl_packoff.h>\r
3642 /**********/\r
3643 #define IB_SA_MAD_HDR_SIZE (sizeof(ib_sa_mad_t) - IB_SA_DATA_SIZE)\r
3644 \r
3645 \r
3646 \r
3647 AL_INLINE uint32_t AL_API\r
3648 ib_get_attr_size(\r
3649         IN              const   ib_net16_t                                      attr_offset )\r
3650 {\r
3651         return( ((uint32_t)cl_ntoh16( attr_offset )) << 3 );\r
3652 }\r
3653 \r
3654 AL_INLINE ib_net16_t AL_API\r
3655 ib_get_attr_offset(\r
3656         IN              const   uint32_t                                        attr_size )\r
3657 {\r
3658         if( attr_size & 0x07 )\r
3659                 return( cl_hton16( (uint16_t)(attr_size >> 3) + 1 ) );\r
3660         else\r
3661                 return( cl_hton16( (uint16_t)(attr_size >> 3) ) );\r
3662 }\r
3663 \r
3664 \r
3665 /****f* IBA Base: Types/ib_sa_mad_get_payload_ptr\r
3666 * NAME\r
3667 *       ib_sa_mad_get_payload_ptr\r
3668 *\r
3669 * DESCRIPTION\r
3670 *       Gets a pointer to the SA MAD's payload area.\r
3671 *\r
3672 * SYNOPSIS\r
3673 */\r
3674 AL_INLINE void* AL_API\r
3675 ib_sa_mad_get_payload_ptr(\r
3676         IN              const   ib_sa_mad_t* const                      p_sa_mad )\r
3677 {\r
3678         return( (void*)p_sa_mad->data );\r
3679 }\r
3680 /*\r
3681 * PARAMETERS\r
3682 *       p_smp\r
3683 *               [in] Pointer to the SA MAD packet.\r
3684 *\r
3685 * RETURN VALUES\r
3686 *       Pointer to SA MAD payload area.\r
3687 *\r
3688 * NOTES\r
3689 *\r
3690 * SEE ALSO\r
3691 *       ib_mad_t\r
3692 *********/\r
3693 \r
3694 #define IB_NODE_INFO_PORT_NUM_MASK              (CL_NTOH32(0xFF000000))\r
3695 #define IB_NODE_INFO_VEND_ID_MASK               (CL_NTOH32(0x00FFFFFF))\r
3696 #if CPU_LE\r
3697         #define IB_NODE_INFO_PORT_NUM_SHIFT 0\r
3698 #else\r
3699         #define IB_NODE_INFO_PORT_NUM_SHIFT 24\r
3700 #endif\r
3701 \r
3702 /****f* IBA Base: Types/ib_node_info_get_local_port_num\r
3703 * NAME\r
3704 *       ib_node_info_get_local_port_num\r
3705 *\r
3706 * DESCRIPTION\r
3707 *       Gets a the local port number from the NodeInfo attribute.\r
3708 *\r
3709 * SYNOPSIS\r
3710 */\r
3711 AL_INLINE uint8_t AL_API\r
3712 ib_node_info_get_local_port_num(\r
3713         IN              const   ib_node_info_t* const           p_ni )\r
3714 {\r
3715         return( (uint8_t)(( p_ni->port_num_vendor_id &\r
3716                         IB_NODE_INFO_PORT_NUM_MASK )\r
3717                         >> IB_NODE_INFO_PORT_NUM_SHIFT ));\r
3718 }\r
3719 /*\r
3720 * PARAMETERS\r
3721 *       p_ni\r
3722 *               [in] Pointer to a NodeInfo attribute.\r
3723 *\r
3724 * RETURN VALUES\r
3725 *       Local port number that returned the attribute.\r
3726 *\r
3727 * NOTES\r
3728 *\r
3729 * SEE ALSO\r
3730 *       ib_node_info_t\r
3731 *********/\r
3732 /****f* IBA Base: Types/ib_node_info_get_vendor_id\r
3733 * NAME\r
3734 *       ib_node_info_get_vendor_id\r
3735 *\r
3736 * DESCRIPTION\r
3737 *       Gets the VendorID from the NodeInfo attribute.\r
3738 *\r
3739 * SYNOPSIS\r
3740 */\r
3741 AL_INLINE ib_net32_t AL_API\r