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