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