1219820Sjeff/*
2219820Sjeff * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
3219820Sjeff * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
4219820Sjeff * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
5219820Sjeff *
6219820Sjeff * This software is available to you under a choice of one of two
7219820Sjeff * licenses.  You may choose to be licensed under the terms of the GNU
8219820Sjeff * General Public License (GPL) Version 2, available from the file
9219820Sjeff * COPYING in the main directory of this source tree, or the
10219820Sjeff * OpenIB.org BSD license below:
11219820Sjeff *
12219820Sjeff *     Redistribution and use in source and binary forms, with or
13219820Sjeff *     without modification, are permitted provided that the following
14219820Sjeff *     conditions are met:
15219820Sjeff *
16219820Sjeff *      - Redistributions of source code must retain the above
17219820Sjeff *        copyright notice, this list of conditions and the following
18219820Sjeff *        disclaimer.
19219820Sjeff *
20219820Sjeff *      - Redistributions in binary form must reproduce the above
21219820Sjeff *        copyright notice, this list of conditions and the following
22219820Sjeff *        disclaimer in the documentation and/or other materials
23219820Sjeff *        provided with the distribution.
24219820Sjeff *
25219820Sjeff * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26219820Sjeff * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27219820Sjeff * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28219820Sjeff * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29219820Sjeff * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30219820Sjeff * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31219820Sjeff * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32219820Sjeff * SOFTWARE.
33219820Sjeff *
34219820Sjeff */
35219820Sjeff
36219820Sjeff#if !defined(__IB_TYPES_H__)
37219820Sjeff#define __IB_TYPES_H__
38219820Sjeff
39219820Sjeff#include <string.h>
40219820Sjeff#include <complib/cl_types.h>
41219820Sjeff#include <complib/cl_byteswap.h>
42219820Sjeff
43219820Sjeff#ifdef __cplusplus
44219820Sjeff#  define BEGIN_C_DECLS extern "C" {
45219820Sjeff#  define END_C_DECLS   }
46219820Sjeff#else				/* !__cplusplus */
47219820Sjeff#  define BEGIN_C_DECLS
48219820Sjeff#  define END_C_DECLS
49219820Sjeff#endif				/* __cplusplus */
50219820Sjeff
51219820SjeffBEGIN_C_DECLS
52219820Sjeff#if defined( WIN32 ) || defined( _WIN64 )
53219820Sjeff#if defined( EXPORT_AL_SYMBOLS )
54219820Sjeff#define OSM_EXPORT	__declspec(dllexport)
55219820Sjeff#else
56219820Sjeff#define OSM_EXPORT	__declspec(dllimport)
57219820Sjeff#endif
58219820Sjeff#define OSM_API __stdcall
59219820Sjeff#define OSM_CDECL __cdecl
60219820Sjeff#else
61219820Sjeff#define OSM_EXPORT	extern
62219820Sjeff#define OSM_API
63219820Sjeff#define OSM_CDECL
64219820Sjeff#define __ptr64
65219820Sjeff#endif
66219820Sjeff/****h* IBA Base/Constants
67219820Sjeff* NAME
68219820Sjeff*	Constants
69219820Sjeff*
70219820Sjeff* DESCRIPTION
71219820Sjeff*	The following constants are used throughout the IBA code base.
72219820Sjeff*
73219820Sjeff*	Definitions are from the InfiniBand Architecture Specification v1.2
74219820Sjeff*
75219820Sjeff*********/
76219820Sjeff/****d* IBA Base: Constants/MAD_BLOCK_SIZE
77219820Sjeff* NAME
78219820Sjeff*	MAD_BLOCK_SIZE
79219820Sjeff*
80219820Sjeff* DESCRIPTION
81219820Sjeff*	Size of a non-RMPP MAD datagram.
82219820Sjeff*
83219820Sjeff* SOURCE
84219820Sjeff*/
85219820Sjeff#define MAD_BLOCK_SIZE						256
86219820Sjeff/**********/
87219820Sjeff/****d* IBA Base: Constants/MAD_RMPP_HDR_SIZE
88219820Sjeff* NAME
89219820Sjeff*	MAD_RMPP_HDR_SIZE
90219820Sjeff*
91219820Sjeff* DESCRIPTION
92219820Sjeff*	Size of an RMPP header, including the common MAD header.
93219820Sjeff*
94219820Sjeff* SOURCE
95219820Sjeff*/
96219820Sjeff#define MAD_RMPP_HDR_SIZE					36
97219820Sjeff/**********/
98219820Sjeff/****d* IBA Base: Constants/MAD_RMPP_DATA_SIZE
99219820Sjeff* NAME
100219820Sjeff*	MAD_RMPP_DATA_SIZE
101219820Sjeff*
102219820Sjeff* DESCRIPTION
103219820Sjeff*	Size of an RMPP transaction data section.
104219820Sjeff*
105219820Sjeff* SOURCE
106219820Sjeff*/
107219820Sjeff#define MAD_RMPP_DATA_SIZE		(MAD_BLOCK_SIZE - MAD_RMPP_HDR_SIZE)
108219820Sjeff/**********/
109219820Sjeff/****d* IBA Base: Constants/MAD_BLOCK_GRH_SIZE
110219820Sjeff* NAME
111219820Sjeff*	MAD_BLOCK_GRH_SIZE
112219820Sjeff*
113219820Sjeff* DESCRIPTION
114219820Sjeff*	Size of a MAD datagram, including the GRH.
115219820Sjeff*
116219820Sjeff* SOURCE
117219820Sjeff*/
118219820Sjeff#define MAD_BLOCK_GRH_SIZE					296
119219820Sjeff/**********/
120219820Sjeff/****d* IBA Base: Constants/IB_LID_PERMISSIVE
121219820Sjeff* NAME
122219820Sjeff*	IB_LID_PERMISSIVE
123219820Sjeff*
124219820Sjeff* DESCRIPTION
125219820Sjeff*	Permissive LID
126219820Sjeff*
127219820Sjeff* SOURCE
128219820Sjeff*/
129219820Sjeff#define IB_LID_PERMISSIVE					0xFFFF
130219820Sjeff/**********/
131219820Sjeff/****d* IBA Base: Constants/IB_DEFAULT_PKEY
132219820Sjeff* NAME
133219820Sjeff*	IB_DEFAULT_PKEY
134219820Sjeff*
135219820Sjeff* DESCRIPTION
136219820Sjeff*	P_Key value for the default partition.
137219820Sjeff*
138219820Sjeff* SOURCE
139219820Sjeff*/
140219820Sjeff#define IB_DEFAULT_PKEY						0xFFFF
141219820Sjeff/**********/
142219820Sjeff/****d* IBA Base: Constants/IB_QP1_WELL_KNOWN_Q_KEY
143219820Sjeff* NAME
144219820Sjeff*	IB_QP1_WELL_KNOWN_Q_KEY
145219820Sjeff*
146219820Sjeff* DESCRIPTION
147219820Sjeff*	Well-known Q_Key for QP1 privileged mode access (15.4.2).
148219820Sjeff*
149219820Sjeff* SOURCE
150219820Sjeff*/
151219820Sjeff#define IB_QP1_WELL_KNOWN_Q_KEY				CL_HTON32(0x80010000)
152219820Sjeff/*********/
153219820Sjeff#define IB_QP0								0
154219820Sjeff#define IB_QP1								CL_HTON32(1)
155219820Sjeff#define IB_QP_PRIVILEGED_Q_KEY				CL_HTON32(0x80000000)
156219820Sjeff/****d* IBA Base: Constants/IB_LID_UCAST_START
157219820Sjeff* NAME
158219820Sjeff*	IB_LID_UCAST_START
159219820Sjeff*
160219820Sjeff* DESCRIPTION
161219820Sjeff*	Lowest valid unicast LID value.
162219820Sjeff*
163219820Sjeff* SOURCE
164219820Sjeff*/
165219820Sjeff#define IB_LID_UCAST_START_HO				0x0001
166219820Sjeff#define IB_LID_UCAST_START					(CL_HTON16(IB_LID_UCAST_START_HO))
167219820Sjeff/**********/
168219820Sjeff/****d* IBA Base: Constants/IB_LID_UCAST_END
169219820Sjeff* NAME
170219820Sjeff*	IB_LID_UCAST_END
171219820Sjeff*
172219820Sjeff* DESCRIPTION
173219820Sjeff*	Highest valid unicast LID value.
174219820Sjeff*
175219820Sjeff* SOURCE
176219820Sjeff*/
177219820Sjeff#define IB_LID_UCAST_END_HO					0xBFFF
178219820Sjeff#define IB_LID_UCAST_END					(CL_HTON16(IB_LID_UCAST_END_HO))
179219820Sjeff/**********/
180219820Sjeff/****d* IBA Base: Constants/IB_LID_MCAST_START
181219820Sjeff* NAME
182219820Sjeff*	IB_LID_MCAST_START
183219820Sjeff*
184219820Sjeff* DESCRIPTION
185219820Sjeff*	Lowest valid multicast LID value.
186219820Sjeff*
187219820Sjeff* SOURCE
188219820Sjeff*/
189219820Sjeff#define IB_LID_MCAST_START_HO				0xC000
190219820Sjeff#define IB_LID_MCAST_START					(CL_HTON16(IB_LID_MCAST_START_HO))
191219820Sjeff/**********/
192219820Sjeff/****d* IBA Base: Constants/IB_LID_MCAST_END
193219820Sjeff* NAME
194219820Sjeff*	IB_LID_MCAST_END
195219820Sjeff*
196219820Sjeff* DESCRIPTION
197219820Sjeff*	Highest valid multicast LID value.
198219820Sjeff*
199219820Sjeff* SOURCE
200219820Sjeff*/
201219820Sjeff#define IB_LID_MCAST_END_HO					0xFFFE
202219820Sjeff#define IB_LID_MCAST_END					(CL_HTON16(IB_LID_MCAST_END_HO))
203219820Sjeff/**********/
204219820Sjeff/****d* IBA Base: Constants/IB_DEFAULT_SUBNET_PREFIX
205219820Sjeff* NAME
206219820Sjeff*	IB_DEFAULT_SUBNET_PREFIX
207219820Sjeff*
208219820Sjeff* DESCRIPTION
209219820Sjeff*	Default subnet GID prefix.
210219820Sjeff*
211219820Sjeff* SOURCE
212219820Sjeff*/
213219820Sjeff#define IB_DEFAULT_SUBNET_PREFIX			(CL_HTON64(0xFE80000000000000ULL))
214219820Sjeff/**********/
215219820Sjeff/****d* IBA Base: Constants/IB_NODE_NUM_PORTS_MAX
216219820Sjeff* NAME
217219820Sjeff*	IB_NODE_NUM_PORTS_MAX
218219820Sjeff*
219219820Sjeff* DESCRIPTION
220219820Sjeff*	Maximum number of ports in a single node (14.2.5.7).
221219820Sjeff* SOURCE
222219820Sjeff*/
223219820Sjeff#define IB_NODE_NUM_PORTS_MAX				0xFE
224219820Sjeff/**********/
225219820Sjeff/****d* IBA Base: Constants/IB_INVALID_PORT_NUM
226219820Sjeff* NAME
227219820Sjeff*	IB_INVALID_PORT_NUM
228219820Sjeff*
229219820Sjeff* DESCRIPTION
230219820Sjeff*	Value used to indicate an invalid port number (14.2.5.10).
231219820Sjeff*
232219820Sjeff* SOURCE
233219820Sjeff*/
234219820Sjeff#define IB_INVALID_PORT_NUM					0xFF
235219820Sjeff/*********/
236219820Sjeff/****d* IBA Base: Constants/IB_SUBNET_PATH_HOPS_MAX
237219820Sjeff* NAME
238219820Sjeff*	IB_SUBNET_PATH_HOPS_MAX
239219820Sjeff*
240219820Sjeff* DESCRIPTION
241219820Sjeff*	Maximum number of directed route switch hops in a subnet (14.2.1.2).
242219820Sjeff*
243219820Sjeff* SOURCE
244219820Sjeff*/
245219820Sjeff#define IB_SUBNET_PATH_HOPS_MAX				64
246219820Sjeff/*********/
247219820Sjeff/****d* IBA Base: Constants/IB_HOPLIMIT_MAX
248219820Sjeff* NAME
249219820Sjeff*	IB_HOPLIMIT_MAX
250219820Sjeff*
251219820Sjeff* DESCRIPTION
252219820Sjeff*       Maximum number of router hops allowed.
253219820Sjeff*
254219820Sjeff* SOURCE
255219820Sjeff*/
256219820Sjeff#define IB_HOPLIMIT_MAX					255
257219820Sjeff/*********/
258219820Sjeff/****d* IBA Base: Constants/IB_MC_SCOPE_*
259219820Sjeff* NAME
260219820Sjeff*	IB_MC_SCOPE_*
261219820Sjeff*
262219820Sjeff* DESCRIPTION
263219820Sjeff*	Scope component definitions from IBA 1.2 (Table 3 p. 146)
264219820Sjeff*/
265219820Sjeff#define IB_MC_SCOPE_LINK_LOCAL		0x2
266219820Sjeff#define IB_MC_SCOPE_SITE_LOCAL		0x5
267219820Sjeff#define IB_MC_SCOPE_ORG_LOCAL		0x8
268219820Sjeff#define IB_MC_SCOPE_GLOBAL		0xE
269219820Sjeff/*********/
270219820Sjeff/****d* IBA Base: Constants/IB_PKEY_MAX_BLOCKS
271219820Sjeff* NAME
272219820Sjeff*	IB_PKEY_MAX_BLOCKS
273219820Sjeff*
274219820Sjeff* DESCRIPTION
275219820Sjeff*	Maximum number of PKEY blocks (14.2.5.7).
276219820Sjeff*
277219820Sjeff* SOURCE
278219820Sjeff*/
279219820Sjeff#define IB_PKEY_MAX_BLOCKS					2048
280219820Sjeff/*********/
281219820Sjeff/****d* IBA Base: Constants/IB_MCAST_MAX_BLOCK_ID
282219820Sjeff* NAME
283219820Sjeff*	IB_MCAST_MAX_BLOCK_ID
284219820Sjeff*
285219820Sjeff* DESCRIPTION
286219820Sjeff*	Maximum number of Multicast port mask blocks
287219820Sjeff*
288219820Sjeff* SOURCE
289219820Sjeff*/
290219820Sjeff#define IB_MCAST_MAX_BLOCK_ID				511
291219820Sjeff/*********/
292219820Sjeff/****d* IBA Base: Constants/IB_MCAST_BLOCK_ID_MASK_HO
293219820Sjeff* NAME
294219820Sjeff*	IB_MCAST_BLOCK_ID_MASK_HO
295219820Sjeff*
296219820Sjeff* DESCRIPTION
297219820Sjeff*	Mask (host order) to recover the Multicast block ID.
298219820Sjeff*
299219820Sjeff* SOURCE
300219820Sjeff*/
301219820Sjeff#define IB_MCAST_BLOCK_ID_MASK_HO			0x000001FF
302219820Sjeff/*********/
303219820Sjeff/****d* IBA Base: Constants/IB_MCAST_BLOCK_SIZE
304219820Sjeff* NAME
305219820Sjeff*	IB_MCAST_BLOCK_SIZE
306219820Sjeff*
307219820Sjeff* DESCRIPTION
308219820Sjeff*	Number of port mask entries in a multicast forwarding table block.
309219820Sjeff*
310219820Sjeff* SOURCE
311219820Sjeff*/
312219820Sjeff#define IB_MCAST_BLOCK_SIZE					32
313219820Sjeff/*********/
314219820Sjeff/****d* IBA Base: Constants/IB_MCAST_MASK_SIZE
315219820Sjeff* NAME
316219820Sjeff*	IB_MCAST_MASK_SIZE
317219820Sjeff*
318219820Sjeff* DESCRIPTION
319219820Sjeff*	Number of port mask bits in each entry in the multicast forwarding table.
320219820Sjeff*
321219820Sjeff* SOURCE
322219820Sjeff*/
323219820Sjeff#define IB_MCAST_MASK_SIZE					16
324219820Sjeff/*********/
325219820Sjeff/****d* IBA Base: Constants/IB_MCAST_POSITION_MASK_HO
326219820Sjeff* NAME
327219820Sjeff*	IB_MCAST_POSITION_MASK_HO
328219820Sjeff*
329219820Sjeff* DESCRIPTION
330219820Sjeff*	Mask (host order) to recover the multicast block position.
331219820Sjeff*
332219820Sjeff* SOURCE
333219820Sjeff*/
334219820Sjeff#define IB_MCAST_POSITION_MASK_HO				0xF0000000
335219820Sjeff/*********/
336219820Sjeff/****d* IBA Base: Constants/IB_MCAST_POSITION_MAX
337219820Sjeff* NAME
338219820Sjeff*	IB_MCAST_POSITION_MAX
339219820Sjeff*
340219820Sjeff* DESCRIPTION
341219820Sjeff*	Maximum value for the multicast block position.
342219820Sjeff*
343219820Sjeff* SOURCE
344219820Sjeff*/
345219820Sjeff#define IB_MCAST_POSITION_MAX				0xF
346219820Sjeff/*********/
347219820Sjeff/****d* IBA Base: Constants/IB_MCAST_POSITION_SHIFT
348219820Sjeff* NAME
349219820Sjeff*	IB_MCAST_POSITION_SHIFT
350219820Sjeff*
351219820Sjeff* DESCRIPTION
352219820Sjeff*	Shift value to normalize the multicast block position value.
353219820Sjeff*
354219820Sjeff* SOURCE
355219820Sjeff*/
356219820Sjeff#define IB_MCAST_POSITION_SHIFT				28
357219820Sjeff/*********/
358219820Sjeff/****d* IBA Base: Constants/IB_PKEY_ENTRIES_MAX
359219820Sjeff* NAME
360219820Sjeff*	IB_PKEY_ENTRIES_MAX
361219820Sjeff*
362219820Sjeff* DESCRIPTION
363219820Sjeff*	Maximum number of PKEY entries per port (14.2.5.7).
364219820Sjeff*
365219820Sjeff* SOURCE
366219820Sjeff*/
367219820Sjeff#define IB_PKEY_ENTRIES_MAX (IB_PKEY_MAX_BLOCKS * IB_NUM_PKEY_ELEMENTS_IN_BLOCK)
368219820Sjeff/*********/
369219820Sjeff/****d* IBA Base: Constants/IB_PKEY_BASE_MASK
370219820Sjeff* NAME
371219820Sjeff*	IB_PKEY_BASE_MASK
372219820Sjeff*
373219820Sjeff* DESCRIPTION
374219820Sjeff*	Masks for the base P_Key value given a P_Key Entry.
375219820Sjeff*
376219820Sjeff* SOURCE
377219820Sjeff*/
378219820Sjeff#define IB_PKEY_BASE_MASK					(CL_HTON16(0x7FFF))
379219820Sjeff/*********/
380219820Sjeff/****d* IBA Base: Constants/IB_PKEY_TYPE_MASK
381219820Sjeff* NAME
382219820Sjeff*	IB_PKEY_TYPE_MASK
383219820Sjeff*
384219820Sjeff* DESCRIPTION
385219820Sjeff*	Masks for the P_Key membership type given a P_Key Entry.
386219820Sjeff*
387219820Sjeff* SOURCE
388219820Sjeff*/
389219820Sjeff#define IB_PKEY_TYPE_MASK					(CL_HTON16(0x8000))
390219820Sjeff/*********/
391219820Sjeff/****d* IBA Base: Constants/IB_DEFAULT_PARTIAL_PKEY
392219820Sjeff* NAME
393219820Sjeff*	IB_DEFAULT_PARTIAL_PKEY
394219820Sjeff*
395219820Sjeff* DESCRIPTION
396219820Sjeff*	0x7FFF in network order
397219820Sjeff*
398219820Sjeff* SOURCE
399219820Sjeff*/
400219820Sjeff#define IB_DEFAULT_PARTIAL_PKEY				       (CL_HTON16(0x7FFF))
401219820Sjeff/**********/
402219820Sjeff/****d* IBA Base: Constants/IB_MCLASS_SUBN_LID
403219820Sjeff* NAME
404219820Sjeff*	IB_MCLASS_SUBN_LID
405219820Sjeff*
406219820Sjeff* DESCRIPTION
407219820Sjeff*	Subnet Management Class, Subnet Manager LID routed (13.4.4)
408219820Sjeff*
409219820Sjeff* SOURCE
410219820Sjeff*/
411219820Sjeff#define IB_MCLASS_SUBN_LID					0x01
412219820Sjeff/**********/
413219820Sjeff/****d* IBA Base: Constants/IB_MCLASS_SUBN_DIR
414219820Sjeff* NAME
415219820Sjeff*	IB_MCLASS_SUBN_DIR
416219820Sjeff*
417219820Sjeff* DESCRIPTION
418219820Sjeff*	Subnet Management Class, Subnet Manager directed route (13.4.4)
419219820Sjeff*
420219820Sjeff* SOURCE
421219820Sjeff*/
422219820Sjeff#define IB_MCLASS_SUBN_DIR					0x81
423219820Sjeff/**********/
424219820Sjeff/****d* IBA Base: Constants/IB_MCLASS_SUBN_ADM
425219820Sjeff* NAME
426219820Sjeff*	IB_MCLASS_SUBN_ADM
427219820Sjeff*
428219820Sjeff* DESCRIPTION
429219820Sjeff*	Management Class, Subnet Administration (13.4.4)
430219820Sjeff*
431219820Sjeff* SOURCE
432219820Sjeff*/
433219820Sjeff#define IB_MCLASS_SUBN_ADM					0x03
434219820Sjeff/**********/
435219820Sjeff/****d* IBA Base: Constants/IB_MCLASS_PERF
436219820Sjeff* NAME
437219820Sjeff*	IB_MCLASS_PERF
438219820Sjeff*
439219820Sjeff* DESCRIPTION
440219820Sjeff*	Management Class, Performance Management (13.4.4)
441219820Sjeff*
442219820Sjeff* SOURCE
443219820Sjeff*/
444219820Sjeff#define IB_MCLASS_PERF						0x04
445219820Sjeff/**********/
446219820Sjeff/****d* IBA Base: Constants/IB_MCLASS_BM
447219820Sjeff* NAME
448219820Sjeff*	IB_MCLASS_BM
449219820Sjeff*
450219820Sjeff* DESCRIPTION
451219820Sjeff*	Management Class, Baseboard Management (13.4.4)
452219820Sjeff*
453219820Sjeff* SOURCE
454219820Sjeff*/
455219820Sjeff#define IB_MCLASS_BM						0x05
456219820Sjeff/**********/
457219820Sjeff/****d* IBA Base: Constants/IB_MCLASS_DEV_MGMT
458219820Sjeff* NAME
459219820Sjeff*	IB_MCLASS_DEV_MGMT
460219820Sjeff*
461219820Sjeff* DESCRIPTION
462219820Sjeff*	Management Class, Device Management (13.4.4)
463219820Sjeff*
464219820Sjeff* SOURCE
465219820Sjeff*/
466219820Sjeff#define IB_MCLASS_DEV_MGMT					0x06
467219820Sjeff/**********/
468219820Sjeff/****d* IBA Base: Constants/IB_MCLASS_COMM_MGMT
469219820Sjeff* NAME
470219820Sjeff*	IB_MCLASS_COMM_MGMT
471219820Sjeff*
472219820Sjeff* DESCRIPTION
473219820Sjeff*	Management Class, Communication Management (13.4.4)
474219820Sjeff*
475219820Sjeff* SOURCE
476219820Sjeff*/
477219820Sjeff#define IB_MCLASS_COMM_MGMT					0x07
478219820Sjeff/**********/
479219820Sjeff/****d* IBA Base: Constants/IB_MCLASS_SNMP
480219820Sjeff* NAME
481219820Sjeff*	IB_MCLASS_SNMP
482219820Sjeff*
483219820Sjeff* DESCRIPTION
484219820Sjeff*	Management Class, SNMP Tunneling (13.4.4)
485219820Sjeff*
486219820Sjeff* SOURCE
487219820Sjeff*/
488219820Sjeff#define IB_MCLASS_SNMP						0x08
489219820Sjeff/**********/
490219820Sjeff/****d* IBA Base: Constants/IB_MCLASS_VENDOR_LOW_RANGE_MIN
491219820Sjeff* NAME
492219820Sjeff*	IB_MCLASS_VENDOR_LOW_RANGE_MIN
493219820Sjeff*
494219820Sjeff* DESCRIPTION
495219820Sjeff*	Management Class, Vendor Specific Low Range Start
496219820Sjeff*
497219820Sjeff* SOURCE
498219820Sjeff*/
499219820Sjeff#define IB_MCLASS_VENDOR_LOW_RANGE_MIN 0x09
500219820Sjeff/**********/
501219820Sjeff/****d* IBA Base: Constants/IB_MCLASS_VENDOR_LOW_RANGE_MAX
502219820Sjeff* NAME
503219820Sjeff*	IB_MCLASS_VENDOR_LOW_RANGE_MAX
504219820Sjeff*
505219820Sjeff* DESCRIPTION
506219820Sjeff*	Management Class, Vendor Specific Low Range End
507219820Sjeff*
508219820Sjeff* SOURCE
509219820Sjeff*/
510219820Sjeff#define IB_MCLASS_VENDOR_LOW_RANGE_MAX 0x0f
511219820Sjeff/**********/
512219820Sjeff/****d* IBA Base: Constants/IB_MCLASS_DEV_ADM
513219820Sjeff* NAME
514219820Sjeff*	IB_MCLASS_DEV_ADM
515219820Sjeff*
516219820Sjeff* DESCRIPTION
517219820Sjeff*	Management Class, Device Administration
518219820Sjeff*
519219820Sjeff* SOURCE
520219820Sjeff*/
521219820Sjeff#define IB_MCLASS_DEV_ADM 0x10
522219820Sjeff/**********/
523219820Sjeff/****d* IBA Base: Constants/IB_MCLASS_BIS
524219820Sjeff* NAME
525219820Sjeff*	IB_MCLASS_BIS
526219820Sjeff*
527219820Sjeff* DESCRIPTION
528219820Sjeff*	Management Class, BIS
529219820Sjeff*
530219820Sjeff* SOURCE
531219820Sjeff*/
532219820Sjeff#define IB_MCLASS_BIS 0x12
533219820Sjeff/**********/
534219820Sjeff/****d* IBA Base: Constants/IB_MCLASS_VENDOR_HIGH_RANGE_MIN
535219820Sjeff* NAME
536219820Sjeff*	IB_MCLASS_VENDOR_HIGH_RANGE_MIN
537219820Sjeff*
538219820Sjeff* DESCRIPTION
539219820Sjeff*	Management Class, Vendor Specific High Range Start
540219820Sjeff*
541219820Sjeff* SOURCE
542219820Sjeff*/
543219820Sjeff#define IB_MCLASS_VENDOR_HIGH_RANGE_MIN 0x30
544219820Sjeff/**********/
545219820Sjeff/****d* IBA Base: Constants/IB_MCLASS_VENDOR_HIGH_RANGE_MAX
546219820Sjeff* NAME
547219820Sjeff*	IB_MCLASS_VENDOR_HIGH_RANGE_MAX
548219820Sjeff*
549219820Sjeff* DESCRIPTION
550219820Sjeff*	Management Class, Vendor Specific High Range End
551219820Sjeff*
552219820Sjeff* SOURCE
553219820Sjeff*/
554219820Sjeff#define IB_MCLASS_VENDOR_HIGH_RANGE_MAX 0x4f
555219820Sjeff/**********/
556219820Sjeff/****f* IBA Base: Types/ib_class_is_vendor_specific_low
557219820Sjeff* NAME
558219820Sjeff*	ib_class_is_vendor_specific_low
559219820Sjeff*
560219820Sjeff* DESCRIPTION
561219820Sjeff*	Indicates if the Class Code if a vendor specific class from
562219820Sjeff*  the low range
563219820Sjeff*
564219820Sjeff* SYNOPSIS
565219820Sjeff*/
566219820Sjeffstatic inline boolean_t OSM_API
567219820Sjeffib_class_is_vendor_specific_low(IN const uint8_t class_code)
568219820Sjeff{
569219820Sjeff	return ((class_code >= IB_MCLASS_VENDOR_LOW_RANGE_MIN) &&
570219820Sjeff		(class_code <= IB_MCLASS_VENDOR_LOW_RANGE_MAX));
571219820Sjeff}
572219820Sjeff
573219820Sjeff/*
574219820Sjeff* PARAMETERS
575219820Sjeff*	class_code
576219820Sjeff*		[in] The Management Datagram Class Code
577219820Sjeff*
578219820Sjeff* RETURN VALUE
579219820Sjeff*	TRUE if the class is in the Low range of Vendor Specific MADs
580219820Sjeff*	FALSE otherwise.
581219820Sjeff*
582219820Sjeff* NOTES
583219820Sjeff*
584219820Sjeff* SEE ALSO
585219820Sjeff* IB_MCLASS_VENDOR_LOW_RANGE_MIN, IB_MCLASS_VENDOR_LOW_RANGE_MAX
586219820Sjeff*********/
587219820Sjeff
588219820Sjeff/****f* IBA Base: Types/ib_class_is_vendor_specific_high
589219820Sjeff* NAME
590219820Sjeff*	ib_class_is_vendor_specific_high
591219820Sjeff*
592219820Sjeff* DESCRIPTION
593219820Sjeff*	Indicates if the Class Code if a vendor specific class from
594219820Sjeff*  the high range
595219820Sjeff*
596219820Sjeff* SYNOPSIS
597219820Sjeff*/
598219820Sjeffstatic inline boolean_t OSM_API
599219820Sjeffib_class_is_vendor_specific_high(IN const uint8_t class_code)
600219820Sjeff{
601219820Sjeff	return ((class_code >= IB_MCLASS_VENDOR_HIGH_RANGE_MIN) &&
602219820Sjeff		(class_code <= IB_MCLASS_VENDOR_HIGH_RANGE_MAX));
603219820Sjeff}
604219820Sjeff
605219820Sjeff/*
606219820Sjeff* PARAMETERS
607219820Sjeff*	class_code
608219820Sjeff*		[in] The Management Datagram Class Code
609219820Sjeff*
610219820Sjeff* RETURN VALUE
611219820Sjeff*	TRUE if the class is in the High range of Vendor Specific MADs
612219820Sjeff*	FALSE otherwise.
613219820Sjeff*
614219820Sjeff* NOTES
615219820Sjeff*
616219820Sjeff* SEE ALSO
617219820Sjeff* IB_MCLASS_VENDOR_HIGH_RANGE_MIN, IB_MCLASS_VENDOR_HIGH_RANGE_MAX
618219820Sjeff*********/
619219820Sjeff
620219820Sjeff/****f* IBA Base: Types/ib_class_is_vendor_specific
621219820Sjeff* NAME
622219820Sjeff*	ib_class_is_vendor_specific
623219820Sjeff*
624219820Sjeff* DESCRIPTION
625219820Sjeff*	Indicates if the Class Code if a vendor specific class
626219820Sjeff*
627219820Sjeff* SYNOPSIS
628219820Sjeff*/
629219820Sjeffstatic inline boolean_t OSM_API
630219820Sjeffib_class_is_vendor_specific(IN const uint8_t class_code)
631219820Sjeff{
632219820Sjeff	return (ib_class_is_vendor_specific_low(class_code) ||
633219820Sjeff		ib_class_is_vendor_specific_high(class_code));
634219820Sjeff}
635219820Sjeff
636219820Sjeff/*
637219820Sjeff* PARAMETERS
638219820Sjeff*	class_code
639219820Sjeff*		[in] The Management Datagram Class Code
640219820Sjeff*
641219820Sjeff* RETURN VALUE
642219820Sjeff*	TRUE if the class is a Vendor Specific MAD
643219820Sjeff*	FALSE otherwise.
644219820Sjeff*
645219820Sjeff* NOTES
646219820Sjeff*
647219820Sjeff* SEE ALSO
648219820Sjeff*  ib_class_is_vendor_specific_low, ib_class_is_vendor_specific_high
649219820Sjeff*********/
650219820Sjeff
651219820Sjeff/****f* IBA Base: Types/ib_class_is_rmpp
652219820Sjeff* NAME
653219820Sjeff*	ib_class_is_rmpp
654219820Sjeff*
655219820Sjeff* DESCRIPTION
656219820Sjeff*	Indicates if the Class Code supports RMPP
657219820Sjeff*
658219820Sjeff* SYNOPSIS
659219820Sjeff*/
660219820Sjeffstatic inline boolean_t OSM_API ib_class_is_rmpp(IN const uint8_t class_code)
661219820Sjeff{
662219820Sjeff	return ((class_code == IB_MCLASS_SUBN_ADM) ||
663219820Sjeff		(class_code == IB_MCLASS_DEV_MGMT) ||
664219820Sjeff		(class_code == IB_MCLASS_DEV_ADM) ||
665219820Sjeff		(class_code == IB_MCLASS_BIS) ||
666219820Sjeff		ib_class_is_vendor_specific_high(class_code));
667219820Sjeff}
668219820Sjeff
669219820Sjeff/*
670219820Sjeff* PARAMETERS
671219820Sjeff*	class_code
672219820Sjeff*		[in] The Management Datagram Class Code
673219820Sjeff*
674219820Sjeff* RETURN VALUE
675219820Sjeff*	TRUE if the class supports RMPP
676219820Sjeff*	FALSE otherwise.
677219820Sjeff*
678219820Sjeff* NOTES
679219820Sjeff*
680219820Sjeff*********/
681219820Sjeff
682219820Sjeff/*
683219820Sjeff *	MAD methods
684219820Sjeff */
685219820Sjeff
686219820Sjeff/****d* IBA Base: Constants/IB_MAX_METHOD
687219820Sjeff* NAME
688219820Sjeff*	IB_MAX_METHOD
689219820Sjeff*
690219820Sjeff* DESCRIPTION
691219820Sjeff*	Total number of methods available to a class, not including the R-bit.
692219820Sjeff*
693219820Sjeff* SOURCE
694219820Sjeff*/
695219820Sjeff#define IB_MAX_METHODS						128
696219820Sjeff/**********/
697219820Sjeff
698219820Sjeff/****d* IBA Base: Constants/IB_MAD_METHOD_RESP_MASK
699219820Sjeff* NAME
700219820Sjeff*	IB_MAD_METHOD_RESP_MASK
701219820Sjeff*
702219820Sjeff* DESCRIPTION
703219820Sjeff*	Response mask to extract 'R' bit from the method field. (13.4.5)
704219820Sjeff*
705219820Sjeff* SOURCE
706219820Sjeff*/
707219820Sjeff#define IB_MAD_METHOD_RESP_MASK				0x80
708219820Sjeff/**********/
709219820Sjeff
710219820Sjeff/****d* IBA Base: Constants/IB_MAD_METHOD_GET
711219820Sjeff* NAME
712219820Sjeff*	IB_MAD_METHOD_GET
713219820Sjeff*
714219820Sjeff* DESCRIPTION
715219820Sjeff*	Get() Method (13.4.5)
716219820Sjeff*
717219820Sjeff* SOURCE
718219820Sjeff*/
719219820Sjeff#define IB_MAD_METHOD_GET					0x01
720219820Sjeff/**********/
721219820Sjeff
722219820Sjeff/****d* IBA Base: Constants/IB_MAD_METHOD_SET
723219820Sjeff* NAME
724219820Sjeff*	IB_MAD_METHOD_SET
725219820Sjeff*
726219820Sjeff* DESCRIPTION
727219820Sjeff*	Set() Method (13.4.5)
728219820Sjeff*
729219820Sjeff* SOURCE
730219820Sjeff*/
731219820Sjeff#define IB_MAD_METHOD_SET					0x02
732219820Sjeff/**********/
733219820Sjeff
734219820Sjeff/****d* IBA Base: Constants/IB_MAD_METHOD_GET_RESP
735219820Sjeff* NAME
736219820Sjeff*	IB_MAD_METHOD_GET_RESP
737219820Sjeff*
738219820Sjeff* DESCRIPTION
739219820Sjeff*	GetResp() Method (13.4.5)
740219820Sjeff*
741219820Sjeff* SOURCE
742219820Sjeff*/
743219820Sjeff#define IB_MAD_METHOD_GET_RESP				0x81
744219820Sjeff/**********/
745219820Sjeff
746219820Sjeff#define IB_MAD_METHOD_DELETE				0x15
747219820Sjeff
748219820Sjeff/****d* IBA Base: Constants/IB_MAD_METHOD_GETTABLE
749219820Sjeff* NAME
750219820Sjeff*	IB_MAD_METHOD_GETTABLE
751219820Sjeff*
752219820Sjeff* DESCRIPTION
753219820Sjeff*	SubnAdmGetTable() Method (15.2.2)
754219820Sjeff*
755219820Sjeff* SOURCE
756219820Sjeff*/
757219820Sjeff#define IB_MAD_METHOD_GETTABLE				0x12
758219820Sjeff/**********/
759219820Sjeff
760219820Sjeff/****d* IBA Base: Constants/IB_MAD_METHOD_GETTABLE_RESP
761219820Sjeff* NAME
762219820Sjeff*	IB_MAD_METHOD_GETTABLE_RESP
763219820Sjeff*
764219820Sjeff* DESCRIPTION
765219820Sjeff*	SubnAdmGetTableResp() Method (15.2.2)
766219820Sjeff*
767219820Sjeff* SOURCE
768219820Sjeff*/
769219820Sjeff#define IB_MAD_METHOD_GETTABLE_RESP			0x92
770219820Sjeff
771219820Sjeff/**********/
772219820Sjeff
773219820Sjeff#define IB_MAD_METHOD_GETTRACETABLE			0x13
774219820Sjeff#define IB_MAD_METHOD_GETMULTI				0x14
775219820Sjeff#define IB_MAD_METHOD_GETMULTI_RESP			0x94
776219820Sjeff
777219820Sjeff/****d* IBA Base: Constants/IB_MAD_METHOD_SEND
778219820Sjeff* NAME
779219820Sjeff*	IB_MAD_METHOD_SEND
780219820Sjeff*
781219820Sjeff* DESCRIPTION
782219820Sjeff*	Send() Method (13.4.5)
783219820Sjeff*
784219820Sjeff* SOURCE
785219820Sjeff*/
786219820Sjeff#define IB_MAD_METHOD_SEND					0x03
787219820Sjeff/**********/
788219820Sjeff
789219820Sjeff/****d* IBA Base: Constants/IB_MAD_METHOD_TRAP
790219820Sjeff* NAME
791219820Sjeff*	IB_MAD_METHOD_TRAP
792219820Sjeff*
793219820Sjeff* DESCRIPTION
794219820Sjeff*	Trap() Method (13.4.5)
795219820Sjeff*
796219820Sjeff* SOURCE
797219820Sjeff*/
798219820Sjeff#define IB_MAD_METHOD_TRAP					0x05
799219820Sjeff/**********/
800219820Sjeff
801219820Sjeff/****d* IBA Base: Constants/IB_MAD_METHOD_REPORT
802219820Sjeff* NAME
803219820Sjeff*	IB_MAD_METHOD_REPORT
804219820Sjeff*
805219820Sjeff* DESCRIPTION
806219820Sjeff*	Report() Method (13.4.5)
807219820Sjeff*
808219820Sjeff* SOURCE
809219820Sjeff*/
810219820Sjeff#define IB_MAD_METHOD_REPORT				0x06
811219820Sjeff/**********/
812219820Sjeff
813219820Sjeff/****d* IBA Base: Constants/IB_MAD_METHOD_REPORT_RESP
814219820Sjeff* NAME
815219820Sjeff*	IB_MAD_METHOD_REPORT_RESP
816219820Sjeff*
817219820Sjeff* DESCRIPTION
818219820Sjeff*	ReportResp() Method (13.4.5)
819219820Sjeff*
820219820Sjeff* SOURCE
821219820Sjeff*/
822219820Sjeff#define IB_MAD_METHOD_REPORT_RESP			0x86
823219820Sjeff/**********/
824219820Sjeff
825219820Sjeff/****d* IBA Base: Constants/IB_MAD_METHOD_TRAP_REPRESS
826219820Sjeff* NAME
827219820Sjeff*	IB_MAD_METHOD_TRAP_REPRESS
828219820Sjeff*
829219820Sjeff* DESCRIPTION
830219820Sjeff*	TrapRepress() Method (13.4.5)
831219820Sjeff*
832219820Sjeff* SOURCE
833219820Sjeff*/
834219820Sjeff#define IB_MAD_METHOD_TRAP_REPRESS			0x07
835219820Sjeff/**********/
836219820Sjeff
837219820Sjeff/****d* IBA Base: Constants/IB_MAD_STATUS_BUSY
838219820Sjeff* NAME
839219820Sjeff*	IB_MAD_STATUS_BUSY
840219820Sjeff*
841219820Sjeff* DESCRIPTION
842219820Sjeff*	Temporarily busy, MAD discarded (13.4.7)
843219820Sjeff*
844219820Sjeff* SOURCE
845219820Sjeff*/
846219820Sjeff#define IB_MAD_STATUS_BUSY				(CL_HTON16(0x0001))
847219820Sjeff/**********/
848219820Sjeff
849219820Sjeff/****d* IBA Base: Constants/IB_MAD_STATUS_REDIRECT
850219820Sjeff* NAME
851219820Sjeff*	IB_MAD_STATUS_REDIRECT
852219820Sjeff*
853219820Sjeff* DESCRIPTION
854219820Sjeff*	QP Redirection required (13.4.7)
855219820Sjeff*
856219820Sjeff* SOURCE
857219820Sjeff*/
858219820Sjeff#define IB_MAD_STATUS_REDIRECT				(CL_HTON16(0x0002))
859219820Sjeff/**********/
860219820Sjeff
861219820Sjeff/****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_CLASS_VER
862219820Sjeff* NAME
863219820Sjeff*	IB_MAD_STATUS_UNSUP_CLASS_VER
864219820Sjeff*
865219820Sjeff* DESCRIPTION
866219820Sjeff*	Unsupported class version (13.4.7)
867219820Sjeff*
868219820Sjeff* SOURCE
869219820Sjeff*/
870219820Sjeff#define IB_MAD_STATUS_UNSUP_CLASS_VER			(CL_HTON16(0x0004))
871219820Sjeff/**********/
872219820Sjeff
873219820Sjeff/****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_METHOD
874219820Sjeff* NAME
875219820Sjeff*	IB_MAD_STATUS_UNSUP_METHOD
876219820Sjeff*
877219820Sjeff* DESCRIPTION
878219820Sjeff*	Unsupported method (13.4.7)
879219820Sjeff*
880219820Sjeff* SOURCE
881219820Sjeff*/
882219820Sjeff#define IB_MAD_STATUS_UNSUP_METHOD			(CL_HTON16(0x0008))
883219820Sjeff/**********/
884219820Sjeff
885219820Sjeff/****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_METHOD_ATTR
886219820Sjeff* NAME
887219820Sjeff*	IB_MAD_STATUS_UNSUP_METHOD_ATTR
888219820Sjeff*
889219820Sjeff* DESCRIPTION
890219820Sjeff*	Unsupported method/attribute combination (13.4.7)
891219820Sjeff*
892219820Sjeff* SOURCE
893219820Sjeff*/
894219820Sjeff#define IB_MAD_STATUS_UNSUP_METHOD_ATTR			(CL_HTON16(0x000C))
895219820Sjeff/**********/
896219820Sjeff
897219820Sjeff/****d* IBA Base: Constants/IB_MAD_STATUS_INVALID_FIELD
898219820Sjeff* NAME
899219820Sjeff*	IB_MAD_STATUS_INVALID_FIELD
900219820Sjeff*
901219820Sjeff* DESCRIPTION
902219820Sjeff*	Attribute contains one or more invalid fields (13.4.7)
903219820Sjeff*
904219820Sjeff* SOURCE
905219820Sjeff*/
906219820Sjeff#define IB_MAD_STATUS_INVALID_FIELD			(CL_HTON16(0x001C))
907219820Sjeff/**********/
908219820Sjeff
909219820Sjeff#define IB_MAD_STATUS_CLASS_MASK			(CL_HTON16(0xFF00))
910219820Sjeff
911219820Sjeff#define IB_SA_MAD_STATUS_SUCCESS			(CL_HTON16(0x0000))
912219820Sjeff#define IB_SA_MAD_STATUS_NO_RESOURCES			(CL_HTON16(0x0100))
913219820Sjeff#define IB_SA_MAD_STATUS_REQ_INVALID			(CL_HTON16(0x0200))
914219820Sjeff#define IB_SA_MAD_STATUS_NO_RECORDS			(CL_HTON16(0x0300))
915219820Sjeff#define IB_SA_MAD_STATUS_TOO_MANY_RECORDS		(CL_HTON16(0x0400))
916219820Sjeff#define IB_SA_MAD_STATUS_INVALID_GID			(CL_HTON16(0x0500))
917219820Sjeff#define IB_SA_MAD_STATUS_INSUF_COMPS			(CL_HTON16(0x0600))
918219820Sjeff#define IB_SA_MAD_STATUS_DENIED				(CL_HTON16(0x0700))
919219820Sjeff#define IB_SA_MAD_STATUS_PRIO_SUGGESTED			(CL_HTON16(0x0800))
920219820Sjeff
921219820Sjeff#define IB_DM_MAD_STATUS_NO_IOC_RESP			(CL_HTON16(0x0100))
922219820Sjeff#define IB_DM_MAD_STATUS_NO_SVC_ENTRIES			(CL_HTON16(0x0200))
923219820Sjeff#define IB_DM_MAD_STATUS_IOC_FAILURE			(CL_HTON16(0x8000))
924219820Sjeff
925219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_CLASS_PORT_INFO
926219820Sjeff* NAME
927219820Sjeff*	IB_MAD_ATTR_CLASS_PORT_INFO
928219820Sjeff*
929219820Sjeff* DESCRIPTION
930219820Sjeff*	ClassPortInfo attribute (13.4.8)
931219820Sjeff*
932219820Sjeff* SOURCE
933219820Sjeff*/
934219820Sjeff#define IB_MAD_ATTR_CLASS_PORT_INFO			(CL_HTON16(0x0001))
935219820Sjeff/**********/
936219820Sjeff
937219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_NOTICE
938219820Sjeff* NAME
939219820Sjeff*	IB_MAD_ATTR_NOTICE
940219820Sjeff*
941219820Sjeff* DESCRIPTION
942219820Sjeff*	Notice attribute (13.4.8)
943219820Sjeff*
944219820Sjeff* SOURCE
945219820Sjeff*/
946219820Sjeff#define IB_MAD_ATTR_NOTICE					(CL_HTON16(0x0002))
947219820Sjeff/**********/
948219820Sjeff
949219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_INFORM_INFO
950219820Sjeff* NAME
951219820Sjeff*	IB_MAD_ATTR_INFORM_INFO
952219820Sjeff*
953219820Sjeff* DESCRIPTION
954219820Sjeff*	InformInfo attribute (13.4.8)
955219820Sjeff*
956219820Sjeff* SOURCE
957219820Sjeff*/
958219820Sjeff#define IB_MAD_ATTR_INFORM_INFO				(CL_HTON16(0x0003))
959219820Sjeff/**********/
960219820Sjeff
961219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_NODE_DESC
962219820Sjeff* NAME
963219820Sjeff*	IB_MAD_ATTR_NODE_DESC
964219820Sjeff*
965219820Sjeff* DESCRIPTION
966219820Sjeff*	NodeDescription attribute (14.2.5)
967219820Sjeff*
968219820Sjeff* SOURCE
969219820Sjeff*/
970219820Sjeff#define IB_MAD_ATTR_NODE_DESC				(CL_HTON16(0x0010))
971219820Sjeff
972219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_SMPL_CTRL
973219820Sjeff* NAME
974219820Sjeff*	IB_MAD_ATTR_PORT_SMPL_CTRL
975219820Sjeff*
976219820Sjeff* DESCRIPTION
977219820Sjeff*	PortSamplesControl attribute (16.1.3)
978219820Sjeff*
979219820Sjeff* SOURCE
980219820Sjeff*/
981219820Sjeff#define IB_MAD_ATTR_PORT_SMPL_CTRL			(CL_HTON16(0x0010))
982219820Sjeff/**********/
983219820Sjeff
984219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_NODE_INFO
985219820Sjeff* NAME
986219820Sjeff*	IB_MAD_ATTR_NODE_INFO
987219820Sjeff*
988219820Sjeff* DESCRIPTION
989219820Sjeff*	NodeInfo attribute (14.2.5)
990219820Sjeff*
991219820Sjeff* SOURCE
992219820Sjeff*/
993219820Sjeff#define IB_MAD_ATTR_NODE_INFO				(CL_HTON16(0x0011))
994219820Sjeff/**********/
995219820Sjeff
996219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_SMPL_RSLT
997219820Sjeff* NAME
998219820Sjeff*	IB_MAD_ATTR_PORT_SMPL_RSLT
999219820Sjeff*
1000219820Sjeff* DESCRIPTION
1001219820Sjeff*	PortSamplesResult attribute (16.1.3)
1002219820Sjeff*
1003219820Sjeff* SOURCE
1004219820Sjeff*/
1005219820Sjeff#define IB_MAD_ATTR_PORT_SMPL_RSLT			(CL_HTON16(0x0011))
1006219820Sjeff/**********/
1007219820Sjeff
1008219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_SWITCH_INFO
1009219820Sjeff* NAME
1010219820Sjeff*	IB_MAD_ATTR_SWITCH_INFO
1011219820Sjeff*
1012219820Sjeff* DESCRIPTION
1013219820Sjeff*	SwitchInfo attribute (14.2.5)
1014219820Sjeff*
1015219820Sjeff* SOURCE
1016219820Sjeff*/
1017219820Sjeff#define IB_MAD_ATTR_SWITCH_INFO				(CL_HTON16(0x0012))
1018219820Sjeff/**********/
1019219820Sjeff
1020219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_CNTRS
1021219820Sjeff* NAME
1022219820Sjeff*	IB_MAD_ATTR_PORT_CNTRS
1023219820Sjeff*
1024219820Sjeff* DESCRIPTION
1025219820Sjeff*	PortCounters attribute (16.1.3)
1026219820Sjeff*
1027219820Sjeff* SOURCE
1028219820Sjeff*/
1029219820Sjeff#define IB_MAD_ATTR_PORT_CNTRS				(CL_HTON16(0x0012))
1030219820Sjeff/**********/
1031219820Sjeff
1032219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_GUID_INFO
1033219820Sjeff* NAME
1034219820Sjeff*	IB_MAD_ATTR_GUID_INFO
1035219820Sjeff*
1036219820Sjeff* DESCRIPTION
1037219820Sjeff*	GUIDInfo attribute (14.2.5)
1038219820Sjeff*
1039219820Sjeff* SOURCE
1040219820Sjeff*/
1041219820Sjeff#define IB_MAD_ATTR_GUID_INFO				(CL_HTON16(0x0014))
1042219820Sjeff/**********/
1043219820Sjeff
1044219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_INFO
1045219820Sjeff* NAME
1046219820Sjeff*	IB_MAD_ATTR_PORT_INFO
1047219820Sjeff*
1048219820Sjeff* DESCRIPTION
1049219820Sjeff*	PortInfo attribute (14.2.5)
1050219820Sjeff*
1051219820Sjeff* SOURCE
1052219820Sjeff*/
1053219820Sjeff#define IB_MAD_ATTR_PORT_INFO				(CL_HTON16(0x0015))
1054219820Sjeff/**********/
1055219820Sjeff
1056219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_P_KEY_TABLE
1057219820Sjeff* NAME
1058219820Sjeff*	IB_MAD_ATTR_P_KEY_TABLE
1059219820Sjeff*
1060219820Sjeff* DESCRIPTION
1061219820Sjeff*	PartitionTable attribute (14.2.5)
1062219820Sjeff*
1063219820Sjeff* SOURCE
1064219820Sjeff*/
1065219820Sjeff#define IB_MAD_ATTR_P_KEY_TABLE				(CL_HTON16(0x0016))
1066219820Sjeff/**********/
1067219820Sjeff
1068219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_SLVL_TABLE
1069219820Sjeff* NAME
1070219820Sjeff*	IB_MAD_ATTR_SLVL_TABLE
1071219820Sjeff*
1072219820Sjeff* DESCRIPTION
1073219820Sjeff*	SL VL Mapping Table attribute (14.2.5)
1074219820Sjeff*
1075219820Sjeff* SOURCE
1076219820Sjeff*/
1077219820Sjeff#define IB_MAD_ATTR_SLVL_TABLE				(CL_HTON16(0x0017))
1078219820Sjeff/**********/
1079219820Sjeff
1080219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_VL_ARBITRATION
1081219820Sjeff* NAME
1082219820Sjeff*	IB_MAD_ATTR_VL_ARBITRATION
1083219820Sjeff*
1084219820Sjeff* DESCRIPTION
1085219820Sjeff*	VL Arbitration Table attribute (14.2.5)
1086219820Sjeff*
1087219820Sjeff* SOURCE
1088219820Sjeff*/
1089219820Sjeff#define IB_MAD_ATTR_VL_ARBITRATION			(CL_HTON16(0x0018))
1090219820Sjeff/**********/
1091219820Sjeff
1092219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_LIN_FWD_TBL
1093219820Sjeff* NAME
1094219820Sjeff*	IB_MAD_ATTR_LIN_FWD_TBL
1095219820Sjeff*
1096219820Sjeff* DESCRIPTION
1097219820Sjeff*	Switch linear forwarding table
1098219820Sjeff*
1099219820Sjeff* SOURCE
1100219820Sjeff*/
1101219820Sjeff#define IB_MAD_ATTR_LIN_FWD_TBL				(CL_HTON16(0x0019))
1102219820Sjeff/**********/
1103219820Sjeff
1104219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_RND_FWD_TBL
1105219820Sjeff* NAME
1106219820Sjeff*	IB_MAD_ATTR_RND_FWD_TBL
1107219820Sjeff*
1108219820Sjeff* DESCRIPTION
1109219820Sjeff*	Switch random forwarding table
1110219820Sjeff*
1111219820Sjeff* SOURCE
1112219820Sjeff*/
1113219820Sjeff#define IB_MAD_ATTR_RND_FWD_TBL				(CL_HTON16(0x001A))
1114219820Sjeff/**********/
1115219820Sjeff
1116219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_MCAST_FWD_TBL
1117219820Sjeff* NAME
1118219820Sjeff*	IB_MAD_ATTR_MCAST_FWD_TBL
1119219820Sjeff*
1120219820Sjeff* DESCRIPTION
1121219820Sjeff*	Switch multicast forwarding table
1122219820Sjeff*
1123219820Sjeff* SOURCE
1124219820Sjeff*/
1125219820Sjeff#define IB_MAD_ATTR_MCAST_FWD_TBL			(CL_HTON16(0x001B))
1126219820Sjeff/**********/
1127219820Sjeff
1128219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_NODE_RECORD
1129219820Sjeff* NAME
1130219820Sjeff*	IB_MAD_ATTR_NODE_RECORD
1131219820Sjeff*
1132219820Sjeff* DESCRIPTION
1133219820Sjeff*	NodeRecord attribute (15.2.5)
1134219820Sjeff*
1135219820Sjeff* SOURCE
1136219820Sjeff*/
1137219820Sjeff#define IB_MAD_ATTR_NODE_RECORD				(CL_HTON16(0x0011))
1138219820Sjeff/**********/
1139219820Sjeff
1140219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_PORTINFO_RECORD
1141219820Sjeff* NAME
1142219820Sjeff*	IB_MAD_ATTR_PORTINFO_RECORD
1143219820Sjeff*
1144219820Sjeff* DESCRIPTION
1145219820Sjeff*	PortInfoRecord attribute (15.2.5)
1146219820Sjeff*
1147219820Sjeff* SOURCE
1148219820Sjeff*/
1149219820Sjeff#define IB_MAD_ATTR_PORTINFO_RECORD			(CL_HTON16(0x0012))
1150219820Sjeff/**********/
1151219820Sjeff
1152219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_SWITCH_INFO_RECORD
1153219820Sjeff* NAME
1154219820Sjeff*       IB_MAD_ATTR_SWITCH_INFO_RECORD
1155219820Sjeff*
1156219820Sjeff* DESCRIPTION
1157219820Sjeff*       SwitchInfoRecord attribute (15.2.5)
1158219820Sjeff*
1159219820Sjeff* SOURCE
1160219820Sjeff*/
1161219820Sjeff#define IB_MAD_ATTR_SWITCH_INFO_RECORD			(CL_HTON16(0x0014))
1162219820Sjeff/**********/
1163219820Sjeff
1164219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_LINK_RECORD
1165219820Sjeff* NAME
1166219820Sjeff*	IB_MAD_ATTR_LINK_RECORD
1167219820Sjeff*
1168219820Sjeff* DESCRIPTION
1169219820Sjeff*	LinkRecord attribute (15.2.5)
1170219820Sjeff*
1171219820Sjeff* SOURCE
1172219820Sjeff*/
1173219820Sjeff#define IB_MAD_ATTR_LINK_RECORD				(CL_HTON16(0x0020))
1174219820Sjeff/**********/
1175219820Sjeff
1176219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_SM_INFO
1177219820Sjeff* NAME
1178219820Sjeff*	IB_MAD_ATTR_SM_INFO
1179219820Sjeff*
1180219820Sjeff* DESCRIPTION
1181219820Sjeff*	SMInfo attribute (14.2.5)
1182219820Sjeff*
1183219820Sjeff* SOURCE
1184219820Sjeff*/
1185219820Sjeff#define IB_MAD_ATTR_SM_INFO				(CL_HTON16(0x0020))
1186219820Sjeff/**********/
1187219820Sjeff
1188219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_SMINFO_RECORD
1189219820Sjeff* NAME
1190219820Sjeff*	IB_MAD_ATTR_SMINFO_RECORD
1191219820Sjeff*
1192219820Sjeff* DESCRIPTION
1193219820Sjeff*	SMInfoRecord attribute (15.2.5)
1194219820Sjeff*
1195219820Sjeff* SOURCE
1196219820Sjeff*/
1197219820Sjeff#define IB_MAD_ATTR_SMINFO_RECORD			(CL_HTON16(0x0018))
1198219820Sjeff/**********/
1199219820Sjeff
1200219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_GUIDINFO_RECORD
1201219820Sjeff* NAME
1202219820Sjeff*       IB_MAD_ATTR_GUIDINFO_RECORD
1203219820Sjeff*
1204219820Sjeff* DESCRIPTION
1205219820Sjeff*       GuidInfoRecord attribute (15.2.5)
1206219820Sjeff*
1207219820Sjeff* SOURCE
1208219820Sjeff*/
1209219820Sjeff#define IB_MAD_ATTR_GUIDINFO_RECORD			(CL_HTON16(0x0030))
1210219820Sjeff/**********/
1211219820Sjeff
1212219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_VENDOR_DIAG
1213219820Sjeff* NAME
1214219820Sjeff*	IB_MAD_ATTR_VENDOR_DIAG
1215219820Sjeff*
1216219820Sjeff* DESCRIPTION
1217219820Sjeff*	VendorDiag attribute (14.2.5)
1218219820Sjeff*
1219219820Sjeff* SOURCE
1220219820Sjeff*/
1221219820Sjeff#define IB_MAD_ATTR_VENDOR_DIAG				(CL_HTON16(0x0030))
1222219820Sjeff/**********/
1223219820Sjeff
1224219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_LED_INFO
1225219820Sjeff* NAME
1226219820Sjeff*	IB_MAD_ATTR_LED_INFO
1227219820Sjeff*
1228219820Sjeff* DESCRIPTION
1229219820Sjeff*	LedInfo attribute (14.2.5)
1230219820Sjeff*
1231219820Sjeff* SOURCE
1232219820Sjeff*/
1233219820Sjeff#define IB_MAD_ATTR_LED_INFO				(CL_HTON16(0x0031))
1234219820Sjeff/**********/
1235219820Sjeff
1236219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_SERVICE_RECORD
1237219820Sjeff* NAME
1238219820Sjeff*	IB_MAD_ATTR_SERVICE_RECORD
1239219820Sjeff*
1240219820Sjeff* DESCRIPTION
1241219820Sjeff*	ServiceRecord attribute (15.2.5)
1242219820Sjeff*
1243219820Sjeff* SOURCE
1244219820Sjeff*/
1245219820Sjeff#define IB_MAD_ATTR_SERVICE_RECORD			(CL_HTON16(0x0031))
1246219820Sjeff/**********/
1247219820Sjeff
1248219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_LFT_RECORD
1249219820Sjeff* NAME
1250219820Sjeff*	IB_MAD_ATTR_LFT_RECORD
1251219820Sjeff*
1252219820Sjeff* DESCRIPTION
1253219820Sjeff*	LinearForwardingTableRecord attribute (15.2.5.6)
1254219820Sjeff*
1255219820Sjeff* SOURCE
1256219820Sjeff*/
1257219820Sjeff#define IB_MAD_ATTR_LFT_RECORD				(CL_HTON16(0x0015))
1258219820Sjeff/**********/
1259219820Sjeff
1260219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_MFT_RECORD
1261219820Sjeff* NAME
1262219820Sjeff*       IB_MAD_ATTR_MFT_RECORD
1263219820Sjeff*
1264219820Sjeff* DESCRIPTION
1265219820Sjeff*       MulticastForwardingTableRecord attribute (15.2.5.8)
1266219820Sjeff*
1267219820Sjeff* SOURCE
1268219820Sjeff*/
1269219820Sjeff#define IB_MAD_ATTR_MFT_RECORD				(CL_HTON16(0x0017))
1270219820Sjeff/**********/
1271219820Sjeff
1272219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_PKEYTBL_RECORD
1273219820Sjeff* NAME
1274219820Sjeff*	IB_MAD_ATTR_PKEYTBL_RECORD
1275219820Sjeff*
1276219820Sjeff* DESCRIPTION
1277219820Sjeff*	PKEY Table Record attribute (15.2.5)
1278219820Sjeff*
1279219820Sjeff* SOURCE
1280219820Sjeff*/
1281219820Sjeff#define IB_MAD_ATTR_PKEY_TBL_RECORD			(CL_HTON16(0x0033))
1282219820Sjeff/**********/
1283219820Sjeff
1284219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_PATH_RECORD
1285219820Sjeff* NAME
1286219820Sjeff*	IB_MAD_ATTR_PATH_RECORD
1287219820Sjeff*
1288219820Sjeff* DESCRIPTION
1289219820Sjeff*	PathRecord attribute (15.2.5)
1290219820Sjeff*
1291219820Sjeff* SOURCE
1292219820Sjeff*/
1293219820Sjeff#define IB_MAD_ATTR_PATH_RECORD				(CL_HTON16(0x0035))
1294219820Sjeff/**********/
1295219820Sjeff
1296219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_VLARB_RECORD
1297219820Sjeff* NAME
1298219820Sjeff*	IB_MAD_ATTR_VLARB_RECORD
1299219820Sjeff*
1300219820Sjeff* DESCRIPTION
1301219820Sjeff*	VL Arbitration Table Record attribute (15.2.5)
1302219820Sjeff*
1303219820Sjeff* SOURCE
1304219820Sjeff*/
1305219820Sjeff#define IB_MAD_ATTR_VLARB_RECORD			(CL_HTON16(0x0036))
1306219820Sjeff/**********/
1307219820Sjeff
1308219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_SLVL_RECORD
1309219820Sjeff* NAME
1310219820Sjeff*	IB_MAD_ATTR_SLVL_RECORD
1311219820Sjeff*
1312219820Sjeff* DESCRIPTION
1313219820Sjeff*	SLtoVL Mapping Table Record attribute (15.2.5)
1314219820Sjeff*
1315219820Sjeff* SOURCE
1316219820Sjeff*/
1317219820Sjeff#define IB_MAD_ATTR_SLVL_RECORD				(CL_HTON16(0x0013))
1318219820Sjeff/**********/
1319219820Sjeff
1320219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_MCMEMBER_RECORD
1321219820Sjeff* NAME
1322219820Sjeff*	IB_MAD_ATTR_MCMEMBER_RECORD
1323219820Sjeff*
1324219820Sjeff* DESCRIPTION
1325219820Sjeff*	MCMemberRecord attribute (15.2.5)
1326219820Sjeff*
1327219820Sjeff* SOURCE
1328219820Sjeff*/
1329219820Sjeff#define IB_MAD_ATTR_MCMEMBER_RECORD			(CL_HTON16(0x0038))
1330219820Sjeff/**********/
1331219820Sjeff
1332219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_TRACE_RECORD
1333219820Sjeff* NAME
1334219820Sjeff*	IB_MAD_ATTR_TRACE_RECORD
1335219820Sjeff*
1336219820Sjeff* DESCRIPTION
1337219820Sjeff*	TraceRecord attribute (15.2.5)
1338219820Sjeff*
1339219820Sjeff* SOURCE
1340219820Sjeff*/
1341219820Sjeff#define IB_MAD_ATTR_TRACE_RECORD			(CL_HTON16(0x0039))
1342219820Sjeff/**********/
1343219820Sjeff
1344219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_MULTIPATH_RECORD
1345219820Sjeff* NAME
1346219820Sjeff*	IB_MAD_ATTR_MULTIPATH_RECORD
1347219820Sjeff*
1348219820Sjeff* DESCRIPTION
1349219820Sjeff*	MultiPathRecord attribute (15.2.5)
1350219820Sjeff*
1351219820Sjeff* SOURCE
1352219820Sjeff*/
1353219820Sjeff#define IB_MAD_ATTR_MULTIPATH_RECORD			(CL_HTON16(0x003A))
1354219820Sjeff/**********/
1355219820Sjeff
1356219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_SVC_ASSOCIATION_RECORD
1357219820Sjeff* NAME
1358219820Sjeff*	IB_MAD_ATTR_SVC_ASSOCIATION_RECORD
1359219820Sjeff*
1360219820Sjeff* DESCRIPTION
1361219820Sjeff*	Service Association Record attribute (15.2.5)
1362219820Sjeff*
1363219820Sjeff* SOURCE
1364219820Sjeff*/
1365219820Sjeff#define IB_MAD_ATTR_SVC_ASSOCIATION_RECORD		(CL_HTON16(0x003B))
1366219820Sjeff/**********/
1367219820Sjeff
1368219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_INFORM_INFO_RECORD
1369219820Sjeff* NAME
1370219820Sjeff*	IB_MAD_ATTR_INFORM_INFO_RECORD
1371219820Sjeff*
1372219820Sjeff* DESCRIPTION
1373219820Sjeff*	InformInfo Record attribute (15.2.5)
1374219820Sjeff*
1375219820Sjeff* SOURCE
1376219820Sjeff*/
1377219820Sjeff#define IB_MAD_ATTR_INFORM_INFO_RECORD			(CL_HTON16(0x00F3))
1378219820Sjeff
1379219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_IO_UNIT_INFO
1380219820Sjeff* NAME
1381219820Sjeff*	IB_MAD_ATTR_IO_UNIT_INFO
1382219820Sjeff*
1383219820Sjeff* DESCRIPTION
1384219820Sjeff*	IOUnitInfo attribute (16.3.3)
1385219820Sjeff*
1386219820Sjeff* SOURCE
1387219820Sjeff*/
1388219820Sjeff#define IB_MAD_ATTR_IO_UNIT_INFO			(CL_HTON16(0x0010))
1389219820Sjeff/**********/
1390219820Sjeff
1391219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_IO_CONTROLLER_PROFILE
1392219820Sjeff* NAME
1393219820Sjeff*	IB_MAD_ATTR_IO_CONTROLLER_PROFILE
1394219820Sjeff*
1395219820Sjeff* DESCRIPTION
1396219820Sjeff*	IOControllerProfile attribute (16.3.3)
1397219820Sjeff*
1398219820Sjeff* SOURCE
1399219820Sjeff*/
1400219820Sjeff#define IB_MAD_ATTR_IO_CONTROLLER_PROFILE	(CL_HTON16(0x0011))
1401219820Sjeff/**********/
1402219820Sjeff
1403219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_SERVICE_ENTRIES
1404219820Sjeff* NAME
1405219820Sjeff*	IB_MAD_ATTR_SERVICE_ENTRIES
1406219820Sjeff*
1407219820Sjeff* DESCRIPTION
1408219820Sjeff*	ServiceEntries attribute (16.3.3)
1409219820Sjeff*
1410219820Sjeff* SOURCE
1411219820Sjeff*/
1412219820Sjeff#define IB_MAD_ATTR_SERVICE_ENTRIES			(CL_HTON16(0x0012))
1413219820Sjeff/**********/
1414219820Sjeff
1415219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT
1416219820Sjeff* NAME
1417219820Sjeff*	IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT
1418219820Sjeff*
1419219820Sjeff* DESCRIPTION
1420219820Sjeff*	DiagnosticTimeout attribute (16.3.3)
1421219820Sjeff*
1422219820Sjeff* SOURCE
1423219820Sjeff*/
1424219820Sjeff#define IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT		(CL_HTON16(0x0020))
1425219820Sjeff/**********/
1426219820Sjeff
1427219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_PREPARE_TO_TEST
1428219820Sjeff* NAME
1429219820Sjeff*	IB_MAD_ATTR_PREPARE_TO_TEST
1430219820Sjeff*
1431219820Sjeff* DESCRIPTION
1432219820Sjeff*	PrepareToTest attribute (16.3.3)
1433219820Sjeff*
1434219820Sjeff* SOURCE
1435219820Sjeff*/
1436219820Sjeff#define IB_MAD_ATTR_PREPARE_TO_TEST			(CL_HTON16(0x0021))
1437219820Sjeff/**********/
1438219820Sjeff
1439219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_TEST_DEVICE_ONCE
1440219820Sjeff* NAME
1441219820Sjeff*	IB_MAD_ATTR_TEST_DEVICE_ONCE
1442219820Sjeff*
1443219820Sjeff* DESCRIPTION
1444219820Sjeff*	TestDeviceOnce attribute (16.3.3)
1445219820Sjeff*
1446219820Sjeff* SOURCE
1447219820Sjeff*/
1448219820Sjeff#define IB_MAD_ATTR_TEST_DEVICE_ONCE		(CL_HTON16(0x0022))
1449219820Sjeff/**********/
1450219820Sjeff
1451219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_TEST_DEVICE_LOOP
1452219820Sjeff* NAME
1453219820Sjeff*	IB_MAD_ATTR_TEST_DEVICE_LOOP
1454219820Sjeff*
1455219820Sjeff* DESCRIPTION
1456219820Sjeff*	TestDeviceLoop attribute (16.3.3)
1457219820Sjeff*
1458219820Sjeff* SOURCE
1459219820Sjeff*/
1460219820Sjeff#define IB_MAD_ATTR_TEST_DEVICE_LOOP		(CL_HTON16(0x0023))
1461219820Sjeff/**********/
1462219820Sjeff
1463219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_DIAG_CODE
1464219820Sjeff* NAME
1465219820Sjeff*	IB_MAD_ATTR_DIAG_CODE
1466219820Sjeff*
1467219820Sjeff* DESCRIPTION
1468219820Sjeff*	DiagCode attribute (16.3.3)
1469219820Sjeff*
1470219820Sjeff* SOURCE
1471219820Sjeff*/
1472219820Sjeff#define IB_MAD_ATTR_DIAG_CODE				(CL_HTON16(0x0024))
1473219820Sjeff/**********/
1474219820Sjeff
1475219820Sjeff/****d* IBA Base: Constants/IB_MAD_ATTR_SVC_ASSOCIATION_RECORD
1476219820Sjeff* NAME
1477219820Sjeff*	IB_MAD_ATTR_SVC_ASSOCIATION_RECORD
1478219820Sjeff*
1479219820Sjeff* DESCRIPTION
1480219820Sjeff*	Service Association Record attribute (15.2.5)
1481219820Sjeff*
1482219820Sjeff* SOURCE
1483219820Sjeff*/
1484219820Sjeff#define IB_MAD_ATTR_SVC_ASSOCIATION_RECORD	(CL_HTON16(0x003B))
1485219820Sjeff/**********/
1486219820Sjeff
1487219820Sjeff/****d* IBA Base: Constants/IB_NODE_TYPE_CA
1488219820Sjeff* NAME
1489219820Sjeff*	IB_NODE_TYPE_CA
1490219820Sjeff*
1491219820Sjeff* DESCRIPTION
1492219820Sjeff*	Encoded generic node type used in MAD attributes (13.4.8.2)
1493219820Sjeff*
1494219820Sjeff* SOURCE
1495219820Sjeff*/
1496219820Sjeff#define IB_NODE_TYPE_CA						0x01
1497219820Sjeff/**********/
1498219820Sjeff
1499219820Sjeff/****d* IBA Base: Constants/IB_NODE_TYPE_SWITCH
1500219820Sjeff* NAME
1501219820Sjeff*	IB_NODE_TYPE_SWITCH
1502219820Sjeff*
1503219820Sjeff* DESCRIPTION
1504219820Sjeff*	Encoded generic node type used in MAD attributes (13.4.8.2)
1505219820Sjeff*
1506219820Sjeff* SOURCE
1507219820Sjeff*/
1508219820Sjeff#define IB_NODE_TYPE_SWITCH					0x02
1509219820Sjeff/**********/
1510219820Sjeff
1511219820Sjeff/****d* IBA Base: Constants/IB_NODE_TYPE_ROUTER
1512219820Sjeff* NAME
1513219820Sjeff*	IB_NODE_TYPE_ROUTER
1514219820Sjeff*
1515219820Sjeff* DESCRIPTION
1516219820Sjeff*	Encoded generic node type used in MAD attributes (13.4.8.2)
1517219820Sjeff*
1518219820Sjeff* SOURCE
1519219820Sjeff*/
1520219820Sjeff#define IB_NODE_TYPE_ROUTER					0x03
1521219820Sjeff/**********/
1522219820Sjeff
1523219820Sjeff/****d* IBA Base: Constants/IB_NOTICE_PRODUCER_TYPE_CA
1524219820Sjeff* NAME
1525219820Sjeff*	IB_NOTICE_PRODUCER_TYPE_CA
1526219820Sjeff*
1527219820Sjeff* DESCRIPTION
1528219820Sjeff*	Encoded generic producer type used in Notice attribute (13.4.8.2)
1529219820Sjeff*
1530219820Sjeff* SOURCE
1531219820Sjeff*/
1532219820Sjeff#define IB_NOTICE_PRODUCER_TYPE_CA			(CL_HTON32(0x000001))
1533219820Sjeff/**********/
1534219820Sjeff
1535219820Sjeff/****d* IBA Base: Constants/IB_NOTICE_PRODUCER_TYPE_SWITCH
1536219820Sjeff* NAME
1537219820Sjeff*	IB_NOTICE_PRODUCER_TYPE_SWITCH
1538219820Sjeff*
1539219820Sjeff* DESCRIPTION
1540219820Sjeff*	Encoded generic producer type used in Notice attribute (13.4.8.2)
1541219820Sjeff*
1542219820Sjeff* SOURCE
1543219820Sjeff*/
1544219820Sjeff#define IB_NOTICE_PRODUCER_TYPE_SWITCH			(CL_HTON32(0x000002))
1545219820Sjeff/**********/
1546219820Sjeff
1547219820Sjeff/****d* IBA Base: Constants/IB_NOTICE_PRODUCER_TYPE_ROUTER
1548219820Sjeff* NAME
1549219820Sjeff*	IB_NOTICE_PRODUCER_TYPE_ROUTER
1550219820Sjeff*
1551219820Sjeff* DESCRIPTION
1552219820Sjeff*	Encoded generic producer type used in Notice attribute (13.4.8.2)
1553219820Sjeff*
1554219820Sjeff* SOURCE
1555219820Sjeff*/
1556219820Sjeff#define IB_NOTICE_PRODUCER_TYPE_ROUTER			(CL_HTON32(0x000003))
1557219820Sjeff/**********/
1558219820Sjeff
1559219820Sjeff/****d* IBA Base: Constants/IB_NOTICE_PRODUCER_TYPE_CLASS_MGR
1560219820Sjeff* NAME
1561219820Sjeff*	IB_NOTICE_PRODUCER_TYPE_CLASS_MGR
1562219820Sjeff*
1563219820Sjeff* DESCRIPTION
1564219820Sjeff*	Encoded generic producer type used in Notice attribute (13.4.8.2)
1565219820Sjeff*
1566219820Sjeff* SOURCE
1567219820Sjeff*/
1568219820Sjeff#define IB_NOTICE_PRODUCER_TYPE_CLASS_MGR			(CL_HTON32(0x000004))
1569219820Sjeff/**********/
1570219820Sjeff
1571219820Sjeff/****d* IBA Base: Constants/IB_MTU_LEN_TYPE
1572219820Sjeff* NAME
1573219820Sjeff*	IB_MTU_LEN_TYPE
1574219820Sjeff*
1575219820Sjeff* DESCRIPTION
1576219820Sjeff*	Encoded path MTU.
1577219820Sjeff*		1: 256
1578219820Sjeff*		2: 512
1579219820Sjeff*		3: 1024
1580219820Sjeff*		4: 2048
1581219820Sjeff*		5: 4096
1582219820Sjeff*		others: reserved
1583219820Sjeff*
1584219820Sjeff* SOURCE
1585219820Sjeff*/
1586219820Sjeff#define IB_MTU_LEN_256							1
1587219820Sjeff#define IB_MTU_LEN_512							2
1588219820Sjeff#define IB_MTU_LEN_1024							3
1589219820Sjeff#define IB_MTU_LEN_2048							4
1590219820Sjeff#define IB_MTU_LEN_4096							5
1591219820Sjeff
1592219820Sjeff#define IB_MIN_MTU    IB_MTU_LEN_256
1593219820Sjeff#define IB_MAX_MTU    IB_MTU_LEN_4096
1594219820Sjeff
1595219820Sjeff/**********/
1596219820Sjeff
1597219820Sjeff/****d* IBA Base: Constants/IB_PATH_SELECTOR_TYPE
1598219820Sjeff* NAME
1599219820Sjeff*	IB_PATH_SELECTOR_TYPE
1600219820Sjeff*
1601219820Sjeff* DESCRIPTION
1602219820Sjeff*	Path selector.
1603219820Sjeff*		0: greater than specified
1604219820Sjeff*		1: less than specified
1605219820Sjeff*		2: exactly the specified
1606219820Sjeff*		3: largest available
1607219820Sjeff*
1608219820Sjeff* SOURCE
1609219820Sjeff*/
1610219820Sjeff#define IB_PATH_SELECTOR_GREATER_THAN		0
1611219820Sjeff#define IB_PATH_SELECTOR_LESS_THAN		1
1612219820Sjeff#define IB_PATH_SELECTOR_EXACTLY		2
1613219820Sjeff#define IB_PATH_SELECTOR_LARGEST		3
1614219820Sjeff/**********/
1615219820Sjeff
1616219820Sjeff/****d* IBA Base: Constants/IB_SMINFO_STATE_NOTACTIVE
1617219820Sjeff* NAME
1618219820Sjeff*	IB_SMINFO_STATE_NOTACTIVE
1619219820Sjeff*
1620219820Sjeff* DESCRIPTION
1621219820Sjeff*	Encoded state value used in the SMInfo attribute.
1622219820Sjeff*
1623219820Sjeff* SOURCE
1624219820Sjeff*/
1625219820Sjeff#define IB_SMINFO_STATE_NOTACTIVE			0
1626219820Sjeff/**********/
1627219820Sjeff
1628219820Sjeff/****d* IBA Base: Constants/IB_SMINFO_STATE_DISCOVERING
1629219820Sjeff* NAME
1630219820Sjeff*	IB_SMINFO_STATE_DISCOVERING
1631219820Sjeff*
1632219820Sjeff* DESCRIPTION
1633219820Sjeff*	Encoded state value used in the SMInfo attribute.
1634219820Sjeff*
1635219820Sjeff* SOURCE
1636219820Sjeff*/
1637219820Sjeff#define IB_SMINFO_STATE_DISCOVERING			1
1638219820Sjeff/**********/
1639219820Sjeff
1640219820Sjeff/****d* IBA Base: Constants/IB_SMINFO_STATE_STANDBY
1641219820Sjeff* NAME
1642219820Sjeff*	IB_SMINFO_STATE_STANDBY
1643219820Sjeff*
1644219820Sjeff* DESCRIPTION
1645219820Sjeff*	Encoded state value used in the SMInfo attribute.
1646219820Sjeff*
1647219820Sjeff* SOURCE
1648219820Sjeff*/
1649219820Sjeff#define IB_SMINFO_STATE_STANDBY				2
1650219820Sjeff/**********/
1651219820Sjeff
1652219820Sjeff/****d* IBA Base: Constants/IB_SMINFO_STATE_MASTER
1653219820Sjeff* NAME
1654219820Sjeff*	IB_SMINFO_STATE_MASTER
1655219820Sjeff*
1656219820Sjeff* DESCRIPTION
1657219820Sjeff*	Encoded state value used in the SMInfo attribute.
1658219820Sjeff*
1659219820Sjeff* SOURCE
1660219820Sjeff*/
1661219820Sjeff#define IB_SMINFO_STATE_MASTER				3
1662219820Sjeff/**********/
1663219820Sjeff
1664219820Sjeff/****d* IBA Base: Constants/IB_PATH_REC_SL_MASK
1665219820Sjeff* NAME
1666219820Sjeff*	IB_PATH_REC_SL_MASK
1667219820Sjeff*
1668219820Sjeff* DESCRIPTION
1669219820Sjeff*	Mask for the sl field for path record
1670219820Sjeff*
1671219820Sjeff* SOURCE
1672219820Sjeff*/
1673219820Sjeff#define IB_PATH_REC_SL_MASK				0x000F
1674219820Sjeff
1675219820Sjeff/****d* IBA Base: Constants/IB_MULTIPATH_REC_SL_MASK
1676219820Sjeff* NAME
1677219820Sjeff*	IB_MILTIPATH_REC_SL_MASK
1678219820Sjeff*
1679219820Sjeff* DESCRIPTION
1680219820Sjeff*	Mask for the sl field for MultiPath record
1681219820Sjeff*
1682219820Sjeff* SOURCE
1683219820Sjeff*/
1684219820Sjeff#define IB_MULTIPATH_REC_SL_MASK			0x000F
1685219820Sjeff
1686219820Sjeff/****d* IBA Base: Constants/IB_PATH_REC_QOS_CLASS_MASK
1687219820Sjeff* NAME
1688219820Sjeff*	IB_PATH_REC_QOS_CLASS_MASK
1689219820Sjeff*
1690219820Sjeff* DESCRIPTION
1691219820Sjeff*	Mask for the QoS class field for path record
1692219820Sjeff*
1693219820Sjeff* SOURCE
1694219820Sjeff*/
1695219820Sjeff#define IB_PATH_REC_QOS_CLASS_MASK			0xFFF0
1696219820Sjeff
1697219820Sjeff/****d* IBA Base: Constants/IB_MULTIPATH_REC_QOS_CLASS_MASK
1698219820Sjeff* NAME
1699219820Sjeff*	IB_MULTIPATH_REC_QOS_CLASS_MASK
1700219820Sjeff*
1701219820Sjeff* DESCRIPTION
1702219820Sjeff*	Mask for the QoS class field for MultiPath record
1703219820Sjeff*
1704219820Sjeff* SOURCE
1705219820Sjeff*/
1706219820Sjeff#define IB_MULTIPATH_REC_QOS_CLASS_MASK			0xFFF0
1707219820Sjeff
1708219820Sjeff/****d* IBA Base: Constants/IB_PATH_REC_SELECTOR_MASK
1709219820Sjeff* NAME
1710219820Sjeff*	IB_PATH_REC_SELECTOR_MASK
1711219820Sjeff*
1712219820Sjeff* DESCRIPTION
1713219820Sjeff*	Mask for the selector field for path record MTU, rate,
1714219820Sjeff*	and packet lifetime.
1715219820Sjeff*
1716219820Sjeff* SOURCE
1717219820Sjeff*/
1718219820Sjeff#define IB_PATH_REC_SELECTOR_MASK			0xC0
1719219820Sjeff
1720219820Sjeff/****d* IBA Base: Constants/IB_MULTIPATH_REC_SELECTOR_MASK
1721219820Sjeff* NAME
1722219820Sjeff*       IB_MULTIPATH_REC_SELECTOR_MASK
1723219820Sjeff*
1724219820Sjeff* DESCRIPTION
1725219820Sjeff*       Mask for the selector field for multipath record MTU, rate,
1726219820Sjeff*       and packet lifetime.
1727219820Sjeff*
1728219820Sjeff* SOURCE
1729219820Sjeff*/
1730219820Sjeff#define IB_MULTIPATH_REC_SELECTOR_MASK                       0xC0
1731219820Sjeff/**********/
1732219820Sjeff
1733219820Sjeff/****d* IBA Base: Constants/IB_PATH_REC_BASE_MASK
1734219820Sjeff* NAME
1735219820Sjeff*	IB_PATH_REC_BASE_MASK
1736219820Sjeff*
1737219820Sjeff* DESCRIPTION
1738219820Sjeff*	Mask for the base value field for path record MTU, rate,
1739219820Sjeff*	and packet lifetime.
1740219820Sjeff*
1741219820Sjeff* SOURCE
1742219820Sjeff*/
1743219820Sjeff#define IB_PATH_REC_BASE_MASK				0x3F
1744219820Sjeff/**********/
1745219820Sjeff
1746219820Sjeff/****d* IBA Base: Constants/IB_MULTIPATH_REC_BASE_MASK
1747219820Sjeff* NAME
1748219820Sjeff*       IB_MULTIPATH_REC_BASE_MASK
1749219820Sjeff*
1750219820Sjeff* DESCRIPTION
1751219820Sjeff*       Mask for the base value field for multipath record MTU, rate,
1752219820Sjeff*       and packet lifetime.
1753219820Sjeff*
1754219820Sjeff* SOURCE
1755219820Sjeff*/
1756219820Sjeff#define IB_MULTIPATH_REC_BASE_MASK                      0x3F
1757219820Sjeff/**********/
1758219820Sjeff
1759219820Sjeff/****h* IBA Base/Type Definitions
1760219820Sjeff* NAME
1761219820Sjeff*	Type Definitions
1762219820Sjeff*
1763219820Sjeff* DESCRIPTION
1764219820Sjeff*	Definitions are from the InfiniBand Architecture Specification v1.2
1765219820Sjeff*
1766219820Sjeff*********/
1767219820Sjeff
1768219820Sjeff/****d* IBA Base: Types/ib_net16_t
1769219820Sjeff* NAME
1770219820Sjeff*	ib_net16_t
1771219820Sjeff*
1772219820Sjeff* DESCRIPTION
1773219820Sjeff*	Defines the network ordered type for 16-bit values.
1774219820Sjeff*
1775219820Sjeff* SOURCE
1776219820Sjeff*/
1777219820Sjefftypedef uint16_t ib_net16_t;
1778219820Sjeff/**********/
1779219820Sjeff
1780219820Sjeff/****d* IBA Base: Types/ib_net32_t
1781219820Sjeff* NAME
1782219820Sjeff*	ib_net32_t
1783219820Sjeff*
1784219820Sjeff* DESCRIPTION
1785219820Sjeff*	Defines the network ordered type for 32-bit values.
1786219820Sjeff*
1787219820Sjeff* SOURCE
1788219820Sjeff*/
1789219820Sjefftypedef uint32_t ib_net32_t;
1790219820Sjeff/**********/
1791219820Sjeff
1792219820Sjeff/****d* IBA Base: Types/ib_net64_t
1793219820Sjeff* NAME
1794219820Sjeff*	ib_net64_t
1795219820Sjeff*
1796219820Sjeff* DESCRIPTION
1797219820Sjeff*	Defines the network ordered type for 64-bit values.
1798219820Sjeff*
1799219820Sjeff* SOURCE
1800219820Sjeff*/
1801219820Sjefftypedef uint64_t ib_net64_t;
1802219820Sjeff/**********/
1803219820Sjeff
1804219820Sjeff/****d* IBA Base: Types/ib_gid_prefix_t
1805219820Sjeff* NAME
1806219820Sjeff*	ib_gid_prefix_t
1807219820Sjeff*
1808219820Sjeff* DESCRIPTION
1809219820Sjeff*
1810219820Sjeff* SOURCE
1811219820Sjeff*/
1812219820Sjefftypedef ib_net64_t ib_gid_prefix_t;
1813219820Sjeff/**********/
1814219820Sjeff
1815219820Sjeff/****d* IBA Base: Constants/ib_link_states_t
1816219820Sjeff* NAME
1817219820Sjeff*	ib_link_states_t
1818219820Sjeff*
1819219820Sjeff* DESCRIPTION
1820219820Sjeff*	Defines the link states of a port.
1821219820Sjeff*
1822219820Sjeff* SOURCE
1823219820Sjeff*/
1824219820Sjeff#define IB_LINK_NO_CHANGE 0
1825219820Sjeff#define IB_LINK_DOWN      1
1826219820Sjeff#define IB_LINK_INIT	  2
1827219820Sjeff#define IB_LINK_ARMED     3
1828219820Sjeff#define IB_LINK_ACTIVE    4
1829219820Sjeff#define IB_LINK_ACT_DEFER 5
1830219820Sjeff/**********/
1831219820Sjeff
1832219820Sjeffstatic const char *const __ib_node_type_str[] = {
1833219820Sjeff	"UNKNOWN",
1834219820Sjeff	"Channel Adapter",
1835219820Sjeff	"Switch",
1836219820Sjeff	"Router"
1837219820Sjeff};
1838219820Sjeff
1839219820Sjeff/****f* IBA Base: Types/ib_get_node_type_str
1840219820Sjeff* NAME
1841219820Sjeff*	ib_get_node_type_str
1842219820Sjeff*
1843219820Sjeff* DESCRIPTION
1844219820Sjeff*	Returns a string for the specified node type.
1845219820Sjeff*	14.2.5.3 NodeInfo
1846219820Sjeff*
1847219820Sjeff* SYNOPSIS
1848219820Sjeff*/
1849219820Sjeffstatic inline const char *OSM_API ib_get_node_type_str(IN uint8_t node_type)
1850219820Sjeff{
1851219820Sjeff	if (node_type > IB_NODE_TYPE_ROUTER)
1852219820Sjeff		node_type = 0;
1853219820Sjeff	return (__ib_node_type_str[node_type]);
1854219820Sjeff}
1855219820Sjeff
1856219820Sjeff/*
1857219820Sjeff* PARAMETERS
1858219820Sjeff*	node_type
1859219820Sjeff*		[in] Encoded node type as returned in the NodeInfo attribute.
1860219820Sjeff
1861219820Sjeff* RETURN VALUES
1862219820Sjeff*	Pointer to the node type string.
1863219820Sjeff*
1864219820Sjeff* NOTES
1865219820Sjeff*
1866219820Sjeff* SEE ALSO
1867219820Sjeff* ib_node_info_t
1868219820Sjeff*********/
1869219820Sjeff
1870219820Sjeffstatic const char *const __ib_producer_type_str[] = {
1871219820Sjeff	"UNKNOWN",
1872219820Sjeff	"Channel Adapter",
1873219820Sjeff	"Switch",
1874219820Sjeff	"Router",
1875219820Sjeff	"Class Manager"
1876219820Sjeff};
1877219820Sjeff
1878219820Sjeff/****f* IBA Base: Types/ib_get_producer_type_str
1879219820Sjeff* NAME
1880219820Sjeff*	ib_get_producer_type_str
1881219820Sjeff*
1882219820Sjeff* DESCRIPTION
1883219820Sjeff*	Returns a string for the specified producer type
1884219820Sjeff*	13.4.8.2 Notice
1885219820Sjeff*	13.4.8.3 InformInfo
1886219820Sjeff*
1887219820Sjeff* SYNOPSIS
1888219820Sjeff*/
1889219820Sjeffstatic inline const char *OSM_API
1890219820Sjeffib_get_producer_type_str(IN ib_net32_t producer_type)
1891219820Sjeff{
1892219820Sjeff	if (cl_ntoh32(producer_type) >
1893219820Sjeff	    CL_NTOH32(IB_NOTICE_PRODUCER_TYPE_CLASS_MGR))
1894219820Sjeff		producer_type = 0;
1895219820Sjeff	return (__ib_producer_type_str[cl_ntoh32(producer_type)]);
1896219820Sjeff}
1897219820Sjeff
1898219820Sjeff/*
1899219820Sjeff* PARAMETERS
1900219820Sjeff*	producer_type
1901219820Sjeff*		[in] Encoded producer type from the Notice attribute
1902219820Sjeff
1903219820Sjeff* RETURN VALUES
1904219820Sjeff*	Pointer to the producer type string.
1905219820Sjeff*
1906219820Sjeff* NOTES
1907219820Sjeff*
1908219820Sjeff* SEE ALSO
1909219820Sjeff* ib_notice_get_prod_type
1910219820Sjeff*********/
1911219820Sjeff
1912219820Sjeffstatic const char *const __ib_port_state_str[] = {
1913219820Sjeff	"No State Change (NOP)",
1914219820Sjeff	"DOWN",
1915219820Sjeff	"INIT",
1916219820Sjeff	"ARMED",
1917219820Sjeff	"ACTIVE",
1918219820Sjeff	"ACTDEFER",
1919219820Sjeff	"UNKNOWN"
1920219820Sjeff};
1921219820Sjeff
1922219820Sjeff/****f* IBA Base: Types/ib_get_port_state_str
1923219820Sjeff* NAME
1924219820Sjeff*	ib_get_port_state_str
1925219820Sjeff*
1926219820Sjeff* DESCRIPTION
1927219820Sjeff*	Returns a string for the specified port state.
1928219820Sjeff*
1929219820Sjeff* SYNOPSIS
1930219820Sjeff*/
1931219820Sjeffstatic inline const char *OSM_API ib_get_port_state_str(IN uint8_t port_state)
1932219820Sjeff{
1933219820Sjeff	if (port_state > IB_LINK_ACTIVE)
1934219820Sjeff		port_state = IB_LINK_ACTIVE + 1;
1935219820Sjeff	return (__ib_port_state_str[port_state]);
1936219820Sjeff}
1937219820Sjeff
1938219820Sjeff/*
1939219820Sjeff* PARAMETERS
1940219820Sjeff*	port_state
1941219820Sjeff*		[in] Encoded port state as returned in the PortInfo attribute.
1942219820Sjeff
1943219820Sjeff* RETURN VALUES
1944219820Sjeff*	Pointer to the port state string.
1945219820Sjeff*
1946219820Sjeff* NOTES
1947219820Sjeff*
1948219820Sjeff* SEE ALSO
1949219820Sjeff* ib_port_info_t
1950219820Sjeff*********/
1951219820Sjeff
1952219820Sjeff/****f* IBA Base: Types/ib_get_port_state_from_str
1953219820Sjeff* NAME
1954219820Sjeff*	ib_get_port_state_from_str
1955219820Sjeff*
1956219820Sjeff* DESCRIPTION
1957219820Sjeff*	Returns a string for the specified port state.
1958219820Sjeff*
1959219820Sjeff* SYNOPSIS
1960219820Sjeff*/
1961219820Sjeffstatic inline uint8_t OSM_API
1962219820Sjeffib_get_port_state_from_str(IN char *p_port_state_str)
1963219820Sjeff{
1964219820Sjeff	if (!strncmp(p_port_state_str, "No State Change (NOP)", 12))
1965219820Sjeff		return (0);
1966219820Sjeff	else if (!strncmp(p_port_state_str, "DOWN", 4))
1967219820Sjeff		return (1);
1968219820Sjeff	else if (!strncmp(p_port_state_str, "INIT", 4))
1969219820Sjeff		return (2);
1970219820Sjeff	else if (!strncmp(p_port_state_str, "ARMED", 5))
1971219820Sjeff		return (3);
1972219820Sjeff	else if (!strncmp(p_port_state_str, "ACTIVE", 6))
1973219820Sjeff		return (4);
1974219820Sjeff	else if (!strncmp(p_port_state_str, "ACTDEFER", 8))
1975219820Sjeff		return (5);
1976219820Sjeff	return (6);
1977219820Sjeff}
1978219820Sjeff
1979219820Sjeff/*
1980219820Sjeff* PARAMETERS
1981219820Sjeff*	p_port_state_str
1982219820Sjeff*		[in] A string matching one returned by ib_get_port_state_str
1983219820Sjeff*
1984219820Sjeff* RETURN VALUES
1985219820Sjeff*	The appropriate code.
1986219820Sjeff*
1987219820Sjeff* NOTES
1988219820Sjeff*
1989219820Sjeff* SEE ALSO
1990219820Sjeff*	ib_port_info_t
1991219820Sjeff*********/
1992219820Sjeff
1993219820Sjeff/****d* IBA Base: Constants/Join States
1994219820Sjeff* NAME
1995219820Sjeff*	Join States
1996219820Sjeff*
1997219820Sjeff* DESCRIPTION
1998219820Sjeff*	Defines the join state flags for multicast group management.
1999219820Sjeff*
2000219820Sjeff* SOURCE
2001219820Sjeff*/
2002219820Sjeff#define IB_JOIN_STATE_FULL		1
2003219820Sjeff#define IB_JOIN_STATE_NON		2
2004219820Sjeff#define IB_JOIN_STATE_SEND_ONLY		4
2005219820Sjeff/**********/
2006219820Sjeff
2007219820Sjeff/****f* IBA Base: Types/ib_pkey_get_base
2008219820Sjeff* NAME
2009219820Sjeff*	ib_pkey_get_base
2010219820Sjeff*
2011219820Sjeff* DESCRIPTION
2012219820Sjeff*	Returns the base P_Key value with the membership bit stripped.
2013219820Sjeff*
2014219820Sjeff* SYNOPSIS
2015219820Sjeff*/
2016219820Sjeffstatic inline ib_net16_t OSM_API ib_pkey_get_base(IN const ib_net16_t pkey)
2017219820Sjeff{
2018219820Sjeff	return ((ib_net16_t) (pkey & IB_PKEY_BASE_MASK));
2019219820Sjeff}
2020219820Sjeff
2021219820Sjeff/*
2022219820Sjeff* PARAMETERS
2023219820Sjeff*	pkey
2024219820Sjeff*		[in] P_Key value
2025219820Sjeff*
2026219820Sjeff* RETURN VALUE
2027219820Sjeff*	Returns the base P_Key value with the membership bit stripped.
2028219820Sjeff*
2029219820Sjeff* NOTES
2030219820Sjeff*
2031219820Sjeff* SEE ALSO
2032219820Sjeff*********/
2033219820Sjeff
2034219820Sjeff/****f* IBA Base: Types/ib_pkey_is_full_member
2035219820Sjeff* NAME
2036219820Sjeff*	ib_pkey_is_full_member
2037219820Sjeff*
2038219820Sjeff* DESCRIPTION
2039219820Sjeff*	Indicates if the port is a full member of the parition.
2040219820Sjeff*
2041219820Sjeff* SYNOPSIS
2042219820Sjeff*/
2043219820Sjeffstatic inline boolean_t OSM_API ib_pkey_is_full_member(IN const ib_net16_t pkey)
2044219820Sjeff{
2045219820Sjeff	return ((pkey & IB_PKEY_TYPE_MASK) == IB_PKEY_TYPE_MASK);
2046219820Sjeff}
2047219820Sjeff
2048219820Sjeff/*
2049219820Sjeff* PARAMETERS
2050219820Sjeff*	pkey
2051219820Sjeff*		[in] P_Key value
2052219820Sjeff*
2053219820Sjeff* RETURN VALUE
2054219820Sjeff*	TRUE if the port is a full member of the partition.
2055219820Sjeff*	FALSE otherwise.
2056219820Sjeff*
2057219820Sjeff* NOTES
2058219820Sjeff*
2059219820Sjeff* SEE ALSO
2060219820Sjeff* ib_pkey_get_base, ib_net16_t
2061219820Sjeff*********/
2062219820Sjeff
2063219820Sjeff/****f* IBA Base: Types/ib_pkey_is_invalid
2064219820Sjeff* NAME
2065219820Sjeff*	ib_pkey_is_invalid
2066219820Sjeff*
2067219820Sjeff* DESCRIPTION
2068219820Sjeff*	Returns TRUE if the given P_Key is an invalid P_Key
2069219820Sjeff*  C10-116: the CI shall regard a P_Key as invalid if its low-order
2070219820Sjeff*           15 bits are all zero...
2071219820Sjeff*
2072219820Sjeff* SYNOPSIS
2073219820Sjeff*/
2074219820Sjeffstatic inline boolean_t OSM_API ib_pkey_is_invalid(IN const ib_net16_t pkey)
2075219820Sjeff{
2076219820Sjeff	if (ib_pkey_get_base(pkey) == 0x0000)
2077219820Sjeff		return TRUE;
2078219820Sjeff
2079219820Sjeff	return FALSE;
2080219820Sjeff}
2081219820Sjeff
2082219820Sjeff/*
2083219820Sjeff* PARAMETERS
2084219820Sjeff*	pkey
2085219820Sjeff*		[in] P_Key value
2086219820Sjeff*
2087219820Sjeff* RETURN VALUE
2088219820Sjeff*	Returns the base P_Key value with the membership bit stripped.
2089219820Sjeff*
2090219820Sjeff* NOTES
2091219820Sjeff*
2092219820Sjeff* SEE ALSO
2093219820Sjeff*********/
2094219820Sjeff
2095219820Sjeff/****d* IBA Base: Types/ib_gid_t
2096219820Sjeff* NAME
2097219820Sjeff*	ib_gid_t
2098219820Sjeff*
2099219820Sjeff* DESCRIPTION
2100219820Sjeff*
2101219820Sjeff* SYNOPSIS
2102219820Sjeff*/
2103219820Sjeff#include <complib/cl_packon.h>
2104219820Sjefftypedef union _ib_gid {
2105219820Sjeff	uint8_t raw[16];
2106219820Sjeff	struct _ib_gid_unicast {
2107219820Sjeff		ib_gid_prefix_t prefix;
2108219820Sjeff		ib_net64_t interface_id;
2109219820Sjeff
2110219820Sjeff	} PACK_SUFFIX unicast;
2111219820Sjeff
2112219820Sjeff	struct _ib_gid_multicast {
2113219820Sjeff		uint8_t header[2];
2114219820Sjeff		uint8_t raw_group_id[14];
2115219820Sjeff
2116219820Sjeff	} PACK_SUFFIX multicast;
2117219820Sjeff
2118219820Sjeff} PACK_SUFFIX ib_gid_t;
2119219820Sjeff#include <complib/cl_packoff.h>
2120219820Sjeff/*
2121219820Sjeff* FIELDS
2122219820Sjeff*	raw
2123219820Sjeff*		GID represented as an unformated byte array.
2124219820Sjeff*
2125219820Sjeff*	unicast
2126219820Sjeff*		Typical unicast representation with subnet prefix and
2127219820Sjeff*		port GUID.
2128219820Sjeff*
2129219820Sjeff*	multicast
2130219820Sjeff*		Representation for multicast use.
2131219820Sjeff*
2132219820Sjeff* SEE ALSO
2133219820Sjeff*********/
2134219820Sjeff
2135219820Sjeff/****f* IBA Base: Types/ib_gid_is_multicast
2136219820Sjeff* NAME
2137219820Sjeff*	ib_gid_is_multicast
2138219820Sjeff*
2139219820Sjeff* DESCRIPTION
2140219820Sjeff*       Returns a boolean indicating whether a GID is a multicast GID.
2141219820Sjeff*
2142219820Sjeff* SYNOPSIS
2143219820Sjeff*/
2144219820Sjeffstatic inline boolean_t OSM_API ib_gid_is_multicast(IN const ib_gid_t * p_gid)
2145219820Sjeff{
2146219820Sjeff	return (p_gid->raw[0] == 0xFF);
2147219820Sjeff}
2148219820Sjeff
2149219820Sjeff/****f* IBA Base: Types/ib_gid_get_scope
2150219820Sjeff* NAME
2151219820Sjeff*	ib_gid_get_scope
2152219820Sjeff*
2153219820Sjeff* DESCRIPTION
2154219820Sjeff*	Returns scope of (assumed) multicast GID.
2155219820Sjeff*
2156219820Sjeff* SYNOPSIS
2157219820Sjeff*/
2158219820Sjeffstatic inline uint8_t OSM_API ib_mgid_get_scope(IN const ib_gid_t * p_gid)
2159219820Sjeff{
2160219820Sjeff	return (p_gid->raw[1] & 0x0F);
2161219820Sjeff}
2162219820Sjeff
2163219820Sjeff/****f* IBA Base: Types/ib_gid_set_scope
2164219820Sjeff* NAME
2165219820Sjeff*	ib_gid_set_scope
2166219820Sjeff*
2167219820Sjeff* DESCRIPTION
2168219820Sjeff*	Sets scope of (assumed) multicast GID.
2169219820Sjeff*
2170219820Sjeff* SYNOPSIS
2171219820Sjeff*/
2172219820Sjeffstatic inline void OSM_API
2173219820Sjeffib_mgid_set_scope(IN ib_gid_t * const p_gid, IN const uint8_t scope)
2174219820Sjeff{
2175219820Sjeff	p_gid->raw[1] &= 0xF0;
2176219820Sjeff	p_gid->raw[1] |= scope & 0x0F;
2177219820Sjeff}
2178219820Sjeff
2179219820Sjeff/****f* IBA Base: Types/ib_gid_set_default
2180219820Sjeff* NAME
2181219820Sjeff*	ib_gid_set_default
2182219820Sjeff*
2183219820Sjeff* DESCRIPTION
2184219820Sjeff*	Sets a GID to the default value.
2185219820Sjeff*
2186219820Sjeff* SYNOPSIS
2187219820Sjeff*/
2188219820Sjeffstatic inline void OSM_API
2189219820Sjeffib_gid_set_default(IN ib_gid_t * const p_gid, IN const ib_net64_t interface_id)
2190219820Sjeff{
2191219820Sjeff	p_gid->unicast.prefix = IB_DEFAULT_SUBNET_PREFIX;
2192219820Sjeff	p_gid->unicast.interface_id = interface_id;
2193219820Sjeff}
2194219820Sjeff
2195219820Sjeff/*
2196219820Sjeff* PARAMETERS
2197219820Sjeff*	p_gid
2198219820Sjeff*		[in] Pointer to the GID object.
2199219820Sjeff*
2200219820Sjeff*	interface_id
2201219820Sjeff*		[in] Manufacturer assigned EUI64 value of a port.
2202219820Sjeff*
2203219820Sjeff* RETURN VALUES
2204219820Sjeff*	None.
2205219820Sjeff*
2206219820Sjeff* NOTES
2207219820Sjeff*
2208219820Sjeff* SEE ALSO
2209219820Sjeff*	ib_gid_t
2210219820Sjeff*********/
2211219820Sjeff
2212219820Sjeff/****f* IBA Base: Types/ib_gid_get_subnet_prefix
2213219820Sjeff* NAME
2214219820Sjeff*	ib_gid_get_subnet_prefix
2215219820Sjeff*
2216219820Sjeff* DESCRIPTION
2217219820Sjeff*	Gets the subnet prefix from a GID.
2218219820Sjeff*
2219219820Sjeff* SYNOPSIS
2220219820Sjeff*/
2221219820Sjeffstatic inline ib_net64_t OSM_API
2222219820Sjeffib_gid_get_subnet_prefix(IN const ib_gid_t * const p_gid)
2223219820Sjeff{
2224219820Sjeff	return (p_gid->unicast.prefix);
2225219820Sjeff}
2226219820Sjeff
2227219820Sjeff/*
2228219820Sjeff* PARAMETERS
2229219820Sjeff*	p_gid
2230219820Sjeff*		[in] Pointer to the GID object.
2231219820Sjeff*
2232219820Sjeff* RETURN VALUES
2233219820Sjeff*	64-bit subnet prefix value.
2234219820Sjeff*
2235219820Sjeff* NOTES
2236219820Sjeff*
2237219820Sjeff* SEE ALSO
2238219820Sjeff*	ib_gid_t
2239219820Sjeff*********/
2240219820Sjeff
2241219820Sjeff/****f* IBA Base: Types/ib_gid_is_link_local
2242219820Sjeff* NAME
2243219820Sjeff*	ib_gid_is_link_local
2244219820Sjeff*
2245219820Sjeff* DESCRIPTION
2246219820Sjeff*	Returns TRUE if the unicast GID scoping indicates link local,
2247219820Sjeff*	FALSE otherwise.
2248219820Sjeff*
2249219820Sjeff* SYNOPSIS
2250219820Sjeff*/
2251219820Sjeffstatic inline boolean_t OSM_API
2252219820Sjeffib_gid_is_link_local(IN const ib_gid_t * const p_gid)
2253219820Sjeff{
2254219820Sjeff	return ((ib_gid_get_subnet_prefix(p_gid) &
2255219820Sjeff		 CL_HTON64(0xFFC0000000000000ULL)) == IB_DEFAULT_SUBNET_PREFIX);
2256219820Sjeff}
2257219820Sjeff
2258219820Sjeff/*
2259219820Sjeff* PARAMETERS
2260219820Sjeff*	p_gid
2261219820Sjeff*		[in] Pointer to the GID object.
2262219820Sjeff*
2263219820Sjeff* RETURN VALUES
2264219820Sjeff*	Returns TRUE if the unicast GID scoping indicates link local,
2265219820Sjeff*	FALSE otherwise.
2266219820Sjeff*
2267219820Sjeff* NOTES
2268219820Sjeff*
2269219820Sjeff* SEE ALSO
2270219820Sjeff*	ib_gid_t
2271219820Sjeff*********/
2272219820Sjeff
2273219820Sjeff/****f* IBA Base: Types/ib_gid_is_site_local
2274219820Sjeff* NAME
2275219820Sjeff*	ib_gid_is_site_local
2276219820Sjeff*
2277219820Sjeff* DESCRIPTION
2278219820Sjeff*	Returns TRUE if the unicast GID scoping indicates site local,
2279219820Sjeff*	FALSE otherwise.
2280219820Sjeff*
2281219820Sjeff* SYNOPSIS
2282219820Sjeff*/
2283219820Sjeffstatic inline boolean_t OSM_API
2284219820Sjeffib_gid_is_site_local(IN const ib_gid_t * const p_gid)
2285219820Sjeff{
2286219820Sjeff	return ((ib_gid_get_subnet_prefix(p_gid) &
2287219820Sjeff		 CL_HTON64(0xFFFFFFFFFFFF0000ULL)) ==
2288219820Sjeff		CL_HTON64(0xFEC0000000000000ULL));
2289219820Sjeff}
2290219820Sjeff
2291219820Sjeff/*
2292219820Sjeff* PARAMETERS
2293219820Sjeff*	p_gid
2294219820Sjeff*		[in] Pointer to the GID object.
2295219820Sjeff*
2296219820Sjeff* RETURN VALUES
2297219820Sjeff*	Returns TRUE if the unicast GID scoping indicates site local,
2298219820Sjeff*	FALSE otherwise.
2299219820Sjeff*
2300219820Sjeff* NOTES
2301219820Sjeff*
2302219820Sjeff* SEE ALSO
2303219820Sjeff*	ib_gid_t
2304219820Sjeff*********/
2305219820Sjeff
2306219820Sjeff/****f* IBA Base: Types/ib_gid_get_guid
2307219820Sjeff* NAME
2308219820Sjeff*	ib_gid_get_guid
2309219820Sjeff*
2310219820Sjeff* DESCRIPTION
2311219820Sjeff*	Gets the guid from a GID.
2312219820Sjeff*
2313219820Sjeff* SYNOPSIS
2314219820Sjeff*/
2315219820Sjeffstatic inline ib_net64_t OSM_API
2316219820Sjeffib_gid_get_guid(IN const ib_gid_t * const p_gid)
2317219820Sjeff{
2318219820Sjeff	return (p_gid->unicast.interface_id);
2319219820Sjeff}
2320219820Sjeff
2321219820Sjeff/*
2322219820Sjeff* PARAMETERS
2323219820Sjeff*	p_gid
2324219820Sjeff*		[in] Pointer to the GID object.
2325219820Sjeff*
2326219820Sjeff* RETURN VALUES
2327219820Sjeff*	64-bit GUID value.
2328219820Sjeff*
2329219820Sjeff* NOTES
2330219820Sjeff*
2331219820Sjeff* SEE ALSO
2332219820Sjeff*	ib_gid_t
2333219820Sjeff*********/
2334219820Sjeff
2335219820Sjeff/****s* IBA Base: Types/ib_path_rec_t
2336219820Sjeff* NAME
2337219820Sjeff*	ib_path_rec_t
2338219820Sjeff*
2339219820Sjeff* DESCRIPTION
2340219820Sjeff*	Path records encapsulate the properties of a given
2341219820Sjeff*	route between two end-points on a subnet.
2342219820Sjeff*
2343219820Sjeff* SYNOPSIS
2344219820Sjeff*/
2345219820Sjeff#include <complib/cl_packon.h>
2346219820Sjefftypedef struct _ib_path_rec {
2347219820Sjeff	ib_net64_t service_id;
2348219820Sjeff	ib_gid_t dgid;
2349219820Sjeff	ib_gid_t sgid;
2350219820Sjeff	ib_net16_t dlid;
2351219820Sjeff	ib_net16_t slid;
2352219820Sjeff	ib_net32_t hop_flow_raw;
2353219820Sjeff	uint8_t tclass;
2354219820Sjeff	uint8_t num_path;
2355219820Sjeff	ib_net16_t pkey;
2356219820Sjeff	ib_net16_t qos_class_sl;
2357219820Sjeff	uint8_t mtu;
2358219820Sjeff	uint8_t rate;
2359219820Sjeff	uint8_t pkt_life;
2360219820Sjeff	uint8_t preference;
2361219820Sjeff	uint8_t resv2[6];
2362219820Sjeff
2363219820Sjeff} PACK_SUFFIX ib_path_rec_t;
2364219820Sjeff#include <complib/cl_packoff.h>
2365219820Sjeff/*
2366219820Sjeff* FIELDS
2367219820Sjeff*	service_id
2368219820Sjeff*		Service ID for QoS.
2369219820Sjeff*
2370219820Sjeff*	dgid
2371219820Sjeff*		GID of destination port.
2372219820Sjeff*
2373219820Sjeff*	sgid
2374219820Sjeff*		GID of source port.
2375219820Sjeff*
2376219820Sjeff*	dlid
2377219820Sjeff*		LID of destination port.
2378219820Sjeff*
2379219820Sjeff*	slid
2380219820Sjeff*		LID of source port.
2381219820Sjeff*
2382219820Sjeff*	hop_flow_raw
2383219820Sjeff*		Global routing parameters: hop count, flow label and raw bit.
2384219820Sjeff*
2385219820Sjeff*	tclass
2386219820Sjeff*		Another global routing parameter.
2387219820Sjeff*
2388219820Sjeff*	num_path
2389219820Sjeff*     Reversible path - 1 bit to say if path is reversible.
2390219820Sjeff*		num_path [6:0] In queries, maximum number of paths to return.
2391219820Sjeff*		In responses, undefined.
2392219820Sjeff*
2393219820Sjeff*	pkey
2394219820Sjeff*		Partition key (P_Key) to use on this path.
2395219820Sjeff*
2396219820Sjeff*	qos_class_sl
2397219820Sjeff*		QoS class and service level to use on this path.
2398219820Sjeff*
2399219820Sjeff*	mtu
2400219820Sjeff*		MTU and MTU selector fields to use on this path
2401219820Sjeff*
2402219820Sjeff*	rate
2403219820Sjeff*		Rate and rate selector fields to use on this path.
2404219820Sjeff*
2405219820Sjeff*	pkt_life
2406219820Sjeff*		Packet lifetime
2407219820Sjeff*
2408219820Sjeff*	preference
2409219820Sjeff*		Indicates the relative merit of this path versus other path
2410219820Sjeff*		records returned from the SA.  Lower numbers are better.
2411219820Sjeff*
2412219820Sjeff*	resv2
2413219820Sjeff*		Reserved bytes.
2414219820Sjeff* SEE ALSO
2415219820Sjeff*********/
2416219820Sjeff
2417219820Sjeff/* Path Record Component Masks */
2418219820Sjeff#define  IB_PR_COMPMASK_SERVICEID_MSB     (CL_HTON64(((uint64_t)1)<<0))
2419219820Sjeff#define  IB_PR_COMPMASK_SERVICEID_LSB     (CL_HTON64(((uint64_t)1)<<1))
2420219820Sjeff#define  IB_PR_COMPMASK_DGID              (CL_HTON64(((uint64_t)1)<<2))
2421219820Sjeff#define  IB_PR_COMPMASK_SGID              (CL_HTON64(((uint64_t)1)<<3))
2422219820Sjeff#define  IB_PR_COMPMASK_DLID              (CL_HTON64(((uint64_t)1)<<4))
2423219820Sjeff#define  IB_PR_COMPMASK_SLID              (CL_HTON64(((uint64_t)1)<<5))
2424219820Sjeff#define  IB_PR_COMPMASK_RAWTRAFFIC        (CL_HTON64(((uint64_t)1)<<6))
2425219820Sjeff#define  IB_PR_COMPMASK_RESV0             (CL_HTON64(((uint64_t)1)<<7))
2426219820Sjeff#define  IB_PR_COMPMASK_FLOWLABEL         (CL_HTON64(((uint64_t)1)<<8))
2427219820Sjeff#define  IB_PR_COMPMASK_HOPLIMIT          (CL_HTON64(((uint64_t)1)<<9))
2428219820Sjeff#define  IB_PR_COMPMASK_TCLASS            (CL_HTON64(((uint64_t)1)<<10))
2429219820Sjeff#define  IB_PR_COMPMASK_REVERSIBLE        (CL_HTON64(((uint64_t)1)<<11))
2430219820Sjeff#define  IB_PR_COMPMASK_NUMBPATH          (CL_HTON64(((uint64_t)1)<<12))
2431219820Sjeff#define  IB_PR_COMPMASK_PKEY              (CL_HTON64(((uint64_t)1)<<13))
2432219820Sjeff#define  IB_PR_COMPMASK_QOS_CLASS         (CL_HTON64(((uint64_t)1)<<14))
2433219820Sjeff#define  IB_PR_COMPMASK_SL                (CL_HTON64(((uint64_t)1)<<15))
2434219820Sjeff#define  IB_PR_COMPMASK_MTUSELEC          (CL_HTON64(((uint64_t)1)<<16))
2435219820Sjeff#define  IB_PR_COMPMASK_MTU               (CL_HTON64(((uint64_t)1)<<17))
2436219820Sjeff#define  IB_PR_COMPMASK_RATESELEC         (CL_HTON64(((uint64_t)1)<<18))
2437219820Sjeff#define  IB_PR_COMPMASK_RATE              (CL_HTON64(((uint64_t)1)<<19))
2438219820Sjeff#define  IB_PR_COMPMASK_PKTLIFETIMESELEC  (CL_HTON64(((uint64_t)1)<<20))
2439219820Sjeff#define  IB_PR_COMPMASK_PKTLIFETIME       (CL_HTON64(((uint64_t)1)<<21))
2440219820Sjeff
2441219820Sjeff/* Link Record Component Masks */
2442219820Sjeff#define IB_LR_COMPMASK_FROM_LID           (CL_HTON64(((uint64_t)1)<<0))
2443219820Sjeff#define IB_LR_COMPMASK_FROM_PORT          (CL_HTON64(((uint64_t)1)<<1))
2444219820Sjeff#define IB_LR_COMPMASK_TO_PORT            (CL_HTON64(((uint64_t)1)<<2))
2445219820Sjeff#define IB_LR_COMPMASK_TO_LID             (CL_HTON64(((uint64_t)1)<<3))
2446219820Sjeff
2447219820Sjeff/* VL Arbitration Record Masks */
2448219820Sjeff#define IB_VLA_COMPMASK_LID               (CL_HTON64(((uint64_t)1)<<0))
2449219820Sjeff#define IB_VLA_COMPMASK_OUT_PORT          (CL_HTON64(((uint64_t)1)<<1))
2450219820Sjeff#define IB_VLA_COMPMASK_BLOCK             (CL_HTON64(((uint64_t)1)<<2))
2451219820Sjeff
2452219820Sjeff/* SLtoVL Mapping Record Masks */
2453219820Sjeff#define IB_SLVL_COMPMASK_LID              (CL_HTON64(((uint64_t)1)<<0))
2454219820Sjeff#define IB_SLVL_COMPMASK_IN_PORT          (CL_HTON64(((uint64_t)1)<<1))
2455219820Sjeff#define IB_SLVL_COMPMASK_OUT_PORT         (CL_HTON64(((uint64_t)1)<<2))
2456219820Sjeff
2457219820Sjeff/* P_Key Table Record Masks */
2458219820Sjeff#define IB_PKEY_COMPMASK_LID              (CL_HTON64(((uint64_t)1)<<0))
2459219820Sjeff#define IB_PKEY_COMPMASK_BLOCK            (CL_HTON64(((uint64_t)1)<<1))
2460219820Sjeff#define IB_PKEY_COMPMASK_PORT             (CL_HTON64(((uint64_t)1)<<2))
2461219820Sjeff
2462219820Sjeff/* Switch Info Record Masks */
2463219820Sjeff#define IB_SWIR_COMPMASK_LID		  (CL_HTON64(((uint64_t)1)<<0))
2464219820Sjeff#define IB_SWIR_COMPMASK_RESERVED1	  (CL_HTON64(((uint64_t)1)<<1))
2465219820Sjeff
2466219820Sjeff/* LFT Record Masks */
2467219820Sjeff#define IB_LFTR_COMPMASK_LID              (CL_HTON64(((uint64_t)1)<<0))
2468219820Sjeff#define IB_LFTR_COMPMASK_BLOCK            (CL_HTON64(((uint64_t)1)<<1))
2469219820Sjeff
2470219820Sjeff/* MFT Record Masks */
2471219820Sjeff#define IB_MFTR_COMPMASK_LID		  (CL_HTON64(((uint64_t)1)<<0))
2472219820Sjeff#define IB_MFTR_COMPMASK_POSITION	  (CL_HTON64(((uint64_t)1)<<1))
2473219820Sjeff#define IB_MFTR_COMPMASK_RESERVED1	  (CL_HTON64(((uint64_t)1)<<2))
2474219820Sjeff#define IB_MFTR_COMPMASK_BLOCK		  (CL_HTON64(((uint64_t)1)<<3))
2475219820Sjeff#define IB_MFTR_COMPMASK_RESERVED2	  (CL_HTON64(((uint64_t)1)<<4))
2476219820Sjeff
2477219820Sjeff/* NodeInfo Record Masks */
2478219820Sjeff#define IB_NR_COMPMASK_LID                (CL_HTON64(((uint64_t)1)<<0))
2479219820Sjeff#define IB_NR_COMPMASK_RESERVED1          (CL_HTON64(((uint64_t)1)<<1))
2480219820Sjeff#define IB_NR_COMPMASK_BASEVERSION        (CL_HTON64(((uint64_t)1)<<2))
2481219820Sjeff#define IB_NR_COMPMASK_CLASSVERSION       (CL_HTON64(((uint64_t)1)<<3))
2482219820Sjeff#define IB_NR_COMPMASK_NODETYPE           (CL_HTON64(((uint64_t)1)<<4))
2483219820Sjeff#define IB_NR_COMPMASK_NUMPORTS           (CL_HTON64(((uint64_t)1)<<5))
2484219820Sjeff#define IB_NR_COMPMASK_SYSIMAGEGUID       (CL_HTON64(((uint64_t)1)<<6))
2485219820Sjeff#define IB_NR_COMPMASK_NODEGUID           (CL_HTON64(((uint64_t)1)<<7))
2486219820Sjeff#define IB_NR_COMPMASK_PORTGUID           (CL_HTON64(((uint64_t)1)<<8))
2487219820Sjeff#define IB_NR_COMPMASK_PARTCAP            (CL_HTON64(((uint64_t)1)<<9))
2488219820Sjeff#define IB_NR_COMPMASK_DEVID              (CL_HTON64(((uint64_t)1)<<10))
2489219820Sjeff#define IB_NR_COMPMASK_REV                (CL_HTON64(((uint64_t)1)<<11))
2490219820Sjeff#define IB_NR_COMPMASK_PORTNUM            (CL_HTON64(((uint64_t)1)<<12))
2491219820Sjeff#define IB_NR_COMPMASK_VENDID             (CL_HTON64(((uint64_t)1)<<13))
2492219820Sjeff#define IB_NR_COMPMASK_NODEDESC           (CL_HTON64(((uint64_t)1)<<14))
2493219820Sjeff
2494219820Sjeff/* Service Record Component Masks Sec 15.2.5.14 Ver 1.1*/
2495219820Sjeff#define IB_SR_COMPMASK_SID                (CL_HTON64(((uint64_t)1)<<0))
2496219820Sjeff#define IB_SR_COMPMASK_SGID               (CL_HTON64(((uint64_t)1)<<1))
2497219820Sjeff#define IB_SR_COMPMASK_SPKEY              (CL_HTON64(((uint64_t)1)<<2))
2498219820Sjeff#define IB_SR_COMPMASK_RES1               (CL_HTON64(((uint64_t)1)<<3))
2499219820Sjeff#define IB_SR_COMPMASK_SLEASE             (CL_HTON64(((uint64_t)1)<<4))
2500219820Sjeff#define IB_SR_COMPMASK_SKEY               (CL_HTON64(((uint64_t)1)<<5))
2501219820Sjeff#define IB_SR_COMPMASK_SNAME              (CL_HTON64(((uint64_t)1)<<6))
2502219820Sjeff#define IB_SR_COMPMASK_SDATA8_0           (CL_HTON64(((uint64_t)1)<<7))
2503219820Sjeff#define IB_SR_COMPMASK_SDATA8_1           (CL_HTON64(((uint64_t)1)<<8))
2504219820Sjeff#define IB_SR_COMPMASK_SDATA8_2           (CL_HTON64(((uint64_t)1)<<9))
2505219820Sjeff#define IB_SR_COMPMASK_SDATA8_3           (CL_HTON64(((uint64_t)1)<<10))
2506219820Sjeff#define IB_SR_COMPMASK_SDATA8_4           (CL_HTON64(((uint64_t)1)<<11))
2507219820Sjeff#define IB_SR_COMPMASK_SDATA8_5           (CL_HTON64(((uint64_t)1)<<12))
2508219820Sjeff#define IB_SR_COMPMASK_SDATA8_6           (CL_HTON64(((uint64_t)1)<<13))
2509219820Sjeff#define IB_SR_COMPMASK_SDATA8_7           (CL_HTON64(((uint64_t)1)<<14))
2510219820Sjeff#define IB_SR_COMPMASK_SDATA8_8           (CL_HTON64(((uint64_t)1)<<15))
2511219820Sjeff#define IB_SR_COMPMASK_SDATA8_9           (CL_HTON64(((uint64_t)1)<<16))
2512219820Sjeff#define IB_SR_COMPMASK_SDATA8_10       (CL_HTON64(((uint64_t)1)<<17))
2513219820Sjeff#define IB_SR_COMPMASK_SDATA8_11       (CL_HTON64(((uint64_t)1)<<18))
2514219820Sjeff#define IB_SR_COMPMASK_SDATA8_12       (CL_HTON64(((uint64_t)1)<<19))
2515219820Sjeff#define IB_SR_COMPMASK_SDATA8_13       (CL_HTON64(((uint64_t)1)<<20))
2516219820Sjeff#define IB_SR_COMPMASK_SDATA8_14       (CL_HTON64(((uint64_t)1)<<21))
2517219820Sjeff#define IB_SR_COMPMASK_SDATA8_15       (CL_HTON64(((uint64_t)1)<<22))
2518219820Sjeff#define IB_SR_COMPMASK_SDATA16_0       (CL_HTON64(((uint64_t)1)<<23))
2519219820Sjeff#define IB_SR_COMPMASK_SDATA16_1       (CL_HTON64(((uint64_t)1)<<24))
2520219820Sjeff#define IB_SR_COMPMASK_SDATA16_2       (CL_HTON64(((uint64_t)1)<<25))
2521219820Sjeff#define IB_SR_COMPMASK_SDATA16_3       (CL_HTON64(((uint64_t)1)<<26))
2522219820Sjeff#define IB_SR_COMPMASK_SDATA16_4       (CL_HTON64(((uint64_t)1)<<27))
2523219820Sjeff#define IB_SR_COMPMASK_SDATA16_5       (CL_HTON64(((uint64_t)1)<<28))
2524219820Sjeff#define IB_SR_COMPMASK_SDATA16_6       (CL_HTON64(((uint64_t)1)<<29))
2525219820Sjeff#define IB_SR_COMPMASK_SDATA16_7       (CL_HTON64(((uint64_t)1)<<30))
2526219820Sjeff#define IB_SR_COMPMASK_SDATA32_0       (CL_HTON64(((uint64_t)1)<<31))
2527219820Sjeff#define IB_SR_COMPMASK_SDATA32_1       (CL_HTON64(((uint64_t)1)<<32))
2528219820Sjeff#define IB_SR_COMPMASK_SDATA32_2       (CL_HTON64(((uint64_t)1)<<33))
2529219820Sjeff#define IB_SR_COMPMASK_SDATA32_3       (CL_HTON64(((uint64_t)1)<<34))
2530219820Sjeff#define IB_SR_COMPMASK_SDATA64_0       (CL_HTON64(((uint64_t)1)<<35))
2531219820Sjeff#define IB_SR_COMPMASK_SDATA64_1       (CL_HTON64(((uint64_t)1)<<36))
2532219820Sjeff
2533219820Sjeff/* Port Info Record Component Masks */
2534219820Sjeff#define IB_PIR_COMPMASK_LID              (CL_HTON64(((uint64_t)1)<<0))
2535219820Sjeff#define IB_PIR_COMPMASK_PORTNUM          (CL_HTON64(((uint64_t)1)<<1))
2536219820Sjeff#define IB_PIR_COMPMASK_RESV1            (CL_HTON64(((uint64_t)1)<<2))
2537219820Sjeff#define IB_PIR_COMPMASK_MKEY             (CL_HTON64(((uint64_t)1)<<3))
2538219820Sjeff#define IB_PIR_COMPMASK_GIDPRE           (CL_HTON64(((uint64_t)1)<<4))
2539219820Sjeff#define IB_PIR_COMPMASK_BASELID          (CL_HTON64(((uint64_t)1)<<5))
2540219820Sjeff#define IB_PIR_COMPMASK_SMLID            (CL_HTON64(((uint64_t)1)<<6))
2541219820Sjeff#define IB_PIR_COMPMASK_CAPMASK          (CL_HTON64(((uint64_t)1)<<7))
2542219820Sjeff#define IB_PIR_COMPMASK_DIAGCODE         (CL_HTON64(((uint64_t)1)<<8))
2543219820Sjeff#define IB_PIR_COMPMASK_MKEYLEASEPRD     (CL_HTON64(((uint64_t)1)<<9))
2544219820Sjeff#define IB_PIR_COMPMASK_LOCALPORTNUM     (CL_HTON64(((uint64_t)1)<<10))
2545219820Sjeff#define IB_PIR_COMPMASK_LINKWIDTHENABLED (CL_HTON64(((uint64_t)1)<<11))
2546219820Sjeff#define IB_PIR_COMPMASK_LNKWIDTHSUPPORT  (CL_HTON64(((uint64_t)1)<<12))
2547219820Sjeff#define IB_PIR_COMPMASK_LNKWIDTHACTIVE   (CL_HTON64(((uint64_t)1)<<13))
2548219820Sjeff#define IB_PIR_COMPMASK_LNKSPEEDSUPPORT  (CL_HTON64(((uint64_t)1)<<14))
2549219820Sjeff#define IB_PIR_COMPMASK_PORTSTATE        (CL_HTON64(((uint64_t)1)<<15))
2550219820Sjeff#define IB_PIR_COMPMASK_PORTPHYSTATE     (CL_HTON64(((uint64_t)1)<<16))
2551219820Sjeff#define IB_PIR_COMPMASK_LINKDWNDFLTSTATE (CL_HTON64(((uint64_t)1)<<17))
2552219820Sjeff#define IB_PIR_COMPMASK_MKEYPROTBITS     (CL_HTON64(((uint64_t)1)<<18))
2553219820Sjeff#define IB_PIR_COMPMASK_RESV2            (CL_HTON64(((uint64_t)1)<<19))
2554219820Sjeff#define IB_PIR_COMPMASK_LMC              (CL_HTON64(((uint64_t)1)<<20))
2555219820Sjeff#define IB_PIR_COMPMASK_LINKSPEEDACTIVE  (CL_HTON64(((uint64_t)1)<<21))
2556219820Sjeff#define IB_PIR_COMPMASK_LINKSPEEDENABLE  (CL_HTON64(((uint64_t)1)<<22))
2557219820Sjeff#define IB_PIR_COMPMASK_NEIGHBORMTU      (CL_HTON64(((uint64_t)1)<<23))
2558219820Sjeff#define IB_PIR_COMPMASK_MASTERSMSL       (CL_HTON64(((uint64_t)1)<<24))
2559219820Sjeff#define IB_PIR_COMPMASK_VLCAP            (CL_HTON64(((uint64_t)1)<<25))
2560219820Sjeff#define IB_PIR_COMPMASK_INITTYPE         (CL_HTON64(((uint64_t)1)<<26))
2561219820Sjeff#define IB_PIR_COMPMASK_VLHIGHLIMIT      (CL_HTON64(((uint64_t)1)<<27))
2562219820Sjeff#define IB_PIR_COMPMASK_VLARBHIGHCAP     (CL_HTON64(((uint64_t)1)<<28))
2563219820Sjeff#define IB_PIR_COMPMASK_VLARBLOWCAP      (CL_HTON64(((uint64_t)1)<<29))
2564219820Sjeff#define IB_PIR_COMPMASK_INITTYPEREPLY    (CL_HTON64(((uint64_t)1)<<30))
2565219820Sjeff#define IB_PIR_COMPMASK_MTUCAP           (CL_HTON64(((uint64_t)1)<<31))
2566219820Sjeff#define IB_PIR_COMPMASK_VLSTALLCNT       (CL_HTON64(((uint64_t)1)<<32))
2567219820Sjeff#define IB_PIR_COMPMASK_HOQLIFE          (CL_HTON64(((uint64_t)1)<<33))
2568219820Sjeff#define IB_PIR_COMPMASK_OPVLS            (CL_HTON64(((uint64_t)1)<<34))
2569219820Sjeff#define IB_PIR_COMPMASK_PARENFIN         (CL_HTON64(((uint64_t)1)<<35))
2570219820Sjeff#define IB_PIR_COMPMASK_PARENFOUT        (CL_HTON64(((uint64_t)1)<<36))
2571219820Sjeff#define IB_PIR_COMPMASK_FILTERRAWIN      (CL_HTON64(((uint64_t)1)<<37))
2572219820Sjeff#define IB_PIR_COMPMASK_FILTERRAWOUT     (CL_HTON64(((uint64_t)1)<<38))
2573219820Sjeff#define IB_PIR_COMPMASK_MKEYVIO          (CL_HTON64(((uint64_t)1)<<39))
2574219820Sjeff#define IB_PIR_COMPMASK_PKEYVIO          (CL_HTON64(((uint64_t)1)<<40))
2575219820Sjeff#define IB_PIR_COMPMASK_QKEYVIO          (CL_HTON64(((uint64_t)1)<<41))
2576219820Sjeff#define IB_PIR_COMPMASK_GUIDCAP          (CL_HTON64(((uint64_t)1)<<42))
2577219820Sjeff#define IB_PIR_COMPMASK_RESV3            (CL_HTON64(((uint64_t)1)<<43))
2578219820Sjeff#define IB_PIR_COMPMASK_SUBNTO           (CL_HTON64(((uint64_t)1)<<44))
2579219820Sjeff#define IB_PIR_COMPMASK_RESV4            (CL_HTON64(((uint64_t)1)<<45))
2580219820Sjeff#define IB_PIR_COMPMASK_RESPTIME         (CL_HTON64(((uint64_t)1)<<46))
2581219820Sjeff#define IB_PIR_COMPMASK_LOCALPHYERR      (CL_HTON64(((uint64_t)1)<<47))
2582219820Sjeff#define IB_PIR_COMPMASK_OVERRUNERR       (CL_HTON64(((uint64_t)1)<<48))
2583219820Sjeff
2584219820Sjeff/* Multicast Member Record Component Masks */
2585219820Sjeff#define IB_MCR_COMPMASK_GID         (CL_HTON64(((uint64_t)1)<<0))
2586219820Sjeff#define IB_MCR_COMPMASK_MGID        (CL_HTON64(((uint64_t)1)<<0))
2587219820Sjeff#define IB_MCR_COMPMASK_PORT_GID    (CL_HTON64(((uint64_t)1)<<1))
2588219820Sjeff#define IB_MCR_COMPMASK_QKEY        (CL_HTON64(((uint64_t)1)<<2))
2589219820Sjeff#define IB_MCR_COMPMASK_MLID        (CL_HTON64(((uint64_t)1)<<3))
2590219820Sjeff#define IB_MCR_COMPMASK_MTU_SEL     (CL_HTON64(((uint64_t)1)<<4))
2591219820Sjeff#define IB_MCR_COMPMASK_MTU         (CL_HTON64(((uint64_t)1)<<5))
2592219820Sjeff#define IB_MCR_COMPMASK_TCLASS      (CL_HTON64(((uint64_t)1)<<6))
2593219820Sjeff#define IB_MCR_COMPMASK_PKEY        (CL_HTON64(((uint64_t)1)<<7))
2594219820Sjeff#define IB_MCR_COMPMASK_RATE_SEL    (CL_HTON64(((uint64_t)1)<<8))
2595219820Sjeff#define IB_MCR_COMPMASK_RATE        (CL_HTON64(((uint64_t)1)<<9))
2596219820Sjeff#define IB_MCR_COMPMASK_LIFE_SEL    (CL_HTON64(((uint64_t)1)<<10))
2597219820Sjeff#define IB_MCR_COMPMASK_LIFE        (CL_HTON64(((uint64_t)1)<<11))
2598219820Sjeff#define IB_MCR_COMPMASK_SL          (CL_HTON64(((uint64_t)1)<<12))
2599219820Sjeff#define IB_MCR_COMPMASK_FLOW        (CL_HTON64(((uint64_t)1)<<13))
2600219820Sjeff#define IB_MCR_COMPMASK_HOP         (CL_HTON64(((uint64_t)1)<<14))
2601219820Sjeff#define IB_MCR_COMPMASK_SCOPE       (CL_HTON64(((uint64_t)1)<<15))
2602219820Sjeff#define IB_MCR_COMPMASK_JOIN_STATE  (CL_HTON64(((uint64_t)1)<<16))
2603219820Sjeff#define IB_MCR_COMPMASK_PROXY       (CL_HTON64(((uint64_t)1)<<17))
2604219820Sjeff
2605219820Sjeff/* GUID Info Record Component Masks */
2606219820Sjeff#define IB_GIR_COMPMASK_LID		(CL_HTON64(((uint64_t)1)<<0))
2607219820Sjeff#define IB_GIR_COMPMASK_BLOCKNUM	(CL_HTON64(((uint64_t)1)<<1))
2608219820Sjeff#define IB_GIR_COMPMASK_RESV1		(CL_HTON64(((uint64_t)1)<<2))
2609219820Sjeff#define IB_GIR_COMPMASK_RESV2		(CL_HTON64(((uint64_t)1)<<3))
2610219820Sjeff#define IB_GIR_COMPMASK_GID0		(CL_HTON64(((uint64_t)1)<<4))
2611219820Sjeff#define IB_GIR_COMPMASK_GID1		(CL_HTON64(((uint64_t)1)<<5))
2612219820Sjeff#define IB_GIR_COMPMASK_GID2		(CL_HTON64(((uint64_t)1)<<6))
2613219820Sjeff#define IB_GIR_COMPMASK_GID3		(CL_HTON64(((uint64_t)1)<<7))
2614219820Sjeff#define IB_GIR_COMPMASK_GID4		(CL_HTON64(((uint64_t)1)<<8))
2615219820Sjeff#define IB_GIR_COMPMASK_GID5		(CL_HTON64(((uint64_t)1)<<9))
2616219820Sjeff#define IB_GIR_COMPMASK_GID6		(CL_HTON64(((uint64_t)1)<<10))
2617219820Sjeff#define IB_GIR_COMPMASK_GID7		(CL_HTON64(((uint64_t)1)<<11))
2618219820Sjeff
2619219820Sjeff/* MultiPath Record Component Masks */
2620219820Sjeff#define IB_MPR_COMPMASK_RAWTRAFFIC	(CL_HTON64(((uint64_t)1)<<0))
2621219820Sjeff#define IB_MPR_COMPMASK_RESV0		(CL_HTON64(((uint64_t)1)<<1))
2622219820Sjeff#define IB_MPR_COMPMASK_FLOWLABEL	(CL_HTON64(((uint64_t)1)<<2))
2623219820Sjeff#define IB_MPR_COMPMASK_HOPLIMIT	(CL_HTON64(((uint64_t)1)<<3))
2624219820Sjeff#define IB_MPR_COMPMASK_TCLASS		(CL_HTON64(((uint64_t)1)<<4))
2625219820Sjeff#define IB_MPR_COMPMASK_REVERSIBLE	(CL_HTON64(((uint64_t)1)<<5))
2626219820Sjeff#define IB_MPR_COMPMASK_NUMBPATH	(CL_HTON64(((uint64_t)1)<<6))
2627219820Sjeff#define IB_MPR_COMPMASK_PKEY		(CL_HTON64(((uint64_t)1)<<7))
2628219820Sjeff#define IB_MPR_COMPMASK_QOS_CLASS	(CL_HTON64(((uint64_t)1)<<8))
2629219820Sjeff#define IB_MPR_COMPMASK_SL		(CL_HTON64(((uint64_t)1)<<9))
2630219820Sjeff#define IB_MPR_COMPMASK_MTUSELEC	(CL_HTON64(((uint64_t)1)<<10))
2631219820Sjeff#define IB_MPR_COMPMASK_MTU		(CL_HTON64(((uint64_t)1)<<11))
2632219820Sjeff#define IB_MPR_COMPMASK_RATESELEC	(CL_HTON64(((uint64_t)1)<<12))
2633219820Sjeff#define IB_MPR_COMPMASK_RATE		(CL_HTON64(((uint64_t)1)<<13))
2634219820Sjeff#define IB_MPR_COMPMASK_PKTLIFETIMESELEC (CL_HTON64(((uint64_t)1)<<14))
2635219820Sjeff#define IB_MPR_COMPMASK_PKTLIFETIME	(CL_HTON64(((uint64_t)1)<<15))
2636219820Sjeff#define IB_MPR_COMPMASK_SERVICEID_MSB	(CL_HTON64(((uint64_t)1)<<16))
2637219820Sjeff#define IB_MPR_COMPMASK_INDEPSELEC	(CL_HTON64(((uint64_t)1)<<17))
2638219820Sjeff#define IB_MPR_COMPMASK_RESV3		(CL_HTON64(((uint64_t)1)<<18))
2639219820Sjeff#define IB_MPR_COMPMASK_SGIDCOUNT	(CL_HTON64(((uint64_t)1)<<19))
2640219820Sjeff#define IB_MPR_COMPMASK_DGIDCOUNT	(CL_HTON64(((uint64_t)1)<<20))
2641219820Sjeff#define IB_MPR_COMPMASK_SERVICEID_LSB	(CL_HTON64(((uint64_t)1)<<21))
2642219820Sjeff
2643219820Sjeff/* SMInfo Record Component Masks */
2644219820Sjeff#define IB_SMIR_COMPMASK_LID		(CL_HTON64(((uint64_t)1)<<0))
2645219820Sjeff#define IB_SMIR_COMPMASK_RESV0		(CL_HTON64(((uint64_t)1)<<1))
2646219820Sjeff#define IB_SMIR_COMPMASK_GUID		(CL_HTON64(((uint64_t)1)<<2))
2647219820Sjeff#define IB_SMIR_COMPMASK_SMKEY		(CL_HTON64(((uint64_t)1)<<3))
2648219820Sjeff#define IB_SMIR_COMPMASK_ACTCOUNT	(CL_HTON64(((uint64_t)1)<<4))
2649219820Sjeff#define IB_SMIR_COMPMASK_PRIORITY	(CL_HTON64(((uint64_t)1)<<5))
2650219820Sjeff#define IB_SMIR_COMPMASK_SMSTATE	(CL_HTON64(((uint64_t)1)<<6))
2651219820Sjeff
2652219820Sjeff/* InformInfo Record Component Masks */
2653219820Sjeff#define IB_IIR_COMPMASK_SUBSCRIBERGID	(CL_HTON64(((uint64_t)1)<<0))
2654219820Sjeff#define IB_IIR_COMPMASK_ENUM		(CL_HTON64(((uint64_t)1)<<1))
2655219820Sjeff#define IB_IIR_COMPMASK_RESV0		(CL_HTON64(((uint64_t)1)<<2))
2656219820Sjeff#define IB_IIR_COMPMASK_GID		(CL_HTON64(((uint64_t)1)<<3))
2657219820Sjeff#define IB_IIR_COMPMASK_LIDRANGEBEGIN	(CL_HTON64(((uint64_t)1)<<4))
2658219820Sjeff#define IB_IIR_COMPMASK_LIDRANGEEND	(CL_HTON64(((uint64_t)1)<<5))
2659219820Sjeff#define IB_IIR_COMPMASK_RESV1		(CL_HTON64(((uint64_t)1)<<6))
2660219820Sjeff#define IB_IIR_COMPMASK_ISGENERIC	(CL_HTON64(((uint64_t)1)<<7))
2661219820Sjeff#define IB_IIR_COMPMASK_SUBSCRIBE	(CL_HTON64(((uint64_t)1)<<8))
2662219820Sjeff#define IB_IIR_COMPMASK_TYPE		(CL_HTON64(((uint64_t)1)<<9))
2663219820Sjeff#define IB_IIR_COMPMASK_TRAPNUMB	(CL_HTON64(((uint64_t)1)<<10))
2664219820Sjeff#define IB_IIR_COMPMASK_DEVICEID	(CL_HTON64(((uint64_t)1)<<10))
2665219820Sjeff#define IB_IIR_COMPMASK_QPN		(CL_HTON64(((uint64_t)1)<<11))
2666219820Sjeff#define IB_IIR_COMPMASK_RESV2		(CL_HTON64(((uint64_t)1)<<12))
2667219820Sjeff#define IB_IIR_COMPMASK_RESPTIME	(CL_HTON64(((uint64_t)1)<<13))
2668219820Sjeff#define IB_IIR_COMPMASK_RESV3		(CL_HTON64(((uint64_t)1)<<14))
2669219820Sjeff#define IB_IIR_COMPMASK_PRODTYPE	(CL_HTON64(((uint64_t)1)<<15))
2670219820Sjeff#define IB_IIR_COMPMASK_VENDID		(CL_HTON64(((uint64_t)1)<<15))
2671219820Sjeff
2672219820Sjeff/****f* IBA Base: Types/ib_path_rec_init_local
2673219820Sjeff* NAME
2674219820Sjeff*	ib_path_rec_init_local
2675219820Sjeff*
2676219820Sjeff* DESCRIPTION
2677219820Sjeff*	Initializes a subnet local path record.
2678219820Sjeff*
2679219820Sjeff* SYNOPSIS
2680219820Sjeff*/
2681219820Sjeffstatic inline void OSM_API
2682219820Sjeffib_path_rec_init_local(IN ib_path_rec_t * const p_rec,
2683219820Sjeff		       IN ib_gid_t * const p_dgid,
2684219820Sjeff		       IN ib_gid_t * const p_sgid,
2685219820Sjeff		       IN ib_net16_t dlid,
2686219820Sjeff		       IN ib_net16_t slid,
2687219820Sjeff		       IN uint8_t num_path,
2688219820Sjeff		       IN ib_net16_t pkey,
2689219820Sjeff		       IN uint8_t sl,
2690219820Sjeff		       IN uint16_t qos_class,
2691219820Sjeff		       IN uint8_t mtu_selector,
2692219820Sjeff		       IN uint8_t mtu,
2693219820Sjeff		       IN uint8_t rate_selector,
2694219820Sjeff		       IN uint8_t rate,
2695219820Sjeff		       IN uint8_t pkt_life_selector,
2696219820Sjeff		       IN uint8_t pkt_life, IN uint8_t preference)
2697219820Sjeff{
2698219820Sjeff	p_rec->dgid = *p_dgid;
2699219820Sjeff	p_rec->sgid = *p_sgid;
2700219820Sjeff	p_rec->dlid = dlid;
2701219820Sjeff	p_rec->slid = slid;
2702219820Sjeff	p_rec->num_path = num_path;
2703219820Sjeff	p_rec->pkey = pkey;
2704219820Sjeff	p_rec->qos_class_sl = cl_hton16((sl & IB_PATH_REC_SL_MASK) |
2705219820Sjeff					(qos_class << 4));
2706219820Sjeff	p_rec->mtu = (uint8_t) ((mtu & IB_PATH_REC_BASE_MASK) |
2707219820Sjeff				(uint8_t) (mtu_selector << 6));
2708219820Sjeff	p_rec->rate = (uint8_t) ((rate & IB_PATH_REC_BASE_MASK) |
2709219820Sjeff				 (uint8_t) (rate_selector << 6));
2710219820Sjeff	p_rec->pkt_life = (uint8_t) ((pkt_life & IB_PATH_REC_BASE_MASK) |
2711219820Sjeff				     (uint8_t) (pkt_life_selector << 6));
2712219820Sjeff	p_rec->preference = preference;
2713219820Sjeff
2714219820Sjeff	/* Clear global routing fields for local path records */
2715219820Sjeff	p_rec->hop_flow_raw = 0;
2716219820Sjeff	p_rec->tclass = 0;
2717219820Sjeff	p_rec->service_id = 0;
2718219820Sjeff
2719219820Sjeff	*((uint32_t *) p_rec->resv2) = 0;
2720219820Sjeff	*((uint16_t *) p_rec->resv2 + 2) = 0;
2721219820Sjeff}
2722219820Sjeff
2723219820Sjeff/*
2724219820Sjeff* PARAMETERS
2725219820Sjeff*	p_rec
2726219820Sjeff*		[in] Pointer to the path record object.
2727219820Sjeff*
2728219820Sjeff*	dgid
2729219820Sjeff*		[in] GID of destination port.
2730219820Sjeff*
2731219820Sjeff*	sgid
2732219820Sjeff*		[in] GID of source port.
2733219820Sjeff*
2734219820Sjeff*	dlid
2735219820Sjeff*		[in] LID of destination port.
2736219820Sjeff*
2737219820Sjeff*	slid
2738219820Sjeff*		[in] LID of source port.
2739219820Sjeff*
2740219820Sjeff*	num_path
2741219820Sjeff*     [in] Reversible path - 1 bit to say if path is reversible.
2742219820Sjeff*		num_path [6:0] In queries, maximum number of paths to return.
2743219820Sjeff*		In responses, undefined.
2744219820Sjeff*
2745219820Sjeff*	pkey
2746219820Sjeff*		[in] Partition key (P_Key) to use on this path.
2747219820Sjeff*
2748219820Sjeff*	qos_class
2749219820Sjeff*		[in] QoS class to use on this path.  Lower 12-bits are valid.
2750219820Sjeff*
2751219820Sjeff*	sl
2752219820Sjeff*		[in] Service level to use on this path.  Lower 4-bits are valid.
2753219820Sjeff*
2754219820Sjeff*	mtu_selector
2755219820Sjeff*		[in] Encoded MTU selector value to use on this path
2756219820Sjeff*
2757219820Sjeff*	mtu
2758219820Sjeff*		[in] Encoded MTU to use on this path
2759219820Sjeff*
2760219820Sjeff*	rate_selector
2761219820Sjeff*		[in] Encoded rate selector value to use on this path.
2762219820Sjeff*
2763219820Sjeff*	rate
2764219820Sjeff*		[in] Encoded rate to use on this path.
2765219820Sjeff*
2766219820Sjeff*	pkt_life_selector
2767219820Sjeff*		[in] Encoded Packet selector value lifetime for this path.
2768219820Sjeff*
2769219820Sjeff*	pkt_life
2770219820Sjeff*		[in] Encoded Packet lifetime for this path.
2771219820Sjeff*
2772219820Sjeff*	preference
2773219820Sjeff*		[in] Indicates the relative merit of this path versus other path
2774219820Sjeff*		records returned from the SA.  Lower numbers are better.
2775219820Sjeff*
2776219820Sjeff* RETURN VALUES
2777219820Sjeff*	None.
2778219820Sjeff*
2779219820Sjeff* NOTES
2780219820Sjeff*
2781219820Sjeff* SEE ALSO
2782219820Sjeff*	ib_gid_t
2783219820Sjeff*********/
2784219820Sjeff
2785219820Sjeff/****f* IBA Base: Types/ib_path_rec_num_path
2786219820Sjeff* NAME
2787219820Sjeff*	ib_path_rec_num_path
2788219820Sjeff*
2789219820Sjeff* DESCRIPTION
2790219820Sjeff*	Get max number of paths to return.
2791219820Sjeff*
2792219820Sjeff* SYNOPSIS
2793219820Sjeff*/
2794219820Sjeffstatic inline uint8_t OSM_API
2795219820Sjeffib_path_rec_num_path(IN const ib_path_rec_t * const p_rec)
2796219820Sjeff{
2797219820Sjeff	return (p_rec->num_path & 0x7F);
2798219820Sjeff}
2799219820Sjeff
2800219820Sjeff/*
2801219820Sjeff* PARAMETERS
2802219820Sjeff*	p_rec
2803219820Sjeff*		[in] Pointer to the path record object.
2804219820Sjeff*
2805219820Sjeff* RETURN VALUES
2806219820Sjeff*	Maximum number of paths to return for each unique SGID_DGID combination.
2807219820Sjeff*
2808219820Sjeff* NOTES
2809219820Sjeff*
2810219820Sjeff* SEE ALSO
2811219820Sjeff*	ib_path_rec_t
2812219820Sjeff*********/
2813219820Sjeff
2814219820Sjeff/****f* IBA Base: Types/ib_path_rec_set_sl
2815219820Sjeff* NAME
2816219820Sjeff*	ib_path_rec_set_sl
2817219820Sjeff*
2818219820Sjeff* DESCRIPTION
2819219820Sjeff*	Set path service level.
2820219820Sjeff*
2821219820Sjeff* SYNOPSIS
2822219820Sjeff*/
2823219820Sjeffstatic inline void OSM_API
2824219820Sjeffib_path_rec_set_sl(IN ib_path_rec_t * const p_rec, IN const uint8_t sl)
2825219820Sjeff{
2826219820Sjeff	p_rec->qos_class_sl =
2827219820Sjeff	    (p_rec->qos_class_sl & CL_HTON16(IB_PATH_REC_QOS_CLASS_MASK)) |
2828219820Sjeff	    cl_hton16(sl & IB_PATH_REC_SL_MASK);
2829219820Sjeff}
2830219820Sjeff
2831219820Sjeff/*
2832219820Sjeff* PARAMETERS
2833219820Sjeff*	p_rec
2834219820Sjeff*		[in] Pointer to the path record object.
2835219820Sjeff*
2836219820Sjeff*	sl
2837219820Sjeff*		[in] Service level to set.
2838219820Sjeff*
2839219820Sjeff* RETURN VALUES
2840219820Sjeff*	None
2841219820Sjeff*
2842219820Sjeff* NOTES
2843219820Sjeff*
2844219820Sjeff* SEE ALSO
2845219820Sjeff*	ib_path_rec_t
2846219820Sjeff*********/
2847219820Sjeff
2848219820Sjeff/****f* IBA Base: Types/ib_path_rec_sl
2849219820Sjeff* NAME
2850219820Sjeff*	ib_path_rec_sl
2851219820Sjeff*
2852219820Sjeff* DESCRIPTION
2853219820Sjeff*	Get path service level.
2854219820Sjeff*
2855219820Sjeff* SYNOPSIS
2856219820Sjeff*/
2857219820Sjeffstatic inline uint8_t OSM_API
2858219820Sjeffib_path_rec_sl(IN const ib_path_rec_t * const p_rec)
2859219820Sjeff{
2860219820Sjeff	return (uint8_t)(cl_ntoh16(p_rec->qos_class_sl) & IB_PATH_REC_SL_MASK);
2861219820Sjeff}
2862219820Sjeff
2863219820Sjeff/*
2864219820Sjeff* PARAMETERS
2865219820Sjeff*	p_rec
2866219820Sjeff*		[in] Pointer to the path record object.
2867219820Sjeff*
2868219820Sjeff* RETURN VALUES
2869219820Sjeff*	SL.
2870219820Sjeff*
2871219820Sjeff* NOTES
2872219820Sjeff*
2873219820Sjeff* SEE ALSO
2874219820Sjeff*	ib_path_rec_t
2875219820Sjeff*********/
2876219820Sjeff
2877219820Sjeff/****f* IBA Base: Types/ib_path_rec_set_qos_class
2878219820Sjeff* NAME
2879219820Sjeff*	ib_path_rec_set_qos_class
2880219820Sjeff*
2881219820Sjeff* DESCRIPTION
2882219820Sjeff*	Set path QoS class.
2883219820Sjeff*
2884219820Sjeff* SYNOPSIS
2885219820Sjeff*/
2886219820Sjeffstatic inline void OSM_API
2887219820Sjeffib_path_rec_set_qos_class(IN ib_path_rec_t * const p_rec,
2888219820Sjeff			  IN const uint16_t qos_class)
2889219820Sjeff{
2890219820Sjeff	p_rec->qos_class_sl =
2891219820Sjeff	    (p_rec->qos_class_sl & CL_HTON16(IB_PATH_REC_SL_MASK)) |
2892219820Sjeff	    cl_hton16(qos_class << 4);
2893219820Sjeff}
2894219820Sjeff
2895219820Sjeff/*
2896219820Sjeff* PARAMETERS
2897219820Sjeff*	p_rec
2898219820Sjeff*		[in] Pointer to the path record object.
2899219820Sjeff*
2900219820Sjeff*	qos_class
2901219820Sjeff*		[in] QoS class to set.
2902219820Sjeff*
2903219820Sjeff* RETURN VALUES
2904219820Sjeff*	None
2905219820Sjeff*
2906219820Sjeff* NOTES
2907219820Sjeff*
2908219820Sjeff* SEE ALSO
2909219820Sjeff*	ib_path_rec_t
2910219820Sjeff*********/
2911219820Sjeff
2912219820Sjeff/****f* IBA Base: Types/ib_path_rec_qos_class
2913219820Sjeff* NAME
2914219820Sjeff*	ib_path_rec_qos_class
2915219820Sjeff*
2916219820Sjeff* DESCRIPTION
2917219820Sjeff*	Get QoS class.
2918219820Sjeff*
2919219820Sjeff* SYNOPSIS
2920219820Sjeff*/
2921219820Sjeffstatic inline uint16_t OSM_API
2922219820Sjeffib_path_rec_qos_class(IN const ib_path_rec_t * const p_rec)
2923219820Sjeff{
2924219820Sjeff	return (cl_ntoh16(p_rec->qos_class_sl) >> 4);
2925219820Sjeff}
2926219820Sjeff
2927219820Sjeff/*
2928219820Sjeff* PARAMETERS
2929219820Sjeff*	p_rec
2930219820Sjeff*		[in] Pointer to the path record object.
2931219820Sjeff*
2932219820Sjeff* RETURN VALUES
2933219820Sjeff*	QoS class of the path record.
2934219820Sjeff*
2935219820Sjeff* NOTES
2936219820Sjeff*
2937219820Sjeff* SEE ALSO
2938219820Sjeff*	ib_path_rec_t
2939219820Sjeff*********/
2940219820Sjeff
2941219820Sjeff/****f* IBA Base: Types/ib_path_rec_mtu
2942219820Sjeff* NAME
2943219820Sjeff*	ib_path_rec_mtu
2944219820Sjeff*
2945219820Sjeff* DESCRIPTION
2946219820Sjeff*	Get encoded path MTU.
2947219820Sjeff*
2948219820Sjeff* SYNOPSIS
2949219820Sjeff*/
2950219820Sjeffstatic inline uint8_t OSM_API
2951219820Sjeffib_path_rec_mtu(IN const ib_path_rec_t * const p_rec)
2952219820Sjeff{
2953219820Sjeff	return ((uint8_t) (p_rec->mtu & IB_PATH_REC_BASE_MASK));
2954219820Sjeff}
2955219820Sjeff
2956219820Sjeff/*
2957219820Sjeff* PARAMETERS
2958219820Sjeff*	p_rec
2959219820Sjeff*		[in] Pointer to the path record object.
2960219820Sjeff*
2961219820Sjeff* RETURN VALUES
2962219820Sjeff*	Encoded path MTU.
2963219820Sjeff*		1: 256
2964219820Sjeff*		2: 512
2965219820Sjeff*		3: 1024
2966219820Sjeff*		4: 2048
2967219820Sjeff*		5: 4096
2968219820Sjeff*		others: reserved
2969219820Sjeff*
2970219820Sjeff* NOTES
2971219820Sjeff*
2972219820Sjeff* SEE ALSO
2973219820Sjeff*	ib_path_rec_t
2974219820Sjeff*********/
2975219820Sjeff
2976219820Sjeff/****f* IBA Base: Types/ib_path_rec_mtu_sel
2977219820Sjeff* NAME
2978219820Sjeff*	ib_path_rec_mtu_sel
2979219820Sjeff*
2980219820Sjeff* DESCRIPTION
2981219820Sjeff*	Get encoded path MTU selector.
2982219820Sjeff*
2983219820Sjeff* SYNOPSIS
2984219820Sjeff*/
2985219820Sjeffstatic inline uint8_t OSM_API
2986219820Sjeffib_path_rec_mtu_sel(IN const ib_path_rec_t * const p_rec)
2987219820Sjeff{
2988219820Sjeff	return ((uint8_t) ((p_rec->mtu & IB_PATH_REC_SELECTOR_MASK) >> 6));
2989219820Sjeff}
2990219820Sjeff
2991219820Sjeff/*
2992219820Sjeff* PARAMETERS
2993219820Sjeff*	p_rec
2994219820Sjeff*		[in] Pointer to the path record object.
2995219820Sjeff*
2996219820Sjeff* RETURN VALUES
2997219820Sjeff*	Encoded path MTU selector value (for queries).
2998219820Sjeff*		0: greater than MTU specified
2999219820Sjeff*		1: less than MTU specified
3000219820Sjeff*		2: exactly the MTU specified
3001219820Sjeff*		3: largest MTU available
3002219820Sjeff*
3003219820Sjeff* NOTES
3004219820Sjeff*
3005219820Sjeff* SEE ALSO
3006219820Sjeff*	ib_path_rec_t
3007219820Sjeff*********/
3008219820Sjeff
3009219820Sjeff/****f* IBA Base: Types/ib_path_rec_rate
3010219820Sjeff* NAME
3011219820Sjeff*	ib_path_rec_rate
3012219820Sjeff*
3013219820Sjeff* DESCRIPTION
3014219820Sjeff*	Get encoded path rate.
3015219820Sjeff*
3016219820Sjeff* SYNOPSIS
3017219820Sjeff*/
3018219820Sjeffstatic inline uint8_t OSM_API
3019219820Sjeffib_path_rec_rate(IN const ib_path_rec_t * const p_rec)
3020219820Sjeff{
3021219820Sjeff	return ((uint8_t) (p_rec->rate & IB_PATH_REC_BASE_MASK));
3022219820Sjeff}
3023219820Sjeff
3024219820Sjeff/*
3025219820Sjeff* PARAMETERS
3026219820Sjeff*	p_rec
3027219820Sjeff*		[in] Pointer to the path record object.
3028219820Sjeff*
3029219820Sjeff* RETURN VALUES
3030219820Sjeff*	Encoded path rate.
3031219820Sjeff*		2: 2.5 Gb/sec.
3032219820Sjeff*		3: 10 Gb/sec.
3033219820Sjeff*		4: 30 Gb/sec.
3034219820Sjeff*		5: 5 Gb/sec.
3035219820Sjeff*		6: 20 Gb/sec.
3036219820Sjeff*		7: 40 Gb/sec.
3037219820Sjeff*		8: 60 Gb/sec.
3038219820Sjeff*		9: 80 Gb/sec.
3039219820Sjeff*		10: 120 Gb/sec.
3040219820Sjeff*		others: reserved
3041219820Sjeff*
3042219820Sjeff* NOTES
3043219820Sjeff*
3044219820Sjeff* SEE ALSO
3045219820Sjeff*	ib_path_rec_t
3046219820Sjeff*********/
3047219820Sjeff
3048219820Sjeff/****f* IBA Base: Types/ib_path_rec_rate_sel
3049219820Sjeff* NAME
3050219820Sjeff*	ib_path_rec_rate_sel
3051219820Sjeff*
3052219820Sjeff* DESCRIPTION
3053219820Sjeff*	Get encoded path rate selector.
3054219820Sjeff*
3055219820Sjeff* SYNOPSIS
3056219820Sjeff*/
3057219820Sjeffstatic inline uint8_t OSM_API
3058219820Sjeffib_path_rec_rate_sel(IN const ib_path_rec_t * const p_rec)
3059219820Sjeff{
3060219820Sjeff	return ((uint8_t) ((p_rec->rate & IB_PATH_REC_SELECTOR_MASK) >> 6));
3061219820Sjeff}
3062219820Sjeff
3063219820Sjeff/*
3064219820Sjeff* PARAMETERS
3065219820Sjeff*	p_rec
3066219820Sjeff*		[in] Pointer to the path record object.
3067219820Sjeff*
3068219820Sjeff* RETURN VALUES
3069219820Sjeff*	Encoded path rate selector value (for queries).
3070219820Sjeff*		0: greater than rate specified
3071219820Sjeff*		1: less than rate specified
3072219820Sjeff*		2: exactly the rate specified
3073219820Sjeff*		3: largest rate available
3074219820Sjeff*
3075219820Sjeff* NOTES
3076219820Sjeff*
3077219820Sjeff* SEE ALSO
3078219820Sjeff*	ib_path_rec_t
3079219820Sjeff*********/
3080219820Sjeff
3081219820Sjeff/****f* IBA Base: Types/ib_path_rec_pkt_life
3082219820Sjeff* NAME
3083219820Sjeff*	ib_path_rec_pkt_life
3084219820Sjeff*
3085219820Sjeff* DESCRIPTION
3086219820Sjeff*	Get encoded path pkt_life.
3087219820Sjeff*
3088219820Sjeff* SYNOPSIS
3089219820Sjeff*/
3090219820Sjeffstatic inline uint8_t OSM_API
3091219820Sjeffib_path_rec_pkt_life(IN const ib_path_rec_t * const p_rec)
3092219820Sjeff{
3093219820Sjeff	return ((uint8_t) (p_rec->pkt_life & IB_PATH_REC_BASE_MASK));
3094219820Sjeff}
3095219820Sjeff
3096219820Sjeff/*
3097219820Sjeff* PARAMETERS
3098219820Sjeff*	p_rec
3099219820Sjeff*		[in] Pointer to the path record object.
3100219820Sjeff*
3101219820Sjeff* RETURN VALUES
3102219820Sjeff*	Encoded path pkt_life = 4.096 usec * 2 ** PacketLifeTime.
3103219820Sjeff*
3104219820Sjeff* NOTES
3105219820Sjeff*
3106219820Sjeff* SEE ALSO
3107219820Sjeff*	ib_path_rec_t
3108219820Sjeff*********/
3109219820Sjeff
3110219820Sjeff/****f* IBA Base: Types/ib_path_rec_pkt_life_sel
3111219820Sjeff* NAME
3112219820Sjeff*	ib_path_rec_pkt_life_sel
3113219820Sjeff*
3114219820Sjeff* DESCRIPTION
3115219820Sjeff*	Get encoded path pkt_lifetime selector.
3116219820Sjeff*
3117219820Sjeff* SYNOPSIS
3118219820Sjeff*/
3119219820Sjeffstatic inline uint8_t OSM_API
3120219820Sjeffib_path_rec_pkt_life_sel(IN const ib_path_rec_t * const p_rec)
3121219820Sjeff{
3122219820Sjeff	return ((uint8_t) ((p_rec->pkt_life & IB_PATH_REC_SELECTOR_MASK) >> 6));
3123219820Sjeff}
3124219820Sjeff
3125219820Sjeff/*
3126219820Sjeff* PARAMETERS
3127219820Sjeff*	p_rec
3128219820Sjeff*		[in] Pointer to the path record object.
3129219820Sjeff*
3130219820Sjeff* RETURN VALUES
3131219820Sjeff*	Encoded path pkt_lifetime selector value (for queries).
3132219820Sjeff*		0: greater than rate specified
3133219820Sjeff*		1: less than rate specified
3134219820Sjeff*		2: exactly the rate specified
3135219820Sjeff*		3: smallest packet lifetime available
3136219820Sjeff*
3137219820Sjeff* NOTES
3138219820Sjeff*
3139219820Sjeff* SEE ALSO
3140219820Sjeff*	ib_path_rec_t
3141219820Sjeff*********/
3142219820Sjeff
3143219820Sjeff/****f* IBA Base: Types/ib_path_rec_flow_lbl
3144219820Sjeff* NAME
3145219820Sjeff*	ib_path_rec_flow_lbl
3146219820Sjeff*
3147219820Sjeff* DESCRIPTION
3148219820Sjeff*	Get flow label.
3149219820Sjeff*
3150219820Sjeff* SYNOPSIS
3151219820Sjeff*/
3152219820Sjeffstatic inline uint32_t OSM_API
3153219820Sjeffib_path_rec_flow_lbl(IN const ib_path_rec_t * const p_rec)
3154219820Sjeff{
3155219820Sjeff	return (((cl_ntoh32(p_rec->hop_flow_raw) >> 8) & 0x000FFFFF));
3156219820Sjeff}
3157219820Sjeff
3158219820Sjeff/*
3159219820Sjeff* PARAMETERS
3160219820Sjeff*	p_rec
3161219820Sjeff*		[in] Pointer to the path record object.
3162219820Sjeff*
3163219820Sjeff* RETURN VALUES
3164219820Sjeff*	Flow label of the path record.
3165219820Sjeff*
3166219820Sjeff* NOTES
3167219820Sjeff*
3168219820Sjeff* SEE ALSO
3169219820Sjeff*	ib_path_rec_t
3170219820Sjeff*********/
3171219820Sjeff
3172219820Sjeff/****f* IBA Base: Types/ib_path_rec_hop_limit
3173219820Sjeff* NAME
3174219820Sjeff*	ib_path_rec_hop_limit
3175219820Sjeff*
3176219820Sjeff* DESCRIPTION
3177219820Sjeff*	Get hop limit.
3178219820Sjeff*
3179219820Sjeff* SYNOPSIS
3180219820Sjeff*/
3181219820Sjeffstatic inline uint8_t OSM_API
3182219820Sjeffib_path_rec_hop_limit(IN const ib_path_rec_t * const p_rec)
3183219820Sjeff{
3184219820Sjeff	return ((uint8_t) (cl_ntoh32(p_rec->hop_flow_raw) & 0x000000FF));
3185219820Sjeff}
3186219820Sjeff
3187219820Sjeff/*
3188219820Sjeff* PARAMETERS
3189219820Sjeff*	p_rec
3190219820Sjeff*		[in] Pointer to the path record object.
3191219820Sjeff*
3192219820Sjeff* RETURN VALUES
3193219820Sjeff*	Hop limit of the path record.
3194219820Sjeff*
3195219820Sjeff* NOTES
3196219820Sjeff*
3197219820Sjeff* SEE ALSO
3198219820Sjeff*	ib_path_rec_t
3199219820Sjeff*********/
3200219820Sjeff
3201219820Sjeff/****s* IBA Base: Constants/IB_CLASS_CAP_TRAP
3202219820Sjeff* NAME
3203219820Sjeff*	IB_CLASS_CAP_TRAP
3204219820Sjeff*
3205219820Sjeff* DESCRIPTION
3206219820Sjeff*	ClassPortInfo CapabilityMask bits.  This bit will be set
3207219820Sjeff*	if the class supports Trap() MADs (13.4.8.1).
3208219820Sjeff*
3209219820Sjeff* SEE ALSO
3210219820Sjeff*	ib_class_port_info_t, IB_CLASS_CAP_GETSET
3211219820Sjeff*
3212219820Sjeff* SOURCE
3213219820Sjeff*/
3214219820Sjeff#define IB_CLASS_CAP_TRAP					0x0001
3215219820Sjeff/*********/
3216219820Sjeff
3217219820Sjeff/****s* IBA Base: Constants/IB_CLASS_CAP_GETSET
3218219820Sjeff* NAME
3219219820Sjeff*	IB_CLASS_CAP_GETSET
3220219820Sjeff*
3221219820Sjeff* DESCRIPTION
3222219820Sjeff*	ClassPortInfo CapabilityMask bits.  This bit will be set
3223219820Sjeff*	if the class supports Get(Notice) and Set(Notice) MADs (13.4.8.1).
3224219820Sjeff*
3225219820Sjeff* SEE ALSO
3226219820Sjeff*	ib_class_port_info_t, IB_CLASS_CAP_TRAP
3227219820Sjeff*
3228219820Sjeff* SOURCE
3229219820Sjeff*/
3230219820Sjeff#define IB_CLASS_CAP_GETSET					0x0002
3231219820Sjeff/*********/
3232219820Sjeff
3233219820Sjeff/****s* IBA Base: Constants/IB_CLASS_RESP_TIME_MASK
3234219820Sjeff* NAME
3235219820Sjeff*	IB_CLASS_RESP_TIME_MASK
3236219820Sjeff*
3237219820Sjeff* DESCRIPTION
3238219820Sjeff*	Mask bits to extract the reponse time value from the
3239219820Sjeff*	resp_time_val field of ib_class_port_info_t.
3240219820Sjeff*
3241219820Sjeff* SEE ALSO
3242219820Sjeff*	ib_class_port_info_t
3243219820Sjeff*
3244219820Sjeff* SOURCE
3245219820Sjeff*/
3246219820Sjeff#define IB_CLASS_RESP_TIME_MASK				0x1F
3247219820Sjeff/*********/
3248219820Sjeff
3249219820Sjeff/****s* IBA Base: Types/ib_class_port_info_t
3250219820Sjeff* NAME
3251219820Sjeff*	ib_class_port_info_t
3252219820Sjeff*
3253219820Sjeff* DESCRIPTION
3254219820Sjeff*	IBA defined ClassPortInfo attribute (13.4.8.1)
3255219820Sjeff*	route between two end-points on a subnet.
3256219820Sjeff*
3257219820Sjeff* SYNOPSIS
3258219820Sjeff*/
3259219820Sjeff#include <complib/cl_packon.h>
3260219820Sjefftypedef struct _ib_class_port_info {
3261219820Sjeff	uint8_t base_ver;
3262219820Sjeff	uint8_t class_ver;
3263219820Sjeff	ib_net16_t cap_mask;
3264219820Sjeff	ib_net32_t cap_mask2_resp_time;
3265219820Sjeff	ib_gid_t redir_gid;
3266219820Sjeff	ib_net32_t redir_tc_sl_fl;
3267219820Sjeff	ib_net16_t redir_lid;
3268219820Sjeff	ib_net16_t redir_pkey;
3269219820Sjeff	ib_net32_t redir_qp;
3270219820Sjeff	ib_net32_t redir_qkey;
3271219820Sjeff	ib_gid_t trap_gid;
3272219820Sjeff	ib_net32_t trap_tc_sl_fl;
3273219820Sjeff	ib_net16_t trap_lid;
3274219820Sjeff	ib_net16_t trap_pkey;
3275219820Sjeff	ib_net32_t trap_hop_qp;
3276219820Sjeff	ib_net32_t trap_qkey;
3277219820Sjeff
3278219820Sjeff} PACK_SUFFIX ib_class_port_info_t;
3279219820Sjeff#include <complib/cl_packoff.h>
3280219820Sjeff/*
3281219820Sjeff* FIELDS
3282219820Sjeff*	base_ver
3283219820Sjeff*		Maximum supported MAD Base Version.
3284219820Sjeff*
3285219820Sjeff*	class_ver
3286219820Sjeff*		Maximum supported management class version.
3287219820Sjeff*
3288219820Sjeff*	cap_mask
3289219820Sjeff*		Supported capabilities of this management class.
3290219820Sjeff*
3291219820Sjeff*	cap_mask2_resp_time
3292219820Sjeff*		Maximum expected response time and additional
3293219820Sjeff*		supported capabilities of this management class.
3294219820Sjeff*
3295219820Sjeff*	redr_gid
3296219820Sjeff*		GID to use for redirection, or zero
3297219820Sjeff*
3298219820Sjeff*	recdir_tc_sl_fl
3299219820Sjeff*		Traffic class, service level and flow label the requester
3300219820Sjeff*		should use if the service is redirected.
3301219820Sjeff*
3302219820Sjeff*	redir_lid
3303219820Sjeff*		LID used for redirection, or zero
3304219820Sjeff*
3305219820Sjeff*	redir_pkey
3306219820Sjeff*		P_Key used for redirection
3307219820Sjeff*
3308219820Sjeff*	redir_qp
3309219820Sjeff*		QP number used for redirection
3310219820Sjeff*
3311219820Sjeff*	redir_qkey
3312219820Sjeff*		Q_Key associated with the redirected QP.  This shall be the
3313219820Sjeff*		well known Q_Key value.
3314219820Sjeff*
3315219820Sjeff*	trap_gid
3316219820Sjeff*		GID value used for trap messages from this service.
3317219820Sjeff*
3318219820Sjeff*	trap_tc_sl_fl
3319219820Sjeff*		Traffic class, service level and flow label used for
3320219820Sjeff*		trap messages originated by this service.
3321219820Sjeff*
3322219820Sjeff*	trap_lid
3323219820Sjeff*		LID used for trap messages, or zero
3324219820Sjeff*
3325219820Sjeff*	trap_pkey
3326219820Sjeff*		P_Key used for trap messages
3327219820Sjeff*
3328219820Sjeff*	trap_hop_qp
3329219820Sjeff*		Hop limit (upper 8 bits) and QP number used for trap messages
3330219820Sjeff*
3331219820Sjeff*	trap_qkey
3332219820Sjeff*		Q_Key associated with the trap messages QP.
3333219820Sjeff*
3334219820Sjeff* SEE ALSO
3335219820Sjeff*	IB_CLASS_CAP_GETSET, IB_CLASS_CAP_TRAP
3336219820Sjeff*
3337219820Sjeff*********/
3338219820Sjeff
3339219820Sjeff/****f* IBA Base: Types/ib_class_set_resp_time_val
3340219820Sjeff* NAME
3341219820Sjeff*	ib_class_set_resp_time_val
3342219820Sjeff*
3343219820Sjeff* DESCRIPTION
3344219820Sjeff*	Set maximum expected response time.
3345219820Sjeff*
3346219820Sjeff* SYNOPSIS
3347219820Sjeff*/
3348219820Sjeffstatic inline void OSM_API
3349219820Sjeffib_class_set_resp_time_val(IN ib_class_port_info_t * const p_cpi,
3350219820Sjeff			   IN const uint8_t val)
3351219820Sjeff{
3352219820Sjeff	p_cpi->cap_mask2_resp_time =
3353219820Sjeff	    (p_cpi->cap_mask2_resp_time & CL_HTON32(~IB_CLASS_RESP_TIME_MASK)) |
3354219820Sjeff	    cl_hton32(val & IB_CLASS_RESP_TIME_MASK);
3355219820Sjeff}
3356219820Sjeff
3357219820Sjeff/*
3358219820Sjeff* PARAMETERS
3359219820Sjeff*	p_cpi
3360219820Sjeff*		[in] Pointer to the class port info object.
3361219820Sjeff*
3362219820Sjeff*	val
3363219820Sjeff*		[in] Response time value to set.
3364219820Sjeff*
3365219820Sjeff* RETURN VALUES
3366219820Sjeff*	None
3367219820Sjeff*
3368219820Sjeff* NOTES
3369219820Sjeff*
3370219820Sjeff* SEE ALSO
3371219820Sjeff*	ib_class_port_info_t
3372219820Sjeff*********/
3373219820Sjeff
3374219820Sjeff/****f* IBA Base: Types/ib_class_resp_time_val
3375219820Sjeff* NAME
3376219820Sjeff*	ib_class_resp_time_val
3377219820Sjeff*
3378219820Sjeff* DESCRIPTION
3379219820Sjeff*	Get response time value.
3380219820Sjeff*
3381219820Sjeff* SYNOPSIS
3382219820Sjeff*/
3383219820Sjeffstatic inline uint8_t OSM_API
3384219820Sjeffib_class_resp_time_val(IN ib_class_port_info_t * const p_cpi)
3385219820Sjeff{
3386219820Sjeff	return (uint8_t)(cl_ntoh32(p_cpi->cap_mask2_resp_time) &
3387219820Sjeff			 IB_CLASS_RESP_TIME_MASK);
3388219820Sjeff}
3389219820Sjeff
3390219820Sjeff/*
3391219820Sjeff* PARAMETERS
3392219820Sjeff*	p_cpi
3393219820Sjeff*		[in] Pointer to the class port info object.
3394219820Sjeff*
3395219820Sjeff* RETURN VALUES
3396219820Sjeff*	Response time value.
3397219820Sjeff*
3398219820Sjeff* NOTES
3399219820Sjeff*
3400219820Sjeff* SEE ALSO
3401219820Sjeff*	ib_class_port_info_t
3402219820Sjeff*********/
3403219820Sjeff
3404219820Sjeff/****f* IBA Base: Types/ib_class_set_cap_mask2
3405219820Sjeff* NAME
3406219820Sjeff*	ib_class_set_cap_mask2
3407219820Sjeff*
3408219820Sjeff* DESCRIPTION
3409219820Sjeff*	Set ClassPortInfo:CapabilityMask2.
3410219820Sjeff*
3411219820Sjeff* SYNOPSIS
3412219820Sjeff*/
3413219820Sjeffstatic inline void OSM_API
3414219820Sjeffib_class_set_cap_mask2(IN ib_class_port_info_t * const p_cpi,
3415219820Sjeff		       IN const uint32_t cap_mask2)
3416219820Sjeff{
3417219820Sjeff	p_cpi->cap_mask2_resp_time = (p_cpi->cap_mask2_resp_time &
3418219820Sjeff		CL_HTON32(IB_CLASS_RESP_TIME_MASK)) |
3419219820Sjeff		cl_hton32(cap_mask2 << 5);
3420219820Sjeff}
3421219820Sjeff
3422219820Sjeff/*
3423219820Sjeff* PARAMETERS
3424219820Sjeff*	p_cpi
3425219820Sjeff*		[in] Pointer to the class port info object.
3426219820Sjeff*
3427219820Sjeff*	cap_mask2
3428219820Sjeff*		[in] CapabilityMask2 value to set.
3429219820Sjeff*
3430219820Sjeff* RETURN VALUES
3431219820Sjeff*	None
3432219820Sjeff*
3433219820Sjeff* NOTES
3434219820Sjeff*
3435219820Sjeff* SEE ALSO
3436219820Sjeff*	ib_class_port_info_t
3437219820Sjeff*********/
3438219820Sjeff
3439219820Sjeff/****f* IBA Base: Types/ib_class_cap_mask2
3440219820Sjeff* NAME
3441219820Sjeff*	ib_class_cap_mask2
3442219820Sjeff*
3443219820Sjeff* DESCRIPTION
3444219820Sjeff*	Get ClassPortInfo:CapabilityMask2.
3445219820Sjeff*
3446219820Sjeff* SYNOPSIS
3447219820Sjeff*/
3448219820Sjeffstatic inline uint32_t OSM_API
3449219820Sjeffib_class_cap_mask2(IN const ib_class_port_info_t * const p_cpi)
3450219820Sjeff{
3451219820Sjeff	return (cl_ntoh32(p_cpi->cap_mask2_resp_time) >> 5);
3452219820Sjeff}
3453219820Sjeff
3454219820Sjeff/*
3455219820Sjeff* PARAMETERS
3456219820Sjeff*	p_cpi
3457219820Sjeff*		[in] Pointer to the class port info object.
3458219820Sjeff*
3459219820Sjeff* RETURN VALUES
3460219820Sjeff*	CapabilityMask2 of the ClassPortInfo.
3461219820Sjeff*
3462219820Sjeff* NOTES
3463219820Sjeff*
3464219820Sjeff* SEE ALSO
3465219820Sjeff*	ib_class_port_info_t
3466219820Sjeff*********/
3467219820Sjeff
3468219820Sjeff/****s* IBA Base: Types/ib_sm_info_t
3469219820Sjeff* NAME
3470219820Sjeff*	ib_sm_info_t
3471219820Sjeff*
3472219820Sjeff* DESCRIPTION
3473219820Sjeff*	SMInfo structure (14.2.5.13).
3474219820Sjeff*
3475219820Sjeff* SYNOPSIS
3476219820Sjeff*/
3477219820Sjeff#include <complib/cl_packon.h>
3478219820Sjefftypedef struct _ib_sm_info {
3479219820Sjeff	ib_net64_t guid;
3480219820Sjeff	ib_net64_t sm_key;
3481219820Sjeff	ib_net32_t act_count;
3482219820Sjeff	uint8_t pri_state;
3483219820Sjeff
3484219820Sjeff} PACK_SUFFIX ib_sm_info_t;
3485219820Sjeff#include <complib/cl_packoff.h>
3486219820Sjeff/*
3487219820Sjeff* FIELDS
3488219820Sjeff*	guid
3489219820Sjeff*		Port GUID for this SM.
3490219820Sjeff*
3491219820Sjeff*	sm_key
3492219820Sjeff*		SM_Key of this SM.
3493219820Sjeff*
3494219820Sjeff*	act_count
3495219820Sjeff*		Activity counter used as a heartbeat.
3496219820Sjeff*
3497219820Sjeff*	pri_state
3498219820Sjeff*		Priority and State information
3499219820Sjeff*
3500219820Sjeff* SEE ALSO
3501219820Sjeff*********/
3502219820Sjeff
3503219820Sjeff/****f* IBA Base: Types/ib_sminfo_get_priority
3504219820Sjeff* NAME
3505219820Sjeff*	ib_sminfo_get_priority
3506219820Sjeff*
3507219820Sjeff* DESCRIPTION
3508219820Sjeff*	Returns the priority value.
3509219820Sjeff*
3510219820Sjeff* SYNOPSIS
3511219820Sjeff*/
3512219820Sjeffstatic inline uint8_t OSM_API
3513219820Sjeffib_sminfo_get_priority(IN const ib_sm_info_t * const p_smi)
3514219820Sjeff{
3515219820Sjeff	return ((uint8_t) ((p_smi->pri_state & 0xF0) >> 4));
3516219820Sjeff}
3517219820Sjeff
3518219820Sjeff/*
3519219820Sjeff* PARAMETERS
3520219820Sjeff*	p_smi
3521219820Sjeff*		[in] Pointer to the SMInfo Attribute.
3522219820Sjeff*
3523219820Sjeff* RETURN VALUES
3524219820Sjeff*	Returns the priority value.
3525219820Sjeff*
3526219820Sjeff* NOTES
3527219820Sjeff*
3528219820Sjeff* SEE ALSO
3529219820Sjeff*********/
3530219820Sjeff
3531219820Sjeff/****f* IBA Base: Types/ib_sminfo_get_state
3532219820Sjeff* NAME
3533219820Sjeff*	ib_sminfo_get_state
3534219820Sjeff*
3535219820Sjeff* DESCRIPTION
3536219820Sjeff*	Returns the state value.
3537219820Sjeff*
3538219820Sjeff* SYNOPSIS
3539219820Sjeff*/
3540219820Sjeffstatic inline uint8_t OSM_API
3541219820Sjeffib_sminfo_get_state(IN const ib_sm_info_t * const p_smi)
3542219820Sjeff{
3543219820Sjeff	return ((uint8_t) (p_smi->pri_state & 0x0F));
3544219820Sjeff}
3545219820Sjeff
3546219820Sjeff/*
3547219820Sjeff* PARAMETERS
3548219820Sjeff*	p_smi
3549219820Sjeff*		[in] Pointer to the SMInfo Attribute.
3550219820Sjeff*
3551219820Sjeff* RETURN VALUES
3552219820Sjeff*	Returns the state value.
3553219820Sjeff*
3554219820Sjeff* NOTES
3555219820Sjeff*
3556219820Sjeff* SEE ALSO
3557219820Sjeff*********/
3558219820Sjeff
3559219820Sjeff/****s* IBA Base: Types/ib_mad_t
3560219820Sjeff* NAME
3561219820Sjeff*	ib_mad_t
3562219820Sjeff*
3563219820Sjeff* DESCRIPTION
3564219820Sjeff*	IBA defined MAD header (13.4.3)
3565219820Sjeff*
3566219820Sjeff* SYNOPSIS
3567219820Sjeff*/
3568219820Sjeff#include <complib/cl_packon.h>
3569219820Sjefftypedef struct _ib_mad {
3570219820Sjeff	uint8_t base_ver;
3571219820Sjeff	uint8_t mgmt_class;
3572219820Sjeff	uint8_t class_ver;
3573219820Sjeff	uint8_t method;
3574219820Sjeff	ib_net16_t status;
3575219820Sjeff	ib_net16_t class_spec;
3576219820Sjeff	ib_net64_t trans_id;
3577219820Sjeff	ib_net16_t attr_id;
3578219820Sjeff	ib_net16_t resv;
3579219820Sjeff	ib_net32_t attr_mod;
3580219820Sjeff} PACK_SUFFIX ib_mad_t;
3581219820Sjeff#include <complib/cl_packoff.h>
3582219820Sjeff/*
3583219820Sjeff* FIELDS
3584219820Sjeff*	base_ver
3585219820Sjeff*		MAD base format.
3586219820Sjeff*
3587219820Sjeff*	mgmt_class
3588219820Sjeff*		Class of operation.
3589219820Sjeff*
3590219820Sjeff*	class_ver
3591219820Sjeff*		Version of MAD class-specific format.
3592219820Sjeff*
3593219820Sjeff*	method
3594219820Sjeff*		Method to perform, including 'R' bit.
3595219820Sjeff*
3596219820Sjeff*	status
3597219820Sjeff*		Status of operation.
3598219820Sjeff*
3599219820Sjeff*	class_spec
3600219820Sjeff*		Reserved for subnet management.
3601219820Sjeff*
3602219820Sjeff*	trans_id
3603219820Sjeff*		Transaction ID.
3604219820Sjeff*
3605219820Sjeff*	attr_id
3606219820Sjeff*		Attribute ID.
3607219820Sjeff*
3608219820Sjeff*	resv
3609219820Sjeff*		Reserved field.
3610219820Sjeff*
3611219820Sjeff*	attr_mod
3612219820Sjeff*		Attribute modifier.
3613219820Sjeff*
3614219820Sjeff* SEE ALSO
3615219820Sjeff*********/
3616219820Sjeff
3617219820Sjeff/****s* IBA Base: Types/ib_rmpp_mad_t
3618219820Sjeff* NAME
3619219820Sjeff*	ib_rmpp_mad_t
3620219820Sjeff*
3621219820Sjeff* DESCRIPTION
3622219820Sjeff*	IBA defined MAD RMPP header (13.6.2.1)
3623219820Sjeff*
3624219820Sjeff* SYNOPSIS
3625219820Sjeff*/
3626219820Sjeff#include <complib/cl_packon.h>
3627219820Sjefftypedef struct _ib_rmpp_mad {
3628219820Sjeff	ib_mad_t common_hdr;
3629219820Sjeff
3630219820Sjeff	uint8_t rmpp_version;
3631219820Sjeff	uint8_t rmpp_type;
3632219820Sjeff	uint8_t rmpp_flags;
3633219820Sjeff	uint8_t rmpp_status;
3634219820Sjeff
3635219820Sjeff	ib_net32_t seg_num;
3636219820Sjeff	ib_net32_t paylen_newwin;
3637219820Sjeff
3638219820Sjeff} PACK_SUFFIX ib_rmpp_mad_t;
3639219820Sjeff#include <complib/cl_packoff.h>
3640219820Sjeff/*
3641219820Sjeff* SEE ALSO
3642219820Sjeff*	ib_mad_t
3643219820Sjeff*********/
3644219820Sjeff
3645219820Sjeff/****f* IBA Base: Types/ib_mad_init_new
3646219820Sjeff* NAME
3647219820Sjeff*	ib_mad_init_new
3648219820Sjeff*
3649219820Sjeff* DESCRIPTION
3650219820Sjeff*	Initializes a MAD common header.
3651219820Sjeff*
3652219820Sjeff* SYNOPSIS
3653219820Sjeff*/
3654219820Sjeffstatic inline void OSM_API
3655219820Sjeffib_mad_init_new(IN ib_mad_t * const p_mad,
3656219820Sjeff		IN const uint8_t mgmt_class,
3657219820Sjeff		IN const uint8_t class_ver,
3658219820Sjeff		IN const uint8_t method,
3659219820Sjeff		IN const ib_net64_t trans_id,
3660219820Sjeff		IN const ib_net16_t attr_id, IN const ib_net32_t attr_mod)
3661219820Sjeff{
3662219820Sjeff	CL_ASSERT(p_mad);
3663219820Sjeff	p_mad->base_ver = 1;
3664219820Sjeff	p_mad->mgmt_class = mgmt_class;
3665219820Sjeff	p_mad->class_ver = class_ver;
3666219820Sjeff	p_mad->method = method;
3667219820Sjeff	p_mad->status = 0;
3668219820Sjeff	p_mad->class_spec = 0;
3669219820Sjeff	p_mad->trans_id = trans_id;
3670219820Sjeff	p_mad->attr_id = attr_id;
3671219820Sjeff	p_mad->resv = 0;
3672219820Sjeff	p_mad->attr_mod = attr_mod;
3673219820Sjeff}
3674219820Sjeff
3675219820Sjeff/*
3676219820Sjeff* PARAMETERS
3677219820Sjeff*	p_mad
3678219820Sjeff*		[in] Pointer to the MAD common header.
3679219820Sjeff*
3680219820Sjeff*	mgmt_class
3681219820Sjeff*		[in] Class of operation.
3682219820Sjeff*
3683219820Sjeff*	class_ver
3684219820Sjeff*		[in] Version of MAD class-specific format.
3685219820Sjeff*
3686219820Sjeff*	method
3687219820Sjeff*		[in] Method to perform, including 'R' bit.
3688219820Sjeff*
3689219820Sjeff*	trans_Id
3690219820Sjeff*		[in] Transaction ID.
3691219820Sjeff*
3692219820Sjeff*	attr_id
3693219820Sjeff*		[in] Attribute ID.
3694219820Sjeff*
3695219820Sjeff*	attr_mod
3696219820Sjeff*		[in] Attribute modifier.
3697219820Sjeff*
3698219820Sjeff* RETURN VALUES
3699219820Sjeff*	None.
3700219820Sjeff*
3701219820Sjeff* NOTES
3702219820Sjeff*
3703219820Sjeff* SEE ALSO
3704219820Sjeff*	ib_mad_t
3705219820Sjeff*********/
3706219820Sjeff
3707219820Sjeff/****f* IBA Base: Types/ib_mad_init_response
3708219820Sjeff* NAME
3709219820Sjeff*	ib_mad_init_response
3710219820Sjeff*
3711219820Sjeff* DESCRIPTION
3712219820Sjeff*	Initializes a MAD common header as a response.
3713219820Sjeff*
3714219820Sjeff* SYNOPSIS
3715219820Sjeff*/
3716219820Sjeffstatic inline void OSM_API
3717219820Sjeffib_mad_init_response(IN const ib_mad_t * const p_req_mad,
3718219820Sjeff		     IN ib_mad_t * const p_mad, IN const ib_net16_t status)
3719219820Sjeff{
3720219820Sjeff	CL_ASSERT(p_req_mad);
3721219820Sjeff	CL_ASSERT(p_mad);
3722219820Sjeff	*p_mad = *p_req_mad;
3723219820Sjeff	p_mad->status = status;
3724219820Sjeff	if (p_mad->method == IB_MAD_METHOD_SET)
3725219820Sjeff		p_mad->method = IB_MAD_METHOD_GET;
3726219820Sjeff	p_mad->method |= IB_MAD_METHOD_RESP_MASK;
3727219820Sjeff}
3728219820Sjeff
3729219820Sjeff/*
3730219820Sjeff* PARAMETERS
3731219820Sjeff*	p_req_mad
3732219820Sjeff*		[in] Pointer to the MAD common header in the original request MAD.
3733219820Sjeff*
3734219820Sjeff*	p_mad
3735219820Sjeff*		[in] Pointer to the MAD common header to initialize.
3736219820Sjeff*
3737219820Sjeff*	status
3738219820Sjeff*		[in] MAD Status value to return;
3739219820Sjeff*
3740219820Sjeff* RETURN VALUES
3741219820Sjeff*	None.
3742219820Sjeff*
3743219820Sjeff* NOTES
3744219820Sjeff*	p_req_mad and p_mad may point to the same MAD.
3745219820Sjeff*
3746219820Sjeff* SEE ALSO
3747219820Sjeff*	ib_mad_t
3748219820Sjeff*********/
3749219820Sjeff
3750219820Sjeff/****f* IBA Base: Types/ib_mad_is_response
3751219820Sjeff* NAME
3752219820Sjeff*	ib_mad_is_response
3753219820Sjeff*
3754219820Sjeff* DESCRIPTION
3755219820Sjeff*	Returns TRUE if the MAD is a response ('R' bit set),
3756219820Sjeff*	FALSE otherwise.
3757219820Sjeff*
3758219820Sjeff* SYNOPSIS
3759219820Sjeff*/
3760219820Sjeffstatic inline boolean_t OSM_API
3761219820Sjeffib_mad_is_response(IN const ib_mad_t * const p_mad)
3762219820Sjeff{
3763219820Sjeff	CL_ASSERT(p_mad);
3764219820Sjeff	return ((p_mad->method & IB_MAD_METHOD_RESP_MASK) ==
3765219820Sjeff		IB_MAD_METHOD_RESP_MASK);
3766219820Sjeff}
3767219820Sjeff
3768219820Sjeff/*
3769219820Sjeff* PARAMETERS
3770219820Sjeff*	p_mad
3771219820Sjeff*		[in] Pointer to the MAD.
3772219820Sjeff*
3773219820Sjeff* RETURN VALUES
3774219820Sjeff*	Returns TRUE if the MAD is a response ('R' bit set),
3775219820Sjeff*	FALSE otherwise.
3776219820Sjeff*
3777219820Sjeff* NOTES
3778219820Sjeff*
3779219820Sjeff* SEE ALSO
3780219820Sjeff*	ib_mad_t
3781219820Sjeff*********/
3782219820Sjeff
3783219820Sjeff#define IB_RMPP_TYPE_DATA		1
3784219820Sjeff#define IB_RMPP_TYPE_ACK		2
3785219820Sjeff#define IB_RMPP_TYPE_STOP		3
3786219820Sjeff#define IB_RMPP_TYPE_ABORT		4
3787219820Sjeff
3788219820Sjeff#define IB_RMPP_NO_RESP_TIME		0x1F
3789219820Sjeff#define IB_RMPP_FLAG_ACTIVE		0x01
3790219820Sjeff#define IB_RMPP_FLAG_FIRST		0x02
3791219820Sjeff#define IB_RMPP_FLAG_LAST		0x04
3792219820Sjeff
3793219820Sjeff#define IB_RMPP_STATUS_SUCCESS		0
3794219820Sjeff#define IB_RMPP_STATUS_RESX		1	/* resources exhausted */
3795219820Sjeff#define IB_RMPP_STATUS_T2L		118	/* time too long */
3796219820Sjeff#define IB_RMPP_STATUS_BAD_LEN		119	/* incon. last and payload len */
3797219820Sjeff#define IB_RMPP_STATUS_BAD_SEG		120	/* incon. first and segment no */
3798219820Sjeff#define IB_RMPP_STATUS_BADT		121	/* bad rmpp type */
3799219820Sjeff#define IB_RMPP_STATUS_W2S		122	/* newwindowlast too small */
3800219820Sjeff#define IB_RMPP_STATUS_S2B		123	/* segment no too big */
3801219820Sjeff#define IB_RMPP_STATUS_BAD_STATUS	124	/* illegal status */
3802219820Sjeff#define IB_RMPP_STATUS_UNV		125	/* unsupported version */
3803219820Sjeff#define IB_RMPP_STATUS_TMR		126	/* too many retries */
3804219820Sjeff#define IB_RMPP_STATUS_UNSPEC		127	/* unspecified */
3805219820Sjeff
3806219820Sjeff/****f* IBA Base: Types/ib_rmpp_is_flag_set
3807219820Sjeff* NAME
3808219820Sjeff*	ib_rmpp_is_flag_set
3809219820Sjeff*
3810219820Sjeff* DESCRIPTION
3811219820Sjeff*	Returns TRUE if the MAD has the given RMPP flag set.
3812219820Sjeff*
3813219820Sjeff* SYNOPSIS
3814219820Sjeff*/
3815219820Sjeffstatic inline boolean_t OSM_API
3816219820Sjeffib_rmpp_is_flag_set(IN const ib_rmpp_mad_t * const p_rmpp_mad,
3817219820Sjeff		    IN const uint8_t flag)
3818219820Sjeff{
3819219820Sjeff	CL_ASSERT(p_rmpp_mad);
3820219820Sjeff	return ((p_rmpp_mad->rmpp_flags & flag) == flag);
3821219820Sjeff}
3822219820Sjeff
3823219820Sjeff/*
3824219820Sjeff* PARAMETERS
3825219820Sjeff*	ib_rmpp_mad_t
3826219820Sjeff*		[in] Pointer to a MAD with an RMPP header.
3827219820Sjeff*
3828219820Sjeff*	flag
3829219820Sjeff*		[in] The RMPP flag being examined.
3830219820Sjeff*
3831219820Sjeff* RETURN VALUES
3832219820Sjeff*	Returns TRUE if the MAD has the given RMPP flag set.
3833219820Sjeff*
3834219820Sjeff* NOTES
3835219820Sjeff*
3836219820Sjeff* SEE ALSO
3837219820Sjeff*	ib_mad_t, ib_rmpp_mad_t
3838219820Sjeff*********/
3839219820Sjeff
3840219820Sjeffstatic inline void OSM_API
3841219820Sjeffib_rmpp_set_resp_time(IN ib_rmpp_mad_t * const p_rmpp_mad,
3842219820Sjeff		      IN const uint8_t resp_time)
3843219820Sjeff{
3844219820Sjeff	CL_ASSERT(p_rmpp_mad);
3845219820Sjeff	p_rmpp_mad->rmpp_flags |= (resp_time << 3);
3846219820Sjeff}
3847219820Sjeff
3848219820Sjeffstatic inline uint8_t OSM_API
3849219820Sjeffib_rmpp_get_resp_time(IN const ib_rmpp_mad_t * const p_rmpp_mad)
3850219820Sjeff{
3851219820Sjeff	CL_ASSERT(p_rmpp_mad);
3852219820Sjeff	return ((uint8_t) (p_rmpp_mad->rmpp_flags >> 3));
3853219820Sjeff}
3854219820Sjeff
3855219820Sjeff/****d* IBA Base: Constants/IB_SMP_DIRECTION
3856219820Sjeff* NAME
3857219820Sjeff*	IB_SMP_DIRECTION
3858219820Sjeff*
3859219820Sjeff* DESCRIPTION
3860219820Sjeff*	The Direction bit for directed route SMPs.
3861219820Sjeff*
3862219820Sjeff* SOURCE
3863219820Sjeff*/
3864219820Sjeff#define IB_SMP_DIRECTION_HO		0x8000
3865219820Sjeff#define IB_SMP_DIRECTION		(CL_HTON16(IB_SMP_DIRECTION_HO))
3866219820Sjeff/**********/
3867219820Sjeff
3868219820Sjeff/****d* IBA Base: Constants/IB_SMP_STATUS_MASK
3869219820Sjeff* NAME
3870219820Sjeff*	IB_SMP_STATUS_MASK
3871219820Sjeff*
3872219820Sjeff* DESCRIPTION
3873219820Sjeff*	Mask value for extracting status from a directed route SMP.
3874219820Sjeff*
3875219820Sjeff* SOURCE
3876219820Sjeff*/
3877219820Sjeff#define IB_SMP_STATUS_MASK_HO		0x7FFF
3878219820Sjeff#define IB_SMP_STATUS_MASK		(CL_HTON16(IB_SMP_STATUS_MASK_HO))
3879219820Sjeff/**********/
3880219820Sjeff
3881219820Sjeff/****s* IBA Base: Types/ib_smp_t
3882219820Sjeff* NAME
3883219820Sjeff*	ib_smp_t
3884219820Sjeff*
3885219820Sjeff* DESCRIPTION
3886219820Sjeff*	IBA defined SMP. (14.2.1.2)
3887219820Sjeff*
3888219820Sjeff* SYNOPSIS
3889219820Sjeff*/
3890219820Sjeff#define IB_SMP_DATA_SIZE 64
3891219820Sjeff#include <complib/cl_packon.h>
3892219820Sjefftypedef struct _ib_smp {
3893219820Sjeff	uint8_t base_ver;
3894219820Sjeff	uint8_t mgmt_class;
3895219820Sjeff	uint8_t class_ver;
3896219820Sjeff	uint8_t method;
3897219820Sjeff	ib_net16_t status;
3898219820Sjeff	uint8_t hop_ptr;
3899219820Sjeff	uint8_t hop_count;
3900219820Sjeff	ib_net64_t trans_id;
3901219820Sjeff	ib_net16_t attr_id;
3902219820Sjeff	ib_net16_t resv;
3903219820Sjeff	ib_net32_t attr_mod;
3904219820Sjeff	ib_net64_t m_key;
3905219820Sjeff	ib_net16_t dr_slid;
3906219820Sjeff	ib_net16_t dr_dlid;
3907219820Sjeff	uint32_t resv1[7];
3908219820Sjeff	uint8_t data[IB_SMP_DATA_SIZE];
3909219820Sjeff	uint8_t initial_path[IB_SUBNET_PATH_HOPS_MAX];
3910219820Sjeff	uint8_t return_path[IB_SUBNET_PATH_HOPS_MAX];
3911219820Sjeff
3912219820Sjeff} PACK_SUFFIX ib_smp_t;
3913219820Sjeff#include <complib/cl_packoff.h>
3914219820Sjeff/*
3915219820Sjeff* FIELDS
3916219820Sjeff*	base_ver
3917219820Sjeff*		MAD base format.
3918219820Sjeff*
3919219820Sjeff*	mgmt_class
3920219820Sjeff*		Class of operation.
3921219820Sjeff*
3922219820Sjeff*	class_ver
3923219820Sjeff*		Version of MAD class-specific format.
3924219820Sjeff*
3925219820Sjeff*	method
3926219820Sjeff*		Method to perform, including 'R' bit.
3927219820Sjeff*
3928219820Sjeff*	status
3929219820Sjeff*		Status of operation.
3930219820Sjeff*
3931219820Sjeff*	hop_ptr
3932219820Sjeff*		Hop pointer for directed route MADs.
3933219820Sjeff*
3934219820Sjeff*	hop_count
3935219820Sjeff*		Hop count for directed route MADs.
3936219820Sjeff*
3937219820Sjeff*	trans_Id
3938219820Sjeff*		Transaction ID.
3939219820Sjeff*
3940219820Sjeff*	attr_id
3941219820Sjeff*		Attribute ID.
3942219820Sjeff*
3943219820Sjeff*	resv
3944219820Sjeff*		Reserved field.
3945219820Sjeff*
3946219820Sjeff*	attr_mod
3947219820Sjeff*		Attribute modifier.
3948219820Sjeff*
3949219820Sjeff*	m_key
3950219820Sjeff*		Management key value.
3951219820Sjeff*
3952219820Sjeff*	dr_slid
3953219820Sjeff*		Directed route source LID.
3954219820Sjeff*
3955219820Sjeff*	dr_dlid
3956219820Sjeff*		Directed route destination LID.
3957219820Sjeff*
3958219820Sjeff*	resv0
3959219820Sjeff*		Reserved for 64 byte alignment.
3960219820Sjeff*
3961219820Sjeff*	data
3962219820Sjeff*		MAD data payload.
3963219820Sjeff*
3964219820Sjeff*	initial_path
3965219820Sjeff*		Outbound port list.
3966219820Sjeff*
3967219820Sjeff*	return_path
3968219820Sjeff*		Inbound port list.
3969219820Sjeff*
3970219820Sjeff* SEE ALSO
3971219820Sjeff*********/
3972219820Sjeff
3973219820Sjeff/****f* IBA Base: Types/ib_smp_get_status
3974219820Sjeff* NAME
3975219820Sjeff*	ib_smp_get_status
3976219820Sjeff*
3977219820Sjeff* DESCRIPTION
3978219820Sjeff*	Returns the SMP status value in network order.
3979219820Sjeff*
3980219820Sjeff* SYNOPSIS
3981219820Sjeff*/
3982219820Sjeffstatic inline ib_net16_t OSM_API
3983219820Sjeffib_smp_get_status(IN const ib_smp_t * const p_smp)
3984219820Sjeff{
3985219820Sjeff	return ((ib_net16_t) (p_smp->status & IB_SMP_STATUS_MASK));
3986219820Sjeff}
3987219820Sjeff
3988219820Sjeff/*
3989219820Sjeff* PARAMETERS
3990219820Sjeff*	p_smp
3991219820Sjeff*		[in] Pointer to the SMP packet.
3992219820Sjeff*
3993219820Sjeff* RETURN VALUES
3994219820Sjeff*	Returns the SMP status value in network order.
3995219820Sjeff*
3996219820Sjeff* NOTES
3997219820Sjeff*
3998219820Sjeff* SEE ALSO
3999219820Sjeff*	ib_smp_t
4000219820Sjeff*********/
4001219820Sjeff
4002219820Sjeff/****f* IBA Base: Types/ib_smp_is_response
4003219820Sjeff* NAME
4004219820Sjeff*	ib_smp_is_response
4005219820Sjeff*
4006219820Sjeff* DESCRIPTION
4007219820Sjeff*	Returns TRUE if the SMP is a response MAD, FALSE otherwise.
4008219820Sjeff*
4009219820Sjeff* SYNOPSIS
4010219820Sjeff*/
4011219820Sjeffstatic inline boolean_t OSM_API
4012219820Sjeffib_smp_is_response(IN const ib_smp_t * const p_smp)
4013219820Sjeff{
4014219820Sjeff	return (ib_mad_is_response((const ib_mad_t *)p_smp));
4015219820Sjeff}
4016219820Sjeff
4017219820Sjeff/*
4018219820Sjeff* PARAMETERS
4019219820Sjeff*	p_smp
4020219820Sjeff*		[in] Pointer to the SMP packet.
4021219820Sjeff*
4022219820Sjeff* RETURN VALUES
4023219820Sjeff*	Returns TRUE if the SMP is a response MAD, FALSE otherwise.
4024219820Sjeff*
4025219820Sjeff* NOTES
4026219820Sjeff*
4027219820Sjeff* SEE ALSO
4028219820Sjeff*	ib_smp_t
4029219820Sjeff*********/
4030219820Sjeff
4031219820Sjeff/****f* IBA Base: Types/ib_smp_is_d
4032219820Sjeff* NAME
4033219820Sjeff*	ib_smp_is_d
4034219820Sjeff*
4035219820Sjeff* DESCRIPTION
4036219820Sjeff*	Returns TRUE if the SMP 'D' (direction) bit is set.
4037219820Sjeff*
4038219820Sjeff* SYNOPSIS
4039219820Sjeff*/
4040219820Sjeffstatic inline boolean_t OSM_API ib_smp_is_d(IN const ib_smp_t * const p_smp)
4041219820Sjeff{
4042219820Sjeff	return ((p_smp->status & IB_SMP_DIRECTION) == IB_SMP_DIRECTION);
4043219820Sjeff}
4044219820Sjeff
4045219820Sjeff/*
4046219820Sjeff* PARAMETERS
4047219820Sjeff*	p_smp
4048219820Sjeff*		[in] Pointer to the SMP packet.
4049219820Sjeff*
4050219820Sjeff* RETURN VALUES
4051219820Sjeff*	Returns TRUE if the SMP 'D' (direction) bit is set.
4052219820Sjeff*
4053219820Sjeff* NOTES
4054219820Sjeff*
4055219820Sjeff* SEE ALSO
4056219820Sjeff*	ib_smp_t
4057219820Sjeff*********/
4058219820Sjeff
4059219820Sjeff/****f* IBA Base: Types/ib_smp_init_new
4060219820Sjeff* NAME
4061219820Sjeff*	ib_smp_init_new
4062219820Sjeff*
4063219820Sjeff* DESCRIPTION
4064219820Sjeff*	Initializes a MAD common header.
4065219820Sjeff*
4066219820Sjeff* TODO
4067219820Sjeff*	This is too big for inlining, but leave it here for now
4068219820Sjeff*	since there is not yet another convient spot.
4069219820Sjeff*
4070219820Sjeff* SYNOPSIS
4071219820Sjeff*/
4072219820Sjeffstatic inline void OSM_API
4073219820Sjeffib_smp_init_new(IN ib_smp_t * const p_smp,
4074219820Sjeff		IN const uint8_t method,
4075219820Sjeff		IN const ib_net64_t trans_id,
4076219820Sjeff		IN const ib_net16_t attr_id,
4077219820Sjeff		IN const ib_net32_t attr_mod,
4078219820Sjeff		IN const uint8_t hop_count,
4079219820Sjeff		IN const ib_net64_t m_key,
4080219820Sjeff		IN const uint8_t * path_out,
4081219820Sjeff		IN const ib_net16_t dr_slid, IN const ib_net16_t dr_dlid)
4082219820Sjeff{
4083219820Sjeff	CL_ASSERT(p_smp);
4084219820Sjeff	CL_ASSERT(hop_count < IB_SUBNET_PATH_HOPS_MAX);
4085219820Sjeff	p_smp->base_ver = 1;
4086219820Sjeff	p_smp->mgmt_class = IB_MCLASS_SUBN_DIR;
4087219820Sjeff	p_smp->class_ver = 1;
4088219820Sjeff	p_smp->method = method;
4089219820Sjeff	p_smp->status = 0;
4090219820Sjeff	p_smp->hop_ptr = 0;
4091219820Sjeff	p_smp->hop_count = hop_count;
4092219820Sjeff	p_smp->trans_id = trans_id;
4093219820Sjeff	p_smp->attr_id = attr_id;
4094219820Sjeff	p_smp->resv = 0;
4095219820Sjeff	p_smp->attr_mod = attr_mod;
4096219820Sjeff	p_smp->m_key = m_key;
4097219820Sjeff	p_smp->dr_slid = dr_slid;
4098219820Sjeff	p_smp->dr_dlid = dr_dlid;
4099219820Sjeff
4100219820Sjeff	memset(p_smp->resv1, 0,
4101219820Sjeff	       sizeof(p_smp->resv1) +
4102219820Sjeff	       sizeof(p_smp->data) +
4103219820Sjeff	       sizeof(p_smp->initial_path) + sizeof(p_smp->return_path));
4104219820Sjeff
4105219820Sjeff	/* copy the path */
4106219820Sjeff	memcpy(&p_smp->initial_path, path_out, sizeof(p_smp->initial_path));
4107219820Sjeff}
4108219820Sjeff
4109219820Sjeff/*
4110219820Sjeff* PARAMETERS
4111219820Sjeff*	p_smp
4112219820Sjeff*		[in] Pointer to the SMP packet.
4113219820Sjeff*
4114219820Sjeff*	method
4115219820Sjeff*		[in] Method to perform, including 'R' bit.
4116219820Sjeff*
4117219820Sjeff*	trans_Id
4118219820Sjeff*		[in] Transaction ID.
4119219820Sjeff*
4120219820Sjeff*	attr_id
4121219820Sjeff*		[in] Attribute ID.
4122219820Sjeff*
4123219820Sjeff*	attr_mod
4124219820Sjeff*		[in] Attribute modifier.
4125219820Sjeff*
4126219820Sjeff*	hop_count
4127219820Sjeff*		[in] Number of hops in the path.
4128219820Sjeff*
4129219820Sjeff*	m_key
4130219820Sjeff*		[in] Management key for this SMP.
4131219820Sjeff*
4132219820Sjeff*	path_out
4133219820Sjeff*		[in] Port array for outbound path.
4134219820Sjeff*
4135219820Sjeff*
4136219820Sjeff* RETURN VALUES
4137219820Sjeff*	None.
4138219820Sjeff*
4139219820Sjeff* NOTES
4140219820Sjeff*	Payload area is initialized to zero.
4141219820Sjeff*
4142219820Sjeff*
4143219820Sjeff* SEE ALSO
4144219820Sjeff*	ib_mad_t
4145219820Sjeff*********/
4146219820Sjeff
4147219820Sjeff/****f* IBA Base: Types/ib_smp_get_payload_ptr
4148219820Sjeff* NAME
4149219820Sjeff*	ib_smp_get_payload_ptr
4150219820Sjeff*
4151219820Sjeff* DESCRIPTION
4152219820Sjeff*	Gets a pointer to the SMP payload area.
4153219820Sjeff*
4154219820Sjeff* SYNOPSIS
4155219820Sjeff*/
4156219820Sjeffstatic inline void *OSM_API
4157219820Sjeffib_smp_get_payload_ptr(IN const ib_smp_t * const p_smp)
4158219820Sjeff{
4159219820Sjeff	return ((void *)p_smp->data);
4160219820Sjeff}
4161219820Sjeff
4162219820Sjeff/*
4163219820Sjeff* PARAMETERS
4164219820Sjeff*	p_smp
4165219820Sjeff*		[in] Pointer to the SMP packet.
4166219820Sjeff*
4167219820Sjeff* RETURN VALUES
4168219820Sjeff*	Pointer to SMP payload area.
4169219820Sjeff*
4170219820Sjeff* NOTES
4171219820Sjeff*
4172219820Sjeff* SEE ALSO
4173219820Sjeff*	ib_mad_t
4174219820Sjeff*********/
4175219820Sjeff
4176219820Sjeff/****s* IBA Base: Types/ib_node_info_t
4177219820Sjeff* NAME
4178219820Sjeff*	ib_node_info_t
4179219820Sjeff*
4180219820Sjeff* DESCRIPTION
4181219820Sjeff*	IBA defined NodeInfo. (14.2.5.3)
4182219820Sjeff*
4183219820Sjeff* SYNOPSIS
4184219820Sjeff*/
4185219820Sjeff#include <complib/cl_packon.h>
4186219820Sjefftypedef struct _ib_node_info {
4187219820Sjeff	uint8_t base_version;
4188219820Sjeff	uint8_t class_version;
4189219820Sjeff	uint8_t node_type;
4190219820Sjeff	uint8_t num_ports;
4191219820Sjeff	ib_net64_t sys_guid;
4192219820Sjeff	ib_net64_t node_guid;
4193219820Sjeff	ib_net64_t port_guid;
4194219820Sjeff	ib_net16_t partition_cap;
4195219820Sjeff	ib_net16_t device_id;
4196219820Sjeff	ib_net32_t revision;
4197219820Sjeff	ib_net32_t port_num_vendor_id;
4198219820Sjeff
4199219820Sjeff} PACK_SUFFIX ib_node_info_t;
4200219820Sjeff#include <complib/cl_packoff.h>
4201219820Sjeff/************/
4202219820Sjeff
4203219820Sjeff/****s* IBA Base: Types/ib_sa_mad_t
4204219820Sjeff* NAME
4205219820Sjeff*	ib_sa_mad_t
4206219820Sjeff*
4207219820Sjeff* DESCRIPTION
4208219820Sjeff*	IBA defined SA MAD format. (15.2.1)
4209219820Sjeff*
4210219820Sjeff* SYNOPSIS
4211219820Sjeff*/
4212219820Sjeff#define IB_SA_DATA_SIZE 200
4213219820Sjeff
4214219820Sjeff#include <complib/cl_packon.h>
4215219820Sjefftypedef struct _ib_sa_mad {
4216219820Sjeff	uint8_t base_ver;
4217219820Sjeff	uint8_t mgmt_class;
4218219820Sjeff	uint8_t class_ver;
4219219820Sjeff	uint8_t method;
4220219820Sjeff	ib_net16_t status;
4221219820Sjeff	ib_net16_t resv;
4222219820Sjeff	ib_net64_t trans_id;
4223219820Sjeff	ib_net16_t attr_id;
4224219820Sjeff	ib_net16_t resv1;
4225219820Sjeff	ib_net32_t attr_mod;
4226219820Sjeff
4227219820Sjeff	uint8_t rmpp_version;
4228219820Sjeff	uint8_t rmpp_type;
4229219820Sjeff	uint8_t rmpp_flags;
4230219820Sjeff	uint8_t rmpp_status;
4231219820Sjeff
4232219820Sjeff	ib_net32_t seg_num;
4233219820Sjeff	ib_net32_t paylen_newwin;
4234219820Sjeff
4235219820Sjeff	ib_net64_t sm_key;
4236219820Sjeff
4237219820Sjeff	ib_net16_t attr_offset;
4238219820Sjeff	ib_net16_t resv3;
4239219820Sjeff
4240219820Sjeff	ib_net64_t comp_mask;
4241219820Sjeff
4242219820Sjeff	uint8_t data[IB_SA_DATA_SIZE];
4243219820Sjeff} PACK_SUFFIX ib_sa_mad_t;
4244219820Sjeff#include <complib/cl_packoff.h>
4245219820Sjeff/**********/
4246219820Sjeff#define IB_SA_MAD_HDR_SIZE (sizeof(ib_sa_mad_t) - IB_SA_DATA_SIZE)
4247219820Sjeff
4248219820Sjeffstatic inline uint32_t OSM_API ib_get_attr_size(IN const ib_net16_t attr_offset)
4249219820Sjeff{
4250219820Sjeff	return (((uint32_t) cl_ntoh16(attr_offset)) << 3);
4251219820Sjeff}
4252219820Sjeff
4253219820Sjeffstatic inline ib_net16_t OSM_API ib_get_attr_offset(IN const uint32_t attr_size)
4254219820Sjeff{
4255219820Sjeff	return (cl_hton16((uint16_t) (attr_size >> 3)));
4256219820Sjeff}
4257219820Sjeff
4258219820Sjeff/****f* IBA Base: Types/ib_sa_mad_get_payload_ptr
4259219820Sjeff* NAME
4260219820Sjeff*	ib_sa_mad_get_payload_ptr
4261219820Sjeff*
4262219820Sjeff* DESCRIPTION
4263219820Sjeff*	Gets a pointer to the SA MAD's payload area.
4264219820Sjeff*
4265219820Sjeff* SYNOPSIS
4266219820Sjeff*/
4267219820Sjeffstatic inline void *OSM_API
4268219820Sjeffib_sa_mad_get_payload_ptr(IN const ib_sa_mad_t * const p_sa_mad)
4269219820Sjeff{
4270219820Sjeff	return ((void *)p_sa_mad->data);
4271219820Sjeff}
4272219820Sjeff
4273219820Sjeff/*
4274219820Sjeff* PARAMETERS
4275219820Sjeff*	p_sa_mad
4276219820Sjeff*		[in] Pointer to the SA MAD packet.
4277219820Sjeff*
4278219820Sjeff* RETURN VALUES
4279219820Sjeff*	Pointer to SA MAD payload area.
4280219820Sjeff*
4281219820Sjeff* NOTES
4282219820Sjeff*
4283219820Sjeff* SEE ALSO
4284219820Sjeff*	ib_mad_t
4285219820Sjeff*********/
4286219820Sjeff
4287219820Sjeff#define IB_NODE_INFO_PORT_NUM_MASK		(CL_HTON32(0xFF000000))
4288219820Sjeff#define IB_NODE_INFO_VEND_ID_MASK		(CL_HTON32(0x00FFFFFF))
4289219820Sjeff#if CPU_LE
4290219820Sjeff#define IB_NODE_INFO_PORT_NUM_SHIFT 0
4291219820Sjeff#else
4292219820Sjeff#define IB_NODE_INFO_PORT_NUM_SHIFT 24
4293219820Sjeff#endif
4294219820Sjeff
4295219820Sjeff/****f* IBA Base: Types/ib_node_info_get_local_port_num
4296219820Sjeff* NAME
4297219820Sjeff*	ib_node_info_get_local_port_num
4298219820Sjeff*
4299219820Sjeff* DESCRIPTION
4300219820Sjeff*	Gets a the local port number from the NodeInfo attribute.
4301219820Sjeff*
4302219820Sjeff* SYNOPSIS
4303219820Sjeff*/
4304219820Sjeffstatic inline uint8_t OSM_API
4305219820Sjeffib_node_info_get_local_port_num(IN const ib_node_info_t * const p_ni)
4306219820Sjeff{
4307219820Sjeff	return ((uint8_t) ((p_ni->port_num_vendor_id &
4308219820Sjeff			    IB_NODE_INFO_PORT_NUM_MASK)
4309219820Sjeff			   >> IB_NODE_INFO_PORT_NUM_SHIFT));
4310219820Sjeff}
4311219820Sjeff
4312219820Sjeff/*
4313219820Sjeff* PARAMETERS
4314219820Sjeff*	p_ni
4315219820Sjeff*		[in] Pointer to a NodeInfo attribute.
4316219820Sjeff*
4317219820Sjeff* RETURN VALUES
4318219820Sjeff*	Local port number that returned the attribute.
4319219820Sjeff*
4320219820Sjeff* NOTES
4321219820Sjeff*
4322219820Sjeff* SEE ALSO
4323219820Sjeff*	ib_node_info_t
4324219820Sjeff*********/
4325219820Sjeff
4326219820Sjeff/****f* IBA Base: Types/ib_node_info_get_vendor_id
4327219820Sjeff* NAME
4328219820Sjeff*	ib_node_info_get_vendor_id
4329219820Sjeff*
4330219820Sjeff* DESCRIPTION
4331219820Sjeff*	Gets the VendorID from the NodeInfo attribute.
4332219820Sjeff*
4333219820Sjeff* SYNOPSIS
4334219820Sjeff*/
4335219820Sjeffstatic inline ib_net32_t OSM_API
4336219820Sjeffib_node_info_get_vendor_id(IN const ib_node_info_t * const p_ni)
4337219820Sjeff{
4338219820Sjeff	return ((ib_net32_t) (p_ni->port_num_vendor_id &
4339219820Sjeff			      IB_NODE_INFO_VEND_ID_MASK));
4340219820Sjeff}
4341219820Sjeff
4342219820Sjeff/*
4343219820Sjeff* PARAMETERS
4344219820Sjeff*	p_ni
4345219820Sjeff*		[in] Pointer to a NodeInfo attribute.
4346219820Sjeff*
4347219820Sjeff* RETURN VALUES
4348219820Sjeff*	VendorID that returned the attribute.
4349219820Sjeff*
4350219820Sjeff* NOTES
4351219820Sjeff*
4352219820Sjeff* SEE ALSO
4353219820Sjeff*	ib_node_info_t
4354219820Sjeff*********/
4355219820Sjeff
4356219820Sjeff#define IB_NODE_DESCRIPTION_SIZE 64
4357219820Sjeff
4358219820Sjeff#include <complib/cl_packon.h>
4359219820Sjefftypedef struct _ib_node_desc {
4360219820Sjeff	// Node String is an array of UTF-8 character that
4361219820Sjeff	// describes the node in text format
4362219820Sjeff	// Note that this string is NOT NULL TERMINATED!
4363219820Sjeff	uint8_t description[IB_NODE_DESCRIPTION_SIZE];
4364219820Sjeff
4365219820Sjeff} PACK_SUFFIX ib_node_desc_t;
4366219820Sjeff#include <complib/cl_packoff.h>
4367219820Sjeff
4368219820Sjeff#include <complib/cl_packon.h>
4369219820Sjefftypedef struct _ib_node_record_t {
4370219820Sjeff	ib_net16_t lid;
4371219820Sjeff	ib_net16_t resv;
4372219820Sjeff	ib_node_info_t node_info;
4373219820Sjeff	ib_node_desc_t node_desc;
4374219820Sjeff	uint8_t pad[4];
4375219820Sjeff
4376219820Sjeff} PACK_SUFFIX ib_node_record_t;
4377219820Sjeff#include <complib/cl_packoff.h>
4378219820Sjeff
4379219820Sjeff/****s* IBA Base: Types/ib_port_info_t
4380219820Sjeff* NAME
4381219820Sjeff*	ib_port_info_t
4382219820Sjeff*
4383219820Sjeff* DESCRIPTION
4384219820Sjeff*	IBA defined PortInfo. (14.2.5.6)
4385219820Sjeff*
4386219820Sjeff* SYNOPSIS
4387219820Sjeff*/
4388219820Sjeff#include <complib/cl_packon.h>
4389219820Sjefftypedef struct _ib_port_info {
4390219820Sjeff	ib_net64_t m_key;
4391219820Sjeff	ib_net64_t subnet_prefix;
4392219820Sjeff	ib_net16_t base_lid;
4393219820Sjeff	ib_net16_t master_sm_base_lid;
4394219820Sjeff	ib_net32_t capability_mask;
4395219820Sjeff	ib_net16_t diag_code;
4396219820Sjeff	ib_net16_t m_key_lease_period;
4397219820Sjeff	uint8_t local_port_num;
4398219820Sjeff	uint8_t link_width_enabled;
4399219820Sjeff	uint8_t link_width_supported;
4400219820Sjeff	uint8_t link_width_active;
4401219820Sjeff	uint8_t state_info1;	/* LinkSpeedSupported and PortState */
4402219820Sjeff	uint8_t state_info2;	/* PortPhysState and LinkDownDefaultState */
4403219820Sjeff	uint8_t mkey_lmc;
4404219820Sjeff	uint8_t link_speed;	/* LinkSpeedEnabled and LinkSpeedActive */
4405219820Sjeff	uint8_t mtu_smsl;
4406219820Sjeff	uint8_t vl_cap;		/* VLCap and InitType */
4407219820Sjeff	uint8_t vl_high_limit;
4408219820Sjeff	uint8_t vl_arb_high_cap;
4409219820Sjeff	uint8_t vl_arb_low_cap;
4410219820Sjeff	uint8_t mtu_cap;
4411219820Sjeff	uint8_t vl_stall_life;
4412219820Sjeff	uint8_t vl_enforce;
4413219820Sjeff	ib_net16_t m_key_violations;
4414219820Sjeff	ib_net16_t p_key_violations;
4415219820Sjeff	ib_net16_t q_key_violations;
4416219820Sjeff	uint8_t guid_cap;
4417219820Sjeff	uint8_t subnet_timeout;	/* cli_rereg(1b), resrv(
4418219820Sjeff				   2b), timeout(5b) */
4419219820Sjeff	uint8_t resp_time_value;
4420219820Sjeff	uint8_t error_threshold;
4421219820Sjeff
4422219820Sjeff} PACK_SUFFIX ib_port_info_t;
4423219820Sjeff#include <complib/cl_packoff.h>
4424219820Sjeff/************/
4425219820Sjeff
4426219820Sjeff#define IB_PORT_STATE_MASK			0x0F
4427219820Sjeff#define IB_PORT_LMC_MASK			0x07
4428219820Sjeff#define IB_PORT_LMC_MAX				0x07
4429219820Sjeff#define IB_PORT_MPB_MASK			0xC0
4430219820Sjeff#define IB_PORT_MPB_SHIFT			6
4431219820Sjeff#define IB_PORT_LINK_SPEED_SHIFT		4
4432219820Sjeff#define IB_PORT_LINK_SPEED_SUPPORTED_MASK	0xF0
4433219820Sjeff#define IB_PORT_LINK_SPEED_ACTIVE_MASK		0xF0
4434219820Sjeff#define IB_PORT_LINK_SPEED_ENABLED_MASK		0x0F
4435219820Sjeff#define IB_PORT_PHYS_STATE_MASK			0xF0
4436219820Sjeff#define IB_PORT_PHYS_STATE_SHIFT		4
4437219820Sjeff#define IB_PORT_PHYS_STATE_NO_CHANGE		0
4438219820Sjeff#define IB_PORT_PHYS_STATE_SLEEP		1
4439219820Sjeff#define IB_PORT_PHYS_STATE_POLLING		2
4440219820Sjeff#define IB_PORT_PHYS_STATE_DISABLED		3
4441219820Sjeff#define IB_PORT_PHYS_STATE_PORTCONFTRAIN	4
4442219820Sjeff#define IB_PORT_PHYS_STATE_LINKUP	        5
4443219820Sjeff#define IB_PORT_PHYS_STATE_LINKERRRECOVER	6
4444219820Sjeff#define IB_PORT_PHYS_STATE_PHYTEST	        7
4445219820Sjeff#define IB_PORT_LNKDWNDFTSTATE_MASK		0x0F
4446219820Sjeff
4447219820Sjeff#define IB_PORT_CAP_RESV0         (CL_HTON32(0x00000001))
4448219820Sjeff#define IB_PORT_CAP_IS_SM         (CL_HTON32(0x00000002))
4449219820Sjeff#define IB_PORT_CAP_HAS_NOTICE    (CL_HTON32(0x00000004))
4450219820Sjeff#define IB_PORT_CAP_HAS_TRAP      (CL_HTON32(0x00000008))
4451219820Sjeff#define IB_PORT_CAP_HAS_IPD       (CL_HTON32(0x00000010))
4452219820Sjeff#define IB_PORT_CAP_HAS_AUTO_MIG  (CL_HTON32(0x00000020))
4453219820Sjeff#define IB_PORT_CAP_HAS_SL_MAP    (CL_HTON32(0x00000040))
4454219820Sjeff#define IB_PORT_CAP_HAS_NV_MKEY   (CL_HTON32(0x00000080))
4455219820Sjeff#define IB_PORT_CAP_HAS_NV_PKEY   (CL_HTON32(0x00000100))
4456219820Sjeff#define IB_PORT_CAP_HAS_LED_INFO  (CL_HTON32(0x00000200))
4457219820Sjeff#define IB_PORT_CAP_SM_DISAB      (CL_HTON32(0x00000400))
4458219820Sjeff#define IB_PORT_CAP_HAS_SYS_IMG_GUID  (CL_HTON32(0x00000800))
4459219820Sjeff#define IB_PORT_CAP_HAS_PKEY_SW_EXT_PORT_TRAP (CL_HTON32(0x00001000))
4460219820Sjeff#define IB_PORT_CAP_RESV13        (CL_HTON32(0x00002000))
4461219820Sjeff#define IB_PORT_CAP_RESV14        (CL_HTON32(0x00004000))
4462219820Sjeff#define IB_PORT_CAP_RESV15        (CL_HTON32(0x00008000))
4463219820Sjeff#define IB_PORT_CAP_HAS_COM_MGT   (CL_HTON32(0x00010000))
4464219820Sjeff#define IB_PORT_CAP_HAS_SNMP      (CL_HTON32(0x00020000))
4465219820Sjeff#define IB_PORT_CAP_REINIT        (CL_HTON32(0x00040000))
4466219820Sjeff#define IB_PORT_CAP_HAS_DEV_MGT   (CL_HTON32(0x00080000))
4467219820Sjeff#define IB_PORT_CAP_HAS_VEND_CLS  (CL_HTON32(0x00100000))
4468219820Sjeff#define IB_PORT_CAP_HAS_DR_NTC    (CL_HTON32(0x00200000))
4469219820Sjeff#define IB_PORT_CAP_HAS_CAP_NTC   (CL_HTON32(0x00400000))
4470219820Sjeff#define IB_PORT_CAP_HAS_BM        (CL_HTON32(0x00800000))
4471219820Sjeff#define IB_PORT_CAP_HAS_LINK_RT_LATENCY (CL_HTON32(0x01000000))
4472219820Sjeff#define IB_PORT_CAP_HAS_CLIENT_REREG (CL_HTON32(0x02000000))
4473219820Sjeff#define IB_PORT_CAP_HAS_OTHER_LOCAL_CHANGES_NTC (CL_HTON32(0x04000000))
4474219820Sjeff#define IB_PORT_CAP_HAS_LINK_SPEED_WIDTH_PAIRS_TBL (CL_HTON32(0x08000000))
4475219820Sjeff#define IB_PORT_CAP_RESV28        (CL_HTON32(0x10000000))
4476219820Sjeff#define IB_PORT_CAP_RESV29        (CL_HTON32(0x20000000))
4477219820Sjeff#define IB_PORT_CAP_RESV30        (CL_HTON32(0x40000000))
4478219820Sjeff#define IB_PORT_CAP_RESV31        (CL_HTON32(0x80000000))
4479219820Sjeff
4480219820Sjeff/****f* IBA Base: Types/ib_port_info_get_port_state
4481219820Sjeff* NAME
4482219820Sjeff*	ib_port_info_get_port_state
4483219820Sjeff*
4484219820Sjeff* DESCRIPTION
4485219820Sjeff*	Returns the port state.
4486219820Sjeff*
4487219820Sjeff* SYNOPSIS
4488219820Sjeff*/
4489219820Sjeffstatic inline uint8_t OSM_API
4490219820Sjeffib_port_info_get_port_state(IN const ib_port_info_t * const p_pi)
4491219820Sjeff{
4492219820Sjeff	return ((uint8_t) (p_pi->state_info1 & IB_PORT_STATE_MASK));
4493219820Sjeff}
4494219820Sjeff
4495219820Sjeff/*
4496219820Sjeff* PARAMETERS
4497219820Sjeff*	p_pi
4498219820Sjeff*		[in] Pointer to a PortInfo attribute.
4499219820Sjeff*
4500219820Sjeff* RETURN VALUES
4501219820Sjeff*	Port state.
4502219820Sjeff*
4503219820Sjeff* NOTES
4504219820Sjeff*
4505219820Sjeff* SEE ALSO
4506219820Sjeff*********/
4507219820Sjeff
4508219820Sjeff/****f* IBA Base: Types/ib_port_info_set_port_state
4509219820Sjeff* NAME
4510219820Sjeff*	ib_port_info_set_port_state
4511219820Sjeff*
4512219820Sjeff* DESCRIPTION
4513219820Sjeff*	Sets the port state.
4514219820Sjeff*
4515219820Sjeff* SYNOPSIS
4516219820Sjeff*/
4517219820Sjeffstatic inline void OSM_API
4518219820Sjeffib_port_info_set_port_state(IN ib_port_info_t * const p_pi,
4519219820Sjeff			    IN const uint8_t port_state)
4520219820Sjeff{
4521219820Sjeff	p_pi->state_info1 = (uint8_t) ((p_pi->state_info1 & 0xF0) | port_state);
4522219820Sjeff}
4523219820Sjeff
4524219820Sjeff/*
4525219820Sjeff* PARAMETERS
4526219820Sjeff*	p_pi
4527219820Sjeff*		[in] Pointer to a PortInfo attribute.
4528219820Sjeff*
4529219820Sjeff*	port_state
4530219820Sjeff*		[in] Port state value to set.
4531219820Sjeff*
4532219820Sjeff* RETURN VALUES
4533219820Sjeff*	None.
4534219820Sjeff*
4535219820Sjeff* NOTES
4536219820Sjeff*
4537219820Sjeff* SEE ALSO
4538219820Sjeff*********/
4539219820Sjeff
4540219820Sjeff/****f* IBA Base: Types/ib_port_info_get_vl_cap
4541219820Sjeff* NAME
4542219820Sjeff*	ib_port_info_get_vl_cap
4543219820Sjeff*
4544219820Sjeff* DESCRIPTION
4545219820Sjeff*	Gets the VL Capability of a port.
4546219820Sjeff*
4547219820Sjeff* SYNOPSIS
4548219820Sjeff*/
4549219820Sjeffstatic inline uint8_t OSM_API
4550219820Sjeffib_port_info_get_vl_cap(IN const ib_port_info_t * const p_pi)
4551219820Sjeff{
4552219820Sjeff	return ((p_pi->vl_cap >> 4) & 0x0F);
4553219820Sjeff}
4554219820Sjeff
4555219820Sjeff/*
4556219820Sjeff* PARAMETERS
4557219820Sjeff*	p_pi
4558219820Sjeff*		[in] Pointer to a PortInfo attribute.
4559219820Sjeff*
4560219820Sjeff* RETURN VALUES
4561219820Sjeff*	VL_CAP field
4562219820Sjeff*
4563219820Sjeff* NOTES
4564219820Sjeff*
4565219820Sjeff* SEE ALSO
4566219820Sjeff*********/
4567219820Sjeff
4568219820Sjeff/****f* IBA Base: Types/ib_port_info_get_init_type
4569219820Sjeff* NAME
4570219820Sjeff*	ib_port_info_get_init_type
4571219820Sjeff*
4572219820Sjeff* DESCRIPTION
4573219820Sjeff*	Gets the init type of a port.
4574219820Sjeff*
4575219820Sjeff* SYNOPSIS
4576219820Sjeff*/
4577219820Sjeffstatic inline uint8_t OSM_API
4578219820Sjeffib_port_info_get_init_type(IN const ib_port_info_t * const p_pi)
4579219820Sjeff{
4580219820Sjeff	return (uint8_t) (p_pi->vl_cap & 0x0F);
4581219820Sjeff}
4582219820Sjeff
4583219820Sjeff/*
4584219820Sjeff* PARAMETERS
4585219820Sjeff*	p_pi
4586219820Sjeff*		[in] Pointer to a PortInfo attribute.
4587219820Sjeff*
4588219820Sjeff* RETURN VALUES
4589219820Sjeff*	InitType field
4590219820Sjeff*
4591219820Sjeff* NOTES
4592219820Sjeff*
4593219820Sjeff* SEE ALSO
4594219820Sjeff*********/
4595219820Sjeff
4596219820Sjeff/****f* IBA Base: Types/ib_port_info_get_op_vls
4597219820Sjeff* NAME
4598219820Sjeff*	ib_port_info_get_op_vls
4599219820Sjeff*
4600219820Sjeff* DESCRIPTION
4601219820Sjeff*	Gets the operational VLs on a port.
4602219820Sjeff*
4603219820Sjeff* SYNOPSIS
4604219820Sjeff*/
4605219820Sjeffstatic inline uint8_t OSM_API
4606219820Sjeffib_port_info_get_op_vls(IN const ib_port_info_t * const p_pi)
4607219820Sjeff{
4608219820Sjeff	return ((p_pi->vl_enforce >> 4) & 0x0F);
4609219820Sjeff}
4610219820Sjeff
4611219820Sjeff/*
4612219820Sjeff* PARAMETERS
4613219820Sjeff*	p_pi
4614219820Sjeff*		[in] Pointer to a PortInfo attribute.
4615219820Sjeff*
4616219820Sjeff* RETURN VALUES
4617219820Sjeff*	OP_VLS field
4618219820Sjeff*
4619219820Sjeff* NOTES
4620219820Sjeff*
4621219820Sjeff* SEE ALSO
4622219820Sjeff*********/
4623219820Sjeff
4624219820Sjeff/****f* IBA Base: Types/ib_port_info_set_op_vls
4625219820Sjeff* NAME
4626219820Sjeff*	ib_port_info_set_op_vls
4627219820Sjeff*
4628219820Sjeff* DESCRIPTION
4629219820Sjeff*	Sets the operational VLs on a port.
4630219820Sjeff*
4631219820Sjeff* SYNOPSIS
4632219820Sjeff*/
4633219820Sjeffstatic inline void OSM_API
4634219820Sjeffib_port_info_set_op_vls(IN ib_port_info_t * const p_pi, IN const uint8_t op_vls)
4635219820Sjeff{
4636219820Sjeff	p_pi->vl_enforce =
4637219820Sjeff	    (uint8_t) ((p_pi->vl_enforce & 0x0F) | (op_vls << 4));
4638219820Sjeff}
4639219820Sjeff
4640219820Sjeff/*
4641219820Sjeff* PARAMETERS
4642219820Sjeff*	p_pi
4643219820Sjeff*		[in] Pointer to a PortInfo attribute.
4644219820Sjeff*
4645219820Sjeff*	op_vls
4646219820Sjeff*		[in] Encoded operation VLs value.
4647219820Sjeff*
4648219820Sjeff* RETURN VALUES
4649219820Sjeff*	None.
4650219820Sjeff*
4651219820Sjeff* NOTES
4652219820Sjeff*
4653219820Sjeff* SEE ALSO
4654219820Sjeff*********/
4655219820Sjeff
4656219820Sjeff/****f* IBA Base: Types/ib_port_info_set_state_no_change
4657219820Sjeff* NAME
4658219820Sjeff*	ib_port_info_set_state_no_change
4659219820Sjeff*
4660219820Sjeff* DESCRIPTION
4661219820Sjeff*	Sets the port state fields to the value for "no change".
4662219820Sjeff*
4663219820Sjeff* SYNOPSIS
4664219820Sjeff*/
4665219820Sjeffstatic inline void OSM_API
4666219820Sjeffib_port_info_set_state_no_change(IN ib_port_info_t * const p_pi)
4667219820Sjeff{
4668219820Sjeff	ib_port_info_set_port_state(p_pi, IB_LINK_NO_CHANGE);
4669219820Sjeff	p_pi->state_info2 = 0;
4670219820Sjeff}
4671219820Sjeff
4672219820Sjeff/*
4673219820Sjeff* PARAMETERS
4674219820Sjeff*	p_pi
4675219820Sjeff*		[in] Pointer to a PortInfo attribute.
4676219820Sjeff*
4677219820Sjeff* RETURN VALUES
4678219820Sjeff*	None.
4679219820Sjeff*
4680219820Sjeff* NOTES
4681219820Sjeff*
4682219820Sjeff* SEE ALSO
4683219820Sjeff*********/
4684219820Sjeff
4685219820Sjeff/****f* IBA Base: Types/ib_port_info_get_link_speed_sup
4686219820Sjeff* NAME
4687219820Sjeff*	ib_port_info_get_link_speed_sup
4688219820Sjeff*
4689219820Sjeff* DESCRIPTION
4690219820Sjeff*	Returns the encoded value for the link speed supported.
4691219820Sjeff*
4692219820Sjeff* SYNOPSIS
4693219820Sjeff*/
4694219820Sjeffstatic inline uint8_t OSM_API
4695219820Sjeffib_port_info_get_link_speed_sup(IN const ib_port_info_t * const p_pi)
4696219820Sjeff{
4697219820Sjeff	return ((uint8_t) ((p_pi->state_info1 &
4698219820Sjeff			    IB_PORT_LINK_SPEED_SUPPORTED_MASK) >>
4699219820Sjeff			   IB_PORT_LINK_SPEED_SHIFT));
4700219820Sjeff}
4701219820Sjeff
4702219820Sjeff/*
4703219820Sjeff* PARAMETERS
4704219820Sjeff*	p_pi
4705219820Sjeff*		[in] Pointer to a PortInfo attribute.
4706219820Sjeff*
4707219820Sjeff* RETURN VALUES
4708219820Sjeff*	Returns the encoded value for the link speed supported.
4709219820Sjeff*
4710219820Sjeff* NOTES
4711219820Sjeff*
4712219820Sjeff* SEE ALSO
4713219820Sjeff*********/
4714219820Sjeff
4715219820Sjeff/****f* IBA Base: Types/ib_port_info_set_link_speed_sup
4716219820Sjeff* NAME
4717219820Sjeff*	ib_port_info_set_link_speed_sup
4718219820Sjeff*
4719219820Sjeff* DESCRIPTION
4720219820Sjeff*	Given an integer of the supported link speed supported.
4721219820Sjeff*	Set the appropriate bits in state_info1
4722219820Sjeff*
4723219820Sjeff* SYNOPSIS
4724219820Sjeff*/
4725219820Sjeffstatic inline void OSM_API
4726219820Sjeffib_port_info_set_link_speed_sup(IN uint8_t const speed,
4727219820Sjeff				IN ib_port_info_t * p_pi)
4728219820Sjeff{
4729219820Sjeff	p_pi->state_info1 =
4730219820Sjeff	    (~IB_PORT_LINK_SPEED_SUPPORTED_MASK & p_pi->state_info1) |
4731219820Sjeff	    (IB_PORT_LINK_SPEED_SUPPORTED_MASK &
4732219820Sjeff	     (speed << IB_PORT_LINK_SPEED_SHIFT));
4733219820Sjeff}
4734219820Sjeff
4735219820Sjeff/*
4736219820Sjeff* PARAMETERS
4737219820Sjeff*	speed
4738219820Sjeff*		[in] Supported Speeds Code.
4739219820Sjeff*
4740219820Sjeff*	p_pi
4741219820Sjeff*		[in] Pointer to a PortInfo attribute.
4742219820Sjeff*
4743219820Sjeff* RETURN VALUES
4744219820Sjeff*	This function does not return a value.
4745219820Sjeff*
4746219820Sjeff* NOTES
4747219820Sjeff*
4748219820Sjeff* SEE ALSO
4749219820Sjeff*********/
4750219820Sjeff
4751219820Sjeff/****f* IBA Base: Types/ib_port_info_get_port_phys_state
4752219820Sjeff* NAME
4753219820Sjeff*	ib_port_info_get_port_phys_state
4754219820Sjeff*
4755219820Sjeff* DESCRIPTION
4756219820Sjeff*	Returns the encoded value for the port physical state.
4757219820Sjeff*
4758219820Sjeff* SYNOPSIS
4759219820Sjeff*/
4760219820Sjeffstatic inline uint8_t OSM_API
4761219820Sjeffib_port_info_get_port_phys_state(IN const ib_port_info_t * const p_pi)
4762219820Sjeff{
4763219820Sjeff	return ((uint8_t) ((p_pi->state_info2 &
4764219820Sjeff			    IB_PORT_PHYS_STATE_MASK) >>
4765219820Sjeff			   IB_PORT_PHYS_STATE_SHIFT));
4766219820Sjeff}
4767219820Sjeff
4768219820Sjeff/*
4769219820Sjeff* PARAMETERS
4770219820Sjeff*	p_pi
4771219820Sjeff*		[in] Pointer to a PortInfo attribute.
4772219820Sjeff*
4773219820Sjeff* RETURN VALUES
4774219820Sjeff*	Returns the encoded value for the port physical state.
4775219820Sjeff*
4776219820Sjeff* NOTES
4777219820Sjeff*
4778219820Sjeff* SEE ALSO
4779219820Sjeff*********/
4780219820Sjeff
4781219820Sjeff/****f* IBA Base: Types/ib_port_info_set_port_phys_state
4782219820Sjeff* NAME
4783219820Sjeff*	ib_port_info_set_port_phys_state
4784219820Sjeff*
4785219820Sjeff* DESCRIPTION
4786219820Sjeff*	Given an integer of the port physical state,
4787219820Sjeff*	Set the appropriate bits in state_info2
4788219820Sjeff*
4789219820Sjeff* SYNOPSIS
4790219820Sjeff*/
4791219820Sjeffstatic inline void OSM_API
4792219820Sjeffib_port_info_set_port_phys_state(IN uint8_t const phys_state,
4793219820Sjeff				 IN ib_port_info_t * p_pi)
4794219820Sjeff{
4795219820Sjeff	p_pi->state_info2 =
4796219820Sjeff	    (~IB_PORT_PHYS_STATE_MASK & p_pi->state_info2) |
4797219820Sjeff	    (IB_PORT_PHYS_STATE_MASK &
4798219820Sjeff	     (phys_state << IB_PORT_PHYS_STATE_SHIFT));
4799219820Sjeff}
4800219820Sjeff
4801219820Sjeff/*
4802219820Sjeff* PARAMETERS
4803219820Sjeff*	phys_state
4804219820Sjeff*		[in] port physical state.
4805219820Sjeff*
4806219820Sjeff*	p_pi
4807219820Sjeff*		[in] Pointer to a PortInfo attribute.
4808219820Sjeff*
4809219820Sjeff* RETURN VALUES
4810219820Sjeff*	This function does not return a value.
4811219820Sjeff*
4812219820Sjeff* NOTES
4813219820Sjeff*
4814219820Sjeff* SEE ALSO
4815219820Sjeff*********/
4816219820Sjeff
4817219820Sjeff/****f* IBA Base: Types/ib_port_info_get_link_down_def_state
4818219820Sjeff* NAME
4819219820Sjeff*	ib_port_info_get_link_down_def_state
4820219820Sjeff*
4821219820Sjeff* DESCRIPTION
4822219820Sjeff*	Returns the link down default state.
4823219820Sjeff*
4824219820Sjeff* SYNOPSIS
4825219820Sjeff*/
4826219820Sjeffstatic inline uint8_t OSM_API
4827219820Sjeffib_port_info_get_link_down_def_state(IN const ib_port_info_t * const p_pi)
4828219820Sjeff{
4829219820Sjeff	return ((uint8_t) (p_pi->state_info2 & IB_PORT_LNKDWNDFTSTATE_MASK));
4830219820Sjeff}
4831219820Sjeff
4832219820Sjeff/*
4833219820Sjeff* PARAMETERS
4834219820Sjeff*	p_pi
4835219820Sjeff*		[in] Pointer to a PortInfo attribute.
4836219820Sjeff*
4837219820Sjeff* RETURN VALUES
4838219820Sjeff*	link down default state of the port.
4839219820Sjeff*
4840219820Sjeff* NOTES
4841219820Sjeff*
4842219820Sjeff* SEE ALSO
4843219820Sjeff*********/
4844219820Sjeff
4845219820Sjeff/****f* IBA Base: Types/ib_port_info_set_link_down_def_state
4846219820Sjeff* NAME
4847219820Sjeff*	ib_port_info_set_link_down_def_state
4848219820Sjeff*
4849219820Sjeff* DESCRIPTION
4850219820Sjeff*	Sets the link down default state of the port.
4851219820Sjeff*
4852219820Sjeff* SYNOPSIS
4853219820Sjeff*/
4854219820Sjeffstatic inline void OSM_API
4855219820Sjeffib_port_info_set_link_down_def_state(IN ib_port_info_t * const p_pi,
4856219820Sjeff				     IN const uint8_t link_dwn_state)
4857219820Sjeff{
4858219820Sjeff	p_pi->state_info2 =
4859219820Sjeff	    (uint8_t) ((p_pi->state_info2 & 0xF0) | link_dwn_state);
4860219820Sjeff}
4861219820Sjeff
4862219820Sjeff/*
4863219820Sjeff* PARAMETERS
4864219820Sjeff*	p_pi
4865219820Sjeff*		[in] Pointer to a PortInfo attribute.
4866219820Sjeff*
4867219820Sjeff*	link_dwn_state
4868219820Sjeff*		[in] Link down default state of the port.
4869219820Sjeff*
4870219820Sjeff* RETURN VALUES
4871219820Sjeff*	None.
4872219820Sjeff*
4873219820Sjeff* NOTES
4874219820Sjeff*
4875219820Sjeff* SEE ALSO
4876219820Sjeff*********/
4877219820Sjeff
4878219820Sjeff/****f* IBA Base: Types/ib_port_info_get_link_speed_active
4879219820Sjeff* NAME
4880219820Sjeff*	ib_port_info_get_link_speed_active
4881219820Sjeff*
4882219820Sjeff* DESCRIPTION
4883219820Sjeff*	Returns the Link Speed Active value assigned to this port.
4884219820Sjeff*
4885219820Sjeff* SYNOPSIS
4886219820Sjeff*/
4887219820Sjeffstatic inline uint8_t OSM_API
4888219820Sjeffib_port_info_get_link_speed_active(IN const ib_port_info_t * const p_pi)
4889219820Sjeff{
4890219820Sjeff	return ((uint8_t) ((p_pi->link_speed &
4891219820Sjeff			    IB_PORT_LINK_SPEED_ACTIVE_MASK) >>
4892219820Sjeff			   IB_PORT_LINK_SPEED_SHIFT));
4893219820Sjeff}
4894219820Sjeff
4895219820Sjeff/*
4896219820Sjeff* PARAMETERS
4897219820Sjeff*	p_pi
4898219820Sjeff*		[in] Pointer to a PortInfo attribute.
4899219820Sjeff*
4900219820Sjeff* RETURN VALUES
4901219820Sjeff*	Returns the link speed active value assigned to this port.
4902219820Sjeff*
4903219820Sjeff* NOTES
4904219820Sjeff*
4905219820Sjeff* SEE ALSO
4906219820Sjeff*********/
4907219820Sjeff
4908219820Sjeff#define IB_LINK_WIDTH_ACTIVE_1X			1
4909219820Sjeff#define IB_LINK_WIDTH_ACTIVE_4X			2
4910219820Sjeff#define IB_LINK_WIDTH_ACTIVE_8X			4
4911219820Sjeff#define IB_LINK_WIDTH_ACTIVE_12X 		8
4912219820Sjeff#define IB_LINK_SPEED_ACTIVE_2_5		1
4913219820Sjeff#define IB_LINK_SPEED_ACTIVE_5			2
4914219820Sjeff#define IB_LINK_SPEED_ACTIVE_10			4
4915219820Sjeff
4916219820Sjeff/* following v1 ver1.2 p901 */
4917219820Sjeff#define IB_PATH_RECORD_RATE_2_5_GBS		2
4918219820Sjeff#define IB_PATH_RECORD_RATE_10_GBS		3
4919219820Sjeff#define IB_PATH_RECORD_RATE_30_GBS		4
4920219820Sjeff#define IB_PATH_RECORD_RATE_5_GBS		5
4921219820Sjeff#define IB_PATH_RECORD_RATE_20_GBS		6
4922219820Sjeff#define IB_PATH_RECORD_RATE_40_GBS		7
4923219820Sjeff#define IB_PATH_RECORD_RATE_60_GBS		8
4924219820Sjeff#define IB_PATH_RECORD_RATE_80_GBS		9
4925219820Sjeff#define IB_PATH_RECORD_RATE_120_GBS		10
4926219820Sjeff
4927219820Sjeff#define IB_MIN_RATE    IB_PATH_RECORD_RATE_2_5_GBS
4928219820Sjeff#define IB_MAX_RATE    IB_PATH_RECORD_RATE_120_GBS
4929219820Sjeff
4930219820Sjeff/****f* IBA Base: Types/ib_port_info_compute_rate
4931219820Sjeff* NAME
4932219820Sjeff*	ib_port_info_compute_rate
4933219820Sjeff*
4934219820Sjeff* DESCRIPTION
4935219820Sjeff*	Returns the encoded value for the path rate.
4936219820Sjeff*
4937219820Sjeff* SYNOPSIS
4938219820Sjeff*/
4939219820Sjeffstatic inline uint8_t OSM_API
4940219820Sjeffib_port_info_compute_rate(IN const ib_port_info_t * const p_pi)
4941219820Sjeff{
4942219820Sjeff	uint8_t rate = 0;
4943219820Sjeff
4944219820Sjeff	switch (ib_port_info_get_link_speed_active(p_pi)) {
4945219820Sjeff	case IB_LINK_SPEED_ACTIVE_2_5:
4946219820Sjeff		switch (p_pi->link_width_active) {
4947219820Sjeff		case IB_LINK_WIDTH_ACTIVE_1X:
4948219820Sjeff			rate = IB_PATH_RECORD_RATE_2_5_GBS;
4949219820Sjeff			break;
4950219820Sjeff
4951219820Sjeff		case IB_LINK_WIDTH_ACTIVE_4X:
4952219820Sjeff			rate = IB_PATH_RECORD_RATE_10_GBS;
4953219820Sjeff			break;
4954219820Sjeff
4955219820Sjeff		case IB_LINK_WIDTH_ACTIVE_8X:
4956219820Sjeff			rate = IB_PATH_RECORD_RATE_20_GBS;
4957219820Sjeff			break;
4958219820Sjeff
4959219820Sjeff		case IB_LINK_WIDTH_ACTIVE_12X:
4960219820Sjeff			rate = IB_PATH_RECORD_RATE_30_GBS;
4961219820Sjeff			break;
4962219820Sjeff
4963219820Sjeff		default:
4964219820Sjeff			rate = IB_PATH_RECORD_RATE_2_5_GBS;
4965219820Sjeff			break;
4966219820Sjeff		}
4967219820Sjeff		break;
4968219820Sjeff	case IB_LINK_SPEED_ACTIVE_5:
4969219820Sjeff		switch (p_pi->link_width_active) {
4970219820Sjeff		case IB_LINK_WIDTH_ACTIVE_1X:
4971219820Sjeff			rate = IB_PATH_RECORD_RATE_5_GBS;
4972219820Sjeff			break;
4973219820Sjeff
4974219820Sjeff		case IB_LINK_WIDTH_ACTIVE_4X:
4975219820Sjeff			rate = IB_PATH_RECORD_RATE_20_GBS;
4976219820Sjeff			break;
4977219820Sjeff
4978219820Sjeff		case IB_LINK_WIDTH_ACTIVE_8X:
4979219820Sjeff			rate = IB_PATH_RECORD_RATE_40_GBS;
4980219820Sjeff			break;
4981219820Sjeff
4982219820Sjeff		case IB_LINK_WIDTH_ACTIVE_12X:
4983219820Sjeff			rate = IB_PATH_RECORD_RATE_60_GBS;
4984219820Sjeff			break;
4985219820Sjeff
4986219820Sjeff		default:
4987219820Sjeff			rate = IB_PATH_RECORD_RATE_5_GBS;
4988219820Sjeff			break;
4989219820Sjeff		}
4990219820Sjeff		break;
4991219820Sjeff	case IB_LINK_SPEED_ACTIVE_10:
4992219820Sjeff		switch (p_pi->link_width_active) {
4993219820Sjeff		case IB_LINK_WIDTH_ACTIVE_1X:
4994219820Sjeff			rate = IB_PATH_RECORD_RATE_10_GBS;
4995219820Sjeff			break;
4996219820Sjeff
4997219820Sjeff		case IB_LINK_WIDTH_ACTIVE_4X:
4998219820Sjeff			rate = IB_PATH_RECORD_RATE_40_GBS;
4999219820Sjeff			break;
5000219820Sjeff
5001219820Sjeff		case IB_LINK_WIDTH_ACTIVE_8X:
5002219820Sjeff			rate = IB_PATH_RECORD_RATE_80_GBS;
5003219820Sjeff			break;
5004219820Sjeff
5005219820Sjeff		case IB_LINK_WIDTH_ACTIVE_12X:
5006219820Sjeff			rate = IB_PATH_RECORD_RATE_120_GBS;
5007219820Sjeff			break;
5008219820Sjeff
5009219820Sjeff		default:
5010219820Sjeff			rate = IB_PATH_RECORD_RATE_10_GBS;
5011219820Sjeff			break;
5012219820Sjeff		}
5013219820Sjeff		break;
5014219820Sjeff	default:
5015219820Sjeff		rate = IB_PATH_RECORD_RATE_2_5_GBS;
5016219820Sjeff		break;
5017219820Sjeff	}
5018219820Sjeff
5019219820Sjeff	return rate;
5020219820Sjeff}
5021219820Sjeff
5022219820Sjeff/*
5023219820Sjeff* PARAMETERS
5024219820Sjeff*	p_pi
5025219820Sjeff*		[in] Pointer to a PortInfo attribute.
5026219820Sjeff*
5027219820Sjeff* RETURN VALUES
5028219820Sjeff*	Returns the encoded value for the link speed supported.
5029219820Sjeff*
5030219820Sjeff* NOTES
5031219820Sjeff*
5032219820Sjeff* SEE ALSO
5033219820Sjeff*********/
5034219820Sjeff
5035219820Sjeff/****f* IBA Base: Types/ib_path_get_ipd
5036219820Sjeff* NAME
5037219820Sjeff*	ib_path_get_ipd
5038219820Sjeff*
5039219820Sjeff* DESCRIPTION
5040219820Sjeff*	Returns the encoded value for the inter packet delay.
5041219820Sjeff*
5042219820Sjeff* SYNOPSIS
5043219820Sjeff*/
5044219820Sjeffstatic inline uint8_t OSM_API
5045219820Sjeffib_path_get_ipd(IN uint8_t local_link_width_supported, IN uint8_t path_rec_rate)
5046219820Sjeff{
5047219820Sjeff	uint8_t ipd = 0;
5048219820Sjeff
5049219820Sjeff	switch (local_link_width_supported) {
5050219820Sjeff		/* link_width_supported = 1: 1x */
5051219820Sjeff	case 1:
5052219820Sjeff		break;
5053219820Sjeff
5054219820Sjeff		/* link_width_supported = 3: 1x or 4x */
5055219820Sjeff	case 3:
5056219820Sjeff		switch (path_rec_rate & 0x3F) {
5057219820Sjeff		case IB_PATH_RECORD_RATE_2_5_GBS:
5058219820Sjeff			ipd = 3;
5059219820Sjeff			break;
5060219820Sjeff		default:
5061219820Sjeff			break;
5062219820Sjeff		}
5063219820Sjeff		break;
5064219820Sjeff
5065219820Sjeff		/* link_width_supported = 11: 1x or 4x or 12x */
5066219820Sjeff	case 11:
5067219820Sjeff		switch (path_rec_rate & 0x3F) {
5068219820Sjeff		case IB_PATH_RECORD_RATE_2_5_GBS:
5069219820Sjeff			ipd = 11;
5070219820Sjeff			break;
5071219820Sjeff		case IB_PATH_RECORD_RATE_10_GBS:
5072219820Sjeff			ipd = 2;
5073219820Sjeff			break;
5074219820Sjeff		default:
5075219820Sjeff			break;
5076219820Sjeff		}
5077219820Sjeff		break;
5078219820Sjeff
5079219820Sjeff	default:
5080219820Sjeff		break;
5081219820Sjeff	}
5082219820Sjeff
5083219820Sjeff	return ipd;
5084219820Sjeff}
5085219820Sjeff
5086219820Sjeff/*
5087219820Sjeff* PARAMETERS
5088219820Sjeff*	local_link_width_supported
5089219820Sjeff*		[in] link with supported for this port
5090219820Sjeff*
5091219820Sjeff*	path_rec_rate
5092219820Sjeff*		[in] rate field of the path record
5093219820Sjeff*
5094219820Sjeff* RETURN VALUES
5095219820Sjeff*	Returns the ipd
5096219820Sjeff*
5097219820Sjeff* NOTES
5098219820Sjeff*
5099219820Sjeff* SEE ALSO
5100219820Sjeff*********/
5101219820Sjeff
5102219820Sjeff/****f* IBA Base: Types/ib_port_info_get_mtu_cap
5103219820Sjeff* NAME
5104219820Sjeff*	ib_port_info_get_mtu_cap
5105219820Sjeff*
5106219820Sjeff* DESCRIPTION
5107219820Sjeff*	Returns the encoded value for the maximum MTU supported by this port.
5108219820Sjeff*
5109219820Sjeff* SYNOPSIS
5110219820Sjeff*/
5111219820Sjeffstatic inline uint8_t OSM_API
5112219820Sjeffib_port_info_get_mtu_cap(IN const ib_port_info_t * const p_pi)
5113219820Sjeff{
5114219820Sjeff	return ((uint8_t) (p_pi->mtu_cap & 0x0F));
5115219820Sjeff}
5116219820Sjeff
5117219820Sjeff/*
5118219820Sjeff* PARAMETERS
5119219820Sjeff*	p_pi
5120219820Sjeff*		[in] Pointer to a PortInfo attribute.
5121219820Sjeff*
5122219820Sjeff* RETURN VALUES
5123219820Sjeff*	Returns the encooded value for the maximum MTU supported by this port.
5124219820Sjeff*
5125219820Sjeff* NOTES
5126219820Sjeff*
5127219820Sjeff* SEE ALSO
5128219820Sjeff*********/
5129219820Sjeff
5130219820Sjeff/****f* IBA Base: Types/ib_port_info_get_neighbor_mtu
5131219820Sjeff* NAME
5132219820Sjeff*	ib_port_info_get_neighbor_mtu
5133219820Sjeff*
5134219820Sjeff* DESCRIPTION
5135219820Sjeff*	Returns the encoded value for the neighbor MTU supported by this port.
5136219820Sjeff*
5137219820Sjeff* SYNOPSIS
5138219820Sjeff*/
5139219820Sjeffstatic inline uint8_t OSM_API
5140219820Sjeffib_port_info_get_neighbor_mtu(IN const ib_port_info_t * const p_pi)
5141219820Sjeff{
5142219820Sjeff	return ((uint8_t) ((p_pi->mtu_smsl & 0xF0) >> 4));
5143219820Sjeff}
5144219820Sjeff
5145219820Sjeff/*
5146219820Sjeff* PARAMETERS
5147219820Sjeff*	p_pi
5148219820Sjeff*		[in] Pointer to a PortInfo attribute.
5149219820Sjeff*
5150219820Sjeff* RETURN VALUES
5151219820Sjeff*	Returns the encoded value for the neighbor MTU at this port.
5152219820Sjeff*
5153219820Sjeff* NOTES
5154219820Sjeff*
5155219820Sjeff* SEE ALSO
5156219820Sjeff*********/
5157219820Sjeff
5158219820Sjeff/****f* IBA Base: Types/ib_port_info_set_neighbor_mtu
5159219820Sjeff* NAME
5160219820Sjeff*	ib_port_info_set_neighbor_mtu
5161219820Sjeff*
5162219820Sjeff* DESCRIPTION
5163219820Sjeff*	Sets the Neighbor MTU value in the PortInfo attribute.
5164219820Sjeff*
5165219820Sjeff* SYNOPSIS
5166219820Sjeff*/
5167219820Sjeffstatic inline void OSM_API
5168219820Sjeffib_port_info_set_neighbor_mtu(IN ib_port_info_t * const p_pi,
5169219820Sjeff			      IN const uint8_t mtu)
5170219820Sjeff{
5171219820Sjeff	CL_ASSERT(mtu <= 5);
5172219820Sjeff	CL_ASSERT(mtu != 0);
5173219820Sjeff	p_pi->mtu_smsl = (uint8_t) ((p_pi->mtu_smsl & 0x0F) | (mtu << 4));
5174219820Sjeff}
5175219820Sjeff
5176219820Sjeff/*
5177219820Sjeff* PARAMETERS
5178219820Sjeff*	p_pi
5179219820Sjeff*		[in] Pointer to a PortInfo attribute.
5180219820Sjeff*
5181219820Sjeff*	mtu
5182219820Sjeff*		[in] Encoded MTU value to set
5183219820Sjeff*
5184219820Sjeff* RETURN VALUES
5185219820Sjeff*	None.
5186219820Sjeff*
5187219820Sjeff* NOTES
5188219820Sjeff*
5189219820Sjeff* SEE ALSO
5190219820Sjeff*********/
5191219820Sjeff
5192219820Sjeff/****f* IBA Base: Types/ib_port_info_get_master_smsl
5193219820Sjeff* NAME
5194219820Sjeff*	ib_port_info_get_master_smsl
5195219820Sjeff*
5196219820Sjeff* DESCRIPTION
5197219820Sjeff*	Returns the encoded value for the Master SMSL at this port.
5198219820Sjeff*
5199219820Sjeff* SYNOPSIS
5200219820Sjeff*/
5201219820Sjeffstatic inline uint8_t OSM_API
5202219820Sjeffib_port_info_get_master_smsl(IN const ib_port_info_t * const p_pi)
5203219820Sjeff{
5204219820Sjeff	return (uint8_t) (p_pi->mtu_smsl & 0x0F);
5205219820Sjeff}
5206219820Sjeff
5207219820Sjeff/*
5208219820Sjeff* PARAMETERS
5209219820Sjeff*	p_pi
5210219820Sjeff*		[in] Pointer to a PortInfo attribute.
5211219820Sjeff*
5212219820Sjeff* RETURN VALUES
5213219820Sjeff*	Returns the encoded value for the Master SMSL at this port.
5214219820Sjeff*
5215219820Sjeff* NOTES
5216219820Sjeff*
5217219820Sjeff* SEE ALSO
5218219820Sjeff*********/
5219219820Sjeff
5220219820Sjeff/****f* IBA Base: Types/ib_port_info_set_master_smsl
5221219820Sjeff* NAME
5222219820Sjeff*	ib_port_info_set_master_smsl
5223219820Sjeff*
5224219820Sjeff* DESCRIPTION
5225219820Sjeff*	Sets the Master SMSL value in the PortInfo attribute.
5226219820Sjeff*
5227219820Sjeff* SYNOPSIS
5228219820Sjeff*/
5229219820Sjeffstatic inline void OSM_API
5230219820Sjeffib_port_info_set_master_smsl(IN ib_port_info_t * const p_pi,
5231219820Sjeff			     IN const uint8_t smsl)
5232219820Sjeff{
5233219820Sjeff	p_pi->mtu_smsl = (uint8_t) ((p_pi->mtu_smsl & 0xF0) | smsl);
5234219820Sjeff}
5235219820Sjeff
5236219820Sjeff/*
5237219820Sjeff* PARAMETERS
5238219820Sjeff*	p_pi
5239219820Sjeff*		[in] Pointer to a PortInfo attribute.
5240219820Sjeff*
5241219820Sjeff*	mtu
5242219820Sjeff*		[in] Encoded Master SMSL value to set
5243219820Sjeff*
5244219820Sjeff* RETURN VALUES
5245219820Sjeff*	None.
5246219820Sjeff*
5247219820Sjeff* NOTES
5248219820Sjeff*
5249219820Sjeff* SEE ALSO
5250219820Sjeff*********/
5251219820Sjeff
5252219820Sjeff/****f* IBA Base: Types/ib_port_info_set_timeout
5253219820Sjeff* NAME
5254219820Sjeff*	ib_port_info_set_timeout
5255219820Sjeff*
5256219820Sjeff* DESCRIPTION
5257219820Sjeff*	Sets the encoded subnet timeout value in the PortInfo attribute.
5258219820Sjeff*
5259219820Sjeff* SYNOPSIS
5260219820Sjeff*/
5261219820Sjeffstatic inline void OSM_API
5262219820Sjeffib_port_info_set_timeout(IN ib_port_info_t * const p_pi,
5263219820Sjeff			 IN const uint8_t timeout)
5264219820Sjeff{
5265219820Sjeff	CL_ASSERT(timeout <= 0x1F);
5266219820Sjeff	p_pi->subnet_timeout =
5267219820Sjeff	    (uint8_t) ((p_pi->subnet_timeout & 0x80) | (timeout & 0x1F));
5268219820Sjeff}
5269219820Sjeff
5270219820Sjeff/*
5271219820Sjeff* PARAMETERS
5272219820Sjeff*	p_pi
5273219820Sjeff*		[in] Pointer to a PortInfo attribute.
5274219820Sjeff*
5275219820Sjeff*	timeout
5276219820Sjeff*		[in] Encoded timeout value to set
5277219820Sjeff*
5278219820Sjeff* RETURN VALUES
5279219820Sjeff*	None.
5280219820Sjeff*
5281219820Sjeff* NOTES
5282219820Sjeff*
5283219820Sjeff* SEE ALSO
5284219820Sjeff*********/
5285219820Sjeff
5286219820Sjeff/****f* IBA Base: Types/ib_port_info_set_client_rereg
5287219820Sjeff* NAME
5288219820Sjeff*	ib_port_info_set_client_rereg
5289219820Sjeff*
5290219820Sjeff* DESCRIPTION
5291219820Sjeff*	Sets the encoded client reregistration bit value in the PortInfo attribute.
5292219820Sjeff*
5293219820Sjeff* SYNOPSIS
5294219820Sjeff*/
5295219820Sjeffstatic inline void OSM_API
5296219820Sjeffib_port_info_set_client_rereg(IN ib_port_info_t * const p_pi,
5297219820Sjeff			      IN const uint8_t client_rereg)
5298219820Sjeff{
5299219820Sjeff	CL_ASSERT(client_rereg <= 0x1);
5300219820Sjeff	p_pi->subnet_timeout =
5301219820Sjeff	    (uint8_t) ((p_pi->
5302219820Sjeff			subnet_timeout & 0x1F) | ((client_rereg << 7) & 0x80));
5303219820Sjeff}
5304219820Sjeff
5305219820Sjeff/*
5306219820Sjeff* PARAMETERS
5307219820Sjeff*	p_pi
5308219820Sjeff*		[in] Pointer to a PortInfo attribute.
5309219820Sjeff*
5310219820Sjeff*	client_rereg
5311219820Sjeff*		[in] Client reregistration value to set (either 1 or 0).
5312219820Sjeff*
5313219820Sjeff* RETURN VALUES
5314219820Sjeff*	None.
5315219820Sjeff*
5316219820Sjeff* NOTES
5317219820Sjeff*
5318219820Sjeff* SEE ALSO
5319219820Sjeff*********/
5320219820Sjeff
5321219820Sjeff/****f* IBA Base: Types/ib_port_info_get_timeout
5322219820Sjeff* NAME
5323219820Sjeff*	ib_port_info_get_timeout
5324219820Sjeff*
5325219820Sjeff* DESCRIPTION
5326219820Sjeff*	Gets the encoded subnet timeout value in the PortInfo attribute.
5327219820Sjeff*
5328219820Sjeff* SYNOPSIS
5329219820Sjeff*/
5330219820Sjeffstatic inline uint8_t OSM_API
5331219820Sjeffib_port_info_get_timeout(IN ib_port_info_t const *p_pi)
5332219820Sjeff{
5333219820Sjeff	return (p_pi->subnet_timeout & 0x1F);
5334219820Sjeff}
5335219820Sjeff
5336219820Sjeff/*
5337219820Sjeff* PARAMETERS
5338219820Sjeff*	p_pi
5339219820Sjeff*		[in] Pointer to a PortInfo attribute.
5340219820Sjeff*
5341219820Sjeff* RETURN VALUES
5342219820Sjeff*	The encoded timeout value
5343219820Sjeff*
5344219820Sjeff* NOTES
5345219820Sjeff*
5346219820Sjeff* SEE ALSO
5347219820Sjeff*********/
5348219820Sjeff
5349219820Sjeff/****f* IBA Base: Types/ib_port_info_get_client_rereg
5350219820Sjeff* NAME
5351219820Sjeff*	ib_port_info_get_client_rereg
5352219820Sjeff*
5353219820Sjeff* DESCRIPTION
5354219820Sjeff*	Gets the encoded client reregistration bit value in the PortInfo attribute.
5355219820Sjeff*
5356219820Sjeff* SYNOPSIS
5357219820Sjeff*/
5358219820Sjeffstatic inline uint8_t OSM_API
5359219820Sjeffib_port_info_get_client_rereg(IN ib_port_info_t const *p_pi)
5360219820Sjeff{
5361219820Sjeff	return ((p_pi->subnet_timeout & 0x80) >> 7);
5362219820Sjeff}
5363219820Sjeff
5364219820Sjeff/*
5365219820Sjeff* PARAMETERS
5366219820Sjeff*	p_pi
5367219820Sjeff*		[in] Pointer to a PortInfo attribute.
5368219820Sjeff*
5369219820Sjeff* RETURN VALUES
5370219820Sjeff*	Client reregistration value (either 1 or 0).
5371219820Sjeff*
5372219820Sjeff* NOTES
5373219820Sjeff*
5374219820Sjeff* SEE ALSO
5375219820Sjeff*********/
5376219820Sjeff
5377219820Sjeff/****f* IBA Base: Types/ib_port_info_set_hoq_lifetime
5378219820Sjeff* NAME
5379219820Sjeff*	ib_port_info_set_hoq_lifetime
5380219820Sjeff*
5381219820Sjeff* DESCRIPTION
5382219820Sjeff*	Sets the Head of Queue Lifetime for which a packet can live in the head
5383219820Sjeff*  of VL queue
5384219820Sjeff*
5385219820Sjeff* SYNOPSIS
5386219820Sjeff*/
5387219820Sjeffstatic inline void OSM_API
5388219820Sjeffib_port_info_set_hoq_lifetime(IN ib_port_info_t * const p_pi,
5389219820Sjeff			      IN const uint8_t hoq_life)
5390219820Sjeff{
5391219820Sjeff	p_pi->vl_stall_life = (uint8_t) ((hoq_life & 0x1f) |
5392219820Sjeff					 (p_pi->vl_stall_life & 0xe0));
5393219820Sjeff}
5394219820Sjeff
5395219820Sjeff/*
5396219820Sjeff* PARAMETERS
5397219820Sjeff*	p_pi
5398219820Sjeff*		[in] Pointer to a PortInfo attribute.
5399219820Sjeff*
5400219820Sjeff*	hoq_life
5401219820Sjeff*		[in] Encoded lifetime value to set
5402219820Sjeff*
5403219820Sjeff* RETURN VALUES
5404219820Sjeff*	None.
5405219820Sjeff*
5406219820Sjeff* NOTES
5407219820Sjeff*
5408219820Sjeff* SEE ALSO
5409219820Sjeff*********/
5410219820Sjeff
5411219820Sjeff/****f* IBA Base: Types/ib_port_info_get_hoq_lifetime
5412219820Sjeff* NAME
5413219820Sjeff*	ib_port_info_get_hoq_lifetime
5414219820Sjeff*
5415219820Sjeff* DESCRIPTION
5416219820Sjeff*	Gets the Head of Queue Lifetime for which a packet can live in the head
5417219820Sjeff*  of VL queue
5418219820Sjeff*
5419219820Sjeff* SYNOPSIS
5420219820Sjeff*/
5421219820Sjeffstatic inline uint8_t OSM_API
5422219820Sjeffib_port_info_get_hoq_lifetime(IN const ib_port_info_t * const p_pi)
5423219820Sjeff{
5424219820Sjeff	return ((uint8_t) (p_pi->vl_stall_life & 0x1f));
5425219820Sjeff}
5426219820Sjeff
5427219820Sjeff/*
5428219820Sjeff* PARAMETERS
5429219820Sjeff*	p_pi
5430219820Sjeff*		[in] Pointer to a PortInfo attribute.
5431219820Sjeff*
5432219820Sjeff* RETURN VALUES
5433219820Sjeff*     Encoded lifetime value
5434219820Sjeff*
5435219820Sjeff* NOTES
5436219820Sjeff*
5437219820Sjeff* SEE ALSO
5438219820Sjeff*********/
5439219820Sjeff
5440219820Sjeff/****f* IBA Base: Types/ib_port_info_set_vl_stall_count
5441219820Sjeff* NAME
5442219820Sjeff*	ib_port_info_set_vl_stall_count
5443219820Sjeff*
5444219820Sjeff* DESCRIPTION
5445219820Sjeff*	Sets the VL Stall Count which define the number of contiguous
5446219820Sjeff*  HLL (hoq) drops that will put the VL into stalled mode.
5447219820Sjeff*
5448219820Sjeff* SYNOPSIS
5449219820Sjeff*/
5450219820Sjeffstatic inline void OSM_API
5451219820Sjeffib_port_info_set_vl_stall_count(IN ib_port_info_t * const p_pi,
5452219820Sjeff				IN const uint8_t vl_stall_count)
5453219820Sjeff{
5454219820Sjeff	p_pi->vl_stall_life = (uint8_t) ((p_pi->vl_stall_life & 0x1f) |
5455219820Sjeff					 ((vl_stall_count << 5) & 0xe0));
5456219820Sjeff}
5457219820Sjeff
5458219820Sjeff/*
5459219820Sjeff* PARAMETERS
5460219820Sjeff*	p_pi
5461219820Sjeff*		[in] Pointer to a PortInfo attribute.
5462219820Sjeff*
5463219820Sjeff*	vl_stall_count
5464219820Sjeff*		[in] value to set
5465219820Sjeff*
5466219820Sjeff* RETURN VALUES
5467219820Sjeff*	None.
5468219820Sjeff*
5469219820Sjeff* NOTES
5470219820Sjeff*
5471219820Sjeff* SEE ALSO
5472219820Sjeff*********/
5473219820Sjeff
5474219820Sjeff/****f* IBA Base: Types/ib_port_info_get_vl_stall_count
5475219820Sjeff* NAME
5476219820Sjeff*	ib_port_info_get_vl_stall_count
5477219820Sjeff*
5478219820Sjeff* DESCRIPTION
5479219820Sjeff*	Gets the VL Stall Count which define the number of contiguous
5480219820Sjeff*  HLL (hoq) drops that will put the VL into stalled mode
5481219820Sjeff*
5482219820Sjeff* SYNOPSIS
5483219820Sjeff*/
5484219820Sjeffstatic inline uint8_t OSM_API
5485219820Sjeffib_port_info_get_vl_stall_count(IN const ib_port_info_t * const p_pi)
5486219820Sjeff{
5487219820Sjeff	return ((uint8_t) (p_pi->vl_stall_life & 0xe0) >> 5);
5488219820Sjeff}
5489219820Sjeff
5490219820Sjeff/*
5491219820Sjeff* PARAMETERS
5492219820Sjeff*	p_pi
5493219820Sjeff*		[in] Pointer to a PortInfo attribute.
5494219820Sjeff*
5495219820Sjeff* RETURN VALUES
5496219820Sjeff*     vl stall count
5497219820Sjeff*
5498219820Sjeff* NOTES
5499219820Sjeff*
5500219820Sjeff* SEE ALSO
5501219820Sjeff*********/
5502219820Sjeff
5503219820Sjeff/****f* IBA Base: Types/ib_port_info_get_lmc
5504219820Sjeff* NAME
5505219820Sjeff*	ib_port_info_get_lmc
5506219820Sjeff*
5507219820Sjeff* DESCRIPTION
5508219820Sjeff*	Returns the LMC value assigned to this port.
5509219820Sjeff*
5510219820Sjeff* SYNOPSIS
5511219820Sjeff*/
5512219820Sjeffstatic inline uint8_t OSM_API
5513219820Sjeffib_port_info_get_lmc(IN const ib_port_info_t * const p_pi)
5514219820Sjeff{
5515219820Sjeff	return ((uint8_t) (p_pi->mkey_lmc & IB_PORT_LMC_MASK));
5516219820Sjeff}
5517219820Sjeff
5518219820Sjeff/*
5519219820Sjeff* PARAMETERS
5520219820Sjeff*	p_pi
5521219820Sjeff*		[in] Pointer to a PortInfo attribute.
5522219820Sjeff*
5523219820Sjeff* RETURN VALUES
5524219820Sjeff*	Returns the LMC value assigned to this port.
5525219820Sjeff*
5526219820Sjeff* NOTES
5527219820Sjeff*
5528219820Sjeff* SEE ALSO
5529219820Sjeff*********/
5530219820Sjeff
5531219820Sjeff/****f* IBA Base: Types/ib_port_info_set_lmc
5532219820Sjeff* NAME
5533219820Sjeff*	ib_port_info_set_lmc
5534219820Sjeff*
5535219820Sjeff* DESCRIPTION
5536219820Sjeff*	Sets the LMC value in the PortInfo attribute.
5537219820Sjeff*
5538219820Sjeff* SYNOPSIS
5539219820Sjeff*/
5540219820Sjeffstatic inline void OSM_API
5541219820Sjeffib_port_info_set_lmc(IN ib_port_info_t * const p_pi, IN const uint8_t lmc)
5542219820Sjeff{
5543219820Sjeff	CL_ASSERT(lmc <= IB_PORT_LMC_MAX);
5544219820Sjeff	p_pi->mkey_lmc = (uint8_t) ((p_pi->mkey_lmc & 0xF8) | lmc);
5545219820Sjeff}
5546219820Sjeff
5547219820Sjeff/*
5548219820Sjeff* PARAMETERS
5549219820Sjeff*	p_pi
5550219820Sjeff*		[in] Pointer to a PortInfo attribute.
5551219820Sjeff*
5552219820Sjeff*	lmc
5553219820Sjeff*		[in] LMC value to set, must be less than 7.
5554219820Sjeff*
5555219820Sjeff* RETURN VALUES
5556219820Sjeff*	None.
5557219820Sjeff*
5558219820Sjeff* NOTES
5559219820Sjeff*
5560219820Sjeff* SEE ALSO
5561219820Sjeff*********/
5562219820Sjeff
5563219820Sjeff/****f* IBA Base: Types/ib_port_info_get_link_speed_enabled
5564219820Sjeff* NAME
5565219820Sjeff*	ib_port_info_get_link_speed_enabled
5566219820Sjeff*
5567219820Sjeff* DESCRIPTION
5568219820Sjeff*	Returns the link speed enabled value assigned to this port.
5569219820Sjeff*
5570219820Sjeff* SYNOPSIS
5571219820Sjeff*/
5572219820Sjeffstatic inline uint8_t OSM_API
5573219820Sjeffib_port_info_get_link_speed_enabled(IN const ib_port_info_t * const p_pi)
5574219820Sjeff{
5575219820Sjeff	return ((uint8_t) (p_pi->link_speed & IB_PORT_LINK_SPEED_ENABLED_MASK));
5576219820Sjeff}
5577219820Sjeff
5578219820Sjeff/*
5579219820Sjeff* PARAMETERS
5580219820Sjeff*	p_pi
5581219820Sjeff*		[in] Pointer to a PortInfo attribute.
5582219820Sjeff*
5583219820Sjeff* RETURN VALUES
5584219820Sjeff*	Port state.
5585219820Sjeff*
5586219820Sjeff* NOTES
5587219820Sjeff*
5588219820Sjeff* SEE ALSO
5589219820Sjeff*********/
5590219820Sjeff
5591219820Sjeff/****f* IBA Base: Types/ib_port_info_set_link_speed_enabled
5592219820Sjeff* NAME
5593219820Sjeff*	ib_port_info_set_link_speed_enabled
5594219820Sjeff*
5595219820Sjeff* DESCRIPTION
5596219820Sjeff*	Sets the link speed enabled value in the PortInfo attribute.
5597219820Sjeff*
5598219820Sjeff* SYNOPSIS
5599219820Sjeff*/
5600219820Sjeffstatic inline void OSM_API
5601219820Sjeffib_port_info_set_link_speed_enabled(IN ib_port_info_t * const p_pi,
5602219820Sjeff				    IN const uint8_t link_speed_enabled)
5603219820Sjeff{
5604219820Sjeff	p_pi->link_speed =
5605219820Sjeff	    (uint8_t) ((p_pi->link_speed & 0xF0) | link_speed_enabled);
5606219820Sjeff}
5607219820Sjeff
5608219820Sjeff/*
5609219820Sjeff* PARAMETERS
5610219820Sjeff*	p_pi
5611219820Sjeff*		[in] Pointer to a PortInfo attribute.
5612219820Sjeff*
5613219820Sjeff*	link_speed_enabled
5614219820Sjeff*		[in] link speed enabled value to set.
5615219820Sjeff*
5616219820Sjeff* RETURN VALUES
5617219820Sjeff*	None.
5618219820Sjeff*
5619219820Sjeff* NOTES
5620219820Sjeff*
5621219820Sjeff* SEE ALSO
5622219820Sjeff*********/
5623219820Sjeff
5624219820Sjeff/****f* IBA Base: Types/ib_port_info_get_mpb
5625219820Sjeff* NAME
5626219820Sjeff*	ib_port_info_get_mpb
5627219820Sjeff*
5628219820Sjeff* DESCRIPTION
5629219820Sjeff*	Returns the M_Key protect bits assigned to this port.
5630219820Sjeff*
5631219820Sjeff* SYNOPSIS
5632219820Sjeff*/
5633219820Sjeffstatic inline uint8_t OSM_API
5634219820Sjeffib_port_info_get_mpb(IN const ib_port_info_t * const p_pi)
5635219820Sjeff{
5636219820Sjeff	return ((uint8_t) ((p_pi->mkey_lmc & IB_PORT_MPB_MASK) >>
5637219820Sjeff			   IB_PORT_MPB_SHIFT));
5638219820Sjeff}
5639219820Sjeff
5640219820Sjeff/*
5641219820Sjeff* PARAMETERS
5642219820Sjeff*	p_ni
5643219820Sjeff*		[in] Pointer to a PortInfo attribute.
5644219820Sjeff*
5645219820Sjeff* RETURN VALUES
5646219820Sjeff*	Returns the M_Key protect bits assigned to this port.
5647219820Sjeff*
5648219820Sjeff* NOTES
5649219820Sjeff*
5650219820Sjeff* SEE ALSO
5651219820Sjeff*********/
5652219820Sjeff
5653219820Sjeff/****f* IBA Base: Types/ib_port_info_set_mpb
5654219820Sjeff* NAME
5655219820Sjeff*	ib_port_info_set_mpb
5656219820Sjeff*
5657219820Sjeff* DESCRIPTION
5658219820Sjeff*	Set the M_Key protect bits of this port.
5659219820Sjeff*
5660219820Sjeff* SYNOPSIS
5661219820Sjeff*/
5662219820Sjeffstatic inline void OSM_API
5663219820Sjeffib_port_info_set_mpb(IN ib_port_info_t * p_pi, IN uint8_t mpb)
5664219820Sjeff{
5665219820Sjeff	p_pi->mkey_lmc =
5666219820Sjeff	    (~IB_PORT_MPB_MASK & p_pi->mkey_lmc) |
5667219820Sjeff	    (IB_PORT_MPB_MASK & (mpb << IB_PORT_MPB_SHIFT));
5668219820Sjeff}
5669219820Sjeff
5670219820Sjeff/*
5671219820Sjeff* PARAMETERS
5672219820Sjeff*	mpb
5673219820Sjeff*		[in] M_Key protect bits
5674219820Sjeff*	p_ni
5675219820Sjeff*		[in] Pointer to a PortInfo attribute.
5676219820Sjeff*
5677219820Sjeff* RETURN VALUES
5678219820Sjeff*
5679219820Sjeff* NOTES
5680219820Sjeff*
5681219820Sjeff* SEE ALSO
5682219820Sjeff*********/
5683219820Sjeff
5684219820Sjeff/****f* IBA Base: Types/ib_port_info_get_local_phy_err_thd
5685219820Sjeff* NAME
5686219820Sjeff*	ib_port_info_get_local_phy_err_thd
5687219820Sjeff*
5688219820Sjeff* DESCRIPTION
5689219820Sjeff*	Returns the Phy Link Threshold
5690219820Sjeff*
5691219820Sjeff* SYNOPSIS
5692219820Sjeff*/
5693219820Sjeffstatic inline uint8_t OSM_API
5694219820Sjeffib_port_info_get_local_phy_err_thd(IN const ib_port_info_t * const p_pi)
5695219820Sjeff{
5696219820Sjeff	return (uint8_t) ((p_pi->error_threshold & 0xF0) >> 4);
5697219820Sjeff}
5698219820Sjeff
5699219820Sjeff/*
5700219820Sjeff* PARAMETERS
5701219820Sjeff*	p_pi
5702219820Sjeff*		[in] Pointer to a PortInfo attribute.
5703219820Sjeff*
5704219820Sjeff* RETURN VALUES
5705219820Sjeff*	Returns the Phy Link error threshold assigned to this port.
5706219820Sjeff*
5707219820Sjeff* NOTES
5708219820Sjeff*
5709219820Sjeff* SEE ALSO
5710219820Sjeff*********/
5711219820Sjeff
5712219820Sjeff/****f* IBA Base: Types/ib_port_info_get_overrun_err_thd
5713219820Sjeff* NAME
5714219820Sjeff*	ib_port_info_get_local_overrun_err_thd
5715219820Sjeff*
5716219820Sjeff* DESCRIPTION
5717219820Sjeff*	Returns the Credits Overrun Errors Threshold
5718219820Sjeff*
5719219820Sjeff* SYNOPSIS
5720219820Sjeff*/
5721219820Sjeffstatic inline uint8_t OSM_API
5722219820Sjeffib_port_info_get_overrun_err_thd(IN const ib_port_info_t * const p_pi)
5723219820Sjeff{
5724219820Sjeff	return (uint8_t) (p_pi->error_threshold & 0x0F);
5725219820Sjeff}
5726219820Sjeff
5727219820Sjeff/*
5728219820Sjeff* PARAMETERS
5729219820Sjeff*	p_pi
5730219820Sjeff*		[in] Pointer to a PortInfo attribute.
5731219820Sjeff*
5732219820Sjeff* RETURN VALUES
5733219820Sjeff*	Returns the Credits Overrun errors threshold assigned to this port.
5734219820Sjeff*
5735219820Sjeff* NOTES
5736219820Sjeff*
5737219820Sjeff* SEE ALSO
5738219820Sjeff*********/
5739219820Sjeff
5740219820Sjeff/****f* IBA Base: Types/ib_port_info_set_phy_and_overrun_err_thd
5741219820Sjeff* NAME
5742219820Sjeff*	ib_port_info_set_phy_and_overrun_err_thd
5743219820Sjeff*
5744219820Sjeff* DESCRIPTION
5745219820Sjeff*	Sets the Phy Link and Credits Overrun Errors Threshold
5746219820Sjeff*
5747219820Sjeff* SYNOPSIS
5748219820Sjeff*/
5749219820Sjeffstatic inline void OSM_API
5750219820Sjeffib_port_info_set_phy_and_overrun_err_thd(IN ib_port_info_t * const p_pi,
5751219820Sjeff					 IN uint8_t phy_threshold,
5752219820Sjeff					 IN uint8_t overrun_threshold)
5753219820Sjeff{
5754219820Sjeff	p_pi->error_threshold =
5755219820Sjeff	    (uint8_t) (((phy_threshold & 0x0F) << 4) |
5756219820Sjeff		       (overrun_threshold & 0x0F));
5757219820Sjeff}
5758219820Sjeff
5759219820Sjeff/*
5760219820Sjeff* PARAMETERS
5761219820Sjeff*	p_pi
5762219820Sjeff*		[in] Pointer to a PortInfo attribute.
5763219820Sjeff*
5764219820Sjeff*	phy_threshold
5765219820Sjeff*		[in] Physical Link Errors Threshold above which Trap 129 is generated
5766219820Sjeff*
5767219820Sjeff*  overrun_threshold
5768219820Sjeff*     [in] Credits overrun Errors Threshold above which Trap 129 is generated
5769219820Sjeff*
5770219820Sjeff* RETURN VALUES
5771219820Sjeff*	None.
5772219820Sjeff*
5773219820Sjeff* NOTES
5774219820Sjeff*
5775219820Sjeff* SEE ALSO
5776219820Sjeff*********/
5777219820Sjeff
5778219820Sjefftypedef uint8_t ib_svc_name_t[64];
5779219820Sjeff
5780219820Sjeff#include <complib/cl_packon.h>
5781219820Sjefftypedef struct _ib_service_record {
5782219820Sjeff	ib_net64_t service_id;
5783219820Sjeff	ib_gid_t service_gid;
5784219820Sjeff	ib_net16_t service_pkey;
5785219820Sjeff	ib_net16_t resv;
5786219820Sjeff	ib_net32_t service_lease;
5787219820Sjeff	uint8_t service_key[16];
5788219820Sjeff	ib_svc_name_t service_name;
5789219820Sjeff	uint8_t service_data8[16];
5790219820Sjeff	ib_net16_t service_data16[8];
5791219820Sjeff	ib_net32_t service_data32[4];
5792219820Sjeff	ib_net64_t service_data64[2];
5793219820Sjeff
5794219820Sjeff} PACK_SUFFIX ib_service_record_t;
5795219820Sjeff#include <complib/cl_packoff.h>
5796219820Sjeff
5797219820Sjeff#include <complib/cl_packon.h>
5798219820Sjefftypedef struct _ib_portinfo_record {
5799219820Sjeff	ib_net16_t lid;
5800219820Sjeff	uint8_t port_num;
5801219820Sjeff	uint8_t resv;
5802219820Sjeff	ib_port_info_t port_info;
5803219820Sjeff	uint8_t pad[6];
5804219820Sjeff
5805219820Sjeff} PACK_SUFFIX ib_portinfo_record_t;
5806219820Sjeff#include <complib/cl_packoff.h>
5807219820Sjeff
5808219820Sjeff#include <complib/cl_packon.h>
5809219820Sjefftypedef struct _ib_link_record {
5810219820Sjeff	ib_net16_t from_lid;
5811219820Sjeff	uint8_t from_port_num;
5812219820Sjeff	uint8_t to_port_num;
5813219820Sjeff	ib_net16_t to_lid;
5814219820Sjeff	uint8_t pad[2];
5815219820Sjeff
5816219820Sjeff} PACK_SUFFIX ib_link_record_t;
5817219820Sjeff#include <complib/cl_packoff.h>
5818219820Sjeff
5819219820Sjeff#include <complib/cl_packon.h>
5820219820Sjefftypedef struct _ib_sminfo_record {
5821219820Sjeff	ib_net16_t lid;
5822219820Sjeff	uint16_t resv0;
5823219820Sjeff	ib_sm_info_t sm_info;
5824219820Sjeff	uint8_t pad[7];
5825219820Sjeff
5826219820Sjeff} PACK_SUFFIX ib_sminfo_record_t;
5827219820Sjeff#include <complib/cl_packoff.h>
5828219820Sjeff
5829219820Sjeff/****s* IBA Base: Types/ib_lft_record_t
5830219820Sjeff* NAME
5831219820Sjeff*	ib_lft_record_t
5832219820Sjeff*
5833219820Sjeff* DESCRIPTION
5834219820Sjeff*	IBA defined LinearForwardingTableRecord (15.2.5.6)
5835219820Sjeff*
5836219820Sjeff* SYNOPSIS
5837219820Sjeff*/
5838219820Sjeff#include <complib/cl_packon.h>
5839219820Sjefftypedef struct _ib_lft_record {
5840219820Sjeff	ib_net16_t lid;
5841219820Sjeff	ib_net16_t block_num;
5842219820Sjeff	uint32_t resv0;
5843219820Sjeff	uint8_t lft[64];
5844219820Sjeff} PACK_SUFFIX ib_lft_record_t;
5845219820Sjeff#include <complib/cl_packoff.h>
5846219820Sjeff/************/
5847219820Sjeff
5848219820Sjeff/****s* IBA Base: Types/ib_mft_record_t
5849219820Sjeff* NAME
5850219820Sjeff*	ib_mft_record_t
5851219820Sjeff*
5852219820Sjeff* DESCRIPTION
5853219820Sjeff*	IBA defined MulticastForwardingTableRecord (15.2.5.8)
5854219820Sjeff*
5855219820Sjeff* SYNOPSIS
5856219820Sjeff*/
5857219820Sjeff#include <complib/cl_packon.h>
5858219820Sjefftypedef struct _ib_mft_record {
5859219820Sjeff	ib_net16_t lid;
5860219820Sjeff	ib_net16_t position_block_num;
5861219820Sjeff	uint32_t resv0;
5862219820Sjeff	ib_net16_t mft[IB_MCAST_BLOCK_SIZE];
5863219820Sjeff} PACK_SUFFIX ib_mft_record_t;
5864219820Sjeff#include <complib/cl_packoff.h>
5865219820Sjeff/************/
5866219820Sjeff
5867219820Sjeff/****s* IBA Base: Types/ib_switch_info_t
5868219820Sjeff* NAME
5869219820Sjeff*	ib_switch_info_t
5870219820Sjeff*
5871219820Sjeff* DESCRIPTION
5872219820Sjeff*	IBA defined SwitchInfo. (14.2.5.4)
5873219820Sjeff*
5874219820Sjeff* SYNOPSIS
5875219820Sjeff*/
5876219820Sjeff#include <complib/cl_packon.h>
5877219820Sjefftypedef struct _ib_switch_info {
5878219820Sjeff	ib_net16_t lin_cap;
5879219820Sjeff	ib_net16_t rand_cap;
5880219820Sjeff	ib_net16_t mcast_cap;
5881219820Sjeff	ib_net16_t lin_top;
5882219820Sjeff	uint8_t def_port;
5883219820Sjeff	uint8_t def_mcast_pri_port;
5884219820Sjeff	uint8_t def_mcast_not_port;
5885219820Sjeff	uint8_t life_state;
5886219820Sjeff	ib_net16_t lids_per_port;
5887219820Sjeff	ib_net16_t enforce_cap;
5888219820Sjeff	uint8_t flags;
5889219820Sjeff
5890219820Sjeff} PACK_SUFFIX ib_switch_info_t;
5891219820Sjeff#include <complib/cl_packoff.h>
5892219820Sjeff/************/
5893219820Sjeff
5894219820Sjeff#include <complib/cl_packon.h>
5895219820Sjefftypedef struct _ib_switch_info_record {
5896219820Sjeff	ib_net16_t lid;
5897219820Sjeff	uint16_t resv0;
5898219820Sjeff	ib_switch_info_t switch_info;
5899219820Sjeff	uint8_t pad[3];
5900219820Sjeff
5901219820Sjeff} PACK_SUFFIX ib_switch_info_record_t;
5902219820Sjeff#include <complib/cl_packoff.h>
5903219820Sjeff
5904219820Sjeff#define IB_SWITCH_PSC 0x04
5905219820Sjeff
5906219820Sjeff/****f* IBA Base: Types/ib_switch_info_get_state_change
5907219820Sjeff* NAME
5908219820Sjeff*	ib_switch_info_get_state_change
5909219820Sjeff*
5910219820Sjeff* DESCRIPTION
5911219820Sjeff*	Returns the value of the state change flag.
5912219820Sjeff*
5913219820Sjeff* SYNOPSIS
5914219820Sjeff*/
5915219820Sjeffstatic inline boolean_t OSM_API
5916219820Sjeffib_switch_info_get_state_change(IN const ib_switch_info_t * const p_si)
5917219820Sjeff{
5918219820Sjeff	return ((p_si->life_state & IB_SWITCH_PSC) == IB_SWITCH_PSC);
5919219820Sjeff}
5920219820Sjeff
5921219820Sjeff/*
5922219820Sjeff* PARAMETERS
5923219820Sjeff*	p_si
5924219820Sjeff*		[in] Pointer to a SwitchInfo attribute.
5925219820Sjeff*
5926219820Sjeff* RETURN VALUES
5927219820Sjeff*	Returns the value of the state change flag.
5928219820Sjeff*
5929219820Sjeff* NOTES
5930219820Sjeff*
5931219820Sjeff* SEE ALSO
5932219820Sjeff*********/
5933219820Sjeff
5934219820Sjeff/****f* IBA Base: Types/ib_switch_info_clear_state_change
5935219820Sjeff* NAME
5936219820Sjeff*	ib_switch_info_clear_state_change
5937219820Sjeff*
5938219820Sjeff* DESCRIPTION
5939219820Sjeff*	Clears the switch's state change bit.
5940219820Sjeff*
5941219820Sjeff* SYNOPSIS
5942219820Sjeff*/
5943219820Sjeffstatic inline void OSM_API
5944219820Sjeffib_switch_info_clear_state_change(IN ib_switch_info_t * const p_si)
5945219820Sjeff{
5946219820Sjeff	p_si->life_state = (uint8_t) (p_si->life_state & 0xFB);
5947219820Sjeff}
5948219820Sjeff
5949219820Sjeff/*
5950219820Sjeff* PARAMETERS
5951219820Sjeff*	p_ni
5952219820Sjeff*		[in] Pointer to a PortInfo attribute.
5953219820Sjeff*
5954219820Sjeff* RETURN VALUES
5955219820Sjeff*	Returns the LMC value assigned to this port.
5956219820Sjeff*
5957219820Sjeff* NOTES
5958219820Sjeff*
5959219820Sjeff* SEE ALSO
5960219820Sjeff*********/
5961219820Sjeff
5962219820Sjeff/****f* IBA Base: Types/ib_switch_info_is_enhanced_port0
5963219820Sjeff* NAME
5964219820Sjeff*	ib_switch_info_is_enhanced_port0
5965219820Sjeff*
5966219820Sjeff* DESCRIPTION
5967219820Sjeff*	Returns TRUE if the enhancedPort0 bit is on (meaning the switch
5968219820Sjeff*  port zero supports enhanced functions).
5969219820Sjeff*  Returns FALSE otherwise.
5970219820Sjeff*
5971219820Sjeff* SYNOPSIS
5972219820Sjeff*/
5973219820Sjeffstatic inline boolean_t OSM_API
5974219820Sjeffib_switch_info_is_enhanced_port0(IN const ib_switch_info_t * const p_si)
5975219820Sjeff{
5976219820Sjeff	return ((p_si->flags & 0x08) == 0x08);
5977219820Sjeff}
5978219820Sjeff
5979219820Sjeff/*
5980219820Sjeff* PARAMETERS
5981219820Sjeff*	p_si
5982219820Sjeff*		[in] Pointer to a SwitchInfo attribute.
5983219820Sjeff*
5984219820Sjeff* RETURN VALUES
5985219820Sjeff*	Returns TRUE if the switch supports enhanced port 0. FALSE otherwise.
5986219820Sjeff*
5987219820Sjeff* NOTES
5988219820Sjeff*
5989219820Sjeff* SEE ALSO
5990219820Sjeff*********/
5991219820Sjeff
5992219820Sjeff/****s* IBA Base: Types/ib_guid_info_t
5993219820Sjeff* NAME
5994219820Sjeff*	ib_guid_info_t
5995219820Sjeff*
5996219820Sjeff* DESCRIPTION
5997219820Sjeff*	IBA defined GuidInfo. (14.2.5.5)
5998219820Sjeff*
5999219820Sjeff* SYNOPSIS
6000219820Sjeff*/
6001219820Sjeff#define	GUID_TABLE_MAX_ENTRIES		8
6002219820Sjeff
6003219820Sjeff#include <complib/cl_packon.h>
6004219820Sjefftypedef struct _ib_guid_info {
6005219820Sjeff	ib_net64_t guid[GUID_TABLE_MAX_ENTRIES];
6006219820Sjeff
6007219820Sjeff} PACK_SUFFIX ib_guid_info_t;
6008219820Sjeff#include <complib/cl_packoff.h>
6009219820Sjeff/************/
6010219820Sjeff
6011219820Sjeff#include <complib/cl_packon.h>
6012219820Sjefftypedef struct _ib_guidinfo_record {
6013219820Sjeff	ib_net16_t lid;
6014219820Sjeff	uint8_t block_num;
6015219820Sjeff	uint8_t resv;
6016219820Sjeff	uint32_t reserved;
6017219820Sjeff	ib_guid_info_t guid_info;
6018219820Sjeff} PACK_SUFFIX ib_guidinfo_record_t;
6019219820Sjeff#include <complib/cl_packoff.h>
6020219820Sjeff
6021219820Sjeff#define IB_MULTIPATH_MAX_GIDS 11	/* Support max that can fit into first MAD (for now) */
6022219820Sjeff
6023219820Sjeff#include <complib/cl_packon.h>
6024219820Sjefftypedef struct _ib_multipath_rec_t {
6025219820Sjeff	ib_net32_t hop_flow_raw;
6026219820Sjeff	uint8_t tclass;
6027219820Sjeff	uint8_t num_path;
6028219820Sjeff	ib_net16_t pkey;
6029219820Sjeff	ib_net16_t qos_class_sl;
6030219820Sjeff	uint8_t mtu;
6031219820Sjeff	uint8_t rate;
6032219820Sjeff	uint8_t pkt_life;
6033219820Sjeff	uint8_t service_id_8msb;
6034219820Sjeff	uint8_t independence;	/* formerly resv2 */
6035219820Sjeff	uint8_t sgid_count;
6036219820Sjeff	uint8_t dgid_count;
6037219820Sjeff	uint8_t service_id_56lsb[7];
6038219820Sjeff	ib_gid_t gids[IB_MULTIPATH_MAX_GIDS];
6039219820Sjeff} PACK_SUFFIX ib_multipath_rec_t;
6040219820Sjeff#include <complib/cl_packoff.h>
6041219820Sjeff/*
6042219820Sjeff* FIELDS
6043219820Sjeff*       hop_flow_raw
6044219820Sjeff*               Global routing parameters: hop count, flow label and raw bit.
6045219820Sjeff*
6046219820Sjeff*       tclass
6047219820Sjeff*               Another global routing parameter.
6048219820Sjeff*
6049219820Sjeff*       num_path
6050219820Sjeff*     Reversible path - 1 bit to say if path is reversible.
6051219820Sjeff*               num_path [6:0] In queries, maximum number of paths to return.
6052219820Sjeff*               In responses, undefined.
6053219820Sjeff*
6054219820Sjeff*       pkey
6055219820Sjeff*               Partition key (P_Key) to use on this path.
6056219820Sjeff*
6057219820Sjeff*       qos_class_sl
6058219820Sjeff*               QoS class and service level to use on this path.
6059219820Sjeff*
6060219820Sjeff*       mtu
6061219820Sjeff*               MTU and MTU selector fields to use on this path
6062219820Sjeff*       rate
6063219820Sjeff*               Rate and rate selector fields to use on this path.
6064219820Sjeff*
6065219820Sjeff*       pkt_life
6066219820Sjeff*               Packet lifetime
6067219820Sjeff*
6068219820Sjeff*	service_id_8msb
6069219820Sjeff*		8 most significant bits of Service ID
6070219820Sjeff*
6071219820Sjeff*	service_id_56lsb
6072219820Sjeff*		56 least significant bits of Service ID
6073219820Sjeff*
6074219820Sjeff*       preference
6075219820Sjeff*               Indicates the relative merit of this path versus other path
6076219820Sjeff*               records returned from the SA.  Lower numbers are better.
6077219820Sjeff*
6078219820Sjeff* SEE ALSO
6079219820Sjeff*********/
6080219820Sjeff
6081219820Sjeff/****f* IBA Base: Types/ib_multipath_rec_num_path
6082219820Sjeff* NAME
6083219820Sjeff*       ib_multipath_rec_num_path
6084219820Sjeff*
6085219820Sjeff* DESCRIPTION
6086219820Sjeff*       Get max number of paths to return.
6087219820Sjeff*
6088219820Sjeff* SYNOPSIS
6089219820Sjeff*/
6090219820Sjeffstatic inline uint8_t OSM_API
6091219820Sjeffib_multipath_rec_num_path(IN const ib_multipath_rec_t * const p_rec)
6092219820Sjeff{
6093219820Sjeff	return (p_rec->num_path & 0x7F);
6094219820Sjeff}
6095219820Sjeff
6096219820Sjeff/*
6097219820Sjeff* PARAMETERS
6098219820Sjeff*       p_rec
6099219820Sjeff*               [in] Pointer to the multipath record object.
6100219820Sjeff*
6101219820Sjeff* RETURN VALUES
6102219820Sjeff*       Maximum number of paths to return for each unique SGID_DGID combination.
6103219820Sjeff*
6104219820Sjeff* NOTES
6105219820Sjeff*
6106219820Sjeff* SEE ALSO
6107219820Sjeff*       ib_multipath_rec_t
6108219820Sjeff*********/
6109219820Sjeff
6110219820Sjeff/****f* IBA Base: Types/ib_multipath_rec_set_sl
6111219820Sjeff* NAME
6112219820Sjeff*	ib_multipath_rec_set_sl
6113219820Sjeff*
6114219820Sjeff* DESCRIPTION
6115219820Sjeff*	Set path service level.
6116219820Sjeff*
6117219820Sjeff* SYNOPSIS
6118219820Sjeff*/
6119219820Sjeffstatic inline void	OSM_API
6120219820Sjeffib_multipath_rec_set_sl(
6121219820Sjeff	IN ib_multipath_rec_t* const p_rec,
6122219820Sjeff	IN const uint8_t sl )
6123219820Sjeff{
6124219820Sjeff	p_rec->qos_class_sl =
6125219820Sjeff		(p_rec->qos_class_sl & CL_HTON16(IB_MULTIPATH_REC_QOS_CLASS_MASK)) |
6126219820Sjeff			cl_hton16(sl & IB_MULTIPATH_REC_SL_MASK);
6127219820Sjeff}
6128219820Sjeff/*
6129219820Sjeff* PARAMETERS
6130219820Sjeff*	p_rec
6131219820Sjeff*		[in] Pointer to the MultiPath record object.
6132219820Sjeff*
6133219820Sjeff*	sl
6134219820Sjeff*		[in] Service level to set.
6135219820Sjeff*
6136219820Sjeff* RETURN VALUES
6137219820Sjeff*	None
6138219820Sjeff*
6139219820Sjeff* NOTES
6140219820Sjeff*
6141219820Sjeff* SEE ALSO
6142219820Sjeff*	ib_multipath_rec_t
6143219820Sjeff*********/
6144219820Sjeff
6145219820Sjeff/****f* IBA Base: Types/ib_multipath_rec_sl
6146219820Sjeff* NAME
6147219820Sjeff*       ib_multipath_rec_sl
6148219820Sjeff*
6149219820Sjeff* DESCRIPTION
6150219820Sjeff*       Get multipath service level.
6151219820Sjeff*
6152219820Sjeff* SYNOPSIS
6153219820Sjeff*/
6154219820Sjeffstatic inline uint8_t OSM_API
6155219820Sjeffib_multipath_rec_sl(IN const ib_multipath_rec_t * const p_rec)
6156219820Sjeff{
6157219820Sjeff	return ((uint8_t) ((cl_ntoh16(p_rec->qos_class_sl)) & IB_MULTIPATH_REC_SL_MASK));
6158219820Sjeff}
6159219820Sjeff
6160219820Sjeff/*
6161219820Sjeff* PARAMETERS
6162219820Sjeff*       p_rec
6163219820Sjeff*               [in] Pointer to the multipath record object.
6164219820Sjeff*
6165219820Sjeff* RETURN VALUES
6166219820Sjeff*	SL.
6167219820Sjeff*
6168219820Sjeff* NOTES
6169219820Sjeff*
6170219820Sjeff* SEE ALSO
6171219820Sjeff*       ib_multipath_rec_t
6172219820Sjeff*********/
6173219820Sjeff
6174219820Sjeff/****f* IBA Base: Types/ib_multipath_rec_set_qos_class
6175219820Sjeff* NAME
6176219820Sjeff*	ib_multipath_rec_set_qos_class
6177219820Sjeff*
6178219820Sjeff* DESCRIPTION
6179219820Sjeff*	Set path QoS class.
6180219820Sjeff*
6181219820Sjeff* SYNOPSIS
6182219820Sjeff*/
6183219820Sjeffstatic inline void	OSM_API
6184219820Sjeffib_multipath_rec_set_qos_class(
6185219820Sjeff	IN ib_multipath_rec_t* const p_rec,
6186219820Sjeff	IN const uint16_t qos_class )
6187219820Sjeff{
6188219820Sjeff	p_rec->qos_class_sl =
6189219820Sjeff		(p_rec->qos_class_sl & CL_HTON16(IB_MULTIPATH_REC_SL_MASK)) |
6190219820Sjeff			cl_hton16(qos_class << 4);
6191219820Sjeff}
6192219820Sjeff/*
6193219820Sjeff* PARAMETERS
6194219820Sjeff*	p_rec
6195219820Sjeff*		[in] Pointer to the MultiPath record object.
6196219820Sjeff*
6197219820Sjeff*	qos_class
6198219820Sjeff*		[in] QoS class to set.
6199219820Sjeff*
6200219820Sjeff* RETURN VALUES
6201219820Sjeff*	None
6202219820Sjeff*
6203219820Sjeff* NOTES
6204219820Sjeff*
6205219820Sjeff* SEE ALSO
6206219820Sjeff*	ib_multipath_rec_t
6207219820Sjeff*********/
6208219820Sjeff
6209219820Sjeff/****f* IBA Base: Types/ib_multipath_rec_qos_class
6210219820Sjeff* NAME
6211219820Sjeff*	ib_multipath_rec_qos_class
6212219820Sjeff*
6213219820Sjeff* DESCRIPTION
6214219820Sjeff*	Get QoS class.
6215219820Sjeff*
6216219820Sjeff* SYNOPSIS
6217219820Sjeff*/
6218219820Sjeffstatic inline uint16_t	OSM_API
6219219820Sjeffib_multipath_rec_qos_class(
6220219820Sjeff	IN	const	ib_multipath_rec_t* const	p_rec )
6221219820Sjeff{
6222219820Sjeff	return (cl_ntoh16( p_rec->qos_class_sl ) >> 4);
6223219820Sjeff}
6224219820Sjeff/*
6225219820Sjeff* PARAMETERS
6226219820Sjeff*	p_rec
6227219820Sjeff*		[in] Pointer to the MultiPath record object.
6228219820Sjeff*
6229219820Sjeff* RETURN VALUES
6230219820Sjeff*	QoS class of the MultiPath record.
6231219820Sjeff*
6232219820Sjeff* NOTES
6233219820Sjeff*
6234219820Sjeff* SEE ALSO
6235219820Sjeff*	ib_multipath_rec_t
6236219820Sjeff*********/
6237219820Sjeff
6238219820Sjeff/****f* IBA Base: Types/ib_multipath_rec_mtu
6239219820Sjeff* NAME
6240219820Sjeff*       ib_multipath_rec_mtu
6241219820Sjeff*
6242219820Sjeff* DESCRIPTION
6243219820Sjeff*       Get encoded path MTU.
6244219820Sjeff*
6245219820Sjeff* SYNOPSIS
6246219820Sjeff*/
6247219820Sjeffstatic inline uint8_t OSM_API
6248219820Sjeffib_multipath_rec_mtu(IN const ib_multipath_rec_t * const p_rec)
6249219820Sjeff{
6250219820Sjeff	return ((uint8_t) (p_rec->mtu & IB_MULTIPATH_REC_BASE_MASK));
6251219820Sjeff}
6252219820Sjeff
6253219820Sjeff/*
6254219820Sjeff* PARAMETERS
6255219820Sjeff*       p_rec
6256219820Sjeff*               [in] Pointer to the multipath record object.
6257219820Sjeff*
6258219820Sjeff* RETURN VALUES
6259219820Sjeff*       Encoded path MTU.
6260219820Sjeff*               1: 256
6261219820Sjeff*               2: 512
6262219820Sjeff*               3: 1024
6263219820Sjeff*               4: 2048
6264219820Sjeff*               5: 4096
6265219820Sjeff*               others: reserved
6266219820Sjeff*
6267219820Sjeff* NOTES
6268219820Sjeff*
6269219820Sjeff* SEE ALSO
6270219820Sjeff*       ib_multipath_rec_t
6271219820Sjeff*********/
6272219820Sjeff
6273219820Sjeff/****f* IBA Base: Types/ib_multipath_rec_mtu_sel
6274219820Sjeff* NAME
6275219820Sjeff*       ib_multipath_rec_mtu_sel
6276219820Sjeff*
6277219820Sjeff* DESCRIPTION
6278219820Sjeff*       Get encoded multipath MTU selector.
6279219820Sjeff*
6280219820Sjeff* SYNOPSIS
6281219820Sjeff*/
6282219820Sjeffstatic inline uint8_t OSM_API
6283219820Sjeffib_multipath_rec_mtu_sel(IN const ib_multipath_rec_t * const p_rec)
6284219820Sjeff{
6285219820Sjeff	return ((uint8_t) ((p_rec->mtu & IB_MULTIPATH_REC_SELECTOR_MASK) >> 6));
6286219820Sjeff}
6287219820Sjeff
6288219820Sjeff/*
6289219820Sjeff* PARAMETERS
6290219820Sjeff*       p_rec
6291219820Sjeff*               [in] Pointer to the multipath record object.
6292219820Sjeff*
6293219820Sjeff* RETURN VALUES
6294219820Sjeff*       Encoded path MTU selector value (for queries).
6295219820Sjeff*               0: greater than MTU specified
6296219820Sjeff*               1: less than MTU specified
6297219820Sjeff*               2: exactly the MTU specified
6298219820Sjeff*               3: largest MTU available
6299219820Sjeff*
6300219820Sjeff* NOTES
6301219820Sjeff*
6302219820Sjeff* SEE ALSO
6303219820Sjeff*       ib_multipath_rec_t
6304219820Sjeff*********/
6305219820Sjeff
6306219820Sjeff/****f* IBA Base: Types/ib_multipath_rec_rate
6307219820Sjeff* NAME
6308219820Sjeff*       ib_multipath_rec_rate
6309219820Sjeff*
6310219820Sjeff* DESCRIPTION
6311219820Sjeff*       Get encoded multipath rate.
6312219820Sjeff*
6313219820Sjeff* SYNOPSIS
6314219820Sjeff*/
6315219820Sjeffstatic inline uint8_t OSM_API
6316219820Sjeffib_multipath_rec_rate(IN const ib_multipath_rec_t * const p_rec)
6317219820Sjeff{
6318219820Sjeff	return ((uint8_t) (p_rec->rate & IB_MULTIPATH_REC_BASE_MASK));
6319219820Sjeff}
6320219820Sjeff
6321219820Sjeff/*
6322219820Sjeff* PARAMETERS
6323219820Sjeff*       p_rec
6324219820Sjeff*               [in] Pointer to the multipath record object.
6325219820Sjeff*
6326219820Sjeff* RETURN VALUES
6327219820Sjeff*       Encoded multipath rate.
6328219820Sjeff*               2: 2.5 Gb/sec.
6329219820Sjeff*               3: 10 Gb/sec.
6330219820Sjeff*               4: 30 Gb/sec.
6331219820Sjeff*               others: reserved
6332219820Sjeff*
6333219820Sjeff* NOTES
6334219820Sjeff*
6335219820Sjeff* SEE ALSO
6336219820Sjeff*       ib_multipath_rec_t
6337219820Sjeff*********/
6338219820Sjeff
6339219820Sjeff/****f* IBA Base: Types/ib_multipath_rec_rate_sel
6340219820Sjeff* NAME
6341219820Sjeff*       ib_multipath_rec_rate_sel
6342219820Sjeff*
6343219820Sjeff* DESCRIPTION
6344219820Sjeff*       Get encoded multipath rate selector.
6345219820Sjeff*
6346219820Sjeff* SYNOPSIS
6347219820Sjeff*/
6348219820Sjeffstatic inline uint8_t OSM_API
6349219820Sjeffib_multipath_rec_rate_sel(IN const ib_multipath_rec_t * const p_rec)
6350219820Sjeff{
6351219820Sjeff	return ((uint8_t)
6352219820Sjeff		((p_rec->rate & IB_MULTIPATH_REC_SELECTOR_MASK) >> 6));
6353219820Sjeff}
6354219820Sjeff
6355219820Sjeff/*
6356219820Sjeff* PARAMETERS
6357219820Sjeff*       p_rec
6358219820Sjeff*               [in] Pointer to the multipath record object.
6359219820Sjeff*
6360219820Sjeff* RETURN VALUES
6361219820Sjeff*       Encoded path rate selector value (for queries).
6362219820Sjeff*               0: greater than rate specified
6363219820Sjeff*               1: less than rate specified
6364219820Sjeff*               2: exactly the rate specified
6365219820Sjeff*               3: largest rate available
6366219820Sjeff*
6367219820Sjeff* NOTES
6368219820Sjeff*
6369219820Sjeff* SEE ALSO
6370219820Sjeff*       ib_multipath_rec_t
6371219820Sjeff*********/
6372219820Sjeff
6373219820Sjeff/****f* IBA Base: Types/ib_multipath_rec_pkt_life
6374219820Sjeff* NAME
6375219820Sjeff*       ib_multipath_rec_pkt_life
6376219820Sjeff*
6377219820Sjeff* DESCRIPTION
6378219820Sjeff*       Get encoded multipath pkt_life.
6379219820Sjeff*
6380219820Sjeff* SYNOPSIS
6381219820Sjeff*/
6382219820Sjeffstatic inline uint8_t OSM_API
6383219820Sjeffib_multipath_rec_pkt_life(IN const ib_multipath_rec_t * const p_rec)
6384219820Sjeff{
6385219820Sjeff	return ((uint8_t) (p_rec->pkt_life & IB_MULTIPATH_REC_BASE_MASK));
6386219820Sjeff}
6387219820Sjeff
6388219820Sjeff/*
6389219820Sjeff* PARAMETERS
6390219820Sjeff*       p_rec
6391219820Sjeff*               [in] Pointer to the multipath record object.
6392219820Sjeff*
6393219820Sjeff* RETURN VALUES
6394219820Sjeff*       Encoded multipath pkt_life = 4.096 usec * 2 ** PacketLifeTime.
6395219820Sjeff*
6396219820Sjeff* NOTES
6397219820Sjeff*
6398219820Sjeff* SEE ALSO
6399219820Sjeff*       ib_multipath_rec_t
6400219820Sjeff*********/
6401219820Sjeff
6402219820Sjeff/****f* IBA Base: Types/ib_multipath_rec_pkt_life_sel
6403219820Sjeff* NAME
6404219820Sjeff*       ib_multipath_rec_pkt_life_sel
6405219820Sjeff*
6406219820Sjeff* DESCRIPTION
6407219820Sjeff*       Get encoded multipath pkt_lifetime selector.
6408219820Sjeff*
6409219820Sjeff* SYNOPSIS
6410219820Sjeff*/
6411219820Sjeffstatic inline uint8_t OSM_API
6412219820Sjeffib_multipath_rec_pkt_life_sel(IN const ib_multipath_rec_t * const p_rec)
6413219820Sjeff{
6414219820Sjeff	return ((uint8_t)
6415219820Sjeff		((p_rec->pkt_life & IB_MULTIPATH_REC_SELECTOR_MASK) >> 6));
6416219820Sjeff}
6417219820Sjeff
6418219820Sjeff/*
6419219820Sjeff* PARAMETERS
6420219820Sjeff*       p_rec
6421219820Sjeff*               [in] Pointer to the multipath record object.
6422219820Sjeff*
6423219820Sjeff* RETURN VALUES
6424219820Sjeff*       Encoded path pkt_lifetime selector value (for queries).
6425219820Sjeff*               0: greater than rate specified
6426219820Sjeff*               1: less than rate specified
6427219820Sjeff*               2: exactly the rate specified
6428219820Sjeff*               3: smallest packet lifetime available
6429219820Sjeff*
6430219820Sjeff* NOTES
6431219820Sjeff*
6432219820Sjeff* SEE ALSO
6433219820Sjeff*       ib_multipath_rec_t
6434219820Sjeff*********/
6435219820Sjeff
6436219820Sjeff/****f* IBA Base: Types/ib_multipath_rec_service_id
6437219820Sjeff* NAME
6438219820Sjeff*	ib_multipath_rec_service_id
6439219820Sjeff*
6440219820Sjeff* DESCRIPTION
6441219820Sjeff*	Get multipath service id.
6442219820Sjeff*
6443219820Sjeff* SYNOPSIS
6444219820Sjeff*/
6445219820Sjeffstatic inline ib_net64_t OSM_API
6446219820Sjeffib_multipath_rec_service_id(IN const ib_multipath_rec_t * const p_rec)
6447219820Sjeff{
6448219820Sjeff	union {
6449219820Sjeff		ib_net64_t sid;
6450219820Sjeff		uint8_t sid_arr[8];
6451219820Sjeff	} sid_union;
6452219820Sjeff	sid_union.sid_arr[0] = p_rec->service_id_8msb;
6453219820Sjeff	memcpy(&sid_union.sid_arr[1], p_rec->service_id_56lsb, 7);
6454219820Sjeff	return sid_union.sid;
6455219820Sjeff}
6456219820Sjeff
6457219820Sjeff/*
6458219820Sjeff* PARAMETERS
6459219820Sjeff*	p_rec
6460219820Sjeff*		[in] Pointer to the multipath record object.
6461219820Sjeff*
6462219820Sjeff* RETURN VALUES
6463219820Sjeff*	Service ID
6464219820Sjeff*
6465219820Sjeff* NOTES
6466219820Sjeff*
6467219820Sjeff* SEE ALSO
6468219820Sjeff*	ib_multipath_rec_t
6469219820Sjeff*********/
6470219820Sjeff
6471219820Sjeff#define IB_NUM_PKEY_ELEMENTS_IN_BLOCK		32
6472219820Sjeff/****s* IBA Base: Types/ib_pkey_table_t
6473219820Sjeff* NAME
6474219820Sjeff*	ib_pkey_table_t
6475219820Sjeff*
6476219820Sjeff* DESCRIPTION
6477219820Sjeff*	IBA defined PKey table. (14.2.5.7)
6478219820Sjeff*
6479219820Sjeff* SYNOPSIS
6480219820Sjeff*/
6481219820Sjeff
6482219820Sjeff#include <complib/cl_packon.h>
6483219820Sjefftypedef struct _ib_pkey_table {
6484219820Sjeff	ib_net16_t pkey_entry[IB_NUM_PKEY_ELEMENTS_IN_BLOCK];
6485219820Sjeff
6486219820Sjeff} PACK_SUFFIX ib_pkey_table_t;
6487219820Sjeff#include <complib/cl_packoff.h>
6488219820Sjeff/************/
6489219820Sjeff
6490219820Sjeff/****s* IBA Base: Types/ib_pkey_table_record_t
6491219820Sjeff* NAME
6492219820Sjeff*	ib_pkey_table_record_t
6493219820Sjeff*
6494219820Sjeff* DESCRIPTION
6495219820Sjeff*	IBA defined P_Key Table Record for SA Query. (15.2.5.11)
6496219820Sjeff*
6497219820Sjeff* SYNOPSIS
6498219820Sjeff*/
6499219820Sjeff#include <complib/cl_packon.h>
6500219820Sjefftypedef struct _ib_pkey_table_record {
6501219820Sjeff	ib_net16_t lid;		// for CA: lid of port, for switch lid of port 0
6502219820Sjeff	uint16_t block_num;
6503219820Sjeff	uint8_t port_num;	// for switch: port number, for CA: reserved
6504219820Sjeff	uint8_t reserved1;
6505219820Sjeff	uint16_t reserved2;
6506219820Sjeff	ib_pkey_table_t pkey_tbl;
6507219820Sjeff
6508219820Sjeff} PACK_SUFFIX ib_pkey_table_record_t;
6509219820Sjeff#include <complib/cl_packoff.h>
6510219820Sjeff/************/
6511219820Sjeff
6512219820Sjeff#define IB_DROP_VL 15
6513219820Sjeff#define IB_MAX_NUM_VLS 16
6514219820Sjeff/****s* IBA Base: Types/ib_slvl_table_t
6515219820Sjeff* NAME
6516219820Sjeff*	ib_slvl_table_t
6517219820Sjeff*
6518219820Sjeff* DESCRIPTION
6519219820Sjeff*	IBA defined SL2VL Mapping Table Attribute. (14.2.5.8)
6520219820Sjeff*
6521219820Sjeff* SYNOPSIS
6522219820Sjeff*/
6523219820Sjeff#include <complib/cl_packon.h>
6524219820Sjefftypedef struct _ib_slvl_table {
6525219820Sjeff	uint8_t raw_vl_by_sl[IB_MAX_NUM_VLS / 2];
6526219820Sjeff} PACK_SUFFIX ib_slvl_table_t;
6527219820Sjeff#include <complib/cl_packoff.h>
6528219820Sjeff/************/
6529219820Sjeff
6530219820Sjeff/****s* IBA Base: Types/ib_slvl_table_record_t
6531219820Sjeff* NAME
6532219820Sjeff*	ib_slvl_table_record_t
6533219820Sjeff*
6534219820Sjeff* DESCRIPTION
6535219820Sjeff*	IBA defined SL to VL Mapping Table Record for SA Query. (15.2.5.4)
6536219820Sjeff*
6537219820Sjeff* SYNOPSIS
6538219820Sjeff*/
6539219820Sjeff#include <complib/cl_packon.h>
6540219820Sjefftypedef struct _ib_slvl_table_record {
6541219820Sjeff	ib_net16_t lid;		// for CA: lid of port, for switch lid of port 0
6542219820Sjeff	uint8_t in_port_num;	// reserved for CAs
6543219820Sjeff	uint8_t out_port_num;	// reserved for CAs
6544219820Sjeff	uint32_t resv;
6545219820Sjeff	ib_slvl_table_t slvl_tbl;
6546219820Sjeff
6547219820Sjeff} PACK_SUFFIX ib_slvl_table_record_t;
6548219820Sjeff#include <complib/cl_packoff.h>
6549219820Sjeff/************/
6550219820Sjeff
6551219820Sjeff/****f* IBA Base: Types/ib_slvl_table_set
6552219820Sjeff* NAME
6553219820Sjeff*	ib_slvl_table_set
6554219820Sjeff*
6555219820Sjeff* DESCRIPTION
6556219820Sjeff*	Set slvl table entry.
6557219820Sjeff*
6558219820Sjeff* SYNOPSIS
6559219820Sjeff*/
6560219820Sjeffstatic inline void OSM_API
6561219820Sjeffib_slvl_table_set(IN ib_slvl_table_t * p_slvl_tbl,
6562219820Sjeff		  IN uint8_t sl_index, IN uint8_t vl)
6563219820Sjeff{
6564219820Sjeff	uint8_t idx = sl_index / 2;
6565219820Sjeff	CL_ASSERT(vl <= 15);
6566219820Sjeff	CL_ASSERT(sl_index <= 15);
6567219820Sjeff
6568219820Sjeff	if (sl_index % 2) {
6569219820Sjeff		/* this is an odd sl. Need to update the ls bits */
6570219820Sjeff		p_slvl_tbl->raw_vl_by_sl[idx] =
6571219820Sjeff		    (p_slvl_tbl->raw_vl_by_sl[idx] & 0xF0) | vl;
6572219820Sjeff	} else {
6573219820Sjeff		/* this is an even sl. Need to update the ms bits */
6574219820Sjeff		p_slvl_tbl->raw_vl_by_sl[idx] =
6575219820Sjeff		    (vl << 4) | (p_slvl_tbl->raw_vl_by_sl[idx] & 0x0F);
6576219820Sjeff	}
6577219820Sjeff}
6578219820Sjeff
6579219820Sjeff/*
6580219820Sjeff* PARAMETERS
6581219820Sjeff*	p_slvl_tbl
6582219820Sjeff*		[in] pointer to ib_slvl_table_t object.
6583219820Sjeff*
6584219820Sjeff*	sl_index
6585219820Sjeff*		[in] the sl index in the table to be updated.
6586219820Sjeff*
6587219820Sjeff*	vl
6588219820Sjeff*		[in] the vl value to update for that sl.
6589219820Sjeff*
6590219820Sjeff* RETURN VALUES
6591219820Sjeff*	None
6592219820Sjeff*
6593219820Sjeff* NOTES
6594219820Sjeff*
6595219820Sjeff* SEE ALSO
6596219820Sjeff*	ib_slvl_table_t
6597219820Sjeff*********/
6598219820Sjeff
6599219820Sjeff/****f* IBA Base: Types/ib_slvl_table_get
6600219820Sjeff* NAME
6601219820Sjeff*	ib_slvl_table_get
6602219820Sjeff*
6603219820Sjeff* DESCRIPTION
6604219820Sjeff*	Get slvl table entry.
6605219820Sjeff*
6606219820Sjeff* SYNOPSIS
6607219820Sjeff*/
6608219820Sjeffstatic inline uint8_t OSM_API
6609219820Sjeffib_slvl_table_get(IN const ib_slvl_table_t * p_slvl_tbl, IN uint8_t sl_index)
6610219820Sjeff{
6611219820Sjeff	uint8_t idx = sl_index / 2;
6612219820Sjeff	CL_ASSERT(sl_index <= 15);
6613219820Sjeff
6614219820Sjeff	if (sl_index % 2) {
6615219820Sjeff		/* this is an odd sl. Need to return the ls bits. */
6616219820Sjeff		return (p_slvl_tbl->raw_vl_by_sl[idx] & 0x0F);
6617219820Sjeff	} else {
6618219820Sjeff		/* this is an even sl. Need to return the ms bits. */
6619219820Sjeff		return ((p_slvl_tbl->raw_vl_by_sl[idx] & 0xF0) >> 4);
6620219820Sjeff	}
6621219820Sjeff}
6622219820Sjeff
6623219820Sjeff/*
6624219820Sjeff* PARAMETERS
6625219820Sjeff*	p_slvl_tbl
6626219820Sjeff*		[in] pointer to ib_slvl_table_t object.
6627219820Sjeff*
6628219820Sjeff*	sl_index
6629219820Sjeff*		[in] the sl index in the table whose value should be returned.
6630219820Sjeff*
6631219820Sjeff* RETURN VALUES
6632219820Sjeff*	vl for the requested sl_index.
6633219820Sjeff*
6634219820Sjeff* NOTES
6635219820Sjeff*
6636219820Sjeff* SEE ALSO
6637219820Sjeff*	ib_slvl_table_t
6638219820Sjeff*********/
6639219820Sjeff
6640219820Sjeff/****s* IBA Base: Types/ib_vl_arb_element_t
6641219820Sjeff* NAME
6642219820Sjeff*	ib_vl_arb_element_t
6643219820Sjeff*
6644219820Sjeff* DESCRIPTION
6645219820Sjeff*	IBA defined VL Arbitration Table Element. (14.2.5.9)
6646219820Sjeff*
6647219820Sjeff* SYNOPSIS
6648219820Sjeff*/
6649219820Sjeff#include <complib/cl_packon.h>
6650219820Sjefftypedef struct _ib_vl_arb_element {
6651219820Sjeff	uint8_t vl;
6652219820Sjeff	uint8_t weight;
6653219820Sjeff} PACK_SUFFIX ib_vl_arb_element_t;
6654219820Sjeff#include <complib/cl_packoff.h>
6655219820Sjeff/************/
6656219820Sjeff
6657219820Sjeff#define IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK 32
6658219820Sjeff
6659219820Sjeff/****s* IBA Base: Types/ib_vl_arb_table_t
6660219820Sjeff* NAME
6661219820Sjeff*	ib_vl_arb_table_t
6662219820Sjeff*
6663219820Sjeff* DESCRIPTION
6664219820Sjeff*	IBA defined VL Arbitration Table. (14.2.5.9)
6665219820Sjeff*
6666219820Sjeff* SYNOPSIS
6667219820Sjeff*/
6668219820Sjeff#include <complib/cl_packon.h>
6669219820Sjefftypedef struct _ib_vl_arb_table {
6670219820Sjeff	ib_vl_arb_element_t vl_entry[IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK];
6671219820Sjeff} PACK_SUFFIX ib_vl_arb_table_t;
6672219820Sjeff#include <complib/cl_packoff.h>
6673219820Sjeff/************/
6674219820Sjeff
6675219820Sjeff/****s* IBA Base: Types/ib_vl_arb_table_record_t
6676219820Sjeff* NAME
6677219820Sjeff*	ib_vl_arb_table_record_t
6678219820Sjeff*
6679219820Sjeff* DESCRIPTION
6680219820Sjeff*	IBA defined VL Arbitration Table Record for SA Query. (15.2.5.9)
6681219820Sjeff*
6682219820Sjeff* SYNOPSIS
6683219820Sjeff*/
6684219820Sjeff#include <complib/cl_packon.h>
6685219820Sjefftypedef struct _ib_vl_arb_table_record {
6686219820Sjeff	ib_net16_t lid;		// for CA: lid of port, for switch lid of port 0
6687219820Sjeff	uint8_t port_num;
6688219820Sjeff	uint8_t block_num;
6689219820Sjeff	uint32_t reserved;
6690219820Sjeff	ib_vl_arb_table_t vl_arb_tbl;
6691219820Sjeff} PACK_SUFFIX ib_vl_arb_table_record_t;
6692219820Sjeff#include <complib/cl_packoff.h>
6693219820Sjeff/************/
6694219820Sjeff
6695219820Sjeff/*
6696219820Sjeff *	Global route header information received with unreliable datagram messages
6697219820Sjeff */
6698219820Sjeff#include <complib/cl_packon.h>
6699219820Sjefftypedef struct _ib_grh {
6700219820Sjeff	ib_net32_t ver_class_flow;
6701219820Sjeff	ib_net16_t resv1;
6702219820Sjeff	uint8_t resv2;
6703219820Sjeff	uint8_t hop_limit;
6704219820Sjeff	ib_gid_t src_gid;
6705219820Sjeff	ib_gid_t dest_gid;
6706219820Sjeff} PACK_SUFFIX ib_grh_t;
6707219820Sjeff#include <complib/cl_packoff.h>
6708219820Sjeff
6709219820Sjeff/****f* IBA Base: Types/ib_grh_get_ver_class_flow
6710219820Sjeff* NAME
6711219820Sjeff*	ib_grh_get_ver_class_flow
6712219820Sjeff*
6713219820Sjeff* DESCRIPTION
6714219820Sjeff*	Get encoded version, traffic class and flow label in grh
6715219820Sjeff*
6716219820Sjeff* SYNOPSIS
6717219820Sjeff*/
6718219820Sjeffstatic inline void OSM_API
6719219820Sjeffib_grh_get_ver_class_flow(IN const ib_net32_t ver_class_flow,
6720219820Sjeff			  OUT uint8_t * const p_ver,
6721219820Sjeff			  OUT uint8_t * const p_tclass,
6722219820Sjeff			  OUT uint32_t * const p_flow_lbl)
6723219820Sjeff{
6724219820Sjeff	ib_net32_t tmp_ver_class_flow;
6725219820Sjeff
6726219820Sjeff	if (p_ver)
6727219820Sjeff		*p_ver = (uint8_t) (ver_class_flow & 0x0f);
6728219820Sjeff
6729219820Sjeff	tmp_ver_class_flow = ver_class_flow >> 4;
6730219820Sjeff
6731219820Sjeff	if (p_tclass)
6732219820Sjeff		*p_tclass = (uint8_t) (tmp_ver_class_flow & 0xff);
6733219820Sjeff
6734219820Sjeff	tmp_ver_class_flow = tmp_ver_class_flow >> 8;
6735219820Sjeff
6736219820Sjeff	if (p_flow_lbl)
6737219820Sjeff		*p_flow_lbl = tmp_ver_class_flow & 0xfffff;
6738219820Sjeff}
6739219820Sjeff
6740219820Sjeff/*
6741219820Sjeff* PARAMETERS
6742219820Sjeff*	ver_class_flow
6743219820Sjeff*		[in] the version, traffic class and flow label info.
6744219820Sjeff*
6745219820Sjeff* RETURN VALUES
6746219820Sjeff*	p_ver
6747219820Sjeff*		[out] pointer to the version info.
6748219820Sjeff*
6749219820Sjeff*	p_tclass
6750219820Sjeff*		[out] pointer to the traffic class info.
6751219820Sjeff*
6752219820Sjeff*	p_flow_lbl
6753219820Sjeff*		[out] pointer to the flow label info
6754219820Sjeff*
6755219820Sjeff* NOTES
6756219820Sjeff*
6757219820Sjeff* SEE ALSO
6758219820Sjeff*	ib_grh_t
6759219820Sjeff*********/
6760219820Sjeff
6761219820Sjeff/****f* IBA Base: Types/ib_grh_set_ver_class_flow
6762219820Sjeff* NAME
6763219820Sjeff*	ib_grh_set_ver_class_flow
6764219820Sjeff*
6765219820Sjeff* DESCRIPTION
6766219820Sjeff*	Set encoded version, traffic class and flow label in grh
6767219820Sjeff*
6768219820Sjeff* SYNOPSIS
6769219820Sjeff*/
6770219820Sjeffstatic inline ib_net32_t OSM_API
6771219820Sjeffib_grh_set_ver_class_flow(IN const uint8_t ver,
6772219820Sjeff			  IN const uint8_t tclass, IN const uint32_t flow_lbl)
6773219820Sjeff{
6774219820Sjeff	ib_net32_t ver_class_flow;
6775219820Sjeff
6776219820Sjeff	ver_class_flow = flow_lbl;
6777219820Sjeff	ver_class_flow = ver_class_flow << 8;
6778219820Sjeff	ver_class_flow = ver_class_flow | tclass;
6779219820Sjeff	ver_class_flow = ver_class_flow << 4;
6780219820Sjeff	ver_class_flow = ver_class_flow | ver;
6781219820Sjeff	return (ver_class_flow);
6782219820Sjeff}
6783219820Sjeff
6784219820Sjeff/*
6785219820Sjeff* PARAMETERS
6786219820Sjeff*	ver
6787219820Sjeff*		[in] the version info.
6788219820Sjeff*
6789219820Sjeff*	tclass
6790219820Sjeff*		[in] the traffic class info.
6791219820Sjeff*
6792219820Sjeff*	flow_lbl
6793219820Sjeff*		[in] the flow label info
6794219820Sjeff*
6795219820Sjeff* RETURN VALUES
6796219820Sjeff*	ver_class_flow
6797219820Sjeff*		[out] the version, traffic class and flow label info.
6798219820Sjeff*
6799219820Sjeff* NOTES
6800219820Sjeff*
6801219820Sjeff* SEE ALSO
6802219820Sjeff*	ib_grh_t
6803219820Sjeff*********/
6804219820Sjeff
6805219820Sjeff/****s* IBA Base: Types/ib_member_rec_t
6806219820Sjeff* NAME
6807219820Sjeff*	ib_member_rec_t
6808219820Sjeff*
6809219820Sjeff* DESCRIPTION
6810219820Sjeff*	Multicast member record, used to create, join, and leave multicast
6811219820Sjeff*	groups.
6812219820Sjeff*
6813219820Sjeff* SYNOPSIS
6814219820Sjeff*/
6815219820Sjeff#include <complib/cl_packon.h>
6816219820Sjefftypedef struct _ib_member_rec {
6817219820Sjeff	ib_gid_t mgid;
6818219820Sjeff	ib_gid_t port_gid;
6819219820Sjeff	ib_net32_t qkey;
6820219820Sjeff	ib_net16_t mlid;
6821219820Sjeff	uint8_t mtu;
6822219820Sjeff	uint8_t tclass;
6823219820Sjeff	ib_net16_t pkey;
6824219820Sjeff	uint8_t rate;
6825219820Sjeff	uint8_t pkt_life;
6826219820Sjeff	ib_net32_t sl_flow_hop;
6827219820Sjeff	uint8_t scope_state;
6828219820Sjeff	uint8_t proxy_join:1;
6829219820Sjeff	uint8_t reserved[2];
6830219820Sjeff	uint8_t pad[4];
6831219820Sjeff
6832219820Sjeff} PACK_SUFFIX ib_member_rec_t;
6833219820Sjeff#include <complib/cl_packoff.h>
6834219820Sjeff/*
6835219820Sjeff* FIELDS
6836219820Sjeff*	mgid
6837219820Sjeff*		Multicast GID address for this multicast group.
6838219820Sjeff*
6839219820Sjeff*	port_gid
6840219820Sjeff*		Valid GID of the endpoint joining this multicast group.
6841219820Sjeff*
6842219820Sjeff*	qkey
6843219820Sjeff*		Q_Key to be sued by this multicast group.
6844219820Sjeff*
6845219820Sjeff*	mlid
6846219820Sjeff*		Multicast LID for this multicast group.
6847219820Sjeff*
6848219820Sjeff*	mtu
6849219820Sjeff*		MTU and MTU selector fields to use on this path
6850219820Sjeff*
6851219820Sjeff*	tclass
6852219820Sjeff*		Another global routing parameter.
6853219820Sjeff*
6854219820Sjeff*	pkey
6855219820Sjeff*		Partition key (P_Key) to use for this member.
6856219820Sjeff*
6857219820Sjeff*	rate
6858219820Sjeff*		Rate and rate selector fields to use on this path.
6859219820Sjeff*
6860219820Sjeff*	pkt_life
6861219820Sjeff*		Packet lifetime
6862219820Sjeff*
6863219820Sjeff*	sl_flow_hop
6864219820Sjeff*		Global routing parameters: service level, hop count, and flow label.
6865219820Sjeff*
6866219820Sjeff*	scope_state
6867219820Sjeff*		MGID scope and JoinState of multicast request.
6868219820Sjeff*
6869219820Sjeff*	proxy_join
6870219820Sjeff*		Enables others in the Partition to proxy add/remove from the group
6871219820Sjeff*
6872219820Sjeff* SEE ALSO
6873219820Sjeff*********/
6874219820Sjeff
6875219820Sjeff/****f* IBA Base: Types/ib_member_get_sl_flow_hop
6876219820Sjeff* NAME
6877219820Sjeff*	ib_member_get_sl_flow_hop
6878219820Sjeff*
6879219820Sjeff* DESCRIPTION
6880219820Sjeff*	Get encoded sl, flow label, and hop limit
6881219820Sjeff*
6882219820Sjeff* SYNOPSIS
6883219820Sjeff*/
6884219820Sjeffstatic inline void OSM_API
6885219820Sjeffib_member_get_sl_flow_hop(IN const ib_net32_t sl_flow_hop,
6886219820Sjeff			  OUT uint8_t * const p_sl,
6887219820Sjeff			  OUT uint32_t * const p_flow_lbl,
6888219820Sjeff			  OUT uint8_t * const p_hop)
6889219820Sjeff{
6890219820Sjeff	uint32_t tmp;
6891219820Sjeff
6892219820Sjeff	tmp = cl_ntoh32(sl_flow_hop);
6893219820Sjeff	if (p_hop)
6894219820Sjeff		*p_hop = (uint8_t) tmp;
6895219820Sjeff	tmp >>= 8;
6896219820Sjeff
6897219820Sjeff	if (p_flow_lbl)
6898219820Sjeff		*p_flow_lbl = (uint32_t) (tmp & 0xfffff);
6899219820Sjeff	tmp >>= 20;
6900219820Sjeff
6901219820Sjeff	if (p_sl)
6902219820Sjeff		*p_sl = (uint8_t) tmp;
6903219820Sjeff}
6904219820Sjeff
6905219820Sjeff/*
6906219820Sjeff* PARAMETERS
6907219820Sjeff*	sl_flow_hop
6908219820Sjeff*		[in] the sl, flow label, and hop limit of MC Group
6909219820Sjeff*
6910219820Sjeff* RETURN VALUES
6911219820Sjeff*	p_sl
6912219820Sjeff*		[out] pointer to the service level
6913219820Sjeff*
6914219820Sjeff*	p_flow_lbl
6915219820Sjeff*		[out] pointer to the flow label info
6916219820Sjeff*
6917219820Sjeff*	p_hop
6918219820Sjeff*		[out] pointer to the hop count limit.
6919219820Sjeff*
6920219820Sjeff* NOTES
6921219820Sjeff*
6922219820Sjeff* SEE ALSO
6923219820Sjeff*	ib_member_rec_t
6924219820Sjeff*********/
6925219820Sjeff
6926219820Sjeff/****f* IBA Base: Types/ib_member_set_sl_flow_hop
6927219820Sjeff* NAME
6928219820Sjeff*	ib_member_set_sl_flow_hop
6929219820Sjeff*
6930219820Sjeff* DESCRIPTION
6931219820Sjeff*	Set encoded sl, flow label, and hop limit
6932219820Sjeff*
6933219820Sjeff* SYNOPSIS
6934219820Sjeff*/
6935219820Sjeffstatic inline ib_net32_t OSM_API
6936219820Sjeffib_member_set_sl_flow_hop(IN const uint8_t sl,
6937219820Sjeff			  IN const uint32_t flow_label,
6938219820Sjeff			  IN const uint8_t hop_limit)
6939219820Sjeff{
6940219820Sjeff	uint32_t tmp;
6941219820Sjeff
6942219820Sjeff	tmp = (sl << 28) | ((flow_label & 0xfffff) << 8) | hop_limit;
6943219820Sjeff	return cl_hton32(tmp);
6944219820Sjeff}
6945219820Sjeff
6946219820Sjeff/*
6947219820Sjeff* PARAMETERS
6948219820Sjeff*	sl
6949219820Sjeff*		[in] the service level.
6950219820Sjeff*
6951219820Sjeff*	flow_lbl
6952219820Sjeff*		[in] the flow label info
6953219820Sjeff*
6954219820Sjeff*	hop_limit
6955219820Sjeff*		[in] the hop limit.
6956219820Sjeff*
6957219820Sjeff* RETURN VALUES
6958219820Sjeff*	sl_flow_hop
6959219820Sjeff*		[out] the encoded sl, flow label, and hop limit
6960219820Sjeff*
6961219820Sjeff* NOTES
6962219820Sjeff*
6963219820Sjeff* SEE ALSO
6964219820Sjeff*	ib_member_rec_t
6965219820Sjeff*********/
6966219820Sjeff
6967219820Sjeff/****f* IBA Base: Types/ib_member_get_scope_state
6968219820Sjeff* NAME
6969219820Sjeff*	ib_member_get_scope_state
6970219820Sjeff*
6971219820Sjeff* DESCRIPTION
6972219820Sjeff*	Get encoded MGID scope and JoinState
6973219820Sjeff*
6974219820Sjeff* SYNOPSIS
6975219820Sjeff*/
6976219820Sjeffstatic inline void OSM_API
6977219820Sjeffib_member_get_scope_state(IN const uint8_t scope_state,
6978219820Sjeff			  OUT uint8_t * const p_scope,
6979219820Sjeff			  OUT uint8_t * const p_state)
6980219820Sjeff{
6981219820Sjeff	uint8_t tmp_scope_state;
6982219820Sjeff
6983219820Sjeff	if (p_state)
6984219820Sjeff		*p_state = (uint8_t) (scope_state & 0x0f);
6985219820Sjeff
6986219820Sjeff	tmp_scope_state = scope_state >> 4;
6987219820Sjeff
6988219820Sjeff	if (p_scope)
6989219820Sjeff		*p_scope = (uint8_t) (tmp_scope_state & 0x0f);
6990219820Sjeff
6991219820Sjeff}
6992219820Sjeff
6993219820Sjeff/*
6994219820Sjeff* PARAMETERS
6995219820Sjeff*	scope_state
6996219820Sjeff*		[in] the scope and state
6997219820Sjeff*
6998219820Sjeff* RETURN VALUES
6999219820Sjeff*	p_scope
7000219820Sjeff*		[out] pointer to the MGID scope
7001219820Sjeff*
7002219820Sjeff*	p_state
7003219820Sjeff*		[out] pointer to the join state
7004219820Sjeff*
7005219820Sjeff* NOTES
7006219820Sjeff*
7007219820Sjeff* SEE ALSO
7008219820Sjeff*	ib_member_rec_t
7009219820Sjeff*********/
7010219820Sjeff
7011219820Sjeff/****f* IBA Base: Types/ib_member_set_scope_state
7012219820Sjeff* NAME
7013219820Sjeff*	ib_member_set_scope_state
7014219820Sjeff*
7015219820Sjeff* DESCRIPTION
7016219820Sjeff*	Set encoded version, MGID scope and JoinState
7017219820Sjeff*
7018219820Sjeff* SYNOPSIS
7019219820Sjeff*/
7020219820Sjeffstatic inline uint8_t OSM_API
7021219820Sjeffib_member_set_scope_state(IN const uint8_t scope, IN const uint8_t state)
7022219820Sjeff{
7023219820Sjeff	uint8_t scope_state;
7024219820Sjeff
7025219820Sjeff	scope_state = scope;
7026219820Sjeff	scope_state = scope_state << 4;
7027219820Sjeff	scope_state = scope_state | state;
7028219820Sjeff	return (scope_state);
7029219820Sjeff}
7030219820Sjeff
7031219820Sjeff/*
7032219820Sjeff* PARAMETERS
7033219820Sjeff*	scope
7034219820Sjeff*		[in] the MGID scope
7035219820Sjeff*
7036219820Sjeff*	state
7037219820Sjeff*		[in] the JoinState
7038219820Sjeff*
7039219820Sjeff* RETURN VALUES
7040219820Sjeff*	scope_state
7041219820Sjeff*		[out] the encoded one
7042219820Sjeff*
7043219820Sjeff* NOTES
7044219820Sjeff*
7045219820Sjeff* SEE ALSO
7046219820Sjeff*	ib_member_rec_t
7047219820Sjeff*********/
7048219820Sjeff
7049219820Sjeff/****f* IBA Base: Types/ib_member_set_join_state
7050219820Sjeff* NAME
7051219820Sjeff*	ib_member_set_join_state
7052219820Sjeff*
7053219820Sjeff* DESCRIPTION
7054219820Sjeff*	Set JoinState
7055219820Sjeff*
7056219820Sjeff* SYNOPSIS
7057219820Sjeff*/
7058219820Sjeffstatic inline void OSM_API
7059219820Sjeffib_member_set_join_state(IN OUT ib_member_rec_t * p_mc_rec,
7060219820Sjeff			 IN const uint8_t state)
7061219820Sjeff{
7062219820Sjeff	/* keep the scope as it is */
7063219820Sjeff	p_mc_rec->scope_state = (p_mc_rec->scope_state & 0xF0) | (0x0f & state);
7064219820Sjeff}
7065219820Sjeff
7066219820Sjeff/*
7067219820Sjeff* PARAMETERS
7068219820Sjeff*	p_mc_rec
7069219820Sjeff*		[in] pointer to the member record
7070219820Sjeff*
7071219820Sjeff*	state
7072219820Sjeff*		[in] the JoinState
7073219820Sjeff*
7074219820Sjeff* RETURN VALUES
7075219820Sjeff*	NONE
7076219820Sjeff*
7077219820Sjeff* NOTES
7078219820Sjeff*
7079219820Sjeff* SEE ALSO
7080219820Sjeff*	ib_member_rec_t
7081219820Sjeff*********/
7082219820Sjeff
7083219820Sjeff/*
7084219820Sjeff * Join State Codes:
7085219820Sjeff */
7086219820Sjeff#define IB_MC_REC_STATE_FULL_MEMBER 0x01
7087219820Sjeff#define IB_MC_REC_STATE_NON_MEMBER 0x02
7088219820Sjeff#define IB_MC_REC_STATE_SEND_ONLY_NON_MEMBER 0x04
7089219820Sjeff
7090219820Sjeff/*
7091219820Sjeff *	Generic MAD notice types
7092219820Sjeff */
7093219820Sjeff#define IB_NOTICE_TYPE_FATAL				0x00
7094219820Sjeff#define IB_NOTICE_TYPE_URGENT				0x01
7095219820Sjeff#define IB_NOTICE_TYPE_SECURITY				0x02
7096219820Sjeff#define IB_NOTICE_TYPE_SUBN_MGMT			0x03
7097219820Sjeff#define IB_NOTICE_TYPE_INFO				0x04
7098219820Sjeff#define IB_NOTICE_TYPE_EMPTY				0x7F
7099219820Sjeff
7100219820Sjeff#include <complib/cl_packon.h>
7101219820Sjefftypedef struct _ib_mad_notice_attr	// Total Size calc  Accumulated
7102219820Sjeff{
7103219820Sjeff	uint8_t generic_type;	// 1                1
7104219820Sjeff
7105219820Sjeff	union _notice_g_or_v {
7106219820Sjeff		struct _notice_generic	// 5                6
7107219820Sjeff		{
7108219820Sjeff			uint8_t prod_type_msb;
7109219820Sjeff			ib_net16_t prod_type_lsb;
7110219820Sjeff			ib_net16_t trap_num;
7111219820Sjeff		} PACK_SUFFIX generic;
7112219820Sjeff
7113219820Sjeff		struct _notice_vend {
7114219820Sjeff			uint8_t vend_id_msb;
7115219820Sjeff			ib_net16_t vend_id_lsb;
7116219820Sjeff			ib_net16_t dev_id;
7117219820Sjeff		} PACK_SUFFIX vend;
7118219820Sjeff	} g_or_v;
7119219820Sjeff
7120219820Sjeff	ib_net16_t issuer_lid;	// 2                 8
7121219820Sjeff	ib_net16_t toggle_count;	// 2                 10
7122219820Sjeff
7123219820Sjeff	union _data_details	// 54                64
7124219820Sjeff	{
7125219820Sjeff		struct _raw_data {
7126219820Sjeff			uint8_t details[54];
7127219820Sjeff		} PACK_SUFFIX raw_data;
7128219820Sjeff
7129219820Sjeff		struct _ntc_64_67 {
7130219820Sjeff			uint8_t res[6];
7131219820Sjeff			ib_gid_t gid;	// the Node or Multicast Group that came in/out
7132219820Sjeff		} PACK_SUFFIX ntc_64_67;
7133219820Sjeff
7134219820Sjeff		struct _ntc_128 {
7135219820Sjeff			ib_net16_t sw_lid;	// the sw lid of which link state changed
7136219820Sjeff		} PACK_SUFFIX ntc_128;
7137219820Sjeff
7138219820Sjeff		struct _ntc_129_131 {
7139219820Sjeff			ib_net16_t pad;
7140219820Sjeff			ib_net16_t lid;	// lid and port number of the violation
7141219820Sjeff			uint8_t port_num;
7142219820Sjeff		} PACK_SUFFIX ntc_129_131;
7143219820Sjeff
7144219820Sjeff		struct _ntc_144 {
7145219820Sjeff			ib_net16_t pad1;
7146219820Sjeff			ib_net16_t lid;             // lid where change occured
7147219820Sjeff			uint8_t    pad2;            // reserved
7148219820Sjeff			uint8_t    local_changes;   // 7b reserved 1b local changes
7149219820Sjeff			ib_net32_t new_cap_mask;    // new capability mask
7150219820Sjeff			ib_net16_t change_flgs;     // 13b reserved 3b change flags
7151219820Sjeff		} PACK_SUFFIX ntc_144;
7152219820Sjeff
7153219820Sjeff		struct _ntc_145 {
7154219820Sjeff			ib_net16_t pad1;
7155219820Sjeff			ib_net16_t lid;	// lid where sys guid changed
7156219820Sjeff			ib_net16_t pad2;
7157219820Sjeff			ib_net64_t new_sys_guid;	// new system image guid
7158219820Sjeff		} PACK_SUFFIX ntc_145;
7159219820Sjeff
7160219820Sjeff		struct _ntc_256 {	// total: 54
7161219820Sjeff			ib_net16_t pad1;	// 2
7162219820Sjeff			ib_net16_t lid;	// 2
7163219820Sjeff			ib_net16_t dr_slid;	// 2
7164219820Sjeff			uint8_t method;	// 1
7165219820Sjeff			uint8_t pad2;	// 1
7166219820Sjeff			ib_net16_t attr_id;	// 2
7167219820Sjeff			ib_net32_t attr_mod;	// 4
7168219820Sjeff			ib_net64_t mkey;	// 8
7169219820Sjeff			uint8_t pad3;	// 1
7170219820Sjeff			uint8_t dr_trunc_hop;	// 1
7171219820Sjeff			uint8_t dr_rtn_path[30];	// 30
7172219820Sjeff		} PACK_SUFFIX ntc_256;
7173219820Sjeff
7174219820Sjeff		struct _ntc_257_258	// violation of p/q_key // 49
7175219820Sjeff		{
7176219820Sjeff			ib_net16_t pad1;	// 2
7177219820Sjeff			ib_net16_t lid1;	// 2
7178219820Sjeff			ib_net16_t lid2;	// 2
7179219820Sjeff			ib_net32_t key;	// 2
7180219820Sjeff			uint8_t sl;	// 1
7181219820Sjeff			ib_net32_t qp1;	// 4
7182219820Sjeff			ib_net32_t qp2;	// 4
7183219820Sjeff			ib_gid_t gid1;	// 16
7184219820Sjeff			ib_gid_t gid2;	// 16
7185219820Sjeff		} PACK_SUFFIX ntc_257_258;
7186219820Sjeff
7187219820Sjeff		struct _ntc_259	// pkey violation from switch 51
7188219820Sjeff		{
7189219820Sjeff			ib_net16_t data_valid;	// 2
7190219820Sjeff			ib_net16_t lid1;	// 2
7191219820Sjeff			ib_net16_t lid2;	// 2
7192219820Sjeff			ib_net16_t pkey;	// 2
7193219820Sjeff			ib_net32_t sl_qp1; // 4b sl, 4b pad, 24b qp1
7194219820Sjeff			ib_net32_t qp2; // 8b pad, 24b qp2
7195219820Sjeff			ib_gid_t gid1;	// 16
7196219820Sjeff			ib_gid_t gid2;	// 16
7197219820Sjeff			ib_net16_t sw_lid;	// 2
7198219820Sjeff			uint8_t port_no;	// 1
7199219820Sjeff		} PACK_SUFFIX ntc_259;
7200219820Sjeff
7201219820Sjeff	} data_details;
7202219820Sjeff
7203219820Sjeff	ib_gid_t issuer_gid;	// 16          80
7204219820Sjeff
7205219820Sjeff} PACK_SUFFIX ib_mad_notice_attr_t;
7206219820Sjeff#include <complib/cl_packoff.h>
7207219820Sjeff
7208219820Sjeff/**
7209219820Sjeff * Trap 259 masks
7210219820Sjeff */
7211219820Sjeff#define TRAP_259_MASK_SL (CL_HTON32(0xF0000000))
7212219820Sjeff#define TRAP_259_MASK_QP (CL_HTON32(0x00FFFFFF))
7213219820Sjeff
7214219820Sjeff/**
7215219820Sjeff * Trap 144 masks
7216219820Sjeff */
7217219820Sjeff#define TRAP_144_MASK_OTHER_LOCAL_CHANGES      0x01
7218219820Sjeff#define TRAP_144_MASK_SM_PRIORITY_CHANGE       (CL_HTON16(0x0008))
7219219820Sjeff#define TRAP_144_MASK_LINK_SPEED_ENABLE_CHANGE (CL_HTON16(0x0004))
7220219820Sjeff#define TRAP_144_MASK_LINK_WIDTH_ENABLE_CHANGE (CL_HTON16(0x0002))
7221219820Sjeff#define TRAP_144_MASK_NODE_DESCRIPTION_CHANGE  (CL_HTON16(0x0001))
7222219820Sjeff
7223219820Sjeff/****f* IBA Base: Types/ib_notice_is_generic
7224219820Sjeff* NAME
7225219820Sjeff*	ib_notice_is_generic
7226219820Sjeff*
7227219820Sjeff* DESCRIPTION
7228219820Sjeff*	Check if the notice is generic
7229219820Sjeff*
7230219820Sjeff* SYNOPSIS
7231219820Sjeff*/
7232219820Sjeffstatic inline boolean_t OSM_API
7233219820Sjeffib_notice_is_generic(IN const ib_mad_notice_attr_t * p_ntc)
7234219820Sjeff{
7235219820Sjeff	return (p_ntc->generic_type & 0x80);
7236219820Sjeff}
7237219820Sjeff
7238219820Sjeff/*
7239219820Sjeff* PARAMETERS
7240219820Sjeff*	p_ntc
7241219820Sjeff*		[in] Pointer to  the notice MAD attribute
7242219820Sjeff*
7243219820Sjeff* RETURN VALUES
7244219820Sjeff*	TRUE if mad is generic
7245219820Sjeff*
7246219820Sjeff* SEE ALSO
7247219820Sjeff*	ib_mad_notice_attr_t
7248219820Sjeff*********/
7249219820Sjeff
7250219820Sjeff/****f* IBA Base: Types/ib_notice_get_type
7251219820Sjeff* NAME
7252219820Sjeff*	ib_notice_get_type
7253219820Sjeff*
7254219820Sjeff* DESCRIPTION
7255219820Sjeff*	Get the notice type
7256219820Sjeff*
7257219820Sjeff* SYNOPSIS
7258219820Sjeff*/
7259219820Sjeffstatic inline uint8_t OSM_API
7260219820Sjeffib_notice_get_type(IN const ib_mad_notice_attr_t * p_ntc)
7261219820Sjeff{
7262219820Sjeff	return p_ntc->generic_type & 0x7f;
7263219820Sjeff}
7264219820Sjeff
7265219820Sjeff/*
7266219820Sjeff* PARAMETERS
7267219820Sjeff*	p_ntc
7268219820Sjeff*		[in] Pointer to  the notice MAD attribute
7269219820Sjeff*
7270219820Sjeff* RETURN VALUES
7271219820Sjeff*	TRUE if mad is generic
7272219820Sjeff*
7273219820Sjeff* SEE ALSO
7274219820Sjeff*	ib_mad_notice_attr_t
7275219820Sjeff*********/
7276219820Sjeff
7277219820Sjeff/****f* IBA Base: Types/ib_notice_get_prod_type
7278219820Sjeff* NAME
7279219820Sjeff*	ib_notice_get_prod_type
7280219820Sjeff*
7281219820Sjeff* DESCRIPTION
7282219820Sjeff*	Get the notice Producer Type of Generic Notice
7283219820Sjeff*
7284219820Sjeff* SYNOPSIS
7285219820Sjeff*/
7286219820Sjeffstatic inline ib_net32_t OSM_API
7287219820Sjeffib_notice_get_prod_type(IN const ib_mad_notice_attr_t * p_ntc)
7288219820Sjeff{
7289219820Sjeff	uint32_t pt;
7290219820Sjeff
7291219820Sjeff	pt = cl_ntoh16(p_ntc->g_or_v.generic.prod_type_lsb) |
7292219820Sjeff	    (p_ntc->g_or_v.generic.prod_type_msb << 16);
7293219820Sjeff	return cl_hton32(pt);
7294219820Sjeff}
7295219820Sjeff
7296219820Sjeff/*
7297219820Sjeff* PARAMETERS
7298219820Sjeff*	p_ntc
7299219820Sjeff*		[in] Pointer to the notice MAD attribute
7300219820Sjeff*
7301219820Sjeff* RETURN VALUES
7302219820Sjeff*	The producer type
7303219820Sjeff*
7304219820Sjeff* SEE ALSO
7305219820Sjeff*	ib_mad_notice_attr_t
7306219820Sjeff*********/
7307219820Sjeff
7308219820Sjeff/****f* IBA Base: Types/ib_notice_set_prod_type
7309219820Sjeff* NAME
7310219820Sjeff*	ib_notice_set_prod_type
7311219820Sjeff*
7312219820Sjeff* DESCRIPTION
7313219820Sjeff*	Set the notice Producer Type of Generic Notice
7314219820Sjeff*
7315219820Sjeff* SYNOPSIS
7316219820Sjeff*/
7317219820Sjeffstatic inline void OSM_API
7318219820Sjeffib_notice_set_prod_type(IN ib_mad_notice_attr_t * p_ntc,
7319219820Sjeff			IN ib_net32_t prod_type_val)
7320219820Sjeff{
7321219820Sjeff	uint32_t ptv = cl_ntoh32(prod_type_val);
7322219820Sjeff	p_ntc->g_or_v.generic.prod_type_lsb =
7323219820Sjeff	    cl_hton16((uint16_t) (ptv & 0x0000ffff));
7324219820Sjeff	p_ntc->g_or_v.generic.prod_type_msb =
7325219820Sjeff	    (uint8_t) ((ptv & 0x00ff0000) >> 16);
7326219820Sjeff}
7327219820Sjeff
7328219820Sjeff/*
7329219820Sjeff* PARAMETERS
7330219820Sjeff*	p_ntc
7331219820Sjeff*		[in] Pointer to the notice MAD attribute
7332219820Sjeff*
7333219820Sjeff*  prod_type
7334219820Sjeff*     [in] The producer Type code
7335219820Sjeff*
7336219820Sjeff* RETURN VALUES
7337219820Sjeff*	None
7338219820Sjeff*
7339219820Sjeff* SEE ALSO
7340219820Sjeff*	ib_mad_notice_attr_t
7341219820Sjeff*********/
7342219820Sjeff
7343219820Sjeff/****f* IBA Base: Types/ib_notice_set_prod_type_ho
7344219820Sjeff* NAME
7345219820Sjeff*	ib_notice_set_prod_type_ho
7346219820Sjeff*
7347219820Sjeff* DESCRIPTION
7348219820Sjeff*	Set the notice Producer Type of Generic Notice given Host Order
7349219820Sjeff*
7350219820Sjeff* SYNOPSIS
7351219820Sjeff*/
7352219820Sjeffstatic inline void OSM_API
7353219820Sjeffib_notice_set_prod_type_ho(IN ib_mad_notice_attr_t * p_ntc,
7354219820Sjeff			   IN uint32_t prod_type_val_ho)
7355219820Sjeff{
7356219820Sjeff	p_ntc->g_or_v.generic.prod_type_lsb =
7357219820Sjeff	    cl_hton16((uint16_t) (prod_type_val_ho & 0x0000ffff));
7358219820Sjeff	p_ntc->g_or_v.generic.prod_type_msb =
7359219820Sjeff	    (uint8_t) ((prod_type_val_ho & 0x00ff0000) >> 16);
7360219820Sjeff}
7361219820Sjeff
7362219820Sjeff/*
7363219820Sjeff* PARAMETERS
7364219820Sjeff*	p_ntc
7365219820Sjeff*		[in] Pointer to the notice MAD attribute
7366219820Sjeff*
7367219820Sjeff*	prod_type
7368219820Sjeff*		[in] The producer Type code in host order
7369219820Sjeff*
7370219820Sjeff* RETURN VALUES
7371219820Sjeff*	None
7372219820Sjeff*
7373219820Sjeff* SEE ALSO
7374219820Sjeff*	ib_mad_notice_attr_t
7375219820Sjeff*********/
7376219820Sjeff
7377219820Sjeff/****f* IBA Base: Types/ib_notice_get_vend_id
7378219820Sjeff* NAME
7379219820Sjeff*	ib_notice_get_vend_id
7380219820Sjeff*
7381219820Sjeff* DESCRIPTION
7382219820Sjeff*	Get the Vendor Id of Vendor type Notice
7383219820Sjeff*
7384219820Sjeff* SYNOPSIS
7385219820Sjeff*/
7386219820Sjeffstatic inline ib_net32_t OSM_API
7387219820Sjeffib_notice_get_vend_id(IN const ib_mad_notice_attr_t * p_ntc)
7388219820Sjeff{
7389219820Sjeff	uint32_t vi;
7390219820Sjeff
7391219820Sjeff	vi = cl_ntoh16(p_ntc->g_or_v.vend.vend_id_lsb) |
7392219820Sjeff	    (p_ntc->g_or_v.vend.vend_id_msb << 16);
7393219820Sjeff	return cl_hton32(vi);
7394219820Sjeff}
7395219820Sjeff
7396219820Sjeff/*
7397219820Sjeff* PARAMETERS
7398219820Sjeff*	p_ntc
7399219820Sjeff*		[in] Pointer to the notice MAD attribute
7400219820Sjeff*
7401219820Sjeff* RETURN VALUES
7402219820Sjeff*	The Vendor Id of Vendor type Notice
7403219820Sjeff*
7404219820Sjeff* SEE ALSO
7405219820Sjeff*	ib_mad_notice_attr_t
7406219820Sjeff*********/
7407219820Sjeff
7408219820Sjeff/****f* IBA Base: Types/ib_notice_set_vend_id
7409219820Sjeff* NAME
7410219820Sjeff*	ib_notice_set_vend_id
7411219820Sjeff*
7412219820Sjeff* DESCRIPTION
7413219820Sjeff*	Set the notice Producer Type of Generic Notice
7414219820Sjeff*
7415219820Sjeff* SYNOPSIS
7416219820Sjeff*/
7417219820Sjeffstatic inline void OSM_API
7418219820Sjeffib_notice_set_vend_id(IN ib_mad_notice_attr_t * p_ntc, IN ib_net32_t vend_id)
7419219820Sjeff{
7420219820Sjeff	uint32_t vi = cl_ntoh32(vend_id);
7421219820Sjeff	p_ntc->g_or_v.vend.vend_id_lsb =
7422219820Sjeff	    cl_hton16((uint16_t) (vi & 0x0000ffff));
7423219820Sjeff	p_ntc->g_or_v.vend.vend_id_msb = (uint8_t) ((vi & 0x00ff0000) >> 16);
7424219820Sjeff}
7425219820Sjeff
7426219820Sjeff/*
7427219820Sjeff* PARAMETERS
7428219820Sjeff*	p_ntc
7429219820Sjeff*		[in] Pointer to the notice MAD attribute
7430219820Sjeff*
7431219820Sjeff*	vend_id
7432219820Sjeff*		[in] The producer Type code
7433219820Sjeff*
7434219820Sjeff* RETURN VALUES
7435219820Sjeff*	None
7436219820Sjeff*
7437219820Sjeff* SEE ALSO
7438219820Sjeff*	ib_mad_notice_attr_t
7439219820Sjeff*********/
7440219820Sjeff
7441219820Sjeff/****f* IBA Base: Types/ib_notice_set_vend_id_ho
7442219820Sjeff* NAME
7443219820Sjeff*	ib_notice_set_vend_id_ho
7444219820Sjeff*
7445219820Sjeff* DESCRIPTION
7446219820Sjeff*	Set the notice Producer Type of Generic Notice given a host order value
7447219820Sjeff*
7448219820Sjeff* SYNOPSIS
7449219820Sjeff*/
7450219820Sjeffstatic inline void OSM_API
7451219820Sjeffib_notice_set_vend_id_ho(IN ib_mad_notice_attr_t * p_ntc,
7452219820Sjeff			 IN uint32_t vend_id_ho)
7453219820Sjeff{
7454219820Sjeff	p_ntc->g_or_v.vend.vend_id_lsb =
7455219820Sjeff	    cl_hton16((uint16_t) (vend_id_ho & 0x0000ffff));
7456219820Sjeff	p_ntc->g_or_v.vend.vend_id_msb =
7457219820Sjeff	    (uint8_t) ((vend_id_ho & 0x00ff0000) >> 16);
7458219820Sjeff}
7459219820Sjeff
7460219820Sjeff/*
7461219820Sjeff* PARAMETERS
7462219820Sjeff*	p_ntc
7463219820Sjeff*		[in] Pointer to the notice MAD attribute
7464219820Sjeff*
7465219820Sjeff*	vend_id_ho
7466219820Sjeff*		[in] The producer Type code in host order
7467219820Sjeff*
7468219820Sjeff* RETURN VALUES
7469219820Sjeff*	None
7470219820Sjeff*
7471219820Sjeff* SEE ALSO
7472219820Sjeff*	ib_mad_notice_attr_t
7473219820Sjeff*********/
7474219820Sjeff
7475219820Sjeff#include <complib/cl_packon.h>
7476219820Sjefftypedef struct _ib_inform_info {
7477219820Sjeff	ib_gid_t gid;
7478219820Sjeff	ib_net16_t lid_range_begin;
7479219820Sjeff	ib_net16_t lid_range_end;
7480219820Sjeff	ib_net16_t reserved1;
7481219820Sjeff	uint8_t is_generic;
7482219820Sjeff	uint8_t subscribe;
7483219820Sjeff	ib_net16_t trap_type;
7484219820Sjeff	union _inform_g_or_v {
7485219820Sjeff		struct _inform_generic {
7486219820Sjeff			ib_net16_t trap_num;
7487219820Sjeff			ib_net32_t qpn_resp_time_val;
7488219820Sjeff			uint8_t reserved2;
7489219820Sjeff			uint8_t node_type_msb;
7490219820Sjeff			ib_net16_t node_type_lsb;
7491219820Sjeff		} PACK_SUFFIX generic;
7492219820Sjeff
7493219820Sjeff		struct _inform_vend {
7494219820Sjeff			ib_net16_t dev_id;
7495219820Sjeff			ib_net32_t qpn_resp_time_val;
7496219820Sjeff			uint8_t reserved2;
7497219820Sjeff			uint8_t vendor_id_msb;
7498219820Sjeff			ib_net16_t vendor_id_lsb;
7499219820Sjeff		} PACK_SUFFIX vend;
7500219820Sjeff
7501219820Sjeff	} PACK_SUFFIX g_or_v;
7502219820Sjeff
7503219820Sjeff} PACK_SUFFIX ib_inform_info_t;
7504219820Sjeff#include <complib/cl_packoff.h>
7505219820Sjeff
7506219820Sjeff/****f* IBA Base: Types/ib_inform_info_get_qpn_resp_time
7507219820Sjeff* NAME
7508219820Sjeff*	ib_inform_info_get_qpn_resp_time
7509219820Sjeff*
7510219820Sjeff* DESCRIPTION
7511219820Sjeff*	Get QPN of the inform info
7512219820Sjeff*
7513219820Sjeff* SYNOPSIS
7514219820Sjeff*/
7515219820Sjeffstatic inline void OSM_API
7516219820Sjeffib_inform_info_get_qpn_resp_time(IN const ib_net32_t qpn_resp_time_val,
7517219820Sjeff				 OUT ib_net32_t * const p_qpn,
7518219820Sjeff				 OUT uint8_t * const p_resp_time_val)
7519219820Sjeff{
7520219820Sjeff	uint32_t tmp = cl_ntoh32(qpn_resp_time_val);
7521219820Sjeff
7522219820Sjeff	if (p_qpn)
7523219820Sjeff		*p_qpn = cl_hton32((tmp & 0xffffff00) >> 8);
7524219820Sjeff
7525219820Sjeff	if (p_resp_time_val)
7526219820Sjeff		*p_resp_time_val = (uint8_t) (tmp & 0x0000001f);
7527219820Sjeff}
7528219820Sjeff
7529219820Sjeff/*
7530219820Sjeff* PARAMETERS
7531219820Sjeff*	qpn_resp_time_val
7532219820Sjeff*		[in] the  qpn and resp time val from the mad
7533219820Sjeff*
7534219820Sjeff* RETURN VALUES
7535219820Sjeff*	p_qpn
7536219820Sjeff*		[out] pointer to the qpn
7537219820Sjeff*
7538219820Sjeff*	p_state
7539219820Sjeff*		[out] pointer to the resp time val
7540219820Sjeff*
7541219820Sjeff* NOTES
7542219820Sjeff*
7543219820Sjeff* SEE ALSO
7544219820Sjeff*	ib_inform_info_t
7545219820Sjeff*********/
7546219820Sjeff
7547219820Sjeff/****f* IBA Base: Types/ib_inform_info_set_qpn
7548219820Sjeff* NAME
7549219820Sjeff*	ib_inform_info_set_qpn
7550219820Sjeff*
7551219820Sjeff* DESCRIPTION
7552219820Sjeff*	Set the QPN of the inform info
7553219820Sjeff*
7554219820Sjeff* SYNOPSIS
7555219820Sjeff*/
7556219820Sjeffstatic inline void OSM_API
7557219820Sjeffib_inform_info_set_qpn(IN ib_inform_info_t * p_ii, IN ib_net32_t const qpn)
7558219820Sjeff{
7559219820Sjeff	uint32_t tmp = cl_ntoh32(p_ii->g_or_v.generic.qpn_resp_time_val);
7560219820Sjeff
7561219820Sjeff	p_ii->g_or_v.generic.qpn_resp_time_val =
7562219820Sjeff	    cl_hton32((tmp & 0x000000ff) | ((cl_ntoh32(qpn) << 8) & 0xffffff00)
7563219820Sjeff	    );
7564219820Sjeff}
7565219820Sjeff
7566219820Sjeff/*
7567219820Sjeff* PARAMETERS
7568219820Sjeff*
7569219820Sjeff* NOTES
7570219820Sjeff*
7571219820Sjeff* SEE ALSO
7572219820Sjeff*	ib_inform_info_t
7573219820Sjeff*********/
7574219820Sjeff
7575219820Sjeff/****f* IBA Base: Types/ib_inform_info_get_prod_type
7576219820Sjeff* NAME
7577219820Sjeff*	ib_inform_info_get_prod_type
7578219820Sjeff*
7579219820Sjeff* DESCRIPTION
7580219820Sjeff*	Get Producer Type of the Inform Info
7581219820Sjeff*	13.4.8.3 InformInfo
7582219820Sjeff*
7583219820Sjeff* SYNOPSIS
7584219820Sjeff*/
7585219820Sjeffstatic inline ib_net32_t OSM_API
7586219820Sjeffib_inform_info_get_prod_type(IN const ib_inform_info_t * p_inf)
7587219820Sjeff{
7588219820Sjeff	uint32_t nt;
7589219820Sjeff
7590219820Sjeff	nt = cl_ntoh16(p_inf->g_or_v.generic.node_type_lsb) |
7591219820Sjeff	    (p_inf->g_or_v.generic.node_type_msb << 16);
7592219820Sjeff	return cl_hton32(nt);
7593219820Sjeff}
7594219820Sjeff
7595219820Sjeff/*
7596219820Sjeff* PARAMETERS
7597219820Sjeff*	p_inf
7598219820Sjeff*		[in] pointer to an inform info
7599219820Sjeff*
7600219820Sjeff* RETURN VALUES
7601219820Sjeff*     The producer type
7602219820Sjeff*
7603219820Sjeff* NOTES
7604219820Sjeff*
7605219820Sjeff* SEE ALSO
7606219820Sjeff*	ib_inform_info_t
7607219820Sjeff*********/
7608219820Sjeff
7609219820Sjeff/****f* IBA Base: Types/ib_inform_info_get_vend_id
7610219820Sjeff* NAME
7611219820Sjeff*	ib_inform_info_get_vend_id
7612219820Sjeff*
7613219820Sjeff* DESCRIPTION
7614219820Sjeff*	Get Node Type of the Inform Info
7615219820Sjeff*
7616219820Sjeff* SYNOPSIS
7617219820Sjeff*/
7618219820Sjeffstatic inline ib_net32_t OSM_API
7619219820Sjeffib_inform_info_get_vend_id(IN const ib_inform_info_t * p_inf)
7620219820Sjeff{
7621219820Sjeff	uint32_t vi;
7622219820Sjeff
7623219820Sjeff	vi = cl_ntoh16(p_inf->g_or_v.vend.vendor_id_lsb) |
7624219820Sjeff	    (p_inf->g_or_v.vend.vendor_id_msb << 16);
7625219820Sjeff	return cl_hton32(vi);
7626219820Sjeff}
7627219820Sjeff
7628219820Sjeff/*
7629219820Sjeff* PARAMETERS
7630219820Sjeff*	p_inf
7631219820Sjeff*		[in] pointer to an inform info
7632219820Sjeff*
7633219820Sjeff* RETURN VALUES
7634219820Sjeff*     The node type
7635219820Sjeff*
7636219820Sjeff* NOTES
7637219820Sjeff*
7638219820Sjeff* SEE ALSO
7639219820Sjeff*	ib_inform_info_t
7640219820Sjeff*********/
7641219820Sjeff
7642219820Sjeff/****s* IBA Base: Types/ib_inform_info_record_t
7643219820Sjeff* NAME
7644219820Sjeff*	ib_inform_info_record_t
7645219820Sjeff*
7646219820Sjeff* DESCRIPTION
7647219820Sjeff*	IBA defined InformInfo Record. (15.2.5.12)
7648219820Sjeff*
7649219820Sjeff* SYNOPSIS
7650219820Sjeff*/
7651219820Sjeff#include <complib/cl_packon.h>
7652219820Sjefftypedef struct _ib_inform_info_record {
7653219820Sjeff	ib_gid_t subscriber_gid;
7654219820Sjeff	ib_net16_t subscriber_enum;
7655219820Sjeff	uint8_t reserved[6];
7656219820Sjeff	ib_inform_info_t inform_info;
7657219820Sjeff	uint8_t pad[4];
7658219820Sjeff} PACK_SUFFIX ib_inform_info_record_t;
7659219820Sjeff#include <complib/cl_packoff.h>
7660219820Sjeff
7661219820Sjeff/****s* IBA Base: Types/ib_perfmgt_mad_t
7662219820Sjeff* NAME
7663219820Sjeff*	ib_perfmgt_mad_t
7664219820Sjeff*
7665219820Sjeff* DESCRIPTION
7666219820Sjeff*	IBA defined Perf Management MAD (16.3.1)
7667219820Sjeff*
7668219820Sjeff* SYNOPSIS
7669219820Sjeff*/
7670219820Sjeff#include <complib/cl_packon.h>
7671219820Sjefftypedef struct _ib_perfmgt_mad {
7672219820Sjeff	ib_mad_t header;
7673219820Sjeff	uint8_t resv[40];
7674219820Sjeff
7675219820Sjeff#define	IB_PM_DATA_SIZE		192
7676219820Sjeff	uint8_t data[IB_PM_DATA_SIZE];
7677219820Sjeff
7678219820Sjeff} PACK_SUFFIX ib_perfmgt_mad_t;
7679219820Sjeff#include <complib/cl_packoff.h>
7680219820Sjeff/*
7681219820Sjeff* FIELDS
7682219820Sjeff*	header
7683219820Sjeff*		Common MAD header.
7684219820Sjeff*
7685219820Sjeff*	resv
7686219820Sjeff*		Reserved.
7687219820Sjeff*
7688219820Sjeff*	data
7689219820Sjeff*		Performance Management payload.  The structure and content of this field
7690219820Sjeff*		depends upon the method, attr_id, and attr_mod fields in the header.
7691219820Sjeff*
7692219820Sjeff* SEE ALSO
7693219820Sjeff* ib_mad_t
7694219820Sjeff*********/
7695219820Sjeff
7696219820Sjeff/****s* IBA Base: Types/ib_port_counters
7697219820Sjeff* NAME
7698219820Sjeff*	ib_port_counters_t
7699219820Sjeff*
7700219820Sjeff* DESCRIPTION
7701219820Sjeff*	IBA defined PortCounters Attribute. (16.1.3.5)
7702219820Sjeff*
7703219820Sjeff* SYNOPSIS
7704219820Sjeff*/
7705219820Sjeff#include <complib/cl_packon.h>
7706219820Sjefftypedef struct _ib_port_counters {
7707219820Sjeff	uint8_t reserved;
7708219820Sjeff	uint8_t port_select;
7709219820Sjeff	ib_net16_t counter_select;
7710219820Sjeff	ib_net16_t symbol_err_cnt;
7711219820Sjeff	uint8_t link_err_recover;
7712219820Sjeff	uint8_t link_downed;
7713219820Sjeff	ib_net16_t rcv_err;
7714219820Sjeff	ib_net16_t rcv_rem_phys_err;
7715219820Sjeff	ib_net16_t rcv_switch_relay_err;
7716219820Sjeff	ib_net16_t xmit_discards;
7717219820Sjeff	uint8_t xmit_constraint_err;
7718219820Sjeff	uint8_t rcv_constraint_err;
7719219820Sjeff	uint8_t res1;
7720219820Sjeff	uint8_t link_int_buffer_overrun;
7721219820Sjeff	ib_net16_t res2;
7722219820Sjeff	ib_net16_t vl15_dropped;
7723219820Sjeff	ib_net32_t xmit_data;
7724219820Sjeff	ib_net32_t rcv_data;
7725219820Sjeff	ib_net32_t xmit_pkts;
7726219820Sjeff	ib_net32_t rcv_pkts;
7727219820Sjeff} PACK_SUFFIX ib_port_counters_t;
7728219820Sjeff#include <complib/cl_packoff.h>
7729219820Sjeff
7730219820Sjeff#define PC_LINK_INT(integ_buf_over) ((integ_buf_over & 0xF0) >> 4)
7731219820Sjeff#define PC_BUF_OVERRUN(integ_buf_over) (integ_buf_over & 0x0F)
7732219820Sjeff
7733219820Sjeff/****s* IBA Base: Types/ib_port_counters_ext
7734219820Sjeff* NAME
7735219820Sjeff*	ib_port_counters_ext_t
7736219820Sjeff*
7737219820Sjeff* DESCRIPTION
7738219820Sjeff*	IBA defined PortCounters Extended Attribute. (16.1.4.11)
7739219820Sjeff*
7740219820Sjeff* SYNOPSIS
7741219820Sjeff*/
7742219820Sjeff#include <complib/cl_packon.h>
7743219820Sjefftypedef struct _ib_port_counters_ext {
7744219820Sjeff	uint8_t reserved;
7745219820Sjeff	uint8_t port_select;
7746219820Sjeff	ib_net16_t counter_select;
7747219820Sjeff	ib_net32_t reserved2;
7748219820Sjeff	ib_net64_t xmit_data;
7749219820Sjeff	ib_net64_t rcv_data;
7750219820Sjeff	ib_net64_t xmit_pkts;
7751219820Sjeff	ib_net64_t rcv_pkts;
7752219820Sjeff	ib_net64_t unicast_xmit_pkts;
7753219820Sjeff	ib_net64_t unicast_rcv_pkts;
7754219820Sjeff	ib_net64_t multicast_xmit_pkts;
7755219820Sjeff	ib_net64_t multicast_rcv_pkts;
7756219820Sjeff} PACK_SUFFIX ib_port_counters_ext_t;
7757219820Sjeff#include <complib/cl_packoff.h>
7758219820Sjeff
7759219820Sjeff/****s* IBA Base: Types/ib_port_samples_control
7760219820Sjeff* NAME
7761219820Sjeff*	ib_port_samples_control_t
7762219820Sjeff*
7763219820Sjeff* DESCRIPTION
7764219820Sjeff*	IBA defined PortSamplesControl Attribute. (16.1.3.2)
7765219820Sjeff*
7766219820Sjeff* SYNOPSIS
7767219820Sjeff*/
7768219820Sjeff#include <complib/cl_packon.h>
7769219820Sjefftypedef struct _ib_port_samples_control {
7770219820Sjeff	uint8_t op_code;
7771219820Sjeff	uint8_t port_select;
7772219820Sjeff	uint8_t tick;
7773219820Sjeff	uint8_t counter_width;	/* 5 bits res : 3bits counter_width */
7774219820Sjeff	ib_net32_t counter_mask;	/* 2 bits res : 3 bits counter_mask : 27 bits counter_masks_1to9 */
7775219820Sjeff	ib_net16_t counter_mask_10to14;	/* 1 bits res : 15 bits counter_masks_10to14 */
7776219820Sjeff	uint8_t sample_mech;
7777219820Sjeff	uint8_t sample_status;	/* 6 bits res : 2 bits sample_status */
7778219820Sjeff	ib_net64_t option_mask;
7779219820Sjeff	ib_net64_t vendor_mask;
7780219820Sjeff	ib_net32_t sample_start;
7781219820Sjeff	ib_net32_t sample_interval;
7782219820Sjeff	ib_net16_t tag;
7783219820Sjeff	ib_net16_t counter_select0;
7784219820Sjeff	ib_net16_t counter_select1;
7785219820Sjeff	ib_net16_t counter_select2;
7786219820Sjeff	ib_net16_t counter_select3;
7787219820Sjeff	ib_net16_t counter_select4;
7788219820Sjeff	ib_net16_t counter_select5;
7789219820Sjeff	ib_net16_t counter_select6;
7790219820Sjeff	ib_net16_t counter_select7;
7791219820Sjeff	ib_net16_t counter_select8;
7792219820Sjeff	ib_net16_t counter_select9;
7793219820Sjeff	ib_net16_t counter_select10;
7794219820Sjeff	ib_net16_t counter_select11;
7795219820Sjeff	ib_net16_t counter_select12;
7796219820Sjeff	ib_net16_t counter_select13;
7797219820Sjeff	ib_net16_t counter_select14;
7798219820Sjeff} PACK_SUFFIX ib_port_samples_control_t;
7799219820Sjeff#include <complib/cl_packoff.h>
7800219820Sjeff
7801219820Sjeff/****d* IBA Base: Types/CounterSelect values
7802219820Sjeff* NAME
7803219820Sjeff*       Counter select values
7804219820Sjeff*
7805219820Sjeff* DESCRIPTION
7806219820Sjeff*	Mandatory counter select values (16.1.3.3)
7807219820Sjeff*
7808219820Sjeff* SYNOPSIS
7809219820Sjeff*/
7810219820Sjeff#define IB_CS_PORT_XMIT_DATA (CL_HTON16(0x0001))
7811219820Sjeff#define IB_CS_PORT_RCV_DATA  (CL_HTON16(0x0002))
7812219820Sjeff#define IB_CS_PORT_XMIT_PKTS (CL_HTON16(0x0003))
7813219820Sjeff#define IB_CS_PORT_RCV_PKTS  (CL_HTON16(0x0004))
7814219820Sjeff#define IB_CS_PORT_XMIT_WAIT (CL_HTON16(0x0005))
7815219820Sjeff
7816219820Sjeff/****s* IBA Base: Types/ib_port_samples_result
7817219820Sjeff* NAME
7818219820Sjeff*	ib_port_samples_result_t
7819219820Sjeff*
7820219820Sjeff* DESCRIPTION
7821219820Sjeff*	IBA defined PortSamplesControl Attribute. (16.1.3.2)
7822219820Sjeff*
7823219820Sjeff* SYNOPSIS
7824219820Sjeff*/
7825219820Sjeff#include <complib/cl_packon.h>
7826219820Sjefftypedef struct _ib_port_samples_result {
7827219820Sjeff	ib_net16_t tag;
7828219820Sjeff	ib_net16_t sample_status;	/* 14 bits res : 2 bits sample_status */
7829219820Sjeff	ib_net32_t counter0;
7830219820Sjeff	ib_net32_t counter1;
7831219820Sjeff	ib_net32_t counter2;
7832219820Sjeff	ib_net32_t counter3;
7833219820Sjeff	ib_net32_t counter4;
7834219820Sjeff	ib_net32_t counter5;
7835219820Sjeff	ib_net32_t counter6;
7836219820Sjeff	ib_net32_t counter7;
7837219820Sjeff	ib_net32_t counter8;
7838219820Sjeff	ib_net32_t counter9;
7839219820Sjeff	ib_net32_t counter10;
7840219820Sjeff	ib_net32_t counter11;
7841219820Sjeff	ib_net32_t counter12;
7842219820Sjeff	ib_net32_t counter13;
7843219820Sjeff	ib_net32_t counter14;
7844219820Sjeff} PACK_SUFFIX ib_port_samples_result_t;
7845219820Sjeff#include <complib/cl_packoff.h>
7846219820Sjeff
7847219820Sjeff/****d* IBA Base: Types/DM_SVC_NAME
7848219820Sjeff* NAME
7849219820Sjeff*	DM_SVC_NAME
7850219820Sjeff*
7851219820Sjeff* DESCRIPTION
7852219820Sjeff*	IBA defined Device Management service name (16.3)
7853219820Sjeff*
7854219820Sjeff* SYNOPSIS
7855219820Sjeff*/
7856219820Sjeff#define	DM_SVC_NAME				"DeviceManager.IBTA"
7857219820Sjeff/*
7858219820Sjeff* SEE ALSO
7859219820Sjeff*********/
7860219820Sjeff
7861219820Sjeff/****s* IBA Base: Types/ib_dm_mad_t
7862219820Sjeff* NAME
7863219820Sjeff*	ib_dm_mad_t
7864219820Sjeff*
7865219820Sjeff* DESCRIPTION
7866219820Sjeff*	IBA defined Device Management MAD (16.3.1)
7867219820Sjeff*
7868219820Sjeff* SYNOPSIS
7869219820Sjeff*/
7870219820Sjeff#include <complib/cl_packon.h>
7871219820Sjefftypedef struct _ib_dm_mad {
7872219820Sjeff	ib_mad_t header;
7873219820Sjeff	uint8_t resv[40];
7874219820Sjeff
7875219820Sjeff#define	IB_DM_DATA_SIZE		192
7876219820Sjeff	uint8_t data[IB_DM_DATA_SIZE];
7877219820Sjeff
7878219820Sjeff} PACK_SUFFIX ib_dm_mad_t;
7879219820Sjeff#include <complib/cl_packoff.h>
7880219820Sjeff/*
7881219820Sjeff* FIELDS
7882219820Sjeff*	header
7883219820Sjeff*		Common MAD header.
7884219820Sjeff*
7885219820Sjeff*	resv
7886219820Sjeff*		Reserved.
7887219820Sjeff*
7888219820Sjeff*	data
7889219820Sjeff*		Device Management payload.  The structure and content of this field
7890219820Sjeff*		depend upon the method, attr_id, and attr_mod fields in the header.
7891219820Sjeff*
7892219820Sjeff* SEE ALSO
7893219820Sjeff* ib_mad_t
7894219820Sjeff*********/
7895219820Sjeff
7896219820Sjeff/****s* IBA Base: Types/ib_iou_info_t
7897219820Sjeff* NAME
7898219820Sjeff*	ib_iou_info_t
7899219820Sjeff*
7900219820Sjeff* DESCRIPTION
7901219820Sjeff*	IBA defined IO Unit information structure (16.3.3.3)
7902219820Sjeff*
7903219820Sjeff* SYNOPSIS
7904219820Sjeff*/
7905219820Sjeff#include <complib/cl_packon.h>
7906219820Sjefftypedef struct _ib_iou_info {
7907219820Sjeff	ib_net16_t change_id;
7908219820Sjeff	uint8_t max_controllers;
7909219820Sjeff	uint8_t diag_rom;
7910219820Sjeff
7911219820Sjeff#define	IB_DM_CTRL_LIST_SIZE	128
7912219820Sjeff
7913219820Sjeff	uint8_t controller_list[IB_DM_CTRL_LIST_SIZE];
7914219820Sjeff#define	IOC_NOT_INSTALLED		0x0
7915219820Sjeff#define	IOC_INSTALLED			0x1
7916219820Sjeff//              Reserved values                         0x02-0xE
7917219820Sjeff#define	SLOT_DOES_NOT_EXIST		0xF
7918219820Sjeff
7919219820Sjeff} PACK_SUFFIX ib_iou_info_t;
7920219820Sjeff#include <complib/cl_packoff.h>
7921219820Sjeff/*
7922219820Sjeff* FIELDS
7923219820Sjeff*	change_id
7924219820Sjeff*		Value incremented, with rollover, by any change to the controller_list.
7925219820Sjeff*
7926219820Sjeff*	max_controllers
7927219820Sjeff*		Number of slots in controller_list.
7928219820Sjeff*
7929219820Sjeff*	diag_rom
7930219820Sjeff*		A byte containing two fields: DiagDeviceID and OptionROM.
7931219820Sjeff*		These fields may be read using the ib_iou_info_diag_dev_id
7932219820Sjeff*		and ib_iou_info_option_rom functions.
7933219820Sjeff*
7934219820Sjeff*	controller_list
7935219820Sjeff*		A series of 4-bit nibbles, with each nibble representing a slot
7936219820Sjeff*		in the IO Unit.  Individual nibbles may be read using the
7937219820Sjeff*		ioc_at_slot function.
7938219820Sjeff*
7939219820Sjeff* SEE ALSO
7940219820Sjeff* ib_dm_mad_t, ib_iou_info_diag_dev_id, ib_iou_info_option_rom, ioc_at_slot
7941219820Sjeff*********/
7942219820Sjeff
7943219820Sjeff/****f* IBA Base: Types/ib_iou_info_diag_dev_id
7944219820Sjeff* NAME
7945219820Sjeff*	ib_iou_info_diag_dev_id
7946219820Sjeff*
7947219820Sjeff* DESCRIPTION
7948219820Sjeff*	Returns the DiagDeviceID.
7949219820Sjeff*
7950219820Sjeff* SYNOPSIS
7951219820Sjeff*/
7952219820Sjeffstatic inline uint8_t OSM_API
7953219820Sjeffib_iou_info_diag_dev_id(IN const ib_iou_info_t * const p_iou_info)
7954219820Sjeff{
7955219820Sjeff	return ((uint8_t) (p_iou_info->diag_rom >> 6 & 1));
7956219820Sjeff}
7957219820Sjeff
7958219820Sjeff/*
7959219820Sjeff* PARAMETERS
7960219820Sjeff*	p_iou_info
7961219820Sjeff*		[in] Pointer to the IO Unit information structure.
7962219820Sjeff*
7963219820Sjeff* RETURN VALUES
7964219820Sjeff*	DiagDeviceID field of the IO Unit information.
7965219820Sjeff*
7966219820Sjeff* NOTES
7967219820Sjeff*
7968219820Sjeff* SEE ALSO
7969219820Sjeff*	ib_iou_info_t
7970219820Sjeff*********/
7971219820Sjeff
7972219820Sjeff/****f* IBA Base: Types/ib_iou_info_option_rom
7973219820Sjeff* NAME
7974219820Sjeff*	ib_iou_info_option_rom
7975219820Sjeff*
7976219820Sjeff* DESCRIPTION
7977219820Sjeff*	Returns the OptionROM.
7978219820Sjeff*
7979219820Sjeff* SYNOPSIS
7980219820Sjeff*/
7981219820Sjeffstatic inline uint8_t OSM_API
7982219820Sjeffib_iou_info_option_rom(IN const ib_iou_info_t * const p_iou_info)
7983219820Sjeff{
7984219820Sjeff	return ((uint8_t) (p_iou_info->diag_rom >> 7));
7985219820Sjeff}
7986219820Sjeff
7987219820Sjeff/*
7988219820Sjeff* PARAMETERS
7989219820Sjeff*	p_iou_info
7990219820Sjeff*		[in] Pointer to the IO Unit information structure.
7991219820Sjeff*
7992219820Sjeff* RETURN VALUES
7993219820Sjeff*	OptionROM field of the IO Unit information.
7994219820Sjeff*
7995219820Sjeff* NOTES
7996219820Sjeff*
7997219820Sjeff* SEE ALSO
7998219820Sjeff*	ib_iou_info_t
7999219820Sjeff*********/
8000219820Sjeff
8001219820Sjeff/****f* IBA Base: Types/ioc_at_slot
8002219820Sjeff* NAME
8003219820Sjeff*	ioc_at_slot
8004219820Sjeff*
8005219820Sjeff* DESCRIPTION
8006219820Sjeff*	Returns the IOC value at the specified slot.
8007219820Sjeff*
8008219820Sjeff* SYNOPSIS
8009219820Sjeff*/
8010219820Sjeffstatic inline uint8_t OSM_API
8011219820Sjeffioc_at_slot(IN const ib_iou_info_t * const p_iou_info, IN uint8_t slot)
8012219820Sjeff{
8013219820Sjeff	if (slot >= IB_DM_CTRL_LIST_SIZE)
8014219820Sjeff		return SLOT_DOES_NOT_EXIST;
8015219820Sjeff	else
8016219820Sjeff		return (int8_t)
8017219820Sjeff		    ((slot % 2) ?
8018219820Sjeff		     ((p_iou_info->controller_list[slot / 2] & 0xf0) >> 4) :
8019219820Sjeff		     (p_iou_info->controller_list[slot / 2] & 0x0f));
8020219820Sjeff}
8021219820Sjeff
8022219820Sjeff/*
8023219820Sjeff* PARAMETERS
8024219820Sjeff*	p_iou_info
8025219820Sjeff*		[in] Pointer to the IO Unit information structure.
8026219820Sjeff*
8027219820Sjeff*	slot
8028219820Sjeff*		[in] Pointer to the IO Unit information structure.
8029219820Sjeff*
8030219820Sjeff* RETURN VALUES
8031219820Sjeff*	OptionROM field of the IO Unit information.
8032219820Sjeff*
8033219820Sjeff* NOTES
8034219820Sjeff*
8035219820Sjeff* SEE ALSO
8036219820Sjeff*	ib_iou_info_t
8037219820Sjeff*********/
8038219820Sjeff
8039219820Sjeff/****s* IBA Base: Types/ib_ioc_profile_t
8040219820Sjeff* NAME
8041219820Sjeff*	ib_ioc_profile_t
8042219820Sjeff*
8043219820Sjeff* DESCRIPTION
8044219820Sjeff*	IBA defined IO Controller profile structure (16.3.3.4)
8045219820Sjeff*
8046219820Sjeff* SYNOPSIS
8047219820Sjeff*/
8048219820Sjeff#include <complib/cl_packon.h>
8049219820Sjefftypedef struct _ib_ioc_profile {
8050219820Sjeff	ib_net64_t ioc_guid;
8051219820Sjeff
8052219820Sjeff	ib_net32_t vend_id;
8053219820Sjeff
8054219820Sjeff	ib_net32_t dev_id;
8055219820Sjeff	ib_net16_t dev_ver;
8056219820Sjeff	ib_net16_t resv2;
8057219820Sjeff
8058219820Sjeff	ib_net32_t subsys_vend_id;
8059219820Sjeff	ib_net32_t subsys_id;
8060219820Sjeff
8061219820Sjeff	ib_net16_t io_class;
8062219820Sjeff	ib_net16_t io_subclass;
8063219820Sjeff	ib_net16_t protocol;
8064219820Sjeff	ib_net16_t protocol_ver;
8065219820Sjeff
8066219820Sjeff	ib_net32_t resv3;
8067219820Sjeff	ib_net16_t send_msg_depth;
8068219820Sjeff	uint8_t resv4;
8069219820Sjeff	uint8_t rdma_read_depth;
8070219820Sjeff	ib_net32_t send_msg_size;
8071219820Sjeff	ib_net32_t rdma_size;
8072219820Sjeff
8073219820Sjeff	uint8_t ctrl_ops_cap;
8074219820Sjeff#define	CTRL_OPS_CAP_ST		0x01
8075219820Sjeff#define	CTRL_OPS_CAP_SF		0x02
8076219820Sjeff#define	CTRL_OPS_CAP_RT		0x04
8077219820Sjeff#define	CTRL_OPS_CAP_RF		0x08
8078219820Sjeff#define	CTRL_OPS_CAP_WT		0x10
8079219820Sjeff#define	CTRL_OPS_CAP_WF		0x20
8080219820Sjeff#define	CTRL_OPS_CAP_AT		0x40
8081219820Sjeff#define	CTRL_OPS_CAP_AF		0x80
8082219820Sjeff
8083219820Sjeff	uint8_t resv5;
8084219820Sjeff
8085219820Sjeff	uint8_t num_svc_entries;
8086219820Sjeff#define	MAX_NUM_SVC_ENTRIES	0xff
8087219820Sjeff
8088219820Sjeff	uint8_t resv6[9];
8089219820Sjeff
8090219820Sjeff#define	CTRL_ID_STRING_LEN	64
8091219820Sjeff	char id_string[CTRL_ID_STRING_LEN];
8092219820Sjeff
8093219820Sjeff} PACK_SUFFIX ib_ioc_profile_t;
8094219820Sjeff#include <complib/cl_packoff.h>
8095219820Sjeff/*
8096219820Sjeff* FIELDS
8097219820Sjeff*	ioc_guid
8098219820Sjeff*		An EUI-64 GUID used to uniquely identify the IO controller.
8099219820Sjeff*
8100219820Sjeff*	vend_id
8101219820Sjeff*		IO controller vendor ID, IEEE format.
8102219820Sjeff*
8103219820Sjeff*	dev_id
8104219820Sjeff*		A number assigned by the vendor to identify the type of controller.
8105219820Sjeff*
8106219820Sjeff*	dev_ver
8107219820Sjeff*		A number assigned by the vendor to identify the divice version.
8108219820Sjeff*
8109219820Sjeff*	subsys_vend_id
8110219820Sjeff*		ID of the vendor of the enclosure, if any, in which the IO controller
8111219820Sjeff*		resides in IEEE format; otherwise zero.
8112219820Sjeff*
8113219820Sjeff*	subsys_id
8114219820Sjeff*		A number identifying the subsystem where the controller resides.
8115219820Sjeff*
8116219820Sjeff*	io_class
8117219820Sjeff*		0x0000 - 0xfffe = reserved for IO classes encompased by InfiniBand
8118219820Sjeff*		Architecture.  0xffff = Vendor specific.
8119219820Sjeff*
8120219820Sjeff*	io_subclass
8121219820Sjeff*		0x0000 - 0xfffe = reserved for IO subclasses encompased by InfiniBand
8122219820Sjeff*		Architecture.  0xffff = Vendor specific.  This shall be set to 0xfff
8123219820Sjeff*		if the io_class component is 0xffff.
8124219820Sjeff*
8125219820Sjeff*	protocol
8126219820Sjeff*		0x0000 - 0xfffe = reserved for IO subclasses encompased by InfiniBand
8127219820Sjeff*		Architecture.  0xffff = Vendor specific.  This shall be set to 0xfff
8128219820Sjeff*		if the io_class component is 0xffff.
8129219820Sjeff*
8130219820Sjeff*	protocol_ver
8131219820Sjeff*		Protocol specific.
8132219820Sjeff*
8133219820Sjeff*	send_msg_depth
8134219820Sjeff*		Maximum depth of the send message queue.
8135219820Sjeff*
8136219820Sjeff*	rdma_read_depth
8137219820Sjeff*		Maximum depth of the per-channel RDMA read queue.
8138219820Sjeff*
8139219820Sjeff*	send_msg_size
8140219820Sjeff*		Maximum size of send messages.
8141219820Sjeff*
8142219820Sjeff*	ctrl_ops_cap
8143219820Sjeff*		Supported operation types of this IO controller.  A bit set to one
8144219820Sjeff*		for affirmation of supported capability.
8145219820Sjeff*
8146219820Sjeff*	num_svc_entries
8147219820Sjeff*		Number of entries in the service entries table.
8148219820Sjeff*
8149219820Sjeff*	id_string
8150219820Sjeff*		UTF-8 encoded string for identifying the controller to an operator.
8151219820Sjeff*
8152219820Sjeff* SEE ALSO
8153219820Sjeff* ib_dm_mad_t
8154219820Sjeff*********/
8155219820Sjeff
8156219820Sjeffstatic inline uint32_t OSM_API
8157219820Sjeffib_ioc_profile_get_vend_id(IN const ib_ioc_profile_t * const p_ioc_profile)
8158219820Sjeff{
8159219820Sjeff	return (cl_ntoh32(p_ioc_profile->vend_id) >> 8);
8160219820Sjeff}
8161219820Sjeff
8162219820Sjeffstatic inline void OSM_API
8163219820Sjeffib_ioc_profile_set_vend_id(IN ib_ioc_profile_t * const p_ioc_profile,
8164219820Sjeff			   IN const uint32_t vend_id)
8165219820Sjeff{
8166219820Sjeff	p_ioc_profile->vend_id = (cl_hton32(vend_id) << 8);
8167219820Sjeff}
8168219820Sjeff
8169219820Sjeff/****s* IBA Base: Types/ib_svc_entry_t
8170219820Sjeff* NAME
8171219820Sjeff*	ib_svc_entry_t
8172219820Sjeff*
8173219820Sjeff* DESCRIPTION
8174219820Sjeff*	IBA defined IO Controller service entry structure (16.3.3.5)
8175219820Sjeff*
8176219820Sjeff* SYNOPSIS
8177219820Sjeff*/
8178219820Sjeff#include <complib/cl_packon.h>
8179219820Sjefftypedef struct _ib_svc_entry {
8180219820Sjeff#define	MAX_SVC_ENTRY_NAME_LEN		40
8181219820Sjeff	char name[MAX_SVC_ENTRY_NAME_LEN];
8182219820Sjeff
8183219820Sjeff	ib_net64_t id;
8184219820Sjeff
8185219820Sjeff} PACK_SUFFIX ib_svc_entry_t;
8186219820Sjeff#include <complib/cl_packoff.h>
8187219820Sjeff/*
8188219820Sjeff* FIELDS
8189219820Sjeff*	name
8190219820Sjeff*		UTF-8 encoded, null-terminated name of the service.
8191219820Sjeff*
8192219820Sjeff*	id
8193219820Sjeff*		An identifier of the associated Service.
8194219820Sjeff*
8195219820Sjeff* SEE ALSO
8196219820Sjeff* ib_svc_entries_t
8197219820Sjeff*********/
8198219820Sjeff
8199219820Sjeff/****s* IBA Base: Types/ib_svc_entries_t
8200219820Sjeff* NAME
8201219820Sjeff*	ib_svc_entries_t
8202219820Sjeff*
8203219820Sjeff* DESCRIPTION
8204219820Sjeff*	IBA defined IO Controller service entry array (16.3.3.5)
8205219820Sjeff*
8206219820Sjeff* SYNOPSIS
8207219820Sjeff*/
8208219820Sjeff#include <complib/cl_packon.h>
8209219820Sjefftypedef struct _ib_svc_entries {
8210219820Sjeff#define	SVC_ENTRY_COUNT			4
8211219820Sjeff	ib_svc_entry_t service_entry[SVC_ENTRY_COUNT];
8212219820Sjeff
8213219820Sjeff} PACK_SUFFIX ib_svc_entries_t;
8214219820Sjeff#include <complib/cl_packoff.h>
8215219820Sjeff/*
8216219820Sjeff* FIELDS
8217219820Sjeff*	service_entry
8218219820Sjeff*		An array of IO controller service entries.
8219219820Sjeff*
8220219820Sjeff* SEE ALSO
8221219820Sjeff* ib_dm_mad_t, ib_svc_entry_t
8222219820Sjeff*********/
8223219820Sjeff
8224219820Sjeffstatic inline void OSM_API
8225219820Sjeffib_dm_get_slot_lo_hi(IN const ib_net32_t slot_lo_hi,
8226219820Sjeff		     OUT uint8_t * const p_slot,
8227219820Sjeff		     OUT uint8_t * const p_lo, OUT uint8_t * const p_hi)
8228219820Sjeff{
8229219820Sjeff	ib_net32_t tmp_slot_lo_hi = CL_NTOH32(slot_lo_hi);
8230219820Sjeff
8231219820Sjeff	if (p_slot)
8232219820Sjeff		*p_slot = (uint8_t) ((tmp_slot_lo_hi >> 16) & 0x0f);
8233219820Sjeff
8234219820Sjeff	if (p_hi)
8235219820Sjeff		*p_hi = (uint8_t) ((tmp_slot_lo_hi >> 8) & 0xff);
8236219820Sjeff
8237219820Sjeff	if (p_lo)
8238219820Sjeff		*p_lo = (uint8_t) ((tmp_slot_lo_hi >> 0) & 0xff);
8239219820Sjeff}
8240219820Sjeff
8241219820Sjeff/*
8242219820Sjeff *	IBA defined information describing an I/O controller
8243219820Sjeff */
8244219820Sjeff#include <complib/cl_packon.h>
8245219820Sjefftypedef struct _ib_ioc_info {
8246219820Sjeff	ib_net64_t module_guid;
8247219820Sjeff	ib_net64_t iou_guid;
8248219820Sjeff	ib_ioc_profile_t ioc_profile;
8249219820Sjeff	ib_net64_t access_key;
8250219820Sjeff	uint16_t initiators_conf;
8251219820Sjeff	uint8_t resv[38];
8252219820Sjeff
8253219820Sjeff} PACK_SUFFIX ib_ioc_info_t;
8254219820Sjeff#include <complib/cl_packoff.h>
8255219820Sjeff
8256219820Sjeff/*
8257219820Sjeff *	The following definitions are shared between the Access Layer and VPD
8258219820Sjeff */
8259219820Sjefftypedef struct _ib_ca *__ptr64 ib_ca_handle_t;
8260219820Sjefftypedef struct _ib_pd *__ptr64 ib_pd_handle_t;
8261219820Sjefftypedef struct _ib_rdd *__ptr64 ib_rdd_handle_t;
8262219820Sjefftypedef struct _ib_mr *__ptr64 ib_mr_handle_t;
8263219820Sjefftypedef struct _ib_mw *__ptr64 ib_mw_handle_t;
8264219820Sjefftypedef struct _ib_qp *__ptr64 ib_qp_handle_t;
8265219820Sjefftypedef struct _ib_eec *__ptr64 ib_eec_handle_t;
8266219820Sjefftypedef struct _ib_cq *__ptr64 ib_cq_handle_t;
8267219820Sjefftypedef struct _ib_av *__ptr64 ib_av_handle_t;
8268219820Sjefftypedef struct _ib_mcast *__ptr64 ib_mcast_handle_t;
8269219820Sjeff
8270219820Sjeff/* Currently for windows branch, use the extended version of ib special verbs struct
8271219820Sjeff	in order to be compliant with Infinicon ib_types; later we'll change it to support
8272219820Sjeff	OpenSM ib_types.h */
8273219820Sjeff
8274219820Sjeff#ifndef WIN32
8275219820Sjeff/****d* Access Layer/ib_api_status_t
8276219820Sjeff* NAME
8277219820Sjeff*	ib_api_status_t
8278219820Sjeff*
8279219820Sjeff* DESCRIPTION
8280219820Sjeff*	Function return codes indicating the success or failure of an API call.
8281219820Sjeff*	Note that success is indicated by the return value IB_SUCCESS, which
8282219820Sjeff*	is always zero.
8283219820Sjeff*
8284219820Sjeff* NOTES
8285219820Sjeff*	IB_VERBS_PROCESSING_DONE is used by UVP library to terminate a verbs call
8286219820Sjeff*	in the pre-ioctl step itself.
8287219820Sjeff*
8288219820Sjeff* SYNOPSIS
8289219820Sjeff*/
8290219820Sjefftypedef enum _ib_api_status_t {
8291219820Sjeff	IB_SUCCESS,
8292219820Sjeff	IB_INSUFFICIENT_RESOURCES,
8293219820Sjeff	IB_INSUFFICIENT_MEMORY,
8294219820Sjeff	IB_INVALID_PARAMETER,
8295219820Sjeff	IB_INVALID_SETTING,
8296219820Sjeff	IB_NOT_FOUND,
8297219820Sjeff	IB_TIMEOUT,
8298219820Sjeff	IB_CANCELED,
8299219820Sjeff	IB_INTERRUPTED,
8300219820Sjeff	IB_INVALID_PERMISSION,
8301219820Sjeff	IB_UNSUPPORTED,
8302219820Sjeff	IB_OVERFLOW,
8303219820Sjeff	IB_MAX_MCAST_QPS_REACHED,
8304219820Sjeff	IB_INVALID_QP_STATE,
8305219820Sjeff	IB_INVALID_EEC_STATE,
8306219820Sjeff	IB_INVALID_APM_STATE,
8307219820Sjeff	IB_INVALID_PORT_STATE,
8308219820Sjeff	IB_INVALID_STATE,
8309219820Sjeff	IB_RESOURCE_BUSY,
8310219820Sjeff	IB_INVALID_PKEY,
8311219820Sjeff	IB_INVALID_LKEY,
8312219820Sjeff	IB_INVALID_RKEY,
8313219820Sjeff	IB_INVALID_MAX_WRS,
8314219820Sjeff	IB_INVALID_MAX_SGE,
8315219820Sjeff	IB_INVALID_CQ_SIZE,
8316219820Sjeff	IB_INVALID_SERVICE_TYPE,
8317219820Sjeff	IB_INVALID_GID,
8318219820Sjeff	IB_INVALID_LID,
8319219820Sjeff	IB_INVALID_GUID,
8320219820Sjeff	IB_INVALID_CA_HANDLE,
8321219820Sjeff	IB_INVALID_AV_HANDLE,
8322219820Sjeff	IB_INVALID_CQ_HANDLE,
8323219820Sjeff	IB_INVALID_EEC_HANDLE,
8324219820Sjeff	IB_INVALID_QP_HANDLE,
8325219820Sjeff	IB_INVALID_PD_HANDLE,
8326219820Sjeff	IB_INVALID_MR_HANDLE,
8327219820Sjeff	IB_INVALID_MW_HANDLE,
8328219820Sjeff	IB_INVALID_RDD_HANDLE,
8329219820Sjeff	IB_INVALID_MCAST_HANDLE,
8330219820Sjeff	IB_INVALID_CALLBACK,
8331219820Sjeff	IB_INVALID_AL_HANDLE,	/* InfiniBand Access Layer */
8332219820Sjeff	IB_INVALID_HANDLE,	/* InfiniBand Access Layer */
8333219820Sjeff	IB_ERROR,		/* InfiniBand Access Layer */
8334219820Sjeff	IB_REMOTE_ERROR,	/* Infiniband Access Layer */
8335219820Sjeff	IB_VERBS_PROCESSING_DONE,	/* See Notes above         */
8336219820Sjeff	IB_INVALID_WR_TYPE,
8337219820Sjeff	IB_QP_IN_TIMEWAIT,
8338219820Sjeff	IB_EE_IN_TIMEWAIT,
8339219820Sjeff	IB_INVALID_PORT,
8340219820Sjeff	IB_NOT_DONE,
8341219820Sjeff	IB_UNKNOWN_ERROR	/* ALWAYS LAST ENUM VALUE! */
8342219820Sjeff} ib_api_status_t;
8343219820Sjeff/*****/
8344219820Sjeff
8345219820SjeffOSM_EXPORT const char *ib_error_str[];
8346219820Sjeff
8347219820Sjeff/****f* IBA Base: Types/ib_get_err_str
8348219820Sjeff* NAME
8349219820Sjeff*	ib_get_err_str
8350219820Sjeff*
8351219820Sjeff* DESCRIPTION
8352219820Sjeff*	Returns a string for the specified status value.
8353219820Sjeff*
8354219820Sjeff* SYNOPSIS
8355219820Sjeff*/
8356219820Sjeffstatic inline const char *OSM_API ib_get_err_str(IN ib_api_status_t status)
8357219820Sjeff{
8358219820Sjeff	if (status > IB_UNKNOWN_ERROR)
8359219820Sjeff		status = IB_UNKNOWN_ERROR;
8360219820Sjeff	return (ib_error_str[status]);
8361219820Sjeff}
8362219820Sjeff
8363219820Sjeff/*
8364219820Sjeff* PARAMETERS
8365219820Sjeff*	status
8366219820Sjeff*		[in] status value
8367219820Sjeff*
8368219820Sjeff* RETURN VALUES
8369219820Sjeff*	Pointer to the status description string.
8370219820Sjeff*
8371219820Sjeff* NOTES
8372219820Sjeff*
8373219820Sjeff* SEE ALSO
8374219820Sjeff*********/
8375219820Sjeff
8376219820Sjeff/****d* Verbs/ib_async_event_t
8377219820Sjeff* NAME
8378219820Sjeff*	ib_async_event_t -- Async event types
8379219820Sjeff*
8380219820Sjeff* DESCRIPTION
8381219820Sjeff*	This type indicates the reason the async callback was called.
8382219820Sjeff*	The context in the ib_event_rec_t indicates the resource context
8383219820Sjeff*	that associated with the callback.  For example, for IB_AE_CQ_ERROR
8384219820Sjeff*	the context provided during the ib_create_cq is returned in the event.
8385219820Sjeff*
8386219820Sjeff* SYNOPSIS
8387219820Sjeff*/
8388219820Sjefftypedef enum _ib_async_event_t {
8389219820Sjeff	IB_AE_SQ_ERROR = 1,
8390219820Sjeff	IB_AE_SQ_DRAINED,
8391219820Sjeff	IB_AE_RQ_ERROR,
8392219820Sjeff	IB_AE_CQ_ERROR,
8393219820Sjeff	IB_AE_QP_FATAL,
8394219820Sjeff	IB_AE_QP_COMM,
8395219820Sjeff	IB_AE_QP_APM,
8396219820Sjeff	IB_AE_EEC_FATAL,
8397219820Sjeff	IB_AE_EEC_COMM,
8398219820Sjeff	IB_AE_EEC_APM,
8399219820Sjeff	IB_AE_LOCAL_FATAL,
8400219820Sjeff	IB_AE_PKEY_TRAP,
8401219820Sjeff	IB_AE_QKEY_TRAP,
8402219820Sjeff	IB_AE_MKEY_TRAP,
8403219820Sjeff	IB_AE_PORT_TRAP,
8404219820Sjeff	IB_AE_SYSIMG_GUID_TRAP,
8405219820Sjeff	IB_AE_BUF_OVERRUN,
8406219820Sjeff	IB_AE_LINK_INTEGRITY,
8407219820Sjeff	IB_AE_FLOW_CTRL_ERROR,
8408219820Sjeff	IB_AE_BKEY_TRAP,
8409219820Sjeff	IB_AE_QP_APM_ERROR,
8410219820Sjeff	IB_AE_EEC_APM_ERROR,
8411219820Sjeff	IB_AE_WQ_REQ_ERROR,
8412219820Sjeff	IB_AE_WQ_ACCESS_ERROR,
8413219820Sjeff	IB_AE_PORT_ACTIVE,
8414219820Sjeff	IB_AE_PORT_DOWN,
8415219820Sjeff	IB_AE_UNKNOWN		/* ALWAYS LAST ENUM VALUE */
8416219820Sjeff} ib_async_event_t;
8417219820Sjeff/*
8418219820Sjeff* VALUES
8419219820Sjeff*	IB_AE_SQ_ERROR
8420219820Sjeff*		An error occurred when accessing the send queue of the QP or EEC.
8421219820Sjeff*		This event is optional.
8422219820Sjeff*
8423219820Sjeff*	IB_AE_SQ_DRAINED
8424219820Sjeff*		The send queue of the specified QP has completed the outstanding
8425219820Sjeff*		messages in progress when the state change was requested and, if
8426219820Sjeff*		applicable, has received all acknowledgements for those messages.
8427219820Sjeff*
8428219820Sjeff*	IB_AE_RQ_ERROR
8429219820Sjeff*		An error occurred when accessing the receive queue of the QP or EEC.
8430219820Sjeff*		This event is optional.
8431219820Sjeff*
8432219820Sjeff*	IB_AE_CQ_ERROR
8433219820Sjeff*		An error occurred when writing an entry to the CQ.
8434219820Sjeff*
8435219820Sjeff*	IB_AE_QP_FATAL
8436219820Sjeff*		A catastrophic error occurred while accessing or processing the
8437219820Sjeff*		work queue that prevents reporting of completions.
8438219820Sjeff*
8439219820Sjeff*	IB_AE_QP_COMM
8440219820Sjeff*		The first packet has arrived for the receive work queue where the
8441219820Sjeff*		QP is still in the RTR state.
8442219820Sjeff*
8443219820Sjeff*	IB_AE_QP_APM
8444219820Sjeff*		If alternate path migration is supported, this event indicates that
8445219820Sjeff*		the QP connection has migrated to the alternate path.
8446219820Sjeff*
8447219820Sjeff*	IB_AE_EEC_FATAL
8448219820Sjeff*		If reliable datagram service is supported, this event indicates that
8449219820Sjeff*		a catastrophic error occurred while accessing or processing the EEC
8450219820Sjeff*		that prevents reporting of completions.
8451219820Sjeff*
8452219820Sjeff*	IB_AE_EEC_COMM
8453219820Sjeff*		If reliable datagram service is supported, this event indicates that
8454219820Sjeff*		the first packet has arrived for the receive work queue where the
8455219820Sjeff*		EEC is still in the RTR state.
8456219820Sjeff*
8457219820Sjeff*	IB_AE_EEC_APM
8458219820Sjeff*		If reliable datagram service and alternate path migration is supported,
8459219820Sjeff*		this event indicates that the EEC connection has migrated to the
8460219820Sjeff*		alternate path.
8461219820Sjeff*
8462219820Sjeff*	IB_AE_LOCAL_FATAL
8463219820Sjeff*		A catastrophic HCA error occurred which cannot be attributed to any
8464219820Sjeff*		resource; behavior is indeterminate.
8465219820Sjeff*
8466219820Sjeff*	IB_AE_PKEY_TRAP
8467219820Sjeff*		A PKEY violation was detected.  This event is optional.
8468219820Sjeff*
8469219820Sjeff*	IB_AE_QKEY_TRAP
8470219820Sjeff*		A QKEY violation was detected.  This event is optional.
8471219820Sjeff*
8472219820Sjeff*	IB_AE_MKEY_TRAP
8473219820Sjeff*		An MKEY violation was detected.  This event is optional.
8474219820Sjeff*
8475219820Sjeff*	IB_AE_PORT_TRAP
8476219820Sjeff*		A port capability change was detected.  This event is optional.
8477219820Sjeff*
8478219820Sjeff*	IB_AE_SYSIMG_GUID_TRAP
8479219820Sjeff*		If the system image GUID is supported, this event indicates that the
8480219820Sjeff*		system image GUID of this HCA has been changed.  This event is
8481219820Sjeff*		optional.
8482219820Sjeff*
8483219820Sjeff*	IB_AE_BUF_OVERRUN
8484219820Sjeff*		The number of consecutive flow control update periods with at least
8485219820Sjeff*		one overrun error in each period has exceeded the threshold specified
8486219820Sjeff*		in the port info attributes.  This event is optional.
8487219820Sjeff*
8488219820Sjeff*	IB_AE_LINK_INTEGRITY
8489219820Sjeff*		The detection of excessively frequent local physical errors has
8490219820Sjeff*		exceeded the threshold specified in the port info attributes.  This
8491219820Sjeff*		event is optional.
8492219820Sjeff*
8493219820Sjeff*	IB_AE_FLOW_CTRL_ERROR
8494219820Sjeff*		An HCA watchdog timer monitoring the arrival of flow control updates
8495219820Sjeff*		has expired without receiving an update.  This event is optional.
8496219820Sjeff*
8497219820Sjeff*	IB_AE_BKEY_TRAP
8498219820Sjeff*		An BKEY violation was detected.  This event is optional.
8499219820Sjeff*
8500219820Sjeff*	IB_AE_QP_APM_ERROR
8501219820Sjeff*		If alternate path migration is supported, this event indicates that
8502219820Sjeff*		an incoming path migration request to this QP was not accepted.
8503219820Sjeff*
8504219820Sjeff*	IB_AE_EEC_APM_ERROR
8505219820Sjeff*		If reliable datagram service and alternate path migration is supported,
8506219820Sjeff*		this event indicates that an incoming path migration request to this
8507219820Sjeff*		EEC was not accepted.
8508219820Sjeff*
8509219820Sjeff*	IB_AE_WQ_REQ_ERROR
8510219820Sjeff*		An OpCode violation was detected at the responder.
8511219820Sjeff*
8512219820Sjeff*	IB_AE_WQ_ACCESS_ERROR
8513219820Sjeff*		An access violation was detected at the responder.
8514219820Sjeff*
8515219820Sjeff*	IB_AE_PORT_ACTIVE
8516219820Sjeff*		If the port active event is supported, this event is generated
8517219820Sjeff*		when the link becomes active: IB_LINK_ACTIVE.
8518219820Sjeff*
8519219820Sjeff*	IB_AE_PORT_DOWN
8520219820Sjeff*		The link is declared unavailable: IB_LINK_INIT, IB_LINK_ARMED,
8521219820Sjeff*		IB_LINK_DOWN.
8522219820Sjeff*
8523219820Sjeff*	IB_AE_UNKNOWN
8524219820Sjeff*		An unknown error occurred which cannot be attributed to any
8525219820Sjeff*		resource; behavior is indeterminate.
8526219820Sjeff*
8527219820Sjeff*****/
8528219820Sjeff
8529219820SjeffOSM_EXPORT const char *ib_async_event_str[];
8530219820Sjeff
8531219820Sjeff/****f* IBA Base: Types/ib_get_async_event_str
8532219820Sjeff* NAME
8533219820Sjeff*	ib_get_async_event_str
8534219820Sjeff*
8535219820Sjeff* DESCRIPTION
8536219820Sjeff*	Returns a string for the specified asynchronous event.
8537219820Sjeff*
8538219820Sjeff* SYNOPSIS
8539219820Sjeff*/
8540219820Sjeffstatic inline const char *OSM_API
8541219820Sjeffib_get_async_event_str(IN ib_async_event_t event)
8542219820Sjeff{
8543219820Sjeff	if (event > IB_AE_UNKNOWN)
8544219820Sjeff		event = IB_AE_UNKNOWN;
8545219820Sjeff	return (ib_async_event_str[event]);
8546219820Sjeff}
8547219820Sjeff
8548219820Sjeff/*
8549219820Sjeff* PARAMETERS
8550219820Sjeff*	event
8551219820Sjeff*		[in] event value
8552219820Sjeff*
8553219820Sjeff* RETURN VALUES
8554219820Sjeff*	Pointer to the asynchronous event description string.
8555219820Sjeff*
8556219820Sjeff* NOTES
8557219820Sjeff*
8558219820Sjeff* SEE ALSO
8559219820Sjeff*********/
8560219820Sjeff
8561219820Sjeff/****s* Verbs/ib_event_rec_t
8562219820Sjeff* NAME
8563219820Sjeff*	ib_event_rec_t -- Async event notification record
8564219820Sjeff*
8565219820Sjeff* DESCRIPTION
8566219820Sjeff*	When an async event callback is made, this structure is passed to indicate
8567219820Sjeff*	the type of event, the source of event that caused it, and the context
8568219820Sjeff*	associated with this event.
8569219820Sjeff*
8570219820Sjeff*	context -- Context of the resource that caused the event.
8571219820Sjeff*		-- ca_context if this is a port/adapter event.
8572219820Sjeff*		-- qp_context if the source is a QP event
8573219820Sjeff*		-- cq_context if the source is a CQ event.
8574219820Sjeff*		-- ee_context if the source is an EE event.
8575219820Sjeff*
8576219820Sjeff* SYNOPSIS
8577219820Sjeff*/
8578219820Sjefftypedef struct _ib_event_rec {
8579219820Sjeff	void *context;
8580219820Sjeff	ib_async_event_t type;
8581219820Sjeff
8582219820Sjeff	/* HCA vendor specific event information. */
8583219820Sjeff	uint64_t vendor_specific;
8584219820Sjeff
8585219820Sjeff	/* The following structures are valid only for trap types. */
8586219820Sjeff	union _trap {
8587219820Sjeff		struct {
8588219820Sjeff			uint16_t lid;
8589219820Sjeff			ib_net64_t port_guid;
8590219820Sjeff			uint8_t port_num;
8591219820Sjeff
8592219820Sjeff			/*
8593219820Sjeff			 * The following structure is valid only for
8594219820Sjeff			 * P_KEY, Q_KEY, and M_KEY violation traps.
8595219820Sjeff			 */
8596219820Sjeff			struct {
8597219820Sjeff				uint8_t sl;
8598219820Sjeff				uint16_t src_lid;
8599219820Sjeff				uint16_t dest_lid;
8600219820Sjeff				union _key {
8601219820Sjeff					uint16_t pkey;
8602219820Sjeff					uint32_t qkey;
8603219820Sjeff					uint64_t mkey;
8604219820Sjeff				} key;
8605219820Sjeff				uint32_t src_qp;
8606219820Sjeff				uint32_t dest_qp;
8607219820Sjeff				ib_gid_t src_gid;
8608219820Sjeff				ib_gid_t dest_gid;
8609219820Sjeff
8610219820Sjeff			} violation;
8611219820Sjeff
8612219820Sjeff		} info;
8613219820Sjeff
8614219820Sjeff		ib_net64_t sysimg_guid;
8615219820Sjeff
8616219820Sjeff	} trap;
8617219820Sjeff
8618219820Sjeff} ib_event_rec_t;
8619219820Sjeff/*******/
8620219820Sjeff
8621219820Sjeff/****d* Access Layer/ib_atomic_t
8622219820Sjeff* NAME
8623219820Sjeff*	ib_atomic_t
8624219820Sjeff*
8625219820Sjeff* DESCRIPTION
8626219820Sjeff*	Indicates atomicity levels supported by an adapter.
8627219820Sjeff*
8628219820Sjeff* SYNOPSIS
8629219820Sjeff*/
8630219820Sjefftypedef enum _ib_atomic_t {
8631219820Sjeff	IB_ATOMIC_NONE,
8632219820Sjeff	IB_ATOMIC_LOCAL,
8633219820Sjeff	IB_ATOMIC_GLOBAL
8634219820Sjeff} ib_atomic_t;
8635219820Sjeff/*
8636219820Sjeff* VALUES
8637219820Sjeff*	IB_ATOMIC_NONE
8638219820Sjeff*		Atomic operations not supported.
8639219820Sjeff*
8640219820Sjeff*	IB_ATOMIC_LOCAL
8641219820Sjeff*		Atomic operations guaranteed between QPs of a single CA.
8642219820Sjeff*
8643219820Sjeff*	IB_ATOMIC_GLOBAL
8644219820Sjeff*		Atomic operations are guaranteed between CA and any other entity
8645219820Sjeff*		in the system.
8646219820Sjeff*****/
8647219820Sjeff
8648219820Sjeff/****s* Access Layer/ib_port_cap_t
8649219820Sjeff* NAME
8650219820Sjeff*	ib_port_cap_t
8651219820Sjeff*
8652219820Sjeff* DESCRIPTION
8653219820Sjeff*	Indicates which management agents are currently available on the specified
8654219820Sjeff*	port.
8655219820Sjeff*
8656219820Sjeff* SYNOPSIS
8657219820Sjeff*/
8658219820Sjefftypedef struct _ib_port_cap {
8659219820Sjeff	boolean_t cm;
8660219820Sjeff	boolean_t snmp;
8661219820Sjeff	boolean_t dev_mgmt;
8662219820Sjeff	boolean_t vend;
8663219820Sjeff	boolean_t sm;
8664219820Sjeff	boolean_t sm_disable;
8665219820Sjeff	boolean_t qkey_ctr;
8666219820Sjeff	boolean_t pkey_ctr;
8667219820Sjeff	boolean_t notice;
8668219820Sjeff	boolean_t trap;
8669219820Sjeff	boolean_t apm;
8670219820Sjeff	boolean_t slmap;
8671219820Sjeff	boolean_t pkey_nvram;
8672219820Sjeff	boolean_t mkey_nvram;
8673219820Sjeff	boolean_t sysguid;
8674219820Sjeff	boolean_t dr_notice;
8675219820Sjeff	boolean_t boot_mgmt;
8676219820Sjeff	boolean_t capm_notice;
8677219820Sjeff	boolean_t reinit;
8678219820Sjeff	boolean_t ledinfo;
8679219820Sjeff	boolean_t port_active;
8680219820Sjeff
8681219820Sjeff} ib_port_cap_t;
8682219820Sjeff/*****/
8683219820Sjeff
8684219820Sjeff/****d* Access Layer/ib_init_type_t
8685219820Sjeff* NAME
8686219820Sjeff*	ib_init_type_t
8687219820Sjeff*
8688219820Sjeff* DESCRIPTION
8689219820Sjeff*	If supported by the HCA, the type of initialization requested by
8690219820Sjeff*	this port before SM moves it to the active or armed state.  If the
8691219820Sjeff*	SM implements reinitialization, it shall set these bits to indicate
8692219820Sjeff*	the type of initialization performed prior to activating the port.
8693219820Sjeff*	Otherwise, these bits shall be set to 0.
8694219820Sjeff*
8695219820Sjeff* SYNOPSIS
8696219820Sjeff*/
8697219820Sjefftypedef uint8_t ib_init_type_t;
8698219820Sjeff#define IB_INIT_TYPE_NO_LOAD			0x01
8699219820Sjeff#define IB_INIT_TYPE_PRESERVE_CONTENT		0x02
8700219820Sjeff#define IB_INIT_TYPE_PRESERVE_PRESENCE		0x04
8701219820Sjeff#define IB_INIT_TYPE_DO_NOT_RESUSCITATE		0x08
8702219820Sjeff/*****/
8703219820Sjeff
8704219820Sjeff/****s* Access Layer/ib_port_attr_mod_t
8705219820Sjeff* NAME
8706219820Sjeff*	ib_port_attr_mod_t
8707219820Sjeff*
8708219820Sjeff* DESCRIPTION
8709219820Sjeff*	Port attributes that may be modified.
8710219820Sjeff*
8711219820Sjeff* SYNOPSIS
8712219820Sjeff*/
8713219820Sjefftypedef struct _ib_port_attr_mod {
8714219820Sjeff	ib_port_cap_t cap;
8715219820Sjeff	uint16_t pkey_ctr;
8716219820Sjeff	uint16_t qkey_ctr;
8717219820Sjeff
8718219820Sjeff	ib_init_type_t init_type;
8719219820Sjeff	ib_net64_t system_image_guid;
8720219820Sjeff
8721219820Sjeff} ib_port_attr_mod_t;
8722219820Sjeff/*
8723219820Sjeff* SEE ALSO
8724219820Sjeff*	ib_port_cap_t
8725219820Sjeff*****/
8726219820Sjeff
8727219820Sjeff/****s* Access Layer/ib_port_attr_t
8728219820Sjeff* NAME
8729219820Sjeff*	ib_port_attr_t
8730219820Sjeff*
8731219820Sjeff* DESCRIPTION
8732219820Sjeff*	Information about a port on a given channel adapter.
8733219820Sjeff*
8734219820Sjeff* SYNOPSIS
8735219820Sjeff*/
8736219820Sjefftypedef struct _ib_port_attr {
8737219820Sjeff	ib_net64_t port_guid;
8738219820Sjeff	uint8_t port_num;
8739219820Sjeff	uint8_t mtu;
8740219820Sjeff	uint64_t max_msg_size;
8741219820Sjeff	ib_net16_t lid;
8742219820Sjeff	uint8_t lmc;
8743219820Sjeff
8744219820Sjeff	/*
8745219820Sjeff	 * LinkWidthSupported as defined in PortInfo.  Required to calculate
8746219820Sjeff	 * inter-packet delay (a.k.a. static rate).
8747219820Sjeff	 */
8748219820Sjeff	uint8_t link_width_supported;
8749219820Sjeff
8750219820Sjeff	uint16_t max_vls;
8751219820Sjeff
8752219820Sjeff	ib_net16_t sm_lid;
8753219820Sjeff	uint8_t sm_sl;
8754219820Sjeff	uint8_t link_state;
8755219820Sjeff
8756219820Sjeff	ib_init_type_t init_type_reply;	/* Optional */
8757219820Sjeff
8758219820Sjeff	/*
8759219820Sjeff	 * subnet_timeout:
8760219820Sjeff	 * The maximum expected subnet propagation delay to reach any port on
8761219820Sjeff	 * the subnet.  This value also determines the rate at which traps can
8762219820Sjeff	 * be generated from this node.
8763219820Sjeff	 *
8764219820Sjeff	 * timeout = 4.096 microseconds * 2^subnet_timeout
8765219820Sjeff	 */
8766219820Sjeff	uint8_t subnet_timeout;
8767219820Sjeff
8768219820Sjeff	ib_port_cap_t cap;
8769219820Sjeff	uint16_t pkey_ctr;
8770219820Sjeff	uint16_t qkey_ctr;
8771219820Sjeff
8772219820Sjeff	uint16_t num_gids;
8773219820Sjeff	uint16_t num_pkeys;
8774219820Sjeff	/*
8775219820Sjeff	 * Pointers at the end of the structure to allow doing a simple
8776219820Sjeff	 * memory comparison of contents up to the first pointer.
8777219820Sjeff	 */
8778219820Sjeff	ib_gid_t *p_gid_table;
8779219820Sjeff	ib_net16_t *p_pkey_table;
8780219820Sjeff
8781219820Sjeff} ib_port_attr_t;
8782219820Sjeff/*
8783219820Sjeff* SEE ALSO
8784219820Sjeff*	uint8_t, ib_port_cap_t, ib_link_states_t
8785219820Sjeff*****/
8786219820Sjeff
8787219820Sjeff/****s* Access Layer/ib_ca_attr_t
8788219820Sjeff* NAME
8789219820Sjeff*	ib_ca_attr_t
8790219820Sjeff*
8791219820Sjeff* DESCRIPTION
8792219820Sjeff*	Information about a channel adapter.
8793219820Sjeff*
8794219820Sjeff* SYNOPSIS
8795219820Sjeff*/
8796219820Sjefftypedef struct _ib_ca_attr {
8797219820Sjeff	ib_net64_t ca_guid;
8798219820Sjeff
8799219820Sjeff	uint32_t vend_id;
8800219820Sjeff	uint16_t dev_id;
8801219820Sjeff	uint16_t revision;
8802219820Sjeff	uint64_t fw_ver;
8803219820Sjeff
8804219820Sjeff	/*
8805219820Sjeff	 * Total size of the ca attributes in bytes
8806219820Sjeff	 */
8807219820Sjeff	uint32_t size;
8808219820Sjeff	uint32_t max_qps;
8809219820Sjeff	uint32_t max_wrs;
8810219820Sjeff
8811219820Sjeff	uint32_t max_sges;
8812219820Sjeff	uint32_t max_rd_sges;
8813219820Sjeff
8814219820Sjeff	uint32_t max_cqs;
8815219820Sjeff	uint32_t max_cqes;
8816219820Sjeff
8817219820Sjeff	uint32_t max_pds;
8818219820Sjeff
8819219820Sjeff	uint32_t init_regions;
8820219820Sjeff	uint64_t init_region_size;
8821219820Sjeff
8822219820Sjeff	uint32_t init_windows;
8823219820Sjeff	uint32_t max_addr_handles;
8824219820Sjeff
8825219820Sjeff	uint32_t max_partitions;
8826219820Sjeff
8827219820Sjeff	ib_atomic_t atomicity;
8828219820Sjeff
8829219820Sjeff	uint8_t max_qp_resp_res;
8830219820Sjeff	uint8_t max_eec_resp_res;
8831219820Sjeff	uint8_t max_resp_res;
8832219820Sjeff
8833219820Sjeff	uint8_t max_qp_init_depth;
8834219820Sjeff	uint8_t max_eec_init_depth;
8835219820Sjeff
8836219820Sjeff	uint32_t max_eecs;
8837219820Sjeff	uint32_t max_rdds;
8838219820Sjeff
8839219820Sjeff	uint32_t max_ipv6_qps;
8840219820Sjeff	uint32_t max_ether_qps;
8841219820Sjeff
8842219820Sjeff	uint32_t max_mcast_grps;
8843219820Sjeff	uint32_t max_mcast_qps;
8844219820Sjeff	uint32_t max_qps_per_mcast_grp;
8845219820Sjeff	uint32_t max_fmr;
8846219820Sjeff	uint32_t max_map_per_fmr;
8847219820Sjeff
8848219820Sjeff	/*
8849219820Sjeff	 * local_ack_delay:
8850219820Sjeff	 * Specifies the maximum time interval between the local CA receiving
8851219820Sjeff	 * a message and the transmission of the associated ACK or NAK.
8852219820Sjeff	 *
8853219820Sjeff	 * timeout = 4.096 microseconds * 2^local_ack_delay
8854219820Sjeff	 */
8855219820Sjeff	uint8_t local_ack_delay;
8856219820Sjeff
8857219820Sjeff	boolean_t bad_pkey_ctr_support;
8858219820Sjeff	boolean_t bad_qkey_ctr_support;
8859219820Sjeff	boolean_t raw_mcast_support;
8860219820Sjeff	boolean_t apm_support;
8861219820Sjeff	boolean_t av_port_check;
8862219820Sjeff	boolean_t change_primary_port;
8863219820Sjeff	boolean_t modify_wr_depth;
8864219820Sjeff	boolean_t current_qp_state_support;
8865219820Sjeff	boolean_t shutdown_port_capability;
8866219820Sjeff	boolean_t init_type_support;
8867219820Sjeff	boolean_t port_active_event_support;
8868219820Sjeff	boolean_t system_image_guid_support;
8869219820Sjeff	boolean_t hw_agents;
8870219820Sjeff
8871219820Sjeff	ib_net64_t system_image_guid;
8872219820Sjeff
8873219820Sjeff	uint32_t num_page_sizes;
8874219820Sjeff	uint8_t num_ports;
8875219820Sjeff
8876219820Sjeff	uint32_t *p_page_size;
8877219820Sjeff	ib_port_attr_t *p_port_attr;
8878219820Sjeff
8879219820Sjeff} ib_ca_attr_t;
8880219820Sjeff/*
8881219820Sjeff* FIELDS
8882219820Sjeff*	ca_guid
8883219820Sjeff*		GUID for this adapter.
8884219820Sjeff*
8885219820Sjeff*	vend_id
8886219820Sjeff*		IEEE vendor ID for this adapter
8887219820Sjeff*
8888219820Sjeff*	dev_id
8889219820Sjeff*		Device ID of this adapter. (typically from PCI device ID)
8890219820Sjeff*
8891219820Sjeff*	revision
8892219820Sjeff*		Revision ID of this adapter
8893219820Sjeff*
8894219820Sjeff*	fw_ver
8895219820Sjeff*		Device Firmware version.
8896219820Sjeff*
8897219820Sjeff*	size
8898219820Sjeff*		Total size in bytes for the HCA attributes.  This size includes total
8899219820Sjeff*		size required for all the variable members of the structure.  If a
8900219820Sjeff*		vendor requires to pass vendor specific fields beyond this structure,
8901219820Sjeff*		the HCA vendor can choose to report a larger size.  If a vendor is
8902219820Sjeff*		reporting extended vendor specific features, they should also provide
8903219820Sjeff*		appropriate access functions to aid with the required interpretation.
8904219820Sjeff*
8905219820Sjeff*	max_qps
8906219820Sjeff*		Maximum number of QP's supported by this HCA.
8907219820Sjeff*
8908219820Sjeff*	max_wrs
8909219820Sjeff*		Maximum number of work requests supported by this HCA.
8910219820Sjeff*
8911219820Sjeff*	max_sges
8912219820Sjeff*		Maximum number of scatter gather elements supported per work request.
8913219820Sjeff*
8914219820Sjeff*	max_rd_sges
8915219820Sjeff*		Maximum number of scatter gather elements supported for READ work
8916219820Sjeff*		requests for a Reliable Datagram QP.  This value must be zero if RD
8917219820Sjeff*		service is not supported.
8918219820Sjeff*
8919219820Sjeff*	max_cqs
8920219820Sjeff*		Maximum number of Completion Queues supported.
8921219820Sjeff*
8922219820Sjeff*	max_cqes
8923219820Sjeff*		Maximum number of CQ elements supported per CQ.
8924219820Sjeff*
8925219820Sjeff*	max_pds
8926219820Sjeff*		Maximum number of protection domains supported.
8927219820Sjeff*
8928219820Sjeff*	init_regions
8929219820Sjeff*		Initial number of memory regions supported.  These are only informative
8930219820Sjeff*		values.  HCA vendors can extended and grow these limits on demand.
8931219820Sjeff*
8932219820Sjeff*	init_region_size
8933219820Sjeff*		Initial limit on the size of the registered memory region.
8934219820Sjeff*
8935219820Sjeff*	init_windows
8936219820Sjeff*		Initial number of window entries supported.
8937219820Sjeff*
8938219820Sjeff*	max_addr_handles
8939219820Sjeff*		Maximum number of address handles supported.
8940219820Sjeff*
8941219820Sjeff*	max_partitions
8942219820Sjeff*		Maximum number of partitions supported.
8943219820Sjeff*
8944219820Sjeff*	atomicity
8945219820Sjeff*		Indicates level of atomic operations supported by this HCA.
8946219820Sjeff*
8947219820Sjeff*	max_qp_resp_res
8948219820Sjeff*	max_eec_resp_res
8949219820Sjeff*		Maximum limit on number of responder resources for incoming RDMA
8950219820Sjeff*		operations, on QPs and EEC's respectively.
8951219820Sjeff*
8952219820Sjeff*	max_resp_res
8953219820Sjeff*		Maximum number of responder resources per HCA, with this HCA used as
8954219820Sjeff*		the target.
8955219820Sjeff*
8956219820Sjeff*	max_qp_init_depth
8957219820Sjeff*	max_eec_init_depth
8958219820Sjeff*		Maximimum initiator depth per QP or EEC for initiating RDMA reads and
8959219820Sjeff*		atomic operations.
8960219820Sjeff*
8961219820Sjeff*	max_eecs
8962219820Sjeff*		Maximimum number of EEC's supported by the HCA.
8963219820Sjeff*
8964219820Sjeff*	max_rdds
8965219820Sjeff*		Maximum number of Reliable datagram domains supported.
8966219820Sjeff*
8967219820Sjeff*	max_ipv6_qps
8968219820Sjeff*	max_ether_qps
8969219820Sjeff*		Maximum number of IPV6 and raw ether QP's supported by this HCA.
8970219820Sjeff*
8971219820Sjeff*	max_mcast_grps
8972219820Sjeff*		Maximum number of multicast groups supported.
8973219820Sjeff*
8974219820Sjeff*	max_mcast_qps
8975219820Sjeff*		Maximum number of QP's that can support multicast operations.
8976219820Sjeff*
8977219820Sjeff*	max_qps_per_mcast_grp
8978219820Sjeff*		Maximum number of multicast QP's per multicast group.
8979219820Sjeff*
8980219820Sjeff*	local_ack_delay
8981219820Sjeff*		Specifies the maximum time interval between the local CA receiving
8982219820Sjeff*		a message and the transmission of the associated ACK or NAK.
8983219820Sjeff*		timeout = 4.096 microseconds * 2^local_ack_delay
8984219820Sjeff*
8985219820Sjeff*	bad_pkey_ctr_support
8986219820Sjeff*	bad_qkey_ctr_support
8987219820Sjeff*		Indicates support for the bad pkey and qkey counters.
8988219820Sjeff*
8989219820Sjeff*	raw_mcast_support
8990219820Sjeff*		Indicates support for raw packet multicast.
8991219820Sjeff*
8992219820Sjeff*	apm_support
8993219820Sjeff*		Indicates support for Automatic Path Migration.
8994219820Sjeff*
8995219820Sjeff*	av_port_check
8996219820Sjeff*		Indicates ability to check port number in address handles.
8997219820Sjeff*
8998219820Sjeff*	change_primary_port
8999219820Sjeff*		Indicates ability to change primary port for a QP or EEC during a
9000219820Sjeff*		SQD->RTS transition.
9001219820Sjeff*
9002219820Sjeff*	modify_wr_depth
9003219820Sjeff*		Indicates ability to modify QP depth during a modify QP operation.
9004219820Sjeff*		Check the verb specification for permitted states.
9005219820Sjeff*
9006219820Sjeff*	current_qp_state_support
9007219820Sjeff*		Indicates ability of the HCA to support the current QP state modifier
9008219820Sjeff*		during a modify QP operation.
9009219820Sjeff*
9010219820Sjeff*	shutdown_port_capability
9011219820Sjeff*		Shutdown port capability support indicator.
9012219820Sjeff*
9013219820Sjeff*	init_type_support
9014219820Sjeff*		Indicates init_type_reply and ability to set init_type is supported.
9015219820Sjeff*
9016219820Sjeff*	port_active_event_support
9017219820Sjeff*		Port active event support indicator.
9018219820Sjeff*
9019219820Sjeff*	system_image_guid_support
9020219820Sjeff*		System image GUID support indicator.
9021219820Sjeff*
9022219820Sjeff*	hw_agents
9023219820Sjeff*		Indicates SMA is implemented in HW.
9024219820Sjeff*
9025219820Sjeff*	system_image_guid
9026219820Sjeff*		Optional system image GUID.  This field is valid only if the
9027219820Sjeff*		system_image_guid_support flag is set.
9028219820Sjeff*
9029219820Sjeff*	num_page_sizes
9030219820Sjeff*		Indicates support for different page sizes supported by the HCA.
9031219820Sjeff*		The variable size array can be obtained from p_page_size.
9032219820Sjeff*
9033219820Sjeff*	num_ports
9034219820Sjeff*		Number of physical ports supported on this HCA.
9035219820Sjeff*
9036219820Sjeff*	p_page_size
9037219820Sjeff*		Array holding different page size supported.
9038219820Sjeff*
9039219820Sjeff*	p_port_attr
9040219820Sjeff*		Array holding port attributes.
9041219820Sjeff*
9042219820Sjeff* NOTES
9043219820Sjeff*	This structure contains the attributes of a channel adapter.  Users must
9044219820Sjeff*	call ib_copy_ca_attr to copy the contents of this structure to a new
9045219820Sjeff*	memory region.
9046219820Sjeff*
9047219820Sjeff* SEE ALSO
9048219820Sjeff*	ib_port_attr_t, ib_atomic_t, ib_copy_ca_attr
9049219820Sjeff*****/
9050219820Sjeff
9051219820Sjeff/****f* Access layer/ib_copy_ca_attr
9052219820Sjeff* NAME
9053219820Sjeff*	ib_copy_ca_attr
9054219820Sjeff*
9055219820Sjeff* DESCRIPTION
9056219820Sjeff*	Copies CA attributes.
9057219820Sjeff*
9058219820Sjeff* SYNOPSIS
9059219820Sjeff*/
9060219820Sjeffib_ca_attr_t *ib_copy_ca_attr(IN ib_ca_attr_t * const p_dest,
9061219820Sjeff			      IN const ib_ca_attr_t * const p_src);
9062219820Sjeff/*
9063219820Sjeff* PARAMETERS
9064219820Sjeff*	p_dest
9065219820Sjeff*		Pointer to the buffer that is the destination of the copy.
9066219820Sjeff*
9067219820Sjeff*	p_src
9068219820Sjeff*		Pointer to the CA attributes to copy.
9069219820Sjeff*
9070219820Sjeff* RETURN VALUE
9071219820Sjeff*	Pointer to the copied CA attributes.
9072219820Sjeff*
9073219820Sjeff* NOTES
9074219820Sjeff*	The buffer pointed to by the p_dest parameter must be at least the size
9075219820Sjeff*	specified in the size field of the buffer pointed to by p_src.
9076219820Sjeff*
9077219820Sjeff* SEE ALSO
9078219820Sjeff*	ib_ca_attr_t, ib_dup_ca_attr, ib_free_ca_attr
9079219820Sjeff*****/
9080219820Sjeff
9081219820Sjeff/****s* Access Layer/ib_av_attr_t
9082219820Sjeff* NAME
9083219820Sjeff*	ib_av_attr_t
9084219820Sjeff*
9085219820Sjeff* DESCRIPTION
9086219820Sjeff*	IBA address vector.
9087219820Sjeff*
9088219820Sjeff* SYNOPSIS
9089219820Sjeff*/
9090219820Sjefftypedef struct _ib_av_attr {
9091219820Sjeff	uint8_t port_num;
9092219820Sjeff
9093219820Sjeff	uint8_t sl;
9094219820Sjeff	ib_net16_t dlid;
9095219820Sjeff
9096219820Sjeff	boolean_t grh_valid;
9097219820Sjeff	ib_grh_t grh;
9098219820Sjeff	uint8_t static_rate;
9099219820Sjeff	uint8_t path_bits;
9100219820Sjeff
9101219820Sjeff	struct _av_conn {
9102219820Sjeff		uint8_t path_mtu;
9103219820Sjeff		uint8_t local_ack_timeout;
9104219820Sjeff		uint8_t seq_err_retry_cnt;
9105219820Sjeff		uint8_t rnr_retry_cnt;
9106219820Sjeff
9107219820Sjeff	} conn;
9108219820Sjeff
9109219820Sjeff} ib_av_attr_t;
9110219820Sjeff/*
9111219820Sjeff* SEE ALSO
9112219820Sjeff*	ib_gid_t
9113219820Sjeff*****/
9114219820Sjeff
9115219820Sjeff/****d* Access Layer/ib_qp_type_t
9116219820Sjeff* NAME
9117219820Sjeff*	ib_qp_type_t
9118219820Sjeff*
9119219820Sjeff* DESCRIPTION
9120219820Sjeff*	Indicates the type of queue pair being created.
9121219820Sjeff*
9122219820Sjeff* SYNOPSIS
9123219820Sjeff*/
9124219820Sjefftypedef enum _ib_qp_type {
9125219820Sjeff	IB_QPT_RELIABLE_CONN = 0,	/* Matches CM REQ transport type */
9126219820Sjeff	IB_QPT_UNRELIABLE_CONN = 1,	/* Matches CM REQ transport type */
9127219820Sjeff	IB_QPT_RELIABLE_DGRM = 2,	/* Matches CM REQ transport type */
9128219820Sjeff	IB_QPT_UNRELIABLE_DGRM,
9129219820Sjeff	IB_QPT_QP0,
9130219820Sjeff	IB_QPT_QP1,
9131219820Sjeff	IB_QPT_RAW_IPV6,
9132219820Sjeff	IB_QPT_RAW_ETHER,
9133219820Sjeff	IB_QPT_MAD,		/* InfiniBand Access Layer */
9134219820Sjeff	IB_QPT_QP0_ALIAS,	/* InfiniBand Access Layer */
9135219820Sjeff	IB_QPT_QP1_ALIAS	/* InfiniBand Access Layer */
9136219820Sjeff} ib_qp_type_t;
9137219820Sjeff/*
9138219820Sjeff* VALUES
9139219820Sjeff*	IB_QPT_RELIABLE_CONN
9140219820Sjeff*		Reliable, connected queue pair.
9141219820Sjeff*
9142219820Sjeff*	IB_QPT_UNRELIABLE_CONN
9143219820Sjeff*		Unreliable, connected queue pair.
9144219820Sjeff*
9145219820Sjeff*	IB_QPT_RELIABLE_DGRM
9146219820Sjeff*		Reliable, datagram queue pair.
9147219820Sjeff*
9148219820Sjeff*	IB_QPT_UNRELIABLE_DGRM
9149219820Sjeff*		Unreliable, datagram queue pair.
9150219820Sjeff*
9151219820Sjeff*	IB_QPT_QP0
9152219820Sjeff*		Queue pair 0.
9153219820Sjeff*
9154219820Sjeff*	IB_QPT_QP1
9155219820Sjeff*		Queue pair 1.
9156219820Sjeff*
9157219820Sjeff*	IB_QPT_RAW_DGRM
9158219820Sjeff*		Raw datagram queue pair.
9159219820Sjeff*
9160219820Sjeff*	IB_QPT_RAW_IPV6
9161219820Sjeff*		Raw IP version 6 queue pair.
9162219820Sjeff*
9163219820Sjeff*	IB_QPT_RAW_ETHER
9164219820Sjeff*		Raw Ethernet queue pair.
9165219820Sjeff*
9166219820Sjeff*	IB_QPT_MAD
9167219820Sjeff*		Unreliable, datagram queue pair that will send and receive management
9168219820Sjeff*		datagrams with assistance from the access layer.
9169219820Sjeff*
9170219820Sjeff*	IB_QPT_QP0_ALIAS
9171219820Sjeff*		Alias to queue pair 0.  Aliased QPs can only be created on an aliased
9172219820Sjeff*		protection domain.
9173219820Sjeff*
9174219820Sjeff*	IB_QPT_QP1_ALIAS
9175219820Sjeff*		Alias to queue pair 1.  Aliased QPs can only be created on an aliased
9176219820Sjeff*		protection domain.
9177219820Sjeff*****/
9178219820Sjeff
9179219820Sjeff/****d* Access Layer/ib_access_t
9180219820Sjeff* NAME
9181219820Sjeff*	ib_access_t
9182219820Sjeff*
9183219820Sjeff* DESCRIPTION
9184219820Sjeff*	Indicates the type of access is permitted on resources such as QPs,
9185219820Sjeff*	memory regions and memory windows.
9186219820Sjeff*
9187219820Sjeff* SYNOPSIS
9188219820Sjeff*/
9189219820Sjefftypedef uint32_t ib_access_t;
9190219820Sjeff#define IB_AC_RDMA_READ				0x00000001
9191219820Sjeff#define IB_AC_RDMA_WRITE			0x00000002
9192219820Sjeff#define IB_AC_ATOMIC				0x00000004
9193219820Sjeff#define IB_AC_LOCAL_WRITE			0x00000008
9194219820Sjeff#define IB_AC_MW_BIND				0x00000010
9195219820Sjeff/*
9196219820Sjeff* NOTES
9197219820Sjeff*	Users may combine access rights using a bit-wise or operation to specify
9198219820Sjeff*	additional access.  For example: IB_AC_RDMA_READ | IB_AC_RDMA_WRITE grants
9199219820Sjeff*	RDMA read and write access.
9200219820Sjeff*****/
9201219820Sjeff
9202219820Sjeff/****d* Access Layer/ib_qp_state_t
9203219820Sjeff* NAME
9204219820Sjeff*	ib_qp_state_t
9205219820Sjeff*
9206219820Sjeff* DESCRIPTION
9207219820Sjeff*	Indicates or sets the state of a queue pair.  The current state of a queue
9208219820Sjeff*	pair is returned through the ib_qp_query call and set via the
9209219820Sjeff*	ib_qp_modify call.
9210219820Sjeff*
9211219820Sjeff* SYNOPSIS
9212219820Sjeff*/
9213219820Sjefftypedef uint32_t ib_qp_state_t;
9214219820Sjeff#define IB_QPS_RESET				0x00000001
9215219820Sjeff#define IB_QPS_INIT				0x00000002
9216219820Sjeff#define IB_QPS_RTR				0x00000004
9217219820Sjeff#define IB_QPS_RTS				0x00000008
9218219820Sjeff#define IB_QPS_SQD				0x00000010
9219219820Sjeff#define IB_QPS_SQD_DRAINING			0x00000030
9220219820Sjeff#define IB_QPS_SQD_DRAINED			0x00000050
9221219820Sjeff#define IB_QPS_SQERR				0x00000080
9222219820Sjeff#define IB_QPS_ERROR				0x00000100
9223219820Sjeff#define IB_QPS_TIME_WAIT			0xDEAD0000	/* InfiniBand Access Layer */
9224219820Sjeff/*****/
9225219820Sjeff
9226219820Sjeff/****d* Access Layer/ib_apm_state_t
9227219820Sjeff* NAME
9228219820Sjeff*	ib_apm_state_t
9229219820Sjeff*
9230219820Sjeff* DESCRIPTION
9231219820Sjeff*	The current automatic path migration state of a queue pair
9232219820Sjeff*
9233219820Sjeff* SYNOPSIS
9234219820Sjeff*/
9235219820Sjefftypedef enum _ib_apm_state {
9236219820Sjeff	IB_APM_MIGRATED = 1,
9237219820Sjeff	IB_APM_REARM,
9238219820Sjeff	IB_APM_ARMED
9239219820Sjeff} ib_apm_state_t;
9240219820Sjeff/*****/
9241219820Sjeff
9242219820Sjeff/****s* Access Layer/ib_qp_create_t
9243219820Sjeff* NAME
9244219820Sjeff*	ib_qp_create_t
9245219820Sjeff*
9246219820Sjeff* DESCRIPTION
9247219820Sjeff*	Attributes used to initialize a queue pair at creation time.
9248219820Sjeff*
9249219820Sjeff* SYNOPSIS
9250219820Sjeff*/
9251219820Sjefftypedef struct _ib_qp_create {
9252219820Sjeff	ib_qp_type_t qp_type;
9253219820Sjeff
9254219820Sjeff	ib_rdd_handle_t h_rdd;
9255219820Sjeff
9256219820Sjeff	uint32_t sq_depth;
9257219820Sjeff	uint32_t rq_depth;
9258219820Sjeff	uint32_t sq_sge;
9259219820Sjeff	uint32_t rq_sge;
9260219820Sjeff
9261219820Sjeff	ib_cq_handle_t h_sq_cq;
9262219820Sjeff	ib_cq_handle_t h_rq_cq;
9263219820Sjeff
9264219820Sjeff	boolean_t sq_signaled;
9265219820Sjeff
9266219820Sjeff} ib_qp_create_t;
9267219820Sjeff/*
9268219820Sjeff* FIELDS
9269219820Sjeff*	type
9270219820Sjeff*		Specifies the type of queue pair to create.
9271219820Sjeff*
9272219820Sjeff*	h_rdd
9273219820Sjeff*		A handle to a reliable datagram domain to associate with the queue
9274219820Sjeff*		pair.  This field is ignored if the queue pair is not a reliable
9275219820Sjeff*		datagram type queue pair.
9276219820Sjeff*
9277219820Sjeff*	sq_depth
9278219820Sjeff*		Indicates the requested maximum number of work requests that may be
9279219820Sjeff*		outstanding on the queue pair's send queue.  This value must be less
9280219820Sjeff*		than or equal to the maximum reported by the channel adapter associated
9281219820Sjeff*		with the queue pair.
9282219820Sjeff*
9283219820Sjeff*	rq_depth
9284219820Sjeff*		Indicates the requested maximum number of work requests that may be
9285219820Sjeff*		outstanding on the queue pair's receive queue.  This value must be less
9286219820Sjeff*		than or equal to the maximum reported by the channel adapter associated
9287219820Sjeff*		with the queue pair.
9288219820Sjeff*
9289219820Sjeff*	sq_sge
9290219820Sjeff*		Indicates the maximum number scatter-gather elements that may be
9291219820Sjeff*		given in a send work request.  This value must be less
9292219820Sjeff*		than or equal to the maximum reported by the channel adapter associated
9293219820Sjeff*		with the queue pair.
9294219820Sjeff*
9295219820Sjeff*	rq_sge
9296219820Sjeff*		Indicates the maximum number scatter-gather elements that may be
9297219820Sjeff*		given in a receive work request.  This value must be less
9298219820Sjeff*		than or equal to the maximum reported by the channel adapter associated
9299219820Sjeff*		with the queue pair.
9300219820Sjeff*
9301219820Sjeff*	h_sq_cq
9302219820Sjeff*		A handle to the completion queue that will be used to report send work
9303219820Sjeff*		request completions.  This handle must be NULL if the type is
9304219820Sjeff*		IB_QPT_MAD, IB_QPT_QP0_ALIAS, or IB_QPT_QP1_ALIAS.
9305219820Sjeff*
9306219820Sjeff*	h_rq_cq
9307219820Sjeff*		A handle to the completion queue that will be used to report receive
9308219820Sjeff*		work request completions.  This handle must be NULL if the type is
9309219820Sjeff*		IB_QPT_MAD, IB_QPT_QP0_ALIAS, or IB_QPT_QP1_ALIAS.
9310219820Sjeff*
9311219820Sjeff*	sq_signaled
9312219820Sjeff*		A flag that is used to indicate whether the queue pair will signal
9313219820Sjeff*		an event upon completion of a send work request.  If set to
9314219820Sjeff*		TRUE, send work requests will always generate a completion
9315219820Sjeff*		event.  If set to FALSE, a completion event will only be
9316219820Sjeff*		generated if the send_opt field of the send work request has the
9317219820Sjeff*		IB_SEND_OPT_SIGNALED flag set.
9318219820Sjeff*
9319219820Sjeff* SEE ALSO
9320219820Sjeff*	ib_qp_type_t, ib_qp_attr_t
9321219820Sjeff*****/
9322219820Sjeff
9323219820Sjeff/****s* Access Layer/ib_qp_attr_t
9324219820Sjeff* NAME
9325219820Sjeff*	ib_qp_attr_t
9326219820Sjeff*
9327219820Sjeff* DESCRIPTION
9328219820Sjeff*	Queue pair attributes returned through ib_query_qp.
9329219820Sjeff*
9330219820Sjeff* SYNOPSIS
9331219820Sjeff*/
9332219820Sjefftypedef struct _ib_qp_attr {
9333219820Sjeff	ib_pd_handle_t h_pd;
9334219820Sjeff	ib_qp_type_t qp_type;
9335219820Sjeff	ib_access_t access_ctrl;
9336219820Sjeff	uint16_t pkey_index;
9337219820Sjeff
9338219820Sjeff	uint32_t sq_depth;
9339219820Sjeff	uint32_t rq_depth;
9340219820Sjeff	uint32_t sq_sge;
9341219820Sjeff	uint32_t rq_sge;
9342219820Sjeff	uint8_t init_depth;
9343219820Sjeff	uint8_t resp_res;
9344219820Sjeff
9345219820Sjeff	ib_cq_handle_t h_sq_cq;
9346219820Sjeff	ib_cq_handle_t h_rq_cq;
9347219820Sjeff	ib_rdd_handle_t h_rdd;
9348219820Sjeff
9349219820Sjeff	boolean_t sq_signaled;
9350219820Sjeff
9351219820Sjeff	ib_qp_state_t state;
9352219820Sjeff	ib_net32_t num;
9353219820Sjeff	ib_net32_t dest_num;
9354219820Sjeff	ib_net32_t qkey;
9355219820Sjeff
9356219820Sjeff	ib_net32_t sq_psn;
9357219820Sjeff	ib_net32_t rq_psn;
9358219820Sjeff
9359219820Sjeff	uint8_t primary_port;
9360219820Sjeff	uint8_t alternate_port;
9361219820Sjeff	ib_av_attr_t primary_av;
9362219820Sjeff	ib_av_attr_t alternate_av;
9363219820Sjeff	ib_apm_state_t apm_state;
9364219820Sjeff
9365219820Sjeff} ib_qp_attr_t;
9366219820Sjeff/*
9367219820Sjeff* FIELDS
9368219820Sjeff*	h_pd
9369219820Sjeff*		This is a handle to a protection domain associated with the queue
9370219820Sjeff*		pair, or NULL if the queue pair is type IB_QPT_RELIABLE_DGRM.
9371219820Sjeff*
9372219820Sjeff* NOTES
9373219820Sjeff*	Other fields are defined by the Infiniband specification.
9374219820Sjeff*
9375219820Sjeff* SEE ALSO
9376219820Sjeff*	ib_qp_type_t, ib_access_t, ib_qp_state_t, ib_av_attr_t, ib_apm_state_t
9377219820Sjeff*****/
9378219820Sjeff
9379219820Sjeff/****d* Access Layer/ib_qp_opts_t
9380219820Sjeff* NAME
9381219820Sjeff*	ib_qp_opts_t
9382219820Sjeff*
9383219820Sjeff* DESCRIPTION
9384219820Sjeff*	Optional fields supplied in the modify QP operation.
9385219820Sjeff*
9386219820Sjeff* SYNOPSIS
9387219820Sjeff*/
9388219820Sjefftypedef uint32_t ib_qp_opts_t;
9389219820Sjeff#define IB_MOD_QP_ALTERNATE_AV			0x00000001
9390219820Sjeff#define IB_MOD_QP_PKEY				0x00000002
9391219820Sjeff#define IB_MOD_QP_APM_STATE			0x00000004
9392219820Sjeff#define IB_MOD_QP_PRIMARY_AV			0x00000008
9393219820Sjeff#define IB_MOD_QP_RNR_NAK_TIMEOUT		0x00000010
9394219820Sjeff#define IB_MOD_QP_RESP_RES			0x00000020
9395219820Sjeff#define IB_MOD_QP_INIT_DEPTH			0x00000040
9396219820Sjeff#define IB_MOD_QP_PRIMARY_PORT			0x00000080
9397219820Sjeff#define IB_MOD_QP_ACCESS_CTRL			0x00000100
9398219820Sjeff#define IB_MOD_QP_QKEY				0x00000200
9399219820Sjeff#define IB_MOD_QP_SQ_DEPTH			0x00000400
9400219820Sjeff#define IB_MOD_QP_RQ_DEPTH			0x00000800
9401219820Sjeff#define IB_MOD_QP_CURRENT_STATE			0x00001000
9402219820Sjeff#define IB_MOD_QP_RETRY_CNT			0x00002000
9403219820Sjeff#define IB_MOD_QP_LOCAL_ACK_TIMEOUT		0x00004000
9404219820Sjeff#define IB_MOD_QP_RNR_RETRY_CNT			0x00008000
9405219820Sjeff/*
9406219820Sjeff* SEE ALSO
9407219820Sjeff*	ib_qp_mod_t
9408219820Sjeff*****/
9409219820Sjeff
9410219820Sjeff/****s* Access Layer/ib_qp_mod_t
9411219820Sjeff* NAME
9412219820Sjeff*	ib_qp_mod_t
9413219820Sjeff*
9414219820Sjeff* DESCRIPTION
9415219820Sjeff*	Information needed to change the state of a queue pair through the
9416219820Sjeff*	ib_modify_qp call.
9417219820Sjeff*
9418219820Sjeff* SYNOPSIS
9419219820Sjeff*/
9420219820Sjefftypedef struct _ib_qp_mod {
9421219820Sjeff	ib_qp_state_t req_state;
9422219820Sjeff
9423219820Sjeff	union _qp_state {
9424219820Sjeff		struct _qp_reset {
9425219820Sjeff			/*
9426219820Sjeff			 * Time, in milliseconds, that the QP needs to spend in
9427219820Sjeff			 * the time wait state before being reused.
9428219820Sjeff			 */
9429219820Sjeff			uint32_t timewait;
9430219820Sjeff
9431219820Sjeff		} reset;
9432219820Sjeff
9433219820Sjeff		struct _qp_init {
9434219820Sjeff			ib_qp_opts_t opts;
9435219820Sjeff			uint8_t primary_port;
9436219820Sjeff			ib_net32_t qkey;
9437219820Sjeff			uint16_t pkey_index;
9438219820Sjeff			ib_access_t access_ctrl;
9439219820Sjeff
9440219820Sjeff		} init;
9441219820Sjeff
9442219820Sjeff		struct _qp_rtr {
9443219820Sjeff			ib_net32_t rq_psn;
9444219820Sjeff			ib_net32_t dest_qp;
9445219820Sjeff			ib_av_attr_t primary_av;
9446219820Sjeff			uint8_t resp_res;
9447219820Sjeff
9448219820Sjeff			ib_qp_opts_t opts;
9449219820Sjeff			ib_av_attr_t alternate_av;
9450219820Sjeff			ib_net32_t qkey;
9451219820Sjeff			uint16_t pkey_index;
9452219820Sjeff			ib_access_t access_ctrl;
9453219820Sjeff			uint32_t sq_depth;
9454219820Sjeff			uint32_t rq_depth;
9455219820Sjeff			uint8_t rnr_nak_timeout;
9456219820Sjeff
9457219820Sjeff		} rtr;
9458219820Sjeff
9459219820Sjeff		struct _qp_rts {
9460219820Sjeff			ib_net32_t sq_psn;
9461219820Sjeff			uint8_t retry_cnt;
9462219820Sjeff			uint8_t rnr_retry_cnt;
9463219820Sjeff			uint8_t rnr_nak_timeout;
9464219820Sjeff			uint8_t local_ack_timeout;
9465219820Sjeff			uint8_t init_depth;
9466219820Sjeff
9467219820Sjeff			ib_qp_opts_t opts;
9468219820Sjeff			ib_qp_state_t current_state;
9469219820Sjeff			ib_net32_t qkey;
9470219820Sjeff			ib_access_t access_ctrl;
9471219820Sjeff			uint8_t resp_res;
9472219820Sjeff
9473219820Sjeff			ib_av_attr_t primary_av;
9474219820Sjeff			ib_av_attr_t alternate_av;
9475219820Sjeff
9476219820Sjeff			uint32_t sq_depth;
9477219820Sjeff			uint32_t rq_depth;
9478219820Sjeff
9479219820Sjeff			ib_apm_state_t apm_state;
9480219820Sjeff			uint8_t primary_port;
9481219820Sjeff			uint16_t pkey_index;
9482219820Sjeff
9483219820Sjeff		} rts;
9484219820Sjeff
9485219820Sjeff		struct _qp_sqd {
9486219820Sjeff			boolean_t sqd_event;
9487219820Sjeff
9488219820Sjeff		} sqd;
9489219820Sjeff
9490219820Sjeff	} state;
9491219820Sjeff
9492219820Sjeff} ib_qp_mod_t;
9493219820Sjeff/*
9494219820Sjeff* SEE ALSO
9495219820Sjeff*	ib_qp_state_t, ib_access_t, ib_av_attr_t, ib_apm_state_t
9496219820Sjeff*****/
9497219820Sjeff
9498219820Sjeff/****s* Access Layer/ib_eec_attr_t
9499219820Sjeff* NAME
9500219820Sjeff*	ib_eec_attr_t
9501219820Sjeff*
9502219820Sjeff* DESCRIPTION
9503219820Sjeff*	Information about an end-to-end context.
9504219820Sjeff*
9505219820Sjeff* SYNOPSIS
9506219820Sjeff*/
9507219820Sjefftypedef struct _ib_eec_attr {
9508219820Sjeff	ib_qp_state_t state;
9509219820Sjeff	ib_rdd_handle_t h_rdd;
9510219820Sjeff	ib_net32_t local_eecn;
9511219820Sjeff
9512219820Sjeff	ib_net32_t sq_psn;
9513219820Sjeff	ib_net32_t rq_psn;
9514219820Sjeff	uint8_t primary_port;
9515219820Sjeff	uint16_t pkey_index;
9516219820Sjeff	uint32_t resp_res;
9517219820Sjeff	ib_net32_t remote_eecn;
9518219820Sjeff	uint32_t init_depth;
9519219820Sjeff	uint32_t dest_num;	// ??? What is this?
9520219820Sjeff	ib_av_attr_t primary_av;
9521219820Sjeff	ib_av_attr_t alternate_av;
9522219820Sjeff	ib_apm_state_t apm_state;
9523219820Sjeff
9524219820Sjeff} ib_eec_attr_t;
9525219820Sjeff/*
9526219820Sjeff* SEE ALSO
9527219820Sjeff*	ib_qp_state_t, ib_av_attr_t, ib_apm_state_t
9528219820Sjeff*****/
9529219820Sjeff
9530219820Sjeff/****d* Access Layer/ib_eec_opts_t
9531219820Sjeff* NAME
9532219820Sjeff*	ib_eec_opts_t
9533219820Sjeff*
9534219820Sjeff* DESCRIPTION
9535219820Sjeff*	Optional fields supplied in the modify EEC operation.
9536219820Sjeff*
9537219820Sjeff* SYNOPSIS
9538219820Sjeff*/
9539219820Sjefftypedef uint32_t ib_eec_opts_t;
9540219820Sjeff#define IB_MOD_EEC_ALTERNATE_AV			0x00000001
9541219820Sjeff#define IB_MOD_EEC_PKEY				0x00000002
9542219820Sjeff#define IB_MOD_EEC_APM_STATE			0x00000004
9543219820Sjeff#define IB_MOD_EEC_PRIMARY_AV			0x00000008
9544219820Sjeff#define IB_MOD_EEC_RNR				0x00000010
9545219820Sjeff#define IB_MOD_EEC_RESP_RES			0x00000020
9546219820Sjeff#define IB_MOD_EEC_OUTSTANDING			0x00000040
9547219820Sjeff#define IB_MOD_EEC_PRIMARY_PORT			0x00000080
9548219820Sjeff/*
9549219820Sjeff* NOTES
9550219820Sjeff*
9551219820Sjeff*
9552219820Sjeff*****/
9553219820Sjeff
9554219820Sjeff/****s* Access Layer/ib_eec_mod_t
9555219820Sjeff* NAME
9556219820Sjeff*	ib_eec_mod_t
9557219820Sjeff*
9558219820Sjeff* DESCRIPTION
9559219820Sjeff*	Information needed to change the state of an end-to-end context through
9560219820Sjeff*	the ib_modify_eec function.
9561219820Sjeff*
9562219820Sjeff* SYNOPSIS
9563219820Sjeff*/
9564219820Sjefftypedef struct _ib_eec_mod {
9565219820Sjeff	ib_qp_state_t req_state;
9566219820Sjeff
9567219820Sjeff	union _eec_state {
9568219820Sjeff		struct _eec_init {
9569219820Sjeff			uint8_t primary_port;
9570219820Sjeff			uint16_t pkey_index;
9571219820Sjeff
9572219820Sjeff		} init;
9573219820Sjeff
9574219820Sjeff		struct _eec_rtr {
9575219820Sjeff			ib_net32_t rq_psn;
9576219820Sjeff			ib_net32_t remote_eecn;
9577219820Sjeff			ib_av_attr_t primary_av;
9578219820Sjeff			uint8_t resp_res;
9579219820Sjeff
9580219820Sjeff			ib_eec_opts_t opts;
9581219820Sjeff			ib_av_attr_t alternate_av;
9582219820Sjeff			uint16_t pkey_index;
9583219820Sjeff
9584219820Sjeff		} rtr;
9585219820Sjeff
9586219820Sjeff		struct _eec_rts {
9587219820Sjeff			ib_net32_t sq_psn;
9588219820Sjeff			uint8_t retry_cnt;
9589219820Sjeff			uint8_t rnr_retry_cnt;
9590219820Sjeff			uint8_t local_ack_timeout;
9591219820Sjeff			uint8_t init_depth;
9592219820Sjeff
9593219820Sjeff			ib_eec_opts_t opts;
9594219820Sjeff			ib_av_attr_t alternate_av;
9595219820Sjeff			ib_apm_state_t apm_state;
9596219820Sjeff
9597219820Sjeff			ib_av_attr_t primary_av;
9598219820Sjeff			uint16_t pkey_index;
9599219820Sjeff			uint8_t primary_port;
9600219820Sjeff
9601219820Sjeff		} rts;
9602219820Sjeff
9603219820Sjeff		struct _eec_sqd {
9604219820Sjeff			boolean_t sqd_event;
9605219820Sjeff
9606219820Sjeff		} sqd;
9607219820Sjeff
9608219820Sjeff	} state;
9609219820Sjeff
9610219820Sjeff} ib_eec_mod_t;
9611219820Sjeff/*
9612219820Sjeff* SEE ALSO
9613219820Sjeff*	ib_qp_state_t, ib_av_attr_t, ib_apm_state_t
9614219820Sjeff*****/
9615219820Sjeff
9616219820Sjeff/****d* Access Layer/ib_wr_type_t
9617219820Sjeff* NAME
9618219820Sjeff*	ib_wr_type_t
9619219820Sjeff*
9620219820Sjeff* DESCRIPTION
9621219820Sjeff*	Identifies the type of work request posted to a queue pair.
9622219820Sjeff*
9623219820Sjeff* SYNOPSIS
9624219820Sjeff*/
9625219820Sjefftypedef enum _ib_wr_type_t {
9626219820Sjeff	WR_SEND = 1,
9627219820Sjeff	WR_RDMA_WRITE,
9628219820Sjeff	WR_RDMA_READ,
9629219820Sjeff	WR_COMPARE_SWAP,
9630219820Sjeff	WR_FETCH_ADD
9631219820Sjeff} ib_wr_type_t;
9632219820Sjeff/*****/
9633219820Sjeff
9634219820Sjeff/****s* Access Layer/ib_local_ds_t
9635219820Sjeff* NAME
9636219820Sjeff*	ib_local_ds_t
9637219820Sjeff*
9638219820Sjeff* DESCRIPTION
9639219820Sjeff*	Local data segment information referenced by send and receive work
9640219820Sjeff*	requests.  This is used to specify local data buffers used as part of a
9641219820Sjeff*	work request.
9642219820Sjeff*
9643219820Sjeff* SYNOPSIS
9644219820Sjeff*/
9645219820Sjefftypedef struct _ib_local_ds {
9646219820Sjeff	void *vaddr;
9647219820Sjeff	uint32_t length;
9648219820Sjeff	uint32_t lkey;
9649219820Sjeff
9650219820Sjeff} ib_local_ds_t;
9651219820Sjeff/*****/
9652219820Sjeff
9653219820Sjeff/****d* Access Layer/ib_send_opt_t
9654219820Sjeff* NAME
9655219820Sjeff*	ib_send_opt_t
9656219820Sjeff*
9657219820Sjeff* DESCRIPTION
9658219820Sjeff*	Optional flags used when posting send work requests.  These flags
9659219820Sjeff*	indicate specific processing for the send operation.
9660219820Sjeff*
9661219820Sjeff* SYNOPSIS
9662219820Sjeff*/
9663219820Sjefftypedef uint32_t ib_send_opt_t;
9664219820Sjeff#define IB_SEND_OPT_IMMEDIATE		0x00000001
9665219820Sjeff#define IB_SEND_OPT_FENCE		0x00000002
9666219820Sjeff#define IB_SEND_OPT_SIGNALED		0x00000004
9667219820Sjeff#define IB_SEND_OPT_SOLICITED		0x00000008
9668219820Sjeff#define IB_SEND_OPT_INLINE		0x00000010
9669219820Sjeff#define IB_SEND_OPT_LOCAL		0x00000020
9670219820Sjeff#define IB_SEND_OPT_VEND_MASK		0xFFFF0000
9671219820Sjeff/*
9672219820Sjeff* VALUES
9673219820Sjeff*	The following flags determine the behavior of a work request when
9674219820Sjeff*	posted to the send side.
9675219820Sjeff*
9676219820Sjeff*	IB_SEND_OPT_IMMEDIATE
9677219820Sjeff*		Send immediate data with the given request.
9678219820Sjeff*
9679219820Sjeff*	IB_SEND_OPT_FENCE
9680219820Sjeff*		The operation is fenced.  Complete all pending send operations
9681219820Sjeff*		before processing this request.
9682219820Sjeff*
9683219820Sjeff*	IB_SEND_OPT_SIGNALED
9684219820Sjeff*		If the queue pair is configured for signaled completion, then
9685219820Sjeff*		generate a completion queue entry when this request completes.
9686219820Sjeff*
9687219820Sjeff*	IB_SEND_OPT_SOLICITED
9688219820Sjeff*		Set the solicited bit on the last packet of this request.
9689219820Sjeff*
9690219820Sjeff*	IB_SEND_OPT_INLINE
9691219820Sjeff*		Indicates that the requested send data should be copied into a VPD
9692219820Sjeff*		owned data buffer.  This flag permits the user to issue send operations
9693219820Sjeff*		without first needing to register the buffer(s) associated with the
9694219820Sjeff*		send operation.  Verb providers that support this operation may place
9695219820Sjeff*		vendor specific restrictions on the size of send operation that may
9696219820Sjeff*		be performed as inline.
9697219820Sjeff*
9698219820Sjeff*
9699219820Sjeff*  IB_SEND_OPT_LOCAL
9700219820Sjeff*     Indicates that a sent MAD request should be given to the local VPD for
9701219820Sjeff*     processing.  MADs sent using this option are not placed on the wire.
9702219820Sjeff*     This send option is only valid for MAD send operations.
9703219820Sjeff*
9704219820Sjeff*
9705219820Sjeff*	IB_SEND_OPT_VEND_MASK
9706219820Sjeff*		This mask indicates bits reserved in the send options that may be used
9707219820Sjeff*		by the verbs provider to indicate vendor specific options.  Bits set
9708219820Sjeff*		in this area of the send options are ignored by the Access Layer, but
9709219820Sjeff*		may have specific meaning to the underlying VPD.
9710219820Sjeff*
9711219820Sjeff*****/
9712219820Sjeff
9713219820Sjeff/****s* Access Layer/ib_send_wr_t
9714219820Sjeff* NAME
9715219820Sjeff*	ib_send_wr_t
9716219820Sjeff*
9717219820Sjeff* DESCRIPTION
9718219820Sjeff*	Information used to submit a work request to the send queue of a queue
9719219820Sjeff*	pair.
9720219820Sjeff*
9721219820Sjeff* SYNOPSIS
9722219820Sjeff*/
9723219820Sjefftypedef struct _ib_send_wr {
9724219820Sjeff	struct _ib_send_wr *p_next;
9725219820Sjeff	uint64_t wr_id;
9726219820Sjeff	ib_wr_type_t wr_type;
9727219820Sjeff	ib_send_opt_t send_opt;
9728219820Sjeff	uint32_t num_ds;
9729219820Sjeff	ib_local_ds_t *ds_array;
9730219820Sjeff	ib_net32_t immediate_data;
9731219820Sjeff
9732219820Sjeff	union _send_dgrm {
9733219820Sjeff		struct _send_ud {
9734219820Sjeff			ib_net32_t remote_qp;
9735219820Sjeff			ib_net32_t remote_qkey;
9736219820Sjeff			ib_av_handle_t h_av;
9737219820Sjeff
9738219820Sjeff		} ud;
9739219820Sjeff
9740219820Sjeff		struct _send_rd {
9741219820Sjeff			ib_net32_t remote_qp;
9742219820Sjeff			ib_net32_t remote_qkey;
9743219820Sjeff			ib_net32_t eecn;
9744219820Sjeff
9745219820Sjeff		} rd;
9746219820Sjeff
9747219820Sjeff		struct _send_raw_ether {
9748219820Sjeff			ib_net16_t dest_lid;
9749219820Sjeff			uint8_t path_bits;
9750219820Sjeff			uint8_t sl;
9751219820Sjeff			uint8_t max_static_rate;
9752219820Sjeff			ib_net16_t ether_type;
9753219820Sjeff
9754219820Sjeff		} raw_ether;
9755219820Sjeff
9756219820Sjeff		struct _send_raw_ipv6 {
9757219820Sjeff			ib_net16_t dest_lid;
9758219820Sjeff			uint8_t path_bits;
9759219820Sjeff			uint8_t sl;
9760219820Sjeff			uint8_t max_static_rate;
9761219820Sjeff
9762219820Sjeff		} raw_ipv6;
9763219820Sjeff
9764219820Sjeff	} dgrm;
9765219820Sjeff
9766219820Sjeff	struct _send_remote_ops {
9767219820Sjeff		uint64_t vaddr;
9768219820Sjeff		uint32_t rkey;
9769219820Sjeff
9770219820Sjeff		ib_net64_t atomic1;
9771219820Sjeff		ib_net64_t atomic2;
9772219820Sjeff
9773219820Sjeff	} remote_ops;
9774219820Sjeff
9775219820Sjeff} ib_send_wr_t;
9776219820Sjeff/*
9777219820Sjeff* FIELDS
9778219820Sjeff*	p_next
9779219820Sjeff*		A pointer used to chain work requests together.  This permits multiple
9780219820Sjeff*		work requests to be posted to a queue pair through a single function
9781219820Sjeff*		call.  This value is set to NULL to mark the end of the chain.
9782219820Sjeff*
9783219820Sjeff*	wr_id
9784219820Sjeff*		A 64-bit work request identifier that is returned to the consumer
9785219820Sjeff*		as part of the work completion.
9786219820Sjeff*
9787219820Sjeff*	wr_type
9788219820Sjeff*		The type of work request being submitted to the send queue.
9789219820Sjeff*
9790219820Sjeff*	send_opt
9791219820Sjeff*		Optional send control parameters.
9792219820Sjeff*
9793219820Sjeff*	num_ds
9794219820Sjeff*		Number of local data segments specified by this work request.
9795219820Sjeff*
9796219820Sjeff*	ds_array
9797219820Sjeff*		A reference to an array of local data segments used by the send
9798219820Sjeff*		operation.
9799219820Sjeff*
9800219820Sjeff*	immediate_data
9801219820Sjeff*		32-bit field sent as part of a message send or RDMA write operation.
9802219820Sjeff*		This field is only valid if the send_opt flag IB_SEND_OPT_IMMEDIATE
9803219820Sjeff*		has been set.
9804219820Sjeff*
9805219820Sjeff*	dgrm.ud.remote_qp
9806219820Sjeff*		Identifies the destination queue pair of an unreliable datagram send
9807219820Sjeff*		operation.
9808219820Sjeff*
9809219820Sjeff*	dgrm.ud.remote_qkey
9810219820Sjeff*		The qkey for the destination queue pair.
9811219820Sjeff*
9812219820Sjeff*	dgrm.ud.h_av
9813219820Sjeff*		An address vector that specifies the path information used to route
9814219820Sjeff*		the outbound datagram to the destination queue pair.
9815219820Sjeff*
9816219820Sjeff*	dgrm.rd.remote_qp
9817219820Sjeff*		Identifies the destination queue pair of a reliable datagram send
9818219820Sjeff*		operation.
9819219820Sjeff*
9820219820Sjeff*	dgrm.rd.remote_qkey
9821219820Sjeff*		The qkey for the destination queue pair.
9822219820Sjeff*
9823219820Sjeff*	dgrm.rd.eecn
9824219820Sjeff*		The local end-to-end context number to use with the reliable datagram
9825219820Sjeff*		send operation.
9826219820Sjeff*
9827219820Sjeff*	dgrm.raw_ether.dest_lid
9828219820Sjeff*		The destination LID that will receive this raw ether send.
9829219820Sjeff*
9830219820Sjeff*	dgrm.raw_ether.path_bits
9831219820Sjeff*		path bits...
9832219820Sjeff*
9833219820Sjeff*	dgrm.raw_ether.sl
9834219820Sjeff*		service level...
9835219820Sjeff*
9836219820Sjeff*	dgrm.raw_ether.max_static_rate
9837219820Sjeff*		static rate...
9838219820Sjeff*
9839219820Sjeff*	dgrm.raw_ether.ether_type
9840219820Sjeff*		ether type...
9841219820Sjeff*
9842219820Sjeff*	dgrm.raw_ipv6.dest_lid
9843219820Sjeff*		The destination LID that will receive this raw ether send.
9844219820Sjeff*
9845219820Sjeff*	dgrm.raw_ipv6.path_bits
9846219820Sjeff*		path bits...
9847219820Sjeff*
9848219820Sjeff*	dgrm.raw_ipv6.sl
9849219820Sjeff*		service level...
9850219820Sjeff*
9851219820Sjeff*	dgrm.raw_ipv6.max_static_rate
9852219820Sjeff*		static rate...
9853219820Sjeff*
9854219820Sjeff*	remote_ops.vaddr
9855219820Sjeff*		The registered virtual memory address of the remote memory to access
9856219820Sjeff*		with an RDMA or atomic operation.
9857219820Sjeff*
9858219820Sjeff*	remote_ops.rkey
9859219820Sjeff*		The rkey associated with the specified remote vaddr. This data must
9860219820Sjeff*		be presented exactly as obtained from the remote node. No swapping
9861219820Sjeff*		of data must be performed.
9862219820Sjeff*
9863219820Sjeff*	atomic1
9864219820Sjeff*		The first operand for an atomic operation.
9865219820Sjeff*
9866219820Sjeff*	atomic2
9867219820Sjeff*		The second operand for an atomic operation.
9868219820Sjeff*
9869219820Sjeff* NOTES
9870219820Sjeff*	The format of data sent over the fabric is user-defined and is considered
9871219820Sjeff*	opaque to the access layer.  The sole exception to this are MADs posted
9872219820Sjeff*	to a MAD QP service.  MADs are expected to match the format defined by
9873219820Sjeff*	the Infiniband specification and must be in network-byte order when posted
9874219820Sjeff*	to the MAD QP service.
9875219820Sjeff*
9876219820Sjeff* SEE ALSO
9877219820Sjeff*	ib_wr_type_t, ib_local_ds_t, ib_send_opt_t
9878219820Sjeff*****/
9879219820Sjeff
9880219820Sjeff/****s* Access Layer/ib_recv_wr_t
9881219820Sjeff* NAME
9882219820Sjeff*	ib_recv_wr_t
9883219820Sjeff*
9884219820Sjeff* DESCRIPTION
9885219820Sjeff*	Information used to submit a work request to the receive queue of a queue
9886219820Sjeff*	pair.
9887219820Sjeff*
9888219820Sjeff* SYNOPSIS
9889219820Sjeff*/
9890219820Sjefftypedef struct _ib_recv_wr {
9891219820Sjeff	struct _ib_recv_wr *p_next;
9892219820Sjeff	uint64_t wr_id;
9893219820Sjeff	uint32_t num_ds;
9894219820Sjeff	ib_local_ds_t *ds_array;
9895219820Sjeff} ib_recv_wr_t;
9896219820Sjeff/*
9897219820Sjeff* FIELDS
9898219820Sjeff*	p_next
9899219820Sjeff*		A pointer used to chain work requests together.  This permits multiple
9900219820Sjeff*		work requests to be posted to a queue pair through a single function
9901219820Sjeff*		call.  This value is set to NULL to mark the end of the chain.
9902219820Sjeff*
9903219820Sjeff*	wr_id
9904219820Sjeff*		A 64-bit work request identifier that is returned to the consumer
9905219820Sjeff*		as part of the work completion.
9906219820Sjeff*
9907219820Sjeff*	num_ds
9908219820Sjeff*		Number of local data segments specified by this work request.
9909219820Sjeff*
9910219820Sjeff*	ds_array
9911219820Sjeff*		A reference to an array of local data segments used by the send
9912219820Sjeff*		operation.
9913219820Sjeff*
9914219820Sjeff* SEE ALSO
9915219820Sjeff*	ib_local_ds_t
9916219820Sjeff*****/
9917219820Sjeff
9918219820Sjeff/****s* Access Layer/ib_bind_wr_t
9919219820Sjeff* NAME
9920219820Sjeff*	ib_bind_wr_t
9921219820Sjeff*
9922219820Sjeff* DESCRIPTION
9923219820Sjeff*	Information used to submit a memory window bind work request to the send
9924219820Sjeff*	queue of a queue pair.
9925219820Sjeff*
9926219820Sjeff* SYNOPSIS
9927219820Sjeff*/
9928219820Sjefftypedef struct _ib_bind_wr {
9929219820Sjeff	uint64_t wr_id;
9930219820Sjeff	ib_send_opt_t send_opt;
9931219820Sjeff
9932219820Sjeff	ib_mr_handle_t h_mr;
9933219820Sjeff	ib_access_t access_ctrl;
9934219820Sjeff	uint32_t current_rkey;
9935219820Sjeff
9936219820Sjeff	ib_local_ds_t local_ds;
9937219820Sjeff
9938219820Sjeff} ib_bind_wr_t;
9939219820Sjeff/*
9940219820Sjeff* FIELDS
9941219820Sjeff*	wr_id
9942219820Sjeff*		A 64-bit work request identifier that is returned to the consumer
9943219820Sjeff*		as part of the work completion.
9944219820Sjeff*
9945219820Sjeff*	send_opt
9946219820Sjeff*		Optional send control parameters.
9947219820Sjeff*
9948219820Sjeff*	h_mr
9949219820Sjeff*		Handle to the memory region to which this window is being bound.
9950219820Sjeff*
9951219820Sjeff*	access_ctrl
9952219820Sjeff*		Access rights for this memory window.
9953219820Sjeff*
9954219820Sjeff*	current_rkey
9955219820Sjeff*		The current rkey assigned to this window for remote access.
9956219820Sjeff*
9957219820Sjeff*	local_ds
9958219820Sjeff*		A reference to a local data segment used by the bind operation.
9959219820Sjeff*
9960219820Sjeff* SEE ALSO
9961219820Sjeff*	ib_send_opt_t, ib_access_t, ib_local_ds_t
9962219820Sjeff*****/
9963219820Sjeff
9964219820Sjeff/****d* Access Layer/ib_wc_status_t
9965219820Sjeff* NAME
9966219820Sjeff*	ib_wc_status_t
9967219820Sjeff*
9968219820Sjeff* DESCRIPTION
9969219820Sjeff*	Indicates the status of a completed work request.  These VALUES are
9970219820Sjeff*	returned to the user when retrieving completions.  Note that success is
9971219820Sjeff*	identified as IB_WCS_SUCCESS, which is always zero.
9972219820Sjeff*
9973219820Sjeff* SYNOPSIS
9974219820Sjeff*/
9975219820Sjefftypedef enum _ib_wc_status_t {
9976219820Sjeff	IB_WCS_SUCCESS,
9977219820Sjeff	IB_WCS_LOCAL_LEN_ERR,
9978219820Sjeff	IB_WCS_LOCAL_OP_ERR,
9979219820Sjeff	IB_WCS_LOCAL_EEC_OP_ERR,
9980219820Sjeff	IB_WCS_LOCAL_PROTECTION_ERR,
9981219820Sjeff	IB_WCS_WR_FLUSHED_ERR,
9982219820Sjeff	IB_WCS_MEM_WINDOW_BIND_ERR,
9983219820Sjeff	IB_WCS_REM_ACCESS_ERR,
9984219820Sjeff	IB_WCS_REM_OP_ERR,
9985219820Sjeff	IB_WCS_RNR_RETRY_ERR,
9986219820Sjeff	IB_WCS_TIMEOUT_RETRY_ERR,
9987219820Sjeff	IB_WCS_REM_INVALID_REQ_ERR,
9988219820Sjeff	IB_WCS_REM_INVALID_RD_REQ_ERR,
9989219820Sjeff	IB_WCS_INVALID_EECN,
9990219820Sjeff	IB_WCS_INVALID_EEC_STATE,
9991219820Sjeff	IB_WCS_UNMATCHED_RESPONSE,	/* InfiniBand Access Layer */
9992219820Sjeff	IB_WCS_CANCELED,	/* InfiniBand Access Layer */
9993219820Sjeff	IB_WCS_UNKNOWN		/* Must be last. */
9994219820Sjeff} ib_wc_status_t;
9995219820Sjeff/*
9996219820Sjeff* VALUES
9997219820Sjeff*	IB_WCS_SUCCESS
9998219820Sjeff*		Work request completed successfully.
9999219820Sjeff*
10000219820Sjeff*	IB_WCS_MAD
10001219820Sjeff*		The completed work request was associated with a managmenet datagram
10002219820Sjeff*		that requires post processing.  The MAD will be returned to the user
10003219820Sjeff*		through a callback once all post processing has completed.
10004219820Sjeff*
10005219820Sjeff*	IB_WCS_LOCAL_LEN_ERR
10006219820Sjeff*		Generated for a work request posted to the send queue when the
10007219820Sjeff*		total of the data segment lengths exceeds the message length of the
10008219820Sjeff*		channel.  Generated for a work request posted to the receive queue when
10009219820Sjeff*		the total of the data segment lengths is too small for a
10010219820Sjeff*		valid incoming message.
10011219820Sjeff*
10012219820Sjeff*	IB_WCS_LOCAL_OP_ERR
10013219820Sjeff*		An internal QP consistency error was generated while processing this
10014219820Sjeff*		work request.  This may indicate that the QP was in an incorrect state
10015219820Sjeff*		for the requested operation.
10016219820Sjeff*
10017219820Sjeff*	IB_WCS_LOCAL_EEC_OP_ERR
10018219820Sjeff*		An internal EEC consistency error was generated while processing
10019219820Sjeff*		this work request.  This may indicate that the EEC was in an incorrect
10020219820Sjeff*		state for the requested operation.
10021219820Sjeff*
10022219820Sjeff*	IB_WCS_LOCAL_PROTECTION_ERR
10023219820Sjeff*		The data segments of the locally posted work request did not refer to
10024219820Sjeff*		a valid memory region.  The memory may not have been properly
10025219820Sjeff*		registered for the requested operation.
10026219820Sjeff*
10027219820Sjeff*	IB_WCS_WR_FLUSHED_ERR
10028219820Sjeff*		The work request was flushed from the QP before being completed.
10029219820Sjeff*
10030219820Sjeff*	IB_WCS_MEM_WINDOW_BIND_ERR
10031219820Sjeff*		A memory window bind operation failed due to insufficient access
10032219820Sjeff*		rights.
10033219820Sjeff*
10034219820Sjeff*	IB_WCS_REM_ACCESS_ERR,
10035219820Sjeff*		A protection error was detected at the remote node for a RDMA or atomic
10036219820Sjeff*		operation.
10037219820Sjeff*
10038219820Sjeff*	IB_WCS_REM_OP_ERR,
10039219820Sjeff*		The operation could not be successfully completed at the remote node.
10040219820Sjeff*		This may indicate that the remote QP was in an invalid state or
10041219820Sjeff*		contained an invalid work request.
10042219820Sjeff*
10043219820Sjeff*	IB_WCS_RNR_RETRY_ERR,
10044219820Sjeff*		The RNR retry count was exceeded while trying to send this message.
10045219820Sjeff*
10046219820Sjeff*	IB_WCS_TIMEOUT_RETRY_ERR
10047219820Sjeff*		The local transport timeout counter expired while trying to send this
10048219820Sjeff*		message.
10049219820Sjeff*
10050219820Sjeff*	IB_WCS_REM_INVALID_REQ_ERR,
10051219820Sjeff*		The remote node detected an invalid message on the channel.  This error
10052219820Sjeff*		is usually a result of one of the following:
10053219820Sjeff*			- The operation was not supported on receive queue.
10054219820Sjeff*			- There was insufficient buffers to receive a new RDMA request.
10055219820Sjeff*			- There was insufficient buffers to receive a new atomic operation.
10056219820Sjeff*			- An RDMA request was larger than 2^31 bytes.
10057219820Sjeff*
10058219820Sjeff*	IB_WCS_REM_INVALID_RD_REQ_ERR,
10059219820Sjeff*		Responder detected an invalid RD message.  This may be the result of an
10060219820Sjeff*		invalid qkey or an RDD mismatch.
10061219820Sjeff*
10062219820Sjeff*	IB_WCS_INVALID_EECN
10063219820Sjeff*		An invalid EE context number was detected.
10064219820Sjeff*
10065219820Sjeff*	IB_WCS_INVALID_EEC_STATE
10066219820Sjeff*		The EEC was in an invalid state for the specified request.
10067219820Sjeff*
10068219820Sjeff*	IB_WCS_UNMATCHED_RESPONSE
10069219820Sjeff*		A response MAD was received for which there was no matching send.  The
10070219820Sjeff*		send operation may have been canceled by the user or may have timed
10071219820Sjeff*		out.
10072219820Sjeff*
10073219820Sjeff*	IB_WCS_CANCELED
10074219820Sjeff*		The completed work request was canceled by the user.
10075219820Sjeff*****/
10076219820Sjeff
10077219820SjeffOSM_EXPORT const char *ib_wc_status_str[];
10078219820Sjeff
10079219820Sjeff/****f* IBA Base: Types/ib_get_wc_status_str
10080219820Sjeff* NAME
10081219820Sjeff*	ib_get_wc_status_str
10082219820Sjeff*
10083219820Sjeff* DESCRIPTION
10084219820Sjeff*	Returns a string for the specified work completion status.
10085219820Sjeff*
10086219820Sjeff* SYNOPSIS
10087219820Sjeff*/
10088219820Sjeffstatic inline const char *OSM_API
10089219820Sjeffib_get_wc_status_str(IN ib_wc_status_t wc_status)
10090219820Sjeff{
10091219820Sjeff	if (wc_status > IB_WCS_UNKNOWN)
10092219820Sjeff		wc_status = IB_WCS_UNKNOWN;
10093219820Sjeff	return (ib_wc_status_str[wc_status]);
10094219820Sjeff}
10095219820Sjeff
10096219820Sjeff/*
10097219820Sjeff* PARAMETERS
10098219820Sjeff*	wc_status
10099219820Sjeff*		[in] work completion status value
10100219820Sjeff*
10101219820Sjeff* RETURN VALUES
10102219820Sjeff*	Pointer to the work completion status description string.
10103219820Sjeff*
10104219820Sjeff* NOTES
10105219820Sjeff*
10106219820Sjeff* SEE ALSO
10107219820Sjeff*********/
10108219820Sjeff
10109219820Sjeff/****d* Access Layer/ib_wc_type_t
10110219820Sjeff* NAME
10111219820Sjeff*	ib_wc_type_t
10112219820Sjeff*
10113219820Sjeff* DESCRIPTION
10114219820Sjeff*	Indicates the type of work completion.
10115219820Sjeff*
10116219820Sjeff* SYNOPSIS
10117219820Sjeff*/
10118219820Sjefftypedef enum _ib_wc_type_t {
10119219820Sjeff	IB_WC_SEND,
10120219820Sjeff	IB_WC_RDMA_WRITE,
10121219820Sjeff	IB_WC_RECV,
10122219820Sjeff	IB_WC_RDMA_READ,
10123219820Sjeff	IB_WC_MW_BIND,
10124219820Sjeff	IB_WC_FETCH_ADD,
10125219820Sjeff	IB_WC_COMPARE_SWAP,
10126219820Sjeff	IB_WC_RECV_RDMA_WRITE
10127219820Sjeff} ib_wc_type_t;
10128219820Sjeff/*****/
10129219820Sjeff
10130219820Sjeff/****d* Access Layer/ib_recv_opt_t
10131219820Sjeff* NAME
10132219820Sjeff*	ib_recv_opt_t
10133219820Sjeff*
10134219820Sjeff* DESCRIPTION
10135219820Sjeff*	Indicates optional fields valid in a receive work completion.
10136219820Sjeff*
10137219820Sjeff* SYNOPSIS
10138219820Sjeff*/
10139219820Sjefftypedef uint32_t ib_recv_opt_t;
10140219820Sjeff#define	IB_RECV_OPT_IMMEDIATE		0x00000001
10141219820Sjeff#define IB_RECV_OPT_FORWARD		0x00000002
10142219820Sjeff#define IB_RECV_OPT_GRH_VALID		0x00000004
10143219820Sjeff#define IB_RECV_OPT_VEND_MASK		0xFFFF0000
10144219820Sjeff/*
10145219820Sjeff* VALUES
10146219820Sjeff*	IB_RECV_OPT_IMMEDIATE
10147219820Sjeff*		Indicates that immediate data is valid for this work completion.
10148219820Sjeff*
10149219820Sjeff*	IB_RECV_OPT_FORWARD
10150219820Sjeff*		Indicates that the received trap should be forwarded to the SM.
10151219820Sjeff*
10152219820Sjeff*	IB_RECV_OPT_GRH_VALID
10153219820Sjeff*		Indicates presence of the global route header. When set, the
10154219820Sjeff*		first 40 bytes received are the GRH.
10155219820Sjeff*
10156219820Sjeff*	IB_RECV_OPT_VEND_MASK
10157219820Sjeff*		This mask indicates bits reserved in the receive options that may be
10158219820Sjeff*		used by the verbs provider to indicate vendor specific options.  Bits
10159219820Sjeff*		set in this area of the receive options are ignored by the Access Layer,
10160219820Sjeff*		but may have specific meaning to the underlying VPD.
10161219820Sjeff*****/
10162219820Sjeff
10163219820Sjeff/****s* Access Layer/ib_wc_t
10164219820Sjeff* NAME
10165219820Sjeff*	ib_wc_t
10166219820Sjeff*
10167219820Sjeff* DESCRIPTION
10168219820Sjeff*	Work completion information.
10169219820Sjeff*
10170219820Sjeff* SYNOPSIS
10171219820Sjeff*/
10172219820Sjefftypedef struct _ib_wc {
10173219820Sjeff	struct _ib_wc *p_next;
10174219820Sjeff	uint64_t wr_id;
10175219820Sjeff	ib_wc_type_t wc_type;
10176219820Sjeff
10177219820Sjeff	uint32_t length;
10178219820Sjeff	ib_wc_status_t status;
10179219820Sjeff	uint64_t vendor_specific;
10180219820Sjeff
10181219820Sjeff	union _wc_recv {
10182219820Sjeff		struct _wc_conn {
10183219820Sjeff			ib_recv_opt_t recv_opt;
10184219820Sjeff			ib_net32_t immediate_data;
10185219820Sjeff
10186219820Sjeff		} conn;
10187219820Sjeff
10188219820Sjeff		struct _wc_ud {
10189219820Sjeff			ib_recv_opt_t recv_opt;
10190219820Sjeff			ib_net32_t immediate_data;
10191219820Sjeff			ib_net32_t remote_qp;
10192219820Sjeff			uint16_t pkey_index;
10193219820Sjeff			ib_net16_t remote_lid;
10194219820Sjeff			uint8_t remote_sl;
10195219820Sjeff			uint8_t path_bits;
10196219820Sjeff
10197219820Sjeff		} ud;
10198219820Sjeff
10199219820Sjeff		struct _wc_rd {
10200219820Sjeff			ib_net32_t remote_eecn;
10201219820Sjeff			ib_net32_t remote_qp;
10202219820Sjeff			ib_net16_t remote_lid;
10203219820Sjeff			uint8_t remote_sl;
10204219820Sjeff			uint32_t free_cnt;
10205219820Sjeff
10206219820Sjeff		} rd;
10207219820Sjeff
10208219820Sjeff		struct _wc_raw_ipv6 {
10209219820Sjeff			ib_net16_t remote_lid;
10210219820Sjeff			uint8_t remote_sl;
10211219820Sjeff			uint8_t path_bits;
10212219820Sjeff
10213219820Sjeff		} raw_ipv6;
10214219820Sjeff
10215219820Sjeff		struct _wc_raw_ether {
10216219820Sjeff			ib_net16_t remote_lid;
10217219820Sjeff			uint8_t remote_sl;
10218219820Sjeff			uint8_t path_bits;
10219219820Sjeff			ib_net16_t ether_type;
10220219820Sjeff
10221219820Sjeff		} raw_ether;
10222219820Sjeff
10223219820Sjeff	} recv;
10224219820Sjeff
10225219820Sjeff} ib_wc_t;
10226219820Sjeff/*
10227219820Sjeff* FIELDS
10228219820Sjeff*	p_next
10229219820Sjeff*		A pointer used to chain work completions.  This permits multiple
10230219820Sjeff*		work completions to be retrieved from a completion queue through a
10231219820Sjeff*		single function call.  This value is set to NULL to mark the end of
10232219820Sjeff*		the chain.
10233219820Sjeff*
10234219820Sjeff*	wr_id
10235219820Sjeff*		The 64-bit work request identifier that was specified when posting the
10236219820Sjeff*		work request.
10237219820Sjeff*
10238219820Sjeff*	wc_type
10239219820Sjeff*		Indicates the type of work completion.
10240219820Sjeff*
10241219820Sjeff*
10242219820Sjeff*	length
10243219820Sjeff*		The total length of the data sent or received with the work request.
10244219820Sjeff*
10245219820Sjeff*	status
10246219820Sjeff*		The result of the work request.
10247219820Sjeff*
10248219820Sjeff*	vendor_specific
10249219820Sjeff*		HCA vendor specific information returned as part of the completion.
10250219820Sjeff*
10251219820Sjeff*	recv.conn.recv_opt
10252219820Sjeff*		Indicates optional fields valid as part of a work request that
10253219820Sjeff*		completed on a connected (reliable or unreliable) queue pair.
10254219820Sjeff*
10255219820Sjeff*	recv.conn.immediate_data
10256219820Sjeff*		32-bit field received as part of an inbound message on a connected
10257219820Sjeff*		queue pair.  This field is only valid if the recv_opt flag
10258219820Sjeff*		IB_RECV_OPT_IMMEDIATE has been set.
10259219820Sjeff*
10260219820Sjeff*	recv.ud.recv_opt
10261219820Sjeff*		Indicates optional fields valid as part of a work request that
10262219820Sjeff*		completed on an unreliable datagram queue pair.
10263219820Sjeff*
10264219820Sjeff*	recv.ud.immediate_data
10265219820Sjeff*		32-bit field received as part of an inbound message on a unreliable
10266219820Sjeff*		datagram queue pair.  This field is only valid if the recv_opt flag
10267219820Sjeff*		IB_RECV_OPT_IMMEDIATE has been set.
10268219820Sjeff*
10269219820Sjeff*	recv.ud.remote_qp
10270219820Sjeff*		Identifies the source queue pair of a received datagram.
10271219820Sjeff*
10272219820Sjeff*	recv.ud.pkey_index
10273219820Sjeff*		The pkey index for the source queue pair. This is valid only for
10274219820Sjeff*		GSI type QP's.
10275219820Sjeff*
10276219820Sjeff*	recv.ud.remote_lid
10277219820Sjeff*		The source LID of the received datagram.
10278219820Sjeff*
10279219820Sjeff*	recv.ud.remote_sl
10280219820Sjeff*		The service level used by the source of the received datagram.
10281219820Sjeff*
10282219820Sjeff*	recv.ud.path_bits
10283219820Sjeff*		path bits...
10284219820Sjeff*
10285219820Sjeff*	recv.rd.remote_eecn
10286219820Sjeff*		The remote end-to-end context number that sent the received message.
10287219820Sjeff*
10288219820Sjeff*	recv.rd.remote_qp
10289219820Sjeff*		Identifies the source queue pair of a received message.
10290219820Sjeff*
10291219820Sjeff*	recv.rd.remote_lid
10292219820Sjeff*		The source LID of the received message.
10293219820Sjeff*
10294219820Sjeff*	recv.rd.remote_sl
10295219820Sjeff*		The service level used by the source of the received message.
10296219820Sjeff*
10297219820Sjeff*	recv.rd.free_cnt
10298219820Sjeff*		The number of available entries in the completion queue.  Reliable
10299219820Sjeff*		datagrams may complete out of order, so this field may be used to
10300219820Sjeff*		determine the number of additional completions that may occur.
10301219820Sjeff*
10302219820Sjeff*	recv.raw_ipv6.remote_lid
10303219820Sjeff*		The source LID of the received message.
10304219820Sjeff*
10305219820Sjeff*	recv.raw_ipv6.remote_sl
10306219820Sjeff*		The service level used by the source of the received message.
10307219820Sjeff*
10308219820Sjeff*	recv.raw_ipv6.path_bits
10309219820Sjeff*		path bits...
10310219820Sjeff*
10311219820Sjeff*	recv.raw_ether.remote_lid
10312219820Sjeff*		The source LID of the received message.
10313219820Sjeff*
10314219820Sjeff*	recv.raw_ether.remote_sl
10315219820Sjeff*		The service level used by the source of the received message.
10316219820Sjeff*
10317219820Sjeff*	recv.raw_ether.path_bits
10318219820Sjeff*		path bits...
10319219820Sjeff*
10320219820Sjeff*	recv.raw_ether.ether_type
10321219820Sjeff*		ether type...
10322219820Sjeff* NOTES
10323219820Sjeff*	When the work request completes with error, the only values that the
10324219820Sjeff*	consumer can depend on are the wr_id field, and the status of the
10325219820Sjeff*	operation.
10326219820Sjeff*
10327219820Sjeff*	If the consumer is using the same CQ for completions from more than
10328219820Sjeff*	one type of QP (i.e Reliable Connected, Datagram etc), then the consumer
10329219820Sjeff*	must have additional information to decide what fields of the union are
10330219820Sjeff*	valid.
10331219820Sjeff* SEE ALSO
10332219820Sjeff*	ib_wc_type_t, ib_qp_type_t, ib_wc_status_t, ib_recv_opt_t
10333219820Sjeff*****/
10334219820Sjeff
10335219820Sjeff/****s* Access Layer/ib_mr_create_t
10336219820Sjeff* NAME
10337219820Sjeff*	ib_mr_create_t
10338219820Sjeff*
10339219820Sjeff* DESCRIPTION
10340219820Sjeff*	Information required to create a registered memory region.
10341219820Sjeff*
10342219820Sjeff* SYNOPSIS
10343219820Sjeff*/
10344219820Sjefftypedef struct _ib_mr_create {
10345219820Sjeff	void *vaddr;
10346219820Sjeff	uint64_t length;
10347219820Sjeff	ib_access_t access_ctrl;
10348219820Sjeff} ib_mr_create_t;
10349219820Sjeff/*
10350219820Sjeff* FIELDS
10351219820Sjeff*	vaddr
10352219820Sjeff*		Starting virtual address of the region being registered.
10353219820Sjeff*
10354219820Sjeff*	length
10355219820Sjeff*		Length of the buffer to register.
10356219820Sjeff*
10357219820Sjeff*	access_ctrl
10358219820Sjeff*		Access rights of the registered region.
10359219820Sjeff*
10360219820Sjeff* SEE ALSO
10361219820Sjeff*	ib_access_t
10362219820Sjeff*****/
10363219820Sjeff
10364219820Sjeff/****s* Access Layer/ib_phys_create_t
10365219820Sjeff* NAME
10366219820Sjeff*	ib_phys_create_t
10367219820Sjeff*
10368219820Sjeff* DESCRIPTION
10369219820Sjeff*	Information required to create a physical memory region.
10370219820Sjeff*
10371219820Sjeff* SYNOPSIS
10372219820Sjeff*/
10373219820Sjefftypedef struct _ib_phys_create {
10374219820Sjeff	uint64_t length;
10375219820Sjeff	uint32_t num_bufs;
10376219820Sjeff	uint64_t *buf_array;
10377219820Sjeff	uint32_t buf_offset;
10378219820Sjeff	uint32_t page_size;
10379219820Sjeff	ib_access_t access_ctrl;
10380219820Sjeff} ib_phys_create_t;
10381219820Sjeff/*
10382219820Sjeff*	length
10383219820Sjeff*		The length of the memory region in bytes.
10384219820Sjeff*
10385219820Sjeff*	num_bufs
10386219820Sjeff*		Number of buffers listed in the specified buffer array.
10387219820Sjeff*
10388219820Sjeff*	buf_array
10389219820Sjeff*		An array of physical buffers to be registered as a single memory
10390219820Sjeff*		region.
10391219820Sjeff*
10392219820Sjeff*	buf_offset
10393219820Sjeff*		The offset into the first physical page of the specified memory
10394219820Sjeff*		region to start the virtual address.
10395219820Sjeff*
10396219820Sjeff*	page_size
10397219820Sjeff*		The physical page size of the memory being registered.
10398219820Sjeff*
10399219820Sjeff*	access_ctrl
10400219820Sjeff*		Access rights of the registered region.
10401219820Sjeff*
10402219820Sjeff* SEE ALSO
10403219820Sjeff*	ib_access_t
10404219820Sjeff*****/
10405219820Sjeff
10406219820Sjeff/****s* Access Layer/ib_mr_attr_t
10407219820Sjeff* NAME
10408219820Sjeff*	ib_mr_attr_t
10409219820Sjeff*
10410219820Sjeff* DESCRIPTION
10411219820Sjeff*	Attributes of a registered memory region.
10412219820Sjeff*
10413219820Sjeff* SYNOPSIS
10414219820Sjeff*/
10415219820Sjefftypedef struct _ib_mr_attr {
10416219820Sjeff	ib_pd_handle_t h_pd;
10417219820Sjeff	void *local_lb;
10418219820Sjeff	void *local_ub;
10419219820Sjeff	void *remote_lb;
10420219820Sjeff	void *remote_ub;
10421219820Sjeff	ib_access_t access_ctrl;
10422219820Sjeff	uint32_t lkey;
10423219820Sjeff	uint32_t rkey;
10424219820Sjeff} ib_mr_attr_t;
10425219820Sjeff/*
10426219820Sjeff* DESCRIPTION
10427219820Sjeff*	h_pd
10428219820Sjeff*		Handle to the protection domain for this memory region.
10429219820Sjeff*
10430219820Sjeff*	local_lb
10431219820Sjeff*		The virtual address of the lower bound of protection for local
10432219820Sjeff*		memory access.
10433219820Sjeff*
10434219820Sjeff*	local_ub
10435219820Sjeff*		The virtual address of the upper bound of protection for local
10436219820Sjeff*		memory access.
10437219820Sjeff*
10438219820Sjeff*	remote_lb
10439219820Sjeff*		The virtual address of the lower bound of protection for remote
10440219820Sjeff*		memory access.
10441219820Sjeff*
10442219820Sjeff*	remote_ub
10443219820Sjeff*		The virtual address of the upper bound of protection for remote
10444219820Sjeff*		memory access.
10445219820Sjeff*
10446219820Sjeff*	access_ctrl
10447219820Sjeff*		Access rights for the specified memory region.
10448219820Sjeff*
10449219820Sjeff*	lkey
10450219820Sjeff*		The lkey associated with this memory region.
10451219820Sjeff*
10452219820Sjeff*	rkey
10453219820Sjeff*		The rkey associated with this memory region.
10454219820Sjeff*
10455219820Sjeff* NOTES
10456219820Sjeff*	The remote_lb, remote_ub, and rkey are only valid if remote memory access
10457219820Sjeff*	is enabled for this memory region.
10458219820Sjeff*
10459219820Sjeff* SEE ALSO
10460219820Sjeff*	ib_access_t
10461219820Sjeff*****/
10462219820Sjeff
10463219820Sjeff/****d* Access Layer/ib_ca_mod_t
10464219820Sjeff* NAME
10465219820Sjeff*	ib_ca_mod_t -- Modify port attributes and error counters
10466219820Sjeff*
10467219820Sjeff* DESCRIPTION
10468219820Sjeff*	Specifies modifications to the port attributes of a channel adapter.
10469219820Sjeff*
10470219820Sjeff* SYNOPSIS
10471219820Sjeff*/
10472219820Sjefftypedef uint32_t ib_ca_mod_t;
10473219820Sjeff#define IB_CA_MOD_IS_CM_SUPPORTED		0x00000001
10474219820Sjeff#define IB_CA_MOD_IS_SNMP_SUPPORTED		0x00000002
10475219820Sjeff#define	IB_CA_MOD_IS_DEV_MGMT_SUPPORTED		0x00000004
10476219820Sjeff#define	IB_CA_MOD_IS_VEND_SUPPORTED		0x00000008
10477219820Sjeff#define	IB_CA_MOD_IS_SM				0x00000010
10478219820Sjeff#define IB_CA_MOD_IS_SM_DISABLED		0x00000020
10479219820Sjeff#define IB_CA_MOD_QKEY_CTR			0x00000040
10480219820Sjeff#define IB_CA_MOD_PKEY_CTR			0x00000080
10481219820Sjeff#define IB_CA_MOD_IS_NOTICE_SUPPORTED		0x00000100
10482219820Sjeff#define IB_CA_MOD_IS_TRAP_SUPPORTED		0x00000200
10483219820Sjeff#define IB_CA_MOD_IS_APM_SUPPORTED		0x00000400
10484219820Sjeff#define IB_CA_MOD_IS_SLMAP_SUPPORTED		0x00000800
10485219820Sjeff#define IB_CA_MOD_IS_PKEY_NVRAM_SUPPORTED	0x00001000
10486219820Sjeff#define IB_CA_MOD_IS_MKEY_NVRAM_SUPPORTED	0x00002000
10487219820Sjeff#define IB_CA_MOD_IS_SYSGUID_SUPPORTED		0x00004000
10488219820Sjeff#define IB_CA_MOD_IS_DR_NOTICE_SUPPORTED	0x00008000
10489219820Sjeff#define IB_CA_MOD_IS_BOOT_MGMT_SUPPORTED	0x00010000
10490219820Sjeff#define IB_CA_MOD_IS_CAPM_NOTICE_SUPPORTED	0x00020000
10491219820Sjeff#define IB_CA_MOD_IS_REINIT_SUPORTED		0x00040000
10492219820Sjeff#define IB_CA_MOD_IS_LEDINFO_SUPPORTED		0x00080000
10493219820Sjeff#define IB_CA_MOD_SHUTDOWN_PORT			0x00100000
10494219820Sjeff#define IB_CA_MOD_INIT_TYPE_VALUE		0x00200000
10495219820Sjeff#define IB_CA_MOD_SYSTEM_IMAGE_GUID		0x00400000
10496219820Sjeff/*
10497219820Sjeff* VALUES
10498219820Sjeff*	IB_CA_MOD_IS_CM_SUPPORTED
10499219820Sjeff*		Indicates if there is a communication manager accessible through
10500219820Sjeff*		the port.
10501219820Sjeff*
10502219820Sjeff*	IB_CA_MOD_IS_SNMP_SUPPORTED
10503219820Sjeff*		Indicates if there is an SNMP agent accessible through the port.
10504219820Sjeff*
10505219820Sjeff*	IB_CA_MOD_IS_DEV_MGMT_SUPPORTED
10506219820Sjeff*		Indicates if there is a device management agent accessible
10507219820Sjeff*		through the port.
10508219820Sjeff*
10509219820Sjeff*	IB_CA_MOD_IS_VEND_SUPPORTED
10510219820Sjeff*		Indicates if there is a vendor supported agent accessible
10511219820Sjeff*		through the port.
10512219820Sjeff*
10513219820Sjeff*	IB_CA_MOD_IS_SM
10514219820Sjeff*		Indicates if there is a subnet manager accessible through
10515219820Sjeff*		the port.
10516219820Sjeff*
10517219820Sjeff*	IB_CA_MOD_IS_SM_DISABLED
10518219820Sjeff*		Indicates if the port has been disabled for configuration by the
10519219820Sjeff*		subnet manager.
10520219820Sjeff*
10521219820Sjeff*	IB_CA_MOD_QKEY_CTR
10522219820Sjeff*		Used to reset the qkey violation counter associated with the
10523219820Sjeff*		port.
10524219820Sjeff*
10525219820Sjeff*	IB_CA_MOD_PKEY_CTR
10526219820Sjeff*		Used to reset the pkey violation counter associated with the
10527219820Sjeff*		port.
10528219820Sjeff*
10529219820Sjeff*	IB_CA_MOD_IS_NOTICE_SUPPORTED
10530219820Sjeff*		Indicates that this CA supports ability to generate Notices for
10531219820Sjeff*		Port State changes. (only applicable to switches)
10532219820Sjeff*
10533219820Sjeff*	IB_CA_MOD_IS_TRAP_SUPPORTED
10534219820Sjeff*		Indicates that this management port supports ability to generate
10535219820Sjeff*		trap messages. (only applicable to switches)
10536219820Sjeff*
10537219820Sjeff*	IB_CA_MOD_IS_APM_SUPPORTED
10538219820Sjeff*		Indicates that this port is capable of performing Automatic
10539219820Sjeff*		Path Migration.
10540219820Sjeff*
10541219820Sjeff*	IB_CA_MOD_IS_SLMAP_SUPPORTED
10542219820Sjeff*		Indicates this port supports SLMAP capability.
10543219820Sjeff*
10544219820Sjeff*	IB_CA_MOD_IS_PKEY_NVRAM_SUPPORTED
10545219820Sjeff*		Indicates that PKEY is supported in NVRAM
10546219820Sjeff*
10547219820Sjeff*	IB_CA_MOD_IS_MKEY_NVRAM_SUPPORTED
10548219820Sjeff*		Indicates that MKEY is supported in NVRAM
10549219820Sjeff*
10550219820Sjeff*	IB_CA_MOD_IS_SYSGUID_SUPPORTED
10551219820Sjeff*		Indicates System Image GUID support.
10552219820Sjeff*
10553219820Sjeff*	IB_CA_MOD_IS_DR_NOTICE_SUPPORTED
10554219820Sjeff*		Indicate support for generating Direct Routed Notices
10555219820Sjeff*
10556219820Sjeff*	IB_CA_MOD_IS_BOOT_MGMT_SUPPORTED
10557219820Sjeff*		Indicates support for Boot Management
10558219820Sjeff*
10559219820Sjeff*	IB_CA_MOD_IS_CAPM_NOTICE_SUPPORTED
10560219820Sjeff*		Indicates capability to generate notices for changes to CAPMASK
10561219820Sjeff*
10562219820Sjeff*	IB_CA_MOD_IS_REINIT_SUPORTED
10563219820Sjeff*		Indicates type of node init supported. Refer to Chapter 14 for
10564219820Sjeff*		Initialization actions.
10565219820Sjeff*
10566219820Sjeff*	IB_CA_MOD_IS_LEDINFO_SUPPORTED
10567219820Sjeff*		Indicates support for LED info.
10568219820Sjeff*
10569219820Sjeff*	IB_CA_MOD_SHUTDOWN_PORT
10570219820Sjeff*		Used to modify the port active indicator.
10571219820Sjeff*
10572219820Sjeff*	IB_CA_MOD_INIT_TYPE_VALUE
10573219820Sjeff*		Used to modify the init_type value for the port.
10574219820Sjeff*
10575219820Sjeff*	IB_CA_MOD_SYSTEM_IMAGE_GUID
10576219820Sjeff*		Used to modify the system image GUID for the port.
10577219820Sjeff*****/
10578219820Sjeff
10579219820Sjeff/****d* Access Layer/ib_mr_mod_t
10580219820Sjeff* NAME
10581219820Sjeff*	ib_mr_mod_t
10582219820Sjeff*
10583219820Sjeff* DESCRIPTION
10584219820Sjeff*	Mask used to specify which attributes of a registered memory region are
10585219820Sjeff*	being modified.
10586219820Sjeff*
10587219820Sjeff* SYNOPSIS
10588219820Sjeff*/
10589219820Sjefftypedef uint32_t ib_mr_mod_t;
10590219820Sjeff#define IB_MR_MOD_ADDR					0x00000001
10591219820Sjeff#define IB_MR_MOD_PD					0x00000002
10592219820Sjeff#define IB_MR_MOD_ACCESS				0x00000004
10593219820Sjeff/*
10594219820Sjeff* PARAMETERS
10595219820Sjeff*	IB_MEM_MOD_ADDR
10596219820Sjeff*		The address of the memory region is being modified.
10597219820Sjeff*
10598219820Sjeff*	IB_MEM_MOD_PD
10599219820Sjeff*		The protection domain associated with the memory region is being
10600219820Sjeff*		modified.
10601219820Sjeff*
10602219820Sjeff*	IB_MEM_MOD_ACCESS
10603219820Sjeff*		The access rights the memory region are being modified.
10604219820Sjeff*****/
10605219820Sjeff
10606219820Sjeff/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_HANDOVER
10607219820Sjeff* NAME
10608219820Sjeff*	IB_SMINFO_ATTR_MOD_HANDOVER
10609219820Sjeff*
10610219820Sjeff* DESCRIPTION
10611219820Sjeff*	Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.
10612219820Sjeff*
10613219820Sjeff* SOURCE
10614219820Sjeff*/
10615219820Sjeff#define IB_SMINFO_ATTR_MOD_HANDOVER		(CL_HTON32(0x000001))
10616219820Sjeff/**********/
10617219820Sjeff
10618219820Sjeff/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_ACKNOWLEDGE
10619219820Sjeff* NAME
10620219820Sjeff*	IB_SMINFO_ATTR_MOD_ACKNOWLEDGE
10621219820Sjeff*
10622219820Sjeff* DESCRIPTION
10623219820Sjeff*	Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.
10624219820Sjeff*
10625219820Sjeff* SOURCE
10626219820Sjeff*/
10627219820Sjeff#define IB_SMINFO_ATTR_MOD_ACKNOWLEDGE		(CL_HTON32(0x000002))
10628219820Sjeff/**********/
10629219820Sjeff
10630219820Sjeff/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_DISABLE
10631219820Sjeff* NAME
10632219820Sjeff*	IB_SMINFO_ATTR_MOD_DISABLE
10633219820Sjeff*
10634219820Sjeff* DESCRIPTION
10635219820Sjeff*	Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.
10636219820Sjeff*
10637219820Sjeff* SOURCE
10638219820Sjeff*/
10639219820Sjeff#define IB_SMINFO_ATTR_MOD_DISABLE			(CL_HTON32(0x000003))
10640219820Sjeff/**********/
10641219820Sjeff
10642219820Sjeff/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_STANDBY
10643219820Sjeff* NAME
10644219820Sjeff*	IB_SMINFO_ATTR_MOD_STANDBY
10645219820Sjeff*
10646219820Sjeff* DESCRIPTION
10647219820Sjeff*	Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.
10648219820Sjeff*
10649219820Sjeff* SOURCE
10650219820Sjeff*/
10651219820Sjeff#define IB_SMINFO_ATTR_MOD_STANDBY			(CL_HTON32(0x000004))
10652219820Sjeff/**********/
10653219820Sjeff
10654219820Sjeff/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_DISCOVER
10655219820Sjeff* NAME
10656219820Sjeff*	IB_SMINFO_ATTR_MOD_DISCOVER
10657219820Sjeff*
10658219820Sjeff* DESCRIPTION
10659219820Sjeff*	Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.
10660219820Sjeff*
10661219820Sjeff* SOURCE
10662219820Sjeff*/
10663219820Sjeff#define IB_SMINFO_ATTR_MOD_DISCOVER			(CL_HTON32(0x000005))
10664219820Sjeff/**********/
10665219820Sjeff
10666219820Sjeff/****s* Access Layer/ib_ci_op_t
10667219820Sjeff* NAME
10668219820Sjeff*	ib_ci_op_t
10669219820Sjeff*
10670219820Sjeff* DESCRIPTION
10671219820Sjeff*	A structure used for vendor specific CA interface communication.
10672219820Sjeff*
10673219820Sjeff* SYNOPSIS
10674219820Sjeff*/
10675219820Sjefftypedef struct _ib_ci_op {
10676219820Sjeff	IN uint32_t command;
10677219820Sjeff	IN OUT void *p_buf OPTIONAL;
10678219820Sjeff	IN uint32_t buf_size;
10679219820Sjeff	IN OUT uint32_t num_bytes_ret;
10680219820Sjeff	IN OUT int32_t status;
10681219820Sjeff
10682219820Sjeff} ib_ci_op_t;
10683219820Sjeff/*
10684219820Sjeff* FIELDS
10685219820Sjeff*	command
10686219820Sjeff*		A command code that is understood by the verbs provider.
10687219820Sjeff*
10688219820Sjeff*	p_buf
10689219820Sjeff*		A reference to a buffer containing vendor specific data.  The verbs
10690219820Sjeff*		provider must not access pointers in the p_buf between user-mode and
10691219820Sjeff*		kernel-mode.  Any pointers embedded in the p_buf are invalidated by
10692219820Sjeff*		the user-mode/kernel-mode transition.
10693219820Sjeff*
10694219820Sjeff*	buf_size
10695219820Sjeff*		The size of the buffer in bytes.
10696219820Sjeff*
10697219820Sjeff*	num_bytes_ret
10698219820Sjeff*		The size in bytes of the vendor specific data returned in the buffer.
10699219820Sjeff*		This field is set by the verbs provider.  The verbs provider should
10700219820Sjeff*		verify that the buffer size is sufficient to hold the data being
10701219820Sjeff*		returned.
10702219820Sjeff*
10703219820Sjeff*	status
10704219820Sjeff*		The completion status from the verbs provider.  This field should be
10705219820Sjeff*		initialize to indicate an error to allow detection and cleanup in
10706219820Sjeff*		case a communication error occurs between user-mode and kernel-mode.
10707219820Sjeff*
10708219820Sjeff* NOTES
10709219820Sjeff*	This structure is provided to allow the exchange of vendor specific
10710219820Sjeff*	data between the originator and the verbs provider.  Users of this
10711219820Sjeff*	structure are expected to know the format of data in the p_buf based
10712219820Sjeff*	on the structure command field or the usage context.
10713219820Sjeff*****/
10714219820Sjeff
10715219820SjeffEND_C_DECLS
10716219820Sjeff#endif				/* ndef WIN32 */
10717219820Sjeff#if defined( __WIN__ )
10718219820Sjeff#include <iba/ib_types_extended.h>
10719219820Sjeff#endif
10720219820Sjeff#endif				/* __IB_TYPES_H__ */
10721