xref: /freebsd/contrib/ofed/opensm/include/iba/ib_types.h (revision 87181516ef48be852d5e5fee53c6e0dbfc62f21e)
1 /*
2  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
3  * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
4  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
5  * Copyright (c) 2009 HNR Consulting. All rights reserved.
6  * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
7  *
8  * This software is available to you under a choice of one of two
9  * licenses.  You may choose to be licensed under the terms of the GNU
10  * General Public License (GPL) Version 2, available from the file
11  * COPYING in the main directory of this source tree, or the
12  * OpenIB.org BSD license below:
13  *
14  *     Redistribution and use in source and binary forms, with or
15  *     without modification, are permitted provided that the following
16  *     conditions are met:
17  *
18  *      - Redistributions of source code must retain the above
19  *        copyright notice, this list of conditions and the following
20  *        disclaimer.
21  *
22  *      - Redistributions in binary form must reproduce the above
23  *        copyright notice, this list of conditions and the following
24  *        disclaimer in the documentation and/or other materials
25  *        provided with the distribution.
26  *
27  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
31  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
32  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
33  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34  * SOFTWARE.
35  *
36  */
37 
38 #if !defined(__IB_TYPES_H__)
39 #define __IB_TYPES_H__
40 
41 #include <string.h>
42 #include <complib/cl_types.h>
43 #include <complib/cl_byteswap.h>
44 
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 #if defined( __WIN__ )
55 #if defined( EXPORT_AL_SYMBOLS )
56 #define OSM_EXPORT	__declspec(dllexport)
57 #else
58 #define OSM_EXPORT	__declspec(dllimport)
59 #endif
60 #define OSM_API __stdcall
61 #define OSM_CDECL __cdecl
62 #else
63 #define OSM_EXPORT	extern
64 #define OSM_API
65 #define OSM_CDECL
66 #define __ptr64
67 #endif
68 /****h* IBA Base/Constants
69 * NAME
70 *	Constants
71 *
72 * DESCRIPTION
73 *	The following constants are used throughout the IBA code base.
74 *
75 *	Definitions are from the InfiniBand Architecture Specification v1.3.1
76 *
77 *********/
78 /****d* IBA Base: Constants/MAD_BLOCK_SIZE
79 * NAME
80 *	MAD_BLOCK_SIZE
81 *
82 * DESCRIPTION
83 *	Size of a non-RMPP MAD datagram.
84 *
85 * SOURCE
86 */
87 #define MAD_BLOCK_SIZE						256
88 /**********/
89 /****d* IBA Base: Constants/MAD_RMPP_HDR_SIZE
90 * NAME
91 *	MAD_RMPP_HDR_SIZE
92 *
93 * DESCRIPTION
94 *	Size of an RMPP header, including the common MAD header.
95 *
96 * SOURCE
97 */
98 #define MAD_RMPP_HDR_SIZE					36
99 /**********/
100 /****d* IBA Base: Constants/MAD_RMPP_DATA_SIZE
101 * NAME
102 *	MAD_RMPP_DATA_SIZE
103 *
104 * DESCRIPTION
105 *	Size of an RMPP transaction data section.
106 *
107 * SOURCE
108 */
109 #define MAD_RMPP_DATA_SIZE		(MAD_BLOCK_SIZE - MAD_RMPP_HDR_SIZE)
110 /**********/
111 /****d* IBA Base: Constants/MAD_BLOCK_GRH_SIZE
112 * NAME
113 *	MAD_BLOCK_GRH_SIZE
114 *
115 * DESCRIPTION
116 *	Size of a MAD datagram, including the GRH.
117 *
118 * SOURCE
119 */
120 #define MAD_BLOCK_GRH_SIZE					296
121 /**********/
122 /****d* IBA Base: Constants/IB_LID_PERMISSIVE
123 * NAME
124 *	IB_LID_PERMISSIVE
125 *
126 * DESCRIPTION
127 *	Permissive LID
128 *
129 * SOURCE
130 */
131 #define IB_LID_PERMISSIVE					0xFFFF
132 /**********/
133 /****d* IBA Base: Constants/IB_DEFAULT_PKEY
134 * NAME
135 *	IB_DEFAULT_PKEY
136 *
137 * DESCRIPTION
138 *	P_Key value for the default partition.
139 *
140 * SOURCE
141 */
142 #define IB_DEFAULT_PKEY						0xFFFF
143 /**********/
144 /****d* IBA Base: Constants/IB_QP1_WELL_KNOWN_Q_KEY
145 * NAME
146 *	IB_QP1_WELL_KNOWN_Q_KEY
147 *
148 * DESCRIPTION
149 *	Well-known Q_Key for QP1 privileged mode access (15.4.2).
150 *
151 * SOURCE
152 */
153 #define IB_QP1_WELL_KNOWN_Q_KEY				CL_HTON32(0x80010000)
154 /*********/
155 #define IB_QP0						0
156 #define IB_QP1						CL_HTON32(1)
157 #define IB_QP_PRIVILEGED_Q_KEY				CL_HTON32(0x80000000)
158 /****d* IBA Base: Constants/IB_LID_UCAST_START
159 * NAME
160 *	IB_LID_UCAST_START
161 *
162 * DESCRIPTION
163 *	Lowest valid unicast LID value.
164 *
165 * SOURCE
166 */
167 #define IB_LID_UCAST_START_HO				0x0001
168 #define IB_LID_UCAST_START				(CL_HTON16(IB_LID_UCAST_START_HO))
169 /**********/
170 /****d* IBA Base: Constants/IB_LID_UCAST_END
171 * NAME
172 *	IB_LID_UCAST_END
173 *
174 * DESCRIPTION
175 *	Highest valid unicast LID value.
176 *
177 * SOURCE
178 */
179 #define IB_LID_UCAST_END_HO				0xBFFF
180 #define IB_LID_UCAST_END				(CL_HTON16(IB_LID_UCAST_END_HO))
181 /**********/
182 /****d* IBA Base: Constants/IB_LID_MCAST_START
183 * NAME
184 *	IB_LID_MCAST_START
185 *
186 * DESCRIPTION
187 *	Lowest valid multicast LID value.
188 *
189 * SOURCE
190 */
191 #define IB_LID_MCAST_START_HO				0xC000
192 #define IB_LID_MCAST_START				(CL_HTON16(IB_LID_MCAST_START_HO))
193 /**********/
194 /****d* IBA Base: Constants/IB_LID_MCAST_END
195 * NAME
196 *	IB_LID_MCAST_END
197 *
198 * DESCRIPTION
199 *	Highest valid multicast LID value.
200 *
201 * SOURCE
202 */
203 #define IB_LID_MCAST_END_HO				0xFFFE
204 #define IB_LID_MCAST_END				(CL_HTON16(IB_LID_MCAST_END_HO))
205 /**********/
206 /****d* IBA Base: Constants/IB_DEFAULT_SUBNET_PREFIX
207 * NAME
208 *	IB_DEFAULT_SUBNET_PREFIX
209 *
210 * DESCRIPTION
211 *	Default subnet GID prefix.
212 *
213 * SOURCE
214 */
215 #define IB_DEFAULT_SUBNET_PREFIX			(CL_HTON64(0xFE80000000000000ULL))
216 #define IB_DEFAULT_SUBNET_PREFIX_HO			(0xFE80000000000000ULL)
217 /**********/
218 /****d* IBA Base: Constants/IB_NODE_NUM_PORTS_MAX
219 * NAME
220 *	IB_NODE_NUM_PORTS_MAX
221 *
222 * DESCRIPTION
223 *	Maximum number of ports in a single node (14.2.5.7).
224 * SOURCE
225 */
226 #define IB_NODE_NUM_PORTS_MAX				0xFE
227 /**********/
228 /****d* IBA Base: Constants/IB_INVALID_PORT_NUM
229 * NAME
230 *	IB_INVALID_PORT_NUM
231 *
232 * DESCRIPTION
233 *	Value used to indicate an invalid port number (14.2.5.10).
234 *
235 * SOURCE
236 */
237 #define IB_INVALID_PORT_NUM				0xFF
238 /*********/
239 /****d* IBA Base: Constants/IB_SUBNET_PATH_HOPS_MAX
240 * NAME
241 *	IB_SUBNET_PATH_HOPS_MAX
242 *
243 * DESCRIPTION
244 *	Maximum number of directed route switch hops in a subnet (14.2.1.2).
245 *
246 * SOURCE
247 */
248 #define IB_SUBNET_PATH_HOPS_MAX				64
249 /*********/
250 /****d* IBA Base: Constants/IB_HOPLIMIT_MAX
251 * NAME
252 *	IB_HOPLIMIT_MAX
253 *
254 * DESCRIPTION
255 *       Maximum number of router hops allowed.
256 *
257 * SOURCE
258 */
259 #define IB_HOPLIMIT_MAX					255
260 /*********/
261 /****d* IBA Base: Constants/IB_MC_SCOPE_*
262 * NAME
263 *	IB_MC_SCOPE_*
264 *
265 * DESCRIPTION
266 *	Scope component definitions from IBA 1.2.1 (Table 3 p. 148)
267 */
268 #define IB_MC_SCOPE_LINK_LOCAL		0x2
269 #define IB_MC_SCOPE_SITE_LOCAL		0x5
270 #define IB_MC_SCOPE_ORG_LOCAL		0x8
271 #define IB_MC_SCOPE_GLOBAL		0xE
272 /*********/
273 /****d* IBA Base: Constants/IB_PKEY_MAX_BLOCKS
274 * NAME
275 *	IB_PKEY_MAX_BLOCKS
276 *
277 * DESCRIPTION
278 *	Maximum number of PKEY blocks (14.2.5.7).
279 *
280 * SOURCE
281 */
282 #define IB_PKEY_MAX_BLOCKS				2048
283 /*********/
284 /****d* IBA Base: Constants/IB_MCAST_MAX_BLOCK_ID
285 * NAME
286 *	IB_MCAST_MAX_BLOCK_ID
287 *
288 * DESCRIPTION
289 *	Maximum number of Multicast port mask blocks
290 *
291 * SOURCE
292 */
293 #define IB_MCAST_MAX_BLOCK_ID				511
294 /*********/
295 /****d* IBA Base: Constants/IB_MCAST_BLOCK_ID_MASK_HO
296 * NAME
297 *	IB_MCAST_BLOCK_ID_MASK_HO
298 *
299 * DESCRIPTION
300 *	Mask (host order) to recover the Multicast block ID.
301 *
302 * SOURCE
303 */
304 #define IB_MCAST_BLOCK_ID_MASK_HO			0x000001FF
305 /*********/
306 /****d* IBA Base: Constants/IB_MCAST_BLOCK_SIZE
307 * NAME
308 *	IB_MCAST_BLOCK_SIZE
309 *
310 * DESCRIPTION
311 *	Number of port mask entries in a multicast forwarding table block.
312 *
313 * SOURCE
314 */
315 #define IB_MCAST_BLOCK_SIZE				32
316 /*********/
317 /****d* IBA Base: Constants/IB_MCAST_MASK_SIZE
318 * NAME
319 *	IB_MCAST_MASK_SIZE
320 *
321 * DESCRIPTION
322 *	Number of port mask bits in each entry in the multicast forwarding table.
323 *
324 * SOURCE
325 */
326 #define IB_MCAST_MASK_SIZE				16
327 /*********/
328 /****d* IBA Base: Constants/IB_MCAST_POSITION_MASK_HO
329 * NAME
330 *	IB_MCAST_POSITION_MASK_HO
331 *
332 * DESCRIPTION
333 *	Mask (host order) to recover the multicast block position.
334 *
335 * SOURCE
336 */
337 #define IB_MCAST_POSITION_MASK_HO			0xF0000000
338 /*********/
339 /****d* IBA Base: Constants/IB_MCAST_POSITION_MAX
340 * NAME
341 *	IB_MCAST_POSITION_MAX
342 *
343 * DESCRIPTION
344 *	Maximum value for the multicast block position.
345 *
346 * SOURCE
347 */
348 #define IB_MCAST_POSITION_MAX				0xF
349 /*********/
350 /****d* IBA Base: Constants/IB_MCAST_POSITION_SHIFT
351 * NAME
352 *	IB_MCAST_POSITION_SHIFT
353 *
354 * DESCRIPTION
355 *	Shift value to normalize the multicast block position value.
356 *
357 * SOURCE
358 */
359 #define IB_MCAST_POSITION_SHIFT				28
360 /*********/
361 /****d* IBA Base: Constants/IB_PKEY_ENTRIES_MAX
362 * NAME
363 *	IB_PKEY_ENTRIES_MAX
364 *
365 * DESCRIPTION
366 *	Maximum number of PKEY entries per port (14.2.5.7).
367 *
368 * SOURCE
369 */
370 #define IB_PKEY_ENTRIES_MAX (IB_PKEY_MAX_BLOCKS * IB_NUM_PKEY_ELEMENTS_IN_BLOCK)
371 /*********/
372 /****d* IBA Base: Constants/IB_PKEY_BASE_MASK
373 * NAME
374 *	IB_PKEY_BASE_MASK
375 *
376 * DESCRIPTION
377 *	Masks for the base P_Key value given a P_Key Entry.
378 *
379 * SOURCE
380 */
381 #define IB_PKEY_BASE_MASK				(CL_HTON16(0x7FFF))
382 /*********/
383 /****d* IBA Base: Constants/IB_PKEY_TYPE_MASK
384 * NAME
385 *	IB_PKEY_TYPE_MASK
386 *
387 * DESCRIPTION
388 *	Masks for the P_Key membership type given a P_Key Entry.
389 *
390 * SOURCE
391 */
392 #define IB_PKEY_TYPE_MASK				(CL_HTON16(0x8000))
393 /*********/
394 /****d* IBA Base: Constants/IB_DEFAULT_PARTIAL_PKEY
395 * NAME
396 *	IB_DEFAULT_PARTIAL_PKEY
397 *
398 * DESCRIPTION
399 *	0x7FFF in network order
400 *
401 * SOURCE
402 */
403 #define IB_DEFAULT_PARTIAL_PKEY				(CL_HTON16(0x7FFF))
404 /**********/
405 /****d* IBA Base: Constants/IB_MCLASS_SUBN_LID
406 * NAME
407 *	IB_MCLASS_SUBN_LID
408 *
409 * DESCRIPTION
410 *	Subnet Management Class, Subnet Manager LID routed (13.4.4)
411 *
412 * SOURCE
413 */
414 #define IB_MCLASS_SUBN_LID				0x01
415 /**********/
416 /****d* IBA Base: Constants/IB_MCLASS_SUBN_DIR
417 * NAME
418 *	IB_MCLASS_SUBN_DIR
419 *
420 * DESCRIPTION
421 *	Subnet Management Class, Subnet Manager directed route (13.4.4)
422 *
423 * SOURCE
424 */
425 #define IB_MCLASS_SUBN_DIR				0x81
426 /**********/
427 /****d* IBA Base: Constants/IB_MCLASS_SUBN_ADM
428 * NAME
429 *	IB_MCLASS_SUBN_ADM
430 *
431 * DESCRIPTION
432 *	Management Class, Subnet Administration (13.4.4)
433 *
434 * SOURCE
435 */
436 #define IB_MCLASS_SUBN_ADM				0x03
437 /**********/
438 /****d* IBA Base: Constants/IB_MCLASS_PERF
439 * NAME
440 *	IB_MCLASS_PERF
441 *
442 * DESCRIPTION
443 *	Management Class, Performance Management (13.4.4)
444 *
445 * SOURCE
446 */
447 #define IB_MCLASS_PERF					0x04
448 /**********/
449 /****d* IBA Base: Constants/IB_MCLASS_BM
450 * NAME
451 *	IB_MCLASS_BM
452 *
453 * DESCRIPTION
454 *	Management Class, Baseboard Management (13.4.4)
455 *
456 * SOURCE
457 */
458 #define IB_MCLASS_BM					0x05
459 /**********/
460 /****d* IBA Base: Constants/IB_MCLASS_DEV_MGMT
461 * NAME
462 *	IB_MCLASS_DEV_MGMT
463 *
464 * DESCRIPTION
465 *	Management Class, Device Management (13.4.4)
466 *
467 * SOURCE
468 */
469 #define IB_MCLASS_DEV_MGMT				0x06
470 /**********/
471 /****d* IBA Base: Constants/IB_MCLASS_COMM_MGMT
472 * NAME
473 *	IB_MCLASS_COMM_MGMT
474 *
475 * DESCRIPTION
476 *	Management Class, Communication Management (13.4.4)
477 *
478 * SOURCE
479 */
480 #define IB_MCLASS_COMM_MGMT				0x07
481 /**********/
482 /****d* IBA Base: Constants/IB_MCLASS_SNMP
483 * NAME
484 *	IB_MCLASS_SNMP
485 *
486 * DESCRIPTION
487 *	Management Class, SNMP Tunneling (13.4.4)
488 *
489 * SOURCE
490 */
491 #define IB_MCLASS_SNMP					0x08
492 /**********/
493 /****d* IBA Base: Constants/IB_MCLASS_VENDOR_LOW_RANGE_MIN
494 * NAME
495 *	IB_MCLASS_VENDOR_LOW_RANGE_MIN
496 *
497 * DESCRIPTION
498 *	Management Class, Vendor Specific Low Range Start
499 *
500 * SOURCE
501 */
502 #define IB_MCLASS_VENDOR_LOW_RANGE_MIN			0x09
503 /**********/
504 /****d* IBA Base: Constants/IB_MCLASS_VENDOR_LOW_RANGE_MAX
505 * NAME
506 *	IB_MCLASS_VENDOR_LOW_RANGE_MAX
507 *
508 * DESCRIPTION
509 *	Management Class, Vendor Specific Low Range End
510 *
511 * SOURCE
512 */
513 #define IB_MCLASS_VENDOR_LOW_RANGE_MAX			0x0F
514 /**********/
515 /****d* IBA Base: Constants/IB_MCLASS_DEV_ADM
516 * NAME
517 *	IB_MCLASS_DEV_ADM
518 *
519 * DESCRIPTION
520 *	Management Class, Device Administration
521 *
522 * SOURCE
523 */
524 #define IB_MCLASS_DEV_ADM				0x10
525 /**********/
526 /****d* IBA Base: Constants/IB_MCLASS_BIS
527 * NAME
528 *	IB_MCLASS_BIS
529 *
530 * DESCRIPTION
531 *	Management Class, BIS
532 *
533 * SOURCE
534 */
535 #define IB_MCLASS_BIS					0x12
536 /**********/
537 /****d* IBA Base: Constants/IB_MCLASS_CC
538 * NAME
539 *	IB_MCLASS_CC
540 *
541 * DESCRIPTION
542 *	Management Class, Congestion Control (A10.4.1)
543 *
544 * SOURCE
545 */
546 #define IB_MCLASS_CC					0x21
547 /**********/
548 /****d* IBA Base: Constants/IB_MCLASS_VENDOR_HIGH_RANGE_MIN
549 * NAME
550 *	IB_MCLASS_VENDOR_HIGH_RANGE_MIN
551 *
552 * DESCRIPTION
553 *	Management Class, Vendor Specific High Range Start
554 *
555 * SOURCE
556 */
557 #define IB_MCLASS_VENDOR_HIGH_RANGE_MIN			0x30
558 /**********/
559 /****d* IBA Base: Constants/IB_MCLASS_VENDOR_HIGH_RANGE_MAX
560 * NAME
561 *	IB_MCLASS_VENDOR_HIGH_RANGE_MAX
562 *
563 * DESCRIPTION
564 *	Management Class, Vendor Specific High Range End
565 *
566 * SOURCE
567 */
568 #define IB_MCLASS_VENDOR_HIGH_RANGE_MAX			0x4F
569 /**********/
570 /****f* IBA Base: Types/ib_class_is_vendor_specific_low
571 * NAME
572 *	ib_class_is_vendor_specific_low
573 *
574 * DESCRIPTION
575 *	Indicates if the Class Code if a vendor specific class from
576 *  the low range
577 *
578 * SYNOPSIS
579 */
580 static inline boolean_t OSM_API
ib_class_is_vendor_specific_low(IN const uint8_t class_code)581 ib_class_is_vendor_specific_low(IN const uint8_t class_code)
582 {
583 	return ((class_code >= IB_MCLASS_VENDOR_LOW_RANGE_MIN) &&
584 		(class_code <= IB_MCLASS_VENDOR_LOW_RANGE_MAX));
585 }
586 
587 /*
588 * PARAMETERS
589 *	class_code
590 *		[in] The Management Datagram Class Code
591 *
592 * RETURN VALUE
593 *	TRUE if the class is in the Low range of Vendor Specific MADs
594 *	FALSE otherwise.
595 *
596 * NOTES
597 *
598 * SEE ALSO
599 * IB_MCLASS_VENDOR_LOW_RANGE_MIN, IB_MCLASS_VENDOR_LOW_RANGE_MAX
600 *********/
601 
602 /****f* IBA Base: Types/ib_class_is_vendor_specific_high
603 * NAME
604 *	ib_class_is_vendor_specific_high
605 *
606 * DESCRIPTION
607 *	Indicates if the Class Code if a vendor specific class from
608 *  the high range
609 *
610 * SYNOPSIS
611 */
612 static inline boolean_t OSM_API
ib_class_is_vendor_specific_high(IN const uint8_t class_code)613 ib_class_is_vendor_specific_high(IN const uint8_t class_code)
614 {
615 	return ((class_code >= IB_MCLASS_VENDOR_HIGH_RANGE_MIN) &&
616 		(class_code <= IB_MCLASS_VENDOR_HIGH_RANGE_MAX));
617 }
618 
619 /*
620 * PARAMETERS
621 *	class_code
622 *		[in] The Management Datagram Class Code
623 *
624 * RETURN VALUE
625 *	TRUE if the class is in the High range of Vendor Specific MADs
626 *	FALSE otherwise.
627 *
628 * NOTES
629 *
630 * SEE ALSO
631 * IB_MCLASS_VENDOR_HIGH_RANGE_MIN, IB_MCLASS_VENDOR_HIGH_RANGE_MAX
632 *********/
633 
634 /****f* IBA Base: Types/ib_class_is_vendor_specific
635 * NAME
636 *	ib_class_is_vendor_specific
637 *
638 * DESCRIPTION
639 *	Indicates if the Class Code if a vendor specific class
640 *
641 * SYNOPSIS
642 */
643 static inline boolean_t OSM_API
ib_class_is_vendor_specific(IN const uint8_t class_code)644 ib_class_is_vendor_specific(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 /*
651 * PARAMETERS
652 *	class_code
653 *		[in] The Management Datagram Class Code
654 *
655 * RETURN VALUE
656 *	TRUE if the class is a Vendor Specific MAD
657 *	FALSE otherwise.
658 *
659 * NOTES
660 *
661 * SEE ALSO
662 *  ib_class_is_vendor_specific_low, ib_class_is_vendor_specific_high
663 *********/
664 
665 /****f* IBA Base: Types/ib_class_is_rmpp
666 * NAME
667 *	ib_class_is_rmpp
668 *
669 * DESCRIPTION
670 *	Indicates if the Class Code supports RMPP
671 *
672 * SYNOPSIS
673 */
ib_class_is_rmpp(IN const uint8_t class_code)674 static inline boolean_t OSM_API ib_class_is_rmpp(IN const uint8_t class_code)
675 {
676 	return ((class_code == IB_MCLASS_SUBN_ADM) ||
677 		(class_code == IB_MCLASS_DEV_MGMT) ||
678 		(class_code == IB_MCLASS_DEV_ADM) ||
679 		(class_code == IB_MCLASS_BIS) ||
680 		ib_class_is_vendor_specific_high(class_code));
681 }
682 
683 /*
684 * PARAMETERS
685 *	class_code
686 *		[in] The Management Datagram Class Code
687 *
688 * RETURN VALUE
689 *	TRUE if the class supports RMPP
690 *	FALSE otherwise.
691 *
692 * NOTES
693 *
694 *********/
695 
696 /*
697  *	MAD methods
698  */
699 
700 /****d* IBA Base: Constants/IB_MAX_METHOD
701 * NAME
702 *	IB_MAX_METHOD
703 *
704 * DESCRIPTION
705 *	Total number of methods available to a class, not including the R-bit.
706 *
707 * SOURCE
708 */
709 #define IB_MAX_METHODS						128
710 /**********/
711 
712 /****d* IBA Base: Constants/IB_MAD_METHOD_RESP_MASK
713 * NAME
714 *	IB_MAD_METHOD_RESP_MASK
715 *
716 * DESCRIPTION
717 *	Response mask to extract 'R' bit from the method field. (13.4.5)
718 *
719 * SOURCE
720 */
721 #define IB_MAD_METHOD_RESP_MASK				0x80
722 /**********/
723 
724 /****d* IBA Base: Constants/IB_MAD_METHOD_GET
725 * NAME
726 *	IB_MAD_METHOD_GET
727 *
728 * DESCRIPTION
729 *	Get() Method (13.4.5)
730 *
731 * SOURCE
732 */
733 #define IB_MAD_METHOD_GET					0x01
734 /**********/
735 
736 /****d* IBA Base: Constants/IB_MAD_METHOD_SET
737 * NAME
738 *	IB_MAD_METHOD_SET
739 *
740 * DESCRIPTION
741 *	Set() Method (13.4.5)
742 *
743 * SOURCE
744 */
745 #define IB_MAD_METHOD_SET					0x02
746 /**********/
747 
748 /****d* IBA Base: Constants/IB_MAD_METHOD_GET_RESP
749 * NAME
750 *	IB_MAD_METHOD_GET_RESP
751 *
752 * DESCRIPTION
753 *	GetResp() Method (13.4.5)
754 *
755 * SOURCE
756 */
757 #define IB_MAD_METHOD_GET_RESP				0x81
758 /**********/
759 
760 #define IB_MAD_METHOD_DELETE				0x15
761 
762 /****d* IBA Base: Constants/IB_MAD_METHOD_GETTABLE
763 * NAME
764 *	IB_MAD_METHOD_GETTABLE
765 *
766 * DESCRIPTION
767 *	SubnAdmGetTable() Method (15.2.2)
768 *
769 * SOURCE
770 */
771 #define IB_MAD_METHOD_GETTABLE				0x12
772 /**********/
773 
774 /****d* IBA Base: Constants/IB_MAD_METHOD_GETTABLE_RESP
775 * NAME
776 *	IB_MAD_METHOD_GETTABLE_RESP
777 *
778 * DESCRIPTION
779 *	SubnAdmGetTableResp() Method (15.2.2)
780 *
781 * SOURCE
782 */
783 #define IB_MAD_METHOD_GETTABLE_RESP			0x92
784 
785 /**********/
786 
787 #define IB_MAD_METHOD_GETTRACETABLE			0x13
788 #define IB_MAD_METHOD_GETMULTI				0x14
789 #define IB_MAD_METHOD_GETMULTI_RESP			0x94
790 
791 /****d* IBA Base: Constants/IB_MAD_METHOD_SEND
792 * NAME
793 *	IB_MAD_METHOD_SEND
794 *
795 * DESCRIPTION
796 *	Send() Method (13.4.5)
797 *
798 * SOURCE
799 */
800 #define IB_MAD_METHOD_SEND					0x03
801 /**********/
802 
803 /****d* IBA Base: Constants/IB_MAD_METHOD_TRAP
804 * NAME
805 *	IB_MAD_METHOD_TRAP
806 *
807 * DESCRIPTION
808 *	Trap() Method (13.4.5)
809 *
810 * SOURCE
811 */
812 #define IB_MAD_METHOD_TRAP					0x05
813 /**********/
814 
815 /****d* IBA Base: Constants/IB_MAD_METHOD_REPORT
816 * NAME
817 *	IB_MAD_METHOD_REPORT
818 *
819 * DESCRIPTION
820 *	Report() Method (13.4.5)
821 *
822 * SOURCE
823 */
824 #define IB_MAD_METHOD_REPORT				0x06
825 /**********/
826 
827 /****d* IBA Base: Constants/IB_MAD_METHOD_REPORT_RESP
828 * NAME
829 *	IB_MAD_METHOD_REPORT_RESP
830 *
831 * DESCRIPTION
832 *	ReportResp() Method (13.4.5)
833 *
834 * SOURCE
835 */
836 #define IB_MAD_METHOD_REPORT_RESP			0x86
837 /**********/
838 
839 /****d* IBA Base: Constants/IB_MAD_METHOD_TRAP_REPRESS
840 * NAME
841 *	IB_MAD_METHOD_TRAP_REPRESS
842 *
843 * DESCRIPTION
844 *	TrapRepress() Method (13.4.5)
845 *
846 * SOURCE
847 */
848 #define IB_MAD_METHOD_TRAP_REPRESS			0x07
849 /**********/
850 
851 /****d* IBA Base: Constants/IB_MAD_STATUS_BUSY
852 * NAME
853 *	IB_MAD_STATUS_BUSY
854 *
855 * DESCRIPTION
856 *	Temporarily busy, MAD discarded (13.4.7)
857 *
858 * SOURCE
859 */
860 #define IB_MAD_STATUS_BUSY				(CL_HTON16(0x0001))
861 /**********/
862 
863 /****d* IBA Base: Constants/IB_MAD_STATUS_REDIRECT
864 * NAME
865 *	IB_MAD_STATUS_REDIRECT
866 *
867 * DESCRIPTION
868 *	QP Redirection required (13.4.7)
869 *
870 * SOURCE
871 */
872 #define IB_MAD_STATUS_REDIRECT				(CL_HTON16(0x0002))
873 /**********/
874 
875 /****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_CLASS_VER
876 * NAME
877 *	IB_MAD_STATUS_UNSUP_CLASS_VER
878 *
879 * DESCRIPTION
880 *	Unsupported class version (13.4.7)
881 *
882 * SOURCE
883 */
884 #define IB_MAD_STATUS_UNSUP_CLASS_VER			(CL_HTON16(0x0004))
885 /**********/
886 
887 /****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_METHOD
888 * NAME
889 *	IB_MAD_STATUS_UNSUP_METHOD
890 *
891 * DESCRIPTION
892 *	Unsupported method (13.4.7)
893 *
894 * SOURCE
895 */
896 #define IB_MAD_STATUS_UNSUP_METHOD			(CL_HTON16(0x0008))
897 /**********/
898 
899 /****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_METHOD_ATTR
900 * NAME
901 *	IB_MAD_STATUS_UNSUP_METHOD_ATTR
902 *
903 * DESCRIPTION
904 *	Unsupported method/attribute combination (13.4.7)
905 *
906 * SOURCE
907 */
908 #define IB_MAD_STATUS_UNSUP_METHOD_ATTR			(CL_HTON16(0x000C))
909 /**********/
910 
911 /****d* IBA Base: Constants/IB_MAD_STATUS_INVALID_FIELD
912 * NAME
913 *	IB_MAD_STATUS_INVALID_FIELD
914 *
915 * DESCRIPTION
916 *	Attribute contains one or more invalid fields (13.4.7)
917 *
918 * SOURCE
919 */
920 #define IB_MAD_STATUS_INVALID_FIELD			(CL_HTON16(0x001C))
921 /**********/
922 
923 #define IB_MAD_STATUS_CLASS_MASK			(CL_HTON16(0xFF00))
924 
925 #define IB_SA_MAD_STATUS_SUCCESS			(CL_HTON16(0x0000))
926 #define IB_SA_MAD_STATUS_NO_RESOURCES			(CL_HTON16(0x0100))
927 #define IB_SA_MAD_STATUS_REQ_INVALID			(CL_HTON16(0x0200))
928 #define IB_SA_MAD_STATUS_NO_RECORDS			(CL_HTON16(0x0300))
929 #define IB_SA_MAD_STATUS_TOO_MANY_RECORDS		(CL_HTON16(0x0400))
930 #define IB_SA_MAD_STATUS_INVALID_GID			(CL_HTON16(0x0500))
931 #define IB_SA_MAD_STATUS_INSUF_COMPS			(CL_HTON16(0x0600))
932 #define IB_SA_MAD_STATUS_DENIED				(CL_HTON16(0x0700))
933 #define IB_SA_MAD_STATUS_PRIO_SUGGESTED			(CL_HTON16(0x0800))
934 
935 #define IB_DM_MAD_STATUS_NO_IOC_RESP			(CL_HTON16(0x0100))
936 #define IB_DM_MAD_STATUS_NO_SVC_ENTRIES			(CL_HTON16(0x0200))
937 #define IB_DM_MAD_STATUS_IOC_FAILURE			(CL_HTON16(0x8000))
938 
939 /****d* IBA Base: Constants/IB_MAD_ATTR_CLASS_PORT_INFO
940 * NAME
941 *	IB_MAD_ATTR_CLASS_PORT_INFO
942 *
943 * DESCRIPTION
944 *	ClassPortInfo attribute (13.4.8)
945 *
946 * SOURCE
947 */
948 #define IB_MAD_ATTR_CLASS_PORT_INFO			(CL_HTON16(0x0001))
949 /**********/
950 
951 /****d* IBA Base: Constants/IB_MAD_ATTR_NOTICE
952 * NAME
953 *	IB_MAD_ATTR_NOTICE
954 *
955 * DESCRIPTION
956 *	Notice attribute (13.4.8)
957 *
958 * SOURCE
959 */
960 #define IB_MAD_ATTR_NOTICE					(CL_HTON16(0x0002))
961 /**********/
962 
963 /****d* IBA Base: Constants/IB_MAD_ATTR_INFORM_INFO
964 * NAME
965 *	IB_MAD_ATTR_INFORM_INFO
966 *
967 * DESCRIPTION
968 *	InformInfo attribute (13.4.8)
969 *
970 * SOURCE
971 */
972 #define IB_MAD_ATTR_INFORM_INFO				(CL_HTON16(0x0003))
973 /**********/
974 
975 /****d* IBA Base: Constants/IB_MAD_ATTR_NODE_DESC
976 * NAME
977 *	IB_MAD_ATTR_NODE_DESC
978 *
979 * DESCRIPTION
980 *	NodeDescription attribute (14.2.5)
981 *
982 * SOURCE
983 */
984 #define IB_MAD_ATTR_NODE_DESC				(CL_HTON16(0x0010))
985 
986 /****d* IBA Base: Constants/IB_MAD_ATTR_PORT_SMPL_CTRL
987 * NAME
988 *	IB_MAD_ATTR_PORT_SMPL_CTRL
989 *
990 * DESCRIPTION
991 *	PortSamplesControl attribute (16.1.3)
992 *
993 * SOURCE
994 */
995 #define IB_MAD_ATTR_PORT_SMPL_CTRL			(CL_HTON16(0x0010))
996 /**********/
997 
998 /****d* IBA Base: Constants/IB_MAD_ATTR_NODE_INFO
999 * NAME
1000 *	IB_MAD_ATTR_NODE_INFO
1001 *
1002 * DESCRIPTION
1003 *	NodeInfo attribute (14.2.5)
1004 *
1005 * SOURCE
1006 */
1007 #define IB_MAD_ATTR_NODE_INFO				(CL_HTON16(0x0011))
1008 /**********/
1009 
1010 /****d* IBA Base: Constants/IB_MAD_ATTR_PORT_SMPL_RSLT
1011 * NAME
1012 *	IB_MAD_ATTR_PORT_SMPL_RSLT
1013 *
1014 * DESCRIPTION
1015 *	PortSamplesResult attribute (16.1.3)
1016 *
1017 * SOURCE
1018 */
1019 #define IB_MAD_ATTR_PORT_SMPL_RSLT			(CL_HTON16(0x0011))
1020 /**********/
1021 
1022 /****d* IBA Base: Constants/IB_MAD_ATTR_SWITCH_INFO
1023 * NAME
1024 *	IB_MAD_ATTR_SWITCH_INFO
1025 *
1026 * DESCRIPTION
1027 *	SwitchInfo attribute (14.2.5)
1028 *
1029 * SOURCE
1030 */
1031 #define IB_MAD_ATTR_SWITCH_INFO				(CL_HTON16(0x0012))
1032 /**********/
1033 
1034 /****d* IBA Base: Constants/IB_MAD_ATTR_PORT_CNTRS
1035 * NAME
1036 *	IB_MAD_ATTR_PORT_CNTRS
1037 *
1038 * DESCRIPTION
1039 *	PortCounters attribute (16.1.3)
1040 *
1041 * SOURCE
1042 */
1043 #define IB_MAD_ATTR_PORT_CNTRS				(CL_HTON16(0x0012))
1044 /**********/
1045 
1046 /****d* IBA Base: Constants/IB_MAD_ATTR_PORT_CNTRS_EXT
1047 * NAME
1048 *       IB_MAD_ATTR_PORT_CNTRS_EXT
1049 *
1050 * DESCRIPTION
1051 *       PortCountersExtended attribute (16.1.4)
1052 *
1053 * SOURCE
1054 */
1055 #define IB_MAD_ATTR_PORT_CNTRS_EXT			(CL_HTON16(0x001D))
1056 /**********/
1057 
1058 /****d* IBA Base: Constants/IB_MAD_ATTR_PORT_XMIT_DATA_SL
1059 * NAME
1060 *	IB_MAD_ATTR_PORT_XMIT_DATA_SL
1061 *
1062 * DESCRIPTION
1063 *	PortXmitDataSL attribute (A13.6.4)
1064 *
1065 * SOURCE
1066 */
1067 #define IB_MAD_ATTR_PORT_XMIT_DATA_SL			(CL_HTON16(0x0036))
1068 /**********/
1069 
1070 /****d* IBA Base: Constants/IB_MAD_ATTR_PORT_RCV_DATA_SL
1071 * NAME
1072 *	IB_MAD_ATTR_PORT_RCV_DATA_SL
1073 *
1074 * DESCRIPTION
1075 *	PortRcvDataSL attribute (A13.6.4)
1076 *
1077 * SOURCE
1078 */
1079 #define IB_MAD_ATTR_PORT_RCV_DATA_SL			(CL_HTON16(0x0037))
1080 /**********/
1081 
1082 /****d* IBA Base: Constants/IB_MAD_ATTR_GUID_INFO
1083 * NAME
1084 *	IB_MAD_ATTR_GUID_INFO
1085 *
1086 * DESCRIPTION
1087 *	GUIDInfo attribute (14.2.5)
1088 *
1089 * SOURCE
1090 */
1091 #define IB_MAD_ATTR_GUID_INFO				(CL_HTON16(0x0014))
1092 /**********/
1093 
1094 /****d* IBA Base: Constants/IB_MAD_ATTR_PORT_INFO
1095 * NAME
1096 *	IB_MAD_ATTR_PORT_INFO
1097 *
1098 * DESCRIPTION
1099 *	PortInfo attribute (14.2.5)
1100 *
1101 * SOURCE
1102 */
1103 #define IB_MAD_ATTR_PORT_INFO				(CL_HTON16(0x0015))
1104 /**********/
1105 
1106 /****d* IBA Base: Constants/IB_MAD_ATTR_P_KEY_TABLE
1107 * NAME
1108 *	IB_MAD_ATTR_P_KEY_TABLE
1109 *
1110 * DESCRIPTION
1111 *	PartitionTable attribute (14.2.5)
1112 *
1113 * SOURCE
1114 */
1115 #define IB_MAD_ATTR_P_KEY_TABLE				(CL_HTON16(0x0016))
1116 /**********/
1117 
1118 /****d* IBA Base: Constants/IB_MAD_ATTR_SLVL_TABLE
1119 * NAME
1120 *	IB_MAD_ATTR_SLVL_TABLE
1121 *
1122 * DESCRIPTION
1123 *	SL VL Mapping Table attribute (14.2.5)
1124 *
1125 * SOURCE
1126 */
1127 #define IB_MAD_ATTR_SLVL_TABLE				(CL_HTON16(0x0017))
1128 /**********/
1129 
1130 /****d* IBA Base: Constants/IB_MAD_ATTR_VL_ARBITRATION
1131 * NAME
1132 *	IB_MAD_ATTR_VL_ARBITRATION
1133 *
1134 * DESCRIPTION
1135 *	VL Arbitration Table attribute (14.2.5)
1136 *
1137 * SOURCE
1138 */
1139 #define IB_MAD_ATTR_VL_ARBITRATION			(CL_HTON16(0x0018))
1140 /**********/
1141 
1142 /****d* IBA Base: Constants/IB_MAD_ATTR_LIN_FWD_TBL
1143 * NAME
1144 *	IB_MAD_ATTR_LIN_FWD_TBL
1145 *
1146 * DESCRIPTION
1147 *	Switch linear forwarding table
1148 *
1149 * SOURCE
1150 */
1151 #define IB_MAD_ATTR_LIN_FWD_TBL				(CL_HTON16(0x0019))
1152 /**********/
1153 
1154 /****d* IBA Base: Constants/IB_MAD_ATTR_RND_FWD_TBL
1155 * NAME
1156 *	IB_MAD_ATTR_RND_FWD_TBL
1157 *
1158 * DESCRIPTION
1159 *	Switch random forwarding table
1160 *
1161 * SOURCE
1162 */
1163 #define IB_MAD_ATTR_RND_FWD_TBL				(CL_HTON16(0x001A))
1164 /**********/
1165 
1166 /****d* IBA Base: Constants/IB_MAD_ATTR_MCAST_FWD_TBL
1167 * NAME
1168 *	IB_MAD_ATTR_MCAST_FWD_TBL
1169 *
1170 * DESCRIPTION
1171 *	Switch multicast forwarding table
1172 *
1173 * SOURCE
1174 */
1175 #define IB_MAD_ATTR_MCAST_FWD_TBL			(CL_HTON16(0x001B))
1176 /**********/
1177 
1178 /****d* IBA Base: Constants/IB_MAD_ATTR_NODE_RECORD
1179 * NAME
1180 *	IB_MAD_ATTR_NODE_RECORD
1181 *
1182 * DESCRIPTION
1183 *	NodeRecord attribute (15.2.5)
1184 *
1185 * SOURCE
1186 */
1187 #define IB_MAD_ATTR_NODE_RECORD				(CL_HTON16(0x0011))
1188 /**********/
1189 
1190 /****d* IBA Base: Constants/IB_MAD_ATTR_PORTINFO_RECORD
1191 * NAME
1192 *	IB_MAD_ATTR_PORTINFO_RECORD
1193 *
1194 * DESCRIPTION
1195 *	PortInfoRecord attribute (15.2.5)
1196 *
1197 * SOURCE
1198 */
1199 #define IB_MAD_ATTR_PORTINFO_RECORD			(CL_HTON16(0x0012))
1200 /**********/
1201 
1202 /****d* IBA Base: Constants/IB_MAD_ATTR_SWITCH_INFO_RECORD
1203 * NAME
1204 *       IB_MAD_ATTR_SWITCH_INFO_RECORD
1205 *
1206 * DESCRIPTION
1207 *       SwitchInfoRecord attribute (15.2.5)
1208 *
1209 * SOURCE
1210 */
1211 #define IB_MAD_ATTR_SWITCH_INFO_RECORD			(CL_HTON16(0x0014))
1212 /**********/
1213 
1214 /****d* IBA Base: Constants/IB_MAD_ATTR_LINK_RECORD
1215 * NAME
1216 *	IB_MAD_ATTR_LINK_RECORD
1217 *
1218 * DESCRIPTION
1219 *	LinkRecord attribute (15.2.5)
1220 *
1221 * SOURCE
1222 */
1223 #define IB_MAD_ATTR_LINK_RECORD				(CL_HTON16(0x0020))
1224 /**********/
1225 
1226 /****d* IBA Base: Constants/IB_MAD_ATTR_SM_INFO
1227 * NAME
1228 *	IB_MAD_ATTR_SM_INFO
1229 *
1230 * DESCRIPTION
1231 *	SMInfo attribute (14.2.5)
1232 *
1233 * SOURCE
1234 */
1235 #define IB_MAD_ATTR_SM_INFO				(CL_HTON16(0x0020))
1236 /**********/
1237 
1238 /****d* IBA Base: Constants/IB_MAD_ATTR_SMINFO_RECORD
1239 * NAME
1240 *	IB_MAD_ATTR_SMINFO_RECORD
1241 *
1242 * DESCRIPTION
1243 *	SMInfoRecord attribute (15.2.5)
1244 *
1245 * SOURCE
1246 */
1247 #define IB_MAD_ATTR_SMINFO_RECORD			(CL_HTON16(0x0018))
1248 /**********/
1249 
1250 /****d* IBA Base: Constants/IB_MAD_ATTR_GUIDINFO_RECORD
1251 * NAME
1252 *       IB_MAD_ATTR_GUIDINFO_RECORD
1253 *
1254 * DESCRIPTION
1255 *       GuidInfoRecord attribute (15.2.5)
1256 *
1257 * SOURCE
1258 */
1259 #define IB_MAD_ATTR_GUIDINFO_RECORD			(CL_HTON16(0x0030))
1260 /**********/
1261 
1262 /****d* IBA Base: Constants/IB_MAD_ATTR_VENDOR_DIAG
1263 * NAME
1264 *	IB_MAD_ATTR_VENDOR_DIAG
1265 *
1266 * DESCRIPTION
1267 *	VendorDiag attribute (14.2.5)
1268 *
1269 * SOURCE
1270 */
1271 #define IB_MAD_ATTR_VENDOR_DIAG				(CL_HTON16(0x0030))
1272 /**********/
1273 
1274 /****d* IBA Base: Constants/IB_MAD_ATTR_LED_INFO
1275 * NAME
1276 *	IB_MAD_ATTR_LED_INFO
1277 *
1278 * DESCRIPTION
1279 *	LedInfo attribute (14.2.5)
1280 *
1281 * SOURCE
1282 */
1283 #define IB_MAD_ATTR_LED_INFO				(CL_HTON16(0x0031))
1284 /**********/
1285 
1286 /****d* IBA Base: Constants/IB_MAD_ATTR_MLNX_EXTENDED_PORT_INFO
1287 * NAME
1288 *	IB_MAD_ATTR_MLNX_EXTENDED_PORT_INFO
1289 *
1290 * DESCRIPTION
1291 *	Vendor specific SM attribute (14.2.5)
1292 *
1293 * SOURCE
1294 */
1295 #define IB_MAD_ATTR_MLNX_EXTENDED_PORT_INFO		(CL_HTON16(0xFF90))
1296 /**********/
1297 
1298 /****d* IBA Base: Constants/IB_MAD_ATTR_SERVICE_RECORD
1299 * NAME
1300 *	IB_MAD_ATTR_SERVICE_RECORD
1301 *
1302 * DESCRIPTION
1303 *	ServiceRecord attribute (15.2.5)
1304 *
1305 * SOURCE
1306 */
1307 #define IB_MAD_ATTR_SERVICE_RECORD			(CL_HTON16(0x0031))
1308 /**********/
1309 
1310 /****d* IBA Base: Constants/IB_MAD_ATTR_LFT_RECORD
1311 * NAME
1312 *	IB_MAD_ATTR_LFT_RECORD
1313 *
1314 * DESCRIPTION
1315 *	LinearForwardingTableRecord attribute (15.2.5.6)
1316 *
1317 * SOURCE
1318 */
1319 #define IB_MAD_ATTR_LFT_RECORD				(CL_HTON16(0x0015))
1320 /**********/
1321 
1322 /****d* IBA Base: Constants/IB_MAD_ATTR_MFT_RECORD
1323 * NAME
1324 *       IB_MAD_ATTR_MFT_RECORD
1325 *
1326 * DESCRIPTION
1327 *       MulticastForwardingTableRecord attribute (15.2.5.8)
1328 *
1329 * SOURCE
1330 */
1331 #define IB_MAD_ATTR_MFT_RECORD				(CL_HTON16(0x0017))
1332 /**********/
1333 
1334 /****d* IBA Base: Constants/IB_MAD_ATTR_PKEYTBL_RECORD
1335 * NAME
1336 *	IB_MAD_ATTR_PKEYTBL_RECORD
1337 *
1338 * DESCRIPTION
1339 *	PKEY Table Record attribute (15.2.5)
1340 *
1341 * SOURCE
1342 */
1343 #define IB_MAD_ATTR_PKEY_TBL_RECORD			(CL_HTON16(0x0033))
1344 /**********/
1345 
1346 /****d* IBA Base: Constants/IB_MAD_ATTR_PATH_RECORD
1347 * NAME
1348 *	IB_MAD_ATTR_PATH_RECORD
1349 *
1350 * DESCRIPTION
1351 *	PathRecord attribute (15.2.5)
1352 *
1353 * SOURCE
1354 */
1355 #define IB_MAD_ATTR_PATH_RECORD				(CL_HTON16(0x0035))
1356 /**********/
1357 
1358 /****d* IBA Base: Constants/IB_MAD_ATTR_VLARB_RECORD
1359 * NAME
1360 *	IB_MAD_ATTR_VLARB_RECORD
1361 *
1362 * DESCRIPTION
1363 *	VL Arbitration Table Record attribute (15.2.5)
1364 *
1365 * SOURCE
1366 */
1367 #define IB_MAD_ATTR_VLARB_RECORD			(CL_HTON16(0x0036))
1368 /**********/
1369 
1370 /****d* IBA Base: Constants/IB_MAD_ATTR_SLVL_RECORD
1371 * NAME
1372 *	IB_MAD_ATTR_SLVL_RECORD
1373 *
1374 * DESCRIPTION
1375 *	SLtoVL Mapping Table Record attribute (15.2.5)
1376 *
1377 * SOURCE
1378 */
1379 #define IB_MAD_ATTR_SLVL_RECORD				(CL_HTON16(0x0013))
1380 /**********/
1381 
1382 /****d* IBA Base: Constants/IB_MAD_ATTR_MCMEMBER_RECORD
1383 * NAME
1384 *	IB_MAD_ATTR_MCMEMBER_RECORD
1385 *
1386 * DESCRIPTION
1387 *	MCMemberRecord attribute (15.2.5)
1388 *
1389 * SOURCE
1390 */
1391 #define IB_MAD_ATTR_MCMEMBER_RECORD			(CL_HTON16(0x0038))
1392 /**********/
1393 
1394 /****d* IBA Base: Constants/IB_MAD_ATTR_TRACE_RECORD
1395 * NAME
1396 *	IB_MAD_ATTR_TRACE_RECORD
1397 *
1398 * DESCRIPTION
1399 *	TraceRecord attribute (15.2.5)
1400 *
1401 * SOURCE
1402 */
1403 #define IB_MAD_ATTR_TRACE_RECORD			(CL_HTON16(0x0039))
1404 /**********/
1405 
1406 /****d* IBA Base: Constants/IB_MAD_ATTR_MULTIPATH_RECORD
1407 * NAME
1408 *	IB_MAD_ATTR_MULTIPATH_RECORD
1409 *
1410 * DESCRIPTION
1411 *	MultiPathRecord attribute (15.2.5)
1412 *
1413 * SOURCE
1414 */
1415 #define IB_MAD_ATTR_MULTIPATH_RECORD			(CL_HTON16(0x003A))
1416 /**********/
1417 
1418 /****d* IBA Base: Constants/IB_MAD_ATTR_SVC_ASSOCIATION_RECORD
1419 * NAME
1420 *	IB_MAD_ATTR_SVC_ASSOCIATION_RECORD
1421 *
1422 * DESCRIPTION
1423 *	Service Association Record attribute (15.2.5)
1424 *
1425 * SOURCE
1426 */
1427 #define IB_MAD_ATTR_SVC_ASSOCIATION_RECORD		(CL_HTON16(0x003B))
1428 /**********/
1429 
1430 /****d* IBA Base: Constants/IB_MAD_ATTR_INFORM_INFO_RECORD
1431 * NAME
1432 *	IB_MAD_ATTR_INFORM_INFO_RECORD
1433 *
1434 * DESCRIPTION
1435 *	InformInfo Record attribute (15.2.5)
1436 *
1437 * SOURCE
1438 */
1439 #define IB_MAD_ATTR_INFORM_INFO_RECORD			(CL_HTON16(0x00F3))
1440 
1441 /****d* IBA Base: Constants/IB_MAD_ATTR_IO_UNIT_INFO
1442 * NAME
1443 *	IB_MAD_ATTR_IO_UNIT_INFO
1444 *
1445 * DESCRIPTION
1446 *	IOUnitInfo attribute (16.3.3)
1447 *
1448 * SOURCE
1449 */
1450 #define IB_MAD_ATTR_IO_UNIT_INFO			(CL_HTON16(0x0010))
1451 /**********/
1452 
1453 /****d* IBA Base: Constants/IB_MAD_ATTR_IO_CONTROLLER_PROFILE
1454 * NAME
1455 *	IB_MAD_ATTR_IO_CONTROLLER_PROFILE
1456 *
1457 * DESCRIPTION
1458 *	IOControllerProfile attribute (16.3.3)
1459 *
1460 * SOURCE
1461 */
1462 #define IB_MAD_ATTR_IO_CONTROLLER_PROFILE	(CL_HTON16(0x0011))
1463 /**********/
1464 
1465 /****d* IBA Base: Constants/IB_MAD_ATTR_SERVICE_ENTRIES
1466 * NAME
1467 *	IB_MAD_ATTR_SERVICE_ENTRIES
1468 *
1469 * DESCRIPTION
1470 *	ServiceEntries attribute (16.3.3)
1471 *
1472 * SOURCE
1473 */
1474 #define IB_MAD_ATTR_SERVICE_ENTRIES			(CL_HTON16(0x0012))
1475 /**********/
1476 
1477 /****d* IBA Base: Constants/IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT
1478 * NAME
1479 *	IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT
1480 *
1481 * DESCRIPTION
1482 *	DiagnosticTimeout attribute (16.3.3)
1483 *
1484 * SOURCE
1485 */
1486 #define IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT		(CL_HTON16(0x0020))
1487 /**********/
1488 
1489 /****d* IBA Base: Constants/IB_MAD_ATTR_PREPARE_TO_TEST
1490 * NAME
1491 *	IB_MAD_ATTR_PREPARE_TO_TEST
1492 *
1493 * DESCRIPTION
1494 *	PrepareToTest attribute (16.3.3)
1495 *
1496 * SOURCE
1497 */
1498 #define IB_MAD_ATTR_PREPARE_TO_TEST			(CL_HTON16(0x0021))
1499 /**********/
1500 
1501 /****d* IBA Base: Constants/IB_MAD_ATTR_TEST_DEVICE_ONCE
1502 * NAME
1503 *	IB_MAD_ATTR_TEST_DEVICE_ONCE
1504 *
1505 * DESCRIPTION
1506 *	TestDeviceOnce attribute (16.3.3)
1507 *
1508 * SOURCE
1509 */
1510 #define IB_MAD_ATTR_TEST_DEVICE_ONCE		(CL_HTON16(0x0022))
1511 /**********/
1512 
1513 /****d* IBA Base: Constants/IB_MAD_ATTR_TEST_DEVICE_LOOP
1514 * NAME
1515 *	IB_MAD_ATTR_TEST_DEVICE_LOOP
1516 *
1517 * DESCRIPTION
1518 *	TestDeviceLoop attribute (16.3.3)
1519 *
1520 * SOURCE
1521 */
1522 #define IB_MAD_ATTR_TEST_DEVICE_LOOP		(CL_HTON16(0x0023))
1523 /**********/
1524 
1525 /****d* IBA Base: Constants/IB_MAD_ATTR_DIAG_CODE
1526 * NAME
1527 *	IB_MAD_ATTR_DIAG_CODE
1528 *
1529 * DESCRIPTION
1530 *	DiagCode attribute (16.3.3)
1531 *
1532 * SOURCE
1533 */
1534 #define IB_MAD_ATTR_DIAG_CODE				(CL_HTON16(0x0024))
1535 /**********/
1536 
1537 /****d* IBA Base: Constants/IB_MAD_ATTR_SVC_ASSOCIATION_RECORD
1538 * NAME
1539 *	IB_MAD_ATTR_SVC_ASSOCIATION_RECORD
1540 *
1541 * DESCRIPTION
1542 *	Service Association Record attribute (15.2.5)
1543 *
1544 * SOURCE
1545 */
1546 #define IB_MAD_ATTR_SVC_ASSOCIATION_RECORD	(CL_HTON16(0x003B))
1547 /**********/
1548 
1549 /****d* IBA Base: Constants/IB_MAD_ATTR_CONG_INFO
1550 * NAME
1551 *	IB_MAD_ATTR_CONG_INFO
1552 *
1553 * DESCRIPTION
1554 *	CongestionInfo attribute (A10.4.3)
1555 *
1556 * SOURCE
1557 */
1558 #define IB_MAD_ATTR_CONG_INFO				(CL_HTON16(0x0011))
1559 /**********/
1560 
1561 /****d* IBA Base: Constants/IB_MAD_ATTR_CONG_KEY_INFO
1562 * NAME
1563 *	IB_MAD_ATTR_CONG_KEY_INFO
1564 *
1565 * DESCRIPTION
1566 *	CongestionKeyInfo attribute (A10.4.3)
1567 *
1568 * SOURCE
1569 */
1570 #define IB_MAD_ATTR_CONG_KEY_INFO			(CL_HTON16(0x0012))
1571 /**********/
1572 
1573 /****d* IBA Base: Constants/IB_MAD_ATTR_CONG_LOG
1574 * NAME
1575 *	IB_MAD_ATTR_CONG_LOG
1576 *
1577 * DESCRIPTION
1578 *	CongestionLog attribute (A10.4.3)
1579 *
1580 * SOURCE
1581 */
1582 #define IB_MAD_ATTR_CONG_LOG				(CL_HTON16(0x0013))
1583 /**********/
1584 
1585 /****d* IBA Base: Constants/IB_MAD_ATTR_SW_CONG_SETTING
1586 * NAME
1587 *	IB_MAD_ATTR_SW_CONG_SETTING
1588 *
1589 * DESCRIPTION
1590 *	SwitchCongestionSetting attribute (A10.4.3)
1591 *
1592 * SOURCE
1593 */
1594 #define IB_MAD_ATTR_SW_CONG_SETTING			(CL_HTON16(0x0014))
1595 /**********/
1596 
1597 /****d* IBA Base: Constants/IB_MAD_ATTR_SW_PORT_CONG_SETTING
1598 * NAME
1599 *	IB_MAD_ATTR_SW_PORT_CONG_SETTING
1600 *
1601 * DESCRIPTION
1602 *	SwitchPortCongestionSetting attribute (A10.4.3)
1603 *
1604 * SOURCE
1605 */
1606 #define IB_MAD_ATTR_SW_PORT_CONG_SETTING		(CL_HTON16(0x0015))
1607 /**********/
1608 
1609 /****d* IBA Base: Constants/IB_MAD_ATTR_CA_CONG_SETTING
1610 * NAME
1611 *	IB_MAD_ATTR_CA_CONG_SETTING
1612 *
1613 * DESCRIPTION
1614 *	CACongestionSetting attribute (A10.4.3)
1615 *
1616 * SOURCE
1617 */
1618 #define IB_MAD_ATTR_CA_CONG_SETTING			(CL_HTON16(0x0016))
1619 /**********/
1620 
1621 /****d* IBA Base: Constants/IB_MAD_ATTR_CC_TBL
1622 * NAME
1623 *	IB_MAD_ATTR_CC_TBL
1624 *
1625 * DESCRIPTION
1626 *	CongestionControlTable attribute (A10.4.3)
1627 *
1628 * SOURCE
1629 */
1630 #define IB_MAD_ATTR_CC_TBL				(CL_HTON16(0x0017))
1631 /**********/
1632 
1633 /****d* IBA Base: Constants/IB_MAD_ATTR_TIME_STAMP
1634 * NAME
1635 *	IB_MAD_ATTR_TIME_STAMP
1636 *
1637 * DESCRIPTION
1638 *	TimeStamp attribute (A10.4.3)
1639 *
1640 * SOURCE
1641 */
1642 #define IB_MAD_ATTR_TIME_STAMP				(CL_HTON16(0x0018))
1643 /**********/
1644 
1645 /****d* IBA Base: Constants/IB_NODE_TYPE_CA
1646 * NAME
1647 *	IB_NODE_TYPE_CA
1648 *
1649 * DESCRIPTION
1650 *	Encoded generic node type used in MAD attributes (13.4.8.2)
1651 *
1652 * SOURCE
1653 */
1654 #define IB_NODE_TYPE_CA						0x01
1655 /**********/
1656 
1657 /****d* IBA Base: Constants/IB_NODE_TYPE_SWITCH
1658 * NAME
1659 *	IB_NODE_TYPE_SWITCH
1660 *
1661 * DESCRIPTION
1662 *	Encoded generic node type used in MAD attributes (13.4.8.2)
1663 *
1664 * SOURCE
1665 */
1666 #define IB_NODE_TYPE_SWITCH					0x02
1667 /**********/
1668 
1669 /****d* IBA Base: Constants/IB_NODE_TYPE_ROUTER
1670 * NAME
1671 *	IB_NODE_TYPE_ROUTER
1672 *
1673 * DESCRIPTION
1674 *	Encoded generic node type used in MAD attributes (13.4.8.2)
1675 *
1676 * SOURCE
1677 */
1678 #define IB_NODE_TYPE_ROUTER					0x03
1679 /**********/
1680 
1681 /****d* IBA Base: Constants/IB_NOTICE_PRODUCER_TYPE_CA
1682 * NAME
1683 *	IB_NOTICE_PRODUCER_TYPE_CA
1684 *
1685 * DESCRIPTION
1686 *	Encoded generic producer type used in Notice attribute (13.4.8.2)
1687 *
1688 * SOURCE
1689 */
1690 #define IB_NOTICE_PRODUCER_TYPE_CA			(CL_HTON32(0x000001))
1691 /**********/
1692 
1693 /****d* IBA Base: Constants/IB_NOTICE_PRODUCER_TYPE_SWITCH
1694 * NAME
1695 *	IB_NOTICE_PRODUCER_TYPE_SWITCH
1696 *
1697 * DESCRIPTION
1698 *	Encoded generic producer type used in Notice attribute (13.4.8.2)
1699 *
1700 * SOURCE
1701 */
1702 #define IB_NOTICE_PRODUCER_TYPE_SWITCH			(CL_HTON32(0x000002))
1703 /**********/
1704 
1705 /****d* IBA Base: Constants/IB_NOTICE_PRODUCER_TYPE_ROUTER
1706 * NAME
1707 *	IB_NOTICE_PRODUCER_TYPE_ROUTER
1708 *
1709 * DESCRIPTION
1710 *	Encoded generic producer type used in Notice attribute (13.4.8.2)
1711 *
1712 * SOURCE
1713 */
1714 #define IB_NOTICE_PRODUCER_TYPE_ROUTER			(CL_HTON32(0x000003))
1715 /**********/
1716 
1717 /****d* IBA Base: Constants/IB_NOTICE_PRODUCER_TYPE_CLASS_MGR
1718 * NAME
1719 *	IB_NOTICE_PRODUCER_TYPE_CLASS_MGR
1720 *
1721 * DESCRIPTION
1722 *	Encoded generic producer type used in Notice attribute (13.4.8.2)
1723 *
1724 * SOURCE
1725 */
1726 #define IB_NOTICE_PRODUCER_TYPE_CLASS_MGR		(CL_HTON32(0x000004))
1727 /**********/
1728 
1729 /****d* IBA Base: Constants/IB_MTU_LEN_TYPE
1730 * NAME
1731 *	IB_MTU_LEN_TYPE
1732 *
1733 * DESCRIPTION
1734 *	Encoded path MTU.
1735 *		1: 256
1736 *		2: 512
1737 *		3: 1024
1738 *		4: 2048
1739 *		5: 4096
1740 *		others: reserved
1741 *
1742 * SOURCE
1743 */
1744 #define IB_MTU_LEN_256							1
1745 #define IB_MTU_LEN_512							2
1746 #define IB_MTU_LEN_1024							3
1747 #define IB_MTU_LEN_2048							4
1748 #define IB_MTU_LEN_4096							5
1749 
1750 #define IB_MIN_MTU    IB_MTU_LEN_256
1751 #define IB_MAX_MTU    IB_MTU_LEN_4096
1752 
1753 /**********/
1754 
1755 /****d* IBA Base: Constants/IB_PATH_SELECTOR_TYPE
1756 * NAME
1757 *	IB_PATH_SELECTOR_TYPE
1758 *
1759 * DESCRIPTION
1760 *	Path selector.
1761 *		0: greater than specified
1762 *		1: less than specified
1763 *		2: exactly the specified
1764 *		3: largest available
1765 *
1766 * SOURCE
1767 */
1768 #define IB_PATH_SELECTOR_GREATER_THAN		0
1769 #define IB_PATH_SELECTOR_LESS_THAN		1
1770 #define IB_PATH_SELECTOR_EXACTLY		2
1771 #define IB_PATH_SELECTOR_LARGEST		3
1772 /**********/
1773 
1774 /****d* IBA Base: Constants/IB_SMINFO_STATE_NOTACTIVE
1775 * NAME
1776 *	IB_SMINFO_STATE_NOTACTIVE
1777 *
1778 * DESCRIPTION
1779 *	Encoded state value used in the SMInfo attribute.
1780 *
1781 * SOURCE
1782 */
1783 #define IB_SMINFO_STATE_NOTACTIVE			0
1784 /**********/
1785 
1786 /****d* IBA Base: Constants/IB_SMINFO_STATE_DISCOVERING
1787 * NAME
1788 *	IB_SMINFO_STATE_DISCOVERING
1789 *
1790 * DESCRIPTION
1791 *	Encoded state value used in the SMInfo attribute.
1792 *
1793 * SOURCE
1794 */
1795 #define IB_SMINFO_STATE_DISCOVERING			1
1796 /**********/
1797 
1798 /****d* IBA Base: Constants/IB_SMINFO_STATE_STANDBY
1799 * NAME
1800 *	IB_SMINFO_STATE_STANDBY
1801 *
1802 * DESCRIPTION
1803 *	Encoded state value used in the SMInfo attribute.
1804 *
1805 * SOURCE
1806 */
1807 #define IB_SMINFO_STATE_STANDBY				2
1808 /**********/
1809 
1810 /****d* IBA Base: Constants/IB_SMINFO_STATE_MASTER
1811 * NAME
1812 *	IB_SMINFO_STATE_MASTER
1813 *
1814 * DESCRIPTION
1815 *	Encoded state value used in the SMInfo attribute.
1816 *
1817 * SOURCE
1818 */
1819 #define IB_SMINFO_STATE_MASTER				3
1820 /**********/
1821 
1822 /****d* IBA Base: Constants/IB_PATH_REC_SL_MASK
1823 * NAME
1824 *	IB_PATH_REC_SL_MASK
1825 *
1826 * DESCRIPTION
1827 *	Mask for the sl field for path record
1828 *
1829 * SOURCE
1830 */
1831 #define IB_PATH_REC_SL_MASK				0x000F
1832 
1833 /****d* IBA Base: Constants/IB_MULTIPATH_REC_SL_MASK
1834 * NAME
1835 *	IB_MULTIPATH_REC_SL_MASK
1836 *
1837 * DESCRIPTION
1838 *	Mask for the sl field for MultiPath record
1839 *
1840 * SOURCE
1841 */
1842 #define IB_MULTIPATH_REC_SL_MASK			0x000F
1843 
1844 /****d* IBA Base: Constants/IB_PATH_REC_QOS_CLASS_MASK
1845 * NAME
1846 *	IB_PATH_REC_QOS_CLASS_MASK
1847 *
1848 * DESCRIPTION
1849 *	Mask for the QoS class field for path record
1850 *
1851 * SOURCE
1852 */
1853 #define IB_PATH_REC_QOS_CLASS_MASK			0xFFF0
1854 
1855 /****d* IBA Base: Constants/IB_MULTIPATH_REC_QOS_CLASS_MASK
1856 * NAME
1857 *	IB_MULTIPATH_REC_QOS_CLASS_MASK
1858 *
1859 * DESCRIPTION
1860 *	Mask for the QoS class field for MultiPath record
1861 *
1862 * SOURCE
1863 */
1864 #define IB_MULTIPATH_REC_QOS_CLASS_MASK			0xFFF0
1865 
1866 /****d* IBA Base: Constants/IB_PATH_REC_SELECTOR_MASK
1867 * NAME
1868 *	IB_PATH_REC_SELECTOR_MASK
1869 *
1870 * DESCRIPTION
1871 *	Mask for the selector field for path record MTU, rate,
1872 *	and packet lifetime.
1873 *
1874 * SOURCE
1875 */
1876 #define IB_PATH_REC_SELECTOR_MASK			0xC0
1877 
1878 /****d* IBA Base: Constants/IB_MULTIPATH_REC_SELECTOR_MASK
1879 * NAME
1880 *       IB_MULTIPATH_REC_SELECTOR_MASK
1881 *
1882 * DESCRIPTION
1883 *       Mask for the selector field for multipath record MTU, rate,
1884 *       and packet lifetime.
1885 *
1886 * SOURCE
1887 */
1888 #define IB_MULTIPATH_REC_SELECTOR_MASK                       0xC0
1889 /**********/
1890 
1891 /****d* IBA Base: Constants/IB_PATH_REC_BASE_MASK
1892 * NAME
1893 *	IB_PATH_REC_BASE_MASK
1894 *
1895 * DESCRIPTION
1896 *	Mask for the base value field for path record MTU, rate,
1897 *	and packet lifetime.
1898 *
1899 * SOURCE
1900 */
1901 #define IB_PATH_REC_BASE_MASK				0x3F
1902 /**********/
1903 
1904 /****d* IBA Base: Constants/IB_MULTIPATH_REC_BASE_MASK
1905 * NAME
1906 *       IB_MULTIPATH_REC_BASE_MASK
1907 *
1908 * DESCRIPTION
1909 *       Mask for the base value field for multipath record MTU, rate,
1910 *       and packet lifetime.
1911 *
1912 * SOURCE
1913 */
1914 #define IB_MULTIPATH_REC_BASE_MASK                      0x3F
1915 /**********/
1916 
1917 /****h* IBA Base/Type Definitions
1918 * NAME
1919 *	Type Definitions
1920 *
1921 * DESCRIPTION
1922 *	Definitions are from the InfiniBand Architecture Specification v1.2
1923 *
1924 *********/
1925 
1926 /****d* IBA Base: Types/ib_net16_t
1927 * NAME
1928 *	ib_net16_t
1929 *
1930 * DESCRIPTION
1931 *	Defines the network ordered type for 16-bit values.
1932 *
1933 * SOURCE
1934 */
1935 typedef uint16_t ib_net16_t;
1936 /**********/
1937 
1938 /****d* IBA Base: Types/ib_net32_t
1939 * NAME
1940 *	ib_net32_t
1941 *
1942 * DESCRIPTION
1943 *	Defines the network ordered type for 32-bit values.
1944 *
1945 * SOURCE
1946 */
1947 typedef uint32_t ib_net32_t;
1948 /**********/
1949 
1950 /****d* IBA Base: Types/ib_net64_t
1951 * NAME
1952 *	ib_net64_t
1953 *
1954 * DESCRIPTION
1955 *	Defines the network ordered type for 64-bit values.
1956 *
1957 * SOURCE
1958 */
1959 typedef uint64_t ib_net64_t;
1960 /**********/
1961 
1962 /****d* IBA Base: Types/ib_gid_prefix_t
1963 * NAME
1964 *	ib_gid_prefix_t
1965 *
1966 * DESCRIPTION
1967 *
1968 * SOURCE
1969 */
1970 typedef ib_net64_t ib_gid_prefix_t;
1971 /**********/
1972 
1973 /****d* IBA Base: Constants/ib_link_states_t
1974 * NAME
1975 *	ib_link_states_t
1976 *
1977 * DESCRIPTION
1978 *	Defines the link states of a port.
1979 *
1980 * SOURCE
1981 */
1982 #define IB_LINK_NO_CHANGE 0
1983 #define IB_LINK_DOWN      1
1984 #define IB_LINK_INIT	  2
1985 #define IB_LINK_ARMED     3
1986 #define IB_LINK_ACTIVE    4
1987 #define IB_LINK_ACT_DEFER 5
1988 /**********/
1989 
1990 static const char *const __ib_node_type_str[] = {
1991 	"UNKNOWN",
1992 	"Channel Adapter",
1993 	"Switch",
1994 	"Router"
1995 };
1996 
1997 /****f* IBA Base: Types/ib_get_node_type_str
1998 * NAME
1999 *	ib_get_node_type_str
2000 *
2001 * DESCRIPTION
2002 *	Returns a string for the specified node type.
2003 *	14.2.5.3 NodeInfo
2004 *
2005 * SYNOPSIS
2006 */
ib_get_node_type_str(IN uint8_t node_type)2007 static inline const char *OSM_API ib_get_node_type_str(IN uint8_t node_type)
2008 {
2009 	if (node_type > IB_NODE_TYPE_ROUTER)
2010 		node_type = 0;
2011 	return (__ib_node_type_str[node_type]);
2012 }
2013 
2014 /*
2015 * PARAMETERS
2016 *	node_type
2017 *		[in] Encoded node type as returned in the NodeInfo attribute.
2018 
2019 * RETURN VALUES
2020 *	Pointer to the node type string.
2021 *
2022 * NOTES
2023 *
2024 * SEE ALSO
2025 * ib_node_info_t
2026 *********/
2027 
2028 static const char *const __ib_producer_type_str[] = {
2029 	"UNKNOWN",
2030 	"Channel Adapter",
2031 	"Switch",
2032 	"Router",
2033 	"Class Manager"
2034 };
2035 
2036 /****f* IBA Base: Types/ib_get_producer_type_str
2037 * NAME
2038 *	ib_get_producer_type_str
2039 *
2040 * DESCRIPTION
2041 *	Returns a string for the specified producer type
2042 *	13.4.8.2 Notice
2043 *	13.4.8.3 InformInfo
2044 *
2045 * SYNOPSIS
2046 */
2047 static inline const char *OSM_API
ib_get_producer_type_str(IN ib_net32_t producer_type)2048 ib_get_producer_type_str(IN ib_net32_t producer_type)
2049 {
2050 	if (cl_ntoh32(producer_type) >
2051 	    CL_NTOH32(IB_NOTICE_PRODUCER_TYPE_CLASS_MGR))
2052 		producer_type = 0;
2053 	return (__ib_producer_type_str[cl_ntoh32(producer_type)]);
2054 }
2055 
2056 /*
2057 * PARAMETERS
2058 *	producer_type
2059 *		[in] Encoded producer type from the Notice attribute
2060 
2061 * RETURN VALUES
2062 *	Pointer to the producer type string.
2063 *
2064 * NOTES
2065 *
2066 * SEE ALSO
2067 * ib_notice_get_prod_type
2068 *********/
2069 
2070 static const char *const __ib_port_state_str[] = {
2071 	"No State Change (NOP)",
2072 	"DOWN",
2073 	"INIT",
2074 	"ARMED",
2075 	"ACTIVE",
2076 	"ACTDEFER",
2077 	"UNKNOWN"
2078 };
2079 
2080 /****f* IBA Base: Types/ib_get_port_state_str
2081 * NAME
2082 *	ib_get_port_state_str
2083 *
2084 * DESCRIPTION
2085 *	Returns a string for the specified port state.
2086 *
2087 * SYNOPSIS
2088 */
ib_get_port_state_str(IN uint8_t port_state)2089 static inline const char *OSM_API ib_get_port_state_str(IN uint8_t port_state)
2090 {
2091 	if (port_state > IB_LINK_ACTIVE)
2092 		port_state = IB_LINK_ACTIVE + 1;
2093 	return (__ib_port_state_str[port_state]);
2094 }
2095 
2096 /*
2097 * PARAMETERS
2098 *	port_state
2099 *		[in] Encoded port state as returned in the PortInfo attribute.
2100 
2101 * RETURN VALUES
2102 *	Pointer to the port state string.
2103 *
2104 * NOTES
2105 *
2106 * SEE ALSO
2107 * ib_port_info_t
2108 *********/
2109 
2110 /****f* IBA Base: Types/ib_get_port_state_from_str
2111 * NAME
2112 *	ib_get_port_state_from_str
2113 *
2114 * DESCRIPTION
2115 *	Returns a string for the specified port state.
2116 *
2117 * SYNOPSIS
2118 */
2119 static inline uint8_t OSM_API
ib_get_port_state_from_str(IN char * p_port_state_str)2120 ib_get_port_state_from_str(IN char *p_port_state_str)
2121 {
2122 	if (!strncmp(p_port_state_str, "No State Change (NOP)", 12))
2123 		return (0);
2124 	else if (!strncmp(p_port_state_str, "DOWN", 4))
2125 		return (1);
2126 	else if (!strncmp(p_port_state_str, "INIT", 4))
2127 		return (2);
2128 	else if (!strncmp(p_port_state_str, "ARMED", 5))
2129 		return (3);
2130 	else if (!strncmp(p_port_state_str, "ACTIVE", 6))
2131 		return (4);
2132 	else if (!strncmp(p_port_state_str, "ACTDEFER", 8))
2133 		return (5);
2134 	return (6);
2135 }
2136 
2137 /*
2138 * PARAMETERS
2139 *	p_port_state_str
2140 *		[in] A string matching one returned by ib_get_port_state_str
2141 *
2142 * RETURN VALUES
2143 *	The appropriate code.
2144 *
2145 * NOTES
2146 *
2147 * SEE ALSO
2148 *	ib_port_info_t
2149 *********/
2150 
2151 /****d* IBA Base: Constants/Join States
2152 * NAME
2153 *	Join States
2154 *
2155 * DESCRIPTION
2156 *	Defines the join state flags for multicast group management.
2157 *
2158 * SOURCE
2159 */
2160 #define IB_JOIN_STATE_FULL		1
2161 #define IB_JOIN_STATE_NON		2
2162 #define IB_JOIN_STATE_SEND_ONLY		4
2163 /**********/
2164 
2165 /****f* IBA Base: Types/ib_pkey_get_base
2166 * NAME
2167 *	ib_pkey_get_base
2168 *
2169 * DESCRIPTION
2170 *	Returns the base P_Key value with the membership bit stripped.
2171 *
2172 * SYNOPSIS
2173 */
ib_pkey_get_base(IN const ib_net16_t pkey)2174 static inline ib_net16_t OSM_API ib_pkey_get_base(IN const ib_net16_t pkey)
2175 {
2176 	return ((ib_net16_t) (pkey & IB_PKEY_BASE_MASK));
2177 }
2178 
2179 /*
2180 * PARAMETERS
2181 *	pkey
2182 *		[in] P_Key value
2183 *
2184 * RETURN VALUE
2185 *	Returns the base P_Key value with the membership bit stripped.
2186 *
2187 * NOTES
2188 *
2189 * SEE ALSO
2190 *********/
2191 
2192 /****f* IBA Base: Types/ib_pkey_is_full_member
2193 * NAME
2194 *	ib_pkey_is_full_member
2195 *
2196 * DESCRIPTION
2197 *	Indicates if the port is a full member of the partition.
2198 *
2199 * SYNOPSIS
2200 */
ib_pkey_is_full_member(IN const ib_net16_t pkey)2201 static inline boolean_t OSM_API ib_pkey_is_full_member(IN const ib_net16_t pkey)
2202 {
2203 	return ((pkey & IB_PKEY_TYPE_MASK) == IB_PKEY_TYPE_MASK);
2204 }
2205 
2206 /*
2207 * PARAMETERS
2208 *	pkey
2209 *		[in] P_Key value
2210 *
2211 * RETURN VALUE
2212 *	TRUE if the port is a full member of the partition.
2213 *	FALSE otherwise.
2214 *
2215 * NOTES
2216 *
2217 * SEE ALSO
2218 * ib_pkey_get_base, ib_net16_t
2219 *********/
2220 
2221 /****f* IBA Base: Types/ib_pkey_is_invalid
2222 * NAME
2223 *	ib_pkey_is_invalid
2224 *
2225 * DESCRIPTION
2226 *	Returns TRUE if the given P_Key is an invalid P_Key
2227 *  C10-116: the CI shall regard a P_Key as invalid if its low-order
2228 *           15 bits are all zero...
2229 *
2230 * SYNOPSIS
2231 */
ib_pkey_is_invalid(IN const ib_net16_t pkey)2232 static inline boolean_t OSM_API ib_pkey_is_invalid(IN const ib_net16_t pkey)
2233 {
2234 	return ib_pkey_get_base(pkey) == 0x0000 ? TRUE : FALSE;
2235 }
2236 
2237 /*
2238 * PARAMETERS
2239 *	pkey
2240 *		[in] P_Key value
2241 *
2242 * RETURN VALUE
2243 *	Returns the base P_Key value with the membership bit stripped.
2244 *
2245 * NOTES
2246 *
2247 * SEE ALSO
2248 *********/
2249 
2250 /****d* IBA Base: Types/ib_gid_t
2251 * NAME
2252 *	ib_gid_t
2253 *
2254 * DESCRIPTION
2255 *
2256 * SYNOPSIS
2257 */
2258 #include <complib/cl_packon.h>
2259 typedef union _ib_gid {
2260 	uint8_t raw[16];
2261 	struct _ib_gid_unicast {
2262 		ib_gid_prefix_t prefix;
2263 		ib_net64_t interface_id;
2264 	} PACK_SUFFIX unicast;
2265 	struct _ib_gid_multicast {
2266 		uint8_t header[2];
2267 		uint8_t raw_group_id[14];
2268 	} PACK_SUFFIX multicast;
2269 } PACK_SUFFIX ib_gid_t;
2270 #include <complib/cl_packoff.h>
2271 /*
2272 * FIELDS
2273 *	raw
2274 *		GID represented as an unformated byte array.
2275 *
2276 *	unicast
2277 *		Typical unicast representation with subnet prefix and
2278 *		port GUID.
2279 *
2280 *	multicast
2281 *		Representation for multicast use.
2282 *
2283 * SEE ALSO
2284 *********/
2285 
2286 /****f* IBA Base: Types/ib_gid_is_multicast
2287 * NAME
2288 *	ib_gid_is_multicast
2289 *
2290 * DESCRIPTION
2291 *       Returns a boolean indicating whether a GID is a multicast GID.
2292 *
2293 * SYNOPSIS
2294 */
ib_gid_is_multicast(IN const ib_gid_t * p_gid)2295 static inline boolean_t OSM_API ib_gid_is_multicast(IN const ib_gid_t * p_gid)
2296 {
2297 	return (p_gid->raw[0] == 0xFF);
2298 }
2299 
2300 /****f* IBA Base: Types/ib_gid_get_scope
2301 * NAME
2302 *	ib_gid_get_scope
2303 *
2304 * DESCRIPTION
2305 *	Returns scope of (assumed) multicast GID.
2306 *
2307 * SYNOPSIS
2308 */
ib_mgid_get_scope(IN const ib_gid_t * p_gid)2309 static inline uint8_t OSM_API ib_mgid_get_scope(IN const ib_gid_t * p_gid)
2310 {
2311 	return (p_gid->raw[1] & 0x0F);
2312 }
2313 
2314 /****f* IBA Base: Types/ib_gid_set_scope
2315 * NAME
2316 *	ib_gid_set_scope
2317 *
2318 * DESCRIPTION
2319 *	Sets scope of (assumed) multicast GID.
2320 *
2321 * SYNOPSIS
2322 */
2323 static inline void OSM_API
ib_mgid_set_scope(IN ib_gid_t * const p_gid,IN const uint8_t scope)2324 ib_mgid_set_scope(IN ib_gid_t * const p_gid, IN const uint8_t scope)
2325 {
2326 	p_gid->raw[1] &= 0xF0;
2327 	p_gid->raw[1] |= scope & 0x0F;
2328 }
2329 
2330 /****f* IBA Base: Types/ib_gid_set_default
2331 * NAME
2332 *	ib_gid_set_default
2333 *
2334 * DESCRIPTION
2335 *	Sets a GID to the default value.
2336 *
2337 * SYNOPSIS
2338 */
2339 static inline void OSM_API
ib_gid_set_default(IN ib_gid_t * const p_gid,IN const ib_net64_t interface_id)2340 ib_gid_set_default(IN ib_gid_t * const p_gid, IN const ib_net64_t interface_id)
2341 {
2342 	p_gid->unicast.prefix = IB_DEFAULT_SUBNET_PREFIX;
2343 	p_gid->unicast.interface_id = interface_id;
2344 }
2345 
2346 /*
2347 * PARAMETERS
2348 *	p_gid
2349 *		[in] Pointer to the GID object.
2350 *
2351 *	interface_id
2352 *		[in] Manufacturer assigned EUI64 value of a port.
2353 *
2354 * RETURN VALUES
2355 *	None.
2356 *
2357 * NOTES
2358 *
2359 * SEE ALSO
2360 *	ib_gid_t
2361 *********/
2362 
2363 /****f* IBA Base: Types/ib_gid_get_subnet_prefix
2364 * NAME
2365 *	ib_gid_get_subnet_prefix
2366 *
2367 * DESCRIPTION
2368 *	Gets the subnet prefix from a GID.
2369 *
2370 * SYNOPSIS
2371 */
2372 static inline ib_net64_t OSM_API
ib_gid_get_subnet_prefix(IN const ib_gid_t * const p_gid)2373 ib_gid_get_subnet_prefix(IN const ib_gid_t * const p_gid)
2374 {
2375 	return (p_gid->unicast.prefix);
2376 }
2377 
2378 /*
2379 * PARAMETERS
2380 *	p_gid
2381 *		[in] Pointer to the GID object.
2382 *
2383 * RETURN VALUES
2384 *	64-bit subnet prefix value.
2385 *
2386 * NOTES
2387 *
2388 * SEE ALSO
2389 *	ib_gid_t
2390 *********/
2391 
2392 /****f* IBA Base: Types/ib_gid_is_link_local
2393 * NAME
2394 *	ib_gid_is_link_local
2395 *
2396 * DESCRIPTION
2397 *	Returns TRUE if the unicast GID scoping indicates link local,
2398 *	FALSE otherwise.
2399 *
2400 * SYNOPSIS
2401 */
2402 static inline boolean_t OSM_API
ib_gid_is_link_local(IN const ib_gid_t * const p_gid)2403 ib_gid_is_link_local(IN const ib_gid_t * const p_gid)
2404 {
2405 	return ((ib_gid_get_subnet_prefix(p_gid) &
2406 		 CL_HTON64(0xFFC0000000000000ULL)) == IB_DEFAULT_SUBNET_PREFIX);
2407 }
2408 
2409 /*
2410 * PARAMETERS
2411 *	p_gid
2412 *		[in] Pointer to the GID object.
2413 *
2414 * RETURN VALUES
2415 *	Returns TRUE if the unicast GID scoping indicates link local,
2416 *	FALSE otherwise.
2417 *
2418 * NOTES
2419 *
2420 * SEE ALSO
2421 *	ib_gid_t
2422 *********/
2423 
2424 /****f* IBA Base: Types/ib_gid_is_site_local
2425 * NAME
2426 *	ib_gid_is_site_local
2427 *
2428 * DESCRIPTION
2429 *	Returns TRUE if the unicast GID scoping indicates site local,
2430 *	FALSE otherwise.
2431 *
2432 * SYNOPSIS
2433 */
2434 static inline boolean_t OSM_API
ib_gid_is_site_local(IN const ib_gid_t * const p_gid)2435 ib_gid_is_site_local(IN const ib_gid_t * const p_gid)
2436 {
2437 	return ((ib_gid_get_subnet_prefix(p_gid) &
2438 		 CL_HTON64(0xFFFFFFFFFFFF0000ULL)) ==
2439 		CL_HTON64(0xFEC0000000000000ULL));
2440 }
2441 
2442 /*
2443 * PARAMETERS
2444 *	p_gid
2445 *		[in] Pointer to the GID object.
2446 *
2447 * RETURN VALUES
2448 *	Returns TRUE if the unicast GID scoping indicates site local,
2449 *	FALSE otherwise.
2450 *
2451 * NOTES
2452 *
2453 * SEE ALSO
2454 *	ib_gid_t
2455 *********/
2456 
2457 /****f* IBA Base: Types/ib_gid_get_guid
2458 * NAME
2459 *	ib_gid_get_guid
2460 *
2461 * DESCRIPTION
2462 *	Gets the guid from a GID.
2463 *
2464 * SYNOPSIS
2465 */
2466 static inline ib_net64_t OSM_API
ib_gid_get_guid(IN const ib_gid_t * const p_gid)2467 ib_gid_get_guid(IN const ib_gid_t * const p_gid)
2468 {
2469 	return (p_gid->unicast.interface_id);
2470 }
2471 
2472 /*
2473 * PARAMETERS
2474 *	p_gid
2475 *		[in] Pointer to the GID object.
2476 *
2477 * RETURN VALUES
2478 *	64-bit GUID value.
2479 *
2480 * NOTES
2481 *
2482 * SEE ALSO
2483 *	ib_gid_t
2484 *********/
2485 
2486 /****s* IBA Base: Types/ib_path_rec_t
2487 * NAME
2488 *	ib_path_rec_t
2489 *
2490 * DESCRIPTION
2491 *	Path records encapsulate the properties of a given
2492 *	route between two end-points on a subnet.
2493 *
2494 * SYNOPSIS
2495 */
2496 #include <complib/cl_packon.h>
2497 typedef struct _ib_path_rec {
2498 	ib_net64_t service_id;
2499 	ib_gid_t dgid;
2500 	ib_gid_t sgid;
2501 	ib_net16_t dlid;
2502 	ib_net16_t slid;
2503 	ib_net32_t hop_flow_raw;
2504 	uint8_t tclass;
2505 	uint8_t num_path;
2506 	ib_net16_t pkey;
2507 	ib_net16_t qos_class_sl;
2508 	uint8_t mtu;
2509 	uint8_t rate;
2510 	uint8_t pkt_life;
2511 	uint8_t preference;
2512 	uint8_t resv2[6];
2513 } PACK_SUFFIX ib_path_rec_t;
2514 #include <complib/cl_packoff.h>
2515 /*
2516 * FIELDS
2517 *	service_id
2518 *		Service ID for QoS.
2519 *
2520 *	dgid
2521 *		GID of destination port.
2522 *
2523 *	sgid
2524 *		GID of source port.
2525 *
2526 *	dlid
2527 *		LID of destination port.
2528 *
2529 *	slid
2530 *		LID of source port.
2531 *
2532 *	hop_flow_raw
2533 *		Global routing parameters: hop count, flow label and raw bit.
2534 *
2535 *	tclass
2536 *		Another global routing parameter.
2537 *
2538 *	num_path
2539 *		Reversible path - 1 bit to say if path is reversible.
2540 *		num_path [6:0] In queries, maximum number of paths to return.
2541 *		In responses, undefined.
2542 *
2543 *	pkey
2544 *		Partition key (P_Key) to use on this path.
2545 *
2546 *	qos_class_sl
2547 *		QoS class and service level to use on this path.
2548 *
2549 *	mtu
2550 *		MTU and MTU selector fields to use on this path
2551 *
2552 *	rate
2553 *		Rate and rate selector fields to use on this path.
2554 *
2555 *	pkt_life
2556 *		Packet lifetime
2557 *
2558 *	preference
2559 *		Indicates the relative merit of this path versus other path
2560 *		records returned from the SA.  Lower numbers are better.
2561 *
2562 *	resv2
2563 *		Reserved bytes.
2564 * SEE ALSO
2565 *********/
2566 
2567 /* Path Record Component Masks */
2568 #define  IB_PR_COMPMASK_SERVICEID_MSB     (CL_HTON64(((uint64_t)1)<<0))
2569 #define  IB_PR_COMPMASK_SERVICEID_LSB     (CL_HTON64(((uint64_t)1)<<1))
2570 #define  IB_PR_COMPMASK_DGID              (CL_HTON64(((uint64_t)1)<<2))
2571 #define  IB_PR_COMPMASK_SGID              (CL_HTON64(((uint64_t)1)<<3))
2572 #define  IB_PR_COMPMASK_DLID              (CL_HTON64(((uint64_t)1)<<4))
2573 #define  IB_PR_COMPMASK_SLID              (CL_HTON64(((uint64_t)1)<<5))
2574 #define  IB_PR_COMPMASK_RAWTRAFFIC        (CL_HTON64(((uint64_t)1)<<6))
2575 #define  IB_PR_COMPMASK_RESV0             (CL_HTON64(((uint64_t)1)<<7))
2576 #define  IB_PR_COMPMASK_FLOWLABEL         (CL_HTON64(((uint64_t)1)<<8))
2577 #define  IB_PR_COMPMASK_HOPLIMIT          (CL_HTON64(((uint64_t)1)<<9))
2578 #define  IB_PR_COMPMASK_TCLASS            (CL_HTON64(((uint64_t)1)<<10))
2579 #define  IB_PR_COMPMASK_REVERSIBLE        (CL_HTON64(((uint64_t)1)<<11))
2580 #define  IB_PR_COMPMASK_NUMBPATH          (CL_HTON64(((uint64_t)1)<<12))
2581 #define  IB_PR_COMPMASK_PKEY              (CL_HTON64(((uint64_t)1)<<13))
2582 #define  IB_PR_COMPMASK_QOS_CLASS         (CL_HTON64(((uint64_t)1)<<14))
2583 #define  IB_PR_COMPMASK_SL                (CL_HTON64(((uint64_t)1)<<15))
2584 #define  IB_PR_COMPMASK_MTUSELEC          (CL_HTON64(((uint64_t)1)<<16))
2585 #define  IB_PR_COMPMASK_MTU               (CL_HTON64(((uint64_t)1)<<17))
2586 #define  IB_PR_COMPMASK_RATESELEC         (CL_HTON64(((uint64_t)1)<<18))
2587 #define  IB_PR_COMPMASK_RATE              (CL_HTON64(((uint64_t)1)<<19))
2588 #define  IB_PR_COMPMASK_PKTLIFETIMESELEC  (CL_HTON64(((uint64_t)1)<<20))
2589 #define  IB_PR_COMPMASK_PKTLIFETIME       (CL_HTON64(((uint64_t)1)<<21))
2590 
2591 #define  IB_PR_COMPMASK_SERVICEID (IB_PR_COMPMASK_SERVICEID_MSB | \
2592 				   IB_PR_COMPMASK_SERVICEID_LSB)
2593 
2594 /* Link Record Component Masks */
2595 #define IB_LR_COMPMASK_FROM_LID           (CL_HTON64(((uint64_t)1)<<0))
2596 #define IB_LR_COMPMASK_FROM_PORT          (CL_HTON64(((uint64_t)1)<<1))
2597 #define IB_LR_COMPMASK_TO_PORT            (CL_HTON64(((uint64_t)1)<<2))
2598 #define IB_LR_COMPMASK_TO_LID             (CL_HTON64(((uint64_t)1)<<3))
2599 
2600 /* VL Arbitration Record Masks */
2601 #define IB_VLA_COMPMASK_LID               (CL_HTON64(((uint64_t)1)<<0))
2602 #define IB_VLA_COMPMASK_OUT_PORT          (CL_HTON64(((uint64_t)1)<<1))
2603 #define IB_VLA_COMPMASK_BLOCK             (CL_HTON64(((uint64_t)1)<<2))
2604 
2605 /* SLtoVL Mapping Record Masks */
2606 #define IB_SLVL_COMPMASK_LID              (CL_HTON64(((uint64_t)1)<<0))
2607 #define IB_SLVL_COMPMASK_IN_PORT          (CL_HTON64(((uint64_t)1)<<1))
2608 #define IB_SLVL_COMPMASK_OUT_PORT         (CL_HTON64(((uint64_t)1)<<2))
2609 
2610 /* P_Key Table Record Masks */
2611 #define IB_PKEY_COMPMASK_LID              (CL_HTON64(((uint64_t)1)<<0))
2612 #define IB_PKEY_COMPMASK_BLOCK            (CL_HTON64(((uint64_t)1)<<1))
2613 #define IB_PKEY_COMPMASK_PORT             (CL_HTON64(((uint64_t)1)<<2))
2614 
2615 /* Switch Info Record Masks */
2616 #define IB_SWIR_COMPMASK_LID		  (CL_HTON64(((uint64_t)1)<<0))
2617 #define IB_SWIR_COMPMASK_RESERVED1	  (CL_HTON64(((uint64_t)1)<<1))
2618 
2619 /* LFT Record Masks */
2620 #define IB_LFTR_COMPMASK_LID              (CL_HTON64(((uint64_t)1)<<0))
2621 #define IB_LFTR_COMPMASK_BLOCK            (CL_HTON64(((uint64_t)1)<<1))
2622 
2623 /* MFT Record Masks */
2624 #define IB_MFTR_COMPMASK_LID		  (CL_HTON64(((uint64_t)1)<<0))
2625 #define IB_MFTR_COMPMASK_POSITION	  (CL_HTON64(((uint64_t)1)<<1))
2626 #define IB_MFTR_COMPMASK_RESERVED1	  (CL_HTON64(((uint64_t)1)<<2))
2627 #define IB_MFTR_COMPMASK_BLOCK		  (CL_HTON64(((uint64_t)1)<<3))
2628 #define IB_MFTR_COMPMASK_RESERVED2	  (CL_HTON64(((uint64_t)1)<<4))
2629 
2630 /* NodeInfo Record Masks */
2631 #define IB_NR_COMPMASK_LID                (CL_HTON64(((uint64_t)1)<<0))
2632 #define IB_NR_COMPMASK_RESERVED1          (CL_HTON64(((uint64_t)1)<<1))
2633 #define IB_NR_COMPMASK_BASEVERSION        (CL_HTON64(((uint64_t)1)<<2))
2634 #define IB_NR_COMPMASK_CLASSVERSION       (CL_HTON64(((uint64_t)1)<<3))
2635 #define IB_NR_COMPMASK_NODETYPE           (CL_HTON64(((uint64_t)1)<<4))
2636 #define IB_NR_COMPMASK_NUMPORTS           (CL_HTON64(((uint64_t)1)<<5))
2637 #define IB_NR_COMPMASK_SYSIMAGEGUID       (CL_HTON64(((uint64_t)1)<<6))
2638 #define IB_NR_COMPMASK_NODEGUID           (CL_HTON64(((uint64_t)1)<<7))
2639 #define IB_NR_COMPMASK_PORTGUID           (CL_HTON64(((uint64_t)1)<<8))
2640 #define IB_NR_COMPMASK_PARTCAP            (CL_HTON64(((uint64_t)1)<<9))
2641 #define IB_NR_COMPMASK_DEVID              (CL_HTON64(((uint64_t)1)<<10))
2642 #define IB_NR_COMPMASK_REV                (CL_HTON64(((uint64_t)1)<<11))
2643 #define IB_NR_COMPMASK_PORTNUM            (CL_HTON64(((uint64_t)1)<<12))
2644 #define IB_NR_COMPMASK_VENDID             (CL_HTON64(((uint64_t)1)<<13))
2645 #define IB_NR_COMPMASK_NODEDESC           (CL_HTON64(((uint64_t)1)<<14))
2646 
2647 /* Service Record Component Masks Sec 15.2.5.14 Ver 1.1*/
2648 #define IB_SR_COMPMASK_SID                (CL_HTON64(((uint64_t)1)<<0))
2649 #define IB_SR_COMPMASK_SGID               (CL_HTON64(((uint64_t)1)<<1))
2650 #define IB_SR_COMPMASK_SPKEY              (CL_HTON64(((uint64_t)1)<<2))
2651 #define IB_SR_COMPMASK_RES1               (CL_HTON64(((uint64_t)1)<<3))
2652 #define IB_SR_COMPMASK_SLEASE             (CL_HTON64(((uint64_t)1)<<4))
2653 #define IB_SR_COMPMASK_SKEY               (CL_HTON64(((uint64_t)1)<<5))
2654 #define IB_SR_COMPMASK_SNAME              (CL_HTON64(((uint64_t)1)<<6))
2655 #define IB_SR_COMPMASK_SDATA8_0           (CL_HTON64(((uint64_t)1)<<7))
2656 #define IB_SR_COMPMASK_SDATA8_1           (CL_HTON64(((uint64_t)1)<<8))
2657 #define IB_SR_COMPMASK_SDATA8_2           (CL_HTON64(((uint64_t)1)<<9))
2658 #define IB_SR_COMPMASK_SDATA8_3           (CL_HTON64(((uint64_t)1)<<10))
2659 #define IB_SR_COMPMASK_SDATA8_4           (CL_HTON64(((uint64_t)1)<<11))
2660 #define IB_SR_COMPMASK_SDATA8_5           (CL_HTON64(((uint64_t)1)<<12))
2661 #define IB_SR_COMPMASK_SDATA8_6           (CL_HTON64(((uint64_t)1)<<13))
2662 #define IB_SR_COMPMASK_SDATA8_7           (CL_HTON64(((uint64_t)1)<<14))
2663 #define IB_SR_COMPMASK_SDATA8_8           (CL_HTON64(((uint64_t)1)<<15))
2664 #define IB_SR_COMPMASK_SDATA8_9           (CL_HTON64(((uint64_t)1)<<16))
2665 #define IB_SR_COMPMASK_SDATA8_10       (CL_HTON64(((uint64_t)1)<<17))
2666 #define IB_SR_COMPMASK_SDATA8_11       (CL_HTON64(((uint64_t)1)<<18))
2667 #define IB_SR_COMPMASK_SDATA8_12       (CL_HTON64(((uint64_t)1)<<19))
2668 #define IB_SR_COMPMASK_SDATA8_13       (CL_HTON64(((uint64_t)1)<<20))
2669 #define IB_SR_COMPMASK_SDATA8_14       (CL_HTON64(((uint64_t)1)<<21))
2670 #define IB_SR_COMPMASK_SDATA8_15       (CL_HTON64(((uint64_t)1)<<22))
2671 #define IB_SR_COMPMASK_SDATA16_0       (CL_HTON64(((uint64_t)1)<<23))
2672 #define IB_SR_COMPMASK_SDATA16_1       (CL_HTON64(((uint64_t)1)<<24))
2673 #define IB_SR_COMPMASK_SDATA16_2       (CL_HTON64(((uint64_t)1)<<25))
2674 #define IB_SR_COMPMASK_SDATA16_3       (CL_HTON64(((uint64_t)1)<<26))
2675 #define IB_SR_COMPMASK_SDATA16_4       (CL_HTON64(((uint64_t)1)<<27))
2676 #define IB_SR_COMPMASK_SDATA16_5       (CL_HTON64(((uint64_t)1)<<28))
2677 #define IB_SR_COMPMASK_SDATA16_6       (CL_HTON64(((uint64_t)1)<<29))
2678 #define IB_SR_COMPMASK_SDATA16_7       (CL_HTON64(((uint64_t)1)<<30))
2679 #define IB_SR_COMPMASK_SDATA32_0       (CL_HTON64(((uint64_t)1)<<31))
2680 #define IB_SR_COMPMASK_SDATA32_1       (CL_HTON64(((uint64_t)1)<<32))
2681 #define IB_SR_COMPMASK_SDATA32_2       (CL_HTON64(((uint64_t)1)<<33))
2682 #define IB_SR_COMPMASK_SDATA32_3       (CL_HTON64(((uint64_t)1)<<34))
2683 #define IB_SR_COMPMASK_SDATA64_0       (CL_HTON64(((uint64_t)1)<<35))
2684 #define IB_SR_COMPMASK_SDATA64_1       (CL_HTON64(((uint64_t)1)<<36))
2685 
2686 /* Port Info Record Component Masks */
2687 #define IB_PIR_COMPMASK_LID              (CL_HTON64(((uint64_t)1)<<0))
2688 #define IB_PIR_COMPMASK_PORTNUM          (CL_HTON64(((uint64_t)1)<<1))
2689 #define IB_PIR_COMPMASK_OPTIONS		 (CL_HTON64(((uint64_t)1)<<2))
2690 #define IB_PIR_COMPMASK_MKEY             (CL_HTON64(((uint64_t)1)<<3))
2691 #define IB_PIR_COMPMASK_GIDPRE           (CL_HTON64(((uint64_t)1)<<4))
2692 #define IB_PIR_COMPMASK_BASELID          (CL_HTON64(((uint64_t)1)<<5))
2693 #define IB_PIR_COMPMASK_SMLID            (CL_HTON64(((uint64_t)1)<<6))
2694 #define IB_PIR_COMPMASK_CAPMASK          (CL_HTON64(((uint64_t)1)<<7))
2695 #define IB_PIR_COMPMASK_DIAGCODE         (CL_HTON64(((uint64_t)1)<<8))
2696 #define IB_PIR_COMPMASK_MKEYLEASEPRD     (CL_HTON64(((uint64_t)1)<<9))
2697 #define IB_PIR_COMPMASK_LOCALPORTNUM     (CL_HTON64(((uint64_t)1)<<10))
2698 #define IB_PIR_COMPMASK_LINKWIDTHENABLED (CL_HTON64(((uint64_t)1)<<11))
2699 #define IB_PIR_COMPMASK_LNKWIDTHSUPPORT  (CL_HTON64(((uint64_t)1)<<12))
2700 #define IB_PIR_COMPMASK_LNKWIDTHACTIVE   (CL_HTON64(((uint64_t)1)<<13))
2701 #define IB_PIR_COMPMASK_LNKSPEEDSUPPORT  (CL_HTON64(((uint64_t)1)<<14))
2702 #define IB_PIR_COMPMASK_PORTSTATE        (CL_HTON64(((uint64_t)1)<<15))
2703 #define IB_PIR_COMPMASK_PORTPHYSTATE     (CL_HTON64(((uint64_t)1)<<16))
2704 #define IB_PIR_COMPMASK_LINKDWNDFLTSTATE (CL_HTON64(((uint64_t)1)<<17))
2705 #define IB_PIR_COMPMASK_MKEYPROTBITS     (CL_HTON64(((uint64_t)1)<<18))
2706 #define IB_PIR_COMPMASK_RESV2            (CL_HTON64(((uint64_t)1)<<19))
2707 #define IB_PIR_COMPMASK_LMC              (CL_HTON64(((uint64_t)1)<<20))
2708 #define IB_PIR_COMPMASK_LINKSPEEDACTIVE  (CL_HTON64(((uint64_t)1)<<21))
2709 #define IB_PIR_COMPMASK_LINKSPEEDENABLE  (CL_HTON64(((uint64_t)1)<<22))
2710 #define IB_PIR_COMPMASK_NEIGHBORMTU      (CL_HTON64(((uint64_t)1)<<23))
2711 #define IB_PIR_COMPMASK_MASTERSMSL       (CL_HTON64(((uint64_t)1)<<24))
2712 #define IB_PIR_COMPMASK_VLCAP            (CL_HTON64(((uint64_t)1)<<25))
2713 #define IB_PIR_COMPMASK_INITTYPE         (CL_HTON64(((uint64_t)1)<<26))
2714 #define IB_PIR_COMPMASK_VLHIGHLIMIT      (CL_HTON64(((uint64_t)1)<<27))
2715 #define IB_PIR_COMPMASK_VLARBHIGHCAP     (CL_HTON64(((uint64_t)1)<<28))
2716 #define IB_PIR_COMPMASK_VLARBLOWCAP      (CL_HTON64(((uint64_t)1)<<29))
2717 #define IB_PIR_COMPMASK_INITTYPEREPLY    (CL_HTON64(((uint64_t)1)<<30))
2718 #define IB_PIR_COMPMASK_MTUCAP           (CL_HTON64(((uint64_t)1)<<31))
2719 #define IB_PIR_COMPMASK_VLSTALLCNT       (CL_HTON64(((uint64_t)1)<<32))
2720 #define IB_PIR_COMPMASK_HOQLIFE          (CL_HTON64(((uint64_t)1)<<33))
2721 #define IB_PIR_COMPMASK_OPVLS            (CL_HTON64(((uint64_t)1)<<34))
2722 #define IB_PIR_COMPMASK_PARENFIN         (CL_HTON64(((uint64_t)1)<<35))
2723 #define IB_PIR_COMPMASK_PARENFOUT        (CL_HTON64(((uint64_t)1)<<36))
2724 #define IB_PIR_COMPMASK_FILTERRAWIN      (CL_HTON64(((uint64_t)1)<<37))
2725 #define IB_PIR_COMPMASK_FILTERRAWOUT     (CL_HTON64(((uint64_t)1)<<38))
2726 #define IB_PIR_COMPMASK_MKEYVIO          (CL_HTON64(((uint64_t)1)<<39))
2727 #define IB_PIR_COMPMASK_PKEYVIO          (CL_HTON64(((uint64_t)1)<<40))
2728 #define IB_PIR_COMPMASK_QKEYVIO          (CL_HTON64(((uint64_t)1)<<41))
2729 #define IB_PIR_COMPMASK_GUIDCAP          (CL_HTON64(((uint64_t)1)<<42))
2730 #define IB_PIR_COMPMASK_CLIENTREREG	 (CL_HTON64(((uint64_t)1)<<43))
2731 #define IB_PIR_COMPMASK_RESV3            (CL_HTON64(((uint64_t)1)<<44))
2732 #define IB_PIR_COMPMASK_SUBNTO           (CL_HTON64(((uint64_t)1)<<45))
2733 #define IB_PIR_COMPMASK_RESV4            (CL_HTON64(((uint64_t)1)<<46))
2734 #define IB_PIR_COMPMASK_RESPTIME         (CL_HTON64(((uint64_t)1)<<47))
2735 #define IB_PIR_COMPMASK_LOCALPHYERR      (CL_HTON64(((uint64_t)1)<<48))
2736 #define IB_PIR_COMPMASK_OVERRUNERR       (CL_HTON64(((uint64_t)1)<<49))
2737 #define IB_PIR_COMPMASK_MAXCREDHINT	 (CL_HTON64(((uint64_t)1)<<50))
2738 #define IB_PIR_COMPMASK_RESV5		 (CL_HTON64(((uint64_t)1)<<51))
2739 #define IB_PIR_COMPMASK_LINKRTLAT	 (CL_HTON64(((uint64_t)1)<<52))
2740 #define IB_PIR_COMPMASK_CAPMASK2	 (CL_HTON64(((uint64_t)1)<<53))
2741 #define IB_PIR_COMPMASK_LINKSPDEXTACT	 (CL_HTON64(((uint64_t)1)<<54))
2742 #define IB_PIR_COMPMASK_LINKSPDEXTSUPP	 (CL_HTON64(((uint64_t)1)<<55))
2743 #define IB_PIR_COMPMASK_RESV7		 (CL_HTON64(((uint64_t)1)<<56))
2744 #define IB_PIR_COMPMASK_LINKSPDEXTENAB	 (CL_HTON64(((uint64_t)1)<<57))
2745 
2746 /* Multicast Member Record Component Masks */
2747 #define IB_MCR_COMPMASK_GID         (CL_HTON64(((uint64_t)1)<<0))
2748 #define IB_MCR_COMPMASK_MGID        (CL_HTON64(((uint64_t)1)<<0))
2749 #define IB_MCR_COMPMASK_PORT_GID    (CL_HTON64(((uint64_t)1)<<1))
2750 #define IB_MCR_COMPMASK_QKEY        (CL_HTON64(((uint64_t)1)<<2))
2751 #define IB_MCR_COMPMASK_MLID        (CL_HTON64(((uint64_t)1)<<3))
2752 #define IB_MCR_COMPMASK_MTU_SEL     (CL_HTON64(((uint64_t)1)<<4))
2753 #define IB_MCR_COMPMASK_MTU         (CL_HTON64(((uint64_t)1)<<5))
2754 #define IB_MCR_COMPMASK_TCLASS      (CL_HTON64(((uint64_t)1)<<6))
2755 #define IB_MCR_COMPMASK_PKEY        (CL_HTON64(((uint64_t)1)<<7))
2756 #define IB_MCR_COMPMASK_RATE_SEL    (CL_HTON64(((uint64_t)1)<<8))
2757 #define IB_MCR_COMPMASK_RATE        (CL_HTON64(((uint64_t)1)<<9))
2758 #define IB_MCR_COMPMASK_LIFE_SEL    (CL_HTON64(((uint64_t)1)<<10))
2759 #define IB_MCR_COMPMASK_LIFE        (CL_HTON64(((uint64_t)1)<<11))
2760 #define IB_MCR_COMPMASK_SL          (CL_HTON64(((uint64_t)1)<<12))
2761 #define IB_MCR_COMPMASK_FLOW        (CL_HTON64(((uint64_t)1)<<13))
2762 #define IB_MCR_COMPMASK_HOP         (CL_HTON64(((uint64_t)1)<<14))
2763 #define IB_MCR_COMPMASK_SCOPE       (CL_HTON64(((uint64_t)1)<<15))
2764 #define IB_MCR_COMPMASK_JOIN_STATE  (CL_HTON64(((uint64_t)1)<<16))
2765 #define IB_MCR_COMPMASK_PROXY       (CL_HTON64(((uint64_t)1)<<17))
2766 
2767 /* GUID Info Record Component Masks */
2768 #define IB_GIR_COMPMASK_LID		(CL_HTON64(((uint64_t)1)<<0))
2769 #define IB_GIR_COMPMASK_BLOCKNUM	(CL_HTON64(((uint64_t)1)<<1))
2770 #define IB_GIR_COMPMASK_RESV1		(CL_HTON64(((uint64_t)1)<<2))
2771 #define IB_GIR_COMPMASK_RESV2		(CL_HTON64(((uint64_t)1)<<3))
2772 #define IB_GIR_COMPMASK_GID0		(CL_HTON64(((uint64_t)1)<<4))
2773 #define IB_GIR_COMPMASK_GID1		(CL_HTON64(((uint64_t)1)<<5))
2774 #define IB_GIR_COMPMASK_GID2		(CL_HTON64(((uint64_t)1)<<6))
2775 #define IB_GIR_COMPMASK_GID3		(CL_HTON64(((uint64_t)1)<<7))
2776 #define IB_GIR_COMPMASK_GID4		(CL_HTON64(((uint64_t)1)<<8))
2777 #define IB_GIR_COMPMASK_GID5		(CL_HTON64(((uint64_t)1)<<9))
2778 #define IB_GIR_COMPMASK_GID6		(CL_HTON64(((uint64_t)1)<<10))
2779 #define IB_GIR_COMPMASK_GID7		(CL_HTON64(((uint64_t)1)<<11))
2780 
2781 /* MultiPath Record Component Masks */
2782 #define IB_MPR_COMPMASK_RAWTRAFFIC	(CL_HTON64(((uint64_t)1)<<0))
2783 #define IB_MPR_COMPMASK_RESV0		(CL_HTON64(((uint64_t)1)<<1))
2784 #define IB_MPR_COMPMASK_FLOWLABEL	(CL_HTON64(((uint64_t)1)<<2))
2785 #define IB_MPR_COMPMASK_HOPLIMIT	(CL_HTON64(((uint64_t)1)<<3))
2786 #define IB_MPR_COMPMASK_TCLASS		(CL_HTON64(((uint64_t)1)<<4))
2787 #define IB_MPR_COMPMASK_REVERSIBLE	(CL_HTON64(((uint64_t)1)<<5))
2788 #define IB_MPR_COMPMASK_NUMBPATH	(CL_HTON64(((uint64_t)1)<<6))
2789 #define IB_MPR_COMPMASK_PKEY		(CL_HTON64(((uint64_t)1)<<7))
2790 #define IB_MPR_COMPMASK_QOS_CLASS	(CL_HTON64(((uint64_t)1)<<8))
2791 #define IB_MPR_COMPMASK_SL		(CL_HTON64(((uint64_t)1)<<9))
2792 #define IB_MPR_COMPMASK_MTUSELEC	(CL_HTON64(((uint64_t)1)<<10))
2793 #define IB_MPR_COMPMASK_MTU		(CL_HTON64(((uint64_t)1)<<11))
2794 #define IB_MPR_COMPMASK_RATESELEC	(CL_HTON64(((uint64_t)1)<<12))
2795 #define IB_MPR_COMPMASK_RATE		(CL_HTON64(((uint64_t)1)<<13))
2796 #define IB_MPR_COMPMASK_PKTLIFETIMESELEC (CL_HTON64(((uint64_t)1)<<14))
2797 #define IB_MPR_COMPMASK_PKTLIFETIME	(CL_HTON64(((uint64_t)1)<<15))
2798 #define IB_MPR_COMPMASK_SERVICEID_MSB	(CL_HTON64(((uint64_t)1)<<16))
2799 #define IB_MPR_COMPMASK_INDEPSELEC	(CL_HTON64(((uint64_t)1)<<17))
2800 #define IB_MPR_COMPMASK_RESV3		(CL_HTON64(((uint64_t)1)<<18))
2801 #define IB_MPR_COMPMASK_SGIDCOUNT	(CL_HTON64(((uint64_t)1)<<19))
2802 #define IB_MPR_COMPMASK_DGIDCOUNT	(CL_HTON64(((uint64_t)1)<<20))
2803 #define IB_MPR_COMPMASK_SERVICEID_LSB	(CL_HTON64(((uint64_t)1)<<21))
2804 
2805 #define IB_MPR_COMPMASK_SERVICEID (IB_MPR_COMPMASK_SERVICEID_MSB | \
2806 				   IB_MPR_COMPMASK_SERVICEID_LSB)
2807 
2808 /* SMInfo Record Component Masks */
2809 #define IB_SMIR_COMPMASK_LID		(CL_HTON64(((uint64_t)1)<<0))
2810 #define IB_SMIR_COMPMASK_RESV0		(CL_HTON64(((uint64_t)1)<<1))
2811 #define IB_SMIR_COMPMASK_GUID		(CL_HTON64(((uint64_t)1)<<2))
2812 #define IB_SMIR_COMPMASK_SMKEY		(CL_HTON64(((uint64_t)1)<<3))
2813 #define IB_SMIR_COMPMASK_ACTCOUNT	(CL_HTON64(((uint64_t)1)<<4))
2814 #define IB_SMIR_COMPMASK_PRIORITY	(CL_HTON64(((uint64_t)1)<<5))
2815 #define IB_SMIR_COMPMASK_SMSTATE	(CL_HTON64(((uint64_t)1)<<6))
2816 
2817 /* InformInfo Record Component Masks */
2818 #define IB_IIR_COMPMASK_SUBSCRIBERGID	(CL_HTON64(((uint64_t)1)<<0))
2819 #define IB_IIR_COMPMASK_ENUM		(CL_HTON64(((uint64_t)1)<<1))
2820 #define IB_IIR_COMPMASK_RESV0		(CL_HTON64(((uint64_t)1)<<2))
2821 #define IB_IIR_COMPMASK_GID		(CL_HTON64(((uint64_t)1)<<3))
2822 #define IB_IIR_COMPMASK_LIDRANGEBEGIN	(CL_HTON64(((uint64_t)1)<<4))
2823 #define IB_IIR_COMPMASK_LIDRANGEEND	(CL_HTON64(((uint64_t)1)<<5))
2824 #define IB_IIR_COMPMASK_RESV1		(CL_HTON64(((uint64_t)1)<<6))
2825 #define IB_IIR_COMPMASK_ISGENERIC	(CL_HTON64(((uint64_t)1)<<7))
2826 #define IB_IIR_COMPMASK_SUBSCRIBE	(CL_HTON64(((uint64_t)1)<<8))
2827 #define IB_IIR_COMPMASK_TYPE		(CL_HTON64(((uint64_t)1)<<9))
2828 #define IB_IIR_COMPMASK_TRAPNUMB	(CL_HTON64(((uint64_t)1)<<10))
2829 #define IB_IIR_COMPMASK_DEVICEID	(CL_HTON64(((uint64_t)1)<<10))
2830 #define IB_IIR_COMPMASK_QPN		(CL_HTON64(((uint64_t)1)<<11))
2831 #define IB_IIR_COMPMASK_RESV2		(CL_HTON64(((uint64_t)1)<<12))
2832 #define IB_IIR_COMPMASK_RESPTIME	(CL_HTON64(((uint64_t)1)<<13))
2833 #define IB_IIR_COMPMASK_RESV3		(CL_HTON64(((uint64_t)1)<<14))
2834 #define IB_IIR_COMPMASK_PRODTYPE	(CL_HTON64(((uint64_t)1)<<15))
2835 #define IB_IIR_COMPMASK_VENDID		(CL_HTON64(((uint64_t)1)<<15))
2836 
2837 /****f* IBA Base: Types/ib_path_rec_init_local
2838 * NAME
2839 *	ib_path_rec_init_local
2840 *
2841 * DESCRIPTION
2842 *	Initializes a subnet local path record.
2843 *
2844 * SYNOPSIS
2845 */
2846 static inline void OSM_API
ib_path_rec_init_local(IN ib_path_rec_t * const p_rec,IN ib_gid_t * const p_dgid,IN ib_gid_t * const p_sgid,IN ib_net16_t dlid,IN ib_net16_t slid,IN uint8_t num_path,IN ib_net16_t pkey,IN uint8_t sl,IN uint16_t qos_class,IN uint8_t mtu_selector,IN uint8_t mtu,IN uint8_t rate_selector,IN uint8_t rate,IN uint8_t pkt_life_selector,IN uint8_t pkt_life,IN uint8_t preference)2847 ib_path_rec_init_local(IN ib_path_rec_t * const p_rec,
2848 		       IN ib_gid_t * const p_dgid,
2849 		       IN ib_gid_t * const p_sgid,
2850 		       IN ib_net16_t dlid,
2851 		       IN ib_net16_t slid,
2852 		       IN uint8_t num_path,
2853 		       IN ib_net16_t pkey,
2854 		       IN uint8_t sl,
2855 		       IN uint16_t qos_class,
2856 		       IN uint8_t mtu_selector,
2857 		       IN uint8_t mtu,
2858 		       IN uint8_t rate_selector,
2859 		       IN uint8_t rate,
2860 		       IN uint8_t pkt_life_selector,
2861 		       IN uint8_t pkt_life, IN uint8_t preference)
2862 {
2863 	p_rec->dgid = *p_dgid;
2864 	p_rec->sgid = *p_sgid;
2865 	p_rec->dlid = dlid;
2866 	p_rec->slid = slid;
2867 	p_rec->num_path = num_path;
2868 	p_rec->pkey = pkey;
2869 	p_rec->qos_class_sl = cl_hton16((sl & IB_PATH_REC_SL_MASK) |
2870 					(qos_class << 4));
2871 	p_rec->mtu = (uint8_t) ((mtu & IB_PATH_REC_BASE_MASK) |
2872 				(uint8_t) (mtu_selector << 6));
2873 	p_rec->rate = (uint8_t) ((rate & IB_PATH_REC_BASE_MASK) |
2874 				 (uint8_t) (rate_selector << 6));
2875 	p_rec->pkt_life = (uint8_t) ((pkt_life & IB_PATH_REC_BASE_MASK) |
2876 				     (uint8_t) (pkt_life_selector << 6));
2877 	p_rec->preference = preference;
2878 
2879 	/* Clear global routing fields for local path records */
2880 	p_rec->hop_flow_raw = 0;
2881 	p_rec->tclass = 0;
2882 	p_rec->service_id = 0;
2883 
2884 	memset(p_rec->resv2, 0, sizeof(p_rec->resv2));
2885 }
2886 
2887 /*
2888 * PARAMETERS
2889 *	p_rec
2890 *		[in] Pointer to the path record object.
2891 *
2892 *	dgid
2893 *		[in] GID of destination port.
2894 *
2895 *	sgid
2896 *		[in] GID of source port.
2897 *
2898 *	dlid
2899 *		[in] LID of destination port.
2900 *
2901 *	slid
2902 *		[in] LID of source port.
2903 *
2904 *	num_path
2905 *		[in] Reversible path - 1 bit to say if path is reversible.
2906 *		num_path [6:0] In queries, maximum number of paths to return.
2907 *		In responses, undefined.
2908 *
2909 *	pkey
2910 *		[in] Partition key (P_Key) to use on this path.
2911 *
2912 *	qos_class
2913 *		[in] QoS class to use on this path.  Lower 12-bits are valid.
2914 *
2915 *	sl
2916 *		[in] Service level to use on this path.  Lower 4-bits are valid.
2917 *
2918 *	mtu_selector
2919 *		[in] Encoded MTU selector value to use on this path
2920 *
2921 *	mtu
2922 *		[in] Encoded MTU to use on this path
2923 *
2924 *	rate_selector
2925 *		[in] Encoded rate selector value to use on this path.
2926 *
2927 *	rate
2928 *		[in] Encoded rate to use on this path.
2929 *
2930 *	pkt_life_selector
2931 *		[in] Encoded Packet selector value lifetime for this path.
2932 *
2933 *	pkt_life
2934 *		[in] Encoded Packet lifetime for this path.
2935 *
2936 *	preference
2937 *		[in] Indicates the relative merit of this path versus other path
2938 *		records returned from the SA.  Lower numbers are better.
2939 *
2940 * RETURN VALUES
2941 *	None.
2942 *
2943 * NOTES
2944 *
2945 * SEE ALSO
2946 *	ib_gid_t
2947 *********/
2948 
2949 /****f* IBA Base: Types/ib_path_rec_num_path
2950 * NAME
2951 *	ib_path_rec_num_path
2952 *
2953 * DESCRIPTION
2954 *	Get max number of paths to return.
2955 *
2956 * SYNOPSIS
2957 */
2958 static inline uint8_t OSM_API
ib_path_rec_num_path(IN const ib_path_rec_t * const p_rec)2959 ib_path_rec_num_path(IN const ib_path_rec_t * const p_rec)
2960 {
2961 	return (p_rec->num_path & 0x7F);
2962 }
2963 
2964 /*
2965 * PARAMETERS
2966 *	p_rec
2967 *		[in] Pointer to the path record object.
2968 *
2969 * RETURN VALUES
2970 *	Maximum number of paths to return for each unique SGID_DGID combination.
2971 *
2972 * NOTES
2973 *
2974 * SEE ALSO
2975 *	ib_path_rec_t
2976 *********/
2977 
2978 /****f* IBA Base: Types/ib_path_rec_set_sl
2979 * NAME
2980 *	ib_path_rec_set_sl
2981 *
2982 * DESCRIPTION
2983 *	Set path service level.
2984 *
2985 * SYNOPSIS
2986 */
2987 static inline void OSM_API
ib_path_rec_set_sl(IN ib_path_rec_t * const p_rec,IN const uint8_t sl)2988 ib_path_rec_set_sl(IN ib_path_rec_t * const p_rec, IN const uint8_t sl)
2989 {
2990 	p_rec->qos_class_sl =
2991 	    (p_rec->qos_class_sl & CL_HTON16(IB_PATH_REC_QOS_CLASS_MASK)) |
2992 	    cl_hton16(sl & IB_PATH_REC_SL_MASK);
2993 }
2994 
2995 /*
2996 * PARAMETERS
2997 *	p_rec
2998 *		[in] Pointer to the path record object.
2999 *
3000 *	sl
3001 *		[in] Service level to set.
3002 *
3003 * RETURN VALUES
3004 *	None
3005 *
3006 * NOTES
3007 *
3008 * SEE ALSO
3009 *	ib_path_rec_t
3010 *********/
3011 
3012 /****f* IBA Base: Types/ib_path_rec_sl
3013 * NAME
3014 *	ib_path_rec_sl
3015 *
3016 * DESCRIPTION
3017 *	Get path service level.
3018 *
3019 * SYNOPSIS
3020 */
3021 static inline uint8_t OSM_API
ib_path_rec_sl(IN const ib_path_rec_t * const p_rec)3022 ib_path_rec_sl(IN const ib_path_rec_t * const p_rec)
3023 {
3024 	return (uint8_t)(cl_ntoh16(p_rec->qos_class_sl) & IB_PATH_REC_SL_MASK);
3025 }
3026 
3027 /*
3028 * PARAMETERS
3029 *	p_rec
3030 *		[in] Pointer to the path record object.
3031 *
3032 * RETURN VALUES
3033 *	SL.
3034 *
3035 * NOTES
3036 *
3037 * SEE ALSO
3038 *	ib_path_rec_t
3039 *********/
3040 
3041 /****f* IBA Base: Types/ib_path_rec_set_qos_class
3042 * NAME
3043 *	ib_path_rec_set_qos_class
3044 *
3045 * DESCRIPTION
3046 *	Set path QoS class.
3047 *
3048 * SYNOPSIS
3049 */
3050 static inline void OSM_API
ib_path_rec_set_qos_class(IN ib_path_rec_t * const p_rec,IN const uint16_t qos_class)3051 ib_path_rec_set_qos_class(IN ib_path_rec_t * const p_rec,
3052 			  IN const uint16_t qos_class)
3053 {
3054 	p_rec->qos_class_sl =
3055 	    (p_rec->qos_class_sl & CL_HTON16(IB_PATH_REC_SL_MASK)) |
3056 	    cl_hton16(qos_class << 4);
3057 }
3058 
3059 /*
3060 * PARAMETERS
3061 *	p_rec
3062 *		[in] Pointer to the path record object.
3063 *
3064 *	qos_class
3065 *		[in] QoS class to set.
3066 *
3067 * RETURN VALUES
3068 *	None
3069 *
3070 * NOTES
3071 *
3072 * SEE ALSO
3073 *	ib_path_rec_t
3074 *********/
3075 
3076 /****f* IBA Base: Types/ib_path_rec_qos_class
3077 * NAME
3078 *	ib_path_rec_qos_class
3079 *
3080 * DESCRIPTION
3081 *	Get QoS class.
3082 *
3083 * SYNOPSIS
3084 */
3085 static inline uint16_t OSM_API
ib_path_rec_qos_class(IN const ib_path_rec_t * const p_rec)3086 ib_path_rec_qos_class(IN const ib_path_rec_t * const p_rec)
3087 {
3088 	return (cl_ntoh16(p_rec->qos_class_sl) >> 4);
3089 }
3090 
3091 /*
3092 * PARAMETERS
3093 *	p_rec
3094 *		[in] Pointer to the path record object.
3095 *
3096 * RETURN VALUES
3097 *	QoS class of the path record.
3098 *
3099 * NOTES
3100 *
3101 * SEE ALSO
3102 *	ib_path_rec_t
3103 *********/
3104 
3105 /****f* IBA Base: Types/ib_path_rec_mtu
3106 * NAME
3107 *	ib_path_rec_mtu
3108 *
3109 * DESCRIPTION
3110 *	Get encoded path MTU.
3111 *
3112 * SYNOPSIS
3113 */
3114 static inline uint8_t OSM_API
ib_path_rec_mtu(IN const ib_path_rec_t * const p_rec)3115 ib_path_rec_mtu(IN const ib_path_rec_t * const p_rec)
3116 {
3117 	return ((uint8_t) (p_rec->mtu & IB_PATH_REC_BASE_MASK));
3118 }
3119 
3120 /*
3121 * PARAMETERS
3122 *	p_rec
3123 *		[in] Pointer to the path record object.
3124 *
3125 * RETURN VALUES
3126 *	Encoded path MTU.
3127 *		1: 256
3128 *		2: 512
3129 *		3: 1024
3130 *		4: 2048
3131 *		5: 4096
3132 *		others: reserved
3133 *
3134 * NOTES
3135 *
3136 * SEE ALSO
3137 *	ib_path_rec_t
3138 *********/
3139 
3140 /****f* IBA Base: Types/ib_path_rec_mtu_sel
3141 * NAME
3142 *	ib_path_rec_mtu_sel
3143 *
3144 * DESCRIPTION
3145 *	Get encoded path MTU selector.
3146 *
3147 * SYNOPSIS
3148 */
3149 static inline uint8_t OSM_API
ib_path_rec_mtu_sel(IN const ib_path_rec_t * const p_rec)3150 ib_path_rec_mtu_sel(IN const ib_path_rec_t * const p_rec)
3151 {
3152 	return ((uint8_t) ((p_rec->mtu & IB_PATH_REC_SELECTOR_MASK) >> 6));
3153 }
3154 
3155 /*
3156 * PARAMETERS
3157 *	p_rec
3158 *		[in] Pointer to the path record object.
3159 *
3160 * RETURN VALUES
3161 *	Encoded path MTU selector value (for queries).
3162 *		0: greater than MTU specified
3163 *		1: less than MTU specified
3164 *		2: exactly the MTU specified
3165 *		3: largest MTU available
3166 *
3167 * NOTES
3168 *
3169 * SEE ALSO
3170 *	ib_path_rec_t
3171 *********/
3172 
3173 /****f* IBA Base: Types/ib_path_rec_rate
3174 * NAME
3175 *	ib_path_rec_rate
3176 *
3177 * DESCRIPTION
3178 *	Get encoded path rate.
3179 *
3180 * SYNOPSIS
3181 */
3182 static inline uint8_t OSM_API
ib_path_rec_rate(IN const ib_path_rec_t * const p_rec)3183 ib_path_rec_rate(IN const ib_path_rec_t * const p_rec)
3184 {
3185 	return ((uint8_t) (p_rec->rate & IB_PATH_REC_BASE_MASK));
3186 }
3187 
3188 /*
3189 * PARAMETERS
3190 *	p_rec
3191 *		[in] Pointer to the path record object.
3192 *
3193 * RETURN VALUES
3194 *	Encoded path rate.
3195 *		2: 2.5 Gb/sec.
3196 *		3: 10 Gb/sec.
3197 *		4: 30 Gb/sec.
3198 *		5: 5 Gb/sec.
3199 *		6: 20 Gb/sec.
3200 *		7: 40 Gb/sec.
3201 *		8: 60 Gb/sec.
3202 *		9: 80 Gb/sec.
3203 *		10: 120 Gb/sec.
3204 *		11: 14 Gb/sec.
3205 *		12: 56 Gb/sec.
3206 *		13: 112 Gb/sec.
3207 *		14: 168 Gb/sec.
3208 *		15: 25 Gb/sec.
3209 *		16: 100 Gb/sec.
3210 *		17: 200 Gb/sec.
3211 *		18: 300 Gb/sec.
3212 *		others: reserved
3213 *
3214 * NOTES
3215 *
3216 * SEE ALSO
3217 *	ib_path_rec_t
3218 *********/
3219 
3220 /****f* IBA Base: Types/ib_path_rec_rate_sel
3221 * NAME
3222 *	ib_path_rec_rate_sel
3223 *
3224 * DESCRIPTION
3225 *	Get encoded path rate selector.
3226 *
3227 * SYNOPSIS
3228 */
3229 static inline uint8_t OSM_API
ib_path_rec_rate_sel(IN const ib_path_rec_t * const p_rec)3230 ib_path_rec_rate_sel(IN const ib_path_rec_t * const p_rec)
3231 {
3232 	return ((uint8_t) ((p_rec->rate & IB_PATH_REC_SELECTOR_MASK) >> 6));
3233 }
3234 
3235 /*
3236 * PARAMETERS
3237 *	p_rec
3238 *		[in] Pointer to the path record object.
3239 *
3240 * RETURN VALUES
3241 *	Encoded path rate selector value (for queries).
3242 *		0: greater than rate specified
3243 *		1: less than rate specified
3244 *		2: exactly the rate specified
3245 *		3: largest rate available
3246 *
3247 * NOTES
3248 *
3249 * SEE ALSO
3250 *	ib_path_rec_t
3251 *********/
3252 
3253 /****f* IBA Base: Types/ib_path_rec_pkt_life
3254 * NAME
3255 *	ib_path_rec_pkt_life
3256 *
3257 * DESCRIPTION
3258 *	Get encoded path pkt_life.
3259 *
3260 * SYNOPSIS
3261 */
3262 static inline uint8_t OSM_API
ib_path_rec_pkt_life(IN const ib_path_rec_t * const p_rec)3263 ib_path_rec_pkt_life(IN const ib_path_rec_t * const p_rec)
3264 {
3265 	return ((uint8_t) (p_rec->pkt_life & IB_PATH_REC_BASE_MASK));
3266 }
3267 
3268 /*
3269 * PARAMETERS
3270 *	p_rec
3271 *		[in] Pointer to the path record object.
3272 *
3273 * RETURN VALUES
3274 *	Encoded path pkt_life = 4.096 usec * 2 ** PacketLifeTime.
3275 *
3276 * NOTES
3277 *
3278 * SEE ALSO
3279 *	ib_path_rec_t
3280 *********/
3281 
3282 /****f* IBA Base: Types/ib_path_rec_pkt_life_sel
3283 * NAME
3284 *	ib_path_rec_pkt_life_sel
3285 *
3286 * DESCRIPTION
3287 *	Get encoded path pkt_lifetime selector.
3288 *
3289 * SYNOPSIS
3290 */
3291 static inline uint8_t OSM_API
ib_path_rec_pkt_life_sel(IN const ib_path_rec_t * const p_rec)3292 ib_path_rec_pkt_life_sel(IN const ib_path_rec_t * const p_rec)
3293 {
3294 	return ((uint8_t) ((p_rec->pkt_life & IB_PATH_REC_SELECTOR_MASK) >> 6));
3295 }
3296 
3297 /*
3298 * PARAMETERS
3299 *	p_rec
3300 *		[in] Pointer to the path record object.
3301 *
3302 * RETURN VALUES
3303 *	Encoded path pkt_lifetime selector value (for queries).
3304 *		0: greater than rate specified
3305 *		1: less than rate specified
3306 *		2: exactly the rate specified
3307 *		3: smallest packet lifetime available
3308 *
3309 * NOTES
3310 *
3311 * SEE ALSO
3312 *	ib_path_rec_t
3313 *********/
3314 
3315 /****f* IBA Base: Types/ib_path_rec_flow_lbl
3316 * NAME
3317 *	ib_path_rec_flow_lbl
3318 *
3319 * DESCRIPTION
3320 *	Get flow label.
3321 *
3322 * SYNOPSIS
3323 */
3324 static inline uint32_t OSM_API
ib_path_rec_flow_lbl(IN const ib_path_rec_t * const p_rec)3325 ib_path_rec_flow_lbl(IN const ib_path_rec_t * const p_rec)
3326 {
3327 	return (((cl_ntoh32(p_rec->hop_flow_raw) >> 8) & 0x000FFFFF));
3328 }
3329 
3330 /*
3331 * PARAMETERS
3332 *	p_rec
3333 *		[in] Pointer to the path record object.
3334 *
3335 * RETURN VALUES
3336 *	Flow label of the path record.
3337 *
3338 * NOTES
3339 *
3340 * SEE ALSO
3341 *	ib_path_rec_t
3342 *********/
3343 
3344 /****f* IBA Base: Types/ib_path_rec_hop_limit
3345 * NAME
3346 *	ib_path_rec_hop_limit
3347 *
3348 * DESCRIPTION
3349 *	Get hop limit.
3350 *
3351 * SYNOPSIS
3352 */
3353 static inline uint8_t OSM_API
ib_path_rec_hop_limit(IN const ib_path_rec_t * const p_rec)3354 ib_path_rec_hop_limit(IN const ib_path_rec_t * const p_rec)
3355 {
3356 	return ((uint8_t) (cl_ntoh32(p_rec->hop_flow_raw) & 0x000000FF));
3357 }
3358 
3359 /*
3360 * PARAMETERS
3361 *	p_rec
3362 *		[in] Pointer to the path record object.
3363 *
3364 * RETURN VALUES
3365 *	Hop limit of the path record.
3366 *
3367 * NOTES
3368 *
3369 * SEE ALSO
3370 *	ib_path_rec_t
3371 *********/
3372 
3373 /****s* IBA Base: Constants/IB_CLASS_CAP_TRAP
3374 * NAME
3375 *	IB_CLASS_CAP_TRAP
3376 *
3377 * DESCRIPTION
3378 *	ClassPortInfo CapabilityMask bits.  This bit will be set
3379 *	if the class supports Trap() MADs (13.4.8.1).
3380 *
3381 * SEE ALSO
3382 *	ib_class_port_info_t, IB_CLASS_CAP_GETSET, IB_CLASS_CAP_CAPMASK2
3383 *
3384 * SOURCE
3385 */
3386 #define IB_CLASS_CAP_TRAP					0x0001
3387 /*********/
3388 
3389 /****s* IBA Base: Constants/IB_CLASS_CAP_GETSET
3390 * NAME
3391 *	IB_CLASS_CAP_GETSET
3392 *
3393 * DESCRIPTION
3394 *	ClassPortInfo CapabilityMask bits.  This bit will be set
3395 *	if the class supports Get(Notice) and Set(Notice) MADs (13.4.8.1).
3396 *
3397 * SEE ALSO
3398 *	ib_class_port_info_t, IB_CLASS_CAP_TRAP, IB_CLASS_CAP_CAPMASK2
3399 *
3400 * SOURCE
3401 */
3402 #define IB_CLASS_CAP_GETSET					0x0002
3403 /*********/
3404 
3405 /****s* IBA Base: Constants/IB_CLASS_CAP_CAPMASK2
3406 * NAME
3407 *	IB_CLASS_CAP_CAPMASK2
3408 *
3409 * DESCRIPTION
3410 *	ClassPortInfo CapabilityMask bits.
3411 *	This bit will be set of the class supports additional class specific
3412 *	capabilities (CapabilityMask2) (13.4.8.1).
3413 *
3414 * SEE ALSO
3415 *	ib_class_port_info_t, IB_CLASS_CAP_TRAP, IB_CLASS_CAP_GETSET
3416 *
3417 * SOURCE
3418 */
3419 #define IB_CLASS_CAP_CAPMASK2					0x0004
3420 /*********/
3421 
3422 /****s* IBA Base: Constants/IB_CLASS_ENH_PORT0_CC_MASK
3423 * NAME
3424 *	IB_CLASS_ENH_PORT0_CC_MASK
3425 *
3426 * DESCRIPTION
3427 *	ClassPortInfo CapabilityMask bits.
3428 *	Switch only: This bit will be set if the EnhancedPort0
3429 *	supports CA Congestion Control (A10.4.3.1).
3430 *
3431 * SEE ALSO
3432 *	ib_class_port_info_t
3433 *
3434 * SOURCE
3435 */
3436 #define IB_CLASS_ENH_PORT0_CC_MASK			0x0100
3437 /*********/
3438 
3439 /****s* IBA Base: Constants/IB_CLASS_RESP_TIME_MASK
3440 * NAME
3441 *	IB_CLASS_RESP_TIME_MASK
3442 *
3443 * DESCRIPTION
3444 *	Mask bits to extract the response time value from the
3445 *	cap_mask2_resp_time field of ib_class_port_info_t.
3446 *
3447 * SEE ALSO
3448 *	ib_class_port_info_t
3449 *
3450 * SOURCE
3451 */
3452 #define IB_CLASS_RESP_TIME_MASK				0x1F
3453 /*********/
3454 
3455 /****s* IBA Base: Constants/IB_CLASS_CAPMASK2_SHIFT
3456 * NAME
3457 *	IB_CLASS_CAPMASK2_SHIFT
3458 *
3459 * DESCRIPTION
3460 *	Number of bits to shift to extract the capability mask2
3461 *	from the cap_mask2_resp_time field of ib_class_port_info_t.
3462 *
3463 * SEE ALSO
3464 *	ib_class_port_info_t
3465 *
3466 * SOURCE
3467 */
3468 #define IB_CLASS_CAPMASK2_SHIFT				5
3469 /*********/
3470 
3471 /****s* IBA Base: Types/ib_class_port_info_t
3472 * NAME
3473 *	ib_class_port_info_t
3474 *
3475 * DESCRIPTION
3476 *	IBA defined ClassPortInfo attribute (13.4.8.1)
3477 *
3478 * SYNOPSIS
3479 */
3480 #include <complib/cl_packon.h>
3481 typedef struct _ib_class_port_info {
3482 	uint8_t base_ver;
3483 	uint8_t class_ver;
3484 	ib_net16_t cap_mask;
3485 	ib_net32_t cap_mask2_resp_time;
3486 	ib_gid_t redir_gid;
3487 	ib_net32_t redir_tc_sl_fl;
3488 	ib_net16_t redir_lid;
3489 	ib_net16_t redir_pkey;
3490 	ib_net32_t redir_qp;
3491 	ib_net32_t redir_qkey;
3492 	ib_gid_t trap_gid;
3493 	ib_net32_t trap_tc_sl_fl;
3494 	ib_net16_t trap_lid;
3495 	ib_net16_t trap_pkey;
3496 	ib_net32_t trap_hop_qp;
3497 	ib_net32_t trap_qkey;
3498 } PACK_SUFFIX ib_class_port_info_t;
3499 #include <complib/cl_packoff.h>
3500 /*
3501 * FIELDS
3502 *	base_ver
3503 *		Maximum supported MAD Base Version.
3504 *
3505 *	class_ver
3506 *		Maximum supported management class version.
3507 *
3508 *	cap_mask
3509 *		Supported capabilities of this management class.
3510 *
3511 *	cap_mask2_resp_time
3512 *		Maximum expected response time and additional
3513 *		supported capabilities of this management class.
3514 *
3515 *	redir_gid
3516 *		GID to use for redirection, or zero
3517 *
3518 *	redir_tc_sl_fl
3519 *		Traffic class, service level and flow label the requester
3520 *		should use if the service is redirected.
3521 *
3522 *	redir_lid
3523 *		LID used for redirection, or zero
3524 *
3525 *	redir_pkey
3526 *		P_Key used for redirection
3527 *
3528 *	redir_qp
3529 *		QP number used for redirection
3530 *
3531 *	redir_qkey
3532 *		Q_Key associated with the redirected QP.  This shall be the
3533 *		well known Q_Key value.
3534 *
3535 *	trap_gid
3536 *		GID value used for trap messages from this service.
3537 *
3538 *	trap_tc_sl_fl
3539 *		Traffic class, service level and flow label used for
3540 *		trap messages originated by this service.
3541 *
3542 *	trap_lid
3543 *		LID used for trap messages, or zero
3544 *
3545 *	trap_pkey
3546 *		P_Key used for trap messages
3547 *
3548 *	trap_hop_qp
3549 *		Hop limit (upper 8 bits) and QP number used for trap messages
3550 *
3551 *	trap_qkey
3552 *		Q_Key associated with the trap messages QP.
3553 *
3554 * SEE ALSO
3555 *	IB_CLASS_CAP_GETSET, IB_CLASS_CAP_TRAP
3556 *
3557 *********/
3558 
3559 #define IB_PM_ALL_PORT_SELECT			(CL_HTON16(((uint16_t)1)<<8))
3560 #define IB_PM_EXT_WIDTH_SUPPORTED		(CL_HTON16(((uint16_t)1)<<9))
3561 #define IB_PM_EXT_WIDTH_NOIETF_SUP		(CL_HTON16(((uint16_t)1)<<10))
3562 #define IB_PM_SAMPLES_ONLY_SUP			(CL_HTON16(((uint16_t)1)<<11))
3563 #define IB_PM_PC_XMIT_WAIT_SUP			(CL_HTON16(((uint16_t)1)<<12))
3564 #define IS_PM_INH_LMTD_PKEY_MC_CONSTR_ERR	(CL_HTON16(((uint16_t)1)<<13))
3565 #define IS_PM_RSFEC_COUNTERS_SUP		(CL_HTON16(((uint16_t)1)<<14))
3566 #define IB_PM_IS_QP1_DROP_SUP			(CL_HTON16(((uint16_t)1)<<15))
3567 /* CapabilityMask2 */
3568 #define IB_PM_IS_PM_KEY_SUPPORTED		(CL_HTON32(((uint32_t)1)<<0))
3569 #define IB_PM_IS_ADDL_PORT_CTRS_EXT_SUP		(CL_HTON32(((uint32_t)1)<<1))
3570 
3571 /****f* IBA Base: Types/ib_class_set_resp_time_val
3572 * NAME
3573 *	ib_class_set_resp_time_val
3574 *
3575 * DESCRIPTION
3576 *	Set maximum expected response time.
3577 *
3578 * SYNOPSIS
3579 */
3580 static inline void OSM_API
ib_class_set_resp_time_val(IN ib_class_port_info_t * const p_cpi,IN const uint8_t val)3581 ib_class_set_resp_time_val(IN ib_class_port_info_t * const p_cpi,
3582 			   IN const uint8_t val)
3583 {
3584 	p_cpi->cap_mask2_resp_time =
3585 	    (p_cpi->cap_mask2_resp_time & CL_HTON32(~IB_CLASS_RESP_TIME_MASK)) |
3586 	    cl_hton32(val & IB_CLASS_RESP_TIME_MASK);
3587 }
3588 
3589 /*
3590 * PARAMETERS
3591 *	p_cpi
3592 *		[in] Pointer to the class port info object.
3593 *
3594 *	val
3595 *		[in] Response time value to set.
3596 *
3597 * RETURN VALUES
3598 *	None
3599 *
3600 * NOTES
3601 *
3602 * SEE ALSO
3603 *	ib_class_port_info_t
3604 *********/
3605 
3606 /****f* IBA Base: Types/ib_class_resp_time_val
3607 * NAME
3608 *	ib_class_resp_time_val
3609 *
3610 * DESCRIPTION
3611 *	Get response time value.
3612 *
3613 * SYNOPSIS
3614 */
3615 static inline uint8_t OSM_API
ib_class_resp_time_val(IN ib_class_port_info_t * const p_cpi)3616 ib_class_resp_time_val(IN ib_class_port_info_t * const p_cpi)
3617 {
3618 	return (uint8_t)(cl_ntoh32(p_cpi->cap_mask2_resp_time) &
3619 			 IB_CLASS_RESP_TIME_MASK);
3620 }
3621 
3622 /*
3623 * PARAMETERS
3624 *	p_cpi
3625 *		[in] Pointer to the class port info object.
3626 *
3627 * RETURN VALUES
3628 *	Response time value.
3629 *
3630 * NOTES
3631 *
3632 * SEE ALSO
3633 *	ib_class_port_info_t
3634 *********/
3635 
3636 /****f* IBA Base: Types/ib_class_set_cap_mask2
3637 * NAME
3638 *	ib_class_set_cap_mask2
3639 *
3640 * DESCRIPTION
3641 *	Set ClassPortInfo:CapabilityMask2.
3642 *
3643 * SYNOPSIS
3644 */
3645 static inline void OSM_API
ib_class_set_cap_mask2(IN ib_class_port_info_t * const p_cpi,IN const uint32_t cap_mask2)3646 ib_class_set_cap_mask2(IN ib_class_port_info_t * const p_cpi,
3647 		       IN const uint32_t cap_mask2)
3648 {
3649 	p_cpi->cap_mask2_resp_time = (p_cpi->cap_mask2_resp_time &
3650 		CL_HTON32(IB_CLASS_RESP_TIME_MASK)) |
3651 		cl_hton32(cap_mask2 << IB_CLASS_CAPMASK2_SHIFT);
3652 }
3653 
3654 /*
3655 * PARAMETERS
3656 *	p_cpi
3657 *		[in] Pointer to the class port info object.
3658 *
3659 *	cap_mask2
3660 *		[in] CapabilityMask2 value to set.
3661 *
3662 * RETURN VALUES
3663 *	None
3664 *
3665 * NOTES
3666 *
3667 * SEE ALSO
3668 *	ib_class_port_info_t
3669 *********/
3670 
3671 /****f* IBA Base: Types/ib_class_cap_mask2
3672 * NAME
3673 *	ib_class_cap_mask2
3674 *
3675 * DESCRIPTION
3676 *	Get ClassPortInfo:CapabilityMask2.
3677 *
3678 * SYNOPSIS
3679 */
3680 static inline uint32_t OSM_API
ib_class_cap_mask2(IN const ib_class_port_info_t * const p_cpi)3681 ib_class_cap_mask2(IN const ib_class_port_info_t * const p_cpi)
3682 {
3683 	return (cl_ntoh32(p_cpi->cap_mask2_resp_time) >> IB_CLASS_CAPMASK2_SHIFT);
3684 }
3685 
3686 /*
3687 * PARAMETERS
3688 *	p_cpi
3689 *		[in] Pointer to the class port info object.
3690 *
3691 * RETURN VALUES
3692 *	CapabilityMask2 of the ClassPortInfo.
3693 *
3694 * NOTES
3695 *
3696 * SEE ALSO
3697 *	ib_class_port_info_t
3698 *********/
3699 
3700 /****s* IBA Base: Types/ib_sm_info_t
3701 * NAME
3702 *	ib_sm_info_t
3703 *
3704 * DESCRIPTION
3705 *	SMInfo structure (14.2.5.13).
3706 *
3707 * SYNOPSIS
3708 */
3709 #include <complib/cl_packon.h>
3710 typedef struct _ib_sm_info {
3711 	ib_net64_t guid;
3712 	ib_net64_t sm_key;
3713 	ib_net32_t act_count;
3714 	uint8_t pri_state;
3715 } PACK_SUFFIX ib_sm_info_t;
3716 #include <complib/cl_packoff.h>
3717 /*
3718 * FIELDS
3719 *	guid
3720 *		Port GUID for this SM.
3721 *
3722 *	sm_key
3723 *		SM_Key of this SM.
3724 *
3725 *	act_count
3726 *		Activity counter used as a heartbeat.
3727 *
3728 *	pri_state
3729 *		Priority and State information
3730 *
3731 * SEE ALSO
3732 *********/
3733 
3734 /****f* IBA Base: Types/ib_sminfo_get_priority
3735 * NAME
3736 *	ib_sminfo_get_priority
3737 *
3738 * DESCRIPTION
3739 *	Returns the priority value.
3740 *
3741 * SYNOPSIS
3742 */
3743 static inline uint8_t OSM_API
ib_sminfo_get_priority(IN const ib_sm_info_t * const p_smi)3744 ib_sminfo_get_priority(IN const ib_sm_info_t * const p_smi)
3745 {
3746 	return ((uint8_t) ((p_smi->pri_state & 0xF0) >> 4));
3747 }
3748 
3749 /*
3750 * PARAMETERS
3751 *	p_smi
3752 *		[in] Pointer to the SMInfo Attribute.
3753 *
3754 * RETURN VALUES
3755 *	Returns the priority value.
3756 *
3757 * NOTES
3758 *
3759 * SEE ALSO
3760 *********/
3761 
3762 /****f* IBA Base: Types/ib_sminfo_get_state
3763 * NAME
3764 *	ib_sminfo_get_state
3765 *
3766 * DESCRIPTION
3767 *	Returns the state value.
3768 *
3769 * SYNOPSIS
3770 */
3771 static inline uint8_t OSM_API
ib_sminfo_get_state(IN const ib_sm_info_t * const p_smi)3772 ib_sminfo_get_state(IN const ib_sm_info_t * const p_smi)
3773 {
3774 	return ((uint8_t) (p_smi->pri_state & 0x0F));
3775 }
3776 
3777 /*
3778 * PARAMETERS
3779 *	p_smi
3780 *		[in] Pointer to the SMInfo Attribute.
3781 *
3782 * RETURN VALUES
3783 *	Returns the state value.
3784 *
3785 * NOTES
3786 *
3787 * SEE ALSO
3788 *********/
3789 
3790 /****s* IBA Base: Types/ib_mad_t
3791 * NAME
3792 *	ib_mad_t
3793 *
3794 * DESCRIPTION
3795 *	IBA defined MAD header (13.4.3)
3796 *
3797 * SYNOPSIS
3798 */
3799 #include <complib/cl_packon.h>
3800 typedef struct _ib_mad {
3801 	uint8_t base_ver;
3802 	uint8_t mgmt_class;
3803 	uint8_t class_ver;
3804 	uint8_t method;
3805 	ib_net16_t status;
3806 	ib_net16_t class_spec;
3807 	ib_net64_t trans_id;
3808 	ib_net16_t attr_id;
3809 	ib_net16_t resv;
3810 	ib_net32_t attr_mod;
3811 } PACK_SUFFIX ib_mad_t;
3812 #include <complib/cl_packoff.h>
3813 /*
3814 * FIELDS
3815 *	base_ver
3816 *		MAD base format.
3817 *
3818 *	mgmt_class
3819 *		Class of operation.
3820 *
3821 *	class_ver
3822 *		Version of MAD class-specific format.
3823 *
3824 *	method
3825 *		Method to perform, including 'R' bit.
3826 *
3827 *	status
3828 *		Status of operation.
3829 *
3830 *	class_spec
3831 *		Reserved for subnet management.
3832 *
3833 *	trans_id
3834 *		Transaction ID.
3835 *
3836 *	attr_id
3837 *		Attribute ID.
3838 *
3839 *	resv
3840 *		Reserved field.
3841 *
3842 *	attr_mod
3843 *		Attribute modifier.
3844 *
3845 * SEE ALSO
3846 *********/
3847 
3848 /****s* IBA Base: Types/ib_rmpp_mad_t
3849 * NAME
3850 *	ib_rmpp_mad_t
3851 *
3852 * DESCRIPTION
3853 *	IBA defined MAD RMPP header (13.6.2.1)
3854 *
3855 * SYNOPSIS
3856 */
3857 #include <complib/cl_packon.h>
3858 typedef struct _ib_rmpp_mad {
3859 	ib_mad_t common_hdr;
3860 	uint8_t rmpp_version;
3861 	uint8_t rmpp_type;
3862 	uint8_t rmpp_flags;
3863 	uint8_t rmpp_status;
3864 	ib_net32_t seg_num;
3865 	ib_net32_t paylen_newwin;
3866 } PACK_SUFFIX ib_rmpp_mad_t;
3867 #include <complib/cl_packoff.h>
3868 /*
3869 * SEE ALSO
3870 *	ib_mad_t
3871 *********/
3872 
3873 /****f* IBA Base: Types/ib_mad_init_new
3874 * NAME
3875 *	ib_mad_init_new
3876 *
3877 * DESCRIPTION
3878 *	Initializes a MAD common header.
3879 *
3880 * SYNOPSIS
3881 */
3882 static inline void OSM_API
ib_mad_init_new(IN ib_mad_t * const p_mad,IN const uint8_t mgmt_class,IN const uint8_t class_ver,IN const uint8_t method,IN const ib_net64_t trans_id,IN const ib_net16_t attr_id,IN const ib_net32_t attr_mod)3883 ib_mad_init_new(IN ib_mad_t * const p_mad,
3884 		IN const uint8_t mgmt_class,
3885 		IN const uint8_t class_ver,
3886 		IN const uint8_t method,
3887 		IN const ib_net64_t trans_id,
3888 		IN const ib_net16_t attr_id, IN const ib_net32_t attr_mod)
3889 {
3890 	CL_ASSERT(p_mad);
3891 	p_mad->base_ver = 1;
3892 	p_mad->mgmt_class = mgmt_class;
3893 	p_mad->class_ver = class_ver;
3894 	p_mad->method = method;
3895 	p_mad->status = 0;
3896 	p_mad->class_spec = 0;
3897 	p_mad->trans_id = trans_id;
3898 	p_mad->attr_id = attr_id;
3899 	p_mad->resv = 0;
3900 	p_mad->attr_mod = attr_mod;
3901 }
3902 
3903 /*
3904 * PARAMETERS
3905 *	p_mad
3906 *		[in] Pointer to the MAD common header.
3907 *
3908 *	mgmt_class
3909 *		[in] Class of operation.
3910 *
3911 *	class_ver
3912 *		[in] Version of MAD class-specific format.
3913 *
3914 *	method
3915 *		[in] Method to perform, including 'R' bit.
3916 *
3917 *	trans_Id
3918 *		[in] Transaction ID.
3919 *
3920 *	attr_id
3921 *		[in] Attribute ID.
3922 *
3923 *	attr_mod
3924 *		[in] Attribute modifier.
3925 *
3926 * RETURN VALUES
3927 *	None.
3928 *
3929 * NOTES
3930 *
3931 * SEE ALSO
3932 *	ib_mad_t
3933 *********/
3934 
3935 /****f* IBA Base: Types/ib_mad_init_response
3936 * NAME
3937 *	ib_mad_init_response
3938 *
3939 * DESCRIPTION
3940 *	Initializes a MAD common header as a response.
3941 *
3942 * SYNOPSIS
3943 */
3944 static inline void OSM_API
ib_mad_init_response(IN const ib_mad_t * const p_req_mad,IN ib_mad_t * const p_mad,IN const ib_net16_t status)3945 ib_mad_init_response(IN const ib_mad_t * const p_req_mad,
3946 		     IN ib_mad_t * const p_mad, IN const ib_net16_t status)
3947 {
3948 	CL_ASSERT(p_req_mad);
3949 	CL_ASSERT(p_mad);
3950 	*p_mad = *p_req_mad;
3951 	p_mad->status = status;
3952 	if (p_mad->method == IB_MAD_METHOD_SET)
3953 		p_mad->method = IB_MAD_METHOD_GET;
3954 	p_mad->method |= IB_MAD_METHOD_RESP_MASK;
3955 }
3956 
3957 /*
3958 * PARAMETERS
3959 *	p_req_mad
3960 *		[in] Pointer to the MAD common header in the original request MAD.
3961 *
3962 *	p_mad
3963 *		[in] Pointer to the MAD common header to initialize.
3964 *
3965 *	status
3966 *		[in] MAD Status value to return;
3967 *
3968 * RETURN VALUES
3969 *	None.
3970 *
3971 * NOTES
3972 *	p_req_mad and p_mad may point to the same MAD.
3973 *
3974 * SEE ALSO
3975 *	ib_mad_t
3976 *********/
3977 
3978 /****f* IBA Base: Types/ib_mad_is_response
3979 * NAME
3980 *	ib_mad_is_response
3981 *
3982 * DESCRIPTION
3983 *	Returns TRUE if the MAD is a response ('R' bit set)
3984 *	or if the MAD is a TRAP REPRESS,
3985 *	FALSE otherwise.
3986 *
3987 * SYNOPSIS
3988 */
3989 static inline boolean_t OSM_API
ib_mad_is_response(IN const ib_mad_t * const p_mad)3990 ib_mad_is_response(IN const ib_mad_t * const p_mad)
3991 {
3992 	CL_ASSERT(p_mad);
3993 	return (p_mad->method & IB_MAD_METHOD_RESP_MASK ||
3994 		p_mad->method == IB_MAD_METHOD_TRAP_REPRESS);
3995 }
3996 
3997 /*
3998 * PARAMETERS
3999 *	p_mad
4000 *		[in] Pointer to the MAD.
4001 *
4002 * RETURN VALUES
4003 *	Returns TRUE if the MAD is a response ('R' bit set),
4004 *	FALSE otherwise.
4005 *
4006 * NOTES
4007 *
4008 * SEE ALSO
4009 *	ib_mad_t
4010 *********/
4011 
4012 #define IB_RMPP_TYPE_DATA		1
4013 #define IB_RMPP_TYPE_ACK		2
4014 #define IB_RMPP_TYPE_STOP		3
4015 #define IB_RMPP_TYPE_ABORT		4
4016 
4017 #define IB_RMPP_NO_RESP_TIME		0x1F
4018 #define IB_RMPP_FLAG_ACTIVE		0x01
4019 #define IB_RMPP_FLAG_FIRST		0x02
4020 #define IB_RMPP_FLAG_LAST		0x04
4021 
4022 #define IB_RMPP_STATUS_SUCCESS		0
4023 #define IB_RMPP_STATUS_RESX		1	/* resources exhausted */
4024 #define IB_RMPP_STATUS_T2L		118	/* time too long */
4025 #define IB_RMPP_STATUS_BAD_LEN		119	/* incon. last and payload len */
4026 #define IB_RMPP_STATUS_BAD_SEG		120	/* incon. first and segment no */
4027 #define IB_RMPP_STATUS_BADT		121	/* bad rmpp type */
4028 #define IB_RMPP_STATUS_W2S		122	/* newwindowlast too small */
4029 #define IB_RMPP_STATUS_S2B		123	/* segment no too big */
4030 #define IB_RMPP_STATUS_BAD_STATUS	124	/* illegal status */
4031 #define IB_RMPP_STATUS_UNV		125	/* unsupported version */
4032 #define IB_RMPP_STATUS_TMR		126	/* too many retries */
4033 #define IB_RMPP_STATUS_UNSPEC		127	/* unspecified */
4034 
4035 /****f* IBA Base: Types/ib_rmpp_is_flag_set
4036 * NAME
4037 *	ib_rmpp_is_flag_set
4038 *
4039 * DESCRIPTION
4040 *	Returns TRUE if the MAD has the given RMPP flag set.
4041 *
4042 * SYNOPSIS
4043 */
4044 static inline boolean_t OSM_API
ib_rmpp_is_flag_set(IN const ib_rmpp_mad_t * const p_rmpp_mad,IN const uint8_t flag)4045 ib_rmpp_is_flag_set(IN const ib_rmpp_mad_t * const p_rmpp_mad,
4046 		    IN const uint8_t flag)
4047 {
4048 	CL_ASSERT(p_rmpp_mad);
4049 	return ((p_rmpp_mad->rmpp_flags & flag) == flag);
4050 }
4051 
4052 /*
4053 * PARAMETERS
4054 *	ib_rmpp_mad_t
4055 *		[in] Pointer to a MAD with an RMPP header.
4056 *
4057 *	flag
4058 *		[in] The RMPP flag being examined.
4059 *
4060 * RETURN VALUES
4061 *	Returns TRUE if the MAD has the given RMPP flag set.
4062 *
4063 * NOTES
4064 *
4065 * SEE ALSO
4066 *	ib_mad_t, ib_rmpp_mad_t
4067 *********/
4068 
4069 static inline void OSM_API
ib_rmpp_set_resp_time(IN ib_rmpp_mad_t * const p_rmpp_mad,IN const uint8_t resp_time)4070 ib_rmpp_set_resp_time(IN ib_rmpp_mad_t * const p_rmpp_mad,
4071 		      IN const uint8_t resp_time)
4072 {
4073 	CL_ASSERT(p_rmpp_mad);
4074 	p_rmpp_mad->rmpp_flags |= (resp_time << 3);
4075 }
4076 
4077 static inline uint8_t OSM_API
ib_rmpp_get_resp_time(IN const ib_rmpp_mad_t * const p_rmpp_mad)4078 ib_rmpp_get_resp_time(IN const ib_rmpp_mad_t * const p_rmpp_mad)
4079 {
4080 	CL_ASSERT(p_rmpp_mad);
4081 	return ((uint8_t) (p_rmpp_mad->rmpp_flags >> 3));
4082 }
4083 
4084 /****d* IBA Base: Constants/IB_SMP_DIRECTION
4085 * NAME
4086 *	IB_SMP_DIRECTION
4087 *
4088 * DESCRIPTION
4089 *	The Direction bit for directed route SMPs.
4090 *
4091 * SOURCE
4092 */
4093 #define IB_SMP_DIRECTION_HO		0x8000
4094 #define IB_SMP_DIRECTION		(CL_HTON16(IB_SMP_DIRECTION_HO))
4095 /**********/
4096 
4097 /****d* IBA Base: Constants/IB_SMP_STATUS_MASK
4098 * NAME
4099 *	IB_SMP_STATUS_MASK
4100 *
4101 * DESCRIPTION
4102 *	Mask value for extracting status from a directed route SMP.
4103 *
4104 * SOURCE
4105 */
4106 #define IB_SMP_STATUS_MASK_HO		0x7FFF
4107 #define IB_SMP_STATUS_MASK		(CL_HTON16(IB_SMP_STATUS_MASK_HO))
4108 /**********/
4109 
4110 /****s* IBA Base: Types/ib_smp_t
4111 * NAME
4112 *	ib_smp_t
4113 *
4114 * DESCRIPTION
4115 *	IBA defined SMP. (14.2.1.2)
4116 *
4117 * SYNOPSIS
4118 */
4119 #define IB_SMP_DATA_SIZE 64
4120 #include <complib/cl_packon.h>
4121 typedef struct _ib_smp {
4122 	uint8_t base_ver;
4123 	uint8_t mgmt_class;
4124 	uint8_t class_ver;
4125 	uint8_t method;
4126 	ib_net16_t status;
4127 	uint8_t hop_ptr;
4128 	uint8_t hop_count;
4129 	ib_net64_t trans_id;
4130 	ib_net16_t attr_id;
4131 	ib_net16_t resv;
4132 	ib_net32_t attr_mod;
4133 	ib_net64_t m_key;
4134 	ib_net16_t dr_slid;
4135 	ib_net16_t dr_dlid;
4136 	uint32_t resv1[7];
4137 	uint8_t data[IB_SMP_DATA_SIZE];
4138 	uint8_t initial_path[IB_SUBNET_PATH_HOPS_MAX];
4139 	uint8_t return_path[IB_SUBNET_PATH_HOPS_MAX];
4140 } PACK_SUFFIX ib_smp_t;
4141 #include <complib/cl_packoff.h>
4142 /*
4143 * FIELDS
4144 *	base_ver
4145 *		MAD base format.
4146 *
4147 *	mgmt_class
4148 *		Class of operation.
4149 *
4150 *	class_ver
4151 *		Version of MAD class-specific format.
4152 *
4153 *	method
4154 *		Method to perform, including 'R' bit.
4155 *
4156 *	status
4157 *		Status of operation.
4158 *
4159 *	hop_ptr
4160 *		Hop pointer for directed route MADs.
4161 *
4162 *	hop_count
4163 *		Hop count for directed route MADs.
4164 *
4165 *	trans_Id
4166 *		Transaction ID.
4167 *
4168 *	attr_id
4169 *		Attribute ID.
4170 *
4171 *	resv
4172 *		Reserved field.
4173 *
4174 *	attr_mod
4175 *		Attribute modifier.
4176 *
4177 *	m_key
4178 *		Management key value.
4179 *
4180 *	dr_slid
4181 *		Directed route source LID.
4182 *
4183 *	dr_dlid
4184 *		Directed route destination LID.
4185 *
4186 *	resv0
4187 *		Reserved for 64 byte alignment.
4188 *
4189 *	data
4190 *		MAD data payload.
4191 *
4192 *	initial_path
4193 *		Outbound port list.
4194 *
4195 *	return_path
4196 *		Inbound port list.
4197 *
4198 * SEE ALSO
4199 *********/
4200 
4201 /****f* IBA Base: Types/ib_smp_get_status
4202 * NAME
4203 *	ib_smp_get_status
4204 *
4205 * DESCRIPTION
4206 *	Returns the SMP status value in network order.
4207 *
4208 * SYNOPSIS
4209 */
4210 static inline ib_net16_t OSM_API
ib_smp_get_status(IN const ib_smp_t * const p_smp)4211 ib_smp_get_status(IN const ib_smp_t * const p_smp)
4212 {
4213 	return ((ib_net16_t) (p_smp->status & IB_SMP_STATUS_MASK));
4214 }
4215 
4216 /*
4217 * PARAMETERS
4218 *	p_smp
4219 *		[in] Pointer to the SMP packet.
4220 *
4221 * RETURN VALUES
4222 *	Returns the SMP status value in network order.
4223 *
4224 * NOTES
4225 *
4226 * SEE ALSO
4227 *	ib_smp_t
4228 *********/
4229 
4230 /****f* IBA Base: Types/ib_smp_is_response
4231 * NAME
4232 *	ib_smp_is_response
4233 *
4234 * DESCRIPTION
4235 *	Returns TRUE if the SMP is a response MAD, FALSE otherwise.
4236 *
4237 * SYNOPSIS
4238 */
4239 static inline boolean_t OSM_API
ib_smp_is_response(IN const ib_smp_t * const p_smp)4240 ib_smp_is_response(IN const ib_smp_t * const p_smp)
4241 {
4242 	return (ib_mad_is_response((const ib_mad_t *)p_smp));
4243 }
4244 
4245 /*
4246 * PARAMETERS
4247 *	p_smp
4248 *		[in] Pointer to the SMP packet.
4249 *
4250 * RETURN VALUES
4251 *	Returns TRUE if the SMP is a response MAD, FALSE otherwise.
4252 *
4253 * NOTES
4254 *
4255 * SEE ALSO
4256 *	ib_smp_t
4257 *********/
4258 
4259 /****f* IBA Base: Types/ib_smp_is_d
4260 * NAME
4261 *	ib_smp_is_d
4262 *
4263 * DESCRIPTION
4264 *	Returns TRUE if the SMP 'D' (direction) bit is set.
4265 *
4266 * SYNOPSIS
4267 */
ib_smp_is_d(IN const ib_smp_t * const p_smp)4268 static inline boolean_t OSM_API ib_smp_is_d(IN const ib_smp_t * const p_smp)
4269 {
4270 	return ((p_smp->status & IB_SMP_DIRECTION) == IB_SMP_DIRECTION);
4271 }
4272 
4273 /*
4274 * PARAMETERS
4275 *	p_smp
4276 *		[in] Pointer to the SMP packet.
4277 *
4278 * RETURN VALUES
4279 *	Returns TRUE if the SMP 'D' (direction) bit is set.
4280 *
4281 * NOTES
4282 *
4283 * SEE ALSO
4284 *	ib_smp_t
4285 *********/
4286 
4287 /****f* IBA Base: Types/ib_smp_init_new
4288 * NAME
4289 *	ib_smp_init_new
4290 *
4291 * DESCRIPTION
4292 *	Initializes a MAD common header.
4293 *
4294 * TODO
4295 *	This is too big for inlining, but leave it here for now
4296 *	since there is not yet another convenient spot.
4297 *
4298 * SYNOPSIS
4299 */
4300 static inline void OSM_API
ib_smp_init_new(IN ib_smp_t * const p_smp,IN const uint8_t method,IN const ib_net64_t trans_id,IN const ib_net16_t attr_id,IN const ib_net32_t attr_mod,IN const uint8_t hop_count,IN const ib_net64_t m_key,IN const uint8_t * path_out,IN const ib_net16_t dr_slid,IN const ib_net16_t dr_dlid)4301 ib_smp_init_new(IN ib_smp_t * const p_smp,
4302 		IN const uint8_t method,
4303 		IN const ib_net64_t trans_id,
4304 		IN const ib_net16_t attr_id,
4305 		IN const ib_net32_t attr_mod,
4306 		IN const uint8_t hop_count,
4307 		IN const ib_net64_t m_key,
4308 		IN const uint8_t * path_out,
4309 		IN const ib_net16_t dr_slid, IN const ib_net16_t dr_dlid)
4310 {
4311 	CL_ASSERT(p_smp);
4312 	CL_ASSERT(hop_count < IB_SUBNET_PATH_HOPS_MAX);
4313 	p_smp->base_ver = 1;
4314 	p_smp->mgmt_class = IB_MCLASS_SUBN_DIR;
4315 	p_smp->class_ver = 1;
4316 	p_smp->method = method;
4317 	p_smp->status = 0;
4318 	p_smp->hop_ptr = 0;
4319 	p_smp->hop_count = hop_count;
4320 	p_smp->trans_id = trans_id;
4321 	p_smp->attr_id = attr_id;
4322 	p_smp->resv = 0;
4323 	p_smp->attr_mod = attr_mod;
4324 	p_smp->m_key = m_key;
4325 	p_smp->dr_slid = dr_slid;
4326 	p_smp->dr_dlid = dr_dlid;
4327 
4328 	memset(p_smp->resv1, 0,
4329 	       sizeof(p_smp->resv1) +
4330 	       sizeof(p_smp->data) +
4331 	       sizeof(p_smp->initial_path) + sizeof(p_smp->return_path));
4332 
4333 	/* copy the path */
4334 	memcpy(&p_smp->initial_path, path_out, sizeof(p_smp->initial_path));
4335 }
4336 
4337 /*
4338 * PARAMETERS
4339 *	p_smp
4340 *		[in] Pointer to the SMP packet.
4341 *
4342 *	method
4343 *		[in] Method to perform, including 'R' bit.
4344 *
4345 *	trans_Id
4346 *		[in] Transaction ID.
4347 *
4348 *	attr_id
4349 *		[in] Attribute ID.
4350 *
4351 *	attr_mod
4352 *		[in] Attribute modifier.
4353 *
4354 *	hop_count
4355 *		[in] Number of hops in the path.
4356 *
4357 *	m_key
4358 *		[in] Management key for this SMP.
4359 *
4360 *	path_out
4361 *		[in] Port array for outbound path.
4362 *
4363 *
4364 * RETURN VALUES
4365 *	None.
4366 *
4367 * NOTES
4368 *	Payload area is initialized to zero.
4369 *
4370 *
4371 * SEE ALSO
4372 *	ib_mad_t
4373 *********/
4374 
4375 /****f* IBA Base: Types/ib_smp_get_payload_ptr
4376 * NAME
4377 *	ib_smp_get_payload_ptr
4378 *
4379 * DESCRIPTION
4380 *	Gets a pointer to the SMP payload area.
4381 *
4382 * SYNOPSIS
4383 */
4384 static inline void *OSM_API
ib_smp_get_payload_ptr(IN const ib_smp_t * const p_smp)4385 ib_smp_get_payload_ptr(IN const ib_smp_t * const p_smp)
4386 {
4387 	return ((void *)p_smp->data);
4388 }
4389 
4390 /*
4391 * PARAMETERS
4392 *	p_smp
4393 *		[in] Pointer to the SMP packet.
4394 *
4395 * RETURN VALUES
4396 *	Pointer to SMP payload area.
4397 *
4398 * NOTES
4399 *
4400 * SEE ALSO
4401 *	ib_mad_t
4402 *********/
4403 
4404 /****s* IBA Base: Types/ib_node_info_t
4405 * NAME
4406 *	ib_node_info_t
4407 *
4408 * DESCRIPTION
4409 *	IBA defined NodeInfo. (14.2.5.3)
4410 *
4411 * SYNOPSIS
4412 */
4413 #include <complib/cl_packon.h>
4414 typedef struct _ib_node_info {
4415 	uint8_t base_version;
4416 	uint8_t class_version;
4417 	uint8_t node_type;
4418 	uint8_t num_ports;
4419 	ib_net64_t sys_guid;
4420 	ib_net64_t node_guid;
4421 	ib_net64_t port_guid;
4422 	ib_net16_t partition_cap;
4423 	ib_net16_t device_id;
4424 	ib_net32_t revision;
4425 	ib_net32_t port_num_vendor_id;
4426 } PACK_SUFFIX ib_node_info_t;
4427 #include <complib/cl_packoff.h>
4428 /************/
4429 
4430 /****s* IBA Base: Types/ib_sa_mad_t
4431 * NAME
4432 *	ib_sa_mad_t
4433 *
4434 * DESCRIPTION
4435 *	IBA defined SA MAD format. (15.2.1)
4436 *
4437 * SYNOPSIS
4438 */
4439 #define IB_SA_DATA_SIZE 200
4440 
4441 #include <complib/cl_packon.h>
4442 typedef struct _ib_sa_mad {
4443 	uint8_t base_ver;
4444 	uint8_t mgmt_class;
4445 	uint8_t class_ver;
4446 	uint8_t method;
4447 	ib_net16_t status;
4448 	ib_net16_t resv;
4449 	ib_net64_t trans_id;
4450 	ib_net16_t attr_id;
4451 	ib_net16_t resv1;
4452 	ib_net32_t attr_mod;
4453 	uint8_t rmpp_version;
4454 	uint8_t rmpp_type;
4455 	uint8_t rmpp_flags;
4456 	uint8_t rmpp_status;
4457 	ib_net32_t seg_num;
4458 	ib_net32_t paylen_newwin;
4459 	ib_net64_t sm_key;
4460 	ib_net16_t attr_offset;
4461 	ib_net16_t resv3;
4462 	ib_net64_t comp_mask;
4463 	uint8_t data[IB_SA_DATA_SIZE];
4464 } PACK_SUFFIX ib_sa_mad_t;
4465 #include <complib/cl_packoff.h>
4466 /**********/
4467 #define IB_SA_MAD_HDR_SIZE (sizeof(ib_sa_mad_t) - IB_SA_DATA_SIZE)
4468 
ib_get_attr_size(IN const ib_net16_t attr_offset)4469 static inline uint32_t OSM_API ib_get_attr_size(IN const ib_net16_t attr_offset)
4470 {
4471 	return (((uint32_t) cl_ntoh16(attr_offset)) << 3);
4472 }
4473 
ib_get_attr_offset(IN const uint32_t attr_size)4474 static inline ib_net16_t OSM_API ib_get_attr_offset(IN const uint32_t attr_size)
4475 {
4476 	return (cl_hton16((uint16_t) (attr_size >> 3)));
4477 }
4478 
4479 /****f* IBA Base: Types/ib_sa_mad_get_payload_ptr
4480 * NAME
4481 *	ib_sa_mad_get_payload_ptr
4482 *
4483 * DESCRIPTION
4484 *	Gets a pointer to the SA MAD's payload area.
4485 *
4486 * SYNOPSIS
4487 */
4488 static inline void *OSM_API
ib_sa_mad_get_payload_ptr(IN const ib_sa_mad_t * const p_sa_mad)4489 ib_sa_mad_get_payload_ptr(IN const ib_sa_mad_t * const p_sa_mad)
4490 {
4491 	return ((void *)p_sa_mad->data);
4492 }
4493 
4494 /*
4495 * PARAMETERS
4496 *	p_sa_mad
4497 *		[in] Pointer to the SA MAD packet.
4498 *
4499 * RETURN VALUES
4500 *	Pointer to SA MAD payload area.
4501 *
4502 * NOTES
4503 *
4504 * SEE ALSO
4505 *	ib_mad_t
4506 *********/
4507 
4508 #define IB_NODE_INFO_PORT_NUM_MASK		(CL_HTON32(0xFF000000))
4509 #define IB_NODE_INFO_VEND_ID_MASK		(CL_HTON32(0x00FFFFFF))
4510 #if CPU_LE
4511 #define IB_NODE_INFO_PORT_NUM_SHIFT 0
4512 #else
4513 #define IB_NODE_INFO_PORT_NUM_SHIFT 24
4514 #endif
4515 
4516 /****f* IBA Base: Types/ib_node_info_get_local_port_num
4517 * NAME
4518 *	ib_node_info_get_local_port_num
4519 *
4520 * DESCRIPTION
4521 *	Gets the local port number from the NodeInfo attribute.
4522 *
4523 * SYNOPSIS
4524 */
4525 static inline uint8_t OSM_API
ib_node_info_get_local_port_num(IN const ib_node_info_t * const p_ni)4526 ib_node_info_get_local_port_num(IN const ib_node_info_t * const p_ni)
4527 {
4528 	return ((uint8_t) ((p_ni->port_num_vendor_id &
4529 			    IB_NODE_INFO_PORT_NUM_MASK)
4530 			   >> IB_NODE_INFO_PORT_NUM_SHIFT));
4531 }
4532 
4533 /*
4534 * PARAMETERS
4535 *	p_ni
4536 *		[in] Pointer to a NodeInfo attribute.
4537 *
4538 * RETURN VALUES
4539 *	Local port number that returned the attribute.
4540 *
4541 * NOTES
4542 *
4543 * SEE ALSO
4544 *	ib_node_info_t
4545 *********/
4546 
4547 /****f* IBA Base: Types/ib_node_info_get_vendor_id
4548 * NAME
4549 *	ib_node_info_get_vendor_id
4550 *
4551 * DESCRIPTION
4552 *	Gets the VendorID from the NodeInfo attribute.
4553 *
4554 * SYNOPSIS
4555 */
4556 static inline ib_net32_t OSM_API
ib_node_info_get_vendor_id(IN const ib_node_info_t * const p_ni)4557 ib_node_info_get_vendor_id(IN const ib_node_info_t * const p_ni)
4558 {
4559 	return ((ib_net32_t) (p_ni->port_num_vendor_id &
4560 			      IB_NODE_INFO_VEND_ID_MASK));
4561 }
4562 
4563 /*
4564 * PARAMETERS
4565 *	p_ni
4566 *		[in] Pointer to a NodeInfo attribute.
4567 *
4568 * RETURN VALUES
4569 *	VendorID that returned the attribute.
4570 *
4571 * NOTES
4572 *
4573 * SEE ALSO
4574 *	ib_node_info_t
4575 *********/
4576 
4577 #define IB_NODE_DESCRIPTION_SIZE 64
4578 
4579 #include <complib/cl_packon.h>
4580 typedef struct _ib_node_desc {
4581 	// Node String is an array of UTF-8 characters
4582 	// that describe the node in text format
4583 	// Note that this string is NOT NULL TERMINATED!
4584 	uint8_t description[IB_NODE_DESCRIPTION_SIZE];
4585 } PACK_SUFFIX ib_node_desc_t;
4586 #include <complib/cl_packoff.h>
4587 
4588 #include <complib/cl_packon.h>
4589 typedef struct _ib_node_record_t {
4590 	ib_net16_t lid;
4591 	ib_net16_t resv;
4592 	ib_node_info_t node_info;
4593 	ib_node_desc_t node_desc;
4594 	uint8_t pad[4];
4595 } PACK_SUFFIX ib_node_record_t;
4596 #include <complib/cl_packoff.h>
4597 
4598 /****s* IBA Base: Types/ib_port_info_t
4599 * NAME
4600 *	ib_port_info_t
4601 *
4602 * DESCRIPTION
4603 *	IBA defined PortInfo. (14.2.5.6)
4604 *
4605 * SYNOPSIS
4606 */
4607 #include <complib/cl_packon.h>
4608 typedef struct _ib_port_info {
4609 	ib_net64_t m_key;
4610 	ib_net64_t subnet_prefix;
4611 	ib_net16_t base_lid;
4612 	ib_net16_t master_sm_base_lid;
4613 	ib_net32_t capability_mask;
4614 	ib_net16_t diag_code;
4615 	ib_net16_t m_key_lease_period;
4616 	uint8_t local_port_num;
4617 	uint8_t link_width_enabled;
4618 	uint8_t link_width_supported;
4619 	uint8_t link_width_active;
4620 	uint8_t state_info1;	/* LinkSpeedSupported and PortState */
4621 	uint8_t state_info2;	/* PortPhysState and LinkDownDefaultState */
4622 	uint8_t mkey_lmc;	/* M_KeyProtectBits and LMC */
4623 	uint8_t link_speed;	/* LinkSpeedEnabled and LinkSpeedActive */
4624 	uint8_t mtu_smsl;
4625 	uint8_t vl_cap;		/* VLCap and InitType */
4626 	uint8_t vl_high_limit;
4627 	uint8_t vl_arb_high_cap;
4628 	uint8_t vl_arb_low_cap;
4629 	uint8_t mtu_cap;
4630 	uint8_t vl_stall_life;
4631 	uint8_t vl_enforce;
4632 	ib_net16_t m_key_violations;
4633 	ib_net16_t p_key_violations;
4634 	ib_net16_t q_key_violations;
4635 	uint8_t guid_cap;
4636 	uint8_t subnet_timeout;	/* cli_rereg(1b), mcast_pkey_trap_suppr(1b), reserv(1b), timeout(5b) */
4637 	uint8_t resp_time_value; /* reserv(3b), rtv(5b) */
4638 	uint8_t error_threshold; /* local phy errors(4b), overrun errors(4b) */
4639 	ib_net16_t max_credit_hint;
4640 	ib_net32_t link_rt_latency; /* reserv(8b), link round trip lat(24b) */
4641 	ib_net16_t capability_mask2;
4642 	uint8_t link_speed_ext;	/* LinkSpeedExtActive and LinkSpeedExtSupported */
4643 	uint8_t link_speed_ext_enabled; /* reserv(3b), LinkSpeedExtEnabled(5b) */
4644 } PACK_SUFFIX ib_port_info_t;
4645 #include <complib/cl_packoff.h>
4646 /************/
4647 
4648 #define IB_PORT_STATE_MASK			0x0F
4649 #define IB_PORT_LMC_MASK			0x07
4650 #define IB_PORT_LMC_MAX				0x07
4651 #define IB_PORT_MPB_MASK			0xC0
4652 #define IB_PORT_MPB_SHIFT			6
4653 #define IB_PORT_LINK_SPEED_SHIFT		4
4654 #define IB_PORT_LINK_SPEED_SUPPORTED_MASK	0xF0
4655 #define IB_PORT_LINK_SPEED_ACTIVE_MASK		0xF0
4656 #define IB_PORT_LINK_SPEED_ENABLED_MASK		0x0F
4657 #define IB_PORT_PHYS_STATE_MASK			0xF0
4658 #define IB_PORT_PHYS_STATE_SHIFT		4
4659 #define IB_PORT_PHYS_STATE_NO_CHANGE		0
4660 #define IB_PORT_PHYS_STATE_SLEEP		1
4661 #define IB_PORT_PHYS_STATE_POLLING		2
4662 #define IB_PORT_PHYS_STATE_DISABLED		3
4663 #define IB_PORT_PHYS_STATE_PORTCONFTRAIN	4
4664 #define IB_PORT_PHYS_STATE_LINKUP	        5
4665 #define IB_PORT_PHYS_STATE_LINKERRRECOVER	6
4666 #define IB_PORT_PHYS_STATE_PHYTEST	        7
4667 #define IB_PORT_LNKDWNDFTSTATE_MASK		0x0F
4668 
4669 #define IB_PORT_CAP_RESV0         (CL_HTON32(0x00000001))
4670 #define IB_PORT_CAP_IS_SM         (CL_HTON32(0x00000002))
4671 #define IB_PORT_CAP_HAS_NOTICE    (CL_HTON32(0x00000004))
4672 #define IB_PORT_CAP_HAS_TRAP      (CL_HTON32(0x00000008))
4673 #define IB_PORT_CAP_HAS_IPD       (CL_HTON32(0x00000010))
4674 #define IB_PORT_CAP_HAS_AUTO_MIG  (CL_HTON32(0x00000020))
4675 #define IB_PORT_CAP_HAS_SL_MAP    (CL_HTON32(0x00000040))
4676 #define IB_PORT_CAP_HAS_NV_MKEY   (CL_HTON32(0x00000080))
4677 #define IB_PORT_CAP_HAS_NV_PKEY   (CL_HTON32(0x00000100))
4678 #define IB_PORT_CAP_HAS_LED_INFO  (CL_HTON32(0x00000200))
4679 #define IB_PORT_CAP_SM_DISAB      (CL_HTON32(0x00000400))
4680 #define IB_PORT_CAP_HAS_SYS_IMG_GUID  (CL_HTON32(0x00000800))
4681 #define IB_PORT_CAP_HAS_PKEY_SW_EXT_PORT_TRAP (CL_HTON32(0x00001000))
4682 #define IB_PORT_CAP_HAS_CABLE_INFO  (CL_HTON32(0x00002000))
4683 #define IB_PORT_CAP_HAS_EXT_SPEEDS  (CL_HTON32(0x00004000))
4684 #define IB_PORT_CAP_HAS_CAP_MASK2 (CL_HTON32(0x00008000))
4685 #define IB_PORT_CAP_HAS_COM_MGT   (CL_HTON32(0x00010000))
4686 #define IB_PORT_CAP_HAS_SNMP      (CL_HTON32(0x00020000))
4687 #define IB_PORT_CAP_REINIT        (CL_HTON32(0x00040000))
4688 #define IB_PORT_CAP_HAS_DEV_MGT   (CL_HTON32(0x00080000))
4689 #define IB_PORT_CAP_HAS_VEND_CLS  (CL_HTON32(0x00100000))
4690 #define IB_PORT_CAP_HAS_DR_NTC    (CL_HTON32(0x00200000))
4691 #define IB_PORT_CAP_HAS_CAP_NTC   (CL_HTON32(0x00400000))
4692 #define IB_PORT_CAP_HAS_BM        (CL_HTON32(0x00800000))
4693 #define IB_PORT_CAP_HAS_LINK_RT_LATENCY (CL_HTON32(0x01000000))
4694 #define IB_PORT_CAP_HAS_CLIENT_REREG (CL_HTON32(0x02000000))
4695 #define IB_PORT_CAP_HAS_OTHER_LOCAL_CHANGES_NTC (CL_HTON32(0x04000000))
4696 #define IB_PORT_CAP_HAS_LINK_SPEED_WIDTH_PAIRS_TBL (CL_HTON32(0x08000000))
4697 #define IB_PORT_CAP_HAS_VEND_MADS (CL_HTON32(0x10000000))
4698 #define IB_PORT_CAP_HAS_MCAST_PKEY_TRAP_SUPPRESS (CL_HTON32(0x20000000))
4699 #define IB_PORT_CAP_HAS_MCAST_FDB_TOP (CL_HTON32(0x40000000))
4700 #define IB_PORT_CAP_HAS_HIER_INFO (CL_HTON32(0x80000000))
4701 
4702 #define IB_PORT_CAP2_IS_SET_NODE_DESC_SUPPORTED (CL_HTON16(0x0001))
4703 #define IB_PORT_CAP2_IS_PORT_INFO_EXT_SUPPORTED (CL_HTON16(0x0002))
4704 #define IB_PORT_CAP2_IS_VIRT_SUPPORTED (CL_HTON16(0x0004))
4705 #define IB_PORT_CAP2_IS_SWITCH_PORT_STATE_TBL_SUPP (CL_HTON16(0x0008))
4706 #define IB_PORT_CAP2_IS_LINK_WIDTH_2X_SUPPORTED (CL_HTON16(0x0010))
4707 
4708 /****s* IBA Base: Types/ib_port_info_ext_t
4709 * NAME
4710 *	ib_port_info_ext_t
4711 *
4712 * DESCRIPTION
4713 *	IBA defined PortInfoExtended. (14.2.5.19)
4714 *
4715 * SYNOPSIS
4716 */
4717 #include <complib/cl_packon.h>
4718 typedef struct _ib_port_info_ext {
4719 	ib_net32_t cap_mask;
4720 	ib_net16_t fec_mode_active;
4721 	ib_net16_t fdr_fec_mode_sup;
4722 	ib_net16_t fdr_fec_mode_enable;
4723 	ib_net16_t edr_fec_mode_sup;
4724 	ib_net16_t edr_fec_mode_enable;
4725 	uint8_t reserved[50];
4726 } PACK_SUFFIX ib_port_info_ext_t;
4727 #include <complib/cl_packoff.h>
4728 /************/
4729 
4730 #define IB_PORT_EXT_NO_FEC_MODE_ACTIVE		    0
4731 #define IB_PORT_EXT_FIRE_CODE_FEC_MODE_ACTIVE	    (CL_HTON16(0x0001))
4732 #define IB_PORT_EXT_RS_FEC_MODE_ACTIVE		    (CL_HTON16(0x0002))
4733 #define IB_PORT_EXT_LOW_LATENCY_RS_FEC_MODE_ACTIVE  (CL_HTON16(0x0003))
4734 
4735 #define IB_PORT_EXT_CAP_IS_FEC_MODE_SUPPORTED (CL_HTON32(0x00000001))
4736 /****f* IBA Base: Types/ib_port_info_get_port_state
4737 * NAME
4738 *	ib_port_info_get_port_state
4739 *
4740 * DESCRIPTION
4741 *	Returns the port state.
4742 *
4743 * SYNOPSIS
4744 */
4745 static inline uint8_t OSM_API
ib_port_info_get_port_state(IN const ib_port_info_t * const p_pi)4746 ib_port_info_get_port_state(IN const ib_port_info_t * const p_pi)
4747 {
4748 	return ((uint8_t) (p_pi->state_info1 & IB_PORT_STATE_MASK));
4749 }
4750 
4751 /*
4752 * PARAMETERS
4753 *	p_pi
4754 *		[in] Pointer to a PortInfo attribute.
4755 *
4756 * RETURN VALUES
4757 *	Port state.
4758 *
4759 * NOTES
4760 *
4761 * SEE ALSO
4762 *********/
4763 
4764 /****f* IBA Base: Types/ib_port_info_set_port_state
4765 * NAME
4766 *	ib_port_info_set_port_state
4767 *
4768 * DESCRIPTION
4769 *	Sets the port state.
4770 *
4771 * SYNOPSIS
4772 */
4773 static inline void OSM_API
ib_port_info_set_port_state(IN ib_port_info_t * const p_pi,IN const uint8_t port_state)4774 ib_port_info_set_port_state(IN ib_port_info_t * const p_pi,
4775 			    IN const uint8_t port_state)
4776 {
4777 	p_pi->state_info1 = (uint8_t) ((p_pi->state_info1 & 0xF0) | port_state);
4778 }
4779 
4780 /*
4781 * PARAMETERS
4782 *	p_pi
4783 *		[in] Pointer to a PortInfo attribute.
4784 *
4785 *	port_state
4786 *		[in] Port state value to set.
4787 *
4788 * RETURN VALUES
4789 *	None.
4790 *
4791 * NOTES
4792 *
4793 * SEE ALSO
4794 *********/
4795 
4796 /****f* IBA Base: Types/ib_port_info_get_vl_cap
4797 * NAME
4798 *	ib_port_info_get_vl_cap
4799 *
4800 * DESCRIPTION
4801 *	Gets the VL Capability of a port.
4802 *
4803 * SYNOPSIS
4804 */
4805 static inline uint8_t OSM_API
ib_port_info_get_vl_cap(IN const ib_port_info_t * const p_pi)4806 ib_port_info_get_vl_cap(IN const ib_port_info_t * const p_pi)
4807 {
4808 	return ((p_pi->vl_cap >> 4) & 0x0F);
4809 }
4810 
4811 /*
4812 * PARAMETERS
4813 *	p_pi
4814 *		[in] Pointer to a PortInfo attribute.
4815 *
4816 * RETURN VALUES
4817 *	VL_CAP field
4818 *
4819 * NOTES
4820 *
4821 * SEE ALSO
4822 *********/
4823 
4824 /****f* IBA Base: Types/ib_port_info_get_init_type
4825 * NAME
4826 *	ib_port_info_get_init_type
4827 *
4828 * DESCRIPTION
4829 *	Gets the init type of a port.
4830 *
4831 * SYNOPSIS
4832 */
4833 static inline uint8_t OSM_API
ib_port_info_get_init_type(IN const ib_port_info_t * const p_pi)4834 ib_port_info_get_init_type(IN const ib_port_info_t * const p_pi)
4835 {
4836 	return (uint8_t) (p_pi->vl_cap & 0x0F);
4837 }
4838 
4839 /*
4840 * PARAMETERS
4841 *	p_pi
4842 *		[in] Pointer to a PortInfo attribute.
4843 *
4844 * RETURN VALUES
4845 *	InitType field
4846 *
4847 * NOTES
4848 *
4849 * SEE ALSO
4850 *********/
4851 
4852 /****f* IBA Base: Types/ib_port_info_get_op_vls
4853 * NAME
4854 *	ib_port_info_get_op_vls
4855 *
4856 * DESCRIPTION
4857 *	Gets the operational VLs on a port.
4858 *
4859 * SYNOPSIS
4860 */
4861 static inline uint8_t OSM_API
ib_port_info_get_op_vls(IN const ib_port_info_t * const p_pi)4862 ib_port_info_get_op_vls(IN const ib_port_info_t * const p_pi)
4863 {
4864 	return ((p_pi->vl_enforce >> 4) & 0x0F);
4865 }
4866 
4867 /*
4868 * PARAMETERS
4869 *	p_pi
4870 *		[in] Pointer to a PortInfo attribute.
4871 *
4872 * RETURN VALUES
4873 *	OP_VLS field
4874 *
4875 * NOTES
4876 *
4877 * SEE ALSO
4878 *********/
4879 
4880 /****f* IBA Base: Types/ib_port_info_set_op_vls
4881 * NAME
4882 *	ib_port_info_set_op_vls
4883 *
4884 * DESCRIPTION
4885 *	Sets the operational VLs on a port.
4886 *
4887 * SYNOPSIS
4888 */
4889 static inline void OSM_API
ib_port_info_set_op_vls(IN ib_port_info_t * const p_pi,IN const uint8_t op_vls)4890 ib_port_info_set_op_vls(IN ib_port_info_t * const p_pi, IN const uint8_t op_vls)
4891 {
4892 	p_pi->vl_enforce =
4893 	    (uint8_t) ((p_pi->vl_enforce & 0x0F) | (op_vls << 4));
4894 }
4895 
4896 /*
4897 * PARAMETERS
4898 *	p_pi
4899 *		[in] Pointer to a PortInfo attribute.
4900 *
4901 *	op_vls
4902 *		[in] Encoded operation VLs value.
4903 *
4904 * RETURN VALUES
4905 *	None.
4906 *
4907 * NOTES
4908 *
4909 * SEE ALSO
4910 *********/
4911 
4912 /****f* IBA Base: Types/ib_port_info_set_state_no_change
4913 * NAME
4914 *	ib_port_info_set_state_no_change
4915 *
4916 * DESCRIPTION
4917 *	Sets the port state fields to the value for "no change".
4918 *
4919 * SYNOPSIS
4920 */
4921 static inline void OSM_API
ib_port_info_set_state_no_change(IN ib_port_info_t * const p_pi)4922 ib_port_info_set_state_no_change(IN ib_port_info_t * const p_pi)
4923 {
4924 	ib_port_info_set_port_state(p_pi, IB_LINK_NO_CHANGE);
4925 	p_pi->state_info2 = 0;
4926 }
4927 
4928 /*
4929 * PARAMETERS
4930 *	p_pi
4931 *		[in] Pointer to a PortInfo attribute.
4932 *
4933 * RETURN VALUES
4934 *	None.
4935 *
4936 * NOTES
4937 *
4938 * SEE ALSO
4939 *********/
4940 
4941 /****f* IBA Base: Types/ib_port_info_get_link_speed_sup
4942 * NAME
4943 *	ib_port_info_get_link_speed_sup
4944 *
4945 * DESCRIPTION
4946 *	Returns the encoded value for the link speed supported.
4947 *
4948 * SYNOPSIS
4949 */
4950 static inline uint8_t OSM_API
ib_port_info_get_link_speed_sup(IN const ib_port_info_t * const p_pi)4951 ib_port_info_get_link_speed_sup(IN const ib_port_info_t * const p_pi)
4952 {
4953 	return ((uint8_t) ((p_pi->state_info1 &
4954 			    IB_PORT_LINK_SPEED_SUPPORTED_MASK) >>
4955 			   IB_PORT_LINK_SPEED_SHIFT));
4956 }
4957 
4958 /*
4959 * PARAMETERS
4960 *	p_pi
4961 *		[in] Pointer to a PortInfo attribute.
4962 *
4963 * RETURN VALUES
4964 *	Returns the encoded value for the link speed supported.
4965 *
4966 * NOTES
4967 *
4968 * SEE ALSO
4969 *********/
4970 
4971 /****f* IBA Base: Types/ib_port_info_set_link_speed_sup
4972 * NAME
4973 *	ib_port_info_set_link_speed_sup
4974 *
4975 * DESCRIPTION
4976 *	Given an integer of the supported link speed supported.
4977 *	Set the appropriate bits in state_info1
4978 *
4979 * SYNOPSIS
4980 */
4981 static inline void OSM_API
ib_port_info_set_link_speed_sup(IN uint8_t const speed,IN ib_port_info_t * p_pi)4982 ib_port_info_set_link_speed_sup(IN uint8_t const speed,
4983 				IN ib_port_info_t * p_pi)
4984 {
4985 	p_pi->state_info1 =
4986 	    (~IB_PORT_LINK_SPEED_SUPPORTED_MASK & p_pi->state_info1) |
4987 	    (IB_PORT_LINK_SPEED_SUPPORTED_MASK &
4988 	     (speed << IB_PORT_LINK_SPEED_SHIFT));
4989 }
4990 
4991 /*
4992 * PARAMETERS
4993 *	speed
4994 *		[in] Supported Speeds Code.
4995 *
4996 *	p_pi
4997 *		[in] Pointer to a PortInfo attribute.
4998 *
4999 * RETURN VALUES
5000 *	This function does not return a value.
5001 *
5002 * NOTES
5003 *
5004 * SEE ALSO
5005 *********/
5006 
5007 /****f* IBA Base: Types/ib_port_info_get_port_phys_state
5008 * NAME
5009 *	ib_port_info_get_port_phys_state
5010 *
5011 * DESCRIPTION
5012 *	Returns the encoded value for the port physical state.
5013 *
5014 * SYNOPSIS
5015 */
5016 static inline uint8_t OSM_API
ib_port_info_get_port_phys_state(IN const ib_port_info_t * const p_pi)5017 ib_port_info_get_port_phys_state(IN const ib_port_info_t * const p_pi)
5018 {
5019 	return ((uint8_t) ((p_pi->state_info2 &
5020 			    IB_PORT_PHYS_STATE_MASK) >>
5021 			   IB_PORT_PHYS_STATE_SHIFT));
5022 }
5023 
5024 /*
5025 * PARAMETERS
5026 *	p_pi
5027 *		[in] Pointer to a PortInfo attribute.
5028 *
5029 * RETURN VALUES
5030 *	Returns the encoded value for the port physical state.
5031 *
5032 * NOTES
5033 *
5034 * SEE ALSO
5035 *********/
5036 
5037 /****f* IBA Base: Types/ib_port_info_set_port_phys_state
5038 * NAME
5039 *	ib_port_info_set_port_phys_state
5040 *
5041 * DESCRIPTION
5042 *	Given an integer of the port physical state,
5043 *	Set the appropriate bits in state_info2
5044 *
5045 * SYNOPSIS
5046 */
5047 static inline void OSM_API
ib_port_info_set_port_phys_state(IN uint8_t const phys_state,IN ib_port_info_t * p_pi)5048 ib_port_info_set_port_phys_state(IN uint8_t const phys_state,
5049 				 IN ib_port_info_t * p_pi)
5050 {
5051 	p_pi->state_info2 =
5052 	    (~IB_PORT_PHYS_STATE_MASK & p_pi->state_info2) |
5053 	    (IB_PORT_PHYS_STATE_MASK &
5054 	     (phys_state << IB_PORT_PHYS_STATE_SHIFT));
5055 }
5056 
5057 /*
5058 * PARAMETERS
5059 *	phys_state
5060 *		[in] port physical state.
5061 *
5062 *	p_pi
5063 *		[in] Pointer to a PortInfo attribute.
5064 *
5065 * RETURN VALUES
5066 *	This function does not return a value.
5067 *
5068 * NOTES
5069 *
5070 * SEE ALSO
5071 *********/
5072 
5073 /****f* IBA Base: Types/ib_port_info_get_link_down_def_state
5074 * NAME
5075 *	ib_port_info_get_link_down_def_state
5076 *
5077 * DESCRIPTION
5078 *	Returns the link down default state.
5079 *
5080 * SYNOPSIS
5081 */
5082 static inline uint8_t OSM_API
ib_port_info_get_link_down_def_state(IN const ib_port_info_t * const p_pi)5083 ib_port_info_get_link_down_def_state(IN const ib_port_info_t * const p_pi)
5084 {
5085 	return ((uint8_t) (p_pi->state_info2 & IB_PORT_LNKDWNDFTSTATE_MASK));
5086 }
5087 
5088 /*
5089 * PARAMETERS
5090 *	p_pi
5091 *		[in] Pointer to a PortInfo attribute.
5092 *
5093 * RETURN VALUES
5094 *	link down default state of the port.
5095 *
5096 * NOTES
5097 *
5098 * SEE ALSO
5099 *********/
5100 
5101 /****f* IBA Base: Types/ib_port_info_set_link_down_def_state
5102 * NAME
5103 *	ib_port_info_set_link_down_def_state
5104 *
5105 * DESCRIPTION
5106 *	Sets the link down default state of the port.
5107 *
5108 * SYNOPSIS
5109 */
5110 static inline void OSM_API
ib_port_info_set_link_down_def_state(IN ib_port_info_t * const p_pi,IN const uint8_t link_dwn_state)5111 ib_port_info_set_link_down_def_state(IN ib_port_info_t * const p_pi,
5112 				     IN const uint8_t link_dwn_state)
5113 {
5114 	p_pi->state_info2 =
5115 	    (uint8_t) ((p_pi->state_info2 & 0xF0) | link_dwn_state);
5116 }
5117 
5118 /*
5119 * PARAMETERS
5120 *	p_pi
5121 *		[in] Pointer to a PortInfo attribute.
5122 *
5123 *	link_dwn_state
5124 *		[in] Link down default state of the port.
5125 *
5126 * RETURN VALUES
5127 *	None.
5128 *
5129 * NOTES
5130 *
5131 * SEE ALSO
5132 *********/
5133 
5134 /****f* IBA Base: Types/ib_port_info_get_link_speed_active
5135 * NAME
5136 *	ib_port_info_get_link_speed_active
5137 *
5138 * DESCRIPTION
5139 *	Returns the Link Speed Active value assigned to this port.
5140 *
5141 * SYNOPSIS
5142 */
5143 static inline uint8_t OSM_API
ib_port_info_get_link_speed_active(IN const ib_port_info_t * const p_pi)5144 ib_port_info_get_link_speed_active(IN const ib_port_info_t * const p_pi)
5145 {
5146 	return ((uint8_t) ((p_pi->link_speed &
5147 			    IB_PORT_LINK_SPEED_ACTIVE_MASK) >>
5148 			   IB_PORT_LINK_SPEED_SHIFT));
5149 }
5150 
5151 /*
5152 * PARAMETERS
5153 *	p_pi
5154 *		[in] Pointer to a PortInfo attribute.
5155 *
5156 * RETURN VALUES
5157 *	Returns the link speed active value assigned to this port.
5158 *
5159 * NOTES
5160 *
5161 * SEE ALSO
5162 *********/
5163 
5164 #define IB_LINK_WIDTH_ACTIVE_1X			1
5165 #define IB_LINK_WIDTH_ACTIVE_4X			2
5166 #define IB_LINK_WIDTH_ACTIVE_8X			4
5167 #define IB_LINK_WIDTH_ACTIVE_12X 		8
5168 #define IB_LINK_WIDTH_ACTIVE_2X			16
5169 #define IB_LINK_SPEED_ACTIVE_EXTENDED		0
5170 #define IB_LINK_SPEED_ACTIVE_2_5		1
5171 #define IB_LINK_SPEED_ACTIVE_5			2
5172 #define IB_LINK_SPEED_ACTIVE_10			4
5173 #define IB_LINK_SPEED_EXT_ACTIVE_NONE		0
5174 #define IB_LINK_SPEED_EXT_ACTIVE_14		1
5175 #define IB_LINK_SPEED_EXT_ACTIVE_25		2
5176 #define IB_LINK_SPEED_EXT_DISABLE		30
5177 #define IB_LINK_SPEED_EXT_SET_LSES		31
5178 
5179 /* following v1 ver1.3 p984 */
5180 #define IB_PATH_RECORD_RATE_2_5_GBS		2
5181 #define IB_PATH_RECORD_RATE_10_GBS		3
5182 #define IB_PATH_RECORD_RATE_30_GBS		4
5183 #define IB_PATH_RECORD_RATE_5_GBS		5
5184 #define IB_PATH_RECORD_RATE_20_GBS		6
5185 #define IB_PATH_RECORD_RATE_40_GBS		7
5186 #define IB_PATH_RECORD_RATE_60_GBS		8
5187 #define IB_PATH_RECORD_RATE_80_GBS		9
5188 #define IB_PATH_RECORD_RATE_120_GBS		10
5189 #define IB_PATH_RECORD_RATE_14_GBS		11
5190 #define IB_PATH_RECORD_RATE_56_GBS		12
5191 #define IB_PATH_RECORD_RATE_112_GBS		13
5192 #define IB_PATH_RECORD_RATE_168_GBS		14
5193 #define IB_PATH_RECORD_RATE_25_GBS		15
5194 #define IB_PATH_RECORD_RATE_100_GBS		16
5195 #define IB_PATH_RECORD_RATE_200_GBS		17
5196 #define IB_PATH_RECORD_RATE_300_GBS		18
5197 #define IB_PATH_RECORD_RATE_28_GBS		19
5198 #define IB_PATH_RECORD_RATE_50_GBS		20
5199 
5200 #define IB_MIN_RATE    IB_PATH_RECORD_RATE_2_5_GBS
5201 #define IB_MAX_RATE    IB_PATH_RECORD_RATE_50_GBS
5202 
5203 static inline uint8_t OSM_API
5204 ib_port_info_get_link_speed_ext_active(IN const ib_port_info_t * const p_pi);
5205 
5206 /****f* IBA Base: Types/ib_port_info_compute_rate
5207 * NAME
5208 *	ib_port_info_compute_rate
5209 *
5210 * DESCRIPTION
5211 *	Returns the encoded value for the path rate.
5212 *
5213 * SYNOPSIS
5214 */
5215 static inline uint8_t OSM_API
ib_port_info_compute_rate(IN const ib_port_info_t * const p_pi,IN const int extended)5216 ib_port_info_compute_rate(IN const ib_port_info_t * const p_pi,
5217 			  IN const int extended)
5218 {
5219 	uint8_t rate = 0;
5220 
5221 	if (extended) {
5222 		switch (ib_port_info_get_link_speed_ext_active(p_pi)) {
5223 		case IB_LINK_SPEED_EXT_ACTIVE_14:
5224 			switch (p_pi->link_width_active) {
5225 			case IB_LINK_WIDTH_ACTIVE_1X:
5226 				rate = IB_PATH_RECORD_RATE_14_GBS;
5227 				break;
5228 
5229 			case IB_LINK_WIDTH_ACTIVE_4X:
5230 				rate = IB_PATH_RECORD_RATE_56_GBS;
5231 				break;
5232 
5233 			case IB_LINK_WIDTH_ACTIVE_8X:
5234 				rate = IB_PATH_RECORD_RATE_112_GBS;
5235 				break;
5236 
5237 			case IB_LINK_WIDTH_ACTIVE_12X:
5238 				rate = IB_PATH_RECORD_RATE_168_GBS;
5239 				break;
5240 
5241 			case IB_LINK_WIDTH_ACTIVE_2X:
5242 				rate = IB_PATH_RECORD_RATE_28_GBS;
5243 				break;
5244 
5245 			default:
5246 				rate = IB_PATH_RECORD_RATE_14_GBS;
5247 				break;
5248 			}
5249 			break;
5250 		case IB_LINK_SPEED_EXT_ACTIVE_25:
5251 			switch (p_pi->link_width_active) {
5252 			case IB_LINK_WIDTH_ACTIVE_1X:
5253 				rate = IB_PATH_RECORD_RATE_25_GBS;
5254 				break;
5255 
5256 			case IB_LINK_WIDTH_ACTIVE_4X:
5257 				rate = IB_PATH_RECORD_RATE_100_GBS;
5258 				break;
5259 
5260 			case IB_LINK_WIDTH_ACTIVE_8X:
5261 				rate = IB_PATH_RECORD_RATE_200_GBS;
5262 				break;
5263 
5264 			case IB_LINK_WIDTH_ACTIVE_12X:
5265 				rate = IB_PATH_RECORD_RATE_300_GBS;
5266 				break;
5267 
5268 			case IB_LINK_WIDTH_ACTIVE_2X:
5269 				rate = IB_PATH_RECORD_RATE_50_GBS;
5270 				break;
5271 
5272 			default:
5273 				rate = IB_PATH_RECORD_RATE_25_GBS;
5274 				break;
5275 			}
5276 			break;
5277 		/* IB_LINK_SPEED_EXT_ACTIVE_NONE and any others */
5278 		default:
5279 			break;
5280 		}
5281 		if (rate)
5282 			return rate;
5283 	}
5284 
5285 	switch (ib_port_info_get_link_speed_active(p_pi)) {
5286 	case IB_LINK_SPEED_ACTIVE_2_5:
5287 		switch (p_pi->link_width_active) {
5288 		case IB_LINK_WIDTH_ACTIVE_1X:
5289 			rate = IB_PATH_RECORD_RATE_2_5_GBS;
5290 			break;
5291 
5292 		case IB_LINK_WIDTH_ACTIVE_4X:
5293 			rate = IB_PATH_RECORD_RATE_10_GBS;
5294 			break;
5295 
5296 		case IB_LINK_WIDTH_ACTIVE_8X:
5297 			rate = IB_PATH_RECORD_RATE_20_GBS;
5298 			break;
5299 
5300 		case IB_LINK_WIDTH_ACTIVE_12X:
5301 			rate = IB_PATH_RECORD_RATE_30_GBS;
5302 			break;
5303 
5304 		case IB_LINK_WIDTH_ACTIVE_2X:
5305 			rate = IB_PATH_RECORD_RATE_5_GBS;
5306 			break;
5307 
5308 		default:
5309 			rate = IB_PATH_RECORD_RATE_2_5_GBS;
5310 			break;
5311 		}
5312 		break;
5313 	case IB_LINK_SPEED_ACTIVE_5:
5314 		switch (p_pi->link_width_active) {
5315 		case IB_LINK_WIDTH_ACTIVE_1X:
5316 			rate = IB_PATH_RECORD_RATE_5_GBS;
5317 			break;
5318 
5319 		case IB_LINK_WIDTH_ACTIVE_4X:
5320 			rate = IB_PATH_RECORD_RATE_20_GBS;
5321 			break;
5322 
5323 		case IB_LINK_WIDTH_ACTIVE_8X:
5324 			rate = IB_PATH_RECORD_RATE_40_GBS;
5325 			break;
5326 
5327 		case IB_LINK_WIDTH_ACTIVE_12X:
5328 			rate = IB_PATH_RECORD_RATE_60_GBS;
5329 			break;
5330 
5331 		case IB_LINK_WIDTH_ACTIVE_2X:
5332 			rate = IB_PATH_RECORD_RATE_10_GBS;
5333 			break;
5334 
5335 		default:
5336 			rate = IB_PATH_RECORD_RATE_5_GBS;
5337 			break;
5338 		}
5339 		break;
5340 	case IB_LINK_SPEED_ACTIVE_10:
5341 		switch (p_pi->link_width_active) {
5342 		case IB_LINK_WIDTH_ACTIVE_1X:
5343 			rate = IB_PATH_RECORD_RATE_10_GBS;
5344 			break;
5345 
5346 		case IB_LINK_WIDTH_ACTIVE_4X:
5347 			rate = IB_PATH_RECORD_RATE_40_GBS;
5348 			break;
5349 
5350 		case IB_LINK_WIDTH_ACTIVE_8X:
5351 			rate = IB_PATH_RECORD_RATE_80_GBS;
5352 			break;
5353 
5354 		case IB_LINK_WIDTH_ACTIVE_12X:
5355 			rate = IB_PATH_RECORD_RATE_120_GBS;
5356 			break;
5357 
5358 		case IB_LINK_WIDTH_ACTIVE_2X:
5359 			rate = IB_PATH_RECORD_RATE_20_GBS;
5360 			break;
5361 
5362 		default:
5363 			rate = IB_PATH_RECORD_RATE_10_GBS;
5364 			break;
5365 		}
5366 		break;
5367 	default:
5368 		rate = IB_PATH_RECORD_RATE_2_5_GBS;
5369 		break;
5370 	}
5371 
5372 	return rate;
5373 }
5374 
5375 /*
5376 * PARAMETERS
5377 *	p_pi
5378 *		[in] Pointer to a PortInfo attribute.
5379 *
5380 *	extended
5381 *		[in] Indicates whether or not to use extended link speeds.
5382 *
5383 * RETURN VALUES
5384 *	Returns the encoded value for the link speed supported.
5385 *
5386 * NOTES
5387 *
5388 * SEE ALSO
5389 *********/
5390 
5391 /****f* IBA Base: Types/ib_path_get_ipd
5392 * NAME
5393 *	ib_path_get_ipd
5394 *
5395 * DESCRIPTION
5396 *	Returns the encoded value for the inter packet delay.
5397 *
5398 * SYNOPSIS
5399 */
5400 static inline uint8_t OSM_API
ib_path_get_ipd(IN uint8_t local_link_width_supported,IN uint8_t path_rec_rate)5401 ib_path_get_ipd(IN uint8_t local_link_width_supported, IN uint8_t path_rec_rate)
5402 {
5403 	uint8_t ipd = 0;
5404 
5405 	switch (local_link_width_supported) {
5406 		/* link_width_supported = 1: 1x */
5407 	case 1:
5408 		break;
5409 
5410 		/* link_width_supported = 3: 1x or 4x */
5411 	case 3:
5412 		switch (path_rec_rate & 0x3F) {
5413 		case IB_PATH_RECORD_RATE_2_5_GBS:
5414 			ipd = 3;
5415 			break;
5416 		default:
5417 			break;
5418 		}
5419 		break;
5420 
5421 		/* link_width_supported = 11: 1x or 4x or 12x */
5422 	case 11:
5423 		switch (path_rec_rate & 0x3F) {
5424 		case IB_PATH_RECORD_RATE_2_5_GBS:
5425 			ipd = 11;
5426 			break;
5427 		case IB_PATH_RECORD_RATE_10_GBS:
5428 			ipd = 2;
5429 			break;
5430 		default:
5431 			break;
5432 		}
5433 		break;
5434 
5435 	default:
5436 		break;
5437 	}
5438 
5439 	return ipd;
5440 }
5441 
5442 /*
5443 * PARAMETERS
5444 *	local_link_width_supported
5445 *		[in] link with supported for this port
5446 *
5447 *	path_rec_rate
5448 *		[in] rate field of the path record
5449 *
5450 * RETURN VALUES
5451 *	Returns the ipd
5452 *
5453 * NOTES
5454 *
5455 * SEE ALSO
5456 *********/
5457 
5458 /****f* IBA Base: Types/ib_port_info_get_mtu_cap
5459 * NAME
5460 *	ib_port_info_get_mtu_cap
5461 *
5462 * DESCRIPTION
5463 *	Returns the encoded value for the maximum MTU supported by this port.
5464 *
5465 * SYNOPSIS
5466 */
5467 static inline uint8_t OSM_API
ib_port_info_get_mtu_cap(IN const ib_port_info_t * const p_pi)5468 ib_port_info_get_mtu_cap(IN const ib_port_info_t * const p_pi)
5469 {
5470 	return ((uint8_t) (p_pi->mtu_cap & 0x0F));
5471 }
5472 
5473 /*
5474 * PARAMETERS
5475 *	p_pi
5476 *		[in] Pointer to a PortInfo attribute.
5477 *
5478 * RETURN VALUES
5479 *	Returns the encooded value for the maximum MTU supported by this port.
5480 *
5481 * NOTES
5482 *
5483 * SEE ALSO
5484 *********/
5485 
5486 /****f* IBA Base: Types/ib_port_info_get_neighbor_mtu
5487 * NAME
5488 *	ib_port_info_get_neighbor_mtu
5489 *
5490 * DESCRIPTION
5491 *	Returns the encoded value for the neighbor MTU supported by this port.
5492 *
5493 * SYNOPSIS
5494 */
5495 static inline uint8_t OSM_API
ib_port_info_get_neighbor_mtu(IN const ib_port_info_t * const p_pi)5496 ib_port_info_get_neighbor_mtu(IN const ib_port_info_t * const p_pi)
5497 {
5498 	return ((uint8_t) ((p_pi->mtu_smsl & 0xF0) >> 4));
5499 }
5500 
5501 /*
5502 * PARAMETERS
5503 *	p_pi
5504 *		[in] Pointer to a PortInfo attribute.
5505 *
5506 * RETURN VALUES
5507 *	Returns the encoded value for the neighbor MTU at this port.
5508 *
5509 * NOTES
5510 *
5511 * SEE ALSO
5512 *********/
5513 
5514 /****f* IBA Base: Types/ib_port_info_set_neighbor_mtu
5515 * NAME
5516 *	ib_port_info_set_neighbor_mtu
5517 *
5518 * DESCRIPTION
5519 *	Sets the Neighbor MTU value in the PortInfo attribute.
5520 *
5521 * SYNOPSIS
5522 */
5523 static inline void OSM_API
ib_port_info_set_neighbor_mtu(IN ib_port_info_t * const p_pi,IN const uint8_t mtu)5524 ib_port_info_set_neighbor_mtu(IN ib_port_info_t * const p_pi,
5525 			      IN const uint8_t mtu)
5526 {
5527 	CL_ASSERT(mtu <= 5);
5528 	CL_ASSERT(mtu != 0);
5529 	p_pi->mtu_smsl = (uint8_t) ((p_pi->mtu_smsl & 0x0F) | (mtu << 4));
5530 }
5531 
5532 /*
5533 * PARAMETERS
5534 *	p_pi
5535 *		[in] Pointer to a PortInfo attribute.
5536 *
5537 *	mtu
5538 *		[in] Encoded MTU value to set
5539 *
5540 * RETURN VALUES
5541 *	None.
5542 *
5543 * NOTES
5544 *
5545 * SEE ALSO
5546 *********/
5547 
5548 /****f* IBA Base: Types/ib_port_info_get_master_smsl
5549 * NAME
5550 *	ib_port_info_get_master_smsl
5551 *
5552 * DESCRIPTION
5553 *	Returns the encoded value for the Master SMSL at this port.
5554 *
5555 * SYNOPSIS
5556 */
5557 static inline uint8_t OSM_API
ib_port_info_get_master_smsl(IN const ib_port_info_t * const p_pi)5558 ib_port_info_get_master_smsl(IN const ib_port_info_t * const p_pi)
5559 {
5560 	return (uint8_t) (p_pi->mtu_smsl & 0x0F);
5561 }
5562 
5563 /*
5564 * PARAMETERS
5565 *	p_pi
5566 *		[in] Pointer to a PortInfo attribute.
5567 *
5568 * RETURN VALUES
5569 *	Returns the encoded value for the Master SMSL at this port.
5570 *
5571 * NOTES
5572 *
5573 * SEE ALSO
5574 *********/
5575 
5576 /****f* IBA Base: Types/ib_port_info_set_master_smsl
5577 * NAME
5578 *	ib_port_info_set_master_smsl
5579 *
5580 * DESCRIPTION
5581 *	Sets the Master SMSL value in the PortInfo attribute.
5582 *
5583 * SYNOPSIS
5584 */
5585 static inline void OSM_API
ib_port_info_set_master_smsl(IN ib_port_info_t * const p_pi,IN const uint8_t smsl)5586 ib_port_info_set_master_smsl(IN ib_port_info_t * const p_pi,
5587 			     IN const uint8_t smsl)
5588 {
5589 	p_pi->mtu_smsl = (uint8_t) ((p_pi->mtu_smsl & 0xF0) | smsl);
5590 }
5591 
5592 /*
5593 * PARAMETERS
5594 *	p_pi
5595 *		[in] Pointer to a PortInfo attribute.
5596 *
5597 *	mtu
5598 *		[in] Encoded Master SMSL value to set
5599 *
5600 * RETURN VALUES
5601 *	None.
5602 *
5603 * NOTES
5604 *
5605 * SEE ALSO
5606 *********/
5607 
5608 /****f* IBA Base: Types/ib_port_info_set_timeout
5609 * NAME
5610 *	ib_port_info_set_timeout
5611 *
5612 * DESCRIPTION
5613 *	Sets the encoded subnet timeout value in the PortInfo attribute.
5614 *
5615 * SYNOPSIS
5616 */
5617 static inline void OSM_API
ib_port_info_set_timeout(IN ib_port_info_t * const p_pi,IN const uint8_t timeout)5618 ib_port_info_set_timeout(IN ib_port_info_t * const p_pi,
5619 			 IN const uint8_t timeout)
5620 {
5621 	CL_ASSERT(timeout <= 0x1F);
5622 	p_pi->subnet_timeout =
5623 	    (uint8_t) ((p_pi->subnet_timeout & 0xE0) | (timeout & 0x1F));
5624 }
5625 
5626 /*
5627 * PARAMETERS
5628 *	p_pi
5629 *		[in] Pointer to a PortInfo attribute.
5630 *
5631 *	timeout
5632 *		[in] Encoded timeout value to set
5633 *
5634 * RETURN VALUES
5635 *	None.
5636 *
5637 * NOTES
5638 *
5639 * SEE ALSO
5640 *********/
5641 
5642 /****f* IBA Base: Types/ib_port_info_set_client_rereg
5643 * NAME
5644 *	ib_port_info_set_client_rereg
5645 *
5646 * DESCRIPTION
5647 *	Sets the encoded client reregistration bit value in the PortInfo attribute.
5648 *
5649 * SYNOPSIS
5650 */
5651 static inline void OSM_API
ib_port_info_set_client_rereg(IN ib_port_info_t * const p_pi,IN const uint8_t client_rereg)5652 ib_port_info_set_client_rereg(IN ib_port_info_t * const p_pi,
5653 			      IN const uint8_t client_rereg)
5654 {
5655 	CL_ASSERT(client_rereg <= 0x1);
5656 	p_pi->subnet_timeout =
5657 	    (uint8_t) ((p_pi->subnet_timeout & 0x7F) | (client_rereg << 7));
5658 }
5659 
5660 /*
5661 * PARAMETERS
5662 *	p_pi
5663 *		[in] Pointer to a PortInfo attribute.
5664 *
5665 *	client_rereg
5666 *		[in] Client reregistration value to set (either 1 or 0).
5667 *
5668 * RETURN VALUES
5669 *	None.
5670 *
5671 * NOTES
5672 *
5673 * SEE ALSO
5674 *********/
5675 
5676 /****f* IBA Base: Types/ib_port_info_set_mcast_pkey_trap_suppress
5677 * NAME
5678 *	ib_port_info_set_mcast_pkey_trap_suppress
5679 *
5680 * DESCRIPTION
5681 *	Sets the encoded multicast pkey trap suppression enabled bit value
5682 *	in the PortInfo attribute.
5683 *
5684 * SYNOPSIS
5685 */
5686 static inline void OSM_API
ib_port_info_set_mcast_pkey_trap_suppress(IN ib_port_info_t * const p_pi,IN const uint8_t trap_suppress)5687 ib_port_info_set_mcast_pkey_trap_suppress(IN ib_port_info_t * const p_pi,
5688 					  IN const uint8_t trap_suppress)
5689 {
5690 	CL_ASSERT(trap_suppress <= 0x1);
5691 	p_pi->subnet_timeout =
5692 	    (uint8_t) ((p_pi->subnet_timeout & 0xBF) | (trap_suppress << 6));
5693 }
5694 
5695 /*
5696 * PARAMETERS
5697 *	p_pi
5698 *		[in] Pointer to a PortInfo attribute.
5699 *
5700 *	trap_suppress
5701 *		[in] Multicast pkey trap suppression enabled value to set
5702 *		     (either 1 or 0).
5703 *
5704 * RETURN VALUES
5705 *	None.
5706 *
5707 * NOTES
5708 *
5709 * SEE ALSO
5710 *********/
5711 
5712 /****f* IBA Base: Types/ib_port_info_get_timeout
5713 * NAME
5714 *	ib_port_info_get_timeout
5715 *
5716 * DESCRIPTION
5717 *	Gets the encoded subnet timeout value in the PortInfo attribute.
5718 *
5719 * SYNOPSIS
5720 */
5721 static inline uint8_t OSM_API
ib_port_info_get_timeout(IN ib_port_info_t const * p_pi)5722 ib_port_info_get_timeout(IN ib_port_info_t const *p_pi)
5723 {
5724 	return (p_pi->subnet_timeout & 0x1F);
5725 }
5726 
5727 /*
5728 * PARAMETERS
5729 *	p_pi
5730 *		[in] Pointer to a PortInfo attribute.
5731 *
5732 * RETURN VALUES
5733 *	The encoded timeout value
5734 *
5735 * NOTES
5736 *
5737 * SEE ALSO
5738 *********/
5739 
5740 /****f* IBA Base: Types/ib_port_info_get_link_speed_ext_active
5741 * NAME
5742 *	ib_port_info_get_link_speed_ext_active
5743 *
5744 * DESCRIPTION
5745 *	Gets the encoded LinkSpeedExtActive value in the PortInfo attribute.
5746 *
5747 * SYNOPSIS
5748 */
5749 static inline uint8_t OSM_API
ib_port_info_get_link_speed_ext_active(IN const ib_port_info_t * const p_pi)5750 ib_port_info_get_link_speed_ext_active(IN const ib_port_info_t * const p_pi)
5751 {
5752 	return ((p_pi->link_speed_ext & 0xF0) >> 4);
5753 }
5754 
5755 /*
5756 * PARAMETERS
5757 *	p_pi
5758 *		[in] Pointer to a PortInfo attribute.
5759 *
5760 * RETURN VALUES
5761 *	The encoded LinkSpeedExtActive value
5762 *
5763 * NOTES
5764 *
5765 * SEE ALSO
5766 *********/
5767 
5768 /****f* IBA Base: Types/ib_port_info_get_link_speed_ext_sup
5769 * NAME
5770 *	ib_port_info_get_link_speed_ext_sup
5771 *
5772 * DESCRIPTION
5773 *	Returns the encoded value for the link speed extended supported.
5774 *
5775 * SYNOPSIS
5776 */
5777 static inline uint8_t OSM_API
ib_port_info_get_link_speed_ext_sup(IN const ib_port_info_t * const p_pi)5778 ib_port_info_get_link_speed_ext_sup(IN const ib_port_info_t * const p_pi)
5779 {
5780 	return (p_pi->link_speed_ext & 0x0F);
5781 }
5782 
5783 /*
5784 * PARAMETERS
5785 *	p_pi
5786 *		[in] Pointer to a PortInfo attribute.
5787 *
5788 * RETURN VALUES
5789 *	The encoded LinkSpeedExtSupported value
5790 *
5791 * NOTES
5792 *
5793 * SEE ALSO
5794 *********/
5795 
5796 /****f* IBA Base: Types/ib_port_info_get_link_speed_ext_enabled
5797 * NAME
5798 *	ib_port_info_get_link_speed_ext_enabled
5799 *
5800 * DESCRIPTION
5801 *	Gets the encoded LinkSpeedExtEnabled value in the PortInfo attribute.
5802 *
5803 * SYNOPSIS
5804 */
5805 static inline uint8_t OSM_API
ib_port_info_get_link_speed_ext_enabled(IN const ib_port_info_t * const p_pi)5806 ib_port_info_get_link_speed_ext_enabled(IN const ib_port_info_t * const p_pi)
5807 {
5808         return (p_pi->link_speed_ext_enabled & 0x1F);
5809 }
5810 
5811 /*
5812 * PARAMETERS
5813 *	p_pi
5814 *		[in] Pointer to a PortInfo attribute.
5815 *
5816 * RETURN VALUES
5817 *	The encoded LinkSpeedExtEnabled value
5818 *
5819 * NOTES
5820 *
5821 * SEE ALSO
5822 *********/
5823 
5824 /****f* IBA Base: Types/ib_port_info_set_link_speed_ext_enabled
5825 * NAME
5826 *	ib_port_info_set_link_speed_ext_enabled
5827 *
5828 * DESCRIPTION
5829 *	Sets the link speed extended enabled value in the PortInfo attribute.
5830 *
5831 * SYNOPSIS
5832 */
5833 static inline void OSM_API
ib_port_info_set_link_speed_ext_enabled(IN ib_port_info_t * const p_pi,IN const uint8_t link_speed_ext_enabled)5834 ib_port_info_set_link_speed_ext_enabled(IN ib_port_info_t * const p_pi,
5835 					IN const uint8_t link_speed_ext_enabled)
5836 {
5837 	CL_ASSERT(link_speed_ext_enabled <= 0x1F);
5838 	p_pi->link_speed_ext_enabled = link_speed_ext_enabled & 0x1F;
5839 }
5840 
5841 /*
5842 * PARAMETERS
5843 *	p_pi
5844 *		[in] Pointer to a PortInfo attribute.
5845 *
5846 *	link_speed_ext_enabled
5847 *		[in] link speed extehded enabled value to set.
5848 *
5849 * RETURN VALUES
5850 *	The encoded LinkSpeedExtEnabled value
5851 *
5852 * NOTES
5853 *
5854 * SEE ALSO
5855 *********/
5856 
5857 /****f* IBA Base: Types/ib_port_info_get_resp_time_value
5858 * NAME
5859 *	ib_port_info_get_resp_time_value
5860 *
5861 * DESCRIPTION
5862 *	Gets the encoded resp time value in the PortInfo attribute.
5863 *
5864 * SYNOPSIS
5865 */
5866 static inline uint8_t OSM_API
ib_port_info_get_resp_time_value(IN const ib_port_info_t * const p_pi)5867 ib_port_info_get_resp_time_value(IN const ib_port_info_t * const p_pi)
5868 {
5869 	return (p_pi->resp_time_value & 0x1F);
5870 }
5871 
5872 /*
5873 * PARAMETERS
5874 *	p_pi
5875 *		[in] Pointer to a PortInfo attribute.
5876 *
5877 * RETURN VALUES
5878 *	The encoded resp time value
5879 *
5880 * NOTES
5881 *
5882 * SEE ALSO
5883 *********/
5884 
5885 /****f* IBA Base: Types/ib_port_info_get_client_rereg
5886 * NAME
5887 *	ib_port_info_get_client_rereg
5888 *
5889 * DESCRIPTION
5890 *	Gets the encoded client reregistration bit value in the PortInfo attribute.
5891 *
5892 * SYNOPSIS
5893 */
5894 static inline uint8_t OSM_API
ib_port_info_get_client_rereg(IN ib_port_info_t const * p_pi)5895 ib_port_info_get_client_rereg(IN ib_port_info_t const *p_pi)
5896 {
5897 	return ((p_pi->subnet_timeout & 0x80) >> 7);
5898 }
5899 
5900 /*
5901 * PARAMETERS
5902 *	p_pi
5903 *		[in] Pointer to a PortInfo attribute.
5904 *
5905 * RETURN VALUES
5906 *	Client reregistration value (either 1 or 0).
5907 *
5908 * NOTES
5909 *
5910 * SEE ALSO
5911 *********/
5912 
5913 /****f* IBA Base: Types/ib_port_info_get_mcast_pkey_trap_suppress
5914 * NAME
5915 *	ib_port_info_get_mcast_pkey_trap_suppress
5916 *
5917 * DESCRIPTION
5918 *	Gets the encoded multicast pkey trap suppression enabled bit value
5919 *	in the PortInfo attribute.
5920 *
5921 * SYNOPSIS
5922 */
5923 static inline uint8_t OSM_API
ib_port_info_get_mcast_pkey_trap_suppress(IN ib_port_info_t const * p_pi)5924 ib_port_info_get_mcast_pkey_trap_suppress(IN ib_port_info_t const *p_pi)
5925 {
5926 	return ((p_pi->subnet_timeout & 0x40) >> 6);
5927 }
5928 
5929 /*
5930 * PARAMETERS
5931 *	p_pi
5932 *		[in] Pointer to a PortInfo attribute.
5933 *
5934 * RETURN VALUES
5935 *	Multicast PKey trap suppression enabled value (either 1 or 0).
5936 *
5937 * NOTES
5938 *
5939 * SEE ALSO
5940 *********/
5941 
5942 /****f* IBA Base: Types/ib_port_info_set_hoq_lifetime
5943 * NAME
5944 *	ib_port_info_set_hoq_lifetime
5945 *
5946 * DESCRIPTION
5947 *	Sets the Head of Queue Lifetime for which a packet can live in the head
5948 *  of VL queue
5949 *
5950 * SYNOPSIS
5951 */
5952 static inline void OSM_API
ib_port_info_set_hoq_lifetime(IN ib_port_info_t * const p_pi,IN const uint8_t hoq_life)5953 ib_port_info_set_hoq_lifetime(IN ib_port_info_t * const p_pi,
5954 			      IN const uint8_t hoq_life)
5955 {
5956 	p_pi->vl_stall_life = (uint8_t) ((hoq_life & 0x1f) |
5957 					 (p_pi->vl_stall_life & 0xe0));
5958 }
5959 
5960 /*
5961 * PARAMETERS
5962 *	p_pi
5963 *		[in] Pointer to a PortInfo attribute.
5964 *
5965 *	hoq_life
5966 *		[in] Encoded lifetime value to set
5967 *
5968 * RETURN VALUES
5969 *	None.
5970 *
5971 * NOTES
5972 *
5973 * SEE ALSO
5974 *********/
5975 
5976 /****f* IBA Base: Types/ib_port_info_get_hoq_lifetime
5977 * NAME
5978 *	ib_port_info_get_hoq_lifetime
5979 *
5980 * DESCRIPTION
5981 *	Gets the Head of Queue Lifetime for which a packet can live in the head
5982 *  of VL queue
5983 *
5984 * SYNOPSIS
5985 */
5986 static inline uint8_t OSM_API
ib_port_info_get_hoq_lifetime(IN const ib_port_info_t * const p_pi)5987 ib_port_info_get_hoq_lifetime(IN const ib_port_info_t * const p_pi)
5988 {
5989 	return ((uint8_t) (p_pi->vl_stall_life & 0x1f));
5990 }
5991 
5992 /*
5993 * PARAMETERS
5994 *	p_pi
5995 *		[in] Pointer to a PortInfo attribute.
5996 *
5997 * RETURN VALUES
5998 *     Encoded lifetime value
5999 *
6000 * NOTES
6001 *
6002 * SEE ALSO
6003 *********/
6004 
6005 /****f* IBA Base: Types/ib_port_info_set_vl_stall_count
6006 * NAME
6007 *	ib_port_info_set_vl_stall_count
6008 *
6009 * DESCRIPTION
6010 *	Sets the VL Stall Count which define the number of contiguous
6011 *  HLL (hoq) drops that will put the VL into stalled mode.
6012 *
6013 * SYNOPSIS
6014 */
6015 static inline void OSM_API
ib_port_info_set_vl_stall_count(IN ib_port_info_t * const p_pi,IN const uint8_t vl_stall_count)6016 ib_port_info_set_vl_stall_count(IN ib_port_info_t * const p_pi,
6017 				IN const uint8_t vl_stall_count)
6018 {
6019 	p_pi->vl_stall_life = (uint8_t) ((p_pi->vl_stall_life & 0x1f) |
6020 					 ((vl_stall_count << 5) & 0xe0));
6021 }
6022 
6023 /*
6024 * PARAMETERS
6025 *	p_pi
6026 *		[in] Pointer to a PortInfo attribute.
6027 *
6028 *	vl_stall_count
6029 *		[in] value to set
6030 *
6031 * RETURN VALUES
6032 *	None.
6033 *
6034 * NOTES
6035 *
6036 * SEE ALSO
6037 *********/
6038 
6039 /****f* IBA Base: Types/ib_port_info_get_vl_stall_count
6040 * NAME
6041 *	ib_port_info_get_vl_stall_count
6042 *
6043 * DESCRIPTION
6044 *	Gets the VL Stall Count which define the number of contiguous
6045 *  HLL (hoq) drops that will put the VL into stalled mode
6046 *
6047 * SYNOPSIS
6048 */
6049 static inline uint8_t OSM_API
ib_port_info_get_vl_stall_count(IN const ib_port_info_t * const p_pi)6050 ib_port_info_get_vl_stall_count(IN const ib_port_info_t * const p_pi)
6051 {
6052 	return ((uint8_t) (p_pi->vl_stall_life & 0xe0) >> 5);
6053 }
6054 
6055 /*
6056 * PARAMETERS
6057 *	p_pi
6058 *		[in] Pointer to a PortInfo attribute.
6059 *
6060 * RETURN VALUES
6061 *     vl stall count
6062 *
6063 * NOTES
6064 *
6065 * SEE ALSO
6066 *********/
6067 
6068 /****f* IBA Base: Types/ib_port_info_get_lmc
6069 * NAME
6070 *	ib_port_info_get_lmc
6071 *
6072 * DESCRIPTION
6073 *	Returns the LMC value assigned to this port.
6074 *
6075 * SYNOPSIS
6076 */
6077 static inline uint8_t OSM_API
ib_port_info_get_lmc(IN const ib_port_info_t * const p_pi)6078 ib_port_info_get_lmc(IN const ib_port_info_t * const p_pi)
6079 {
6080 	return ((uint8_t) (p_pi->mkey_lmc & IB_PORT_LMC_MASK));
6081 }
6082 
6083 /*
6084 * PARAMETERS
6085 *	p_pi
6086 *		[in] Pointer to a PortInfo attribute.
6087 *
6088 * RETURN VALUES
6089 *	Returns the LMC value assigned to this port.
6090 *
6091 * NOTES
6092 *
6093 * SEE ALSO
6094 *********/
6095 
6096 /****f* IBA Base: Types/ib_port_info_set_lmc
6097 * NAME
6098 *	ib_port_info_set_lmc
6099 *
6100 * DESCRIPTION
6101 *	Sets the LMC value in the PortInfo attribute.
6102 *
6103 * SYNOPSIS
6104 */
6105 static inline void OSM_API
ib_port_info_set_lmc(IN ib_port_info_t * const p_pi,IN const uint8_t lmc)6106 ib_port_info_set_lmc(IN ib_port_info_t * const p_pi, IN const uint8_t lmc)
6107 {
6108 	CL_ASSERT(lmc <= IB_PORT_LMC_MAX);
6109 	p_pi->mkey_lmc = (uint8_t) ((p_pi->mkey_lmc & 0xF8) | lmc);
6110 }
6111 
6112 /*
6113 * PARAMETERS
6114 *	p_pi
6115 *		[in] Pointer to a PortInfo attribute.
6116 *
6117 *	lmc
6118 *		[in] LMC value to set, must be less than 7.
6119 *
6120 * RETURN VALUES
6121 *	None.
6122 *
6123 * NOTES
6124 *
6125 * SEE ALSO
6126 *********/
6127 
6128 /****f* IBA Base: Types/ib_port_info_get_link_speed_enabled
6129 * NAME
6130 *	ib_port_info_get_link_speed_enabled
6131 *
6132 * DESCRIPTION
6133 *	Returns the link speed enabled value assigned to this port.
6134 *
6135 * SYNOPSIS
6136 */
6137 static inline uint8_t OSM_API
ib_port_info_get_link_speed_enabled(IN const ib_port_info_t * const p_pi)6138 ib_port_info_get_link_speed_enabled(IN const ib_port_info_t * const p_pi)
6139 {
6140 	return ((uint8_t) (p_pi->link_speed & IB_PORT_LINK_SPEED_ENABLED_MASK));
6141 }
6142 
6143 /*
6144 * PARAMETERS
6145 *	p_pi
6146 *		[in] Pointer to a PortInfo attribute.
6147 *
6148 * RETURN VALUES
6149 *	Port state.
6150 *
6151 * NOTES
6152 *
6153 * SEE ALSO
6154 *********/
6155 
6156 /****f* IBA Base: Types/ib_port_info_set_link_speed_enabled
6157 * NAME
6158 *	ib_port_info_set_link_speed_enabled
6159 *
6160 * DESCRIPTION
6161 *	Sets the link speed enabled value in the PortInfo attribute.
6162 *
6163 * SYNOPSIS
6164 */
6165 static inline void OSM_API
ib_port_info_set_link_speed_enabled(IN ib_port_info_t * const p_pi,IN const uint8_t link_speed_enabled)6166 ib_port_info_set_link_speed_enabled(IN ib_port_info_t * const p_pi,
6167 				    IN const uint8_t link_speed_enabled)
6168 {
6169 	p_pi->link_speed =
6170 	    (uint8_t) ((p_pi->link_speed & 0xF0) | link_speed_enabled);
6171 }
6172 
6173 /*
6174 * PARAMETERS
6175 *	p_pi
6176 *		[in] Pointer to a PortInfo attribute.
6177 *
6178 *	link_speed_enabled
6179 *		[in] link speed enabled value to set.
6180 *
6181 * RETURN VALUES
6182 *	None.
6183 *
6184 * NOTES
6185 *
6186 * SEE ALSO
6187 *********/
6188 
6189 /****f* IBA Base: Types/ib_port_info_get_mpb
6190 * NAME
6191 *	ib_port_info_get_mpb
6192 *
6193 * DESCRIPTION
6194 *	Returns the M_Key protect bits assigned to this port.
6195 *
6196 * SYNOPSIS
6197 */
6198 static inline uint8_t OSM_API
ib_port_info_get_mpb(IN const ib_port_info_t * const p_pi)6199 ib_port_info_get_mpb(IN const ib_port_info_t * const p_pi)
6200 {
6201 	return ((uint8_t) ((p_pi->mkey_lmc & IB_PORT_MPB_MASK) >>
6202 			   IB_PORT_MPB_SHIFT));
6203 }
6204 
6205 /*
6206 * PARAMETERS
6207 *	p_ni
6208 *		[in] Pointer to a PortInfo attribute.
6209 *
6210 * RETURN VALUES
6211 *	Returns the M_Key protect bits assigned to this port.
6212 *
6213 * NOTES
6214 *
6215 * SEE ALSO
6216 *********/
6217 
6218 /****f* IBA Base: Types/ib_port_info_set_mpb
6219 * NAME
6220 *	ib_port_info_set_mpb
6221 *
6222 * DESCRIPTION
6223 *	Set the M_Key protect bits of this port.
6224 *
6225 * SYNOPSIS
6226 */
6227 static inline void OSM_API
ib_port_info_set_mpb(IN ib_port_info_t * p_pi,IN uint8_t mpb)6228 ib_port_info_set_mpb(IN ib_port_info_t * p_pi, IN uint8_t mpb)
6229 {
6230 	p_pi->mkey_lmc =
6231 	    (~IB_PORT_MPB_MASK & p_pi->mkey_lmc) |
6232 	    (IB_PORT_MPB_MASK & (mpb << IB_PORT_MPB_SHIFT));
6233 }
6234 
6235 /*
6236 * PARAMETERS
6237 *	mpb
6238 *		[in] M_Key protect bits
6239 *	p_ni
6240 *		[in] Pointer to a PortInfo attribute.
6241 *
6242 * RETURN VALUES
6243 *
6244 * NOTES
6245 *
6246 * SEE ALSO
6247 *********/
6248 
6249 /****f* IBA Base: Types/ib_port_info_get_local_phy_err_thd
6250 * NAME
6251 *	ib_port_info_get_local_phy_err_thd
6252 *
6253 * DESCRIPTION
6254 *	Returns the Phy Link Threshold
6255 *
6256 * SYNOPSIS
6257 */
6258 static inline uint8_t OSM_API
ib_port_info_get_local_phy_err_thd(IN const ib_port_info_t * const p_pi)6259 ib_port_info_get_local_phy_err_thd(IN const ib_port_info_t * const p_pi)
6260 {
6261 	return (uint8_t) ((p_pi->error_threshold & 0xF0) >> 4);
6262 }
6263 
6264 /*
6265 * PARAMETERS
6266 *	p_pi
6267 *		[in] Pointer to a PortInfo attribute.
6268 *
6269 * RETURN VALUES
6270 *	Returns the Phy Link error threshold assigned to this port.
6271 *
6272 * NOTES
6273 *
6274 * SEE ALSO
6275 *********/
6276 
6277 /****f* IBA Base: Types/ib_port_info_get_overrun_err_thd
6278 * NAME
6279 *	ib_port_info_get_local_overrun_err_thd
6280 *
6281 * DESCRIPTION
6282 *	Returns the Credits Overrun Errors Threshold
6283 *
6284 * SYNOPSIS
6285 */
6286 static inline uint8_t OSM_API
ib_port_info_get_overrun_err_thd(IN const ib_port_info_t * const p_pi)6287 ib_port_info_get_overrun_err_thd(IN const ib_port_info_t * const p_pi)
6288 {
6289 	return (uint8_t) (p_pi->error_threshold & 0x0F);
6290 }
6291 
6292 /*
6293 * PARAMETERS
6294 *	p_pi
6295 *		[in] Pointer to a PortInfo attribute.
6296 *
6297 * RETURN VALUES
6298 *	Returns the Credits Overrun errors threshold assigned to this port.
6299 *
6300 * NOTES
6301 *
6302 * SEE ALSO
6303 *********/
6304 
6305 /****f* IBA Base: Types/ib_port_info_set_phy_and_overrun_err_thd
6306 * NAME
6307 *	ib_port_info_set_phy_and_overrun_err_thd
6308 *
6309 * DESCRIPTION
6310 *	Sets the Phy Link and Credits Overrun Errors Threshold
6311 *
6312 * SYNOPSIS
6313 */
6314 static inline void OSM_API
ib_port_info_set_phy_and_overrun_err_thd(IN ib_port_info_t * const p_pi,IN uint8_t phy_threshold,IN uint8_t overrun_threshold)6315 ib_port_info_set_phy_and_overrun_err_thd(IN ib_port_info_t * const p_pi,
6316 					 IN uint8_t phy_threshold,
6317 					 IN uint8_t overrun_threshold)
6318 {
6319 	p_pi->error_threshold =
6320 	    (uint8_t) (((phy_threshold & 0x0F) << 4) |
6321 		       (overrun_threshold & 0x0F));
6322 }
6323 
6324 /*
6325 * PARAMETERS
6326 *	p_pi
6327 *		[in] Pointer to a PortInfo attribute.
6328 *
6329 *	phy_threshold
6330 *		[in] Physical Link Errors Threshold above which Trap 129 is generated
6331 *
6332 *  overrun_threshold
6333 *     [in] Credits overrun Errors Threshold above which Trap 129 is generated
6334 *
6335 * RETURN VALUES
6336 *	None.
6337 *
6338 * NOTES
6339 *
6340 * SEE ALSO
6341 *********/
6342 
6343 /****f* IBA Base: Types/ib_port_info_get_m_key
6344 * NAME
6345 *	ib_port_info_get_m_key
6346 *
6347 * DESCRIPTION
6348 *	Gets the M_Key
6349 *
6350 * SYNOPSIS
6351 */
6352 static inline ib_net64_t OSM_API
ib_port_info_get_m_key(IN const ib_port_info_t * const p_pi)6353 ib_port_info_get_m_key(IN const ib_port_info_t * const p_pi)
6354 {
6355 	return p_pi->m_key;
6356 }
6357 
6358 /*
6359 * PARAMETERS
6360 *	p_pi
6361 *		[in] Pointer to a PortInfo attribute.
6362 *
6363 * RETURN VALUES
6364 *	M_Key.
6365 *
6366 * NOTES
6367 *
6368 * SEE ALSO
6369 *********/
6370 
6371 /****f* IBA Base: Types/ib_port_info_set_m_key
6372 * NAME
6373 *	ib_port_info_set_m_key
6374 *
6375 * DESCRIPTION
6376 *	Sets the M_Key value
6377 *
6378 * SYNOPSIS
6379 */
6380 static inline void OSM_API
ib_port_info_set_m_key(IN ib_port_info_t * const p_pi,IN ib_net64_t m_key)6381 ib_port_info_set_m_key(IN ib_port_info_t * const p_pi, IN ib_net64_t m_key)
6382 {
6383 	p_pi->m_key = m_key;
6384 }
6385 
6386 /*
6387 * PARAMETERS
6388 *	p_pi
6389 *		[in] Pointer to a PortInfo attribute.
6390 *	m_key
6391 *		[in] M_Key value.
6392 *
6393 * RETURN VALUES
6394 *	None.
6395 *
6396 * NOTES
6397 *
6398 * SEE ALSO
6399 *********/
6400 
6401 
6402 /****s* IBA Base: Types/ib_mlnx_ext_port_info_t
6403 * NAME
6404 *	ib_mlnx_ext_port_info_t
6405 *
6406 * DESCRIPTION
6407 *	Mellanox ExtendedPortInfo (Vendor specific SM class attribute).
6408 *
6409 * SYNOPSIS
6410 */
6411 #include <complib/cl_packon.h>
6412 typedef struct _ib_mlnx_ext_port_info {
6413 	uint8_t resvd1[3];
6414 	uint8_t state_change_enable;
6415 	uint8_t resvd2[3];
6416 	uint8_t link_speed_supported;
6417 	uint8_t resvd3[3];
6418 	uint8_t link_speed_enabled;
6419 	uint8_t resvd4[3];
6420 	uint8_t link_speed_active;
6421 	uint8_t resvd5[48];
6422 } PACK_SUFFIX ib_mlnx_ext_port_info_t;
6423 #include <complib/cl_packoff.h>
6424 /************/
6425 
6426 #define FDR10 0x01
6427 
6428 typedef uint8_t ib_svc_name_t[64];
6429 
6430 #include <complib/cl_packon.h>
6431 typedef struct _ib_service_record {
6432 	ib_net64_t service_id;
6433 	ib_gid_t service_gid;
6434 	ib_net16_t service_pkey;
6435 	ib_net16_t resv;
6436 	ib_net32_t service_lease;
6437 	uint8_t service_key[16];
6438 	ib_svc_name_t service_name;
6439 	uint8_t service_data8[16];
6440 	ib_net16_t service_data16[8];
6441 	ib_net32_t service_data32[4];
6442 	ib_net64_t service_data64[2];
6443 } PACK_SUFFIX ib_service_record_t;
6444 #include <complib/cl_packoff.h>
6445 
6446 #include <complib/cl_packon.h>
6447 typedef struct _ib_portinfo_record {
6448 	ib_net16_t lid;
6449 	uint8_t port_num;
6450 	uint8_t options;
6451 	ib_port_info_t port_info;
6452 	uint8_t pad[4];
6453 } PACK_SUFFIX ib_portinfo_record_t;
6454 #include <complib/cl_packoff.h>
6455 
6456 #include <complib/cl_packon.h>
6457 typedef struct _ib_portinfoext_record {
6458 	ib_net16_t lid;
6459 	uint8_t port_num;
6460 	uint8_t options;
6461 	ib_port_info_ext_t port_info_ext;
6462 } PACK_SUFFIX ib_portinfoext_record_t;
6463 #include <complib/cl_packoff.h>
6464 
6465 #include <complib/cl_packon.h>
6466 typedef struct _ib_link_record {
6467 	ib_net16_t from_lid;
6468 	uint8_t from_port_num;
6469 	uint8_t to_port_num;
6470 	ib_net16_t to_lid;
6471 	uint8_t pad[2];
6472 } PACK_SUFFIX ib_link_record_t;
6473 #include <complib/cl_packoff.h>
6474 
6475 #include <complib/cl_packon.h>
6476 typedef struct _ib_sminfo_record {
6477 	ib_net16_t lid;
6478 	uint16_t resv0;
6479 	ib_sm_info_t sm_info;
6480 	uint8_t pad[7];
6481 } PACK_SUFFIX ib_sminfo_record_t;
6482 #include <complib/cl_packoff.h>
6483 
6484 /****s* IBA Base: Types/ib_lft_record_t
6485 * NAME
6486 *	ib_lft_record_t
6487 *
6488 * DESCRIPTION
6489 *	IBA defined LinearForwardingTableRecord (15.2.5.6)
6490 *
6491 * SYNOPSIS
6492 */
6493 #include <complib/cl_packon.h>
6494 typedef struct _ib_lft_record {
6495 	ib_net16_t lid;
6496 	ib_net16_t block_num;
6497 	uint32_t resv0;
6498 	uint8_t lft[64];
6499 } PACK_SUFFIX ib_lft_record_t;
6500 #include <complib/cl_packoff.h>
6501 /************/
6502 
6503 /****s* IBA Base: Types/ib_mft_record_t
6504 * NAME
6505 *	ib_mft_record_t
6506 *
6507 * DESCRIPTION
6508 *	IBA defined MulticastForwardingTableRecord (15.2.5.8)
6509 *
6510 * SYNOPSIS
6511 */
6512 #include <complib/cl_packon.h>
6513 typedef struct _ib_mft_record {
6514 	ib_net16_t lid;
6515 	ib_net16_t position_block_num;
6516 	uint32_t resv0;
6517 	ib_net16_t mft[IB_MCAST_BLOCK_SIZE];
6518 } PACK_SUFFIX ib_mft_record_t;
6519 #include <complib/cl_packoff.h>
6520 /************/
6521 
6522 /****s* IBA Base: Types/ib_switch_info_t
6523 * NAME
6524 *	ib_switch_info_t
6525 *
6526 * DESCRIPTION
6527 *	IBA defined SwitchInfo. (14.2.5.4)
6528 *
6529 * SYNOPSIS
6530 */
6531 #include <complib/cl_packon.h>
6532 typedef struct _ib_switch_info {
6533 	ib_net16_t lin_cap;
6534 	ib_net16_t rand_cap;
6535 	ib_net16_t mcast_cap;
6536 	ib_net16_t lin_top;
6537 	uint8_t def_port;
6538 	uint8_t def_mcast_pri_port;
6539 	uint8_t def_mcast_not_port;
6540 	uint8_t life_state;
6541 	ib_net16_t lids_per_port;
6542 	ib_net16_t enforce_cap;
6543 	uint8_t flags;
6544 	uint8_t resvd;
6545 	ib_net16_t mcast_top;
6546 } PACK_SUFFIX ib_switch_info_t;
6547 #include <complib/cl_packoff.h>
6548 /************/
6549 
6550 #include <complib/cl_packon.h>
6551 typedef struct _ib_switch_info_record {
6552 	ib_net16_t lid;
6553 	uint16_t resv0;
6554 	ib_switch_info_t switch_info;
6555 } PACK_SUFFIX ib_switch_info_record_t;
6556 #include <complib/cl_packoff.h>
6557 
6558 #define IB_SWITCH_PSC 0x04
6559 
6560 /****f* IBA Base: Types/ib_switch_info_get_state_change
6561 * NAME
6562 *	ib_switch_info_get_state_change
6563 *
6564 * DESCRIPTION
6565 *	Returns the value of the state change flag.
6566 *
6567 * SYNOPSIS
6568 */
6569 static inline boolean_t OSM_API
ib_switch_info_get_state_change(IN const ib_switch_info_t * const p_si)6570 ib_switch_info_get_state_change(IN const ib_switch_info_t * const p_si)
6571 {
6572 	return ((p_si->life_state & IB_SWITCH_PSC) == IB_SWITCH_PSC);
6573 }
6574 
6575 /*
6576 * PARAMETERS
6577 *	p_si
6578 *		[in] Pointer to a SwitchInfo attribute.
6579 *
6580 * RETURN VALUES
6581 *	Returns the value of the state change flag.
6582 *
6583 * NOTES
6584 *
6585 * SEE ALSO
6586 *********/
6587 
6588 /****f* IBA Base: Types/ib_switch_info_clear_state_change
6589 * NAME
6590 *	ib_switch_info_clear_state_change
6591 *
6592 * DESCRIPTION
6593 *	Clears the switch's state change bit.
6594 *
6595 * SYNOPSIS
6596 */
6597 static inline void OSM_API
ib_switch_info_clear_state_change(IN ib_switch_info_t * const p_si)6598 ib_switch_info_clear_state_change(IN ib_switch_info_t * const p_si)
6599 {
6600 	p_si->life_state = (uint8_t) (p_si->life_state & 0xFB);
6601 }
6602 
6603 /*
6604 * PARAMETERS
6605 *	p_si
6606 *		[in] Pointer to a SwitchInfo attribute.
6607 *
6608 * RETURN VALUES
6609 *	None
6610 *
6611 * NOTES
6612 *
6613 * SEE ALSO
6614 *********/
6615 
6616 /****f* IBA Base: Types/ib_switch_info_state_change_set
6617 * NAME
6618 *	ib_switch_info_state_change_set
6619 *
6620 * DESCRIPTION
6621 *	Clears the switch's state change bit.
6622 *
6623 * SYNOPSIS
6624 */
6625 static inline void OSM_API
ib_switch_info_state_change_set(IN ib_switch_info_t * const p_si)6626 ib_switch_info_state_change_set(IN ib_switch_info_t * const p_si)
6627 {
6628 	p_si->life_state = (uint8_t) ((p_si->life_state & ~IB_SWITCH_PSC) | IB_SWITCH_PSC);
6629 }
6630 
6631 /*
6632 * PARAMETERS
6633 *	p_si
6634 *		[in] Pointer to a SwitchInfo attribute.
6635 *
6636 * RETURN VALUES
6637 *	None
6638 *
6639 * NOTES
6640 *
6641 * SEE ALSO
6642 *********/
6643 
6644 /****f* IBA Base: Types/ib_switch_info_get_opt_sl2vlmapping
6645 * NAME
6646 *	ib_switch_info_get_state_opt_sl2vlmapping
6647 *
6648 * DESCRIPTION
6649 *       Returns the value of the optimized SLtoVLMapping programming flag.
6650 *
6651 * SYNOPSIS
6652 */
6653 static inline boolean_t OSM_API
ib_switch_info_get_opt_sl2vlmapping(IN const ib_switch_info_t * const p_si)6654 ib_switch_info_get_opt_sl2vlmapping(IN const ib_switch_info_t * const p_si)
6655 {
6656         return ((p_si->life_state & 0x01) == 0x01);
6657 }
6658 
6659 /*
6660 * PARAMETERS
6661 *	p_si
6662 *		[in] Pointer to a SwitchInfo attribute.
6663 *
6664 * RETURN VALUES
6665 *	Returns the value of the optimized SLtoVLMapping programming flag.
6666 *
6667 * NOTES
6668 *
6669 * SEE ALSO
6670 *********/
6671 
6672 /****f* IBA Base: Types/ib_switch_info_set_life_time
6673 * NAME
6674 *	ib_switch_info_set_life_time
6675 *
6676 * DESCRIPTION
6677 *	Sets the value of LifeTimeValue.
6678 *
6679 * SYNOPSIS
6680 */
6681 static inline void OSM_API
ib_switch_info_set_life_time(IN ib_switch_info_t * const p_si,IN const uint8_t life_time_val)6682 ib_switch_info_set_life_time(IN ib_switch_info_t * const p_si,
6683 			     IN const uint8_t life_time_val)
6684 {
6685 	p_si->life_state = (p_si->life_state & 0x1f) |
6686 			   (life_time_val << 3);
6687 }
6688 
6689 /*
6690 * PARAMETERS
6691 *	p_si
6692 *		[in] Pointer to a SwitchInfo attribute.
6693 *	life_time_val
6694 *		[in] LiveTimeValue.
6695 *
6696 * RETURN VALUES
6697 *	None.
6698 *
6699 * NOTES
6700 *
6701 * SEE ALSO
6702 *********/
6703 
6704 /****f* IBA Base: Types/ib_switch_info_is_enhanced_port0
6705 * NAME
6706 *	ib_switch_info_is_enhanced_port0
6707 *
6708 * DESCRIPTION
6709 *	Returns TRUE if the enhancedPort0 bit is on (meaning the switch
6710 *  port zero supports enhanced functions).
6711 *  Returns FALSE otherwise.
6712 *
6713 * SYNOPSIS
6714 */
6715 static inline boolean_t OSM_API
ib_switch_info_is_enhanced_port0(IN const ib_switch_info_t * const p_si)6716 ib_switch_info_is_enhanced_port0(IN const ib_switch_info_t * const p_si)
6717 {
6718 	return ((p_si->flags & 0x08) == 0x08);
6719 }
6720 
6721 /*
6722 * PARAMETERS
6723 *	p_si
6724 *		[in] Pointer to a SwitchInfo attribute.
6725 *
6726 * RETURN VALUES
6727 *	Returns TRUE if the switch supports enhanced port 0. FALSE otherwise.
6728 *
6729 * NOTES
6730 *
6731 * SEE ALSO
6732 *********/
6733 
6734 /****s* IBA Base: Types/ib_guid_info_t
6735 * NAME
6736 *	ib_guid_info_t
6737 *
6738 * DESCRIPTION
6739 *	IBA defined GuidInfo. (14.2.5.5)
6740 *
6741 * SYNOPSIS
6742 */
6743 #define	GUID_TABLE_MAX_ENTRIES		8
6744 
6745 #include <complib/cl_packon.h>
6746 typedef struct _ib_guid_info {
6747 	ib_net64_t guid[GUID_TABLE_MAX_ENTRIES];
6748 } PACK_SUFFIX ib_guid_info_t;
6749 #include <complib/cl_packoff.h>
6750 /************/
6751 
6752 #include <complib/cl_packon.h>
6753 typedef struct _ib_guidinfo_record {
6754 	ib_net16_t lid;
6755 	uint8_t block_num;
6756 	uint8_t resv;
6757 	uint32_t reserved;
6758 	ib_guid_info_t guid_info;
6759 } PACK_SUFFIX ib_guidinfo_record_t;
6760 #include <complib/cl_packoff.h>
6761 
6762 #define IB_MULTIPATH_MAX_GIDS 11	/* Support max that can fit into first MAD (for now) */
6763 
6764 #include <complib/cl_packon.h>
6765 typedef struct _ib_multipath_rec_t {
6766 	ib_net32_t hop_flow_raw;
6767 	uint8_t tclass;
6768 	uint8_t num_path;
6769 	ib_net16_t pkey;
6770 	ib_net16_t qos_class_sl;
6771 	uint8_t mtu;
6772 	uint8_t rate;
6773 	uint8_t pkt_life;
6774 	uint8_t service_id_8msb;
6775 	uint8_t independence;	/* formerly resv2 */
6776 	uint8_t sgid_count;
6777 	uint8_t dgid_count;
6778 	uint8_t service_id_56lsb[7];
6779 	ib_gid_t gids[IB_MULTIPATH_MAX_GIDS];
6780 } PACK_SUFFIX ib_multipath_rec_t;
6781 #include <complib/cl_packoff.h>
6782 /*
6783 * FIELDS
6784 *       hop_flow_raw
6785 *               Global routing parameters: hop count, flow label and raw bit.
6786 *
6787 *       tclass
6788 *               Another global routing parameter.
6789 *
6790 *       num_path
6791 *     Reversible path - 1 bit to say if path is reversible.
6792 *               num_path [6:0] In queries, maximum number of paths to return.
6793 *               In responses, undefined.
6794 *
6795 *       pkey
6796 *               Partition key (P_Key) to use on this path.
6797 *
6798 *       qos_class_sl
6799 *               QoS class and service level to use on this path.
6800 *
6801 *       mtu
6802 *               MTU and MTU selector fields to use on this path
6803 *       rate
6804 *               Rate and rate selector fields to use on this path.
6805 *
6806 *       pkt_life
6807 *               Packet lifetime
6808 *
6809 *	service_id_8msb
6810 *		8 most significant bits of Service ID
6811 *
6812 *	service_id_56lsb
6813 *		56 least significant bits of Service ID
6814 *
6815 *       preference
6816 *               Indicates the relative merit of this path versus other path
6817 *               records returned from the SA.  Lower numbers are better.
6818 *
6819 * SEE ALSO
6820 *********/
6821 
6822 /****f* IBA Base: Types/ib_multipath_rec_num_path
6823 * NAME
6824 *       ib_multipath_rec_num_path
6825 *
6826 * DESCRIPTION
6827 *       Get max number of paths to return.
6828 *
6829 * SYNOPSIS
6830 */
6831 static inline uint8_t OSM_API
ib_multipath_rec_num_path(IN const ib_multipath_rec_t * const p_rec)6832 ib_multipath_rec_num_path(IN const ib_multipath_rec_t * const p_rec)
6833 {
6834 	return (p_rec->num_path & 0x7F);
6835 }
6836 
6837 /*
6838 * PARAMETERS
6839 *       p_rec
6840 *               [in] Pointer to the multipath record object.
6841 *
6842 * RETURN VALUES
6843 *       Maximum number of paths to return for each unique SGID_DGID combination.
6844 *
6845 * NOTES
6846 *
6847 * SEE ALSO
6848 *       ib_multipath_rec_t
6849 *********/
6850 
6851 /****f* IBA Base: Types/ib_multipath_rec_set_sl
6852 * NAME
6853 *	ib_multipath_rec_set_sl
6854 *
6855 * DESCRIPTION
6856 *	Set path service level.
6857 *
6858 * SYNOPSIS
6859 */
6860 static inline void OSM_API
ib_multipath_rec_set_sl(IN ib_multipath_rec_t * const p_rec,IN const uint8_t sl)6861 ib_multipath_rec_set_sl(
6862 	IN ib_multipath_rec_t* const p_rec,
6863 	IN const uint8_t sl )
6864 {
6865 	p_rec->qos_class_sl =
6866 		(p_rec->qos_class_sl & CL_HTON16(IB_MULTIPATH_REC_QOS_CLASS_MASK)) |
6867 			cl_hton16(sl & IB_MULTIPATH_REC_SL_MASK);
6868 }
6869 /*
6870 * PARAMETERS
6871 *	p_rec
6872 *		[in] Pointer to the MultiPath record object.
6873 *
6874 *	sl
6875 *		[in] Service level to set.
6876 *
6877 * RETURN VALUES
6878 *	None
6879 *
6880 * NOTES
6881 *
6882 * SEE ALSO
6883 *	ib_multipath_rec_t
6884 *********/
6885 
6886 /****f* IBA Base: Types/ib_multipath_rec_sl
6887 * NAME
6888 *       ib_multipath_rec_sl
6889 *
6890 * DESCRIPTION
6891 *       Get multipath service level.
6892 *
6893 * SYNOPSIS
6894 */
6895 static inline uint8_t OSM_API
ib_multipath_rec_sl(IN const ib_multipath_rec_t * const p_rec)6896 ib_multipath_rec_sl(IN const ib_multipath_rec_t * const p_rec)
6897 {
6898 	return ((uint8_t) ((cl_ntoh16(p_rec->qos_class_sl)) & IB_MULTIPATH_REC_SL_MASK));
6899 }
6900 
6901 /*
6902 * PARAMETERS
6903 *       p_rec
6904 *               [in] Pointer to the multipath record object.
6905 *
6906 * RETURN VALUES
6907 *	SL.
6908 *
6909 * NOTES
6910 *
6911 * SEE ALSO
6912 *       ib_multipath_rec_t
6913 *********/
6914 
6915 /****f* IBA Base: Types/ib_multipath_rec_set_qos_class
6916 * NAME
6917 *	ib_multipath_rec_set_qos_class
6918 *
6919 * DESCRIPTION
6920 *	Set path QoS class.
6921 *
6922 * SYNOPSIS
6923 */
6924 static inline void	OSM_API
ib_multipath_rec_set_qos_class(IN ib_multipath_rec_t * const p_rec,IN const uint16_t qos_class)6925 ib_multipath_rec_set_qos_class(
6926 	IN ib_multipath_rec_t* const p_rec,
6927 	IN const uint16_t qos_class )
6928 {
6929 	p_rec->qos_class_sl =
6930 		(p_rec->qos_class_sl & CL_HTON16(IB_MULTIPATH_REC_SL_MASK)) |
6931 			cl_hton16(qos_class << 4);
6932 }
6933 /*
6934 * PARAMETERS
6935 *	p_rec
6936 *		[in] Pointer to the MultiPath record object.
6937 *
6938 *	qos_class
6939 *		[in] QoS class to set.
6940 *
6941 * RETURN VALUES
6942 *	None
6943 *
6944 * NOTES
6945 *
6946 * SEE ALSO
6947 *	ib_multipath_rec_t
6948 *********/
6949 
6950 /****f* IBA Base: Types/ib_multipath_rec_qos_class
6951 * NAME
6952 *	ib_multipath_rec_qos_class
6953 *
6954 * DESCRIPTION
6955 *	Get QoS class.
6956 *
6957 * SYNOPSIS
6958 */
6959 static inline uint16_t	OSM_API
ib_multipath_rec_qos_class(IN const ib_multipath_rec_t * const p_rec)6960 ib_multipath_rec_qos_class(
6961 	IN	const	ib_multipath_rec_t* const	p_rec )
6962 {
6963 	return (cl_ntoh16( p_rec->qos_class_sl ) >> 4);
6964 }
6965 /*
6966 * PARAMETERS
6967 *	p_rec
6968 *		[in] Pointer to the MultiPath record object.
6969 *
6970 * RETURN VALUES
6971 *	QoS class of the MultiPath record.
6972 *
6973 * NOTES
6974 *
6975 * SEE ALSO
6976 *	ib_multipath_rec_t
6977 *********/
6978 
6979 /****f* IBA Base: Types/ib_multipath_rec_mtu
6980 * NAME
6981 *       ib_multipath_rec_mtu
6982 *
6983 * DESCRIPTION
6984 *       Get encoded path MTU.
6985 *
6986 * SYNOPSIS
6987 */
6988 static inline uint8_t OSM_API
ib_multipath_rec_mtu(IN const ib_multipath_rec_t * const p_rec)6989 ib_multipath_rec_mtu(IN const ib_multipath_rec_t * const p_rec)
6990 {
6991 	return ((uint8_t) (p_rec->mtu & IB_MULTIPATH_REC_BASE_MASK));
6992 }
6993 
6994 /*
6995 * PARAMETERS
6996 *       p_rec
6997 *               [in] Pointer to the multipath record object.
6998 *
6999 * RETURN VALUES
7000 *       Encoded path MTU.
7001 *               1: 256
7002 *               2: 512
7003 *               3: 1024
7004 *               4: 2048
7005 *               5: 4096
7006 *               others: reserved
7007 *
7008 * NOTES
7009 *
7010 * SEE ALSO
7011 *       ib_multipath_rec_t
7012 *********/
7013 
7014 /****f* IBA Base: Types/ib_multipath_rec_mtu_sel
7015 * NAME
7016 *       ib_multipath_rec_mtu_sel
7017 *
7018 * DESCRIPTION
7019 *       Get encoded multipath MTU selector.
7020 *
7021 * SYNOPSIS
7022 */
7023 static inline uint8_t OSM_API
ib_multipath_rec_mtu_sel(IN const ib_multipath_rec_t * const p_rec)7024 ib_multipath_rec_mtu_sel(IN const ib_multipath_rec_t * const p_rec)
7025 {
7026 	return ((uint8_t) ((p_rec->mtu & IB_MULTIPATH_REC_SELECTOR_MASK) >> 6));
7027 }
7028 
7029 /*
7030 * PARAMETERS
7031 *       p_rec
7032 *               [in] Pointer to the multipath record object.
7033 *
7034 * RETURN VALUES
7035 *       Encoded path MTU selector value (for queries).
7036 *               0: greater than MTU specified
7037 *               1: less than MTU specified
7038 *               2: exactly the MTU specified
7039 *               3: largest MTU available
7040 *
7041 * NOTES
7042 *
7043 * SEE ALSO
7044 *       ib_multipath_rec_t
7045 *********/
7046 
7047 /****f* IBA Base: Types/ib_multipath_rec_rate
7048 * NAME
7049 *	ib_multipath_rec_rate
7050 *
7051 * DESCRIPTION
7052 *	Get encoded multipath rate.
7053 *
7054 * SYNOPSIS
7055 */
7056 static inline uint8_t OSM_API
ib_multipath_rec_rate(IN const ib_multipath_rec_t * const p_rec)7057 ib_multipath_rec_rate(IN const ib_multipath_rec_t * const p_rec)
7058 {
7059 	return ((uint8_t) (p_rec->rate & IB_MULTIPATH_REC_BASE_MASK));
7060 }
7061 
7062 /*
7063 * PARAMETERS
7064 *	p_rec
7065 *		[in] Pointer to the multipath record object.
7066 *
7067 * RETURN VALUES
7068 *	Encoded multipath rate.
7069 *		2: 2.5 Gb/sec.
7070 *		3: 10 Gb/sec.
7071 *		4: 30 Gb/sec.
7072 *		5: 5 Gb/sec.
7073 *		6: 20 Gb/sec.
7074 *		7: 40 Gb/sec.
7075 *		8: 60 Gb/sec.
7076 *		9: 80 Gb/sec.
7077 *		10: 120 Gb/sec.
7078 *		11: 14 Gb/sec.
7079 *		12: 56 Gb/sec.
7080 *		13: 112 Gb/sec.
7081 *		14: 168 Gb/sec.
7082 *		15: 25 Gb/sec.
7083 *		16: 100 Gb/sec.
7084 *		17: 200 Gb/sec.
7085 *		18: 300 Gb/sec.
7086 *               others: reserved
7087 *
7088 * NOTES
7089 *
7090 * SEE ALSO
7091 *       ib_multipath_rec_t
7092 *********/
7093 
7094 /****f* IBA Base: Types/ib_multipath_rec_rate_sel
7095 * NAME
7096 *       ib_multipath_rec_rate_sel
7097 *
7098 * DESCRIPTION
7099 *       Get encoded multipath rate selector.
7100 *
7101 * SYNOPSIS
7102 */
7103 static inline uint8_t OSM_API
ib_multipath_rec_rate_sel(IN const ib_multipath_rec_t * const p_rec)7104 ib_multipath_rec_rate_sel(IN const ib_multipath_rec_t * const p_rec)
7105 {
7106 	return ((uint8_t)
7107 		((p_rec->rate & IB_MULTIPATH_REC_SELECTOR_MASK) >> 6));
7108 }
7109 
7110 /*
7111 * PARAMETERS
7112 *       p_rec
7113 *               [in] Pointer to the multipath record object.
7114 *
7115 * RETURN VALUES
7116 *       Encoded path rate selector value (for queries).
7117 *               0: greater than rate specified
7118 *               1: less than rate specified
7119 *               2: exactly the rate specified
7120 *               3: largest rate available
7121 *
7122 * NOTES
7123 *
7124 * SEE ALSO
7125 *       ib_multipath_rec_t
7126 *********/
7127 
7128 /****f* IBA Base: Types/ib_multipath_rec_pkt_life
7129 * NAME
7130 *       ib_multipath_rec_pkt_life
7131 *
7132 * DESCRIPTION
7133 *       Get encoded multipath pkt_life.
7134 *
7135 * SYNOPSIS
7136 */
7137 static inline uint8_t OSM_API
ib_multipath_rec_pkt_life(IN const ib_multipath_rec_t * const p_rec)7138 ib_multipath_rec_pkt_life(IN const ib_multipath_rec_t * const p_rec)
7139 {
7140 	return ((uint8_t) (p_rec->pkt_life & IB_MULTIPATH_REC_BASE_MASK));
7141 }
7142 
7143 /*
7144 * PARAMETERS
7145 *       p_rec
7146 *               [in] Pointer to the multipath record object.
7147 *
7148 * RETURN VALUES
7149 *       Encoded multipath pkt_life = 4.096 usec * 2 ** PacketLifeTime.
7150 *
7151 * NOTES
7152 *
7153 * SEE ALSO
7154 *       ib_multipath_rec_t
7155 *********/
7156 
7157 /****f* IBA Base: Types/ib_multipath_rec_pkt_life_sel
7158 * NAME
7159 *       ib_multipath_rec_pkt_life_sel
7160 *
7161 * DESCRIPTION
7162 *       Get encoded multipath pkt_lifetime selector.
7163 *
7164 * SYNOPSIS
7165 */
7166 static inline uint8_t OSM_API
ib_multipath_rec_pkt_life_sel(IN const ib_multipath_rec_t * const p_rec)7167 ib_multipath_rec_pkt_life_sel(IN const ib_multipath_rec_t * const p_rec)
7168 {
7169 	return ((uint8_t)
7170 		((p_rec->pkt_life & IB_MULTIPATH_REC_SELECTOR_MASK) >> 6));
7171 }
7172 
7173 /*
7174 * PARAMETERS
7175 *       p_rec
7176 *               [in] Pointer to the multipath record object.
7177 *
7178 * RETURN VALUES
7179 *       Encoded path pkt_lifetime selector value (for queries).
7180 *               0: greater than rate specified
7181 *               1: less than rate specified
7182 *               2: exactly the rate specified
7183 *               3: smallest packet lifetime available
7184 *
7185 * NOTES
7186 *
7187 * SEE ALSO
7188 *       ib_multipath_rec_t
7189 *********/
7190 
7191 /****f* IBA Base: Types/ib_multipath_rec_service_id
7192 * NAME
7193 *	ib_multipath_rec_service_id
7194 *
7195 * DESCRIPTION
7196 *	Get multipath service id.
7197 *
7198 * SYNOPSIS
7199 */
7200 static inline ib_net64_t OSM_API
ib_multipath_rec_service_id(IN const ib_multipath_rec_t * const p_rec)7201 ib_multipath_rec_service_id(IN const ib_multipath_rec_t * const p_rec)
7202 {
7203 	union {
7204 		ib_net64_t sid;
7205 		uint8_t sid_arr[8];
7206 	} sid_union;
7207 	sid_union.sid_arr[0] = p_rec->service_id_8msb;
7208 	memcpy(&sid_union.sid_arr[1], p_rec->service_id_56lsb, 7);
7209 	return sid_union.sid;
7210 }
7211 
7212 /*
7213 * PARAMETERS
7214 *	p_rec
7215 *		[in] Pointer to the multipath record object.
7216 *
7217 * RETURN VALUES
7218 *	Service ID
7219 *
7220 * NOTES
7221 *
7222 * SEE ALSO
7223 *	ib_multipath_rec_t
7224 *********/
7225 
7226 #define IB_NUM_PKEY_ELEMENTS_IN_BLOCK		32
7227 /****s* IBA Base: Types/ib_pkey_table_t
7228 * NAME
7229 *	ib_pkey_table_t
7230 *
7231 * DESCRIPTION
7232 *	IBA defined PKey table. (14.2.5.7)
7233 *
7234 * SYNOPSIS
7235 */
7236 
7237 #include <complib/cl_packon.h>
7238 typedef struct _ib_pkey_table {
7239 	ib_net16_t pkey_entry[IB_NUM_PKEY_ELEMENTS_IN_BLOCK];
7240 } PACK_SUFFIX ib_pkey_table_t;
7241 #include <complib/cl_packoff.h>
7242 /************/
7243 
7244 /****s* IBA Base: Types/ib_pkey_table_record_t
7245 * NAME
7246 *	ib_pkey_table_record_t
7247 *
7248 * DESCRIPTION
7249 *	IBA defined P_Key Table Record for SA Query. (15.2.5.11)
7250 *
7251 * SYNOPSIS
7252 */
7253 #include <complib/cl_packon.h>
7254 typedef struct _ib_pkey_table_record {
7255 	ib_net16_t lid;		// for CA: lid of port, for switch lid of port 0
7256 	ib_net16_t block_num;
7257 	uint8_t port_num;	// for switch: port number, for CA: reserved
7258 	uint8_t reserved1;
7259 	uint16_t reserved2;
7260 	ib_pkey_table_t pkey_tbl;
7261 } PACK_SUFFIX ib_pkey_table_record_t;
7262 #include <complib/cl_packoff.h>
7263 /************/
7264 
7265 #define IB_DROP_VL 15
7266 #define IB_MAX_NUM_VLS 16
7267 /****s* IBA Base: Types/ib_slvl_table_t
7268 * NAME
7269 *	ib_slvl_table_t
7270 *
7271 * DESCRIPTION
7272 *	IBA defined SL2VL Mapping Table Attribute. (14.2.5.8)
7273 *
7274 * SYNOPSIS
7275 */
7276 #include <complib/cl_packon.h>
7277 typedef struct _ib_slvl_table {
7278 	uint8_t raw_vl_by_sl[IB_MAX_NUM_VLS / 2];
7279 } PACK_SUFFIX ib_slvl_table_t;
7280 #include <complib/cl_packoff.h>
7281 /************/
7282 
7283 /****s* IBA Base: Types/ib_slvl_table_record_t
7284 * NAME
7285 *	ib_slvl_table_record_t
7286 *
7287 * DESCRIPTION
7288 *	IBA defined SL to VL Mapping Table Record for SA Query. (15.2.5.4)
7289 *
7290 * SYNOPSIS
7291 */
7292 #include <complib/cl_packon.h>
7293 typedef struct _ib_slvl_table_record {
7294 	ib_net16_t lid;		// for CA: lid of port, for switch lid of port 0
7295 	uint8_t in_port_num;	// reserved for CAs
7296 	uint8_t out_port_num;	// reserved for CAs
7297 	uint32_t resv;
7298 	ib_slvl_table_t slvl_tbl;
7299 } PACK_SUFFIX ib_slvl_table_record_t;
7300 #include <complib/cl_packoff.h>
7301 /************/
7302 
7303 /****f* IBA Base: Types/ib_slvl_table_set
7304 * NAME
7305 *	ib_slvl_table_set
7306 *
7307 * DESCRIPTION
7308 *	Set slvl table entry.
7309 *
7310 * SYNOPSIS
7311 */
7312 static inline void OSM_API
ib_slvl_table_set(IN ib_slvl_table_t * p_slvl_tbl,IN uint8_t sl_index,IN uint8_t vl)7313 ib_slvl_table_set(IN ib_slvl_table_t * p_slvl_tbl,
7314 		  IN uint8_t sl_index, IN uint8_t vl)
7315 {
7316 	uint8_t idx = sl_index / 2;
7317 	CL_ASSERT(vl <= 15);
7318 	CL_ASSERT(sl_index <= 15);
7319 
7320 	if (sl_index % 2)
7321 		/* this is an odd sl. Need to update the ls bits */
7322 		p_slvl_tbl->raw_vl_by_sl[idx] =
7323 		    (p_slvl_tbl->raw_vl_by_sl[idx] & 0xF0) | vl;
7324 	else
7325 		/* this is an even sl. Need to update the ms bits */
7326 		p_slvl_tbl->raw_vl_by_sl[idx] =
7327 		    (vl << 4) | (p_slvl_tbl->raw_vl_by_sl[idx] & 0x0F);
7328 }
7329 
7330 /*
7331 * PARAMETERS
7332 *	p_slvl_tbl
7333 *		[in] pointer to ib_slvl_table_t object.
7334 *
7335 *	sl_index
7336 *		[in] the sl index in the table to be updated.
7337 *
7338 *	vl
7339 *		[in] the vl value to update for that sl.
7340 *
7341 * RETURN VALUES
7342 *	None
7343 *
7344 * NOTES
7345 *
7346 * SEE ALSO
7347 *	ib_slvl_table_t
7348 *********/
7349 
7350 /****f* IBA Base: Types/ib_slvl_table_get
7351 * NAME
7352 *	ib_slvl_table_get
7353 *
7354 * DESCRIPTION
7355 *	Get slvl table entry.
7356 *
7357 * SYNOPSIS
7358 */
7359 static inline uint8_t OSM_API
ib_slvl_table_get(IN const ib_slvl_table_t * p_slvl_tbl,IN uint8_t sl_index)7360 ib_slvl_table_get(IN const ib_slvl_table_t * p_slvl_tbl, IN uint8_t sl_index)
7361 {
7362 	uint8_t idx = sl_index / 2;
7363 	CL_ASSERT(sl_index <= 15);
7364 
7365 	if (sl_index % 2)
7366 		/* this is an odd sl. Need to return the ls bits. */
7367 		return (p_slvl_tbl->raw_vl_by_sl[idx] & 0x0F);
7368 	else
7369 		/* this is an even sl. Need to return the ms bits. */
7370 		return ((p_slvl_tbl->raw_vl_by_sl[idx] & 0xF0) >> 4);
7371 }
7372 
7373 /*
7374 * PARAMETERS
7375 *	p_slvl_tbl
7376 *		[in] pointer to ib_slvl_table_t object.
7377 *
7378 *	sl_index
7379 *		[in] the sl index in the table whose value should be returned.
7380 *
7381 * RETURN VALUES
7382 *	vl for the requested sl_index.
7383 *
7384 * NOTES
7385 *
7386 * SEE ALSO
7387 *	ib_slvl_table_t
7388 *********/
7389 
7390 /****s* IBA Base: Types/ib_vl_arb_element_t
7391 * NAME
7392 *	ib_vl_arb_element_t
7393 *
7394 * DESCRIPTION
7395 *	IBA defined VL Arbitration Table Element. (14.2.5.9)
7396 *
7397 * SYNOPSIS
7398 */
7399 #include <complib/cl_packon.h>
7400 typedef struct _ib_vl_arb_element {
7401 	uint8_t vl;
7402 	uint8_t weight;
7403 } PACK_SUFFIX ib_vl_arb_element_t;
7404 #include <complib/cl_packoff.h>
7405 /************/
7406 
7407 #define IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK 32
7408 
7409 /****s* IBA Base: Types/ib_vl_arb_table_t
7410 * NAME
7411 *	ib_vl_arb_table_t
7412 *
7413 * DESCRIPTION
7414 *	IBA defined VL Arbitration Table. (14.2.5.9)
7415 *
7416 * SYNOPSIS
7417 */
7418 #include <complib/cl_packon.h>
7419 typedef struct _ib_vl_arb_table {
7420 	ib_vl_arb_element_t vl_entry[IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK];
7421 } PACK_SUFFIX ib_vl_arb_table_t;
7422 #include <complib/cl_packoff.h>
7423 /************/
7424 
7425 /****s* IBA Base: Types/ib_vl_arb_table_record_t
7426 * NAME
7427 *	ib_vl_arb_table_record_t
7428 *
7429 * DESCRIPTION
7430 *	IBA defined VL Arbitration Table Record for SA Query. (15.2.5.9)
7431 *
7432 * SYNOPSIS
7433 */
7434 #include <complib/cl_packon.h>
7435 typedef struct _ib_vl_arb_table_record {
7436 	ib_net16_t lid;		// for CA: lid of port, for switch lid of port 0
7437 	uint8_t port_num;
7438 	uint8_t block_num;
7439 	uint32_t reserved;
7440 	ib_vl_arb_table_t vl_arb_tbl;
7441 } PACK_SUFFIX ib_vl_arb_table_record_t;
7442 #include <complib/cl_packoff.h>
7443 /************/
7444 
7445 /*
7446  *	Global route header information received with unreliable datagram messages
7447  */
7448 #include <complib/cl_packon.h>
7449 typedef struct _ib_grh {
7450 	ib_net32_t ver_class_flow;
7451 	ib_net16_t resv1;
7452 	uint8_t resv2;
7453 	uint8_t hop_limit;
7454 	ib_gid_t src_gid;
7455 	ib_gid_t dest_gid;
7456 } PACK_SUFFIX ib_grh_t;
7457 #include <complib/cl_packoff.h>
7458 
7459 /****f* IBA Base: Types/ib_grh_get_ver_class_flow
7460 * NAME
7461 *	ib_grh_get_ver_class_flow
7462 *
7463 * DESCRIPTION
7464 *	Get encoded version, traffic class and flow label in grh
7465 *
7466 * SYNOPSIS
7467 */
7468 static inline void OSM_API
ib_grh_get_ver_class_flow(IN const ib_net32_t ver_class_flow,OUT uint8_t * const p_ver,OUT uint8_t * const p_tclass,OUT uint32_t * const p_flow_lbl)7469 ib_grh_get_ver_class_flow(IN const ib_net32_t ver_class_flow,
7470 			  OUT uint8_t * const p_ver,
7471 			  OUT uint8_t * const p_tclass,
7472 			  OUT uint32_t * const p_flow_lbl)
7473 {
7474 	ib_net32_t tmp_ver_class_flow;
7475 
7476 	if (p_ver)
7477 		*p_ver = (uint8_t) (ver_class_flow & 0x0f);
7478 
7479 	tmp_ver_class_flow = ver_class_flow >> 4;
7480 
7481 	if (p_tclass)
7482 		*p_tclass = (uint8_t) (tmp_ver_class_flow & 0xff);
7483 
7484 	tmp_ver_class_flow = tmp_ver_class_flow >> 8;
7485 
7486 	if (p_flow_lbl)
7487 		*p_flow_lbl = tmp_ver_class_flow & 0xfffff;
7488 }
7489 
7490 /*
7491 * PARAMETERS
7492 *	ver_class_flow
7493 *		[in] the version, traffic class and flow label info.
7494 *
7495 * RETURN VALUES
7496 *	p_ver
7497 *		[out] pointer to the version info.
7498 *
7499 *	p_tclass
7500 *		[out] pointer to the traffic class info.
7501 *
7502 *	p_flow_lbl
7503 *		[out] pointer to the flow label info
7504 *
7505 * NOTES
7506 *
7507 * SEE ALSO
7508 *	ib_grh_t
7509 *********/
7510 
7511 /****f* IBA Base: Types/ib_grh_set_ver_class_flow
7512 * NAME
7513 *	ib_grh_set_ver_class_flow
7514 *
7515 * DESCRIPTION
7516 *	Set encoded version, traffic class and flow label in grh
7517 *
7518 * SYNOPSIS
7519 */
7520 static inline ib_net32_t OSM_API
ib_grh_set_ver_class_flow(IN const uint8_t ver,IN const uint8_t tclass,IN const uint32_t flow_lbl)7521 ib_grh_set_ver_class_flow(IN const uint8_t ver,
7522 			  IN const uint8_t tclass, IN const uint32_t flow_lbl)
7523 {
7524 	ib_net32_t ver_class_flow;
7525 
7526 	ver_class_flow = flow_lbl;
7527 	ver_class_flow = ver_class_flow << 8;
7528 	ver_class_flow = ver_class_flow | tclass;
7529 	ver_class_flow = ver_class_flow << 4;
7530 	ver_class_flow = ver_class_flow | ver;
7531 	return (ver_class_flow);
7532 }
7533 
7534 /*
7535 * PARAMETERS
7536 *	ver
7537 *		[in] the version info.
7538 *
7539 *	tclass
7540 *		[in] the traffic class info.
7541 *
7542 *	flow_lbl
7543 *		[in] the flow label info
7544 *
7545 * RETURN VALUES
7546 *	ver_class_flow
7547 *		[out] the version, traffic class and flow label info.
7548 *
7549 * NOTES
7550 *
7551 * SEE ALSO
7552 *	ib_grh_t
7553 *********/
7554 
7555 /****s* IBA Base: Types/ib_member_rec_t
7556 * NAME
7557 *	ib_member_rec_t
7558 *
7559 * DESCRIPTION
7560 *	Multicast member record, used to create, join, and leave multicast
7561 *	groups.
7562 *
7563 * SYNOPSIS
7564 */
7565 #include <complib/cl_packon.h>
7566 typedef struct _ib_member_rec {
7567 	ib_gid_t mgid;
7568 	ib_gid_t port_gid;
7569 	ib_net32_t qkey;
7570 	ib_net16_t mlid;
7571 	uint8_t mtu;
7572 	uint8_t tclass;
7573 	ib_net16_t pkey;
7574 	uint8_t rate;
7575 	uint8_t pkt_life;
7576 	ib_net32_t sl_flow_hop;
7577 	uint8_t scope_state;
7578 	uint8_t proxy_join:1;
7579 	uint8_t reserved[2];
7580 	uint8_t pad[4];
7581 } PACK_SUFFIX ib_member_rec_t;
7582 #include <complib/cl_packoff.h>
7583 /*
7584 * FIELDS
7585 *	mgid
7586 *		Multicast GID address for this multicast group.
7587 *
7588 *	port_gid
7589 *		Valid GID of the endpoint joining this multicast group.
7590 *
7591 *	qkey
7592 *		Q_Key to be sued by this multicast group.
7593 *
7594 *	mlid
7595 *		Multicast LID for this multicast group.
7596 *
7597 *	mtu
7598 *		MTU and MTU selector fields to use on this path
7599 *
7600 *	tclass
7601 *		Another global routing parameter.
7602 *
7603 *	pkey
7604 *		Partition key (P_Key) to use for this member.
7605 *
7606 *	rate
7607 *		Rate and rate selector fields to use on this path.
7608 *
7609 *	pkt_life
7610 *		Packet lifetime
7611 *
7612 *	sl_flow_hop
7613 *		Global routing parameters: service level, hop count, and flow label.
7614 *
7615 *	scope_state
7616 *		MGID scope and JoinState of multicast request.
7617 *
7618 *	proxy_join
7619 *		Enables others in the Partition to proxy add/remove from the group
7620 *
7621 * SEE ALSO
7622 *********/
7623 
7624 /****f* IBA Base: Types/ib_member_get_sl_flow_hop
7625 * NAME
7626 *	ib_member_get_sl_flow_hop
7627 *
7628 * DESCRIPTION
7629 *	Get encoded sl, flow label, and hop limit
7630 *
7631 * SYNOPSIS
7632 */
7633 static inline void OSM_API
ib_member_get_sl_flow_hop(IN const ib_net32_t sl_flow_hop,OUT uint8_t * const p_sl,OUT uint32_t * const p_flow_lbl,OUT uint8_t * const p_hop)7634 ib_member_get_sl_flow_hop(IN const ib_net32_t sl_flow_hop,
7635 			  OUT uint8_t * const p_sl,
7636 			  OUT uint32_t * const p_flow_lbl,
7637 			  OUT uint8_t * const p_hop)
7638 {
7639 	uint32_t tmp;
7640 
7641 	tmp = cl_ntoh32(sl_flow_hop);
7642 	if (p_hop)
7643 		*p_hop = (uint8_t) tmp;
7644 	tmp >>= 8;
7645 
7646 	if (p_flow_lbl)
7647 		*p_flow_lbl = (uint32_t) (tmp & 0xfffff);
7648 	tmp >>= 20;
7649 
7650 	if (p_sl)
7651 		*p_sl = (uint8_t) tmp;
7652 }
7653 
7654 /*
7655 * PARAMETERS
7656 *	sl_flow_hop
7657 *		[in] the sl, flow label, and hop limit of MC Group
7658 *
7659 * RETURN VALUES
7660 *	p_sl
7661 *		[out] pointer to the service level
7662 *
7663 *	p_flow_lbl
7664 *		[out] pointer to the flow label info
7665 *
7666 *	p_hop
7667 *		[out] pointer to the hop count limit.
7668 *
7669 * NOTES
7670 *
7671 * SEE ALSO
7672 *	ib_member_rec_t
7673 *********/
7674 
7675 /****f* IBA Base: Types/ib_member_set_sl_flow_hop
7676 * NAME
7677 *	ib_member_set_sl_flow_hop
7678 *
7679 * DESCRIPTION
7680 *	Set encoded sl, flow label, and hop limit
7681 *
7682 * SYNOPSIS
7683 */
7684 static inline ib_net32_t OSM_API
ib_member_set_sl_flow_hop(IN const uint8_t sl,IN const uint32_t flow_label,IN const uint8_t hop_limit)7685 ib_member_set_sl_flow_hop(IN const uint8_t sl,
7686 			  IN const uint32_t flow_label,
7687 			  IN const uint8_t hop_limit)
7688 {
7689 	uint32_t tmp;
7690 
7691 	tmp = (sl << 28) | ((flow_label & 0xfffff) << 8) | hop_limit;
7692 	return cl_hton32(tmp);
7693 }
7694 
7695 /*
7696 * PARAMETERS
7697 *	sl
7698 *		[in] the service level.
7699 *
7700 *	flow_lbl
7701 *		[in] the flow label info
7702 *
7703 *	hop_limit
7704 *		[in] the hop limit.
7705 *
7706 * RETURN VALUES
7707 *	sl_flow_hop
7708 *		[out] the encoded sl, flow label, and hop limit
7709 *
7710 * NOTES
7711 *
7712 * SEE ALSO
7713 *	ib_member_rec_t
7714 *********/
7715 
7716 /****f* IBA Base: Types/ib_member_get_scope_state
7717 * NAME
7718 *	ib_member_get_scope_state
7719 *
7720 * DESCRIPTION
7721 *	Get encoded MGID scope and JoinState
7722 *
7723 * SYNOPSIS
7724 */
7725 static inline void OSM_API
ib_member_get_scope_state(IN const uint8_t scope_state,OUT uint8_t * const p_scope,OUT uint8_t * const p_state)7726 ib_member_get_scope_state(IN const uint8_t scope_state,
7727 			  OUT uint8_t * const p_scope,
7728 			  OUT uint8_t * const p_state)
7729 {
7730 	uint8_t tmp_scope_state;
7731 
7732 	if (p_state)
7733 		*p_state = (uint8_t) (scope_state & 0x0f);
7734 
7735 	tmp_scope_state = scope_state >> 4;
7736 
7737 	if (p_scope)
7738 		*p_scope = (uint8_t) (tmp_scope_state & 0x0f);
7739 
7740 }
7741 
7742 /*
7743 * PARAMETERS
7744 *	scope_state
7745 *		[in] the scope and state
7746 *
7747 * RETURN VALUES
7748 *	p_scope
7749 *		[out] pointer to the MGID scope
7750 *
7751 *	p_state
7752 *		[out] pointer to the join state
7753 *
7754 * NOTES
7755 *
7756 * SEE ALSO
7757 *	ib_member_rec_t
7758 *********/
7759 
7760 /****f* IBA Base: Types/ib_member_set_scope_state
7761 * NAME
7762 *	ib_member_set_scope_state
7763 *
7764 * DESCRIPTION
7765 *	Set encoded version, MGID scope and JoinState
7766 *
7767 * SYNOPSIS
7768 */
7769 static inline uint8_t OSM_API
ib_member_set_scope_state(IN const uint8_t scope,IN const uint8_t state)7770 ib_member_set_scope_state(IN const uint8_t scope, IN const uint8_t state)
7771 {
7772 	uint8_t scope_state;
7773 
7774 	scope_state = scope;
7775 	scope_state = scope_state << 4;
7776 	scope_state = scope_state | state;
7777 	return (scope_state);
7778 }
7779 
7780 /*
7781 * PARAMETERS
7782 *	scope
7783 *		[in] the MGID scope
7784 *
7785 *	state
7786 *		[in] the JoinState
7787 *
7788 * RETURN VALUES
7789 *	scope_state
7790 *		[out] the encoded one
7791 *
7792 * NOTES
7793 *
7794 * SEE ALSO
7795 *	ib_member_rec_t
7796 *********/
7797 
7798 /****f* IBA Base: Types/ib_member_set_join_state
7799 * NAME
7800 *	ib_member_set_join_state
7801 *
7802 * DESCRIPTION
7803 *	Set JoinState
7804 *
7805 * SYNOPSIS
7806 */
7807 static inline void OSM_API
ib_member_set_join_state(IN OUT ib_member_rec_t * p_mc_rec,IN const uint8_t state)7808 ib_member_set_join_state(IN OUT ib_member_rec_t * p_mc_rec,
7809 			 IN const uint8_t state)
7810 {
7811 	/* keep the scope as it is */
7812 	p_mc_rec->scope_state = (p_mc_rec->scope_state & 0xF0) | (0x0f & state);
7813 }
7814 
7815 /*
7816 * PARAMETERS
7817 *	p_mc_rec
7818 *		[in] pointer to the member record
7819 *
7820 *	state
7821 *		[in] the JoinState
7822 *
7823 * RETURN VALUES
7824 *	NONE
7825 *
7826 * NOTES
7827 *
7828 * SEE ALSO
7829 *	ib_member_rec_t
7830 *********/
7831 
7832 /*
7833  * Join State Codes:
7834  */
7835 #define IB_MC_REC_STATE_FULL_MEMBER 0x01
7836 #define IB_MC_REC_STATE_NON_MEMBER 0x02
7837 #define IB_MC_REC_STATE_SEND_ONLY_NON_MEMBER 0x04
7838 
7839 /*
7840  *	Generic MAD notice types
7841  */
7842 #define IB_NOTICE_TYPE_FATAL				0x00
7843 #define IB_NOTICE_TYPE_URGENT				0x01
7844 #define IB_NOTICE_TYPE_SECURITY				0x02
7845 #define IB_NOTICE_TYPE_SUBN_MGMT			0x03
7846 #define IB_NOTICE_TYPE_INFO				0x04
7847 #define IB_NOTICE_TYPE_EMPTY				0x7F
7848 
7849 #define SM_GID_IN_SERVICE_TRAP				64
7850 #define SM_GID_OUT_OF_SERVICE_TRAP			65
7851 #define SM_MGID_CREATED_TRAP				66
7852 #define SM_MGID_DESTROYED_TRAP				67
7853 #define SM_UNPATH_TRAP					68
7854 #define SM_REPATH_TRAP					69
7855 #define SM_LINK_STATE_CHANGED_TRAP			128
7856 #define SM_LINK_INTEGRITY_THRESHOLD_TRAP		129
7857 #define SM_BUFFER_OVERRUN_THRESHOLD_TRAP		130
7858 #define SM_WATCHDOG_TIMER_EXPIRED_TRAP			131
7859 #define SM_LOCAL_CHANGES_TRAP				144
7860 #define SM_SYS_IMG_GUID_CHANGED_TRAP			145
7861 #define SM_BAD_MKEY_TRAP				256
7862 #define SM_BAD_PKEY_TRAP				257
7863 #define SM_BAD_QKEY_TRAP				258
7864 #define SM_BAD_SWITCH_PKEY_TRAP				259
7865 
7866 #include <complib/cl_packon.h>
7867 typedef struct _ib_mad_notice_attr	// Total Size calc  Accumulated
7868 {
7869 	uint8_t generic_type;	// 1                1
7870 	union _notice_g_or_v {
7871 		struct _notice_generic	// 5                6
7872 		{
7873 			uint8_t prod_type_msb;
7874 			ib_net16_t prod_type_lsb;
7875 			ib_net16_t trap_num;
7876 		} PACK_SUFFIX generic;
7877 		struct _notice_vend {
7878 			uint8_t vend_id_msb;
7879 			ib_net16_t vend_id_lsb;
7880 			ib_net16_t dev_id;
7881 		} PACK_SUFFIX vend;
7882 	} g_or_v;
7883 	ib_net16_t issuer_lid;	// 2                 8
7884 	ib_net16_t toggle_count;	// 2                 10
7885 	union _data_details	// 54                64
7886 	{
7887 		struct _raw_data {
7888 			uint8_t details[54];
7889 		} PACK_SUFFIX raw_data;
7890 		struct _ntc_64_67 {
7891 			uint8_t res[6];
7892 			ib_gid_t gid;	// the Node or Multicast Group that came in/out
7893 		} PACK_SUFFIX ntc_64_67;
7894 		struct _ntc_128 {
7895 			ib_net16_t sw_lid;	// the sw lid of which link state changed
7896 		} PACK_SUFFIX ntc_128;
7897 		struct _ntc_129_131 {
7898 			ib_net16_t pad;
7899 			ib_net16_t lid;	// lid and port number of the violation
7900 			uint8_t port_num;
7901 		} PACK_SUFFIX ntc_129_131;
7902 		struct _ntc_144 {
7903 			ib_net16_t pad1;
7904 			ib_net16_t lid;             // lid where change occured
7905 			uint8_t    pad2;            // reserved
7906 			uint8_t    local_changes;   // 7b reserved 1b local changes
7907 			ib_net32_t new_cap_mask;    // new capability mask
7908 			ib_net16_t change_flgs;     // 10b reserved 6b change flags
7909 			ib_net16_t cap_mask2;
7910 		} PACK_SUFFIX ntc_144;
7911 		struct _ntc_145 {
7912 			ib_net16_t pad1;
7913 			ib_net16_t lid;	// lid where sys guid changed
7914 			ib_net16_t pad2;
7915 			ib_net64_t new_sys_guid;	// new system image guid
7916 		} PACK_SUFFIX ntc_145;
7917 		struct _ntc_256 {	// total: 54
7918 			ib_net16_t pad1;	// 2
7919 			ib_net16_t lid;	// 2
7920 			ib_net16_t dr_slid;	// 2
7921 			uint8_t method;	// 1
7922 			uint8_t pad2;	// 1
7923 			ib_net16_t attr_id;	// 2
7924 			ib_net32_t attr_mod;	// 4
7925 			ib_net64_t mkey;	// 8
7926 			uint8_t pad3;	// 1
7927 			uint8_t dr_trunc_hop;	// 1
7928 			uint8_t dr_rtn_path[30];	// 30
7929 		} PACK_SUFFIX ntc_256;
7930 		struct _ntc_257_258	// violation of p/q_key // 49
7931 		{
7932 			ib_net16_t pad1;	// 2
7933 			ib_net16_t lid1;	// 2
7934 			ib_net16_t lid2;	// 2
7935 			ib_net32_t key;	// 4
7936 			ib_net32_t qp1;	// 4b sl, 4b pad, 24b qp1
7937 			ib_net32_t qp2;	// 8b pad, 24b qp2
7938 			ib_gid_t gid1;	// 16
7939 			ib_gid_t gid2;	// 16
7940 		} PACK_SUFFIX ntc_257_258;
7941 		struct _ntc_259	// pkey violation from switch 51
7942 		{
7943 			ib_net16_t data_valid;	// 2
7944 			ib_net16_t lid1;	// 2
7945 			ib_net16_t lid2;	// 2
7946 			ib_net16_t pkey;	// 2
7947 			ib_net32_t sl_qp1; // 4b sl, 4b pad, 24b qp1
7948 			ib_net32_t qp2; // 8b pad, 24b qp2
7949 			ib_gid_t gid1;	// 16
7950 			ib_gid_t gid2;	// 16
7951 			ib_net16_t sw_lid;	// 2
7952 			uint8_t port_no;	// 1
7953 		} PACK_SUFFIX ntc_259;
7954 		struct _ntc_bkey_259	// bkey violation
7955 		{
7956 			ib_net16_t lidaddr;
7957 			uint8_t method;
7958 			uint8_t reserved;
7959 			ib_net16_t attribute_id;
7960 			ib_net32_t attribute_modifier;
7961 			ib_net32_t qp;		// qp is low 24 bits
7962 			ib_net64_t bkey;
7963 			ib_gid_t gid;
7964 		} PACK_SUFFIX ntc_bkey_259;
7965 		struct _ntc_cckey_0	// CC key violation
7966 		{
7967 			ib_net16_t slid;     // source LID from offending packet LRH
7968 			uint8_t method;      // method, from common MAD header
7969 			uint8_t resv0;
7970 			ib_net16_t attribute_id; // Attribute ID, from common MAD header
7971 			ib_net16_t resv1;
7972 			ib_net32_t attribute_modifier; // Attribute Modif, from common MAD header
7973 			ib_net32_t qp;       // 8b pad, 24b dest QP from BTH
7974 			ib_net64_t cc_key;   // CC key of the offending packet
7975 			ib_gid_t source_gid; // GID from GRH of the offending packet
7976 			uint8_t padding[14]; // Padding - ignored on read
7977 		} PACK_SUFFIX ntc_cckey_0;
7978 	} data_details;
7979 	ib_gid_t issuer_gid;	// 16          80
7980 } PACK_SUFFIX ib_mad_notice_attr_t;
7981 #include <complib/cl_packoff.h>
7982 
7983 /**
7984  * Trap 259 masks
7985  */
7986 #define TRAP_259_MASK_SL (CL_HTON32(0xF0000000))
7987 #define TRAP_259_MASK_QP (CL_HTON32(0x00FFFFFF))
7988 
7989 /**
7990  * Trap 144 masks
7991  */
7992 #define TRAP_144_MASK_OTHER_LOCAL_CHANGES      0x01
7993 #define TRAP_144_MASK_CAPABILITY_MASK2_CHANGE  (CL_HTON16(0x0020))
7994 #define TRAP_144_MASK_HIERARCHY_INFO_CHANGE    (CL_HTON16(0x0010))
7995 #define TRAP_144_MASK_SM_PRIORITY_CHANGE       (CL_HTON16(0x0008))
7996 #define TRAP_144_MASK_LINK_SPEED_ENABLE_CHANGE (CL_HTON16(0x0004))
7997 #define TRAP_144_MASK_LINK_WIDTH_ENABLE_CHANGE (CL_HTON16(0x0002))
7998 #define TRAP_144_MASK_NODE_DESCRIPTION_CHANGE  (CL_HTON16(0x0001))
7999 
8000 /****f* IBA Base: Types/ib_notice_is_generic
8001 * NAME
8002 *	ib_notice_is_generic
8003 *
8004 * DESCRIPTION
8005 *	Check if the notice is generic
8006 *
8007 * SYNOPSIS
8008 */
8009 static inline boolean_t OSM_API
ib_notice_is_generic(IN const ib_mad_notice_attr_t * p_ntc)8010 ib_notice_is_generic(IN const ib_mad_notice_attr_t * p_ntc)
8011 {
8012 	return (p_ntc->generic_type & 0x80);
8013 }
8014 
8015 /*
8016 * PARAMETERS
8017 *	p_ntc
8018 *		[in] Pointer to the notice MAD attribute
8019 *
8020 * RETURN VALUES
8021 *	TRUE if notice MAD is generic
8022 *
8023 * SEE ALSO
8024 *	ib_mad_notice_attr_t
8025 *********/
8026 
8027 /****f* IBA Base: Types/ib_notice_get_type
8028 * NAME
8029 *	ib_notice_get_type
8030 *
8031 * DESCRIPTION
8032 *	Get the notice type
8033 *
8034 * SYNOPSIS
8035 */
8036 static inline uint8_t OSM_API
ib_notice_get_type(IN const ib_mad_notice_attr_t * p_ntc)8037 ib_notice_get_type(IN const ib_mad_notice_attr_t * p_ntc)
8038 {
8039 	return p_ntc->generic_type & 0x7f;
8040 }
8041 
8042 /*
8043 * PARAMETERS
8044 *	p_ntc
8045 *		[in] Pointer to  the notice MAD attribute
8046 *
8047 * RETURN VALUES
8048 *	TRUE if mad is generic
8049 *
8050 * SEE ALSO
8051 *	ib_mad_notice_attr_t
8052 *********/
8053 
8054 /****f* IBA Base: Types/ib_notice_get_prod_type
8055 * NAME
8056 *	ib_notice_get_prod_type
8057 *
8058 * DESCRIPTION
8059 *	Get the notice Producer Type of Generic Notice
8060 *
8061 * SYNOPSIS
8062 */
8063 static inline ib_net32_t OSM_API
ib_notice_get_prod_type(IN const ib_mad_notice_attr_t * p_ntc)8064 ib_notice_get_prod_type(IN const ib_mad_notice_attr_t * p_ntc)
8065 {
8066 	uint32_t pt;
8067 
8068 	pt = cl_ntoh16(p_ntc->g_or_v.generic.prod_type_lsb) |
8069 	    (p_ntc->g_or_v.generic.prod_type_msb << 16);
8070 	return cl_hton32(pt);
8071 }
8072 
8073 /*
8074 * PARAMETERS
8075 *	p_ntc
8076 *		[in] Pointer to the notice MAD attribute
8077 *
8078 * RETURN VALUES
8079 *	The producer type
8080 *
8081 * SEE ALSO
8082 *	ib_mad_notice_attr_t
8083 *********/
8084 
8085 /****f* IBA Base: Types/ib_notice_set_prod_type
8086 * NAME
8087 *	ib_notice_set_prod_type
8088 *
8089 * DESCRIPTION
8090 *	Set the notice Producer Type of Generic Notice
8091 *
8092 * SYNOPSIS
8093 */
8094 static inline void OSM_API
ib_notice_set_prod_type(IN ib_mad_notice_attr_t * p_ntc,IN ib_net32_t prod_type_val)8095 ib_notice_set_prod_type(IN ib_mad_notice_attr_t * p_ntc,
8096 			IN ib_net32_t prod_type_val)
8097 {
8098 	uint32_t ptv = cl_ntoh32(prod_type_val);
8099 	p_ntc->g_or_v.generic.prod_type_lsb =
8100 	    cl_hton16((uint16_t) (ptv & 0x0000ffff));
8101 	p_ntc->g_or_v.generic.prod_type_msb =
8102 	    (uint8_t) ((ptv & 0x00ff0000) >> 16);
8103 }
8104 
8105 /*
8106 * PARAMETERS
8107 *	p_ntc
8108 *		[in] Pointer to the notice MAD attribute
8109 *
8110 *  prod_type
8111 *     [in] The producer Type code
8112 *
8113 * RETURN VALUES
8114 *	None
8115 *
8116 * SEE ALSO
8117 *	ib_mad_notice_attr_t
8118 *********/
8119 
8120 /****f* IBA Base: Types/ib_notice_set_prod_type_ho
8121 * NAME
8122 *	ib_notice_set_prod_type_ho
8123 *
8124 * DESCRIPTION
8125 *	Set the notice Producer Type of Generic Notice given Host Order
8126 *
8127 * SYNOPSIS
8128 */
8129 static inline void OSM_API
ib_notice_set_prod_type_ho(IN ib_mad_notice_attr_t * p_ntc,IN uint32_t prod_type_val_ho)8130 ib_notice_set_prod_type_ho(IN ib_mad_notice_attr_t * p_ntc,
8131 			   IN uint32_t prod_type_val_ho)
8132 {
8133 	p_ntc->g_or_v.generic.prod_type_lsb =
8134 	    cl_hton16((uint16_t) (prod_type_val_ho & 0x0000ffff));
8135 	p_ntc->g_or_v.generic.prod_type_msb =
8136 	    (uint8_t) ((prod_type_val_ho & 0x00ff0000) >> 16);
8137 }
8138 
8139 /*
8140 * PARAMETERS
8141 *	p_ntc
8142 *		[in] Pointer to the notice MAD attribute
8143 *
8144 *	prod_type
8145 *		[in] The producer Type code in host order
8146 *
8147 * RETURN VALUES
8148 *	None
8149 *
8150 * SEE ALSO
8151 *	ib_mad_notice_attr_t
8152 *********/
8153 
8154 /****f* IBA Base: Types/ib_notice_get_vend_id
8155 * NAME
8156 *	ib_notice_get_vend_id
8157 *
8158 * DESCRIPTION
8159 *	Get the Vendor Id of Vendor type Notice
8160 *
8161 * SYNOPSIS
8162 */
8163 static inline ib_net32_t OSM_API
ib_notice_get_vend_id(IN const ib_mad_notice_attr_t * p_ntc)8164 ib_notice_get_vend_id(IN const ib_mad_notice_attr_t * p_ntc)
8165 {
8166 	uint32_t vi;
8167 
8168 	vi = cl_ntoh16(p_ntc->g_or_v.vend.vend_id_lsb) |
8169 	    (p_ntc->g_or_v.vend.vend_id_msb << 16);
8170 	return cl_hton32(vi);
8171 }
8172 
8173 /*
8174 * PARAMETERS
8175 *	p_ntc
8176 *		[in] Pointer to the notice MAD attribute
8177 *
8178 * RETURN VALUES
8179 *	The Vendor Id of Vendor type Notice
8180 *
8181 * SEE ALSO
8182 *	ib_mad_notice_attr_t
8183 *********/
8184 
8185 /****f* IBA Base: Types/ib_notice_set_vend_id
8186 * NAME
8187 *	ib_notice_set_vend_id
8188 *
8189 * DESCRIPTION
8190 *	Set the notice Producer Type of Generic Notice
8191 *
8192 * SYNOPSIS
8193 */
8194 static inline void OSM_API
ib_notice_set_vend_id(IN ib_mad_notice_attr_t * p_ntc,IN ib_net32_t vend_id)8195 ib_notice_set_vend_id(IN ib_mad_notice_attr_t * p_ntc, IN ib_net32_t vend_id)
8196 {
8197 	uint32_t vi = cl_ntoh32(vend_id);
8198 	p_ntc->g_or_v.vend.vend_id_lsb =
8199 	    cl_hton16((uint16_t) (vi & 0x0000ffff));
8200 	p_ntc->g_or_v.vend.vend_id_msb = (uint8_t) ((vi & 0x00ff0000) >> 16);
8201 }
8202 
8203 /*
8204 * PARAMETERS
8205 *	p_ntc
8206 *		[in] Pointer to the notice MAD attribute
8207 *
8208 *	vend_id
8209 *		[in] The producer Type code
8210 *
8211 * RETURN VALUES
8212 *	None
8213 *
8214 * SEE ALSO
8215 *	ib_mad_notice_attr_t
8216 *********/
8217 
8218 /****f* IBA Base: Types/ib_notice_set_vend_id_ho
8219 * NAME
8220 *	ib_notice_set_vend_id_ho
8221 *
8222 * DESCRIPTION
8223 *	Set the notice Producer Type of Generic Notice given a host order value
8224 *
8225 * SYNOPSIS
8226 */
8227 static inline void OSM_API
ib_notice_set_vend_id_ho(IN ib_mad_notice_attr_t * p_ntc,IN uint32_t vend_id_ho)8228 ib_notice_set_vend_id_ho(IN ib_mad_notice_attr_t * p_ntc,
8229 			 IN uint32_t vend_id_ho)
8230 {
8231 	p_ntc->g_or_v.vend.vend_id_lsb =
8232 	    cl_hton16((uint16_t) (vend_id_ho & 0x0000ffff));
8233 	p_ntc->g_or_v.vend.vend_id_msb =
8234 	    (uint8_t) ((vend_id_ho & 0x00ff0000) >> 16);
8235 }
8236 
8237 /*
8238 * PARAMETERS
8239 *	p_ntc
8240 *		[in] Pointer to the notice MAD attribute
8241 *
8242 *	vend_id_ho
8243 *		[in] The producer Type code in host order
8244 *
8245 * RETURN VALUES
8246 *	None
8247 *
8248 * SEE ALSO
8249 *	ib_mad_notice_attr_t
8250 *********/
8251 
8252 #include <complib/cl_packon.h>
8253 typedef struct _ib_inform_info {
8254 	ib_gid_t gid;
8255 	ib_net16_t lid_range_begin;
8256 	ib_net16_t lid_range_end;
8257 	ib_net16_t reserved1;
8258 	uint8_t is_generic;
8259 	uint8_t subscribe;
8260 	ib_net16_t trap_type;
8261 	union _inform_g_or_v {
8262 		struct _inform_generic {
8263 			ib_net16_t trap_num;
8264 			ib_net32_t qpn_resp_time_val;
8265 			uint8_t reserved2;
8266 			uint8_t node_type_msb;
8267 			ib_net16_t node_type_lsb;
8268 		} PACK_SUFFIX generic;
8269 		struct _inform_vend {
8270 			ib_net16_t dev_id;
8271 			ib_net32_t qpn_resp_time_val;
8272 			uint8_t reserved2;
8273 			uint8_t vendor_id_msb;
8274 			ib_net16_t vendor_id_lsb;
8275 		} PACK_SUFFIX vend;
8276 	} PACK_SUFFIX g_or_v;
8277 } PACK_SUFFIX ib_inform_info_t;
8278 #include <complib/cl_packoff.h>
8279 
8280 /****f* IBA Base: Types/ib_inform_info_get_qpn_resp_time
8281 * NAME
8282 *	ib_inform_info_get_qpn_resp_time
8283 *
8284 * DESCRIPTION
8285 *	Get QPN of the inform info
8286 *
8287 * SYNOPSIS
8288 */
8289 static inline void OSM_API
ib_inform_info_get_qpn_resp_time(IN const ib_net32_t qpn_resp_time_val,OUT ib_net32_t * const p_qpn,OUT uint8_t * const p_resp_time_val)8290 ib_inform_info_get_qpn_resp_time(IN const ib_net32_t qpn_resp_time_val,
8291 				 OUT ib_net32_t * const p_qpn,
8292 				 OUT uint8_t * const p_resp_time_val)
8293 {
8294 	uint32_t tmp = cl_ntoh32(qpn_resp_time_val);
8295 
8296 	if (p_qpn)
8297 		*p_qpn = cl_hton32((tmp & 0xffffff00) >> 8);
8298 	if (p_resp_time_val)
8299 		*p_resp_time_val = (uint8_t) (tmp & 0x0000001f);
8300 }
8301 
8302 /*
8303 * PARAMETERS
8304 *	qpn_resp_time_val
8305 *		[in] the  qpn and resp time val from the mad
8306 *
8307 * RETURN VALUES
8308 *	p_qpn
8309 *		[out] pointer to the qpn
8310 *
8311 *	p_state
8312 *		[out] pointer to the resp time val
8313 *
8314 * NOTES
8315 *
8316 * SEE ALSO
8317 *	ib_inform_info_t
8318 *********/
8319 
8320 /****f* IBA Base: Types/ib_inform_info_set_qpn
8321 * NAME
8322 *	ib_inform_info_set_qpn
8323 *
8324 * DESCRIPTION
8325 *	Set the QPN of the inform info
8326 *
8327 * SYNOPSIS
8328 */
8329 static inline void OSM_API
ib_inform_info_set_qpn(IN ib_inform_info_t * p_ii,IN ib_net32_t const qpn)8330 ib_inform_info_set_qpn(IN ib_inform_info_t * p_ii, IN ib_net32_t const qpn)
8331 {
8332 	uint32_t tmp = cl_ntoh32(p_ii->g_or_v.generic.qpn_resp_time_val);
8333 	uint32_t qpn_h = cl_ntoh32(qpn);
8334 
8335 	p_ii->g_or_v.generic.qpn_resp_time_val =
8336 	    cl_hton32((tmp & 0x000000ff) | ((qpn_h << 8) & 0xffffff00)
8337 	    );
8338 }
8339 
8340 /*
8341 * PARAMETERS
8342 *
8343 * NOTES
8344 *
8345 * SEE ALSO
8346 *	ib_inform_info_t
8347 *********/
8348 
8349 /****f* IBA Base: Types/ib_inform_info_get_prod_type
8350 * NAME
8351 *	ib_inform_info_get_prod_type
8352 *
8353 * DESCRIPTION
8354 *	Get Producer Type of the Inform Info
8355 *	13.4.8.3 InformInfo
8356 *
8357 * SYNOPSIS
8358 */
8359 static inline ib_net32_t OSM_API
ib_inform_info_get_prod_type(IN const ib_inform_info_t * p_inf)8360 ib_inform_info_get_prod_type(IN const ib_inform_info_t * p_inf)
8361 {
8362 	uint32_t nt;
8363 
8364 	nt = cl_ntoh16(p_inf->g_or_v.generic.node_type_lsb) |
8365 	    (p_inf->g_or_v.generic.node_type_msb << 16);
8366 	return cl_hton32(nt);
8367 }
8368 
8369 /*
8370 * PARAMETERS
8371 *	p_inf
8372 *		[in] pointer to an inform info
8373 *
8374 * RETURN VALUES
8375 *     The producer type
8376 *
8377 * NOTES
8378 *
8379 * SEE ALSO
8380 *	ib_inform_info_t
8381 *********/
8382 
8383 /****f* IBA Base: Types/ib_inform_info_get_vend_id
8384 * NAME
8385 *	ib_inform_info_get_vend_id
8386 *
8387 * DESCRIPTION
8388 *	Get Node Type of the Inform Info
8389 *
8390 * SYNOPSIS
8391 */
8392 static inline ib_net32_t OSM_API
ib_inform_info_get_vend_id(IN const ib_inform_info_t * p_inf)8393 ib_inform_info_get_vend_id(IN const ib_inform_info_t * p_inf)
8394 {
8395 	uint32_t vi;
8396 
8397 	vi = cl_ntoh16(p_inf->g_or_v.vend.vendor_id_lsb) |
8398 	    (p_inf->g_or_v.vend.vendor_id_msb << 16);
8399 	return cl_hton32(vi);
8400 }
8401 
8402 /*
8403 * PARAMETERS
8404 *	p_inf
8405 *		[in] pointer to an inform info
8406 *
8407 * RETURN VALUES
8408 *     The node type
8409 *
8410 * NOTES
8411 *
8412 * SEE ALSO
8413 *	ib_inform_info_t
8414 *********/
8415 
8416 /****s* IBA Base: Types/ib_inform_info_record_t
8417 * NAME
8418 *	ib_inform_info_record_t
8419 *
8420 * DESCRIPTION
8421 *	IBA defined InformInfo Record. (15.2.5.12)
8422 *
8423 * SYNOPSIS
8424 */
8425 #include <complib/cl_packon.h>
8426 typedef struct _ib_inform_info_record {
8427 	ib_gid_t subscriber_gid;
8428 	ib_net16_t subscriber_enum;
8429 	uint8_t reserved[6];
8430 	ib_inform_info_t inform_info;
8431 	uint8_t pad[4];
8432 } PACK_SUFFIX ib_inform_info_record_t;
8433 #include <complib/cl_packoff.h>
8434 
8435 /****s* IBA Base: Types/ib_perfmgt_mad_t
8436 * NAME
8437 *	ib_perfmgt_mad_t
8438 *
8439 * DESCRIPTION
8440 *	IBA defined Perf Management MAD (16.3.1)
8441 *
8442 * SYNOPSIS
8443 */
8444 #include <complib/cl_packon.h>
8445 typedef struct _ib_perfmgt_mad {
8446 	ib_mad_t header;
8447 	uint8_t resv[40];
8448 #define	IB_PM_DATA_SIZE		192
8449 	uint8_t data[IB_PM_DATA_SIZE];
8450 } PACK_SUFFIX ib_perfmgt_mad_t;
8451 #include <complib/cl_packoff.h>
8452 /*
8453 * FIELDS
8454 *	header
8455 *		Common MAD header.
8456 *
8457 *	resv
8458 *		Reserved.
8459 *
8460 *	data
8461 *		Performance Management payload.  The structure and content of this field
8462 *		depends upon the method, attr_id, and attr_mod fields in the header.
8463 *
8464 * SEE ALSO
8465 * ib_mad_t
8466 *********/
8467 
8468 /****s* IBA Base: Types/ib_port_counters
8469 * NAME
8470 *	ib_port_counters_t
8471 *
8472 * DESCRIPTION
8473 *	IBA defined PortCounters Attribute. (16.1.3.5)
8474 *
8475 * SYNOPSIS
8476 */
8477 #include <complib/cl_packon.h>
8478 typedef struct _ib_port_counters {
8479 	uint8_t reserved;
8480 	uint8_t port_select;
8481 	ib_net16_t counter_select;
8482 	ib_net16_t symbol_err_cnt;
8483 	uint8_t link_err_recover;
8484 	uint8_t link_downed;
8485 	ib_net16_t rcv_err;
8486 	ib_net16_t rcv_rem_phys_err;
8487 	ib_net16_t rcv_switch_relay_err;
8488 	ib_net16_t xmit_discards;
8489 	uint8_t xmit_constraint_err;
8490 	uint8_t rcv_constraint_err;
8491 	uint8_t counter_select2;
8492 	uint8_t link_int_buffer_overrun;
8493 	ib_net16_t qp1_dropped;
8494 	ib_net16_t vl15_dropped;
8495 	ib_net32_t xmit_data;
8496 	ib_net32_t rcv_data;
8497 	ib_net32_t xmit_pkts;
8498 	ib_net32_t rcv_pkts;
8499 	ib_net32_t xmit_wait;
8500 } PACK_SUFFIX ib_port_counters_t;
8501 #include <complib/cl_packoff.h>
8502 
8503 #define PC_LINK_INT(integ_buf_over) ((integ_buf_over & 0xF0) >> 4)
8504 #define PC_BUF_OVERRUN(integ_buf_over) (integ_buf_over & 0x0F)
8505 
8506 /****s* IBA Base: Types/ib_port_counters_ext
8507 * NAME
8508 *	ib_port_counters_ext_t
8509 *
8510 * DESCRIPTION
8511 *	IBA defined PortCounters Extended Attribute. (16.1.4.11)
8512 *
8513 * SYNOPSIS
8514 */
8515 #include <complib/cl_packon.h>
8516 typedef struct _ib_port_counters_ext {
8517 	uint8_t reserved;
8518 	uint8_t port_select;
8519 	ib_net16_t counter_select;
8520 	ib_net32_t counter_select2;
8521 	ib_net64_t xmit_data;
8522 	ib_net64_t rcv_data;
8523 	ib_net64_t xmit_pkts;
8524 	ib_net64_t rcv_pkts;
8525 	ib_net64_t unicast_xmit_pkts;
8526 	ib_net64_t unicast_rcv_pkts;
8527 	ib_net64_t multicast_xmit_pkts;
8528 	ib_net64_t multicast_rcv_pkts;
8529 	ib_net64_t symbol_err_cnt;
8530 	ib_net64_t link_err_recover;
8531 	ib_net64_t link_downed;
8532 	ib_net64_t rcv_err;
8533 	ib_net64_t rcv_rem_phys_err;
8534 	ib_net64_t rcv_switch_relay_err;
8535 	ib_net64_t xmit_discards;
8536 	ib_net64_t xmit_constraint_err;
8537 	ib_net64_t rcv_constraint_err;
8538 	ib_net64_t link_integrity_err;
8539 	ib_net64_t buffer_overrun;
8540 	ib_net64_t vl15_dropped;
8541 	ib_net64_t xmit_wait;
8542 	ib_net64_t qp1_dropped;
8543 } PACK_SUFFIX ib_port_counters_ext_t;
8544 #include <complib/cl_packoff.h>
8545 
8546 /****s* IBA Base: Types/ib_port_samples_control
8547 * NAME
8548 *	ib_port_samples_control_t
8549 *
8550 * DESCRIPTION
8551 *	IBA defined PortSamplesControl Attribute. (16.1.3.2)
8552 *
8553 * SYNOPSIS
8554 */
8555 #include <complib/cl_packon.h>
8556 typedef struct _ib_port_samples_control {
8557 	uint8_t op_code;
8558 	uint8_t port_select;
8559 	uint8_t tick;
8560 	uint8_t counter_width;	/* 5 bits res : 3bits counter_width */
8561 	ib_net32_t counter_mask;	/* 2 bits res : 3 bits counter_mask : 27 bits counter_masks_1to9 */
8562 	ib_net16_t counter_mask_10to14;	/* 1 bits res : 15 bits counter_masks_10to14 */
8563 	uint8_t sample_mech;
8564 	uint8_t sample_status;	/* 6 bits res : 2 bits sample_status */
8565 	ib_net64_t option_mask;
8566 	ib_net64_t vendor_mask;
8567 	ib_net32_t sample_start;
8568 	ib_net32_t sample_interval;
8569 	ib_net16_t tag;
8570 	ib_net16_t counter_select0;
8571 	ib_net16_t counter_select1;
8572 	ib_net16_t counter_select2;
8573 	ib_net16_t counter_select3;
8574 	ib_net16_t counter_select4;
8575 	ib_net16_t counter_select5;
8576 	ib_net16_t counter_select6;
8577 	ib_net16_t counter_select7;
8578 	ib_net16_t counter_select8;
8579 	ib_net16_t counter_select9;
8580 	ib_net16_t counter_select10;
8581 	ib_net16_t counter_select11;
8582 	ib_net16_t counter_select12;
8583 	ib_net16_t counter_select13;
8584 	ib_net16_t counter_select14;
8585 } PACK_SUFFIX ib_port_samples_control_t;
8586 #include <complib/cl_packoff.h>
8587 
8588 /****d* IBA Base: Types/CounterSelect values
8589 * NAME
8590 *       Counter select values
8591 *
8592 * DESCRIPTION
8593 *	Mandatory counter select values (16.1.3.3)
8594 *
8595 * SYNOPSIS
8596 */
8597 #define IB_CS_PORT_XMIT_DATA (CL_HTON16(0x0001))
8598 #define IB_CS_PORT_RCV_DATA  (CL_HTON16(0x0002))
8599 #define IB_CS_PORT_XMIT_PKTS (CL_HTON16(0x0003))
8600 #define IB_CS_PORT_RCV_PKTS  (CL_HTON16(0x0004))
8601 #define IB_CS_PORT_XMIT_WAIT (CL_HTON16(0x0005))
8602 
8603 /****s* IBA Base: Types/ib_port_samples_result
8604 * NAME
8605 *	ib_port_samples_result_t
8606 *
8607 * DESCRIPTION
8608 *	IBA defined PortSamplesControl Attribute. (16.1.3.2)
8609 *
8610 * SYNOPSIS
8611 */
8612 #include <complib/cl_packon.h>
8613 typedef struct _ib_port_samples_result {
8614 	ib_net16_t tag;
8615 	ib_net16_t sample_status;	/* 14 bits res : 2 bits sample_status */
8616 	ib_net32_t counter0;
8617 	ib_net32_t counter1;
8618 	ib_net32_t counter2;
8619 	ib_net32_t counter3;
8620 	ib_net32_t counter4;
8621 	ib_net32_t counter5;
8622 	ib_net32_t counter6;
8623 	ib_net32_t counter7;
8624 	ib_net32_t counter8;
8625 	ib_net32_t counter9;
8626 	ib_net32_t counter10;
8627 	ib_net32_t counter11;
8628 	ib_net32_t counter12;
8629 	ib_net32_t counter13;
8630 	ib_net32_t counter14;
8631 } PACK_SUFFIX ib_port_samples_result_t;
8632 #include <complib/cl_packoff.h>
8633 
8634 /****s* IBA Base: Types/ib_port_xmit_data_sl
8635 * NAME
8636 *	ib_port_xmit_data_sl_t
8637 *
8638 * DESCRIPTION
8639 *       IBA defined PortXmitDataSL Attribute. (A13.6.4)
8640 *
8641 * SYNOPSIS
8642 */
8643 #include <complib/cl_packon.h>
8644 typedef struct _ib_port_xmit_data_sl {
8645 	uint8_t reserved;
8646 	uint8_t port_select;
8647 	ib_net16_t counter_select;
8648 	ib_net32_t port_xmit_data_sl[16];
8649 	uint8_t resv[124];
8650 } PACK_SUFFIX ib_port_xmit_data_sl_t;
8651 #include <complib/cl_packoff.h>
8652 
8653 /****s* IBA Base: Types/ib_port_rcv_data_sl
8654 * NAME
8655 *	ib_port_rcv_data_sl_t
8656 *
8657 * DESCRIPTION
8658 *	IBA defined PortRcvDataSL Attribute. (A13.6.4)
8659 *
8660 * SYNOPSIS
8661 */
8662 #include <complib/cl_packon.h>
8663 typedef struct _ib_port_rcv_data_sl {
8664 	uint8_t reserved;
8665 	uint8_t port_select;
8666 	ib_net16_t counter_select;
8667 	ib_net32_t port_rcv_data_sl[16];
8668 	uint8_t resv[124];
8669 } PACK_SUFFIX ib_port_rcv_data_sl_t;
8670 #include <complib/cl_packoff.h>
8671 
8672 /****d* IBA Base: Types/DM_SVC_NAME
8673 * NAME
8674 *	DM_SVC_NAME
8675 *
8676 * DESCRIPTION
8677 *	IBA defined Device Management service name (16.3)
8678 *
8679 * SYNOPSIS
8680 */
8681 #define	DM_SVC_NAME				"DeviceManager.IBTA"
8682 /*
8683 * SEE ALSO
8684 *********/
8685 
8686 /****s* IBA Base: Types/ib_dm_mad_t
8687 * NAME
8688 *	ib_dm_mad_t
8689 *
8690 * DESCRIPTION
8691 *	IBA defined Device Management MAD (16.3.1)
8692 *
8693 * SYNOPSIS
8694 */
8695 #include <complib/cl_packon.h>
8696 typedef struct _ib_dm_mad {
8697 	ib_mad_t header;
8698 	uint8_t resv[40];
8699 #define	IB_DM_DATA_SIZE		192
8700 	uint8_t data[IB_DM_DATA_SIZE];
8701 } PACK_SUFFIX ib_dm_mad_t;
8702 #include <complib/cl_packoff.h>
8703 /*
8704 * FIELDS
8705 *	header
8706 *		Common MAD header.
8707 *
8708 *	resv
8709 *		Reserved.
8710 *
8711 *	data
8712 *		Device Management payload.  The structure and content of this field
8713 *		depend upon the method, attr_id, and attr_mod fields in the header.
8714 *
8715 * SEE ALSO
8716 * ib_mad_t
8717 *********/
8718 
8719 /****s* IBA Base: Types/ib_iou_info_t
8720 * NAME
8721 *	ib_iou_info_t
8722 *
8723 * DESCRIPTION
8724 *	IBA defined IO Unit information structure (16.3.3.3)
8725 *
8726 * SYNOPSIS
8727 */
8728 #include <complib/cl_packon.h>
8729 typedef struct _ib_iou_info {
8730 	ib_net16_t change_id;
8731 	uint8_t max_controllers;
8732 	uint8_t diag_rom;
8733 #define	IB_DM_CTRL_LIST_SIZE	128
8734 	uint8_t controller_list[IB_DM_CTRL_LIST_SIZE];
8735 #define	IOC_NOT_INSTALLED		0x0
8736 #define	IOC_INSTALLED			0x1
8737 //              Reserved values                         0x02-0xE
8738 #define	SLOT_DOES_NOT_EXIST		0xF
8739 } PACK_SUFFIX ib_iou_info_t;
8740 #include <complib/cl_packoff.h>
8741 /*
8742 * FIELDS
8743 *	change_id
8744 *		Value incremented, with rollover, by any change to the controller_list.
8745 *
8746 *	max_controllers
8747 *		Number of slots in controller_list.
8748 *
8749 *	diag_rom
8750 *		A byte containing two fields: DiagDeviceID and OptionROM.
8751 *		These fields may be read using the ib_iou_info_diag_dev_id
8752 *		and ib_iou_info_option_rom functions.
8753 *
8754 *	controller_list
8755 *		A series of 4-bit nibbles, with each nibble representing a slot
8756 *		in the IO Unit.  Individual nibbles may be read using the
8757 *		ioc_at_slot function.
8758 *
8759 * SEE ALSO
8760 * ib_dm_mad_t, ib_iou_info_diag_dev_id, ib_iou_info_option_rom, ioc_at_slot
8761 *********/
8762 
8763 /****f* IBA Base: Types/ib_iou_info_diag_dev_id
8764 * NAME
8765 *	ib_iou_info_diag_dev_id
8766 *
8767 * DESCRIPTION
8768 *	Returns the DiagDeviceID.
8769 *
8770 * SYNOPSIS
8771 */
8772 static inline uint8_t OSM_API
ib_iou_info_diag_dev_id(IN const ib_iou_info_t * const p_iou_info)8773 ib_iou_info_diag_dev_id(IN const ib_iou_info_t * const p_iou_info)
8774 {
8775 	return ((uint8_t) (p_iou_info->diag_rom >> 6 & 1));
8776 }
8777 
8778 /*
8779 * PARAMETERS
8780 *	p_iou_info
8781 *		[in] Pointer to the IO Unit information structure.
8782 *
8783 * RETURN VALUES
8784 *	DiagDeviceID field of the IO Unit information.
8785 *
8786 * NOTES
8787 *
8788 * SEE ALSO
8789 *	ib_iou_info_t
8790 *********/
8791 
8792 /****f* IBA Base: Types/ib_iou_info_option_rom
8793 * NAME
8794 *	ib_iou_info_option_rom
8795 *
8796 * DESCRIPTION
8797 *	Returns the OptionROM.
8798 *
8799 * SYNOPSIS
8800 */
8801 static inline uint8_t OSM_API
ib_iou_info_option_rom(IN const ib_iou_info_t * const p_iou_info)8802 ib_iou_info_option_rom(IN const ib_iou_info_t * const p_iou_info)
8803 {
8804 	return ((uint8_t) (p_iou_info->diag_rom >> 7));
8805 }
8806 
8807 /*
8808 * PARAMETERS
8809 *	p_iou_info
8810 *		[in] Pointer to the IO Unit information structure.
8811 *
8812 * RETURN VALUES
8813 *	OptionROM field of the IO Unit information.
8814 *
8815 * NOTES
8816 *
8817 * SEE ALSO
8818 *	ib_iou_info_t
8819 *********/
8820 
8821 /****f* IBA Base: Types/ioc_at_slot
8822 * NAME
8823 *	ioc_at_slot
8824 *
8825 * DESCRIPTION
8826 *	Returns the IOC value at the specified slot.
8827 *
8828 * SYNOPSIS
8829 */
8830 static inline uint8_t OSM_API
ioc_at_slot(IN const ib_iou_info_t * const p_iou_info,IN uint8_t slot)8831 ioc_at_slot(IN const ib_iou_info_t * const p_iou_info, IN uint8_t slot)
8832 {
8833 	if (slot >= IB_DM_CTRL_LIST_SIZE)
8834 		return SLOT_DOES_NOT_EXIST;
8835 	else
8836 		return (int8_t)
8837 		    ((slot % 2) ?
8838 		     ((p_iou_info->controller_list[slot / 2] & 0xf0) >> 4) :
8839 		     (p_iou_info->controller_list[slot / 2] & 0x0f));
8840 }
8841 
8842 /*
8843 * PARAMETERS
8844 *	p_iou_info
8845 *		[in] Pointer to the IO Unit information structure.
8846 *
8847 *	slot
8848 *		[in] Pointer to the IO Unit information structure.
8849 *
8850 * RETURN VALUES
8851 *	OptionROM field of the IO Unit information.
8852 *
8853 * NOTES
8854 *
8855 * SEE ALSO
8856 *	ib_iou_info_t
8857 *********/
8858 
8859 /****s* IBA Base: Types/ib_ioc_profile_t
8860 * NAME
8861 *	ib_ioc_profile_t
8862 *
8863 * DESCRIPTION
8864 *	IBA defined IO Controller profile structure (16.3.3.4)
8865 *
8866 * SYNOPSIS
8867 */
8868 #include <complib/cl_packon.h>
8869 typedef struct _ib_ioc_profile {
8870 	ib_net64_t ioc_guid;
8871 	ib_net32_t vend_id;
8872 	ib_net32_t dev_id;
8873 	ib_net16_t dev_ver;
8874 	ib_net16_t resv2;
8875 	ib_net32_t subsys_vend_id;
8876 	ib_net32_t subsys_id;
8877 	ib_net16_t io_class;
8878 	ib_net16_t io_subclass;
8879 	ib_net16_t protocol;
8880 	ib_net16_t protocol_ver;
8881 	ib_net32_t resv3;
8882 	ib_net16_t send_msg_depth;
8883 	uint8_t resv4;
8884 	uint8_t rdma_read_depth;
8885 	ib_net32_t send_msg_size;
8886 	ib_net32_t rdma_size;
8887 	uint8_t ctrl_ops_cap;
8888 #define	CTRL_OPS_CAP_ST		0x01
8889 #define	CTRL_OPS_CAP_SF		0x02
8890 #define	CTRL_OPS_CAP_RT		0x04
8891 #define	CTRL_OPS_CAP_RF		0x08
8892 #define	CTRL_OPS_CAP_WT		0x10
8893 #define	CTRL_OPS_CAP_WF		0x20
8894 #define	CTRL_OPS_CAP_AT		0x40
8895 #define	CTRL_OPS_CAP_AF		0x80
8896 	uint8_t resv5;
8897 	uint8_t num_svc_entries;
8898 #define	MAX_NUM_SVC_ENTRIES	0xff
8899 	uint8_t resv6[9];
8900 #define	CTRL_ID_STRING_LEN	64
8901 	char id_string[CTRL_ID_STRING_LEN];
8902 } PACK_SUFFIX ib_ioc_profile_t;
8903 #include <complib/cl_packoff.h>
8904 /*
8905 * FIELDS
8906 *	ioc_guid
8907 *		An EUI-64 GUID used to uniquely identify the IO controller.
8908 *
8909 *	vend_id
8910 *		IO controller vendor ID, IEEE format.
8911 *
8912 *	dev_id
8913 *		A number assigned by the vendor to identify the type of controller.
8914 *
8915 *	dev_ver
8916 *		A number assigned by the vendor to identify the divice version.
8917 *
8918 *	subsys_vend_id
8919 *		ID of the vendor of the enclosure, if any, in which the IO controller
8920 *		resides in IEEE format; otherwise zero.
8921 *
8922 *	subsys_id
8923 *		A number identifying the subsystem where the controller resides.
8924 *
8925 *	io_class
8926 *		0x0000 - 0xfffe = reserved for IO classes encompased by InfiniBand
8927 *		Architecture.  0xffff = Vendor specific.
8928 *
8929 *	io_subclass
8930 *		0x0000 - 0xfffe = reserved for IO subclasses encompased by InfiniBand
8931 *		Architecture.  0xffff = Vendor specific.  This shall be set to 0xfff
8932 *		if the io_class component is 0xffff.
8933 *
8934 *	protocol
8935 *		0x0000 - 0xfffe = reserved for IO subclasses encompased by InfiniBand
8936 *		Architecture.  0xffff = Vendor specific.  This shall be set to 0xfff
8937 *		if the io_class component is 0xffff.
8938 *
8939 *	protocol_ver
8940 *		Protocol specific.
8941 *
8942 *	send_msg_depth
8943 *		Maximum depth of the send message queue.
8944 *
8945 *	rdma_read_depth
8946 *		Maximum depth of the per-channel RDMA read queue.
8947 *
8948 *	send_msg_size
8949 *		Maximum size of send messages.
8950 *
8951 *	ctrl_ops_cap
8952 *		Supported operation types of this IO controller.  A bit set to one
8953 *		for affirmation of supported capability.
8954 *
8955 *	num_svc_entries
8956 *		Number of entries in the service entries table.
8957 *
8958 *	id_string
8959 *		UTF-8 encoded string for identifying the controller to an operator.
8960 *
8961 * SEE ALSO
8962 * ib_dm_mad_t
8963 *********/
8964 
8965 static inline uint32_t OSM_API
ib_ioc_profile_get_vend_id(IN const ib_ioc_profile_t * const p_ioc_profile)8966 ib_ioc_profile_get_vend_id(IN const ib_ioc_profile_t * const p_ioc_profile)
8967 {
8968 	return (cl_ntoh32(p_ioc_profile->vend_id) >> 8);
8969 }
8970 
8971 static inline void OSM_API
ib_ioc_profile_set_vend_id(IN ib_ioc_profile_t * const p_ioc_profile,IN const uint32_t vend_id)8972 ib_ioc_profile_set_vend_id(IN ib_ioc_profile_t * const p_ioc_profile,
8973 			   IN const uint32_t vend_id)
8974 {
8975 	p_ioc_profile->vend_id = (cl_hton32(vend_id) << 8);
8976 }
8977 
8978 /****s* IBA Base: Types/ib_svc_entry_t
8979 * NAME
8980 *	ib_svc_entry_t
8981 *
8982 * DESCRIPTION
8983 *	IBA defined IO Controller service entry structure (16.3.3.5)
8984 *
8985 * SYNOPSIS
8986 */
8987 #include <complib/cl_packon.h>
8988 typedef struct _ib_svc_entry {
8989 #define	MAX_SVC_ENTRY_NAME_LEN		40
8990 	char name[MAX_SVC_ENTRY_NAME_LEN];
8991 	ib_net64_t id;
8992 } PACK_SUFFIX ib_svc_entry_t;
8993 #include <complib/cl_packoff.h>
8994 /*
8995 * FIELDS
8996 *	name
8997 *		UTF-8 encoded, null-terminated name of the service.
8998 *
8999 *	id
9000 *		An identifier of the associated Service.
9001 *
9002 * SEE ALSO
9003 * ib_svc_entries_t
9004 *********/
9005 
9006 /****s* IBA Base: Types/ib_svc_entries_t
9007 * NAME
9008 *	ib_svc_entries_t
9009 *
9010 * DESCRIPTION
9011 *	IBA defined IO Controller service entry array (16.3.3.5)
9012 *
9013 * SYNOPSIS
9014 */
9015 #include <complib/cl_packon.h>
9016 typedef struct _ib_svc_entries {
9017 #define	SVC_ENTRY_COUNT			4
9018 	ib_svc_entry_t service_entry[SVC_ENTRY_COUNT];
9019 } PACK_SUFFIX ib_svc_entries_t;
9020 #include <complib/cl_packoff.h>
9021 /*
9022 * FIELDS
9023 *	service_entry
9024 *		An array of IO controller service entries.
9025 *
9026 * SEE ALSO
9027 * ib_dm_mad_t, ib_svc_entry_t
9028 *********/
9029 
9030 static inline void OSM_API
ib_dm_get_slot_lo_hi(IN const ib_net32_t slot_lo_hi,OUT uint8_t * const p_slot,OUT uint8_t * const p_lo,OUT uint8_t * const p_hi)9031 ib_dm_get_slot_lo_hi(IN const ib_net32_t slot_lo_hi,
9032 		     OUT uint8_t * const p_slot,
9033 		     OUT uint8_t * const p_lo, OUT uint8_t * const p_hi)
9034 {
9035 	ib_net32_t tmp_slot_lo_hi = CL_NTOH32(slot_lo_hi);
9036 
9037 	if (p_slot)
9038 		*p_slot = (uint8_t) ((tmp_slot_lo_hi >> 16) & 0x0f);
9039 	if (p_hi)
9040 		*p_hi = (uint8_t) ((tmp_slot_lo_hi >> 8) & 0xff);
9041 	if (p_lo)
9042 		*p_lo = (uint8_t) ((tmp_slot_lo_hi >> 0) & 0xff);
9043 }
9044 
9045 /*
9046  *	IBA defined information describing an I/O controller
9047  */
9048 #include <complib/cl_packon.h>
9049 typedef struct _ib_ioc_info {
9050 	ib_net64_t module_guid;
9051 	ib_net64_t iou_guid;
9052 	ib_ioc_profile_t ioc_profile;
9053 	ib_net64_t access_key;
9054 	uint16_t initiators_conf;
9055 	uint8_t resv[38];
9056 } PACK_SUFFIX ib_ioc_info_t;
9057 #include <complib/cl_packoff.h>
9058 
9059 /*
9060  *	The following definitions are shared between the Access Layer and VPD
9061  */
9062 typedef struct _ib_ca *__ptr64 ib_ca_handle_t;
9063 typedef struct _ib_pd *__ptr64 ib_pd_handle_t;
9064 typedef struct _ib_rdd *__ptr64 ib_rdd_handle_t;
9065 typedef struct _ib_mr *__ptr64 ib_mr_handle_t;
9066 typedef struct _ib_mw *__ptr64 ib_mw_handle_t;
9067 typedef struct _ib_qp *__ptr64 ib_qp_handle_t;
9068 typedef struct _ib_eec *__ptr64 ib_eec_handle_t;
9069 typedef struct _ib_cq *__ptr64 ib_cq_handle_t;
9070 typedef struct _ib_av *__ptr64 ib_av_handle_t;
9071 typedef struct _ib_mcast *__ptr64 ib_mcast_handle_t;
9072 
9073 /* Currently for windows branch, use the extended version of ib special verbs struct
9074 	in order to be compliant with Infinicon ib_types; later we'll change it to support
9075 	OpenSM ib_types.h */
9076 
9077 #ifndef __WIN__
9078 /****d* Access Layer/ib_api_status_t
9079 * NAME
9080 *	ib_api_status_t
9081 *
9082 * DESCRIPTION
9083 *	Function return codes indicating the success or failure of an API call.
9084 *	Note that success is indicated by the return value IB_SUCCESS, which
9085 *	is always zero.
9086 *
9087 * NOTES
9088 *	IB_VERBS_PROCESSING_DONE is used by UVP library to terminate a verbs call
9089 *	in the pre-ioctl step itself.
9090 *
9091 * SYNOPSIS
9092 */
9093 typedef enum _ib_api_status_t {
9094 	IB_SUCCESS,
9095 	IB_INSUFFICIENT_RESOURCES,
9096 	IB_INSUFFICIENT_MEMORY,
9097 	IB_INVALID_PARAMETER,
9098 	IB_INVALID_SETTING,
9099 	IB_NOT_FOUND,
9100 	IB_TIMEOUT,
9101 	IB_CANCELED,
9102 	IB_INTERRUPTED,
9103 	IB_INVALID_PERMISSION,
9104 	IB_UNSUPPORTED,
9105 	IB_OVERFLOW,
9106 	IB_MAX_MCAST_QPS_REACHED,
9107 	IB_INVALID_QP_STATE,
9108 	IB_INVALID_EEC_STATE,
9109 	IB_INVALID_APM_STATE,
9110 	IB_INVALID_PORT_STATE,
9111 	IB_INVALID_STATE,
9112 	IB_RESOURCE_BUSY,
9113 	IB_INVALID_PKEY,
9114 	IB_INVALID_LKEY,
9115 	IB_INVALID_RKEY,
9116 	IB_INVALID_MAX_WRS,
9117 	IB_INVALID_MAX_SGE,
9118 	IB_INVALID_CQ_SIZE,
9119 	IB_INVALID_SERVICE_TYPE,
9120 	IB_INVALID_GID,
9121 	IB_INVALID_LID,
9122 	IB_INVALID_GUID,
9123 	IB_INVALID_CA_HANDLE,
9124 	IB_INVALID_AV_HANDLE,
9125 	IB_INVALID_CQ_HANDLE,
9126 	IB_INVALID_EEC_HANDLE,
9127 	IB_INVALID_QP_HANDLE,
9128 	IB_INVALID_PD_HANDLE,
9129 	IB_INVALID_MR_HANDLE,
9130 	IB_INVALID_MW_HANDLE,
9131 	IB_INVALID_RDD_HANDLE,
9132 	IB_INVALID_MCAST_HANDLE,
9133 	IB_INVALID_CALLBACK,
9134 	IB_INVALID_AL_HANDLE,	/* InfiniBand Access Layer */
9135 	IB_INVALID_HANDLE,	/* InfiniBand Access Layer */
9136 	IB_ERROR,		/* InfiniBand Access Layer */
9137 	IB_REMOTE_ERROR,	/* Infiniband Access Layer */
9138 	IB_VERBS_PROCESSING_DONE,	/* See Notes above         */
9139 	IB_INVALID_WR_TYPE,
9140 	IB_QP_IN_TIMEWAIT,
9141 	IB_EE_IN_TIMEWAIT,
9142 	IB_INVALID_PORT,
9143 	IB_NOT_DONE,
9144 	IB_UNKNOWN_ERROR	/* ALWAYS LAST ENUM VALUE! */
9145 } ib_api_status_t;
9146 /*****/
9147 
9148 OSM_EXPORT const char *ib_error_str[];
9149 
9150 /****f* IBA Base: Types/ib_get_err_str
9151 * NAME
9152 *	ib_get_err_str
9153 *
9154 * DESCRIPTION
9155 *	Returns a string for the specified status value.
9156 *
9157 * SYNOPSIS
9158 */
ib_get_err_str(IN ib_api_status_t status)9159 static inline const char *OSM_API ib_get_err_str(IN ib_api_status_t status)
9160 {
9161 	if (status > IB_UNKNOWN_ERROR)
9162 		status = IB_UNKNOWN_ERROR;
9163 	return (ib_error_str[status]);
9164 }
9165 
9166 /*
9167 * PARAMETERS
9168 *	status
9169 *		[in] status value
9170 *
9171 * RETURN VALUES
9172 *	Pointer to the status description string.
9173 *
9174 * NOTES
9175 *
9176 * SEE ALSO
9177 *********/
9178 
9179 /****d* Verbs/ib_async_event_t
9180 * NAME
9181 *	ib_async_event_t -- Async event types
9182 *
9183 * DESCRIPTION
9184 *	This type indicates the reason the async callback was called.
9185 *	The context in the ib_event_rec_t indicates the resource context
9186 *	that associated with the callback.  For example, for IB_AE_CQ_ERROR
9187 *	the context provided during the ib_create_cq is returned in the event.
9188 *
9189 * SYNOPSIS
9190 */
9191 typedef enum _ib_async_event_t {
9192 	IB_AE_SQ_ERROR = 1,
9193 	IB_AE_SQ_DRAINED,
9194 	IB_AE_RQ_ERROR,
9195 	IB_AE_CQ_ERROR,
9196 	IB_AE_QP_FATAL,
9197 	IB_AE_QP_COMM,
9198 	IB_AE_QP_APM,
9199 	IB_AE_EEC_FATAL,
9200 	IB_AE_EEC_COMM,
9201 	IB_AE_EEC_APM,
9202 	IB_AE_LOCAL_FATAL,
9203 	IB_AE_PKEY_TRAP,
9204 	IB_AE_QKEY_TRAP,
9205 	IB_AE_MKEY_TRAP,
9206 	IB_AE_PORT_TRAP,
9207 	IB_AE_SYSIMG_GUID_TRAP,
9208 	IB_AE_BUF_OVERRUN,
9209 	IB_AE_LINK_INTEGRITY,
9210 	IB_AE_FLOW_CTRL_ERROR,
9211 	IB_AE_BKEY_TRAP,
9212 	IB_AE_QP_APM_ERROR,
9213 	IB_AE_EEC_APM_ERROR,
9214 	IB_AE_WQ_REQ_ERROR,
9215 	IB_AE_WQ_ACCESS_ERROR,
9216 	IB_AE_PORT_ACTIVE,
9217 	IB_AE_PORT_DOWN,
9218 	IB_AE_UNKNOWN		/* ALWAYS LAST ENUM VALUE */
9219 } ib_async_event_t;
9220 /*
9221 * VALUES
9222 *	IB_AE_SQ_ERROR
9223 *		An error occurred when accessing the send queue of the QP or EEC.
9224 *		This event is optional.
9225 *
9226 *	IB_AE_SQ_DRAINED
9227 *		The send queue of the specified QP has completed the outstanding
9228 *		messages in progress when the state change was requested and, if
9229 *		applicable, has received all acknowledgements for those messages.
9230 *
9231 *	IB_AE_RQ_ERROR
9232 *		An error occurred when accessing the receive queue of the QP or EEC.
9233 *		This event is optional.
9234 *
9235 *	IB_AE_CQ_ERROR
9236 *		An error occurred when writing an entry to the CQ.
9237 *
9238 *	IB_AE_QP_FATAL
9239 *		A catastrophic error occurred while accessing or processing the
9240 *		work queue that prevents reporting of completions.
9241 *
9242 *	IB_AE_QP_COMM
9243 *		The first packet has arrived for the receive work queue where the
9244 *		QP is still in the RTR state.
9245 *
9246 *	IB_AE_QP_APM
9247 *		If alternate path migration is supported, this event indicates that
9248 *		the QP connection has migrated to the alternate path.
9249 *
9250 *	IB_AE_EEC_FATAL
9251 *		If reliable datagram service is supported, this event indicates that
9252 *		a catastrophic error occurred while accessing or processing the EEC
9253 *		that prevents reporting of completions.
9254 *
9255 *	IB_AE_EEC_COMM
9256 *		If reliable datagram service is supported, this event indicates that
9257 *		the first packet has arrived for the receive work queue where the
9258 *		EEC is still in the RTR state.
9259 *
9260 *	IB_AE_EEC_APM
9261 *		If reliable datagram service and alternate path migration is supported,
9262 *		this event indicates that the EEC connection has migrated to the
9263 *		alternate path.
9264 *
9265 *	IB_AE_LOCAL_FATAL
9266 *		A catastrophic HCA error occurred which cannot be attributed to
9267 *		any resource; behavior is indeterminate.
9268 *
9269 *	IB_AE_PKEY_TRAP
9270 *		A PKEY violation was detected.  This event is optional.
9271 *
9272 *	IB_AE_QKEY_TRAP
9273 *		A QKEY violation was detected.  This event is optional.
9274 *
9275 *	IB_AE_MKEY_TRAP
9276 *		A MKEY violation was detected.  This event is optional.
9277 *
9278 *	IB_AE_PORT_TRAP
9279 *		A port capability change was detected.  This event is optional.
9280 *
9281 *	IB_AE_SYSIMG_GUID_TRAP
9282 *		If the system image GUID is supported, this event indicates that
9283 *		the system image GUID of this HCA has been changed.  This event
9284 *		is optional.
9285 *
9286 *	IB_AE_BUF_OVERRUN
9287 *		The number of consecutive flow control update periods with at least
9288 *		one overrun error in each period has exceeded the threshold specified
9289 *		in the port info attributes.  This event is optional.
9290 *
9291 *	IB_AE_LINK_INTEGRITY
9292 *		The detection of excessively frequent local physical errors has
9293 *		exceeded the threshold specified in the port info attributes.  This
9294 *		event is optional.
9295 *
9296 *	IB_AE_FLOW_CTRL_ERROR
9297 *		An HCA watchdog timer monitoring the arrival of flow control updates
9298 *		has expired without receiving an update.  This event is optional.
9299 *
9300 *	IB_AE_BKEY_TRAP
9301 *		An BKEY violation was detected.  This event is optional.
9302 *
9303 *	IB_AE_QP_APM_ERROR
9304 *		If alternate path migration is supported, this event indicates that
9305 *		an incoming path migration request to this QP was not accepted.
9306 *
9307 *	IB_AE_EEC_APM_ERROR
9308 *		If reliable datagram service and alternate path migration is supported,
9309 *		this event indicates that an incoming path migration request to this
9310 *		EEC was not accepted.
9311 *
9312 *	IB_AE_WQ_REQ_ERROR
9313 *		An OpCode violation was detected at the responder.
9314 *
9315 *	IB_AE_WQ_ACCESS_ERROR
9316 *		An access violation was detected at the responder.
9317 *
9318 *	IB_AE_PORT_ACTIVE
9319 *		If the port active event is supported, this event is generated
9320 *		when the link becomes active: IB_LINK_ACTIVE.
9321 *
9322 *	IB_AE_PORT_DOWN
9323 *		The link is declared unavailable: IB_LINK_INIT, IB_LINK_ARMED,
9324 *		IB_LINK_DOWN.
9325 *
9326 *	IB_AE_UNKNOWN
9327 *		An unknown error occurred which cannot be attributed to any
9328 *		resource; behavior is indeterminate.
9329 *
9330 *****/
9331 
9332 OSM_EXPORT const char *ib_async_event_str[];
9333 
9334 /****f* IBA Base: Types/ib_get_async_event_str
9335 * NAME
9336 *	ib_get_async_event_str
9337 *
9338 * DESCRIPTION
9339 *	Returns a string for the specified asynchronous event.
9340 *
9341 * SYNOPSIS
9342 */
9343 static inline const char *OSM_API
ib_get_async_event_str(IN ib_async_event_t event)9344 ib_get_async_event_str(IN ib_async_event_t event)
9345 {
9346 	if (event > IB_AE_UNKNOWN)
9347 		event = IB_AE_UNKNOWN;
9348 	return (ib_async_event_str[event]);
9349 }
9350 
9351 /*
9352 * PARAMETERS
9353 *	event
9354 *		[in] event value
9355 *
9356 * RETURN VALUES
9357 *	Pointer to the asynchronous event description string.
9358 *
9359 * NOTES
9360 *
9361 * SEE ALSO
9362 *********/
9363 
9364 /****s* Verbs/ib_event_rec_t
9365 * NAME
9366 *	ib_event_rec_t -- Async event notification record
9367 *
9368 * DESCRIPTION
9369 *	When an async event callback is made, this structure is passed to indicate
9370 *	the type of event, the source of event that caused it, and the context
9371 *	associated with this event.
9372 *
9373 *	context -- Context of the resource that caused the event.
9374 *		-- ca_context if this is a port/adapter event.
9375 *		-- qp_context if the source is a QP event
9376 *		-- cq_context if the source is a CQ event.
9377 *		-- ee_context if the source is an EE event.
9378 *
9379 * SYNOPSIS
9380 */
9381 typedef struct _ib_event_rec {
9382 	void *context;
9383 	ib_async_event_t type;
9384 	/* HCA vendor specific event information. */
9385 	uint64_t vendor_specific;
9386 	/* The following structures are valid only for trap types. */
9387 	union _trap {
9388 		struct {
9389 			uint16_t lid;
9390 			ib_net64_t port_guid;
9391 			uint8_t port_num;
9392 			/*
9393 			 * The following structure is valid only for
9394 			 * P_KEY, Q_KEY, and M_KEY violation traps.
9395 			 */
9396 			struct {
9397 				uint8_t sl;
9398 				uint16_t src_lid;
9399 				uint16_t dest_lid;
9400 				union _key {
9401 					uint16_t pkey;
9402 					uint32_t qkey;
9403 					uint64_t mkey;
9404 				} key;
9405 				uint32_t src_qp;
9406 				uint32_t dest_qp;
9407 				ib_gid_t src_gid;
9408 				ib_gid_t dest_gid;
9409 			} violation;
9410 		} info;
9411 		ib_net64_t sysimg_guid;
9412 	} trap;
9413 } ib_event_rec_t;
9414 /*******/
9415 
9416 /****d* Access Layer/ib_atomic_t
9417 * NAME
9418 *	ib_atomic_t
9419 *
9420 * DESCRIPTION
9421 *	Indicates atomicity levels supported by an adapter.
9422 *
9423 * SYNOPSIS
9424 */
9425 typedef enum _ib_atomic_t {
9426 	IB_ATOMIC_NONE,
9427 	IB_ATOMIC_LOCAL,
9428 	IB_ATOMIC_GLOBAL
9429 } ib_atomic_t;
9430 /*
9431 * VALUES
9432 *	IB_ATOMIC_NONE
9433 *		Atomic operations not supported.
9434 *
9435 *	IB_ATOMIC_LOCAL
9436 *		Atomic operations guaranteed between QPs of a single CA.
9437 *
9438 *	IB_ATOMIC_GLOBAL
9439 *		Atomic operations are guaranteed between CA and any other entity
9440 *		in the system.
9441 *****/
9442 
9443 /****s* Access Layer/ib_port_cap_t
9444 * NAME
9445 *	ib_port_cap_t
9446 *
9447 * DESCRIPTION
9448 *	Indicates which management agents are currently available on the specified
9449 *	port.
9450 *
9451 * SYNOPSIS
9452 */
9453 typedef struct _ib_port_cap {
9454 	boolean_t cm;
9455 	boolean_t snmp;
9456 	boolean_t dev_mgmt;
9457 	boolean_t vend;
9458 	boolean_t sm;
9459 	boolean_t sm_disable;
9460 	boolean_t qkey_ctr;
9461 	boolean_t pkey_ctr;
9462 	boolean_t notice;
9463 	boolean_t trap;
9464 	boolean_t apm;
9465 	boolean_t slmap;
9466 	boolean_t pkey_nvram;
9467 	boolean_t mkey_nvram;
9468 	boolean_t sysguid;
9469 	boolean_t dr_notice;
9470 	boolean_t boot_mgmt;
9471 	boolean_t capm_notice;
9472 	boolean_t reinit;
9473 	boolean_t ledinfo;
9474 	boolean_t port_active;
9475 } ib_port_cap_t;
9476 /*****/
9477 
9478 /****d* Access Layer/ib_init_type_t
9479 * NAME
9480 *	ib_init_type_t
9481 *
9482 * DESCRIPTION
9483 *	If supported by the HCA, the type of initialization requested by
9484 *	this port before SM moves it to the active or armed state.  If the
9485 *	SM implements reinitialization, it shall set these bits to indicate
9486 *	the type of initialization performed prior to activating the port.
9487 *	Otherwise, these bits shall be set to 0.
9488 *
9489 * SYNOPSIS
9490 */
9491 typedef uint8_t ib_init_type_t;
9492 #define IB_INIT_TYPE_NO_LOAD			0x01
9493 #define IB_INIT_TYPE_PRESERVE_CONTENT		0x02
9494 #define IB_INIT_TYPE_PRESERVE_PRESENCE		0x04
9495 #define IB_INIT_TYPE_DO_NOT_RESUSCITATE		0x08
9496 /*****/
9497 
9498 /****s* Access Layer/ib_port_attr_mod_t
9499 * NAME
9500 *	ib_port_attr_mod_t
9501 *
9502 * DESCRIPTION
9503 *	Port attributes that may be modified.
9504 *
9505 * SYNOPSIS
9506 */
9507 typedef struct _ib_port_attr_mod {
9508 	ib_port_cap_t cap;
9509 	uint16_t pkey_ctr;
9510 	uint16_t qkey_ctr;
9511 	ib_init_type_t init_type;
9512 	ib_net64_t system_image_guid;
9513 } ib_port_attr_mod_t;
9514 /*
9515 * SEE ALSO
9516 *	ib_port_cap_t
9517 *****/
9518 
9519 /****s* Access Layer/ib_port_attr_t
9520 * NAME
9521 *	ib_port_attr_t
9522 *
9523 * DESCRIPTION
9524 *	Information about a port on a given channel adapter.
9525 *
9526 * SYNOPSIS
9527 */
9528 typedef struct _ib_port_attr {
9529 	ib_net64_t port_guid;
9530 	uint8_t port_num;
9531 	uint8_t mtu;
9532 	uint64_t max_msg_size;
9533 	ib_net16_t lid;
9534 	uint8_t lmc;
9535 	/*
9536 	 * LinkWidthSupported as defined in PortInfo.  Required to calculate
9537 	 * inter-packet delay (a.k.a. static rate).
9538 	 */
9539 	uint8_t link_width_supported;
9540 	uint16_t max_vls;
9541 	ib_net16_t sm_lid;
9542 	uint8_t sm_sl;
9543 	uint8_t link_state;
9544 	ib_init_type_t init_type_reply;	/* Optional */
9545 	/*
9546 	 * subnet_timeout:
9547 	 * The maximum expected subnet propagation delay to reach any port on
9548 	 * the subnet.  This value also determines the rate at which traps can
9549 	 * be generated from this node.
9550 	 *
9551 	 * timeout = 4.096 microseconds * 2^subnet_timeout
9552 	 */
9553 	uint8_t subnet_timeout;
9554 	ib_port_cap_t cap;
9555 	uint16_t pkey_ctr;
9556 	uint16_t qkey_ctr;
9557 	uint16_t num_gids;
9558 	uint16_t num_pkeys;
9559 	/*
9560 	 * Pointers at the end of the structure to allow doing a simple
9561 	 * memory comparison of contents up to the first pointer.
9562 	 */
9563 	ib_gid_t *p_gid_table;
9564 	ib_net16_t *p_pkey_table;
9565 } ib_port_attr_t;
9566 /*
9567 * SEE ALSO
9568 *	uint8_t, ib_port_cap_t, ib_link_states_t
9569 *****/
9570 
9571 /****s* Access Layer/ib_ca_attr_t
9572 * NAME
9573 *	ib_ca_attr_t
9574 *
9575 * DESCRIPTION
9576 *	Information about a channel adapter.
9577 *
9578 * SYNOPSIS
9579 */
9580 typedef struct _ib_ca_attr {
9581 	ib_net64_t ca_guid;
9582 	uint32_t vend_id;
9583 	uint16_t dev_id;
9584 	uint16_t revision;
9585 	uint64_t fw_ver;
9586 	/*
9587 	 * Total size of the ca attributes in bytes
9588 	 */
9589 	uint32_t size;
9590 	uint32_t max_qps;
9591 	uint32_t max_wrs;
9592 	uint32_t max_sges;
9593 	uint32_t max_rd_sges;
9594 	uint32_t max_cqs;
9595 	uint32_t max_cqes;
9596 	uint32_t max_pds;
9597 	uint32_t init_regions;
9598 	uint64_t init_region_size;
9599 	uint32_t init_windows;
9600 	uint32_t max_addr_handles;
9601 	uint32_t max_partitions;
9602 	ib_atomic_t atomicity;
9603 	uint8_t max_qp_resp_res;
9604 	uint8_t max_eec_resp_res;
9605 	uint8_t max_resp_res;
9606 	uint8_t max_qp_init_depth;
9607 	uint8_t max_eec_init_depth;
9608 	uint32_t max_eecs;
9609 	uint32_t max_rdds;
9610 	uint32_t max_ipv6_qps;
9611 	uint32_t max_ether_qps;
9612 	uint32_t max_mcast_grps;
9613 	uint32_t max_mcast_qps;
9614 	uint32_t max_qps_per_mcast_grp;
9615 	uint32_t max_fmr;
9616 	uint32_t max_map_per_fmr;
9617 	/*
9618 	 * local_ack_delay:
9619 	 * Specifies the maximum time interval between the local CA receiving
9620 	 * a message and the transmission of the associated ACK or NAK.
9621 	 *
9622 	 * timeout = 4.096 microseconds * 2^local_ack_delay
9623 	 */
9624 	uint8_t local_ack_delay;
9625 	boolean_t bad_pkey_ctr_support;
9626 	boolean_t bad_qkey_ctr_support;
9627 	boolean_t raw_mcast_support;
9628 	boolean_t apm_support;
9629 	boolean_t av_port_check;
9630 	boolean_t change_primary_port;
9631 	boolean_t modify_wr_depth;
9632 	boolean_t current_qp_state_support;
9633 	boolean_t shutdown_port_capability;
9634 	boolean_t init_type_support;
9635 	boolean_t port_active_event_support;
9636 	boolean_t system_image_guid_support;
9637 	boolean_t hw_agents;
9638 	ib_net64_t system_image_guid;
9639 	uint32_t num_page_sizes;
9640 	uint8_t num_ports;
9641 	uint32_t *p_page_size;
9642 	ib_port_attr_t *p_port_attr;
9643 } ib_ca_attr_t;
9644 /*
9645 * FIELDS
9646 *	ca_guid
9647 *		GUID for this adapter.
9648 *
9649 *	vend_id
9650 *		IEEE vendor ID for this adapter
9651 *
9652 *	dev_id
9653 *		Device ID of this adapter. (typically from PCI device ID)
9654 *
9655 *	revision
9656 *		Revision ID of this adapter
9657 *
9658 *	fw_ver
9659 *		Device Firmware version.
9660 *
9661 *	size
9662 *		Total size in bytes for the HCA attributes.  This size includes total
9663 *		size required for all the variable members of the structure.  If a
9664 *		vendor requires to pass vendor specific fields beyond this structure,
9665 *		the HCA vendor can choose to report a larger size.  If a vendor is
9666 *		reporting extended vendor specific features, they should also provide
9667 *		appropriate access functions to aid with the required interpretation.
9668 *
9669 *	max_qps
9670 *		Maximum number of QP's supported by this HCA.
9671 *
9672 *	max_wrs
9673 *		Maximum number of work requests supported by this HCA.
9674 *
9675 *	max_sges
9676 *		Maximum number of scatter gather elements supported per work request.
9677 *
9678 *	max_rd_sges
9679 *		Maximum number of scatter gather elements supported for READ work
9680 *		requests for a Reliable Datagram QP.  This value must be zero if RD
9681 *		service is not supported.
9682 *
9683 *	max_cqs
9684 *		Maximum number of Completion Queues supported.
9685 *
9686 *	max_cqes
9687 *		Maximum number of CQ elements supported per CQ.
9688 *
9689 *	max_pds
9690 *		Maximum number of protection domains supported.
9691 *
9692 *	init_regions
9693 *		Initial number of memory regions supported.  These are only informative
9694 *		values.  HCA vendors can extended and grow these limits on demand.
9695 *
9696 *	init_region_size
9697 *		Initial limit on the size of the registered memory region.
9698 *
9699 *	init_windows
9700 *		Initial number of window entries supported.
9701 *
9702 *	max_addr_handles
9703 *		Maximum number of address handles supported.
9704 *
9705 *	max_partitions
9706 *		Maximum number of partitions supported.
9707 *
9708 *	atomicity
9709 *		Indicates level of atomic operations supported by this HCA.
9710 *
9711 *	max_qp_resp_res
9712 *	max_eec_resp_res
9713 *		Maximum limit on number of responder resources for incoming RDMA
9714 *		operations, on QPs and EEC's respectively.
9715 *
9716 *	max_resp_res
9717 *		Maximum number of responder resources per HCA, with this HCA used as
9718 *		the target.
9719 *
9720 *	max_qp_init_depth
9721 *	max_eec_init_depth
9722 *		Maximimum initiator depth per QP or EEC for initiating RDMA reads and
9723 *		atomic operations.
9724 *
9725 *	max_eecs
9726 *		Maximimum number of EEC's supported by the HCA.
9727 *
9728 *	max_rdds
9729 *		Maximum number of Reliable datagram domains supported.
9730 *
9731 *	max_ipv6_qps
9732 *	max_ether_qps
9733 *		Maximum number of IPV6 and raw ether QP's supported by this HCA.
9734 *
9735 *	max_mcast_grps
9736 *		Maximum number of multicast groups supported.
9737 *
9738 *	max_mcast_qps
9739 *		Maximum number of QP's that can support multicast operations.
9740 *
9741 *	max_qps_per_mcast_grp
9742 *		Maximum number of multicast QP's per multicast group.
9743 *
9744 *	local_ack_delay
9745 *		Specifies the maximum time interval between the local CA receiving
9746 *		a message and the transmission of the associated ACK or NAK.
9747 *		timeout = 4.096 microseconds * 2^local_ack_delay
9748 *
9749 *	bad_pkey_ctr_support
9750 *	bad_qkey_ctr_support
9751 *		Indicates support for the bad pkey and qkey counters.
9752 *
9753 *	raw_mcast_support
9754 *		Indicates support for raw packet multicast.
9755 *
9756 *	apm_support
9757 *		Indicates support for Automatic Path Migration.
9758 *
9759 *	av_port_check
9760 *		Indicates ability to check port number in address handles.
9761 *
9762 *	change_primary_port
9763 *		Indicates ability to change primary port for a QP or EEC during a
9764 *		SQD->RTS transition.
9765 *
9766 *	modify_wr_depth
9767 *		Indicates ability to modify QP depth during a modify QP operation.
9768 *		Check the verb specification for permitted states.
9769 *
9770 *	current_qp_state_support
9771 *		Indicates ability of the HCA to support the current QP state modifier
9772 *		during a modify QP operation.
9773 *
9774 *	shutdown_port_capability
9775 *		Shutdown port capability support indicator.
9776 *
9777 *	init_type_support
9778 *		Indicates init_type_reply and ability to set init_type is supported.
9779 *
9780 *	port_active_event_support
9781 *		Port active event support indicator.
9782 *
9783 *	system_image_guid_support
9784 *		System image GUID support indicator.
9785 *
9786 *	hw_agents
9787 *		Indicates SMA is implemented in HW.
9788 *
9789 *	system_image_guid
9790 *		Optional system image GUID.  This field is valid only if the
9791 *		system_image_guid_support flag is set.
9792 *
9793 *	num_page_sizes
9794 *		Indicates support for different page sizes supported by the HCA.
9795 *		The variable size array can be obtained from p_page_size.
9796 *
9797 *	num_ports
9798 *		Number of physical ports supported on this HCA.
9799 *
9800 *	p_page_size
9801 *		Array holding different page size supported.
9802 *
9803 *	p_port_attr
9804 *		Array holding port attributes.
9805 *
9806 * NOTES
9807 *	This structure contains the attributes of a channel adapter.  Users must
9808 *	call ib_copy_ca_attr to copy the contents of this structure to a new
9809 *	memory region.
9810 *
9811 * SEE ALSO
9812 *	ib_port_attr_t, ib_atomic_t, ib_copy_ca_attr
9813 *****/
9814 
9815 /****f* Access layer/ib_copy_ca_attr
9816 * NAME
9817 *	ib_copy_ca_attr
9818 *
9819 * DESCRIPTION
9820 *	Copies CA attributes.
9821 *
9822 * SYNOPSIS
9823 */
9824 ib_ca_attr_t *ib_copy_ca_attr(IN ib_ca_attr_t * const p_dest,
9825 			      IN const ib_ca_attr_t * const p_src);
9826 /*
9827 * PARAMETERS
9828 *	p_dest
9829 *		Pointer to the buffer that is the destination of the copy.
9830 *
9831 *	p_src
9832 *		Pointer to the CA attributes to copy.
9833 *
9834 * RETURN VALUE
9835 *	Pointer to the copied CA attributes.
9836 *
9837 * NOTES
9838 *	The buffer pointed to by the p_dest parameter must be at least the size
9839 *	specified in the size field of the buffer pointed to by p_src.
9840 *
9841 * SEE ALSO
9842 *	ib_ca_attr_t, ib_dup_ca_attr, ib_free_ca_attr
9843 *****/
9844 
9845 /****s* Access Layer/ib_av_attr_t
9846 * NAME
9847 *	ib_av_attr_t
9848 *
9849 * DESCRIPTION
9850 *	IBA address vector.
9851 *
9852 * SYNOPSIS
9853 */
9854 typedef struct _ib_av_attr {
9855 	uint8_t port_num;
9856 	uint8_t sl;
9857 	ib_net16_t dlid;
9858 	boolean_t grh_valid;
9859 	ib_grh_t grh;
9860 	uint8_t static_rate;
9861 	uint8_t path_bits;
9862 	struct _av_conn {
9863 		uint8_t path_mtu;
9864 		uint8_t local_ack_timeout;
9865 		uint8_t seq_err_retry_cnt;
9866 		uint8_t rnr_retry_cnt;
9867 	} conn;
9868 } ib_av_attr_t;
9869 /*
9870 * SEE ALSO
9871 *	ib_gid_t
9872 *****/
9873 
9874 /****d* Access Layer/ib_qp_type_t
9875 * NAME
9876 *	ib_qp_type_t
9877 *
9878 * DESCRIPTION
9879 *	Indicates the type of queue pair being created.
9880 *
9881 * SYNOPSIS
9882 */
9883 typedef enum _ib_qp_type {
9884 	IB_QPT_RELIABLE_CONN = 0,	/* Matches CM REQ transport type */
9885 	IB_QPT_UNRELIABLE_CONN = 1,	/* Matches CM REQ transport type */
9886 	IB_QPT_RELIABLE_DGRM = 2,	/* Matches CM REQ transport type */
9887 	IB_QPT_UNRELIABLE_DGRM,
9888 	IB_QPT_QP0,
9889 	IB_QPT_QP1,
9890 	IB_QPT_RAW_IPV6,
9891 	IB_QPT_RAW_ETHER,
9892 	IB_QPT_MAD,		/* InfiniBand Access Layer */
9893 	IB_QPT_QP0_ALIAS,	/* InfiniBand Access Layer */
9894 	IB_QPT_QP1_ALIAS	/* InfiniBand Access Layer */
9895 } ib_qp_type_t;
9896 /*
9897 * VALUES
9898 *	IB_QPT_RELIABLE_CONN
9899 *		Reliable, connected queue pair.
9900 *
9901 *	IB_QPT_UNRELIABLE_CONN
9902 *		Unreliable, connected queue pair.
9903 *
9904 *	IB_QPT_RELIABLE_DGRM
9905 *		Reliable, datagram queue pair.
9906 *
9907 *	IB_QPT_UNRELIABLE_DGRM
9908 *		Unreliable, datagram queue pair.
9909 *
9910 *	IB_QPT_QP0
9911 *		Queue pair 0.
9912 *
9913 *	IB_QPT_QP1
9914 *		Queue pair 1.
9915 *
9916 *	IB_QPT_RAW_DGRM
9917 *		Raw datagram queue pair.
9918 *
9919 *	IB_QPT_RAW_IPV6
9920 *		Raw IP version 6 queue pair.
9921 *
9922 *	IB_QPT_RAW_ETHER
9923 *		Raw Ethernet queue pair.
9924 *
9925 *	IB_QPT_MAD
9926 *		Unreliable, datagram queue pair that will send and receive management
9927 *		datagrams with assistance from the access layer.
9928 *
9929 *	IB_QPT_QP0_ALIAS
9930 *		Alias to queue pair 0.  Aliased QPs can only be created on an aliased
9931 *		protection domain.
9932 *
9933 *	IB_QPT_QP1_ALIAS
9934 *		Alias to queue pair 1.  Aliased QPs can only be created on an aliased
9935 *		protection domain.
9936 *****/
9937 
9938 /****d* Access Layer/ib_access_t
9939 * NAME
9940 *	ib_access_t
9941 *
9942 * DESCRIPTION
9943 *	Indicates the type of access is permitted on resources such as QPs,
9944 *	memory regions and memory windows.
9945 *
9946 * SYNOPSIS
9947 */
9948 typedef uint32_t ib_access_t;
9949 #define IB_AC_RDMA_READ				0x00000001
9950 #define IB_AC_RDMA_WRITE			0x00000002
9951 #define IB_AC_ATOMIC				0x00000004
9952 #define IB_AC_LOCAL_WRITE			0x00000008
9953 #define IB_AC_MW_BIND				0x00000010
9954 /*
9955 * NOTES
9956 *	Users may combine access rights using a bit-wise or operation to specify
9957 *	additional access.  For example: IB_AC_RDMA_READ | IB_AC_RDMA_WRITE grants
9958 *	RDMA read and write access.
9959 *****/
9960 
9961 /****d* Access Layer/ib_qp_state_t
9962 * NAME
9963 *	ib_qp_state_t
9964 *
9965 * DESCRIPTION
9966 *	Indicates or sets the state of a queue pair.  The current state of a queue
9967 *	pair is returned through the ib_qp_query call and set via the
9968 *	ib_qp_modify call.
9969 *
9970 * SYNOPSIS
9971 */
9972 typedef uint32_t ib_qp_state_t;
9973 #define IB_QPS_RESET				0x00000001
9974 #define IB_QPS_INIT				0x00000002
9975 #define IB_QPS_RTR				0x00000004
9976 #define IB_QPS_RTS				0x00000008
9977 #define IB_QPS_SQD				0x00000010
9978 #define IB_QPS_SQD_DRAINING			0x00000030
9979 #define IB_QPS_SQD_DRAINED			0x00000050
9980 #define IB_QPS_SQERR				0x00000080
9981 #define IB_QPS_ERROR				0x00000100
9982 #define IB_QPS_TIME_WAIT			0xDEAD0000	/* InfiniBand Access Layer */
9983 /*****/
9984 
9985 /****d* Access Layer/ib_apm_state_t
9986 * NAME
9987 *	ib_apm_state_t
9988 *
9989 * DESCRIPTION
9990 *	The current automatic path migration state of a queue pair
9991 *
9992 * SYNOPSIS
9993 */
9994 typedef enum _ib_apm_state {
9995 	IB_APM_MIGRATED = 1,
9996 	IB_APM_REARM,
9997 	IB_APM_ARMED
9998 } ib_apm_state_t;
9999 /*****/
10000 
10001 /****s* Access Layer/ib_qp_create_t
10002 * NAME
10003 *	ib_qp_create_t
10004 *
10005 * DESCRIPTION
10006 *	Attributes used to initialize a queue pair at creation time.
10007 *
10008 * SYNOPSIS
10009 */
10010 typedef struct _ib_qp_create {
10011 	ib_qp_type_t qp_type;
10012 	ib_rdd_handle_t h_rdd;
10013 	uint32_t sq_depth;
10014 	uint32_t rq_depth;
10015 	uint32_t sq_sge;
10016 	uint32_t rq_sge;
10017 	ib_cq_handle_t h_sq_cq;
10018 	ib_cq_handle_t h_rq_cq;
10019 	boolean_t sq_signaled;
10020 } ib_qp_create_t;
10021 /*
10022 * FIELDS
10023 *	type
10024 *		Specifies the type of queue pair to create.
10025 *
10026 *	h_rdd
10027 *		A handle to a reliable datagram domain to associate with the queue
10028 *		pair.  This field is ignored if the queue pair is not a reliable
10029 *		datagram type queue pair.
10030 *
10031 *	sq_depth
10032 *		Indicates the requested maximum number of work requests that may be
10033 *		outstanding on the queue pair's send queue.  This value must be less
10034 *		than or equal to the maximum reported by the channel adapter associated
10035 *		with the queue pair.
10036 *
10037 *	rq_depth
10038 *		Indicates the requested maximum number of work requests that may be
10039 *		outstanding on the queue pair's receive queue.  This value must be less
10040 *		than or equal to the maximum reported by the channel adapter associated
10041 *		with the queue pair.
10042 *
10043 *	sq_sge
10044 *		Indicates the maximum number scatter-gather elements that may be
10045 *		given in a send work request.  This value must be less
10046 *		than or equal to the maximum reported by the channel adapter associated
10047 *		with the queue pair.
10048 *
10049 *	rq_sge
10050 *		Indicates the maximum number scatter-gather elements that may be
10051 *		given in a receive work request.  This value must be less
10052 *		than or equal to the maximum reported by the channel adapter associated
10053 *		with the queue pair.
10054 *
10055 *	h_sq_cq
10056 *		A handle to the completion queue that will be used to report send work
10057 *		request completions.  This handle must be NULL if the type is
10058 *		IB_QPT_MAD, IB_QPT_QP0_ALIAS, or IB_QPT_QP1_ALIAS.
10059 *
10060 *	h_rq_cq
10061 *		A handle to the completion queue that will be used to report receive
10062 *		work request completions.  This handle must be NULL if the type is
10063 *		IB_QPT_MAD, IB_QPT_QP0_ALIAS, or IB_QPT_QP1_ALIAS.
10064 *
10065 *	sq_signaled
10066 *		A flag that is used to indicate whether the queue pair will signal
10067 *		an event upon completion of a send work request.  If set to
10068 *		TRUE, send work requests will always generate a completion
10069 *		event.  If set to FALSE, a completion event will only be
10070 *		generated if the send_opt field of the send work request has the
10071 *		IB_SEND_OPT_SIGNALED flag set.
10072 *
10073 * SEE ALSO
10074 *	ib_qp_type_t, ib_qp_attr_t
10075 *****/
10076 
10077 /****s* Access Layer/ib_qp_attr_t
10078 * NAME
10079 *	ib_qp_attr_t
10080 *
10081 * DESCRIPTION
10082 *	Queue pair attributes returned through ib_query_qp.
10083 *
10084 * SYNOPSIS
10085 */
10086 typedef struct _ib_qp_attr {
10087 	ib_pd_handle_t h_pd;
10088 	ib_qp_type_t qp_type;
10089 	ib_access_t access_ctrl;
10090 	uint16_t pkey_index;
10091 	uint32_t sq_depth;
10092 	uint32_t rq_depth;
10093 	uint32_t sq_sge;
10094 	uint32_t rq_sge;
10095 	uint8_t init_depth;
10096 	uint8_t resp_res;
10097 	ib_cq_handle_t h_sq_cq;
10098 	ib_cq_handle_t h_rq_cq;
10099 	ib_rdd_handle_t h_rdd;
10100 	boolean_t sq_signaled;
10101 	ib_qp_state_t state;
10102 	ib_net32_t num;
10103 	ib_net32_t dest_num;
10104 	ib_net32_t qkey;
10105 	ib_net32_t sq_psn;
10106 	ib_net32_t rq_psn;
10107 	uint8_t primary_port;
10108 	uint8_t alternate_port;
10109 	ib_av_attr_t primary_av;
10110 	ib_av_attr_t alternate_av;
10111 	ib_apm_state_t apm_state;
10112 } ib_qp_attr_t;
10113 /*
10114 * FIELDS
10115 *	h_pd
10116 *		This is a handle to a protection domain associated with the queue
10117 *		pair, or NULL if the queue pair is type IB_QPT_RELIABLE_DGRM.
10118 *
10119 * NOTES
10120 *	Other fields are defined by the Infiniband specification.
10121 *
10122 * SEE ALSO
10123 *	ib_qp_type_t, ib_access_t, ib_qp_state_t, ib_av_attr_t, ib_apm_state_t
10124 *****/
10125 
10126 /****d* Access Layer/ib_qp_opts_t
10127 * NAME
10128 *	ib_qp_opts_t
10129 *
10130 * DESCRIPTION
10131 *	Optional fields supplied in the modify QP operation.
10132 *
10133 * SYNOPSIS
10134 */
10135 typedef uint32_t ib_qp_opts_t;
10136 #define IB_MOD_QP_ALTERNATE_AV			0x00000001
10137 #define IB_MOD_QP_PKEY				0x00000002
10138 #define IB_MOD_QP_APM_STATE			0x00000004
10139 #define IB_MOD_QP_PRIMARY_AV			0x00000008
10140 #define IB_MOD_QP_RNR_NAK_TIMEOUT		0x00000010
10141 #define IB_MOD_QP_RESP_RES			0x00000020
10142 #define IB_MOD_QP_INIT_DEPTH			0x00000040
10143 #define IB_MOD_QP_PRIMARY_PORT			0x00000080
10144 #define IB_MOD_QP_ACCESS_CTRL			0x00000100
10145 #define IB_MOD_QP_QKEY				0x00000200
10146 #define IB_MOD_QP_SQ_DEPTH			0x00000400
10147 #define IB_MOD_QP_RQ_DEPTH			0x00000800
10148 #define IB_MOD_QP_CURRENT_STATE			0x00001000
10149 #define IB_MOD_QP_RETRY_CNT			0x00002000
10150 #define IB_MOD_QP_LOCAL_ACK_TIMEOUT		0x00004000
10151 #define IB_MOD_QP_RNR_RETRY_CNT			0x00008000
10152 /*
10153 * SEE ALSO
10154 *	ib_qp_mod_t
10155 *****/
10156 
10157 /****s* Access Layer/ib_qp_mod_t
10158 * NAME
10159 *	ib_qp_mod_t
10160 *
10161 * DESCRIPTION
10162 *	Information needed to change the state of a queue pair through the
10163 *	ib_modify_qp call.
10164 *
10165 * SYNOPSIS
10166 */
10167 typedef struct _ib_qp_mod {
10168 	ib_qp_state_t req_state;
10169 	union _qp_state {
10170 		struct _qp_reset {
10171 			/*
10172 			 * Time, in milliseconds, that the QP needs to spend in
10173 			 * the time wait state before being reused.
10174 			 */
10175 			uint32_t timewait;
10176 		} reset;
10177 		struct _qp_init {
10178 			ib_qp_opts_t opts;
10179 			uint8_t primary_port;
10180 			ib_net32_t qkey;
10181 			uint16_t pkey_index;
10182 			ib_access_t access_ctrl;
10183 		} init;
10184 		struct _qp_rtr {
10185 			ib_net32_t rq_psn;
10186 			ib_net32_t dest_qp;
10187 			ib_av_attr_t primary_av;
10188 			uint8_t resp_res;
10189 			ib_qp_opts_t opts;
10190 			ib_av_attr_t alternate_av;
10191 			ib_net32_t qkey;
10192 			uint16_t pkey_index;
10193 			ib_access_t access_ctrl;
10194 			uint32_t sq_depth;
10195 			uint32_t rq_depth;
10196 			uint8_t rnr_nak_timeout;
10197 		} rtr;
10198 		struct _qp_rts {
10199 			ib_net32_t sq_psn;
10200 			uint8_t retry_cnt;
10201 			uint8_t rnr_retry_cnt;
10202 			uint8_t rnr_nak_timeout;
10203 			uint8_t local_ack_timeout;
10204 			uint8_t init_depth;
10205 			ib_qp_opts_t opts;
10206 			ib_qp_state_t current_state;
10207 			ib_net32_t qkey;
10208 			ib_access_t access_ctrl;
10209 			uint8_t resp_res;
10210 			ib_av_attr_t primary_av;
10211 			ib_av_attr_t alternate_av;
10212 			uint32_t sq_depth;
10213 			uint32_t rq_depth;
10214 			ib_apm_state_t apm_state;
10215 			uint8_t primary_port;
10216 			uint16_t pkey_index;
10217 		} rts;
10218 		struct _qp_sqd {
10219 			boolean_t sqd_event;
10220 		} sqd;
10221 	} state;
10222 } ib_qp_mod_t;
10223 /*
10224 * SEE ALSO
10225 *	ib_qp_state_t, ib_access_t, ib_av_attr_t, ib_apm_state_t
10226 *****/
10227 
10228 /****s* Access Layer/ib_eec_attr_t
10229 * NAME
10230 *	ib_eec_attr_t
10231 *
10232 * DESCRIPTION
10233 *	Information about an end-to-end context.
10234 *
10235 * SYNOPSIS
10236 */
10237 typedef struct _ib_eec_attr {
10238 	ib_qp_state_t state;
10239 	ib_rdd_handle_t h_rdd;
10240 	ib_net32_t local_eecn;
10241 	ib_net32_t sq_psn;
10242 	ib_net32_t rq_psn;
10243 	uint8_t primary_port;
10244 	uint16_t pkey_index;
10245 	uint32_t resp_res;
10246 	ib_net32_t remote_eecn;
10247 	uint32_t init_depth;
10248 	uint32_t dest_num;	// ??? What is this?
10249 	ib_av_attr_t primary_av;
10250 	ib_av_attr_t alternate_av;
10251 	ib_apm_state_t apm_state;
10252 } ib_eec_attr_t;
10253 /*
10254 * SEE ALSO
10255 *	ib_qp_state_t, ib_av_attr_t, ib_apm_state_t
10256 *****/
10257 
10258 /****d* Access Layer/ib_eec_opts_t
10259 * NAME
10260 *	ib_eec_opts_t
10261 *
10262 * DESCRIPTION
10263 *	Optional fields supplied in the modify EEC operation.
10264 *
10265 * SYNOPSIS
10266 */
10267 typedef uint32_t ib_eec_opts_t;
10268 #define IB_MOD_EEC_ALTERNATE_AV			0x00000001
10269 #define IB_MOD_EEC_PKEY				0x00000002
10270 #define IB_MOD_EEC_APM_STATE			0x00000004
10271 #define IB_MOD_EEC_PRIMARY_AV			0x00000008
10272 #define IB_MOD_EEC_RNR				0x00000010
10273 #define IB_MOD_EEC_RESP_RES			0x00000020
10274 #define IB_MOD_EEC_OUTSTANDING			0x00000040
10275 #define IB_MOD_EEC_PRIMARY_PORT			0x00000080
10276 /*
10277 * NOTES
10278 *
10279 *
10280 *****/
10281 
10282 /****s* Access Layer/ib_eec_mod_t
10283 * NAME
10284 *	ib_eec_mod_t
10285 *
10286 * DESCRIPTION
10287 *	Information needed to change the state of an end-to-end context through
10288 *	the ib_modify_eec function.
10289 *
10290 * SYNOPSIS
10291 */
10292 typedef struct _ib_eec_mod {
10293 	ib_qp_state_t req_state;
10294 	union _eec_state {
10295 		struct _eec_init {
10296 			uint8_t primary_port;
10297 			uint16_t pkey_index;
10298 		} init;
10299 		struct _eec_rtr {
10300 			ib_net32_t rq_psn;
10301 			ib_net32_t remote_eecn;
10302 			ib_av_attr_t primary_av;
10303 			uint8_t resp_res;
10304 			ib_eec_opts_t opts;
10305 			ib_av_attr_t alternate_av;
10306 			uint16_t pkey_index;
10307 		} rtr;
10308 		struct _eec_rts {
10309 			ib_net32_t sq_psn;
10310 			uint8_t retry_cnt;
10311 			uint8_t rnr_retry_cnt;
10312 			uint8_t local_ack_timeout;
10313 			uint8_t init_depth;
10314 			ib_eec_opts_t opts;
10315 			ib_av_attr_t alternate_av;
10316 			ib_apm_state_t apm_state;
10317 			ib_av_attr_t primary_av;
10318 			uint16_t pkey_index;
10319 			uint8_t primary_port;
10320 		} rts;
10321 		struct _eec_sqd {
10322 			boolean_t sqd_event;
10323 		} sqd;
10324 	} state;
10325 } ib_eec_mod_t;
10326 /*
10327 * SEE ALSO
10328 *	ib_qp_state_t, ib_av_attr_t, ib_apm_state_t
10329 *****/
10330 
10331 /****d* Access Layer/ib_wr_type_t
10332 * NAME
10333 *	ib_wr_type_t
10334 *
10335 * DESCRIPTION
10336 *	Identifies the type of work request posted to a queue pair.
10337 *
10338 * SYNOPSIS
10339 */
10340 typedef enum _ib_wr_type_t {
10341 	WR_SEND = 1,
10342 	WR_RDMA_WRITE,
10343 	WR_RDMA_READ,
10344 	WR_COMPARE_SWAP,
10345 	WR_FETCH_ADD
10346 } ib_wr_type_t;
10347 /*****/
10348 
10349 /****s* Access Layer/ib_local_ds_t
10350 * NAME
10351 *	ib_local_ds_t
10352 *
10353 * DESCRIPTION
10354 *	Local data segment information referenced by send and receive work
10355 *	requests.  This is used to specify local data buffers used as part of a
10356 *	work request.
10357 *
10358 * SYNOPSIS
10359 */
10360 typedef struct _ib_local_ds {
10361 	void *vaddr;
10362 	uint32_t length;
10363 	uint32_t lkey;
10364 } ib_local_ds_t;
10365 /*****/
10366 
10367 /****d* Access Layer/ib_send_opt_t
10368 * NAME
10369 *	ib_send_opt_t
10370 *
10371 * DESCRIPTION
10372 *	Optional flags used when posting send work requests.  These flags
10373 *	indicate specific processing for the send operation.
10374 *
10375 * SYNOPSIS
10376 */
10377 typedef uint32_t ib_send_opt_t;
10378 #define IB_SEND_OPT_IMMEDIATE		0x00000001
10379 #define IB_SEND_OPT_FENCE		0x00000002
10380 #define IB_SEND_OPT_SIGNALED		0x00000004
10381 #define IB_SEND_OPT_SOLICITED		0x00000008
10382 #define IB_SEND_OPT_INLINE		0x00000010
10383 #define IB_SEND_OPT_LOCAL		0x00000020
10384 #define IB_SEND_OPT_VEND_MASK		0xFFFF0000
10385 /*
10386 * VALUES
10387 *	The following flags determine the behavior of a work request when
10388 *	posted to the send side.
10389 *
10390 *	IB_SEND_OPT_IMMEDIATE
10391 *		Send immediate data with the given request.
10392 *
10393 *	IB_SEND_OPT_FENCE
10394 *		The operation is fenced.  Complete all pending send operations
10395 *		before processing this request.
10396 *
10397 *	IB_SEND_OPT_SIGNALED
10398 *		If the queue pair is configured for signaled completion, then
10399 *		generate a completion queue entry when this request completes.
10400 *
10401 *	IB_SEND_OPT_SOLICITED
10402 *		Set the solicited bit on the last packet of this request.
10403 *
10404 *	IB_SEND_OPT_INLINE
10405 *		Indicates that the requested send data should be copied into a VPD
10406 *		owned data buffer.  This flag permits the user to issue send operations
10407 *		without first needing to register the buffer(s) associated with the
10408 *		send operation.  Verb providers that support this operation may place
10409 *		vendor specific restrictions on the size of send operation that may
10410 *		be performed as inline.
10411 *
10412 *
10413 *  IB_SEND_OPT_LOCAL
10414 *     Indicates that a sent MAD request should be given to the local VPD for
10415 *     processing.  MADs sent using this option are not placed on the wire.
10416 *     This send option is only valid for MAD send operations.
10417 *
10418 *
10419 *	IB_SEND_OPT_VEND_MASK
10420 *		This mask indicates bits reserved in the send options that may be used
10421 *		by the verbs provider to indicate vendor specific options.  Bits set
10422 *		in this area of the send options are ignored by the Access Layer, but
10423 *		may have specific meaning to the underlying VPD.
10424 *
10425 *****/
10426 
10427 /****s* Access Layer/ib_send_wr_t
10428 * NAME
10429 *	ib_send_wr_t
10430 *
10431 * DESCRIPTION
10432 *	Information used to submit a work request to the send queue of a queue
10433 *	pair.
10434 *
10435 * SYNOPSIS
10436 */
10437 typedef struct _ib_send_wr {
10438 	struct _ib_send_wr *p_next;
10439 	uint64_t wr_id;
10440 	ib_wr_type_t wr_type;
10441 	ib_send_opt_t send_opt;
10442 	uint32_t num_ds;
10443 	ib_local_ds_t *ds_array;
10444 	ib_net32_t immediate_data;
10445 	union _send_dgrm {
10446 		struct _send_ud {
10447 			ib_net32_t remote_qp;
10448 			ib_net32_t remote_qkey;
10449 			ib_av_handle_t h_av;
10450 		} ud;
10451 		struct _send_rd {
10452 			ib_net32_t remote_qp;
10453 			ib_net32_t remote_qkey;
10454 			ib_net32_t eecn;
10455 		} rd;
10456 		struct _send_raw_ether {
10457 			ib_net16_t dest_lid;
10458 			uint8_t path_bits;
10459 			uint8_t sl;
10460 			uint8_t max_static_rate;
10461 			ib_net16_t ether_type;
10462 		} raw_ether;
10463 		struct _send_raw_ipv6 {
10464 			ib_net16_t dest_lid;
10465 			uint8_t path_bits;
10466 			uint8_t sl;
10467 			uint8_t max_static_rate;
10468 		} raw_ipv6;
10469 	} dgrm;
10470 	struct _send_remote_ops {
10471 		uint64_t vaddr;
10472 		uint32_t rkey;
10473 		ib_net64_t atomic1;
10474 		ib_net64_t atomic2;
10475 	} remote_ops;
10476 } ib_send_wr_t;
10477 /*
10478 * FIELDS
10479 *	p_next
10480 *		A pointer used to chain work requests together.  This permits multiple
10481 *		work requests to be posted to a queue pair through a single function
10482 *		call.  This value is set to NULL to mark the end of the chain.
10483 *
10484 *	wr_id
10485 *		A 64-bit work request identifier that is returned to the consumer
10486 *		as part of the work completion.
10487 *
10488 *	wr_type
10489 *		The type of work request being submitted to the send queue.
10490 *
10491 *	send_opt
10492 *		Optional send control parameters.
10493 *
10494 *	num_ds
10495 *		Number of local data segments specified by this work request.
10496 *
10497 *	ds_array
10498 *		A reference to an array of local data segments used by the send
10499 *		operation.
10500 *
10501 *	immediate_data
10502 *		32-bit field sent as part of a message send or RDMA write operation.
10503 *		This field is only valid if the send_opt flag IB_SEND_OPT_IMMEDIATE
10504 *		has been set.
10505 *
10506 *	dgrm.ud.remote_qp
10507 *		Identifies the destination queue pair of an unreliable datagram send
10508 *		operation.
10509 *
10510 *	dgrm.ud.remote_qkey
10511 *		The qkey for the destination queue pair.
10512 *
10513 *	dgrm.ud.h_av
10514 *		An address vector that specifies the path information used to route
10515 *		the outbound datagram to the destination queue pair.
10516 *
10517 *	dgrm.rd.remote_qp
10518 *		Identifies the destination queue pair of a reliable datagram send
10519 *		operation.
10520 *
10521 *	dgrm.rd.remote_qkey
10522 *		The qkey for the destination queue pair.
10523 *
10524 *	dgrm.rd.eecn
10525 *		The local end-to-end context number to use with the reliable datagram
10526 *		send operation.
10527 *
10528 *	dgrm.raw_ether.dest_lid
10529 *		The destination LID that will receive this raw ether send.
10530 *
10531 *	dgrm.raw_ether.path_bits
10532 *		path bits...
10533 *
10534 *	dgrm.raw_ether.sl
10535 *		service level...
10536 *
10537 *	dgrm.raw_ether.max_static_rate
10538 *		static rate...
10539 *
10540 *	dgrm.raw_ether.ether_type
10541 *		ether type...
10542 *
10543 *	dgrm.raw_ipv6.dest_lid
10544 *		The destination LID that will receive this raw ether send.
10545 *
10546 *	dgrm.raw_ipv6.path_bits
10547 *		path bits...
10548 *
10549 *	dgrm.raw_ipv6.sl
10550 *		service level...
10551 *
10552 *	dgrm.raw_ipv6.max_static_rate
10553 *		static rate...
10554 *
10555 *	remote_ops.vaddr
10556 *		The registered virtual memory address of the remote memory to access
10557 *		with an RDMA or atomic operation.
10558 *
10559 *	remote_ops.rkey
10560 *		The rkey associated with the specified remote vaddr. This data must
10561 *		be presented exactly as obtained from the remote node. No swapping
10562 *		of data must be performed.
10563 *
10564 *	atomic1
10565 *		The first operand for an atomic operation.
10566 *
10567 *	atomic2
10568 *		The second operand for an atomic operation.
10569 *
10570 * NOTES
10571 *	The format of data sent over the fabric is user-defined and is considered
10572 *	opaque to the access layer.  The sole exception to this are MADs posted
10573 *	to a MAD QP service.  MADs are expected to match the format defined by
10574 *	the Infiniband specification and must be in network-byte order when posted
10575 *	to the MAD QP service.
10576 *
10577 * SEE ALSO
10578 *	ib_wr_type_t, ib_local_ds_t, ib_send_opt_t
10579 *****/
10580 
10581 /****s* Access Layer/ib_recv_wr_t
10582 * NAME
10583 *	ib_recv_wr_t
10584 *
10585 * DESCRIPTION
10586 *	Information used to submit a work request to the receive queue of a queue
10587 *	pair.
10588 *
10589 * SYNOPSIS
10590 */
10591 typedef struct _ib_recv_wr {
10592 	struct _ib_recv_wr *p_next;
10593 	uint64_t wr_id;
10594 	uint32_t num_ds;
10595 	ib_local_ds_t *ds_array;
10596 } ib_recv_wr_t;
10597 /*
10598 * FIELDS
10599 *	p_next
10600 *		A pointer used to chain work requests together.  This permits multiple
10601 *		work requests to be posted to a queue pair through a single function
10602 *		call.  This value is set to NULL to mark the end of the chain.
10603 *
10604 *	wr_id
10605 *		A 64-bit work request identifier that is returned to the consumer
10606 *		as part of the work completion.
10607 *
10608 *	num_ds
10609 *		Number of local data segments specified by this work request.
10610 *
10611 *	ds_array
10612 *		A reference to an array of local data segments used by the send
10613 *		operation.
10614 *
10615 * SEE ALSO
10616 *	ib_local_ds_t
10617 *****/
10618 
10619 /****s* Access Layer/ib_bind_wr_t
10620 * NAME
10621 *	ib_bind_wr_t
10622 *
10623 * DESCRIPTION
10624 *	Information used to submit a memory window bind work request to the send
10625 *	queue of a queue pair.
10626 *
10627 * SYNOPSIS
10628 */
10629 typedef struct _ib_bind_wr {
10630 	uint64_t wr_id;
10631 	ib_send_opt_t send_opt;
10632 	ib_mr_handle_t h_mr;
10633 	ib_access_t access_ctrl;
10634 	uint32_t current_rkey;
10635 	ib_local_ds_t local_ds;
10636 } ib_bind_wr_t;
10637 /*
10638 * FIELDS
10639 *	wr_id
10640 *		A 64-bit work request identifier that is returned to the consumer
10641 *		as part of the work completion.
10642 *
10643 *	send_opt
10644 *		Optional send control parameters.
10645 *
10646 *	h_mr
10647 *		Handle to the memory region to which this window is being bound.
10648 *
10649 *	access_ctrl
10650 *		Access rights for this memory window.
10651 *
10652 *	current_rkey
10653 *		The current rkey assigned to this window for remote access.
10654 *
10655 *	local_ds
10656 *		A reference to a local data segment used by the bind operation.
10657 *
10658 * SEE ALSO
10659 *	ib_send_opt_t, ib_access_t, ib_local_ds_t
10660 *****/
10661 
10662 /****d* Access Layer/ib_wc_status_t
10663 * NAME
10664 *	ib_wc_status_t
10665 *
10666 * DESCRIPTION
10667 *	Indicates the status of a completed work request.  These VALUES are
10668 *	returned to the user when retrieving completions.  Note that success is
10669 *	identified as IB_WCS_SUCCESS, which is always zero.
10670 *
10671 * SYNOPSIS
10672 */
10673 typedef enum _ib_wc_status_t {
10674 	IB_WCS_SUCCESS,
10675 	IB_WCS_LOCAL_LEN_ERR,
10676 	IB_WCS_LOCAL_OP_ERR,
10677 	IB_WCS_LOCAL_EEC_OP_ERR,
10678 	IB_WCS_LOCAL_PROTECTION_ERR,
10679 	IB_WCS_WR_FLUSHED_ERR,
10680 	IB_WCS_MEM_WINDOW_BIND_ERR,
10681 	IB_WCS_REM_ACCESS_ERR,
10682 	IB_WCS_REM_OP_ERR,
10683 	IB_WCS_RNR_RETRY_ERR,
10684 	IB_WCS_TIMEOUT_RETRY_ERR,
10685 	IB_WCS_REM_INVALID_REQ_ERR,
10686 	IB_WCS_REM_INVALID_RD_REQ_ERR,
10687 	IB_WCS_INVALID_EECN,
10688 	IB_WCS_INVALID_EEC_STATE,
10689 	IB_WCS_UNMATCHED_RESPONSE,	/* InfiniBand Access Layer */
10690 	IB_WCS_CANCELED,	/* InfiniBand Access Layer */
10691 	IB_WCS_UNKNOWN		/* Must be last. */
10692 } ib_wc_status_t;
10693 /*
10694 * VALUES
10695 *	IB_WCS_SUCCESS
10696 *		Work request completed successfully.
10697 *
10698 *	IB_WCS_MAD
10699 *		The completed work request was associated with a managmenet datagram
10700 *		that requires post processing.  The MAD will be returned to the user
10701 *		through a callback once all post processing has completed.
10702 *
10703 *	IB_WCS_LOCAL_LEN_ERR
10704 *		Generated for a work request posted to the send queue when the
10705 *		total of the data segment lengths exceeds the message length of the
10706 *		channel.  Generated for a work request posted to the receive queue when
10707 *		the total of the data segment lengths is too small for a
10708 *		valid incoming message.
10709 *
10710 *	IB_WCS_LOCAL_OP_ERR
10711 *		An internal QP consistency error was generated while processing this
10712 *		work request.  This may indicate that the QP was in an incorrect state
10713 *		for the requested operation.
10714 *
10715 *	IB_WCS_LOCAL_EEC_OP_ERR
10716 *		An internal EEC consistency error was generated while processing
10717 *		this work request.  This may indicate that the EEC was in an incorrect
10718 *		state for the requested operation.
10719 *
10720 *	IB_WCS_LOCAL_PROTECTION_ERR
10721 *		The data segments of the locally posted work request did not refer to
10722 *		a valid memory region.  The memory may not have been properly
10723 *		registered for the requested operation.
10724 *
10725 *	IB_WCS_WR_FLUSHED_ERR
10726 *		The work request was flushed from the QP before being completed.
10727 *
10728 *	IB_WCS_MEM_WINDOW_BIND_ERR
10729 *		A memory window bind operation failed due to insufficient access
10730 *		rights.
10731 *
10732 *	IB_WCS_REM_ACCESS_ERR,
10733 *		A protection error was detected at the remote node for a RDMA or atomic
10734 *		operation.
10735 *
10736 *	IB_WCS_REM_OP_ERR,
10737 *		The operation could not be successfully completed at the remote node.
10738 *		This may indicate that the remote QP was in an invalid state or
10739 *		contained an invalid work request.
10740 *
10741 *	IB_WCS_RNR_RETRY_ERR,
10742 *		The RNR retry count was exceeded while trying to send this message.
10743 *
10744 *	IB_WCS_TIMEOUT_RETRY_ERR
10745 *		The local transport timeout counter expired while trying to send this
10746 *		message.
10747 *
10748 *	IB_WCS_REM_INVALID_REQ_ERR,
10749 *		The remote node detected an invalid message on the channel.  This error
10750 *		is usually a result of one of the following:
10751 *			- The operation was not supported on receive queue.
10752 *			- There was insufficient buffers to receive a new RDMA request.
10753 *			- There was insufficient buffers to receive a new atomic operation.
10754 *			- An RDMA request was larger than 2^31 bytes.
10755 *
10756 *	IB_WCS_REM_INVALID_RD_REQ_ERR,
10757 *		Responder detected an invalid RD message.  This may be the result of an
10758 *		invalid qkey or an RDD mismatch.
10759 *
10760 *	IB_WCS_INVALID_EECN
10761 *		An invalid EE context number was detected.
10762 *
10763 *	IB_WCS_INVALID_EEC_STATE
10764 *		The EEC was in an invalid state for the specified request.
10765 *
10766 *	IB_WCS_UNMATCHED_RESPONSE
10767 *		A response MAD was received for which there was no matching send.  The
10768 *		send operation may have been canceled by the user or may have timed
10769 *		out.
10770 *
10771 *	IB_WCS_CANCELED
10772 *		The completed work request was canceled by the user.
10773 *****/
10774 
10775 OSM_EXPORT const char *ib_wc_status_str[];
10776 
10777 /****f* IBA Base: Types/ib_get_wc_status_str
10778 * NAME
10779 *	ib_get_wc_status_str
10780 *
10781 * DESCRIPTION
10782 *	Returns a string for the specified work completion status.
10783 *
10784 * SYNOPSIS
10785 */
10786 static inline const char *OSM_API
ib_get_wc_status_str(IN ib_wc_status_t wc_status)10787 ib_get_wc_status_str(IN ib_wc_status_t wc_status)
10788 {
10789 	if (wc_status > IB_WCS_UNKNOWN)
10790 		wc_status = IB_WCS_UNKNOWN;
10791 	return (ib_wc_status_str[wc_status]);
10792 }
10793 
10794 /*
10795 * PARAMETERS
10796 *	wc_status
10797 *		[in] work completion status value
10798 *
10799 * RETURN VALUES
10800 *	Pointer to the work completion status description string.
10801 *
10802 * NOTES
10803 *
10804 * SEE ALSO
10805 *********/
10806 
10807 /****d* Access Layer/ib_wc_type_t
10808 * NAME
10809 *	ib_wc_type_t
10810 *
10811 * DESCRIPTION
10812 *	Indicates the type of work completion.
10813 *
10814 * SYNOPSIS
10815 */
10816 typedef enum _ib_wc_type_t {
10817 	IB_WC_SEND,
10818 	IB_WC_RDMA_WRITE,
10819 	IB_WC_RECV,
10820 	IB_WC_RDMA_READ,
10821 	IB_WC_MW_BIND,
10822 	IB_WC_FETCH_ADD,
10823 	IB_WC_COMPARE_SWAP,
10824 	IB_WC_RECV_RDMA_WRITE
10825 } ib_wc_type_t;
10826 /*****/
10827 
10828 /****d* Access Layer/ib_recv_opt_t
10829 * NAME
10830 *	ib_recv_opt_t
10831 *
10832 * DESCRIPTION
10833 *	Indicates optional fields valid in a receive work completion.
10834 *
10835 * SYNOPSIS
10836 */
10837 typedef uint32_t ib_recv_opt_t;
10838 #define	IB_RECV_OPT_IMMEDIATE		0x00000001
10839 #define IB_RECV_OPT_FORWARD		0x00000002
10840 #define IB_RECV_OPT_GRH_VALID		0x00000004
10841 #define IB_RECV_OPT_VEND_MASK		0xFFFF0000
10842 /*
10843 * VALUES
10844 *	IB_RECV_OPT_IMMEDIATE
10845 *		Indicates that immediate data is valid for this work completion.
10846 *
10847 *	IB_RECV_OPT_FORWARD
10848 *		Indicates that the received trap should be forwarded to the SM.
10849 *
10850 *	IB_RECV_OPT_GRH_VALID
10851 *		Indicates presence of the global route header. When set, the
10852 *		first 40 bytes received are the GRH.
10853 *
10854 *	IB_RECV_OPT_VEND_MASK
10855 *		This mask indicates bits reserved in the receive options that may be
10856 *		used by the verbs provider to indicate vendor specific options.  Bits
10857 *		set in this area of the receive options are ignored by the Access Layer,
10858 *		but may have specific meaning to the underlying VPD.
10859 *****/
10860 
10861 /****s* Access Layer/ib_wc_t
10862 * NAME
10863 *	ib_wc_t
10864 *
10865 * DESCRIPTION
10866 *	Work completion information.
10867 *
10868 * SYNOPSIS
10869 */
10870 typedef struct _ib_wc {
10871 	struct _ib_wc *p_next;
10872 	uint64_t wr_id;
10873 	ib_wc_type_t wc_type;
10874 	uint32_t length;
10875 	ib_wc_status_t status;
10876 	uint64_t vendor_specific;
10877 	union _wc_recv {
10878 		struct _wc_conn {
10879 			ib_recv_opt_t recv_opt;
10880 			ib_net32_t immediate_data;
10881 		} conn;
10882 		struct _wc_ud {
10883 			ib_recv_opt_t recv_opt;
10884 			ib_net32_t immediate_data;
10885 			ib_net32_t remote_qp;
10886 			uint16_t pkey_index;
10887 			ib_net16_t remote_lid;
10888 			uint8_t remote_sl;
10889 			uint8_t path_bits;
10890 		} ud;
10891 		struct _wc_rd {
10892 			ib_net32_t remote_eecn;
10893 			ib_net32_t remote_qp;
10894 			ib_net16_t remote_lid;
10895 			uint8_t remote_sl;
10896 			uint32_t free_cnt;
10897 
10898 		} rd;
10899 		struct _wc_raw_ipv6 {
10900 			ib_net16_t remote_lid;
10901 			uint8_t remote_sl;
10902 			uint8_t path_bits;
10903 		} raw_ipv6;
10904 		struct _wc_raw_ether {
10905 			ib_net16_t remote_lid;
10906 			uint8_t remote_sl;
10907 			uint8_t path_bits;
10908 			ib_net16_t ether_type;
10909 		} raw_ether;
10910 	} recv;
10911 } ib_wc_t;
10912 /*
10913 * FIELDS
10914 *	p_next
10915 *		A pointer used to chain work completions.  This permits multiple
10916 *		work completions to be retrieved from a completion queue through a
10917 *		single function call.  This value is set to NULL to mark the end of
10918 *		the chain.
10919 *
10920 *	wr_id
10921 *		The 64-bit work request identifier that was specified when posting the
10922 *		work request.
10923 *
10924 *	wc_type
10925 *		Indicates the type of work completion.
10926 *
10927 *
10928 *	length
10929 *		The total length of the data sent or received with the work request.
10930 *
10931 *	status
10932 *		The result of the work request.
10933 *
10934 *	vendor_specific
10935 *		HCA vendor specific information returned as part of the completion.
10936 *
10937 *	recv.conn.recv_opt
10938 *		Indicates optional fields valid as part of a work request that
10939 *		completed on a connected (reliable or unreliable) queue pair.
10940 *
10941 *	recv.conn.immediate_data
10942 *		32-bit field received as part of an inbound message on a connected
10943 *		queue pair.  This field is only valid if the recv_opt flag
10944 *		IB_RECV_OPT_IMMEDIATE has been set.
10945 *
10946 *	recv.ud.recv_opt
10947 *		Indicates optional fields valid as part of a work request that
10948 *		completed on an unreliable datagram queue pair.
10949 *
10950 *	recv.ud.immediate_data
10951 *		32-bit field received as part of an inbound message on a unreliable
10952 *		datagram queue pair.  This field is only valid if the recv_opt flag
10953 *		IB_RECV_OPT_IMMEDIATE has been set.
10954 *
10955 *	recv.ud.remote_qp
10956 *		Identifies the source queue pair of a received datagram.
10957 *
10958 *	recv.ud.pkey_index
10959 *		The pkey index for the source queue pair. This is valid only for
10960 *		GSI type QP's.
10961 *
10962 *	recv.ud.remote_lid
10963 *		The source LID of the received datagram.
10964 *
10965 *	recv.ud.remote_sl
10966 *		The service level used by the source of the received datagram.
10967 *
10968 *	recv.ud.path_bits
10969 *		path bits...
10970 *
10971 *	recv.rd.remote_eecn
10972 *		The remote end-to-end context number that sent the received message.
10973 *
10974 *	recv.rd.remote_qp
10975 *		Identifies the source queue pair of a received message.
10976 *
10977 *	recv.rd.remote_lid
10978 *		The source LID of the received message.
10979 *
10980 *	recv.rd.remote_sl
10981 *		The service level used by the source of the received message.
10982 *
10983 *	recv.rd.free_cnt
10984 *		The number of available entries in the completion queue.  Reliable
10985 *		datagrams may complete out of order, so this field may be used to
10986 *		determine the number of additional completions that may occur.
10987 *
10988 *	recv.raw_ipv6.remote_lid
10989 *		The source LID of the received message.
10990 *
10991 *	recv.raw_ipv6.remote_sl
10992 *		The service level used by the source of the received message.
10993 *
10994 *	recv.raw_ipv6.path_bits
10995 *		path bits...
10996 *
10997 *	recv.raw_ether.remote_lid
10998 *		The source LID of the received message.
10999 *
11000 *	recv.raw_ether.remote_sl
11001 *		The service level used by the source of the received message.
11002 *
11003 *	recv.raw_ether.path_bits
11004 *		path bits...
11005 *
11006 *	recv.raw_ether.ether_type
11007 *		ether type...
11008 * NOTES
11009 *	When the work request completes with error, the only values that the
11010 *	consumer can depend on are the wr_id field, and the status of the
11011 *	operation.
11012 *
11013 *	If the consumer is using the same CQ for completions from more than
11014 *	one type of QP (i.e Reliable Connected, Datagram etc), then the consumer
11015 *	must have additional information to decide what fields of the union are
11016 *	valid.
11017 * SEE ALSO
11018 *	ib_wc_type_t, ib_qp_type_t, ib_wc_status_t, ib_recv_opt_t
11019 *****/
11020 
11021 /****s* Access Layer/ib_mr_create_t
11022 * NAME
11023 *	ib_mr_create_t
11024 *
11025 * DESCRIPTION
11026 *	Information required to create a registered memory region.
11027 *
11028 * SYNOPSIS
11029 */
11030 typedef struct _ib_mr_create {
11031 	void *vaddr;
11032 	uint64_t length;
11033 	ib_access_t access_ctrl;
11034 } ib_mr_create_t;
11035 /*
11036 * FIELDS
11037 *	vaddr
11038 *		Starting virtual address of the region being registered.
11039 *
11040 *	length
11041 *		Length of the buffer to register.
11042 *
11043 *	access_ctrl
11044 *		Access rights of the registered region.
11045 *
11046 * SEE ALSO
11047 *	ib_access_t
11048 *****/
11049 
11050 /****s* Access Layer/ib_phys_create_t
11051 * NAME
11052 *	ib_phys_create_t
11053 *
11054 * DESCRIPTION
11055 *	Information required to create a physical memory region.
11056 *
11057 * SYNOPSIS
11058 */
11059 typedef struct _ib_phys_create {
11060 	uint64_t length;
11061 	uint32_t num_bufs;
11062 	uint64_t *buf_array;
11063 	uint32_t buf_offset;
11064 	uint32_t page_size;
11065 	ib_access_t access_ctrl;
11066 } ib_phys_create_t;
11067 /*
11068 *	length
11069 *		The length of the memory region in bytes.
11070 *
11071 *	num_bufs
11072 *		Number of buffers listed in the specified buffer array.
11073 *
11074 *	buf_array
11075 *		An array of physical buffers to be registered as a single memory
11076 *		region.
11077 *
11078 *	buf_offset
11079 *		The offset into the first physical page of the specified memory
11080 *		region to start the virtual address.
11081 *
11082 *	page_size
11083 *		The physical page size of the memory being registered.
11084 *
11085 *	access_ctrl
11086 *		Access rights of the registered region.
11087 *
11088 * SEE ALSO
11089 *	ib_access_t
11090 *****/
11091 
11092 /****s* Access Layer/ib_mr_attr_t
11093 * NAME
11094 *	ib_mr_attr_t
11095 *
11096 * DESCRIPTION
11097 *	Attributes of a registered memory region.
11098 *
11099 * SYNOPSIS
11100 */
11101 typedef struct _ib_mr_attr {
11102 	ib_pd_handle_t h_pd;
11103 	void *local_lb;
11104 	void *local_ub;
11105 	void *remote_lb;
11106 	void *remote_ub;
11107 	ib_access_t access_ctrl;
11108 	uint32_t lkey;
11109 	uint32_t rkey;
11110 } ib_mr_attr_t;
11111 /*
11112 * DESCRIPTION
11113 *	h_pd
11114 *		Handle to the protection domain for this memory region.
11115 *
11116 *	local_lb
11117 *		The virtual address of the lower bound of protection for local
11118 *		memory access.
11119 *
11120 *	local_ub
11121 *		The virtual address of the upper bound of protection for local
11122 *		memory access.
11123 *
11124 *	remote_lb
11125 *		The virtual address of the lower bound of protection for remote
11126 *		memory access.
11127 *
11128 *	remote_ub
11129 *		The virtual address of the upper bound of protection for remote
11130 *		memory access.
11131 *
11132 *	access_ctrl
11133 *		Access rights for the specified memory region.
11134 *
11135 *	lkey
11136 *		The lkey associated with this memory region.
11137 *
11138 *	rkey
11139 *		The rkey associated with this memory region.
11140 *
11141 * NOTES
11142 *	The remote_lb, remote_ub, and rkey are only valid if remote memory access
11143 *	is enabled for this memory region.
11144 *
11145 * SEE ALSO
11146 *	ib_access_t
11147 *****/
11148 
11149 /****d* Access Layer/ib_ca_mod_t
11150 * NAME
11151 *	ib_ca_mod_t -- Modify port attributes and error counters
11152 *
11153 * DESCRIPTION
11154 *	Specifies modifications to the port attributes of a channel adapter.
11155 *
11156 * SYNOPSIS
11157 */
11158 typedef uint32_t ib_ca_mod_t;
11159 #define IB_CA_MOD_IS_CM_SUPPORTED		0x00000001
11160 #define IB_CA_MOD_IS_SNMP_SUPPORTED		0x00000002
11161 #define	IB_CA_MOD_IS_DEV_MGMT_SUPPORTED		0x00000004
11162 #define	IB_CA_MOD_IS_VEND_SUPPORTED		0x00000008
11163 #define	IB_CA_MOD_IS_SM				0x00000010
11164 #define IB_CA_MOD_IS_SM_DISABLED		0x00000020
11165 #define IB_CA_MOD_QKEY_CTR			0x00000040
11166 #define IB_CA_MOD_PKEY_CTR			0x00000080
11167 #define IB_CA_MOD_IS_NOTICE_SUPPORTED		0x00000100
11168 #define IB_CA_MOD_IS_TRAP_SUPPORTED		0x00000200
11169 #define IB_CA_MOD_IS_APM_SUPPORTED		0x00000400
11170 #define IB_CA_MOD_IS_SLMAP_SUPPORTED		0x00000800
11171 #define IB_CA_MOD_IS_PKEY_NVRAM_SUPPORTED	0x00001000
11172 #define IB_CA_MOD_IS_MKEY_NVRAM_SUPPORTED	0x00002000
11173 #define IB_CA_MOD_IS_SYSGUID_SUPPORTED		0x00004000
11174 #define IB_CA_MOD_IS_DR_NOTICE_SUPPORTED	0x00008000
11175 #define IB_CA_MOD_IS_BOOT_MGMT_SUPPORTED	0x00010000
11176 #define IB_CA_MOD_IS_CAPM_NOTICE_SUPPORTED	0x00020000
11177 #define IB_CA_MOD_IS_REINIT_SUPORTED		0x00040000
11178 #define IB_CA_MOD_IS_LEDINFO_SUPPORTED		0x00080000
11179 #define IB_CA_MOD_SHUTDOWN_PORT			0x00100000
11180 #define IB_CA_MOD_INIT_TYPE_VALUE		0x00200000
11181 #define IB_CA_MOD_SYSTEM_IMAGE_GUID		0x00400000
11182 /*
11183 * VALUES
11184 *	IB_CA_MOD_IS_CM_SUPPORTED
11185 *		Indicates if there is a communication manager accessible through
11186 *		the port.
11187 *
11188 *	IB_CA_MOD_IS_SNMP_SUPPORTED
11189 *		Indicates if there is an SNMP agent accessible through the port.
11190 *
11191 *	IB_CA_MOD_IS_DEV_MGMT_SUPPORTED
11192 *		Indicates if there is a device management agent accessible
11193 *		through the port.
11194 *
11195 *	IB_CA_MOD_IS_VEND_SUPPORTED
11196 *		Indicates if there is a vendor supported agent accessible
11197 *		through the port.
11198 *
11199 *	IB_CA_MOD_IS_SM
11200 *		Indicates if there is a subnet manager accessible through
11201 *		the port.
11202 *
11203 *	IB_CA_MOD_IS_SM_DISABLED
11204 *		Indicates if the port has been disabled for configuration by the
11205 *		subnet manager.
11206 *
11207 *	IB_CA_MOD_QKEY_CTR
11208 *		Used to reset the qkey violation counter associated with the
11209 *		port.
11210 *
11211 *	IB_CA_MOD_PKEY_CTR
11212 *		Used to reset the pkey violation counter associated with the
11213 *		port.
11214 *
11215 *	IB_CA_MOD_IS_NOTICE_SUPPORTED
11216 *		Indicates that this CA supports ability to generate Notices for
11217 *		Port State changes. (only applicable to switches)
11218 *
11219 *	IB_CA_MOD_IS_TRAP_SUPPORTED
11220 *		Indicates that this management port supports ability to generate
11221 *		trap messages. (only applicable to switches)
11222 *
11223 *	IB_CA_MOD_IS_APM_SUPPORTED
11224 *		Indicates that this port is capable of performing Automatic
11225 *		Path Migration.
11226 *
11227 *	IB_CA_MOD_IS_SLMAP_SUPPORTED
11228 *		Indicates this port supports SLMAP capability.
11229 *
11230 *	IB_CA_MOD_IS_PKEY_NVRAM_SUPPORTED
11231 *		Indicates that PKEY is supported in NVRAM
11232 *
11233 *	IB_CA_MOD_IS_MKEY_NVRAM_SUPPORTED
11234 *		Indicates that MKEY is supported in NVRAM
11235 *
11236 *	IB_CA_MOD_IS_SYSGUID_SUPPORTED
11237 *		Indicates System Image GUID support.
11238 *
11239 *	IB_CA_MOD_IS_DR_NOTICE_SUPPORTED
11240 *		Indicate support for generating Direct Routed Notices
11241 *
11242 *	IB_CA_MOD_IS_BOOT_MGMT_SUPPORTED
11243 *		Indicates support for Boot Management
11244 *
11245 *	IB_CA_MOD_IS_CAPM_NOTICE_SUPPORTED
11246 *		Indicates capability to generate notices for changes to CAPMASK
11247 *
11248 *	IB_CA_MOD_IS_REINIT_SUPORTED
11249 *		Indicates type of node init supported. Refer to Chapter 14 for
11250 *		Initialization actions.
11251 *
11252 *	IB_CA_MOD_IS_LEDINFO_SUPPORTED
11253 *		Indicates support for LED info.
11254 *
11255 *	IB_CA_MOD_SHUTDOWN_PORT
11256 *		Used to modify the port active indicator.
11257 *
11258 *	IB_CA_MOD_INIT_TYPE_VALUE
11259 *		Used to modify the init_type value for the port.
11260 *
11261 *	IB_CA_MOD_SYSTEM_IMAGE_GUID
11262 *		Used to modify the system image GUID for the port.
11263 *****/
11264 
11265 /****d* Access Layer/ib_mr_mod_t
11266 * NAME
11267 *	ib_mr_mod_t
11268 *
11269 * DESCRIPTION
11270 *	Mask used to specify which attributes of a registered memory region are
11271 *	being modified.
11272 *
11273 * SYNOPSIS
11274 */
11275 typedef uint32_t ib_mr_mod_t;
11276 #define IB_MR_MOD_ADDR					0x00000001
11277 #define IB_MR_MOD_PD					0x00000002
11278 #define IB_MR_MOD_ACCESS				0x00000004
11279 /*
11280 * PARAMETERS
11281 *	IB_MEM_MOD_ADDR
11282 *		The address of the memory region is being modified.
11283 *
11284 *	IB_MEM_MOD_PD
11285 *		The protection domain associated with the memory region is being
11286 *		modified.
11287 *
11288 *	IB_MEM_MOD_ACCESS
11289 *		The access rights the memory region are being modified.
11290 *****/
11291 
11292 /****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_HANDOVER
11293 * NAME
11294 *	IB_SMINFO_ATTR_MOD_HANDOVER
11295 *
11296 * DESCRIPTION
11297 *	Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.
11298 *
11299 * SOURCE
11300 */
11301 #define IB_SMINFO_ATTR_MOD_HANDOVER		(CL_HTON32(0x000001))
11302 /**********/
11303 
11304 /****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_ACKNOWLEDGE
11305 * NAME
11306 *	IB_SMINFO_ATTR_MOD_ACKNOWLEDGE
11307 *
11308 * DESCRIPTION
11309 *	Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.
11310 *
11311 * SOURCE
11312 */
11313 #define IB_SMINFO_ATTR_MOD_ACKNOWLEDGE		(CL_HTON32(0x000002))
11314 /**********/
11315 
11316 /****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_DISABLE
11317 * NAME
11318 *	IB_SMINFO_ATTR_MOD_DISABLE
11319 *
11320 * DESCRIPTION
11321 *	Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.
11322 *
11323 * SOURCE
11324 */
11325 #define IB_SMINFO_ATTR_MOD_DISABLE			(CL_HTON32(0x000003))
11326 /**********/
11327 
11328 /****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_STANDBY
11329 * NAME
11330 *	IB_SMINFO_ATTR_MOD_STANDBY
11331 *
11332 * DESCRIPTION
11333 *	Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.
11334 *
11335 * SOURCE
11336 */
11337 #define IB_SMINFO_ATTR_MOD_STANDBY			(CL_HTON32(0x000004))
11338 /**********/
11339 
11340 /****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_DISCOVER
11341 * NAME
11342 *	IB_SMINFO_ATTR_MOD_DISCOVER
11343 *
11344 * DESCRIPTION
11345 *	Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.
11346 *
11347 * SOURCE
11348 */
11349 #define IB_SMINFO_ATTR_MOD_DISCOVER			(CL_HTON32(0x000005))
11350 /**********/
11351 
11352 /****s* Access Layer/ib_ci_op_t
11353 * NAME
11354 *	ib_ci_op_t
11355 *
11356 * DESCRIPTION
11357 *	A structure used for vendor specific CA interface communication.
11358 *
11359 * SYNOPSIS
11360 */
11361 typedef struct _ib_ci_op {
11362 	IN uint32_t command;
11363 	IN OUT void *p_buf OPTIONAL;
11364 	IN uint32_t buf_size;
11365 	IN OUT uint32_t num_bytes_ret;
11366 	IN OUT int32_t status;
11367 } ib_ci_op_t;
11368 /*
11369 * FIELDS
11370 *	command
11371 *		A command code that is understood by the verbs provider.
11372 *
11373 *	p_buf
11374 *		A reference to a buffer containing vendor specific data.  The verbs
11375 *		provider must not access pointers in the p_buf between user-mode and
11376 *		kernel-mode.  Any pointers embedded in the p_buf are invalidated by
11377 *		the user-mode/kernel-mode transition.
11378 *
11379 *	buf_size
11380 *		The size of the buffer in bytes.
11381 *
11382 *	num_bytes_ret
11383 *		The size in bytes of the vendor specific data returned in the buffer.
11384 *		This field is set by the verbs provider.  The verbs provider should
11385 *		verify that the buffer size is sufficient to hold the data being
11386 *		returned.
11387 *
11388 *	status
11389 *		The completion status from the verbs provider.  This field should be
11390 *		initialize to indicate an error to allow detection and cleanup in
11391 *		case a communication error occurs between user-mode and kernel-mode.
11392 *
11393 * NOTES
11394 *	This structure is provided to allow the exchange of vendor specific
11395 *	data between the originator and the verbs provider.  Users of this
11396 *	structure are expected to know the format of data in the p_buf based
11397 *	on the structure command field or the usage context.
11398 *****/
11399 
11400 /****s* IBA Base: Types/ib_cc_mad_t
11401 * NAME
11402 *	ib_cc_mad_t
11403 *
11404 * DESCRIPTION
11405 *	IBA defined Congestion Control MAD format. (A10.4.1)
11406 *
11407 * SYNOPSIS
11408 */
11409 #define IB_CC_LOG_DATA_SIZE 32
11410 #define IB_CC_MGT_DATA_SIZE 192
11411 #define IB_CC_MAD_HDR_SIZE (sizeof(ib_sa_mad_t) - IB_CC_LOG_DATA_SIZE \
11412 						- IB_CC_MGT_DATA_SIZE)
11413 
11414 #include <complib/cl_packon.h>
11415 typedef struct _ib_cc_mad {
11416 	ib_mad_t header;
11417 	ib_net64_t cc_key;
11418 	uint8_t log_data[IB_CC_LOG_DATA_SIZE];
11419 	uint8_t mgt_data[IB_CC_MGT_DATA_SIZE];
11420 } PACK_SUFFIX ib_cc_mad_t;
11421 #include <complib/cl_packoff.h>
11422 /*
11423 * FIELDS
11424 *	header
11425 *		Common MAD header.
11426 *
11427 *	cc_key
11428 *		CC_Key of the Congestion Control MAD.
11429 *
11430 *	log_data
11431 *		Congestion Control log data of the CC MAD.
11432 *
11433 *	mgt_data
11434 *		Congestion Control management data of the CC MAD.
11435 *
11436 * SEE ALSO
11437 * ib_mad_t
11438 *********/
11439 
11440 /****f* IBA Base: Types/ib_cc_mad_get_cc_key
11441 * NAME
11442 *	ib_cc_mad_get_cc_key
11443 *
11444 * DESCRIPTION
11445 *	Gets a CC_Key of the CC MAD.
11446 *
11447 * SYNOPSIS
11448 */
11449 static inline ib_net64_t OSM_API
ib_cc_mad_get_cc_key(IN const ib_cc_mad_t * const p_cc_mad)11450 ib_cc_mad_get_cc_key(IN const ib_cc_mad_t * const p_cc_mad)
11451 {
11452 	return p_cc_mad->cc_key;
11453 }
11454 /*
11455 * PARAMETERS
11456 *	p_cc_mad
11457 *		[in] Pointer to the CC MAD packet.
11458 *
11459 * RETURN VALUES
11460 *	CC_Key of the provided CC MAD packet.
11461 *
11462 * NOTES
11463 *
11464 * SEE ALSO
11465 *	ib_cc_mad_t
11466 *********/
11467 
11468 /****f* IBA Base: Types/ib_cc_mad_get_log_data_ptr
11469 * NAME
11470 *	ib_cc_mad_get_log_data_ptr
11471 *
11472 * DESCRIPTION
11473 *	Gets a pointer to the CC MAD's log data area.
11474 *
11475 * SYNOPSIS
11476 */
11477 static inline void * OSM_API
ib_cc_mad_get_log_data_ptr(IN const ib_cc_mad_t * const p_cc_mad)11478 ib_cc_mad_get_log_data_ptr(IN const ib_cc_mad_t * const p_cc_mad)
11479 {
11480 	return ((void *)p_cc_mad->log_data);
11481 }
11482 /*
11483 * PARAMETERS
11484 *	p_cc_mad
11485 *		[in] Pointer to the CC MAD packet.
11486 *
11487 * RETURN VALUES
11488 *	Pointer to CC MAD log data area.
11489 *
11490 * NOTES
11491 *
11492 * SEE ALSO
11493 *	ib_cc_mad_t
11494 *********/
11495 
11496 /****f* IBA Base: Types/ib_cc_mad_get_mgt_data_ptr
11497 * NAME
11498 *	ib_cc_mad_get_mgt_data_ptr
11499 *
11500 * DESCRIPTION
11501 *	Gets a pointer to the CC MAD's management data area.
11502 *
11503 * SYNOPSIS
11504 */
11505 static inline void * OSM_API
ib_cc_mad_get_mgt_data_ptr(IN const ib_cc_mad_t * const p_cc_mad)11506 ib_cc_mad_get_mgt_data_ptr(IN const ib_cc_mad_t * const p_cc_mad)
11507 {
11508 	return ((void *)p_cc_mad->mgt_data);
11509 }
11510 /*
11511 * PARAMETERS
11512 *	p_cc_mad
11513 *		[in] Pointer to the CC MAD packet.
11514 *
11515 * RETURN VALUES
11516 *	Pointer to CC MAD management data area.
11517 *
11518 * NOTES
11519 *
11520 * SEE ALSO
11521 *	ib_cc_mad_t
11522 *********/
11523 
11524 /****s* IBA Base: Types/ib_cong_info_t
11525 * NAME
11526 *	ib_cong_info_t
11527 *
11528 * DESCRIPTION
11529 *	IBA defined CongestionInfo attribute (A10.4.3.3)
11530 *
11531 * SYNOPSIS
11532 */
11533 #include <complib/cl_packon.h>
11534 typedef struct _ib_cong_info {
11535 	uint8_t cong_info;
11536 	uint8_t resv;
11537 	uint8_t ctrl_table_cap;
11538 } PACK_SUFFIX ib_cong_info_t;
11539 #include <complib/cl_packoff.h>
11540 /*
11541 * FIELDS
11542 *	cong_info
11543 *		Congestion control capabilities of the node.
11544 *
11545 *	ctrl_table_cap
11546 *		Number of 64 entry blocks in the CongestionControlTable.
11547 *
11548 * SEE ALSO
11549 *	ib_cc_mad_t
11550 *********/
11551 
11552 /****s* IBA Base: Types/ib_cong_key_info_t
11553 * NAME
11554 *	ib_cong_key_info_t
11555 *
11556 * DESCRIPTION
11557 *	IBA defined CongestionKeyInfo attribute (A10.4.3.4)
11558 *
11559 * SYNOPSIS
11560 */
11561 #include <complib/cl_packon.h>
11562 typedef struct _ib_cong_key_info {
11563 	ib_net64_t cc_key;
11564 	ib_net16_t protect_bit;
11565 	ib_net16_t lease_period;
11566 	ib_net16_t violations;
11567 } PACK_SUFFIX ib_cong_key_info_t;
11568 #include <complib/cl_packoff.h>
11569 /*
11570 * FIELDS
11571 *	cc_key
11572 *		8-byte CC Key.
11573 *
11574 *	protect_bit
11575 *		Bit 0 is a CC Key Protect Bit, other 15 bits are reserved.
11576 *
11577 *	lease_period
11578 *		How long the CC Key protect bit is to remain non-zero.
11579 *
11580 *	violations
11581 *		Number of received MADs that violated CC Key.
11582 *
11583 * SEE ALSO
11584 *	ib_cc_mad_t
11585 *********/
11586 
11587 /****s* IBA Base: Types/ib_cong_log_event_sw_t
11588 * NAME
11589 *	ib_cong_log_event_sw_t
11590 *
11591 * DESCRIPTION
11592 *	IBA defined CongestionLogEvent (SW) entry (A10.4.3.5)
11593 *
11594 * SYNOPSIS
11595 */
11596 #include <complib/cl_packon.h>
11597 typedef struct _ib_cong_log_event_sw {
11598 	ib_net16_t slid;
11599 	ib_net16_t dlid;
11600 	ib_net32_t sl;
11601 	ib_net32_t time_stamp;
11602 } PACK_SUFFIX ib_cong_log_event_sw_t;
11603 #include <complib/cl_packoff.h>
11604 /*
11605 * FIELDS
11606 *	slid
11607 *		Source LID of congestion event.
11608 *
11609 *	dlid
11610 *		Destination LID of congestion event.
11611 *
11612 *	sl
11613 *		4 bits - SL of congestion event.
11614 *		rest of the bits are reserved.
11615 *
11616 *	time_stamp
11617 *		Timestamp of congestion event.
11618 *
11619 * SEE ALSO
11620 *	ib_cc_mad_t, ib_cong_log_t
11621 *********/
11622 
11623 /****s* IBA Base: Types/ib_cong_log_event_ca_t
11624 * NAME
11625 *	ib_cong_log_event_ca_t
11626 *
11627 * DESCRIPTION
11628 *	IBA defined CongestionLogEvent (CA) entry (A10.4.3.5)
11629 *
11630 * SYNOPSIS
11631 */
11632 #include <complib/cl_packon.h>
11633 typedef struct _ib_cong_log_event_ca {
11634 	ib_net32_t local_qp_resv0;
11635 	ib_net32_t remote_qp_sl_service_type;
11636 	ib_net16_t remote_lid;
11637 	ib_net16_t resv1;
11638 	ib_net32_t time_stamp;
11639 } PACK_SUFFIX ib_cong_log_event_ca_t;
11640 #include <complib/cl_packoff.h>
11641 /*
11642 * FIELDS
11643 *	resv0_local_qp
11644 *		bits [31:8] local QP that reached CN threshold.
11645 *		bits [7:0] reserved.
11646 *
11647 *	remote_qp_sl_service_type
11648 *		bits [31:8] remote QP that is connected to local QP.
11649 *		bits [7:4] SL of the local QP.
11650 *		bits [3:0] Service Type of the local QP.
11651 *
11652 *	remote_lid
11653 *		LID of the remote port that is connected to local QP.
11654 *
11655 *	time_stamp
11656 *		Timestamp when threshold reached.
11657 *
11658 * SEE ALSO
11659 *	ib_cc_mad_t, ib_cong_log_t
11660 *********/
11661 
11662 /****s* IBA Base: Types/ib_cong_log_t
11663 * NAME
11664 *	ib_cong_log_t
11665 *
11666 * DESCRIPTION
11667 *	IBA defined CongestionLog attribute (A10.4.3.5)
11668 *
11669 * SYNOPSIS
11670 */
11671 #include <complib/cl_packon.h>
11672 typedef struct _ib_cong_log {
11673 	uint8_t log_type;
11674 	union _log_details
11675 	{
11676 		struct _log_sw {
11677 			uint8_t cong_flags;
11678 			ib_net16_t event_counter;
11679 			ib_net32_t time_stamp;
11680 			uint8_t port_map[32];
11681 			ib_cong_log_event_sw_t entry_list[15];
11682 		} PACK_SUFFIX log_sw;
11683 
11684 		struct _log_ca {
11685 			uint8_t cong_flags;
11686 			ib_net16_t event_counter;
11687 			ib_net16_t event_map;
11688 			ib_net16_t resv;
11689 			ib_net32_t time_stamp;
11690 			ib_cong_log_event_ca_t log_event[13];
11691 		} PACK_SUFFIX log_ca;
11692 
11693 	} log_details;
11694 } PACK_SUFFIX ib_cong_log_t;
11695 #include <complib/cl_packoff.h>
11696 /*
11697 * FIELDS
11698 *
11699 *	log_{sw,ca}.log_type
11700 *		Log type: 0x1 is for Switch, 0x2 is for CA
11701 *
11702 *	log_{sw,ca}.cong_flags
11703 *		Congestion Flags.
11704 *
11705 *	log_{sw,ca}.event_counter
11706 *		Number of events since log last sent.
11707 *
11708 *	log_{sw,ca}.time_stamp
11709 *		Timestamp when log sent.
11710 *
11711 *	log_sw.port_map
11712 *		If a bit set to 1, then the corresponding port
11713 *		has marked packets with a FECN.
11714 *		bits 0 and 255 - reserved
11715 *		bits [254..1] - ports [254..1].
11716 *
11717 *	log_sw.entry_list
11718 *		Array of 13 most recent congestion log events.
11719 *
11720 *	log_ca.event_map
11721 *		array 16 bits, one for each SL.
11722 *
11723 *	log_ca.log_event
11724 *		Array of 13 most recent congestion log events.
11725 *
11726 * SEE ALSO
11727 *	ib_cc_mad_t, ib_cong_log_event_sw_t, ib_cong_log_event_ca_t
11728 *********/
11729 
11730 /****s* IBA Base: Types/ib_sw_cong_setting_t
11731 * NAME
11732 *	ib_sw_cong_setting_t
11733 *
11734 * DESCRIPTION
11735 *	IBA defined SwitchCongestionSetting attribute (A10.4.3.6)
11736 *
11737 * SYNOPSIS
11738 */
11739 #define IB_CC_PORT_MASK_DATA_SIZE 32
11740 #include <complib/cl_packon.h>
11741 typedef struct _ib_sw_cong_setting {
11742 	ib_net32_t control_map;
11743 	uint8_t victim_mask[IB_CC_PORT_MASK_DATA_SIZE];
11744 	uint8_t credit_mask[IB_CC_PORT_MASK_DATA_SIZE];
11745 	uint8_t threshold_resv;
11746 	uint8_t packet_size;
11747 	ib_net16_t cs_threshold_resv;
11748 	ib_net16_t cs_return_delay;
11749 	ib_net16_t marking_rate;
11750 } PACK_SUFFIX ib_sw_cong_setting_t;
11751 #include <complib/cl_packoff.h>
11752 /*
11753 * FIELDS
11754 *
11755 *	control_map
11756 *		Indicates which components of this attribute are valid
11757 *
11758 *	victim_mask
11759 *		If the bit set to 1, then the port corresponding to
11760 *		that bit shall mark packets that encounter congestion
11761 *		with a FECN, whether they are the source or victim
11762 *		of congestion. (See A10.2.1.1.1)
11763 *		  bit 0: port 0 (enhanced port 0 only)
11764 *		  bits [254..1]: ports [254..1]
11765 *		  bit 255: reserved
11766 *
11767 *	credit_mask
11768 *		If the bit set to 1, then the port corresponding
11769 *		to that bit shall apply Credit Starvation.
11770 *		  bit 0: port 0 (enhanced port 0 only)
11771 *		  bits [254..1]: ports [254..1]
11772 *		  bit 255: reserved
11773 *
11774 *	threshold_resv
11775 *		bits [7..4] Indicates how aggressive cong. marking should be
11776 *		bits [3..0] Reserved
11777 *
11778 *	packet_size
11779 *		Any packet less than this size won't be marked with FECN
11780 *
11781 *	cs_threshold_resv
11782 *		bits [15..12] How aggressive Credit Starvation should be
11783 *		bits [11..0] Reserved
11784 *
11785 *	cs_return_delay
11786 *		Value that controls credit return rate.
11787 *
11788 *	marking_rate
11789 *		The value that provides the mean number of packets
11790 *		between marking eligible packets with FECN.
11791 *
11792 * SEE ALSO
11793 *	ib_cc_mad_t
11794 *********/
11795 
11796 /****s* IBA Base: Types/ib_sw_port_cong_setting_element_t
11797 * NAME
11798 *	ib_sw_port_cong_setting_element_t
11799 *
11800 * DESCRIPTION
11801 *	IBA defined SwitchPortCongestionSettingElement (A10.4.3.7)
11802 *
11803 * SYNOPSIS
11804 */
11805 #include <complib/cl_packon.h>
11806 typedef struct _ib_sw_port_cong_setting_element {
11807 	uint8_t valid_ctrl_type_res_threshold;
11808 	uint8_t packet_size;
11809 	ib_net16_t cong_param;
11810 } PACK_SUFFIX ib_sw_port_cong_setting_element_t;
11811 #include <complib/cl_packoff.h>
11812 /*
11813 * FIELDS
11814 *
11815 *	valid_ctrl_type_res_threshold
11816 *		bit 7: "Valid"
11817 *			when set to 1, indicates this switch
11818 *			port congestion setting element is valid.
11819 *		bit 6: "Control Type"
11820 *			Indicates which type of attribute is being set:
11821 *			0b = Congestion Control parameters are being set.
11822 *			1b = Credit Starvation parameters are being set.
11823 *		bits [5..4]: reserved
11824 *		bits [3..0]: "Threshold"
11825 *			When Control Type is 0, contains the congestion
11826 *			threshold value (Threshold) for this port.
11827 *			When Control Type is 1, contains the credit
11828 *			starvation threshold (CS_Threshold) value for
11829 *			this port.
11830 *
11831 *	packet_size
11832 *		When Control Type is 0, this field contains the minimum
11833 *		size of packets that may be marked with a FECN.
11834 *		When Control Type is 1, this field is reserved.
11835 *
11836 *	cong_parm
11837 *		When Control Type is 0, this field contains the port
11838 *		marking_rate.
11839 *		When Control Type is 1, this field is reserved.
11840 *
11841 * SEE ALSO
11842 *	ib_cc_mad_t, ib_sw_port_cong_setting_t
11843 *********/
11844 
11845 /****d* IBA Base: Types/ib_sw_port_cong_setting_block_t
11846 * NAME
11847 *	ib_sw_port_cong_setting_block_t
11848 *
11849 * DESCRIPTION
11850 *	Defines the SwitchPortCongestionSetting Block (A10.4.3.7).
11851 *
11852 * SOURCE
11853 */
11854 #define IB_CC_SW_PORT_SETTING_ELEMENTS 32
11855 typedef ib_sw_port_cong_setting_element_t ib_sw_port_cong_setting_block_t[IB_CC_SW_PORT_SETTING_ELEMENTS];
11856 /**********/
11857 
11858 /****s* IBA Base: Types/ib_sw_port_cong_setting_t
11859 * NAME
11860 *	ib_sw_port_cong_setting_t
11861 *
11862 * DESCRIPTION
11863 *	IBA defined SwitchPortCongestionSetting attribute (A10.4.3.7)
11864 *
11865 * SYNOPSIS
11866 */
11867 
11868 #include <complib/cl_packon.h>
11869 typedef struct _ib_sw_port_cong_setting {
11870 	ib_sw_port_cong_setting_block_t block;
11871 } PACK_SUFFIX ib_sw_port_cong_setting_t;
11872 #include <complib/cl_packoff.h>
11873 /*
11874 * FIELDS
11875 *
11876 *	block
11877 *		SwitchPortCongestionSetting block.
11878 *
11879 * SEE ALSO
11880 *	ib_cc_mad_t, ib_sw_port_cong_setting_element_t
11881 *********/
11882 
11883 /****s* IBA Base: Types/ib_ca_cong_entry_t
11884 * NAME
11885 *	ib_ca_cong_entry_t
11886 *
11887 * DESCRIPTION
11888 *	IBA defined CACongestionEntry (A10.4.3.8)
11889 *
11890 * SYNOPSIS
11891 */
11892 #include <complib/cl_packon.h>
11893 typedef struct _ib_ca_cong_entry {
11894 	ib_net16_t ccti_timer;
11895 	uint8_t ccti_increase;
11896 	uint8_t trigger_threshold;
11897 	uint8_t ccti_min;
11898 	uint8_t resv0;
11899 	ib_net16_t resv1;
11900 } PACK_SUFFIX ib_ca_cong_entry_t;
11901 #include <complib/cl_packoff.h>
11902 /*
11903 * FIELDS
11904 *
11905 *	ccti_timer
11906 *		When the timer expires it will be reset to its specified
11907 *		value, and 1 will be decremented from the CCTI.
11908 *
11909 *	ccti_increase
11910 *		The number to be added to the table Index (CCTI)
11911 *		on the receipt of a BECN.
11912 *
11913 *	trigger_threshold
11914 *		When the CCTI is equal to this value, an event
11915 *		is logged in the CAs cyclic event log.
11916 *
11917 *	ccti_min
11918 *		The minimum value permitted for the CCTI.
11919 *
11920 * SEE ALSO
11921 *	ib_cc_mad_t
11922 *********/
11923 
11924 /****s* IBA Base: Types/ib_ca_cong_setting_t
11925 * NAME
11926 *	ib_ca_cong_setting_t
11927 *
11928 * DESCRIPTION
11929 *	IBA defined CACongestionSetting attribute (A10.4.3.8)
11930 *
11931 * SYNOPSIS
11932 */
11933 #define IB_CA_CONG_ENTRY_DATA_SIZE 16
11934 #include <complib/cl_packon.h>
11935 typedef struct _ib_ca_cong_setting {
11936 	ib_net16_t port_control;
11937 	ib_net16_t control_map;
11938 	ib_ca_cong_entry_t entry_list[IB_CA_CONG_ENTRY_DATA_SIZE];
11939 } PACK_SUFFIX ib_ca_cong_setting_t;
11940 #include <complib/cl_packoff.h>
11941 /*
11942 * FIELDS
11943 *
11944 *	port_control
11945 *		Congestion attributes for this port:
11946 *		  bit0 = 0: QP based CC
11947 *		  bit0 = 1: SL/Port based CC
11948 *		All other bits are reserved
11949 *
11950 *	control_map
11951 *		An array of sixteen bits, one for each SL. Each bit indicates
11952 *		whether or not the corresponding entry is to be modified.
11953 *
11954 *	entry_list
11955 *		List of 16 CACongestionEntries, one per SL.
11956 *
11957 * SEE ALSO
11958 *	ib_cc_mad_t
11959 *********/
11960 
11961 /****s* IBA Base: Types/ib_cc_tbl_entry_t
11962 * NAME
11963 *	ib_cc_tbl_entry_t
11964 *
11965 * DESCRIPTION
11966 *	IBA defined CongestionControlTableEntry (A10.4.3.9)
11967 *
11968 * SYNOPSIS
11969 */
11970 #include <complib/cl_packon.h>
11971 typedef struct _ib_cc_tbl_entry {
11972 	ib_net16_t shift_multiplier;
11973 } PACK_SUFFIX ib_cc_tbl_entry_t;
11974 #include <complib/cl_packoff.h>
11975 /*
11976 * FIELDS
11977 *
11978 *	shift_multiplier
11979 *		bits [15..14] - CCT Shift
11980 *		  used when calculating the injection rate delay
11981 *		bits [13..0] - CCT Multiplier
11982 *		  used when calculating the injection rate delay
11983 *
11984 * SEE ALSO
11985 *	ib_cc_mad_t
11986 *********/
11987 
11988 /****s* IBA Base: Types/ib_cc_tbl_t
11989 * NAME
11990 *	ib_cc_tbl_t
11991 *
11992 * DESCRIPTION
11993 *	IBA defined CongestionControlTable attribute (A10.4.3.9)
11994 *
11995 * SYNOPSIS
11996 */
11997 #define IB_CC_TBL_ENTRY_LIST_MAX 64
11998 #include <complib/cl_packon.h>
11999 typedef struct _ib_cc_tbl {
12000 	ib_net16_t ccti_limit;
12001 	ib_net16_t resv;
12002 	ib_cc_tbl_entry_t entry_list[IB_CC_TBL_ENTRY_LIST_MAX];
12003 } PACK_SUFFIX ib_cc_tbl_t;
12004 #include <complib/cl_packoff.h>
12005 /*
12006 * FIELDS
12007 *
12008 *	ccti_limit
12009 *		Maximum valid CCTI for this table.
12010 *
12011 *	entry_list
12012 *		List of up to 64 CongestionControlTableEntries.
12013 *
12014 * SEE ALSO
12015 *	ib_cc_mad_t
12016 *********/
12017 
12018 /****s* IBA Base: Types/ib_time_stamp_t
12019 * NAME
12020 *	ib_time_stamp_t
12021 *
12022 * DESCRIPTION
12023 *	IBA defined TimeStamp attribute (A10.4.3.10)
12024 *
12025 * SOURCE
12026 */
12027 #include <complib/cl_packon.h>
12028 typedef struct _ib_time_stamp {
12029 	ib_net32_t value;
12030 } PACK_SUFFIX ib_time_stamp_t;
12031 #include <complib/cl_packoff.h>
12032 /*
12033 * FIELDS
12034 *
12035 *	value
12036 *		Free running clock that provides relative time info
12037 *		for a device. Time is kept in 1.024 usec units.
12038 *
12039 * SEE ALSO
12040 *	ib_cc_mad_t
12041 *********/
12042 
12043 END_C_DECLS
12044 #else				/* ndef __WIN__ */
12045 #include <iba/ib_types_extended.h>
12046 #endif
12047 #endif				/* __IB_TYPES_H__ */
12048