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