1321936Shselasky/*
2321936Shselasky * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
3321936Shselasky * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
4321936Shselasky * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
5321936Shselasky * Copyright (c) 2009 HNR Consulting. All rights reserved.
6321936Shselasky * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
7321936Shselasky *
8321936Shselasky * This software is available to you under a choice of one of two
9321936Shselasky * licenses.  You may choose to be licensed under the terms of the GNU
10321936Shselasky * General Public License (GPL) Version 2, available from the file
11321936Shselasky * COPYING in the main directory of this source tree, or the
12321936Shselasky * OpenIB.org BSD license below:
13321936Shselasky *
14321936Shselasky *     Redistribution and use in source and binary forms, with or
15321936Shselasky *     without modification, are permitted provided that the following
16321936Shselasky *     conditions are met:
17321936Shselasky *
18321936Shselasky *      - Redistributions of source code must retain the above
19321936Shselasky *        copyright notice, this list of conditions and the following
20321936Shselasky *        disclaimer.
21321936Shselasky *
22321936Shselasky *      - Redistributions in binary form must reproduce the above
23321936Shselasky *        copyright notice, this list of conditions and the following
24321936Shselasky *        disclaimer in the documentation and/or other materials
25321936Shselasky *        provided with the distribution.
26321936Shselasky *
27321936Shselasky * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28321936Shselasky * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29321936Shselasky * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30321936Shselasky * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
31321936Shselasky * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
32321936Shselasky * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
33321936Shselasky * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34321936Shselasky * SOFTWARE.
35321936Shselasky *
36321936Shselasky */
37321936Shselasky
38321936Shselasky#if !defined(__IB_TYPES_H__)
39321936Shselasky#define __IB_TYPES_H__
40321936Shselasky
41321936Shselasky#include <string.h>
42321936Shselasky#include <complib/cl_types.h>
43321936Shselasky#include <complib/cl_byteswap.h>
44321936Shselasky
45321936Shselasky#ifdef __cplusplus
46321936Shselasky#  define BEGIN_C_DECLS extern "C" {
47321936Shselasky#  define END_C_DECLS   }
48321936Shselasky#else				/* !__cplusplus */
49321936Shselasky#  define BEGIN_C_DECLS
50321936Shselasky#  define END_C_DECLS
51321936Shselasky#endif				/* __cplusplus */
52321936Shselasky
53321936ShselaskyBEGIN_C_DECLS
54321936Shselasky#if defined( __WIN__ )
55321936Shselasky#if defined( EXPORT_AL_SYMBOLS )
56321936Shselasky#define OSM_EXPORT	__declspec(dllexport)
57321936Shselasky#else
58321936Shselasky#define OSM_EXPORT	__declspec(dllimport)
59321936Shselasky#endif
60321936Shselasky#define OSM_API __stdcall
61321936Shselasky#define OSM_CDECL __cdecl
62321936Shselasky#else
63321936Shselasky#define OSM_EXPORT	extern
64321936Shselasky#define OSM_API
65321936Shselasky#define OSM_CDECL
66321936Shselasky#define __ptr64
67321936Shselasky#endif
68321936Shselasky/****h* IBA Base/Constants
69321936Shselasky* NAME
70321936Shselasky*	Constants
71321936Shselasky*
72321936Shselasky* DESCRIPTION
73321936Shselasky*	The following constants are used throughout the IBA code base.
74321936Shselasky*
75321936Shselasky*	Definitions are from the InfiniBand Architecture Specification v1.3.1
76321936Shselasky*
77321936Shselasky*********/
78321936Shselasky/****d* IBA Base: Constants/MAD_BLOCK_SIZE
79321936Shselasky* NAME
80321936Shselasky*	MAD_BLOCK_SIZE
81321936Shselasky*
82321936Shselasky* DESCRIPTION
83321936Shselasky*	Size of a non-RMPP MAD datagram.
84321936Shselasky*
85321936Shselasky* SOURCE
86321936Shselasky*/
87321936Shselasky#define MAD_BLOCK_SIZE						256
88321936Shselasky/**********/
89321936Shselasky/****d* IBA Base: Constants/MAD_RMPP_HDR_SIZE
90321936Shselasky* NAME
91321936Shselasky*	MAD_RMPP_HDR_SIZE
92321936Shselasky*
93321936Shselasky* DESCRIPTION
94321936Shselasky*	Size of an RMPP header, including the common MAD header.
95321936Shselasky*
96321936Shselasky* SOURCE
97321936Shselasky*/
98321936Shselasky#define MAD_RMPP_HDR_SIZE					36
99321936Shselasky/**********/
100321936Shselasky/****d* IBA Base: Constants/MAD_RMPP_DATA_SIZE
101321936Shselasky* NAME
102321936Shselasky*	MAD_RMPP_DATA_SIZE
103321936Shselasky*
104321936Shselasky* DESCRIPTION
105321936Shselasky*	Size of an RMPP transaction data section.
106321936Shselasky*
107321936Shselasky* SOURCE
108321936Shselasky*/
109321936Shselasky#define MAD_RMPP_DATA_SIZE		(MAD_BLOCK_SIZE - MAD_RMPP_HDR_SIZE)
110321936Shselasky/**********/
111321936Shselasky/****d* IBA Base: Constants/MAD_BLOCK_GRH_SIZE
112321936Shselasky* NAME
113321936Shselasky*	MAD_BLOCK_GRH_SIZE
114321936Shselasky*
115321936Shselasky* DESCRIPTION
116321936Shselasky*	Size of a MAD datagram, including the GRH.
117321936Shselasky*
118321936Shselasky* SOURCE
119321936Shselasky*/
120321936Shselasky#define MAD_BLOCK_GRH_SIZE					296
121321936Shselasky/**********/
122321936Shselasky/****d* IBA Base: Constants/IB_LID_PERMISSIVE
123321936Shselasky* NAME
124321936Shselasky*	IB_LID_PERMISSIVE
125321936Shselasky*
126321936Shselasky* DESCRIPTION
127321936Shselasky*	Permissive LID
128321936Shselasky*
129321936Shselasky* SOURCE
130321936Shselasky*/
131321936Shselasky#define IB_LID_PERMISSIVE					0xFFFF
132321936Shselasky/**********/
133321936Shselasky/****d* IBA Base: Constants/IB_DEFAULT_PKEY
134321936Shselasky* NAME
135321936Shselasky*	IB_DEFAULT_PKEY
136321936Shselasky*
137321936Shselasky* DESCRIPTION
138321936Shselasky*	P_Key value for the default partition.
139321936Shselasky*
140321936Shselasky* SOURCE
141321936Shselasky*/
142321936Shselasky#define IB_DEFAULT_PKEY						0xFFFF
143321936Shselasky/**********/
144321936Shselasky/****d* IBA Base: Constants/IB_QP1_WELL_KNOWN_Q_KEY
145321936Shselasky* NAME
146321936Shselasky*	IB_QP1_WELL_KNOWN_Q_KEY
147321936Shselasky*
148321936Shselasky* DESCRIPTION
149321936Shselasky*	Well-known Q_Key for QP1 privileged mode access (15.4.2).
150321936Shselasky*
151321936Shselasky* SOURCE
152321936Shselasky*/
153321936Shselasky#define IB_QP1_WELL_KNOWN_Q_KEY				CL_HTON32(0x80010000)
154321936Shselasky/*********/
155321936Shselasky#define IB_QP0						0
156321936Shselasky#define IB_QP1						CL_HTON32(1)
157321936Shselasky#define IB_QP_PRIVILEGED_Q_KEY				CL_HTON32(0x80000000)
158321936Shselasky/****d* IBA Base: Constants/IB_LID_UCAST_START
159321936Shselasky* NAME
160321936Shselasky*	IB_LID_UCAST_START
161321936Shselasky*
162321936Shselasky* DESCRIPTION
163321936Shselasky*	Lowest valid unicast LID value.
164321936Shselasky*
165321936Shselasky* SOURCE
166321936Shselasky*/
167321936Shselasky#define IB_LID_UCAST_START_HO				0x0001
168321936Shselasky#define IB_LID_UCAST_START				(CL_HTON16(IB_LID_UCAST_START_HO))
169321936Shselasky/**********/
170321936Shselasky/****d* IBA Base: Constants/IB_LID_UCAST_END
171321936Shselasky* NAME
172321936Shselasky*	IB_LID_UCAST_END
173321936Shselasky*
174321936Shselasky* DESCRIPTION
175321936Shselasky*	Highest valid unicast LID value.
176321936Shselasky*
177321936Shselasky* SOURCE
178321936Shselasky*/
179321936Shselasky#define IB_LID_UCAST_END_HO				0xBFFF
180321936Shselasky#define IB_LID_UCAST_END				(CL_HTON16(IB_LID_UCAST_END_HO))
181321936Shselasky/**********/
182321936Shselasky/****d* IBA Base: Constants/IB_LID_MCAST_START
183321936Shselasky* NAME
184321936Shselasky*	IB_LID_MCAST_START
185321936Shselasky*
186321936Shselasky* DESCRIPTION
187321936Shselasky*	Lowest valid multicast LID value.
188321936Shselasky*
189321936Shselasky* SOURCE
190321936Shselasky*/
191321936Shselasky#define IB_LID_MCAST_START_HO				0xC000
192321936Shselasky#define IB_LID_MCAST_START				(CL_HTON16(IB_LID_MCAST_START_HO))
193321936Shselasky/**********/
194321936Shselasky/****d* IBA Base: Constants/IB_LID_MCAST_END
195321936Shselasky* NAME
196321936Shselasky*	IB_LID_MCAST_END
197321936Shselasky*
198321936Shselasky* DESCRIPTION
199321936Shselasky*	Highest valid multicast LID value.
200321936Shselasky*
201321936Shselasky* SOURCE
202321936Shselasky*/
203321936Shselasky#define IB_LID_MCAST_END_HO				0xFFFE
204321936Shselasky#define IB_LID_MCAST_END				(CL_HTON16(IB_LID_MCAST_END_HO))
205321936Shselasky/**********/
206321936Shselasky/****d* IBA Base: Constants/IB_DEFAULT_SUBNET_PREFIX
207321936Shselasky* NAME
208321936Shselasky*	IB_DEFAULT_SUBNET_PREFIX
209321936Shselasky*
210321936Shselasky* DESCRIPTION
211321936Shselasky*	Default subnet GID prefix.
212321936Shselasky*
213321936Shselasky* SOURCE
214321936Shselasky*/
215321936Shselasky#define IB_DEFAULT_SUBNET_PREFIX			(CL_HTON64(0xFE80000000000000ULL))
216321936Shselasky#define IB_DEFAULT_SUBNET_PREFIX_HO			(0xFE80000000000000ULL)
217321936Shselasky/**********/
218321936Shselasky/****d* IBA Base: Constants/IB_NODE_NUM_PORTS_MAX
219321936Shselasky* NAME
220321936Shselasky*	IB_NODE_NUM_PORTS_MAX
221321936Shselasky*
222321936Shselasky* DESCRIPTION
223321936Shselasky*	Maximum number of ports in a single node (14.2.5.7).
224321936Shselasky* SOURCE
225321936Shselasky*/
226321936Shselasky#define IB_NODE_NUM_PORTS_MAX				0xFE
227321936Shselasky/**********/
228321936Shselasky/****d* IBA Base: Constants/IB_INVALID_PORT_NUM
229321936Shselasky* NAME
230321936Shselasky*	IB_INVALID_PORT_NUM
231321936Shselasky*
232321936Shselasky* DESCRIPTION
233321936Shselasky*	Value used to indicate an invalid port number (14.2.5.10).
234321936Shselasky*
235321936Shselasky* SOURCE
236321936Shselasky*/
237321936Shselasky#define IB_INVALID_PORT_NUM				0xFF
238321936Shselasky/*********/
239321936Shselasky/****d* IBA Base: Constants/IB_SUBNET_PATH_HOPS_MAX
240321936Shselasky* NAME
241321936Shselasky*	IB_SUBNET_PATH_HOPS_MAX
242321936Shselasky*
243321936Shselasky* DESCRIPTION
244321936Shselasky*	Maximum number of directed route switch hops in a subnet (14.2.1.2).
245321936Shselasky*
246321936Shselasky* SOURCE
247321936Shselasky*/
248321936Shselasky#define IB_SUBNET_PATH_HOPS_MAX				64
249321936Shselasky/*********/
250321936Shselasky/****d* IBA Base: Constants/IB_HOPLIMIT_MAX
251321936Shselasky* NAME
252321936Shselasky*	IB_HOPLIMIT_MAX
253321936Shselasky*
254321936Shselasky* DESCRIPTION
255321936Shselasky*       Maximum number of router hops allowed.
256321936Shselasky*
257321936Shselasky* SOURCE
258321936Shselasky*/
259321936Shselasky#define IB_HOPLIMIT_MAX					255
260321936Shselasky/*********/
261321936Shselasky/****d* IBA Base: Constants/IB_MC_SCOPE_*
262321936Shselasky* NAME
263321936Shselasky*	IB_MC_SCOPE_*
264321936Shselasky*
265321936Shselasky* DESCRIPTION
266321936Shselasky*	Scope component definitions from IBA 1.2.1 (Table 3 p. 148)
267321936Shselasky*/
268321936Shselasky#define IB_MC_SCOPE_LINK_LOCAL		0x2
269321936Shselasky#define IB_MC_SCOPE_SITE_LOCAL		0x5
270321936Shselasky#define IB_MC_SCOPE_ORG_LOCAL		0x8
271321936Shselasky#define IB_MC_SCOPE_GLOBAL		0xE
272321936Shselasky/*********/
273321936Shselasky/****d* IBA Base: Constants/IB_PKEY_MAX_BLOCKS
274321936Shselasky* NAME
275321936Shselasky*	IB_PKEY_MAX_BLOCKS
276321936Shselasky*
277321936Shselasky* DESCRIPTION
278321936Shselasky*	Maximum number of PKEY blocks (14.2.5.7).
279321936Shselasky*
280321936Shselasky* SOURCE
281321936Shselasky*/
282321936Shselasky#define IB_PKEY_MAX_BLOCKS				2048
283321936Shselasky/*********/
284321936Shselasky/****d* IBA Base: Constants/IB_MCAST_MAX_BLOCK_ID
285321936Shselasky* NAME
286321936Shselasky*	IB_MCAST_MAX_BLOCK_ID
287321936Shselasky*
288321936Shselasky* DESCRIPTION
289321936Shselasky*	Maximum number of Multicast port mask blocks
290321936Shselasky*
291321936Shselasky* SOURCE
292321936Shselasky*/
293321936Shselasky#define IB_MCAST_MAX_BLOCK_ID				511
294321936Shselasky/*********/
295321936Shselasky/****d* IBA Base: Constants/IB_MCAST_BLOCK_ID_MASK_HO
296321936Shselasky* NAME
297321936Shselasky*	IB_MCAST_BLOCK_ID_MASK_HO
298321936Shselasky*
299321936Shselasky* DESCRIPTION
300321936Shselasky*	Mask (host order) to recover the Multicast block ID.
301321936Shselasky*
302321936Shselasky* SOURCE
303321936Shselasky*/
304321936Shselasky#define IB_MCAST_BLOCK_ID_MASK_HO			0x000001FF
305321936Shselasky/*********/
306321936Shselasky/****d* IBA Base: Constants/IB_MCAST_BLOCK_SIZE
307321936Shselasky* NAME
308321936Shselasky*	IB_MCAST_BLOCK_SIZE
309321936Shselasky*
310321936Shselasky* DESCRIPTION
311321936Shselasky*	Number of port mask entries in a multicast forwarding table block.
312321936Shselasky*
313321936Shselasky* SOURCE
314321936Shselasky*/
315321936Shselasky#define IB_MCAST_BLOCK_SIZE				32
316321936Shselasky/*********/
317321936Shselasky/****d* IBA Base: Constants/IB_MCAST_MASK_SIZE
318321936Shselasky* NAME
319321936Shselasky*	IB_MCAST_MASK_SIZE
320321936Shselasky*
321321936Shselasky* DESCRIPTION
322321936Shselasky*	Number of port mask bits in each entry in the multicast forwarding table.
323321936Shselasky*
324321936Shselasky* SOURCE
325321936Shselasky*/
326321936Shselasky#define IB_MCAST_MASK_SIZE				16
327321936Shselasky/*********/
328321936Shselasky/****d* IBA Base: Constants/IB_MCAST_POSITION_MASK_HO
329321936Shselasky* NAME
330321936Shselasky*	IB_MCAST_POSITION_MASK_HO
331321936Shselasky*
332321936Shselasky* DESCRIPTION
333321936Shselasky*	Mask (host order) to recover the multicast block position.
334321936Shselasky*
335321936Shselasky* SOURCE
336321936Shselasky*/
337321936Shselasky#define IB_MCAST_POSITION_MASK_HO			0xF0000000
338321936Shselasky/*********/
339321936Shselasky/****d* IBA Base: Constants/IB_MCAST_POSITION_MAX
340321936Shselasky* NAME
341321936Shselasky*	IB_MCAST_POSITION_MAX
342321936Shselasky*
343321936Shselasky* DESCRIPTION
344321936Shselasky*	Maximum value for the multicast block position.
345321936Shselasky*
346321936Shselasky* SOURCE
347321936Shselasky*/
348321936Shselasky#define IB_MCAST_POSITION_MAX				0xF
349321936Shselasky/*********/
350321936Shselasky/****d* IBA Base: Constants/IB_MCAST_POSITION_SHIFT
351321936Shselasky* NAME
352321936Shselasky*	IB_MCAST_POSITION_SHIFT
353321936Shselasky*
354321936Shselasky* DESCRIPTION
355321936Shselasky*	Shift value to normalize the multicast block position value.
356321936Shselasky*
357321936Shselasky* SOURCE
358321936Shselasky*/
359321936Shselasky#define IB_MCAST_POSITION_SHIFT				28
360321936Shselasky/*********/
361321936Shselasky/****d* IBA Base: Constants/IB_PKEY_ENTRIES_MAX
362321936Shselasky* NAME
363321936Shselasky*	IB_PKEY_ENTRIES_MAX
364321936Shselasky*
365321936Shselasky* DESCRIPTION
366321936Shselasky*	Maximum number of PKEY entries per port (14.2.5.7).
367321936Shselasky*
368321936Shselasky* SOURCE
369321936Shselasky*/
370321936Shselasky#define IB_PKEY_ENTRIES_MAX (IB_PKEY_MAX_BLOCKS * IB_NUM_PKEY_ELEMENTS_IN_BLOCK)
371321936Shselasky/*********/
372321936Shselasky/****d* IBA Base: Constants/IB_PKEY_BASE_MASK
373321936Shselasky* NAME
374321936Shselasky*	IB_PKEY_BASE_MASK
375321936Shselasky*
376321936Shselasky* DESCRIPTION
377321936Shselasky*	Masks for the base P_Key value given a P_Key Entry.
378321936Shselasky*
379321936Shselasky* SOURCE
380321936Shselasky*/
381321936Shselasky#define IB_PKEY_BASE_MASK				(CL_HTON16(0x7FFF))
382321936Shselasky/*********/
383321936Shselasky/****d* IBA Base: Constants/IB_PKEY_TYPE_MASK
384321936Shselasky* NAME
385321936Shselasky*	IB_PKEY_TYPE_MASK
386321936Shselasky*
387321936Shselasky* DESCRIPTION
388321936Shselasky*	Masks for the P_Key membership type given a P_Key Entry.
389321936Shselasky*
390321936Shselasky* SOURCE
391321936Shselasky*/
392321936Shselasky#define IB_PKEY_TYPE_MASK				(CL_HTON16(0x8000))
393321936Shselasky/*********/
394321936Shselasky/****d* IBA Base: Constants/IB_DEFAULT_PARTIAL_PKEY
395321936Shselasky* NAME
396321936Shselasky*	IB_DEFAULT_PARTIAL_PKEY
397321936Shselasky*
398321936Shselasky* DESCRIPTION
399321936Shselasky*	0x7FFF in network order
400321936Shselasky*
401321936Shselasky* SOURCE
402321936Shselasky*/
403321936Shselasky#define IB_DEFAULT_PARTIAL_PKEY				(CL_HTON16(0x7FFF))
404321936Shselasky/**********/
405321936Shselasky/****d* IBA Base: Constants/IB_MCLASS_SUBN_LID
406321936Shselasky* NAME
407321936Shselasky*	IB_MCLASS_SUBN_LID
408321936Shselasky*
409321936Shselasky* DESCRIPTION
410321936Shselasky*	Subnet Management Class, Subnet Manager LID routed (13.4.4)
411321936Shselasky*
412321936Shselasky* SOURCE
413321936Shselasky*/
414321936Shselasky#define IB_MCLASS_SUBN_LID				0x01
415321936Shselasky/**********/
416321936Shselasky/****d* IBA Base: Constants/IB_MCLASS_SUBN_DIR
417321936Shselasky* NAME
418321936Shselasky*	IB_MCLASS_SUBN_DIR
419321936Shselasky*
420321936Shselasky* DESCRIPTION
421321936Shselasky*	Subnet Management Class, Subnet Manager directed route (13.4.4)
422321936Shselasky*
423321936Shselasky* SOURCE
424321936Shselasky*/
425321936Shselasky#define IB_MCLASS_SUBN_DIR				0x81
426321936Shselasky/**********/
427321936Shselasky/****d* IBA Base: Constants/IB_MCLASS_SUBN_ADM
428321936Shselasky* NAME
429321936Shselasky*	IB_MCLASS_SUBN_ADM
430321936Shselasky*
431321936Shselasky* DESCRIPTION
432321936Shselasky*	Management Class, Subnet Administration (13.4.4)
433321936Shselasky*
434321936Shselasky* SOURCE
435321936Shselasky*/
436321936Shselasky#define IB_MCLASS_SUBN_ADM				0x03
437321936Shselasky/**********/
438321936Shselasky/****d* IBA Base: Constants/IB_MCLASS_PERF
439321936Shselasky* NAME
440321936Shselasky*	IB_MCLASS_PERF
441321936Shselasky*
442321936Shselasky* DESCRIPTION
443321936Shselasky*	Management Class, Performance Management (13.4.4)
444321936Shselasky*
445321936Shselasky* SOURCE
446321936Shselasky*/
447321936Shselasky#define IB_MCLASS_PERF					0x04
448321936Shselasky/**********/
449321936Shselasky/****d* IBA Base: Constants/IB_MCLASS_BM
450321936Shselasky* NAME
451321936Shselasky*	IB_MCLASS_BM
452321936Shselasky*
453321936Shselasky* DESCRIPTION
454321936Shselasky*	Management Class, Baseboard Management (13.4.4)
455321936Shselasky*
456321936Shselasky* SOURCE
457321936Shselasky*/
458321936Shselasky#define IB_MCLASS_BM					0x05
459321936Shselasky/**********/
460321936Shselasky/****d* IBA Base: Constants/IB_MCLASS_DEV_MGMT
461321936Shselasky* NAME
462321936Shselasky*	IB_MCLASS_DEV_MGMT
463321936Shselasky*
464321936Shselasky* DESCRIPTION
465321936Shselasky*	Management Class, Device Management (13.4.4)
466321936Shselasky*
467321936Shselasky* SOURCE
468321936Shselasky*/
469321936Shselasky#define IB_MCLASS_DEV_MGMT				0x06
470321936Shselasky/**********/
471321936Shselasky/****d* IBA Base: Constants/IB_MCLASS_COMM_MGMT
472321936Shselasky* NAME
473321936Shselasky*	IB_MCLASS_COMM_MGMT
474321936Shselasky*
475321936Shselasky* DESCRIPTION
476321936Shselasky*	Management Class, Communication Management (13.4.4)
477321936Shselasky*
478321936Shselasky* SOURCE
479321936Shselasky*/
480321936Shselasky#define IB_MCLASS_COMM_MGMT				0x07
481321936Shselasky/**********/
482321936Shselasky/****d* IBA Base: Constants/IB_MCLASS_SNMP
483321936Shselasky* NAME
484321936Shselasky*	IB_MCLASS_SNMP
485321936Shselasky*
486321936Shselasky* DESCRIPTION
487321936Shselasky*	Management Class, SNMP Tunneling (13.4.4)
488321936Shselasky*
489321936Shselasky* SOURCE
490321936Shselasky*/
491321936Shselasky#define IB_MCLASS_SNMP					0x08
492321936Shselasky/**********/
493321936Shselasky/****d* IBA Base: Constants/IB_MCLASS_VENDOR_LOW_RANGE_MIN
494321936Shselasky* NAME
495321936Shselasky*	IB_MCLASS_VENDOR_LOW_RANGE_MIN
496321936Shselasky*
497321936Shselasky* DESCRIPTION
498321936Shselasky*	Management Class, Vendor Specific Low Range Start
499321936Shselasky*
500321936Shselasky* SOURCE
501321936Shselasky*/
502321936Shselasky#define IB_MCLASS_VENDOR_LOW_RANGE_MIN			0x09
503321936Shselasky/**********/
504321936Shselasky/****d* IBA Base: Constants/IB_MCLASS_VENDOR_LOW_RANGE_MAX
505321936Shselasky* NAME
506321936Shselasky*	IB_MCLASS_VENDOR_LOW_RANGE_MAX
507321936Shselasky*
508321936Shselasky* DESCRIPTION
509321936Shselasky*	Management Class, Vendor Specific Low Range End
510321936Shselasky*
511321936Shselasky* SOURCE
512321936Shselasky*/
513321936Shselasky#define IB_MCLASS_VENDOR_LOW_RANGE_MAX			0x0F
514321936Shselasky/**********/
515321936Shselasky/****d* IBA Base: Constants/IB_MCLASS_DEV_ADM
516321936Shselasky* NAME
517321936Shselasky*	IB_MCLASS_DEV_ADM
518321936Shselasky*
519321936Shselasky* DESCRIPTION
520321936Shselasky*	Management Class, Device Administration
521321936Shselasky*
522321936Shselasky* SOURCE
523321936Shselasky*/
524321936Shselasky#define IB_MCLASS_DEV_ADM				0x10
525321936Shselasky/**********/
526321936Shselasky/****d* IBA Base: Constants/IB_MCLASS_BIS
527321936Shselasky* NAME
528321936Shselasky*	IB_MCLASS_BIS
529321936Shselasky*
530321936Shselasky* DESCRIPTION
531321936Shselasky*	Management Class, BIS
532321936Shselasky*
533321936Shselasky* SOURCE
534321936Shselasky*/
535321936Shselasky#define IB_MCLASS_BIS					0x12
536321936Shselasky/**********/
537321936Shselasky/****d* IBA Base: Constants/IB_MCLASS_CC
538321936Shselasky* NAME
539321936Shselasky*	IB_MCLASS_CC
540321936Shselasky*
541321936Shselasky* DESCRIPTION
542321936Shselasky*	Management Class, Congestion Control (A10.4.1)
543321936Shselasky*
544321936Shselasky* SOURCE
545321936Shselasky*/
546321936Shselasky#define IB_MCLASS_CC					0x21
547321936Shselasky/**********/
548321936Shselasky/****d* IBA Base: Constants/IB_MCLASS_VENDOR_HIGH_RANGE_MIN
549321936Shselasky* NAME
550321936Shselasky*	IB_MCLASS_VENDOR_HIGH_RANGE_MIN
551321936Shselasky*
552321936Shselasky* DESCRIPTION
553321936Shselasky*	Management Class, Vendor Specific High Range Start
554321936Shselasky*
555321936Shselasky* SOURCE
556321936Shselasky*/
557321936Shselasky#define IB_MCLASS_VENDOR_HIGH_RANGE_MIN			0x30
558321936Shselasky/**********/
559321936Shselasky/****d* IBA Base: Constants/IB_MCLASS_VENDOR_HIGH_RANGE_MAX
560321936Shselasky* NAME
561321936Shselasky*	IB_MCLASS_VENDOR_HIGH_RANGE_MAX
562321936Shselasky*
563321936Shselasky* DESCRIPTION
564321936Shselasky*	Management Class, Vendor Specific High Range End
565321936Shselasky*
566321936Shselasky* SOURCE
567321936Shselasky*/
568321936Shselasky#define IB_MCLASS_VENDOR_HIGH_RANGE_MAX			0x4F
569321936Shselasky/**********/
570321936Shselasky/****f* IBA Base: Types/ib_class_is_vendor_specific_low
571321936Shselasky* NAME
572321936Shselasky*	ib_class_is_vendor_specific_low
573321936Shselasky*
574321936Shselasky* DESCRIPTION
575321936Shselasky*	Indicates if the Class Code if a vendor specific class from
576321936Shselasky*  the low range
577321936Shselasky*
578321936Shselasky* SYNOPSIS
579321936Shselasky*/
580321936Shselaskystatic inline boolean_t OSM_API
581321936Shselaskyib_class_is_vendor_specific_low(IN const uint8_t class_code)
582321936Shselasky{
583321936Shselasky	return ((class_code >= IB_MCLASS_VENDOR_LOW_RANGE_MIN) &&
584321936Shselasky		(class_code <= IB_MCLASS_VENDOR_LOW_RANGE_MAX));
585321936Shselasky}
586321936Shselasky
587321936Shselasky/*
588321936Shselasky* PARAMETERS
589321936Shselasky*	class_code
590321936Shselasky*		[in] The Management Datagram Class Code
591321936Shselasky*
592321936Shselasky* RETURN VALUE
593321936Shselasky*	TRUE if the class is in the Low range of Vendor Specific MADs
594321936Shselasky*	FALSE otherwise.
595321936Shselasky*
596321936Shselasky* NOTES
597321936Shselasky*
598321936Shselasky* SEE ALSO
599321936Shselasky* IB_MCLASS_VENDOR_LOW_RANGE_MIN, IB_MCLASS_VENDOR_LOW_RANGE_MAX
600321936Shselasky*********/
601321936Shselasky
602321936Shselasky/****f* IBA Base: Types/ib_class_is_vendor_specific_high
603321936Shselasky* NAME
604321936Shselasky*	ib_class_is_vendor_specific_high
605321936Shselasky*
606321936Shselasky* DESCRIPTION
607321936Shselasky*	Indicates if the Class Code if a vendor specific class from
608321936Shselasky*  the high range
609321936Shselasky*
610321936Shselasky* SYNOPSIS
611321936Shselasky*/
612321936Shselaskystatic inline boolean_t OSM_API
613321936Shselaskyib_class_is_vendor_specific_high(IN const uint8_t class_code)
614321936Shselasky{
615321936Shselasky	return ((class_code >= IB_MCLASS_VENDOR_HIGH_RANGE_MIN) &&
616321936Shselasky		(class_code <= IB_MCLASS_VENDOR_HIGH_RANGE_MAX));
617321936Shselasky}
618321936Shselasky
619321936Shselasky/*
620321936Shselasky* PARAMETERS
621321936Shselasky*	class_code
622321936Shselasky*		[in] The Management Datagram Class Code
623321936Shselasky*
624321936Shselasky* RETURN VALUE
625321936Shselasky*	TRUE if the class is in the High range of Vendor Specific MADs
626321936Shselasky*	FALSE otherwise.
627321936Shselasky*
628321936Shselasky* NOTES
629321936Shselasky*
630321936Shselasky* SEE ALSO
631321936Shselasky* IB_MCLASS_VENDOR_HIGH_RANGE_MIN, IB_MCLASS_VENDOR_HIGH_RANGE_MAX
632321936Shselasky*********/
633321936Shselasky
634321936Shselasky/****f* IBA Base: Types/ib_class_is_vendor_specific
635321936Shselasky* NAME
636321936Shselasky*	ib_class_is_vendor_specific
637321936Shselasky*
638321936Shselasky* DESCRIPTION
639321936Shselasky*	Indicates if the Class Code if a vendor specific class
640321936Shselasky*
641321936Shselasky* SYNOPSIS
642321936Shselasky*/
643321936Shselaskystatic inline boolean_t OSM_API
644321936Shselaskyib_class_is_vendor_specific(IN const uint8_t class_code)
645321936Shselasky{
646321936Shselasky	return (ib_class_is_vendor_specific_low(class_code) ||
647321936Shselasky		ib_class_is_vendor_specific_high(class_code));
648321936Shselasky}
649321936Shselasky
650321936Shselasky/*
651321936Shselasky* PARAMETERS
652321936Shselasky*	class_code
653321936Shselasky*		[in] The Management Datagram Class Code
654321936Shselasky*
655321936Shselasky* RETURN VALUE
656321936Shselasky*	TRUE if the class is a Vendor Specific MAD
657321936Shselasky*	FALSE otherwise.
658321936Shselasky*
659321936Shselasky* NOTES
660321936Shselasky*
661321936Shselasky* SEE ALSO
662321936Shselasky*  ib_class_is_vendor_specific_low, ib_class_is_vendor_specific_high
663321936Shselasky*********/
664321936Shselasky
665321936Shselasky/****f* IBA Base: Types/ib_class_is_rmpp
666321936Shselasky* NAME
667321936Shselasky*	ib_class_is_rmpp
668321936Shselasky*
669321936Shselasky* DESCRIPTION
670321936Shselasky*	Indicates if the Class Code supports RMPP
671321936Shselasky*
672321936Shselasky* SYNOPSIS
673321936Shselasky*/
674321936Shselaskystatic inline boolean_t OSM_API ib_class_is_rmpp(IN const uint8_t class_code)
675321936Shselasky{
676321936Shselasky	return ((class_code == IB_MCLASS_SUBN_ADM) ||
677321936Shselasky		(class_code == IB_MCLASS_DEV_MGMT) ||
678321936Shselasky		(class_code == IB_MCLASS_DEV_ADM) ||
679321936Shselasky		(class_code == IB_MCLASS_BIS) ||
680321936Shselasky		ib_class_is_vendor_specific_high(class_code));
681321936Shselasky}
682321936Shselasky
683321936Shselasky/*
684321936Shselasky* PARAMETERS
685321936Shselasky*	class_code
686321936Shselasky*		[in] The Management Datagram Class Code
687321936Shselasky*
688321936Shselasky* RETURN VALUE
689321936Shselasky*	TRUE if the class supports RMPP
690321936Shselasky*	FALSE otherwise.
691321936Shselasky*
692321936Shselasky* NOTES
693321936Shselasky*
694321936Shselasky*********/
695321936Shselasky
696321936Shselasky/*
697321936Shselasky *	MAD methods
698321936Shselasky */
699321936Shselasky
700321936Shselasky/****d* IBA Base: Constants/IB_MAX_METHOD
701321936Shselasky* NAME
702321936Shselasky*	IB_MAX_METHOD
703321936Shselasky*
704321936Shselasky* DESCRIPTION
705321936Shselasky*	Total number of methods available to a class, not including the R-bit.
706321936Shselasky*
707321936Shselasky* SOURCE
708321936Shselasky*/
709321936Shselasky#define IB_MAX_METHODS						128
710321936Shselasky/**********/
711321936Shselasky
712321936Shselasky/****d* IBA Base: Constants/IB_MAD_METHOD_RESP_MASK
713321936Shselasky* NAME
714321936Shselasky*	IB_MAD_METHOD_RESP_MASK
715321936Shselasky*
716321936Shselasky* DESCRIPTION
717321936Shselasky*	Response mask to extract 'R' bit from the method field. (13.4.5)
718321936Shselasky*
719321936Shselasky* SOURCE
720321936Shselasky*/
721321936Shselasky#define IB_MAD_METHOD_RESP_MASK				0x80
722321936Shselasky/**********/
723321936Shselasky
724321936Shselasky/****d* IBA Base: Constants/IB_MAD_METHOD_GET
725321936Shselasky* NAME
726321936Shselasky*	IB_MAD_METHOD_GET
727321936Shselasky*
728321936Shselasky* DESCRIPTION
729321936Shselasky*	Get() Method (13.4.5)
730321936Shselasky*
731321936Shselasky* SOURCE
732321936Shselasky*/
733321936Shselasky#define IB_MAD_METHOD_GET					0x01
734321936Shselasky/**********/
735321936Shselasky
736321936Shselasky/****d* IBA Base: Constants/IB_MAD_METHOD_SET
737321936Shselasky* NAME
738321936Shselasky*	IB_MAD_METHOD_SET
739321936Shselasky*
740321936Shselasky* DESCRIPTION
741321936Shselasky*	Set() Method (13.4.5)
742321936Shselasky*
743321936Shselasky* SOURCE
744321936Shselasky*/
745321936Shselasky#define IB_MAD_METHOD_SET					0x02
746321936Shselasky/**********/
747321936Shselasky
748321936Shselasky/****d* IBA Base: Constants/IB_MAD_METHOD_GET_RESP
749321936Shselasky* NAME
750321936Shselasky*	IB_MAD_METHOD_GET_RESP
751321936Shselasky*
752321936Shselasky* DESCRIPTION
753321936Shselasky*	GetResp() Method (13.4.5)
754321936Shselasky*
755321936Shselasky* SOURCE
756321936Shselasky*/
757321936Shselasky#define IB_MAD_METHOD_GET_RESP				0x81
758321936Shselasky/**********/
759321936Shselasky
760321936Shselasky#define IB_MAD_METHOD_DELETE				0x15
761321936Shselasky
762321936Shselasky/****d* IBA Base: Constants/IB_MAD_METHOD_GETTABLE
763321936Shselasky* NAME
764321936Shselasky*	IB_MAD_METHOD_GETTABLE
765321936Shselasky*
766321936Shselasky* DESCRIPTION
767321936Shselasky*	SubnAdmGetTable() Method (15.2.2)
768321936Shselasky*
769321936Shselasky* SOURCE
770321936Shselasky*/
771321936Shselasky#define IB_MAD_METHOD_GETTABLE				0x12
772321936Shselasky/**********/
773321936Shselasky
774321936Shselasky/****d* IBA Base: Constants/IB_MAD_METHOD_GETTABLE_RESP
775321936Shselasky* NAME
776321936Shselasky*	IB_MAD_METHOD_GETTABLE_RESP
777321936Shselasky*
778321936Shselasky* DESCRIPTION
779321936Shselasky*	SubnAdmGetTableResp() Method (15.2.2)
780321936Shselasky*
781321936Shselasky* SOURCE
782321936Shselasky*/
783321936Shselasky#define IB_MAD_METHOD_GETTABLE_RESP			0x92
784321936Shselasky
785321936Shselasky/**********/
786321936Shselasky
787321936Shselasky#define IB_MAD_METHOD_GETTRACETABLE			0x13
788321936Shselasky#define IB_MAD_METHOD_GETMULTI				0x14
789321936Shselasky#define IB_MAD_METHOD_GETMULTI_RESP			0x94
790321936Shselasky
791321936Shselasky/****d* IBA Base: Constants/IB_MAD_METHOD_SEND
792321936Shselasky* NAME
793321936Shselasky*	IB_MAD_METHOD_SEND
794321936Shselasky*
795321936Shselasky* DESCRIPTION
796321936Shselasky*	Send() Method (13.4.5)
797321936Shselasky*
798321936Shselasky* SOURCE
799321936Shselasky*/
800321936Shselasky#define IB_MAD_METHOD_SEND					0x03
801321936Shselasky/**********/
802321936Shselasky
803321936Shselasky/****d* IBA Base: Constants/IB_MAD_METHOD_TRAP
804321936Shselasky* NAME
805321936Shselasky*	IB_MAD_METHOD_TRAP
806321936Shselasky*
807321936Shselasky* DESCRIPTION
808321936Shselasky*	Trap() Method (13.4.5)
809321936Shselasky*
810321936Shselasky* SOURCE
811321936Shselasky*/
812321936Shselasky#define IB_MAD_METHOD_TRAP					0x05
813321936Shselasky/**********/
814321936Shselasky
815321936Shselasky/****d* IBA Base: Constants/IB_MAD_METHOD_REPORT
816321936Shselasky* NAME
817321936Shselasky*	IB_MAD_METHOD_REPORT
818321936Shselasky*
819321936Shselasky* DESCRIPTION
820321936Shselasky*	Report() Method (13.4.5)
821321936Shselasky*
822321936Shselasky* SOURCE
823321936Shselasky*/
824321936Shselasky#define IB_MAD_METHOD_REPORT				0x06
825321936Shselasky/**********/
826321936Shselasky
827321936Shselasky/****d* IBA Base: Constants/IB_MAD_METHOD_REPORT_RESP
828321936Shselasky* NAME
829321936Shselasky*	IB_MAD_METHOD_REPORT_RESP
830321936Shselasky*
831321936Shselasky* DESCRIPTION
832321936Shselasky*	ReportResp() Method (13.4.5)
833321936Shselasky*
834321936Shselasky* SOURCE
835321936Shselasky*/
836321936Shselasky#define IB_MAD_METHOD_REPORT_RESP			0x86
837321936Shselasky/**********/
838321936Shselasky
839321936Shselasky/****d* IBA Base: Constants/IB_MAD_METHOD_TRAP_REPRESS
840321936Shselasky* NAME
841321936Shselasky*	IB_MAD_METHOD_TRAP_REPRESS
842321936Shselasky*
843321936Shselasky* DESCRIPTION
844321936Shselasky*	TrapRepress() Method (13.4.5)
845321936Shselasky*
846321936Shselasky* SOURCE
847321936Shselasky*/
848321936Shselasky#define IB_MAD_METHOD_TRAP_REPRESS			0x07
849321936Shselasky/**********/
850321936Shselasky
851321936Shselasky/****d* IBA Base: Constants/IB_MAD_STATUS_BUSY
852321936Shselasky* NAME
853321936Shselasky*	IB_MAD_STATUS_BUSY
854321936Shselasky*
855321936Shselasky* DESCRIPTION
856321936Shselasky*	Temporarily busy, MAD discarded (13.4.7)
857321936Shselasky*
858321936Shselasky* SOURCE
859321936Shselasky*/
860321936Shselasky#define IB_MAD_STATUS_BUSY				(CL_HTON16(0x0001))
861321936Shselasky/**********/
862321936Shselasky
863321936Shselasky/****d* IBA Base: Constants/IB_MAD_STATUS_REDIRECT
864321936Shselasky* NAME
865321936Shselasky*	IB_MAD_STATUS_REDIRECT
866321936Shselasky*
867321936Shselasky* DESCRIPTION
868321936Shselasky*	QP Redirection required (13.4.7)
869321936Shselasky*
870321936Shselasky* SOURCE
871321936Shselasky*/
872321936Shselasky#define IB_MAD_STATUS_REDIRECT				(CL_HTON16(0x0002))
873321936Shselasky/**********/
874321936Shselasky
875321936Shselasky/****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_CLASS_VER
876321936Shselasky* NAME
877321936Shselasky*	IB_MAD_STATUS_UNSUP_CLASS_VER
878321936Shselasky*
879321936Shselasky* DESCRIPTION
880321936Shselasky*	Unsupported class version (13.4.7)
881321936Shselasky*
882321936Shselasky* SOURCE
883321936Shselasky*/
884321936Shselasky#define IB_MAD_STATUS_UNSUP_CLASS_VER			(CL_HTON16(0x0004))
885321936Shselasky/**********/
886321936Shselasky
887321936Shselasky/****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_METHOD
888321936Shselasky* NAME
889321936Shselasky*	IB_MAD_STATUS_UNSUP_METHOD
890321936Shselasky*
891321936Shselasky* DESCRIPTION
892321936Shselasky*	Unsupported method (13.4.7)
893321936Shselasky*
894321936Shselasky* SOURCE
895321936Shselasky*/
896321936Shselasky#define IB_MAD_STATUS_UNSUP_METHOD			(CL_HTON16(0x0008))
897321936Shselasky/**********/
898321936Shselasky
899321936Shselasky/****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_METHOD_ATTR
900321936Shselasky* NAME
901321936Shselasky*	IB_MAD_STATUS_UNSUP_METHOD_ATTR
902321936Shselasky*
903321936Shselasky* DESCRIPTION
904321936Shselasky*	Unsupported method/attribute combination (13.4.7)
905321936Shselasky*
906321936Shselasky* SOURCE
907321936Shselasky*/
908321936Shselasky#define IB_MAD_STATUS_UNSUP_METHOD_ATTR			(CL_HTON16(0x000C))
909321936Shselasky/**********/
910321936Shselasky
911321936Shselasky/****d* IBA Base: Constants/IB_MAD_STATUS_INVALID_FIELD
912321936Shselasky* NAME
913321936Shselasky*	IB_MAD_STATUS_INVALID_FIELD
914321936Shselasky*
915321936Shselasky* DESCRIPTION
916321936Shselasky*	Attribute contains one or more invalid fields (13.4.7)
917321936Shselasky*
918321936Shselasky* SOURCE
919321936Shselasky*/
920321936Shselasky#define IB_MAD_STATUS_INVALID_FIELD			(CL_HTON16(0x001C))
921321936Shselasky/**********/
922321936Shselasky
923321936Shselasky#define IB_MAD_STATUS_CLASS_MASK			(CL_HTON16(0xFF00))
924321936Shselasky
925321936Shselasky#define IB_SA_MAD_STATUS_SUCCESS			(CL_HTON16(0x0000))
926321936Shselasky#define IB_SA_MAD_STATUS_NO_RESOURCES			(CL_HTON16(0x0100))
927321936Shselasky#define IB_SA_MAD_STATUS_REQ_INVALID			(CL_HTON16(0x0200))
928321936Shselasky#define IB_SA_MAD_STATUS_NO_RECORDS			(CL_HTON16(0x0300))
929321936Shselasky#define IB_SA_MAD_STATUS_TOO_MANY_RECORDS		(CL_HTON16(0x0400))
930321936Shselasky#define IB_SA_MAD_STATUS_INVALID_GID			(CL_HTON16(0x0500))
931321936Shselasky#define IB_SA_MAD_STATUS_INSUF_COMPS			(CL_HTON16(0x0600))
932321936Shselasky#define IB_SA_MAD_STATUS_DENIED				(CL_HTON16(0x0700))
933321936Shselasky#define IB_SA_MAD_STATUS_PRIO_SUGGESTED			(CL_HTON16(0x0800))
934321936Shselasky
935321936Shselasky#define IB_DM_MAD_STATUS_NO_IOC_RESP			(CL_HTON16(0x0100))
936321936Shselasky#define IB_DM_MAD_STATUS_NO_SVC_ENTRIES			(CL_HTON16(0x0200))
937321936Shselasky#define IB_DM_MAD_STATUS_IOC_FAILURE			(CL_HTON16(0x8000))
938321936Shselasky
939321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_CLASS_PORT_INFO
940321936Shselasky* NAME
941321936Shselasky*	IB_MAD_ATTR_CLASS_PORT_INFO
942321936Shselasky*
943321936Shselasky* DESCRIPTION
944321936Shselasky*	ClassPortInfo attribute (13.4.8)
945321936Shselasky*
946321936Shselasky* SOURCE
947321936Shselasky*/
948321936Shselasky#define IB_MAD_ATTR_CLASS_PORT_INFO			(CL_HTON16(0x0001))
949321936Shselasky/**********/
950321936Shselasky
951321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_NOTICE
952321936Shselasky* NAME
953321936Shselasky*	IB_MAD_ATTR_NOTICE
954321936Shselasky*
955321936Shselasky* DESCRIPTION
956321936Shselasky*	Notice attribute (13.4.8)
957321936Shselasky*
958321936Shselasky* SOURCE
959321936Shselasky*/
960321936Shselasky#define IB_MAD_ATTR_NOTICE					(CL_HTON16(0x0002))
961321936Shselasky/**********/
962321936Shselasky
963321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_INFORM_INFO
964321936Shselasky* NAME
965321936Shselasky*	IB_MAD_ATTR_INFORM_INFO
966321936Shselasky*
967321936Shselasky* DESCRIPTION
968321936Shselasky*	InformInfo attribute (13.4.8)
969321936Shselasky*
970321936Shselasky* SOURCE
971321936Shselasky*/
972321936Shselasky#define IB_MAD_ATTR_INFORM_INFO				(CL_HTON16(0x0003))
973321936Shselasky/**********/
974321936Shselasky
975321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_NODE_DESC
976321936Shselasky* NAME
977321936Shselasky*	IB_MAD_ATTR_NODE_DESC
978321936Shselasky*
979321936Shselasky* DESCRIPTION
980321936Shselasky*	NodeDescription attribute (14.2.5)
981321936Shselasky*
982321936Shselasky* SOURCE
983321936Shselasky*/
984321936Shselasky#define IB_MAD_ATTR_NODE_DESC				(CL_HTON16(0x0010))
985321936Shselasky
986321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_SMPL_CTRL
987321936Shselasky* NAME
988321936Shselasky*	IB_MAD_ATTR_PORT_SMPL_CTRL
989321936Shselasky*
990321936Shselasky* DESCRIPTION
991321936Shselasky*	PortSamplesControl attribute (16.1.3)
992321936Shselasky*
993321936Shselasky* SOURCE
994321936Shselasky*/
995321936Shselasky#define IB_MAD_ATTR_PORT_SMPL_CTRL			(CL_HTON16(0x0010))
996321936Shselasky/**********/
997321936Shselasky
998321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_NODE_INFO
999321936Shselasky* NAME
1000321936Shselasky*	IB_MAD_ATTR_NODE_INFO
1001321936Shselasky*
1002321936Shselasky* DESCRIPTION
1003321936Shselasky*	NodeInfo attribute (14.2.5)
1004321936Shselasky*
1005321936Shselasky* SOURCE
1006321936Shselasky*/
1007321936Shselasky#define IB_MAD_ATTR_NODE_INFO				(CL_HTON16(0x0011))
1008321936Shselasky/**********/
1009321936Shselasky
1010321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_SMPL_RSLT
1011321936Shselasky* NAME
1012321936Shselasky*	IB_MAD_ATTR_PORT_SMPL_RSLT
1013321936Shselasky*
1014321936Shselasky* DESCRIPTION
1015321936Shselasky*	PortSamplesResult attribute (16.1.3)
1016321936Shselasky*
1017321936Shselasky* SOURCE
1018321936Shselasky*/
1019321936Shselasky#define IB_MAD_ATTR_PORT_SMPL_RSLT			(CL_HTON16(0x0011))
1020321936Shselasky/**********/
1021321936Shselasky
1022321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_SWITCH_INFO
1023321936Shselasky* NAME
1024321936Shselasky*	IB_MAD_ATTR_SWITCH_INFO
1025321936Shselasky*
1026321936Shselasky* DESCRIPTION
1027321936Shselasky*	SwitchInfo attribute (14.2.5)
1028321936Shselasky*
1029321936Shselasky* SOURCE
1030321936Shselasky*/
1031321936Shselasky#define IB_MAD_ATTR_SWITCH_INFO				(CL_HTON16(0x0012))
1032321936Shselasky/**********/
1033321936Shselasky
1034321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_CNTRS
1035321936Shselasky* NAME
1036321936Shselasky*	IB_MAD_ATTR_PORT_CNTRS
1037321936Shselasky*
1038321936Shselasky* DESCRIPTION
1039321936Shselasky*	PortCounters attribute (16.1.3)
1040321936Shselasky*
1041321936Shselasky* SOURCE
1042321936Shselasky*/
1043321936Shselasky#define IB_MAD_ATTR_PORT_CNTRS				(CL_HTON16(0x0012))
1044321936Shselasky/**********/
1045321936Shselasky
1046321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_CNTRS_EXT
1047321936Shselasky* NAME
1048321936Shselasky*       IB_MAD_ATTR_PORT_CNTRS_EXT
1049321936Shselasky*
1050321936Shselasky* DESCRIPTION
1051321936Shselasky*       PortCountersExtended attribute (16.1.4)
1052321936Shselasky*
1053321936Shselasky* SOURCE
1054321936Shselasky*/
1055321936Shselasky#define IB_MAD_ATTR_PORT_CNTRS_EXT			(CL_HTON16(0x001D))
1056321936Shselasky/**********/
1057321936Shselasky
1058321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_XMIT_DATA_SL
1059321936Shselasky* NAME
1060321936Shselasky*	IB_MAD_ATTR_PORT_XMIT_DATA_SL
1061321936Shselasky*
1062321936Shselasky* DESCRIPTION
1063321936Shselasky*	PortXmitDataSL attribute (A13.6.4)
1064321936Shselasky*
1065321936Shselasky* SOURCE
1066321936Shselasky*/
1067321936Shselasky#define IB_MAD_ATTR_PORT_XMIT_DATA_SL			(CL_HTON16(0x0036))
1068321936Shselasky/**********/
1069321936Shselasky
1070321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_RCV_DATA_SL
1071321936Shselasky* NAME
1072321936Shselasky*	IB_MAD_ATTR_PORT_RCV_DATA_SL
1073321936Shselasky*
1074321936Shselasky* DESCRIPTION
1075321936Shselasky*	PortRcvDataSL attribute (A13.6.4)
1076321936Shselasky*
1077321936Shselasky* SOURCE
1078321936Shselasky*/
1079321936Shselasky#define IB_MAD_ATTR_PORT_RCV_DATA_SL			(CL_HTON16(0x0037))
1080321936Shselasky/**********/
1081321936Shselasky
1082321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_GUID_INFO
1083321936Shselasky* NAME
1084321936Shselasky*	IB_MAD_ATTR_GUID_INFO
1085321936Shselasky*
1086321936Shselasky* DESCRIPTION
1087321936Shselasky*	GUIDInfo attribute (14.2.5)
1088321936Shselasky*
1089321936Shselasky* SOURCE
1090321936Shselasky*/
1091321936Shselasky#define IB_MAD_ATTR_GUID_INFO				(CL_HTON16(0x0014))
1092321936Shselasky/**********/
1093321936Shselasky
1094321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_INFO
1095321936Shselasky* NAME
1096321936Shselasky*	IB_MAD_ATTR_PORT_INFO
1097321936Shselasky*
1098321936Shselasky* DESCRIPTION
1099321936Shselasky*	PortInfo attribute (14.2.5)
1100321936Shselasky*
1101321936Shselasky* SOURCE
1102321936Shselasky*/
1103321936Shselasky#define IB_MAD_ATTR_PORT_INFO				(CL_HTON16(0x0015))
1104321936Shselasky/**********/
1105321936Shselasky
1106321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_P_KEY_TABLE
1107321936Shselasky* NAME
1108321936Shselasky*	IB_MAD_ATTR_P_KEY_TABLE
1109321936Shselasky*
1110321936Shselasky* DESCRIPTION
1111321936Shselasky*	PartitionTable attribute (14.2.5)
1112321936Shselasky*
1113321936Shselasky* SOURCE
1114321936Shselasky*/
1115321936Shselasky#define IB_MAD_ATTR_P_KEY_TABLE				(CL_HTON16(0x0016))
1116321936Shselasky/**********/
1117321936Shselasky
1118321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_SLVL_TABLE
1119321936Shselasky* NAME
1120321936Shselasky*	IB_MAD_ATTR_SLVL_TABLE
1121321936Shselasky*
1122321936Shselasky* DESCRIPTION
1123321936Shselasky*	SL VL Mapping Table attribute (14.2.5)
1124321936Shselasky*
1125321936Shselasky* SOURCE
1126321936Shselasky*/
1127321936Shselasky#define IB_MAD_ATTR_SLVL_TABLE				(CL_HTON16(0x0017))
1128321936Shselasky/**********/
1129321936Shselasky
1130321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_VL_ARBITRATION
1131321936Shselasky* NAME
1132321936Shselasky*	IB_MAD_ATTR_VL_ARBITRATION
1133321936Shselasky*
1134321936Shselasky* DESCRIPTION
1135321936Shselasky*	VL Arbitration Table attribute (14.2.5)
1136321936Shselasky*
1137321936Shselasky* SOURCE
1138321936Shselasky*/
1139321936Shselasky#define IB_MAD_ATTR_VL_ARBITRATION			(CL_HTON16(0x0018))
1140321936Shselasky/**********/
1141321936Shselasky
1142321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_LIN_FWD_TBL
1143321936Shselasky* NAME
1144321936Shselasky*	IB_MAD_ATTR_LIN_FWD_TBL
1145321936Shselasky*
1146321936Shselasky* DESCRIPTION
1147321936Shselasky*	Switch linear forwarding table
1148321936Shselasky*
1149321936Shselasky* SOURCE
1150321936Shselasky*/
1151321936Shselasky#define IB_MAD_ATTR_LIN_FWD_TBL				(CL_HTON16(0x0019))
1152321936Shselasky/**********/
1153321936Shselasky
1154321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_RND_FWD_TBL
1155321936Shselasky* NAME
1156321936Shselasky*	IB_MAD_ATTR_RND_FWD_TBL
1157321936Shselasky*
1158321936Shselasky* DESCRIPTION
1159321936Shselasky*	Switch random forwarding table
1160321936Shselasky*
1161321936Shselasky* SOURCE
1162321936Shselasky*/
1163321936Shselasky#define IB_MAD_ATTR_RND_FWD_TBL				(CL_HTON16(0x001A))
1164321936Shselasky/**********/
1165321936Shselasky
1166321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_MCAST_FWD_TBL
1167321936Shselasky* NAME
1168321936Shselasky*	IB_MAD_ATTR_MCAST_FWD_TBL
1169321936Shselasky*
1170321936Shselasky* DESCRIPTION
1171321936Shselasky*	Switch multicast forwarding table
1172321936Shselasky*
1173321936Shselasky* SOURCE
1174321936Shselasky*/
1175321936Shselasky#define IB_MAD_ATTR_MCAST_FWD_TBL			(CL_HTON16(0x001B))
1176321936Shselasky/**********/
1177321936Shselasky
1178321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_NODE_RECORD
1179321936Shselasky* NAME
1180321936Shselasky*	IB_MAD_ATTR_NODE_RECORD
1181321936Shselasky*
1182321936Shselasky* DESCRIPTION
1183321936Shselasky*	NodeRecord attribute (15.2.5)
1184321936Shselasky*
1185321936Shselasky* SOURCE
1186321936Shselasky*/
1187321936Shselasky#define IB_MAD_ATTR_NODE_RECORD				(CL_HTON16(0x0011))
1188321936Shselasky/**********/
1189321936Shselasky
1190321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_PORTINFO_RECORD
1191321936Shselasky* NAME
1192321936Shselasky*	IB_MAD_ATTR_PORTINFO_RECORD
1193321936Shselasky*
1194321936Shselasky* DESCRIPTION
1195321936Shselasky*	PortInfoRecord attribute (15.2.5)
1196321936Shselasky*
1197321936Shselasky* SOURCE
1198321936Shselasky*/
1199321936Shselasky#define IB_MAD_ATTR_PORTINFO_RECORD			(CL_HTON16(0x0012))
1200321936Shselasky/**********/
1201321936Shselasky
1202321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_SWITCH_INFO_RECORD
1203321936Shselasky* NAME
1204321936Shselasky*       IB_MAD_ATTR_SWITCH_INFO_RECORD
1205321936Shselasky*
1206321936Shselasky* DESCRIPTION
1207321936Shselasky*       SwitchInfoRecord attribute (15.2.5)
1208321936Shselasky*
1209321936Shselasky* SOURCE
1210321936Shselasky*/
1211321936Shselasky#define IB_MAD_ATTR_SWITCH_INFO_RECORD			(CL_HTON16(0x0014))
1212321936Shselasky/**********/
1213321936Shselasky
1214321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_LINK_RECORD
1215321936Shselasky* NAME
1216321936Shselasky*	IB_MAD_ATTR_LINK_RECORD
1217321936Shselasky*
1218321936Shselasky* DESCRIPTION
1219321936Shselasky*	LinkRecord attribute (15.2.5)
1220321936Shselasky*
1221321936Shselasky* SOURCE
1222321936Shselasky*/
1223321936Shselasky#define IB_MAD_ATTR_LINK_RECORD				(CL_HTON16(0x0020))
1224321936Shselasky/**********/
1225321936Shselasky
1226321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_SM_INFO
1227321936Shselasky* NAME
1228321936Shselasky*	IB_MAD_ATTR_SM_INFO
1229321936Shselasky*
1230321936Shselasky* DESCRIPTION
1231321936Shselasky*	SMInfo attribute (14.2.5)
1232321936Shselasky*
1233321936Shselasky* SOURCE
1234321936Shselasky*/
1235321936Shselasky#define IB_MAD_ATTR_SM_INFO				(CL_HTON16(0x0020))
1236321936Shselasky/**********/
1237321936Shselasky
1238321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_SMINFO_RECORD
1239321936Shselasky* NAME
1240321936Shselasky*	IB_MAD_ATTR_SMINFO_RECORD
1241321936Shselasky*
1242321936Shselasky* DESCRIPTION
1243321936Shselasky*	SMInfoRecord attribute (15.2.5)
1244321936Shselasky*
1245321936Shselasky* SOURCE
1246321936Shselasky*/
1247321936Shselasky#define IB_MAD_ATTR_SMINFO_RECORD			(CL_HTON16(0x0018))
1248321936Shselasky/**********/
1249321936Shselasky
1250321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_GUIDINFO_RECORD
1251321936Shselasky* NAME
1252321936Shselasky*       IB_MAD_ATTR_GUIDINFO_RECORD
1253321936Shselasky*
1254321936Shselasky* DESCRIPTION
1255321936Shselasky*       GuidInfoRecord attribute (15.2.5)
1256321936Shselasky*
1257321936Shselasky* SOURCE
1258321936Shselasky*/
1259321936Shselasky#define IB_MAD_ATTR_GUIDINFO_RECORD			(CL_HTON16(0x0030))
1260321936Shselasky/**********/
1261321936Shselasky
1262321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_VENDOR_DIAG
1263321936Shselasky* NAME
1264321936Shselasky*	IB_MAD_ATTR_VENDOR_DIAG
1265321936Shselasky*
1266321936Shselasky* DESCRIPTION
1267321936Shselasky*	VendorDiag attribute (14.2.5)
1268321936Shselasky*
1269321936Shselasky* SOURCE
1270321936Shselasky*/
1271321936Shselasky#define IB_MAD_ATTR_VENDOR_DIAG				(CL_HTON16(0x0030))
1272321936Shselasky/**********/
1273321936Shselasky
1274321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_LED_INFO
1275321936Shselasky* NAME
1276321936Shselasky*	IB_MAD_ATTR_LED_INFO
1277321936Shselasky*
1278321936Shselasky* DESCRIPTION
1279321936Shselasky*	LedInfo attribute (14.2.5)
1280321936Shselasky*
1281321936Shselasky* SOURCE
1282321936Shselasky*/
1283321936Shselasky#define IB_MAD_ATTR_LED_INFO				(CL_HTON16(0x0031))
1284321936Shselasky/**********/
1285321936Shselasky
1286321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_MLNX_EXTENDED_PORT_INFO
1287321936Shselasky* NAME
1288321936Shselasky*	IB_MAD_ATTR_MLNX_EXTENDED_PORT_INFO
1289321936Shselasky*
1290321936Shselasky* DESCRIPTION
1291321936Shselasky*	Vendor specific SM attribute (14.2.5)
1292321936Shselasky*
1293321936Shselasky* SOURCE
1294321936Shselasky*/
1295321936Shselasky#define IB_MAD_ATTR_MLNX_EXTENDED_PORT_INFO		(CL_HTON16(0xFF90))
1296321936Shselasky/**********/
1297321936Shselasky
1298321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_SERVICE_RECORD
1299321936Shselasky* NAME
1300321936Shselasky*	IB_MAD_ATTR_SERVICE_RECORD
1301321936Shselasky*
1302321936Shselasky* DESCRIPTION
1303321936Shselasky*	ServiceRecord attribute (15.2.5)
1304321936Shselasky*
1305321936Shselasky* SOURCE
1306321936Shselasky*/
1307321936Shselasky#define IB_MAD_ATTR_SERVICE_RECORD			(CL_HTON16(0x0031))
1308321936Shselasky/**********/
1309321936Shselasky
1310321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_LFT_RECORD
1311321936Shselasky* NAME
1312321936Shselasky*	IB_MAD_ATTR_LFT_RECORD
1313321936Shselasky*
1314321936Shselasky* DESCRIPTION
1315321936Shselasky*	LinearForwardingTableRecord attribute (15.2.5.6)
1316321936Shselasky*
1317321936Shselasky* SOURCE
1318321936Shselasky*/
1319321936Shselasky#define IB_MAD_ATTR_LFT_RECORD				(CL_HTON16(0x0015))
1320321936Shselasky/**********/
1321321936Shselasky
1322321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_MFT_RECORD
1323321936Shselasky* NAME
1324321936Shselasky*       IB_MAD_ATTR_MFT_RECORD
1325321936Shselasky*
1326321936Shselasky* DESCRIPTION
1327321936Shselasky*       MulticastForwardingTableRecord attribute (15.2.5.8)
1328321936Shselasky*
1329321936Shselasky* SOURCE
1330321936Shselasky*/
1331321936Shselasky#define IB_MAD_ATTR_MFT_RECORD				(CL_HTON16(0x0017))
1332321936Shselasky/**********/
1333321936Shselasky
1334321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_PKEYTBL_RECORD
1335321936Shselasky* NAME
1336321936Shselasky*	IB_MAD_ATTR_PKEYTBL_RECORD
1337321936Shselasky*
1338321936Shselasky* DESCRIPTION
1339321936Shselasky*	PKEY Table Record attribute (15.2.5)
1340321936Shselasky*
1341321936Shselasky* SOURCE
1342321936Shselasky*/
1343321936Shselasky#define IB_MAD_ATTR_PKEY_TBL_RECORD			(CL_HTON16(0x0033))
1344321936Shselasky/**********/
1345321936Shselasky
1346321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_PATH_RECORD
1347321936Shselasky* NAME
1348321936Shselasky*	IB_MAD_ATTR_PATH_RECORD
1349321936Shselasky*
1350321936Shselasky* DESCRIPTION
1351321936Shselasky*	PathRecord attribute (15.2.5)
1352321936Shselasky*
1353321936Shselasky* SOURCE
1354321936Shselasky*/
1355321936Shselasky#define IB_MAD_ATTR_PATH_RECORD				(CL_HTON16(0x0035))
1356321936Shselasky/**********/
1357321936Shselasky
1358321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_VLARB_RECORD
1359321936Shselasky* NAME
1360321936Shselasky*	IB_MAD_ATTR_VLARB_RECORD
1361321936Shselasky*
1362321936Shselasky* DESCRIPTION
1363321936Shselasky*	VL Arbitration Table Record attribute (15.2.5)
1364321936Shselasky*
1365321936Shselasky* SOURCE
1366321936Shselasky*/
1367321936Shselasky#define IB_MAD_ATTR_VLARB_RECORD			(CL_HTON16(0x0036))
1368321936Shselasky/**********/
1369321936Shselasky
1370321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_SLVL_RECORD
1371321936Shselasky* NAME
1372321936Shselasky*	IB_MAD_ATTR_SLVL_RECORD
1373321936Shselasky*
1374321936Shselasky* DESCRIPTION
1375321936Shselasky*	SLtoVL Mapping Table Record attribute (15.2.5)
1376321936Shselasky*
1377321936Shselasky* SOURCE
1378321936Shselasky*/
1379321936Shselasky#define IB_MAD_ATTR_SLVL_RECORD				(CL_HTON16(0x0013))
1380321936Shselasky/**********/
1381321936Shselasky
1382321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_MCMEMBER_RECORD
1383321936Shselasky* NAME
1384321936Shselasky*	IB_MAD_ATTR_MCMEMBER_RECORD
1385321936Shselasky*
1386321936Shselasky* DESCRIPTION
1387321936Shselasky*	MCMemberRecord attribute (15.2.5)
1388321936Shselasky*
1389321936Shselasky* SOURCE
1390321936Shselasky*/
1391321936Shselasky#define IB_MAD_ATTR_MCMEMBER_RECORD			(CL_HTON16(0x0038))
1392321936Shselasky/**********/
1393321936Shselasky
1394321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_TRACE_RECORD
1395321936Shselasky* NAME
1396321936Shselasky*	IB_MAD_ATTR_TRACE_RECORD
1397321936Shselasky*
1398321936Shselasky* DESCRIPTION
1399321936Shselasky*	TraceRecord attribute (15.2.5)
1400321936Shselasky*
1401321936Shselasky* SOURCE
1402321936Shselasky*/
1403321936Shselasky#define IB_MAD_ATTR_TRACE_RECORD			(CL_HTON16(0x0039))
1404321936Shselasky/**********/
1405321936Shselasky
1406321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_MULTIPATH_RECORD
1407321936Shselasky* NAME
1408321936Shselasky*	IB_MAD_ATTR_MULTIPATH_RECORD
1409321936Shselasky*
1410321936Shselasky* DESCRIPTION
1411321936Shselasky*	MultiPathRecord attribute (15.2.5)
1412321936Shselasky*
1413321936Shselasky* SOURCE
1414321936Shselasky*/
1415321936Shselasky#define IB_MAD_ATTR_MULTIPATH_RECORD			(CL_HTON16(0x003A))
1416321936Shselasky/**********/
1417321936Shselasky
1418321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_SVC_ASSOCIATION_RECORD
1419321936Shselasky* NAME
1420321936Shselasky*	IB_MAD_ATTR_SVC_ASSOCIATION_RECORD
1421321936Shselasky*
1422321936Shselasky* DESCRIPTION
1423321936Shselasky*	Service Association Record attribute (15.2.5)
1424321936Shselasky*
1425321936Shselasky* SOURCE
1426321936Shselasky*/
1427321936Shselasky#define IB_MAD_ATTR_SVC_ASSOCIATION_RECORD		(CL_HTON16(0x003B))
1428321936Shselasky/**********/
1429321936Shselasky
1430321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_INFORM_INFO_RECORD
1431321936Shselasky* NAME
1432321936Shselasky*	IB_MAD_ATTR_INFORM_INFO_RECORD
1433321936Shselasky*
1434321936Shselasky* DESCRIPTION
1435321936Shselasky*	InformInfo Record attribute (15.2.5)
1436321936Shselasky*
1437321936Shselasky* SOURCE
1438321936Shselasky*/
1439321936Shselasky#define IB_MAD_ATTR_INFORM_INFO_RECORD			(CL_HTON16(0x00F3))
1440321936Shselasky
1441321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_IO_UNIT_INFO
1442321936Shselasky* NAME
1443321936Shselasky*	IB_MAD_ATTR_IO_UNIT_INFO
1444321936Shselasky*
1445321936Shselasky* DESCRIPTION
1446321936Shselasky*	IOUnitInfo attribute (16.3.3)
1447321936Shselasky*
1448321936Shselasky* SOURCE
1449321936Shselasky*/
1450321936Shselasky#define IB_MAD_ATTR_IO_UNIT_INFO			(CL_HTON16(0x0010))
1451321936Shselasky/**********/
1452321936Shselasky
1453321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_IO_CONTROLLER_PROFILE
1454321936Shselasky* NAME
1455321936Shselasky*	IB_MAD_ATTR_IO_CONTROLLER_PROFILE
1456321936Shselasky*
1457321936Shselasky* DESCRIPTION
1458321936Shselasky*	IOControllerProfile attribute (16.3.3)
1459321936Shselasky*
1460321936Shselasky* SOURCE
1461321936Shselasky*/
1462321936Shselasky#define IB_MAD_ATTR_IO_CONTROLLER_PROFILE	(CL_HTON16(0x0011))
1463321936Shselasky/**********/
1464321936Shselasky
1465321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_SERVICE_ENTRIES
1466321936Shselasky* NAME
1467321936Shselasky*	IB_MAD_ATTR_SERVICE_ENTRIES
1468321936Shselasky*
1469321936Shselasky* DESCRIPTION
1470321936Shselasky*	ServiceEntries attribute (16.3.3)
1471321936Shselasky*
1472321936Shselasky* SOURCE
1473321936Shselasky*/
1474321936Shselasky#define IB_MAD_ATTR_SERVICE_ENTRIES			(CL_HTON16(0x0012))
1475321936Shselasky/**********/
1476321936Shselasky
1477321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT
1478321936Shselasky* NAME
1479321936Shselasky*	IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT
1480321936Shselasky*
1481321936Shselasky* DESCRIPTION
1482321936Shselasky*	DiagnosticTimeout attribute (16.3.3)
1483321936Shselasky*
1484321936Shselasky* SOURCE
1485321936Shselasky*/
1486321936Shselasky#define IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT		(CL_HTON16(0x0020))
1487321936Shselasky/**********/
1488321936Shselasky
1489321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_PREPARE_TO_TEST
1490321936Shselasky* NAME
1491321936Shselasky*	IB_MAD_ATTR_PREPARE_TO_TEST
1492321936Shselasky*
1493321936Shselasky* DESCRIPTION
1494321936Shselasky*	PrepareToTest attribute (16.3.3)
1495321936Shselasky*
1496321936Shselasky* SOURCE
1497321936Shselasky*/
1498321936Shselasky#define IB_MAD_ATTR_PREPARE_TO_TEST			(CL_HTON16(0x0021))
1499321936Shselasky/**********/
1500321936Shselasky
1501321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_TEST_DEVICE_ONCE
1502321936Shselasky* NAME
1503321936Shselasky*	IB_MAD_ATTR_TEST_DEVICE_ONCE
1504321936Shselasky*
1505321936Shselasky* DESCRIPTION
1506321936Shselasky*	TestDeviceOnce attribute (16.3.3)
1507321936Shselasky*
1508321936Shselasky* SOURCE
1509321936Shselasky*/
1510321936Shselasky#define IB_MAD_ATTR_TEST_DEVICE_ONCE		(CL_HTON16(0x0022))
1511321936Shselasky/**********/
1512321936Shselasky
1513321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_TEST_DEVICE_LOOP
1514321936Shselasky* NAME
1515321936Shselasky*	IB_MAD_ATTR_TEST_DEVICE_LOOP
1516321936Shselasky*
1517321936Shselasky* DESCRIPTION
1518321936Shselasky*	TestDeviceLoop attribute (16.3.3)
1519321936Shselasky*
1520321936Shselasky* SOURCE
1521321936Shselasky*/
1522321936Shselasky#define IB_MAD_ATTR_TEST_DEVICE_LOOP		(CL_HTON16(0x0023))
1523321936Shselasky/**********/
1524321936Shselasky
1525321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_DIAG_CODE
1526321936Shselasky* NAME
1527321936Shselasky*	IB_MAD_ATTR_DIAG_CODE
1528321936Shselasky*
1529321936Shselasky* DESCRIPTION
1530321936Shselasky*	DiagCode attribute (16.3.3)
1531321936Shselasky*
1532321936Shselasky* SOURCE
1533321936Shselasky*/
1534321936Shselasky#define IB_MAD_ATTR_DIAG_CODE				(CL_HTON16(0x0024))
1535321936Shselasky/**********/
1536321936Shselasky
1537321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_SVC_ASSOCIATION_RECORD
1538321936Shselasky* NAME
1539321936Shselasky*	IB_MAD_ATTR_SVC_ASSOCIATION_RECORD
1540321936Shselasky*
1541321936Shselasky* DESCRIPTION
1542321936Shselasky*	Service Association Record attribute (15.2.5)
1543321936Shselasky*
1544321936Shselasky* SOURCE
1545321936Shselasky*/
1546321936Shselasky#define IB_MAD_ATTR_SVC_ASSOCIATION_RECORD	(CL_HTON16(0x003B))
1547321936Shselasky/**********/
1548321936Shselasky
1549321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_CONG_INFO
1550321936Shselasky* NAME
1551321936Shselasky*	IB_MAD_ATTR_CONG_INFO
1552321936Shselasky*
1553321936Shselasky* DESCRIPTION
1554321936Shselasky*	CongestionInfo attribute (A10.4.3)
1555321936Shselasky*
1556321936Shselasky* SOURCE
1557321936Shselasky*/
1558321936Shselasky#define IB_MAD_ATTR_CONG_INFO				(CL_HTON16(0x0011))
1559321936Shselasky/**********/
1560321936Shselasky
1561321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_CONG_KEY_INFO
1562321936Shselasky* NAME
1563321936Shselasky*	IB_MAD_ATTR_CONG_KEY_INFO
1564321936Shselasky*
1565321936Shselasky* DESCRIPTION
1566321936Shselasky*	CongestionKeyInfo attribute (A10.4.3)
1567321936Shselasky*
1568321936Shselasky* SOURCE
1569321936Shselasky*/
1570321936Shselasky#define IB_MAD_ATTR_CONG_KEY_INFO			(CL_HTON16(0x0012))
1571321936Shselasky/**********/
1572321936Shselasky
1573321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_CONG_LOG
1574321936Shselasky* NAME
1575321936Shselasky*	IB_MAD_ATTR_CONG_LOG
1576321936Shselasky*
1577321936Shselasky* DESCRIPTION
1578321936Shselasky*	CongestionLog attribute (A10.4.3)
1579321936Shselasky*
1580321936Shselasky* SOURCE
1581321936Shselasky*/
1582321936Shselasky#define IB_MAD_ATTR_CONG_LOG				(CL_HTON16(0x0013))
1583321936Shselasky/**********/
1584321936Shselasky
1585321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_SW_CONG_SETTING
1586321936Shselasky* NAME
1587321936Shselasky*	IB_MAD_ATTR_SW_CONG_SETTING
1588321936Shselasky*
1589321936Shselasky* DESCRIPTION
1590321936Shselasky*	SwitchCongestionSetting attribute (A10.4.3)
1591321936Shselasky*
1592321936Shselasky* SOURCE
1593321936Shselasky*/
1594321936Shselasky#define IB_MAD_ATTR_SW_CONG_SETTING			(CL_HTON16(0x0014))
1595321936Shselasky/**********/
1596321936Shselasky
1597321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_SW_PORT_CONG_SETTING
1598321936Shselasky* NAME
1599321936Shselasky*	IB_MAD_ATTR_SW_PORT_CONG_SETTING
1600321936Shselasky*
1601321936Shselasky* DESCRIPTION
1602321936Shselasky*	SwitchPortCongestionSetting attribute (A10.4.3)
1603321936Shselasky*
1604321936Shselasky* SOURCE
1605321936Shselasky*/
1606321936Shselasky#define IB_MAD_ATTR_SW_PORT_CONG_SETTING		(CL_HTON16(0x0015))
1607321936Shselasky/**********/
1608321936Shselasky
1609321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_CA_CONG_SETTING
1610321936Shselasky* NAME
1611321936Shselasky*	IB_MAD_ATTR_CA_CONG_SETTING
1612321936Shselasky*
1613321936Shselasky* DESCRIPTION
1614321936Shselasky*	CACongestionSetting attribute (A10.4.3)
1615321936Shselasky*
1616321936Shselasky* SOURCE
1617321936Shselasky*/
1618321936Shselasky#define IB_MAD_ATTR_CA_CONG_SETTING			(CL_HTON16(0x0016))
1619321936Shselasky/**********/
1620321936Shselasky
1621321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_CC_TBL
1622321936Shselasky* NAME
1623321936Shselasky*	IB_MAD_ATTR_CC_TBL
1624321936Shselasky*
1625321936Shselasky* DESCRIPTION
1626321936Shselasky*	CongestionControlTable attribute (A10.4.3)
1627321936Shselasky*
1628321936Shselasky* SOURCE
1629321936Shselasky*/
1630321936Shselasky#define IB_MAD_ATTR_CC_TBL				(CL_HTON16(0x0017))
1631321936Shselasky/**********/
1632321936Shselasky
1633321936Shselasky/****d* IBA Base: Constants/IB_MAD_ATTR_TIME_STAMP
1634321936Shselasky* NAME
1635321936Shselasky*	IB_MAD_ATTR_TIME_STAMP
1636321936Shselasky*
1637321936Shselasky* DESCRIPTION
1638321936Shselasky*	TimeStamp attribute (A10.4.3)
1639321936Shselasky*
1640321936Shselasky* SOURCE
1641321936Shselasky*/
1642321936Shselasky#define IB_MAD_ATTR_TIME_STAMP				(CL_HTON16(0x0018))
1643321936Shselasky/**********/
1644321936Shselasky
1645321936Shselasky/****d* IBA Base: Constants/IB_NODE_TYPE_CA
1646321936Shselasky* NAME
1647321936Shselasky*	IB_NODE_TYPE_CA
1648321936Shselasky*
1649321936Shselasky* DESCRIPTION
1650321936Shselasky*	Encoded generic node type used in MAD attributes (13.4.8.2)
1651321936Shselasky*
1652321936Shselasky* SOURCE
1653321936Shselasky*/
1654321936Shselasky#define IB_NODE_TYPE_CA						0x01
1655321936Shselasky/**********/
1656321936Shselasky
1657321936Shselasky/****d* IBA Base: Constants/IB_NODE_TYPE_SWITCH
1658321936Shselasky* NAME
1659321936Shselasky*	IB_NODE_TYPE_SWITCH
1660321936Shselasky*
1661321936Shselasky* DESCRIPTION
1662321936Shselasky*	Encoded generic node type used in MAD attributes (13.4.8.2)
1663321936Shselasky*
1664321936Shselasky* SOURCE
1665321936Shselasky*/
1666321936Shselasky#define IB_NODE_TYPE_SWITCH					0x02
1667321936Shselasky/**********/
1668321936Shselasky
1669321936Shselasky/****d* IBA Base: Constants/IB_NODE_TYPE_ROUTER
1670321936Shselasky* NAME
1671321936Shselasky*	IB_NODE_TYPE_ROUTER
1672321936Shselasky*
1673321936Shselasky* DESCRIPTION
1674321936Shselasky*	Encoded generic node type used in MAD attributes (13.4.8.2)
1675321936Shselasky*
1676321936Shselasky* SOURCE
1677321936Shselasky*/
1678321936Shselasky#define IB_NODE_TYPE_ROUTER					0x03
1679321936Shselasky/**********/
1680321936Shselasky
1681321936Shselasky/****d* IBA Base: Constants/IB_NOTICE_PRODUCER_TYPE_CA
1682321936Shselasky* NAME
1683321936Shselasky*	IB_NOTICE_PRODUCER_TYPE_CA
1684321936Shselasky*
1685321936Shselasky* DESCRIPTION
1686321936Shselasky*	Encoded generic producer type used in Notice attribute (13.4.8.2)
1687321936Shselasky*
1688321936Shselasky* SOURCE
1689321936Shselasky*/
1690321936Shselasky#define IB_NOTICE_PRODUCER_TYPE_CA			(CL_HTON32(0x000001))
1691321936Shselasky/**********/
1692321936Shselasky
1693321936Shselasky/****d* IBA Base: Constants/IB_NOTICE_PRODUCER_TYPE_SWITCH
1694321936Shselasky* NAME
1695321936Shselasky*	IB_NOTICE_PRODUCER_TYPE_SWITCH
1696321936Shselasky*
1697321936Shselasky* DESCRIPTION
1698321936Shselasky*	Encoded generic producer type used in Notice attribute (13.4.8.2)
1699321936Shselasky*
1700321936Shselasky* SOURCE
1701321936Shselasky*/
1702321936Shselasky#define IB_NOTICE_PRODUCER_TYPE_SWITCH			(CL_HTON32(0x000002))
1703321936Shselasky/**********/
1704321936Shselasky
1705321936Shselasky/****d* IBA Base: Constants/IB_NOTICE_PRODUCER_TYPE_ROUTER
1706321936Shselasky* NAME
1707321936Shselasky*	IB_NOTICE_PRODUCER_TYPE_ROUTER
1708321936Shselasky*
1709321936Shselasky* DESCRIPTION
1710321936Shselasky*	Encoded generic producer type used in Notice attribute (13.4.8.2)
1711321936Shselasky*
1712321936Shselasky* SOURCE
1713321936Shselasky*/
1714321936Shselasky#define IB_NOTICE_PRODUCER_TYPE_ROUTER			(CL_HTON32(0x000003))
1715321936Shselasky/**********/
1716321936Shselasky
1717321936Shselasky/****d* IBA Base: Constants/IB_NOTICE_PRODUCER_TYPE_CLASS_MGR
1718321936Shselasky* NAME
1719321936Shselasky*	IB_NOTICE_PRODUCER_TYPE_CLASS_MGR
1720321936Shselasky*
1721321936Shselasky* DESCRIPTION
1722321936Shselasky*	Encoded generic producer type used in Notice attribute (13.4.8.2)
1723321936Shselasky*
1724321936Shselasky* SOURCE
1725321936Shselasky*/
1726321936Shselasky#define IB_NOTICE_PRODUCER_TYPE_CLASS_MGR		(CL_HTON32(0x000004))
1727321936Shselasky/**********/
1728321936Shselasky
1729321936Shselasky/****d* IBA Base: Constants/IB_MTU_LEN_TYPE
1730321936Shselasky* NAME
1731321936Shselasky*	IB_MTU_LEN_TYPE
1732321936Shselasky*
1733321936Shselasky* DESCRIPTION
1734321936Shselasky*	Encoded path MTU.
1735321936Shselasky*		1: 256
1736321936Shselasky*		2: 512
1737321936Shselasky*		3: 1024
1738321936Shselasky*		4: 2048
1739321936Shselasky*		5: 4096
1740321936Shselasky*		others: reserved
1741321936Shselasky*
1742321936Shselasky* SOURCE
1743321936Shselasky*/
1744321936Shselasky#define IB_MTU_LEN_256							1
1745321936Shselasky#define IB_MTU_LEN_512							2
1746321936Shselasky#define IB_MTU_LEN_1024							3
1747321936Shselasky#define IB_MTU_LEN_2048							4
1748321936Shselasky#define IB_MTU_LEN_4096							5
1749321936Shselasky
1750321936Shselasky#define IB_MIN_MTU    IB_MTU_LEN_256
1751321936Shselasky#define IB_MAX_MTU    IB_MTU_LEN_4096
1752321936Shselasky
1753321936Shselasky/**********/
1754321936Shselasky
1755321936Shselasky/****d* IBA Base: Constants/IB_PATH_SELECTOR_TYPE
1756321936Shselasky* NAME
1757321936Shselasky*	IB_PATH_SELECTOR_TYPE
1758321936Shselasky*
1759321936Shselasky* DESCRIPTION
1760321936Shselasky*	Path selector.
1761321936Shselasky*		0: greater than specified
1762321936Shselasky*		1: less than specified
1763321936Shselasky*		2: exactly the specified
1764321936Shselasky*		3: largest available
1765321936Shselasky*
1766321936Shselasky* SOURCE
1767321936Shselasky*/
1768321936Shselasky#define IB_PATH_SELECTOR_GREATER_THAN		0
1769321936Shselasky#define IB_PATH_SELECTOR_LESS_THAN		1
1770321936Shselasky#define IB_PATH_SELECTOR_EXACTLY		2
1771321936Shselasky#define IB_PATH_SELECTOR_LARGEST		3
1772321936Shselasky/**********/
1773321936Shselasky
1774321936Shselasky/****d* IBA Base: Constants/IB_SMINFO_STATE_NOTACTIVE
1775321936Shselasky* NAME
1776321936Shselasky*	IB_SMINFO_STATE_NOTACTIVE
1777321936Shselasky*
1778321936Shselasky* DESCRIPTION
1779321936Shselasky*	Encoded state value used in the SMInfo attribute.
1780321936Shselasky*
1781321936Shselasky* SOURCE
1782321936Shselasky*/
1783321936Shselasky#define IB_SMINFO_STATE_NOTACTIVE			0
1784321936Shselasky/**********/
1785321936Shselasky
1786321936Shselasky/****d* IBA Base: Constants/IB_SMINFO_STATE_DISCOVERING
1787321936Shselasky* NAME
1788321936Shselasky*	IB_SMINFO_STATE_DISCOVERING
1789321936Shselasky*
1790321936Shselasky* DESCRIPTION
1791321936Shselasky*	Encoded state value used in the SMInfo attribute.
1792321936Shselasky*
1793321936Shselasky* SOURCE
1794321936Shselasky*/
1795321936Shselasky#define IB_SMINFO_STATE_DISCOVERING			1
1796321936Shselasky/**********/
1797321936Shselasky
1798321936Shselasky/****d* IBA Base: Constants/IB_SMINFO_STATE_STANDBY
1799321936Shselasky* NAME
1800321936Shselasky*	IB_SMINFO_STATE_STANDBY
1801321936Shselasky*
1802321936Shselasky* DESCRIPTION
1803321936Shselasky*	Encoded state value used in the SMInfo attribute.
1804321936Shselasky*
1805321936Shselasky* SOURCE
1806321936Shselasky*/
1807321936Shselasky#define IB_SMINFO_STATE_STANDBY				2
1808321936Shselasky/**********/
1809321936Shselasky
1810321936Shselasky/****d* IBA Base: Constants/IB_SMINFO_STATE_MASTER
1811321936Shselasky* NAME
1812321936Shselasky*	IB_SMINFO_STATE_MASTER
1813321936Shselasky*
1814321936Shselasky* DESCRIPTION
1815321936Shselasky*	Encoded state value used in the SMInfo attribute.
1816321936Shselasky*
1817321936Shselasky* SOURCE
1818321936Shselasky*/
1819321936Shselasky#define IB_SMINFO_STATE_MASTER				3
1820321936Shselasky/**********/
1821321936Shselasky
1822321936Shselasky/****d* IBA Base: Constants/IB_PATH_REC_SL_MASK
1823321936Shselasky* NAME
1824321936Shselasky*	IB_PATH_REC_SL_MASK
1825321936Shselasky*
1826321936Shselasky* DESCRIPTION
1827321936Shselasky*	Mask for the sl field for path record
1828321936Shselasky*
1829321936Shselasky* SOURCE
1830321936Shselasky*/
1831321936Shselasky#define IB_PATH_REC_SL_MASK				0x000F
1832321936Shselasky
1833321936Shselasky/****d* IBA Base: Constants/IB_MULTIPATH_REC_SL_MASK
1834321936Shselasky* NAME
1835321936Shselasky*	IB_MULTIPATH_REC_SL_MASK
1836321936Shselasky*
1837321936Shselasky* DESCRIPTION
1838321936Shselasky*	Mask for the sl field for MultiPath record
1839321936Shselasky*
1840321936Shselasky* SOURCE
1841321936Shselasky*/
1842321936Shselasky#define IB_MULTIPATH_REC_SL_MASK			0x000F
1843321936Shselasky
1844321936Shselasky/****d* IBA Base: Constants/IB_PATH_REC_QOS_CLASS_MASK
1845321936Shselasky* NAME
1846321936Shselasky*	IB_PATH_REC_QOS_CLASS_MASK
1847321936Shselasky*
1848321936Shselasky* DESCRIPTION
1849321936Shselasky*	Mask for the QoS class field for path record
1850321936Shselasky*
1851321936Shselasky* SOURCE
1852321936Shselasky*/
1853321936Shselasky#define IB_PATH_REC_QOS_CLASS_MASK			0xFFF0
1854321936Shselasky
1855321936Shselasky/****d* IBA Base: Constants/IB_MULTIPATH_REC_QOS_CLASS_MASK
1856321936Shselasky* NAME
1857321936Shselasky*	IB_MULTIPATH_REC_QOS_CLASS_MASK
1858321936Shselasky*
1859321936Shselasky* DESCRIPTION
1860321936Shselasky*	Mask for the QoS class field for MultiPath record
1861321936Shselasky*
1862321936Shselasky* SOURCE
1863321936Shselasky*/
1864321936Shselasky#define IB_MULTIPATH_REC_QOS_CLASS_MASK			0xFFF0
1865321936Shselasky
1866321936Shselasky/****d* IBA Base: Constants/IB_PATH_REC_SELECTOR_MASK
1867321936Shselasky* NAME
1868321936Shselasky*	IB_PATH_REC_SELECTOR_MASK
1869321936Shselasky*
1870321936Shselasky* DESCRIPTION
1871321936Shselasky*	Mask for the selector field for path record MTU, rate,
1872321936Shselasky*	and packet lifetime.
1873321936Shselasky*
1874321936Shselasky* SOURCE
1875321936Shselasky*/
1876321936Shselasky#define IB_PATH_REC_SELECTOR_MASK			0xC0
1877321936Shselasky
1878321936Shselasky/****d* IBA Base: Constants/IB_MULTIPATH_REC_SELECTOR_MASK
1879321936Shselasky* NAME
1880321936Shselasky*       IB_MULTIPATH_REC_SELECTOR_MASK
1881321936Shselasky*
1882321936Shselasky* DESCRIPTION
1883321936Shselasky*       Mask for the selector field for multipath record MTU, rate,
1884321936Shselasky*       and packet lifetime.
1885321936Shselasky*
1886321936Shselasky* SOURCE
1887321936Shselasky*/
1888321936Shselasky#define IB_MULTIPATH_REC_SELECTOR_MASK                       0xC0
1889321936Shselasky/**********/
1890321936Shselasky
1891321936Shselasky/****d* IBA Base: Constants/IB_PATH_REC_BASE_MASK
1892321936Shselasky* NAME
1893321936Shselasky*	IB_PATH_REC_BASE_MASK
1894321936Shselasky*
1895321936Shselasky* DESCRIPTION
1896321936Shselasky*	Mask for the base value field for path record MTU, rate,
1897321936Shselasky*	and packet lifetime.
1898321936Shselasky*
1899321936Shselasky* SOURCE
1900321936Shselasky*/
1901321936Shselasky#define IB_PATH_REC_BASE_MASK				0x3F
1902321936Shselasky/**********/
1903321936Shselasky
1904321936Shselasky/****d* IBA Base: Constants/IB_MULTIPATH_REC_BASE_MASK
1905321936Shselasky* NAME
1906321936Shselasky*       IB_MULTIPATH_REC_BASE_MASK
1907321936Shselasky*
1908321936Shselasky* DESCRIPTION
1909321936Shselasky*       Mask for the base value field for multipath record MTU, rate,
1910321936Shselasky*       and packet lifetime.
1911321936Shselasky*
1912321936Shselasky* SOURCE
1913321936Shselasky*/
1914321936Shselasky#define IB_MULTIPATH_REC_BASE_MASK                      0x3F
1915321936Shselasky/**********/
1916321936Shselasky
1917321936Shselasky/****h* IBA Base/Type Definitions
1918321936Shselasky* NAME
1919321936Shselasky*	Type Definitions
1920321936Shselasky*
1921321936Shselasky* DESCRIPTION
1922321936Shselasky*	Definitions are from the InfiniBand Architecture Specification v1.2
1923321936Shselasky*
1924321936Shselasky*********/
1925321936Shselasky
1926321936Shselasky/****d* IBA Base: Types/ib_net16_t
1927321936Shselasky* NAME
1928321936Shselasky*	ib_net16_t
1929321936Shselasky*
1930321936Shselasky* DESCRIPTION
1931321936Shselasky*	Defines the network ordered type for 16-bit values.
1932321936Shselasky*
1933321936Shselasky* SOURCE
1934321936Shselasky*/
1935321936Shselaskytypedef uint16_t ib_net16_t;
1936321936Shselasky/**********/
1937321936Shselasky
1938321936Shselasky/****d* IBA Base: Types/ib_net32_t
1939321936Shselasky* NAME
1940321936Shselasky*	ib_net32_t
1941321936Shselasky*
1942321936Shselasky* DESCRIPTION
1943321936Shselasky*	Defines the network ordered type for 32-bit values.
1944321936Shselasky*
1945321936Shselasky* SOURCE
1946321936Shselasky*/
1947321936Shselaskytypedef uint32_t ib_net32_t;
1948321936Shselasky/**********/
1949321936Shselasky
1950321936Shselasky/****d* IBA Base: Types/ib_net64_t
1951321936Shselasky* NAME
1952321936Shselasky*	ib_net64_t
1953321936Shselasky*
1954321936Shselasky* DESCRIPTION
1955321936Shselasky*	Defines the network ordered type for 64-bit values.
1956321936Shselasky*
1957321936Shselasky* SOURCE
1958321936Shselasky*/
1959321936Shselaskytypedef uint64_t ib_net64_t;
1960321936Shselasky/**********/
1961321936Shselasky
1962321936Shselasky/****d* IBA Base: Types/ib_gid_prefix_t
1963321936Shselasky* NAME
1964321936Shselasky*	ib_gid_prefix_t
1965321936Shselasky*
1966321936Shselasky* DESCRIPTION
1967321936Shselasky*
1968321936Shselasky* SOURCE
1969321936Shselasky*/
1970321936Shselaskytypedef ib_net64_t ib_gid_prefix_t;
1971321936Shselasky/**********/
1972321936Shselasky
1973321936Shselasky/****d* IBA Base: Constants/ib_link_states_t
1974321936Shselasky* NAME
1975321936Shselasky*	ib_link_states_t
1976321936Shselasky*
1977321936Shselasky* DESCRIPTION
1978321936Shselasky*	Defines the link states of a port.
1979321936Shselasky*
1980321936Shselasky* SOURCE
1981321936Shselasky*/
1982321936Shselasky#define IB_LINK_NO_CHANGE 0
1983321936Shselasky#define IB_LINK_DOWN      1
1984321936Shselasky#define IB_LINK_INIT	  2
1985321936Shselasky#define IB_LINK_ARMED     3
1986321936Shselasky#define IB_LINK_ACTIVE    4
1987321936Shselasky#define IB_LINK_ACT_DEFER 5
1988321936Shselasky/**********/
1989321936Shselasky
1990321936Shselaskystatic const char *const __ib_node_type_str[] = {
1991321936Shselasky	"UNKNOWN",
1992321936Shselasky	"Channel Adapter",
1993321936Shselasky	"Switch",
1994321936Shselasky	"Router"
1995321936Shselasky};
1996321936Shselasky
1997321936Shselasky/****f* IBA Base: Types/ib_get_node_type_str
1998321936Shselasky* NAME
1999321936Shselasky*	ib_get_node_type_str
2000321936Shselasky*
2001321936Shselasky* DESCRIPTION
2002321936Shselasky*	Returns a string for the specified node type.
2003321936Shselasky*	14.2.5.3 NodeInfo
2004321936Shselasky*
2005321936Shselasky* SYNOPSIS
2006321936Shselasky*/
2007321936Shselaskystatic inline const char *OSM_API ib_get_node_type_str(IN uint8_t node_type)
2008321936Shselasky{
2009321936Shselasky	if (node_type > IB_NODE_TYPE_ROUTER)
2010321936Shselasky		node_type = 0;
2011321936Shselasky	return (__ib_node_type_str[node_type]);
2012321936Shselasky}
2013321936Shselasky
2014321936Shselasky/*
2015321936Shselasky* PARAMETERS
2016321936Shselasky*	node_type
2017321936Shselasky*		[in] Encoded node type as returned in the NodeInfo attribute.
2018321936Shselasky
2019321936Shselasky* RETURN VALUES
2020321936Shselasky*	Pointer to the node type string.
2021321936Shselasky*
2022321936Shselasky* NOTES
2023321936Shselasky*
2024321936Shselasky* SEE ALSO
2025321936Shselasky* ib_node_info_t
2026321936Shselasky*********/
2027321936Shselasky
2028321936Shselaskystatic const char *const __ib_producer_type_str[] = {
2029321936Shselasky	"UNKNOWN",
2030321936Shselasky	"Channel Adapter",
2031321936Shselasky	"Switch",
2032321936Shselasky	"Router",
2033321936Shselasky	"Class Manager"
2034321936Shselasky};
2035321936Shselasky
2036321936Shselasky/****f* IBA Base: Types/ib_get_producer_type_str
2037321936Shselasky* NAME
2038321936Shselasky*	ib_get_producer_type_str
2039321936Shselasky*
2040321936Shselasky* DESCRIPTION
2041321936Shselasky*	Returns a string for the specified producer type
2042321936Shselasky*	13.4.8.2 Notice
2043321936Shselasky*	13.4.8.3 InformInfo
2044321936Shselasky*
2045321936Shselasky* SYNOPSIS
2046321936Shselasky*/
2047321936Shselaskystatic inline const char *OSM_API
2048321936Shselaskyib_get_producer_type_str(IN ib_net32_t producer_type)
2049321936Shselasky{
2050321936Shselasky	if (cl_ntoh32(producer_type) >
2051321936Shselasky	    CL_NTOH32(IB_NOTICE_PRODUCER_TYPE_CLASS_MGR))
2052321936Shselasky		producer_type = 0;
2053321936Shselasky	return (__ib_producer_type_str[cl_ntoh32(producer_type)]);
2054321936Shselasky}
2055321936Shselasky
2056321936Shselasky/*
2057321936Shselasky* PARAMETERS
2058321936Shselasky*	producer_type
2059321936Shselasky*		[in] Encoded producer type from the Notice attribute
2060321936Shselasky
2061321936Shselasky* RETURN VALUES
2062321936Shselasky*	Pointer to the producer type string.
2063321936Shselasky*
2064321936Shselasky* NOTES
2065321936Shselasky*
2066321936Shselasky* SEE ALSO
2067321936Shselasky* ib_notice_get_prod_type
2068321936Shselasky*********/
2069321936Shselasky
2070321936Shselaskystatic const char *const __ib_port_state_str[] = {
2071321936Shselasky	"No State Change (NOP)",
2072321936Shselasky	"DOWN",
2073321936Shselasky	"INIT",
2074321936Shselasky	"ARMED",
2075321936Shselasky	"ACTIVE",
2076321936Shselasky	"ACTDEFER",
2077321936Shselasky	"UNKNOWN"
2078321936Shselasky};
2079321936Shselasky
2080321936Shselasky/****f* IBA Base: Types/ib_get_port_state_str
2081321936Shselasky* NAME
2082321936Shselasky*	ib_get_port_state_str
2083321936Shselasky*
2084321936Shselasky* DESCRIPTION
2085321936Shselasky*	Returns a string for the specified port state.
2086321936Shselasky*
2087321936Shselasky* SYNOPSIS
2088321936Shselasky*/
2089321936Shselaskystatic inline const char *OSM_API ib_get_port_state_str(IN uint8_t port_state)
2090321936Shselasky{
2091321936Shselasky	if (port_state > IB_LINK_ACTIVE)
2092321936Shselasky		port_state = IB_LINK_ACTIVE + 1;
2093321936Shselasky	return (__ib_port_state_str[port_state]);
2094321936Shselasky}
2095321936Shselasky
2096321936Shselasky/*
2097321936Shselasky* PARAMETERS
2098321936Shselasky*	port_state
2099321936Shselasky*		[in] Encoded port state as returned in the PortInfo attribute.
2100321936Shselasky
2101321936Shselasky* RETURN VALUES
2102321936Shselasky*	Pointer to the port state string.
2103321936Shselasky*
2104321936Shselasky* NOTES
2105321936Shselasky*
2106321936Shselasky* SEE ALSO
2107321936Shselasky* ib_port_info_t
2108321936Shselasky*********/
2109321936Shselasky
2110321936Shselasky/****f* IBA Base: Types/ib_get_port_state_from_str
2111321936Shselasky* NAME
2112321936Shselasky*	ib_get_port_state_from_str
2113321936Shselasky*
2114321936Shselasky* DESCRIPTION
2115321936Shselasky*	Returns a string for the specified port state.
2116321936Shselasky*
2117321936Shselasky* SYNOPSIS
2118321936Shselasky*/
2119321936Shselaskystatic inline uint8_t OSM_API
2120321936Shselaskyib_get_port_state_from_str(IN char *p_port_state_str)
2121321936Shselasky{
2122321936Shselasky	if (!strncmp(p_port_state_str, "No State Change (NOP)", 12))
2123321936Shselasky		return (0);
2124321936Shselasky	else if (!strncmp(p_port_state_str, "DOWN", 4))
2125321936Shselasky		return (1);
2126321936Shselasky	else if (!strncmp(p_port_state_str, "INIT", 4))
2127321936Shselasky		return (2);
2128321936Shselasky	else if (!strncmp(p_port_state_str, "ARMED", 5))
2129321936Shselasky		return (3);
2130321936Shselasky	else if (!strncmp(p_port_state_str, "ACTIVE", 6))
2131321936Shselasky		return (4);
2132321936Shselasky	else if (!strncmp(p_port_state_str, "ACTDEFER", 8))
2133321936Shselasky		return (5);
2134321936Shselasky	return (6);
2135321936Shselasky}
2136321936Shselasky
2137321936Shselasky/*
2138321936Shselasky* PARAMETERS
2139321936Shselasky*	p_port_state_str
2140321936Shselasky*		[in] A string matching one returned by ib_get_port_state_str
2141321936Shselasky*
2142321936Shselasky* RETURN VALUES
2143321936Shselasky*	The appropriate code.
2144321936Shselasky*
2145321936Shselasky* NOTES
2146321936Shselasky*
2147321936Shselasky* SEE ALSO
2148321936Shselasky*	ib_port_info_t
2149321936Shselasky*********/
2150321936Shselasky
2151321936Shselasky/****d* IBA Base: Constants/Join States
2152321936Shselasky* NAME
2153321936Shselasky*	Join States
2154321936Shselasky*
2155321936Shselasky* DESCRIPTION
2156321936Shselasky*	Defines the join state flags for multicast group management.
2157321936Shselasky*
2158321936Shselasky* SOURCE
2159321936Shselasky*/
2160321936Shselasky#define IB_JOIN_STATE_FULL		1
2161321936Shselasky#define IB_JOIN_STATE_NON		2
2162321936Shselasky#define IB_JOIN_STATE_SEND_ONLY		4
2163321936Shselasky/**********/
2164321936Shselasky
2165321936Shselasky/****f* IBA Base: Types/ib_pkey_get_base
2166321936Shselasky* NAME
2167321936Shselasky*	ib_pkey_get_base
2168321936Shselasky*
2169321936Shselasky* DESCRIPTION
2170321936Shselasky*	Returns the base P_Key value with the membership bit stripped.
2171321936Shselasky*
2172321936Shselasky* SYNOPSIS
2173321936Shselasky*/
2174321936Shselaskystatic inline ib_net16_t OSM_API ib_pkey_get_base(IN const ib_net16_t pkey)
2175321936Shselasky{
2176321936Shselasky	return ((ib_net16_t) (pkey & IB_PKEY_BASE_MASK));
2177321936Shselasky}
2178321936Shselasky
2179321936Shselasky/*
2180321936Shselasky* PARAMETERS
2181321936Shselasky*	pkey
2182321936Shselasky*		[in] P_Key value
2183321936Shselasky*
2184321936Shselasky* RETURN VALUE
2185321936Shselasky*	Returns the base P_Key value with the membership bit stripped.
2186321936Shselasky*
2187321936Shselasky* NOTES
2188321936Shselasky*
2189321936Shselasky* SEE ALSO
2190321936Shselasky*********/
2191321936Shselasky
2192321936Shselasky/****f* IBA Base: Types/ib_pkey_is_full_member
2193321936Shselasky* NAME
2194321936Shselasky*	ib_pkey_is_full_member
2195321936Shselasky*
2196321936Shselasky* DESCRIPTION
2197321936Shselasky*	Indicates if the port is a full member of the partition.
2198321936Shselasky*
2199321936Shselasky* SYNOPSIS
2200321936Shselasky*/
2201321936Shselaskystatic inline boolean_t OSM_API ib_pkey_is_full_member(IN const ib_net16_t pkey)
2202321936Shselasky{
2203321936Shselasky	return ((pkey & IB_PKEY_TYPE_MASK) == IB_PKEY_TYPE_MASK);
2204321936Shselasky}
2205321936Shselasky
2206321936Shselasky/*
2207321936Shselasky* PARAMETERS
2208321936Shselasky*	pkey
2209321936Shselasky*		[in] P_Key value
2210321936Shselasky*
2211321936Shselasky* RETURN VALUE
2212321936Shselasky*	TRUE if the port is a full member of the partition.
2213321936Shselasky*	FALSE otherwise.
2214321936Shselasky*
2215321936Shselasky* NOTES
2216321936Shselasky*
2217321936Shselasky* SEE ALSO
2218321936Shselasky* ib_pkey_get_base, ib_net16_t
2219321936Shselasky*********/
2220321936Shselasky
2221321936Shselasky/****f* IBA Base: Types/ib_pkey_is_invalid
2222321936Shselasky* NAME
2223321936Shselasky*	ib_pkey_is_invalid
2224321936Shselasky*
2225321936Shselasky* DESCRIPTION
2226321936Shselasky*	Returns TRUE if the given P_Key is an invalid P_Key
2227321936Shselasky*  C10-116: the CI shall regard a P_Key as invalid if its low-order
2228321936Shselasky*           15 bits are all zero...
2229321936Shselasky*
2230321936Shselasky* SYNOPSIS
2231321936Shselasky*/
2232321936Shselaskystatic inline boolean_t OSM_API ib_pkey_is_invalid(IN const ib_net16_t pkey)
2233321936Shselasky{
2234321936Shselasky	return ib_pkey_get_base(pkey) == 0x0000 ? TRUE : FALSE;
2235321936Shselasky}
2236321936Shselasky
2237321936Shselasky/*
2238321936Shselasky* PARAMETERS
2239321936Shselasky*	pkey
2240321936Shselasky*		[in] P_Key value
2241321936Shselasky*
2242321936Shselasky* RETURN VALUE
2243321936Shselasky*	Returns the base P_Key value with the membership bit stripped.
2244321936Shselasky*
2245321936Shselasky* NOTES
2246321936Shselasky*
2247321936Shselasky* SEE ALSO
2248321936Shselasky*********/
2249321936Shselasky
2250321936Shselasky/****d* IBA Base: Types/ib_gid_t
2251321936Shselasky* NAME
2252321936Shselasky*	ib_gid_t
2253321936Shselasky*
2254321936Shselasky* DESCRIPTION
2255321936Shselasky*
2256321936Shselasky* SYNOPSIS
2257321936Shselasky*/
2258321936Shselasky#include <complib/cl_packon.h>
2259321936Shselaskytypedef union _ib_gid {
2260321936Shselasky	uint8_t raw[16];
2261321936Shselasky	struct _ib_gid_unicast {
2262321936Shselasky		ib_gid_prefix_t prefix;
2263321936Shselasky		ib_net64_t interface_id;
2264321936Shselasky	} PACK_SUFFIX unicast;
2265321936Shselasky	struct _ib_gid_multicast {
2266321936Shselasky		uint8_t header[2];
2267321936Shselasky		uint8_t raw_group_id[14];
2268321936Shselasky	} PACK_SUFFIX multicast;
2269321936Shselasky} PACK_SUFFIX ib_gid_t;
2270321936Shselasky#include <complib/cl_packoff.h>
2271321936Shselasky/*
2272321936Shselasky* FIELDS
2273321936Shselasky*	raw
2274321936Shselasky*		GID represented as an unformated byte array.
2275321936Shselasky*
2276321936Shselasky*	unicast
2277321936Shselasky*		Typical unicast representation with subnet prefix and
2278321936Shselasky*		port GUID.
2279321936Shselasky*
2280321936Shselasky*	multicast
2281321936Shselasky*		Representation for multicast use.
2282321936Shselasky*
2283321936Shselasky* SEE ALSO
2284321936Shselasky*********/
2285321936Shselasky
2286321936Shselasky/****f* IBA Base: Types/ib_gid_is_multicast
2287321936Shselasky* NAME
2288321936Shselasky*	ib_gid_is_multicast
2289321936Shselasky*
2290321936Shselasky* DESCRIPTION
2291321936Shselasky*       Returns a boolean indicating whether a GID is a multicast GID.
2292321936Shselasky*
2293321936Shselasky* SYNOPSIS
2294321936Shselasky*/
2295321936Shselaskystatic inline boolean_t OSM_API ib_gid_is_multicast(IN const ib_gid_t * p_gid)
2296321936Shselasky{
2297321936Shselasky	return (p_gid->raw[0] == 0xFF);
2298321936Shselasky}
2299321936Shselasky
2300321936Shselasky/****f* IBA Base: Types/ib_gid_get_scope
2301321936Shselasky* NAME
2302321936Shselasky*	ib_gid_get_scope
2303321936Shselasky*
2304321936Shselasky* DESCRIPTION
2305321936Shselasky*	Returns scope of (assumed) multicast GID.
2306321936Shselasky*
2307321936Shselasky* SYNOPSIS
2308321936Shselasky*/
2309321936Shselaskystatic inline uint8_t OSM_API ib_mgid_get_scope(IN const ib_gid_t * p_gid)
2310321936Shselasky{
2311321936Shselasky	return (p_gid->raw[1] & 0x0F);
2312321936Shselasky}
2313321936Shselasky
2314321936Shselasky/****f* IBA Base: Types/ib_gid_set_scope
2315321936Shselasky* NAME
2316321936Shselasky*	ib_gid_set_scope
2317321936Shselasky*
2318321936Shselasky* DESCRIPTION
2319321936Shselasky*	Sets scope of (assumed) multicast GID.
2320321936Shselasky*
2321321936Shselasky* SYNOPSIS
2322321936Shselasky*/
2323321936Shselaskystatic inline void OSM_API
2324321936Shselaskyib_mgid_set_scope(IN ib_gid_t * const p_gid, IN const uint8_t scope)
2325321936Shselasky{
2326321936Shselasky	p_gid->raw[1] &= 0xF0;
2327321936Shselasky	p_gid->raw[1] |= scope & 0x0F;
2328321936Shselasky}
2329321936Shselasky
2330321936Shselasky/****f* IBA Base: Types/ib_gid_set_default
2331321936Shselasky* NAME
2332321936Shselasky*	ib_gid_set_default
2333321936Shselasky*
2334321936Shselasky* DESCRIPTION
2335321936Shselasky*	Sets a GID to the default value.
2336321936Shselasky*
2337321936Shselasky* SYNOPSIS
2338321936Shselasky*/
2339321936Shselaskystatic inline void OSM_API
2340321936Shselaskyib_gid_set_default(IN ib_gid_t * const p_gid, IN const ib_net64_t interface_id)
2341321936Shselasky{
2342321936Shselasky	p_gid->unicast.prefix = IB_DEFAULT_SUBNET_PREFIX;
2343321936Shselasky	p_gid->unicast.interface_id = interface_id;
2344321936Shselasky}
2345321936Shselasky
2346321936Shselasky/*
2347321936Shselasky* PARAMETERS
2348321936Shselasky*	p_gid
2349321936Shselasky*		[in] Pointer to the GID object.
2350321936Shselasky*
2351321936Shselasky*	interface_id
2352321936Shselasky*		[in] Manufacturer assigned EUI64 value of a port.
2353321936Shselasky*
2354321936Shselasky* RETURN VALUES
2355321936Shselasky*	None.
2356321936Shselasky*
2357321936Shselasky* NOTES
2358321936Shselasky*
2359321936Shselasky* SEE ALSO
2360321936Shselasky*	ib_gid_t
2361321936Shselasky*********/
2362321936Shselasky
2363321936Shselasky/****f* IBA Base: Types/ib_gid_get_subnet_prefix
2364321936Shselasky* NAME
2365321936Shselasky*	ib_gid_get_subnet_prefix
2366321936Shselasky*
2367321936Shselasky* DESCRIPTION
2368321936Shselasky*	Gets the subnet prefix from a GID.
2369321936Shselasky*
2370321936Shselasky* SYNOPSIS
2371321936Shselasky*/
2372321936Shselaskystatic inline ib_net64_t OSM_API
2373321936Shselaskyib_gid_get_subnet_prefix(IN const ib_gid_t * const p_gid)
2374321936Shselasky{
2375321936Shselasky	return (p_gid->unicast.prefix);
2376321936Shselasky}
2377321936Shselasky
2378321936Shselasky/*
2379321936Shselasky* PARAMETERS
2380321936Shselasky*	p_gid
2381321936Shselasky*		[in] Pointer to the GID object.
2382321936Shselasky*
2383321936Shselasky* RETURN VALUES
2384321936Shselasky*	64-bit subnet prefix value.
2385321936Shselasky*
2386321936Shselasky* NOTES
2387321936Shselasky*
2388321936Shselasky* SEE ALSO
2389321936Shselasky*	ib_gid_t
2390321936Shselasky*********/
2391321936Shselasky
2392321936Shselasky/****f* IBA Base: Types/ib_gid_is_link_local
2393321936Shselasky* NAME
2394321936Shselasky*	ib_gid_is_link_local
2395321936Shselasky*
2396321936Shselasky* DESCRIPTION
2397321936Shselasky*	Returns TRUE if the unicast GID scoping indicates link local,
2398321936Shselasky*	FALSE otherwise.
2399321936Shselasky*
2400321936Shselasky* SYNOPSIS
2401321936Shselasky*/
2402321936Shselaskystatic inline boolean_t OSM_API
2403321936Shselaskyib_gid_is_link_local(IN const ib_gid_t * const p_gid)
2404321936Shselasky{
2405321936Shselasky	return ((ib_gid_get_subnet_prefix(p_gid) &
2406321936Shselasky		 CL_HTON64(0xFFC0000000000000ULL)) == IB_DEFAULT_SUBNET_PREFIX);
2407321936Shselasky}
2408321936Shselasky
2409321936Shselasky/*
2410321936Shselasky* PARAMETERS
2411321936Shselasky*	p_gid
2412321936Shselasky*		[in] Pointer to the GID object.
2413321936Shselasky*
2414321936Shselasky* RETURN VALUES
2415321936Shselasky*	Returns TRUE if the unicast GID scoping indicates link local,
2416321936Shselasky*	FALSE otherwise.
2417321936Shselasky*
2418321936Shselasky* NOTES
2419321936Shselasky*
2420321936Shselasky* SEE ALSO
2421321936Shselasky*	ib_gid_t
2422321936Shselasky*********/
2423321936Shselasky
2424321936Shselasky/****f* IBA Base: Types/ib_gid_is_site_local
2425321936Shselasky* NAME
2426321936Shselasky*	ib_gid_is_site_local
2427321936Shselasky*
2428321936Shselasky* DESCRIPTION
2429321936Shselasky*	Returns TRUE if the unicast GID scoping indicates site local,
2430321936Shselasky*	FALSE otherwise.
2431321936Shselasky*
2432321936Shselasky* SYNOPSIS
2433321936Shselasky*/
2434321936Shselaskystatic inline boolean_t OSM_API
2435321936Shselaskyib_gid_is_site_local(IN const ib_gid_t * const p_gid)
2436321936Shselasky{
2437321936Shselasky	return ((ib_gid_get_subnet_prefix(p_gid) &
2438321936Shselasky		 CL_HTON64(0xFFFFFFFFFFFF0000ULL)) ==
2439321936Shselasky		CL_HTON64(0xFEC0000000000000ULL));
2440321936Shselasky}
2441321936Shselasky
2442321936Shselasky/*
2443321936Shselasky* PARAMETERS
2444321936Shselasky*	p_gid
2445321936Shselasky*		[in] Pointer to the GID object.
2446321936Shselasky*
2447321936Shselasky* RETURN VALUES
2448321936Shselasky*	Returns TRUE if the unicast GID scoping indicates site local,
2449321936Shselasky*	FALSE otherwise.
2450321936Shselasky*
2451321936Shselasky* NOTES
2452321936Shselasky*
2453321936Shselasky* SEE ALSO
2454321936Shselasky*	ib_gid_t
2455321936Shselasky*********/
2456321936Shselasky
2457321936Shselasky/****f* IBA Base: Types/ib_gid_get_guid
2458321936Shselasky* NAME
2459321936Shselasky*	ib_gid_get_guid
2460321936Shselasky*
2461321936Shselasky* DESCRIPTION
2462321936Shselasky*	Gets the guid from a GID.
2463321936Shselasky*
2464321936Shselasky* SYNOPSIS
2465321936Shselasky*/
2466321936Shselaskystatic inline ib_net64_t OSM_API
2467321936Shselaskyib_gid_get_guid(IN const ib_gid_t * const p_gid)
2468321936Shselasky{
2469321936Shselasky	return (p_gid->unicast.interface_id);
2470321936Shselasky}
2471321936Shselasky
2472321936Shselasky/*
2473321936Shselasky* PARAMETERS
2474321936Shselasky*	p_gid
2475321936Shselasky*		[in] Pointer to the GID object.
2476321936Shselasky*
2477321936Shselasky* RETURN VALUES
2478321936Shselasky*	64-bit GUID value.
2479321936Shselasky*
2480321936Shselasky* NOTES
2481321936Shselasky*
2482321936Shselasky* SEE ALSO
2483321936Shselasky*	ib_gid_t
2484321936Shselasky*********/
2485321936Shselasky
2486321936Shselasky/****s* IBA Base: Types/ib_path_rec_t
2487321936Shselasky* NAME
2488321936Shselasky*	ib_path_rec_t
2489321936Shselasky*
2490321936Shselasky* DESCRIPTION
2491321936Shselasky*	Path records encapsulate the properties of a given
2492321936Shselasky*	route between two end-points on a subnet.
2493321936Shselasky*
2494321936Shselasky* SYNOPSIS
2495321936Shselasky*/
2496321936Shselasky#include <complib/cl_packon.h>
2497321936Shselaskytypedef struct _ib_path_rec {
2498321936Shselasky	ib_net64_t service_id;
2499321936Shselasky	ib_gid_t dgid;
2500321936Shselasky	ib_gid_t sgid;
2501321936Shselasky	ib_net16_t dlid;
2502321936Shselasky	ib_net16_t slid;
2503321936Shselasky	ib_net32_t hop_flow_raw;
2504321936Shselasky	uint8_t tclass;
2505321936Shselasky	uint8_t num_path;
2506321936Shselasky	ib_net16_t pkey;
2507321936Shselasky	ib_net16_t qos_class_sl;
2508321936Shselasky	uint8_t mtu;
2509321936Shselasky	uint8_t rate;
2510321936Shselasky	uint8_t pkt_life;
2511321936Shselasky	uint8_t preference;
2512321936Shselasky	uint8_t resv2[6];
2513321936Shselasky} PACK_SUFFIX ib_path_rec_t;
2514321936Shselasky#include <complib/cl_packoff.h>
2515321936Shselasky/*
2516321936Shselasky* FIELDS
2517321936Shselasky*	service_id
2518321936Shselasky*		Service ID for QoS.
2519321936Shselasky*
2520321936Shselasky*	dgid
2521321936Shselasky*		GID of destination port.
2522321936Shselasky*
2523321936Shselasky*	sgid
2524321936Shselasky*		GID of source port.
2525321936Shselasky*
2526321936Shselasky*	dlid
2527321936Shselasky*		LID of destination port.
2528321936Shselasky*
2529321936Shselasky*	slid
2530321936Shselasky*		LID of source port.
2531321936Shselasky*
2532321936Shselasky*	hop_flow_raw
2533321936Shselasky*		Global routing parameters: hop count, flow label and raw bit.
2534321936Shselasky*
2535321936Shselasky*	tclass
2536321936Shselasky*		Another global routing parameter.
2537321936Shselasky*
2538321936Shselasky*	num_path
2539321936Shselasky*		Reversible path - 1 bit to say if path is reversible.
2540321936Shselasky*		num_path [6:0] In queries, maximum number of paths to return.
2541321936Shselasky*		In responses, undefined.
2542321936Shselasky*
2543321936Shselasky*	pkey
2544321936Shselasky*		Partition key (P_Key) to use on this path.
2545321936Shselasky*
2546321936Shselasky*	qos_class_sl
2547321936Shselasky*		QoS class and service level to use on this path.
2548321936Shselasky*
2549321936Shselasky*	mtu
2550321936Shselasky*		MTU and MTU selector fields to use on this path
2551321936Shselasky*
2552321936Shselasky*	rate
2553321936Shselasky*		Rate and rate selector fields to use on this path.
2554321936Shselasky*
2555321936Shselasky*	pkt_life
2556321936Shselasky*		Packet lifetime
2557321936Shselasky*
2558321936Shselasky*	preference
2559321936Shselasky*		Indicates the relative merit of this path versus other path
2560321936Shselasky*		records returned from the SA.  Lower numbers are better.
2561321936Shselasky*
2562321936Shselasky*	resv2
2563321936Shselasky*		Reserved bytes.
2564321936Shselasky* SEE ALSO
2565321936Shselasky*********/
2566321936Shselasky
2567321936Shselasky/* Path Record Component Masks */
2568321936Shselasky#define  IB_PR_COMPMASK_SERVICEID_MSB     (CL_HTON64(((uint64_t)1)<<0))
2569321936Shselasky#define  IB_PR_COMPMASK_SERVICEID_LSB     (CL_HTON64(((uint64_t)1)<<1))
2570321936Shselasky#define  IB_PR_COMPMASK_DGID              (CL_HTON64(((uint64_t)1)<<2))
2571321936Shselasky#define  IB_PR_COMPMASK_SGID              (CL_HTON64(((uint64_t)1)<<3))
2572321936Shselasky#define  IB_PR_COMPMASK_DLID              (CL_HTON64(((uint64_t)1)<<4))
2573321936Shselasky#define  IB_PR_COMPMASK_SLID              (CL_HTON64(((uint64_t)1)<<5))
2574321936Shselasky#define  IB_PR_COMPMASK_RAWTRAFFIC        (CL_HTON64(((uint64_t)1)<<6))
2575321936Shselasky#define  IB_PR_COMPMASK_RESV0             (CL_HTON64(((uint64_t)1)<<7))
2576321936Shselasky#define  IB_PR_COMPMASK_FLOWLABEL         (CL_HTON64(((uint64_t)1)<<8))
2577321936Shselasky#define  IB_PR_COMPMASK_HOPLIMIT          (CL_HTON64(((uint64_t)1)<<9))
2578321936Shselasky#define  IB_PR_COMPMASK_TCLASS            (CL_HTON64(((uint64_t)1)<<10))
2579321936Shselasky#define  IB_PR_COMPMASK_REVERSIBLE        (CL_HTON64(((uint64_t)1)<<11))
2580321936Shselasky#define  IB_PR_COMPMASK_NUMBPATH          (CL_HTON64(((uint64_t)1)<<12))
2581321936Shselasky#define  IB_PR_COMPMASK_PKEY              (CL_HTON64(((uint64_t)1)<<13))
2582321936Shselasky#define  IB_PR_COMPMASK_QOS_CLASS         (CL_HTON64(((uint64_t)1)<<14))
2583321936Shselasky#define  IB_PR_COMPMASK_SL                (CL_HTON64(((uint64_t)1)<<15))
2584321936Shselasky#define  IB_PR_COMPMASK_MTUSELEC          (CL_HTON64(((uint64_t)1)<<16))
2585321936Shselasky#define  IB_PR_COMPMASK_MTU               (CL_HTON64(((uint64_t)1)<<17))
2586321936Shselasky#define  IB_PR_COMPMASK_RATESELEC         (CL_HTON64(((uint64_t)1)<<18))
2587321936Shselasky#define  IB_PR_COMPMASK_RATE              (CL_HTON64(((uint64_t)1)<<19))
2588321936Shselasky#define  IB_PR_COMPMASK_PKTLIFETIMESELEC  (CL_HTON64(((uint64_t)1)<<20))
2589321936Shselasky#define  IB_PR_COMPMASK_PKTLIFETIME       (CL_HTON64(((uint64_t)1)<<21))
2590321936Shselasky
2591321936Shselasky#define  IB_PR_COMPMASK_SERVICEID (IB_PR_COMPMASK_SERVICEID_MSB | \
2592321936Shselasky				   IB_PR_COMPMASK_SERVICEID_LSB)
2593321936Shselasky
2594321936Shselasky/* Link Record Component Masks */
2595321936Shselasky#define IB_LR_COMPMASK_FROM_LID           (CL_HTON64(((uint64_t)1)<<0))
2596321936Shselasky#define IB_LR_COMPMASK_FROM_PORT          (CL_HTON64(((uint64_t)1)<<1))
2597321936Shselasky#define IB_LR_COMPMASK_TO_PORT            (CL_HTON64(((uint64_t)1)<<2))
2598321936Shselasky#define IB_LR_COMPMASK_TO_LID             (CL_HTON64(((uint64_t)1)<<3))
2599321936Shselasky
2600321936Shselasky/* VL Arbitration Record Masks */
2601321936Shselasky#define IB_VLA_COMPMASK_LID               (CL_HTON64(((uint64_t)1)<<0))
2602321936Shselasky#define IB_VLA_COMPMASK_OUT_PORT          (CL_HTON64(((uint64_t)1)<<1))
2603321936Shselasky#define IB_VLA_COMPMASK_BLOCK             (CL_HTON64(((uint64_t)1)<<2))
2604321936Shselasky
2605321936Shselasky/* SLtoVL Mapping Record Masks */
2606321936Shselasky#define IB_SLVL_COMPMASK_LID              (CL_HTON64(((uint64_t)1)<<0))
2607321936Shselasky#define IB_SLVL_COMPMASK_IN_PORT          (CL_HTON64(((uint64_t)1)<<1))
2608321936Shselasky#define IB_SLVL_COMPMASK_OUT_PORT         (CL_HTON64(((uint64_t)1)<<2))
2609321936Shselasky
2610321936Shselasky/* P_Key Table Record Masks */
2611321936Shselasky#define IB_PKEY_COMPMASK_LID              (CL_HTON64(((uint64_t)1)<<0))
2612321936Shselasky#define IB_PKEY_COMPMASK_BLOCK            (CL_HTON64(((uint64_t)1)<<1))
2613321936Shselasky#define IB_PKEY_COMPMASK_PORT             (CL_HTON64(((uint64_t)1)<<2))
2614321936Shselasky
2615321936Shselasky/* Switch Info Record Masks */
2616321936Shselasky#define IB_SWIR_COMPMASK_LID		  (CL_HTON64(((uint64_t)1)<<0))
2617321936Shselasky#define IB_SWIR_COMPMASK_RESERVED1	  (CL_HTON64(((uint64_t)1)<<1))
2618321936Shselasky
2619321936Shselasky/* LFT Record Masks */
2620321936Shselasky#define IB_LFTR_COMPMASK_LID              (CL_HTON64(((uint64_t)1)<<0))
2621321936Shselasky#define IB_LFTR_COMPMASK_BLOCK            (CL_HTON64(((uint64_t)1)<<1))
2622321936Shselasky
2623321936Shselasky/* MFT Record Masks */
2624321936Shselasky#define IB_MFTR_COMPMASK_LID		  (CL_HTON64(((uint64_t)1)<<0))
2625321936Shselasky#define IB_MFTR_COMPMASK_POSITION	  (CL_HTON64(((uint64_t)1)<<1))
2626321936Shselasky#define IB_MFTR_COMPMASK_RESERVED1	  (CL_HTON64(((uint64_t)1)<<2))
2627321936Shselasky#define IB_MFTR_COMPMASK_BLOCK		  (CL_HTON64(((uint64_t)1)<<3))
2628321936Shselasky#define IB_MFTR_COMPMASK_RESERVED2	  (CL_HTON64(((uint64_t)1)<<4))
2629321936Shselasky
2630321936Shselasky/* NodeInfo Record Masks */
2631321936Shselasky#define IB_NR_COMPMASK_LID                (CL_HTON64(((uint64_t)1)<<0))
2632321936Shselasky#define IB_NR_COMPMASK_RESERVED1          (CL_HTON64(((uint64_t)1)<<1))
2633321936Shselasky#define IB_NR_COMPMASK_BASEVERSION        (CL_HTON64(((uint64_t)1)<<2))
2634321936Shselasky#define IB_NR_COMPMASK_CLASSVERSION       (CL_HTON64(((uint64_t)1)<<3))
2635321936Shselasky#define IB_NR_COMPMASK_NODETYPE           (CL_HTON64(((uint64_t)1)<<4))
2636321936Shselasky#define IB_NR_COMPMASK_NUMPORTS           (CL_HTON64(((uint64_t)1)<<5))
2637321936Shselasky#define IB_NR_COMPMASK_SYSIMAGEGUID       (CL_HTON64(((uint64_t)1)<<6))
2638321936Shselasky#define IB_NR_COMPMASK_NODEGUID           (CL_HTON64(((uint64_t)1)<<7))
2639321936Shselasky#define IB_NR_COMPMASK_PORTGUID           (CL_HTON64(((uint64_t)1)<<8))
2640321936Shselasky#define IB_NR_COMPMASK_PARTCAP            (CL_HTON64(((uint64_t)1)<<9))
2641321936Shselasky#define IB_NR_COMPMASK_DEVID              (CL_HTON64(((uint64_t)1)<<10))
2642321936Shselasky#define IB_NR_COMPMASK_REV                (CL_HTON64(((uint64_t)1)<<11))
2643321936Shselasky#define IB_NR_COMPMASK_PORTNUM            (CL_HTON64(((uint64_t)1)<<12))
2644321936Shselasky#define IB_NR_COMPMASK_VENDID             (CL_HTON64(((uint64_t)1)<<13))
2645321936Shselasky#define IB_NR_COMPMASK_NODEDESC           (CL_HTON64(((uint64_t)1)<<14))
2646321936Shselasky
2647321936Shselasky/* Service Record Component Masks Sec 15.2.5.14 Ver 1.1*/
2648321936Shselasky#define IB_SR_COMPMASK_SID                (CL_HTON64(((uint64_t)1)<<0))
2649321936Shselasky#define IB_SR_COMPMASK_SGID               (CL_HTON64(((uint64_t)1)<<1))
2650321936Shselasky#define IB_SR_COMPMASK_SPKEY              (CL_HTON64(((uint64_t)1)<<2))
2651321936Shselasky#define IB_SR_COMPMASK_RES1               (CL_HTON64(((uint64_t)1)<<3))
2652321936Shselasky#define IB_SR_COMPMASK_SLEASE             (CL_HTON64(((uint64_t)1)<<4))
2653321936Shselasky#define IB_SR_COMPMASK_SKEY               (CL_HTON64(((uint64_t)1)<<5))
2654321936Shselasky#define IB_SR_COMPMASK_SNAME              (CL_HTON64(((uint64_t)1)<<6))
2655321936Shselasky#define IB_SR_COMPMASK_SDATA8_0           (CL_HTON64(((uint64_t)1)<<7))
2656321936Shselasky#define IB_SR_COMPMASK_SDATA8_1           (CL_HTON64(((uint64_t)1)<<8))
2657321936Shselasky#define IB_SR_COMPMASK_SDATA8_2           (CL_HTON64(((uint64_t)1)<<9))
2658321936Shselasky#define IB_SR_COMPMASK_SDATA8_3           (CL_HTON64(((uint64_t)1)<<10))
2659321936Shselasky#define IB_SR_COMPMASK_SDATA8_4           (CL_HTON64(((uint64_t)1)<<11))
2660321936Shselasky#define IB_SR_COMPMASK_SDATA8_5           (CL_HTON64(((uint64_t)1)<<12))
2661321936Shselasky#define IB_SR_COMPMASK_SDATA8_6           (CL_HTON64(((uint64_t)1)<<13))
2662321936Shselasky#define IB_SR_COMPMASK_SDATA8_7           (CL_HTON64(((uint64_t)1)<<14))
2663321936Shselasky#define IB_SR_COMPMASK_SDATA8_8           (CL_HTON64(((uint64_t)1)<<15))
2664321936Shselasky#define IB_SR_COMPMASK_SDATA8_9           (CL_HTON64(((uint64_t)1)<<16))
2665321936Shselasky#define IB_SR_COMPMASK_SDATA8_10       (CL_HTON64(((uint64_t)1)<<17))
2666321936Shselasky#define IB_SR_COMPMASK_SDATA8_11       (CL_HTON64(((uint64_t)1)<<18))
2667321936Shselasky#define IB_SR_COMPMASK_SDATA8_12       (CL_HTON64(((uint64_t)1)<<19))
2668321936Shselasky#define IB_SR_COMPMASK_SDATA8_13       (CL_HTON64(((uint64_t)1)<<20))
2669321936Shselasky#define IB_SR_COMPMASK_SDATA8_14       (CL_HTON64(((uint64_t)1)<<21))
2670321936Shselasky#define IB_SR_COMPMASK_SDATA8_15       (CL_HTON64(((uint64_t)1)<<22))
2671321936Shselasky#define IB_SR_COMPMASK_SDATA16_0       (CL_HTON64(((uint64_t)1)<<23))
2672321936Shselasky#define IB_SR_COMPMASK_SDATA16_1       (CL_HTON64(((uint64_t)1)<<24))
2673321936Shselasky#define IB_SR_COMPMASK_SDATA16_2       (CL_HTON64(((uint64_t)1)<<25))
2674321936Shselasky#define IB_SR_COMPMASK_SDATA16_3       (CL_HTON64(((uint64_t)1)<<26))
2675321936Shselasky#define IB_SR_COMPMASK_SDATA16_4       (CL_HTON64(((uint64_t)1)<<27))
2676321936Shselasky#define IB_SR_COMPMASK_SDATA16_5       (CL_HTON64(((uint64_t)1)<<28))
2677321936Shselasky#define IB_SR_COMPMASK_SDATA16_6       (CL_HTON64(((uint64_t)1)<<29))
2678321936Shselasky#define IB_SR_COMPMASK_SDATA16_7       (CL_HTON64(((uint64_t)1)<<30))
2679321936Shselasky#define IB_SR_COMPMASK_SDATA32_0       (CL_HTON64(((uint64_t)1)<<31))
2680321936Shselasky#define IB_SR_COMPMASK_SDATA32_1       (CL_HTON64(((uint64_t)1)<<32))
2681321936Shselasky#define IB_SR_COMPMASK_SDATA32_2       (CL_HTON64(((uint64_t)1)<<33))
2682321936Shselasky#define IB_SR_COMPMASK_SDATA32_3       (CL_HTON64(((uint64_t)1)<<34))
2683321936Shselasky#define IB_SR_COMPMASK_SDATA64_0       (CL_HTON64(((uint64_t)1)<<35))
2684321936Shselasky#define IB_SR_COMPMASK_SDATA64_1       (CL_HTON64(((uint64_t)1)<<36))
2685321936Shselasky
2686321936Shselasky/* Port Info Record Component Masks */
2687321936Shselasky#define IB_PIR_COMPMASK_LID              (CL_HTON64(((uint64_t)1)<<0))
2688321936Shselasky#define IB_PIR_COMPMASK_PORTNUM          (CL_HTON64(((uint64_t)1)<<1))
2689321936Shselasky#define IB_PIR_COMPMASK_OPTIONS		 (CL_HTON64(((uint64_t)1)<<2))
2690321936Shselasky#define IB_PIR_COMPMASK_MKEY             (CL_HTON64(((uint64_t)1)<<3))
2691321936Shselasky#define IB_PIR_COMPMASK_GIDPRE           (CL_HTON64(((uint64_t)1)<<4))
2692321936Shselasky#define IB_PIR_COMPMASK_BASELID          (CL_HTON64(((uint64_t)1)<<5))
2693321936Shselasky#define IB_PIR_COMPMASK_SMLID            (CL_HTON64(((uint64_t)1)<<6))
2694321936Shselasky#define IB_PIR_COMPMASK_CAPMASK          (CL_HTON64(((uint64_t)1)<<7))
2695321936Shselasky#define IB_PIR_COMPMASK_DIAGCODE         (CL_HTON64(((uint64_t)1)<<8))
2696321936Shselasky#define IB_PIR_COMPMASK_MKEYLEASEPRD     (CL_HTON64(((uint64_t)1)<<9))
2697321936Shselasky#define IB_PIR_COMPMASK_LOCALPORTNUM     (CL_HTON64(((uint64_t)1)<<10))
2698321936Shselasky#define IB_PIR_COMPMASK_LINKWIDTHENABLED (CL_HTON64(((uint64_t)1)<<11))
2699321936Shselasky#define IB_PIR_COMPMASK_LNKWIDTHSUPPORT  (CL_HTON64(((uint64_t)1)<<12))
2700321936Shselasky#define IB_PIR_COMPMASK_LNKWIDTHACTIVE   (CL_HTON64(((uint64_t)1)<<13))
2701321936Shselasky#define IB_PIR_COMPMASK_LNKSPEEDSUPPORT  (CL_HTON64(((uint64_t)1)<<14))
2702321936Shselasky#define IB_PIR_COMPMASK_PORTSTATE        (CL_HTON64(((uint64_t)1)<<15))
2703321936Shselasky#define IB_PIR_COMPMASK_PORTPHYSTATE     (CL_HTON64(((uint64_t)1)<<16))
2704321936Shselasky#define IB_PIR_COMPMASK_LINKDWNDFLTSTATE (CL_HTON64(((uint64_t)1)<<17))
2705321936Shselasky#define IB_PIR_COMPMASK_MKEYPROTBITS     (CL_HTON64(((uint64_t)1)<<18))
2706321936Shselasky#define IB_PIR_COMPMASK_RESV2            (CL_HTON64(((uint64_t)1)<<19))
2707321936Shselasky#define IB_PIR_COMPMASK_LMC              (CL_HTON64(((uint64_t)1)<<20))
2708321936Shselasky#define IB_PIR_COMPMASK_LINKSPEEDACTIVE  (CL_HTON64(((uint64_t)1)<<21))
2709321936Shselasky#define IB_PIR_COMPMASK_LINKSPEEDENABLE  (CL_HTON64(((uint64_t)1)<<22))
2710321936Shselasky#define IB_PIR_COMPMASK_NEIGHBORMTU      (CL_HTON64(((uint64_t)1)<<23))
2711321936Shselasky#define IB_PIR_COMPMASK_MASTERSMSL       (CL_HTON64(((uint64_t)1)<<24))
2712321936Shselasky#define IB_PIR_COMPMASK_VLCAP            (CL_HTON64(((uint64_t)1)<<25))
2713321936Shselasky#define IB_PIR_COMPMASK_INITTYPE         (CL_HTON64(((uint64_t)1)<<26))
2714321936Shselasky#define IB_PIR_COMPMASK_VLHIGHLIMIT      (CL_HTON64(((uint64_t)1)<<27))
2715321936Shselasky#define IB_PIR_COMPMASK_VLARBHIGHCAP     (CL_HTON64(((uint64_t)1)<<28))
2716321936Shselasky#define IB_PIR_COMPMASK_VLARBLOWCAP      (CL_HTON64(((uint64_t)1)<<29))
2717321936Shselasky#define IB_PIR_COMPMASK_INITTYPEREPLY    (CL_HTON64(((uint64_t)1)<<30))
2718321936Shselasky#define IB_PIR_COMPMASK_MTUCAP           (CL_HTON64(((uint64_t)1)<<31))
2719321936Shselasky#define IB_PIR_COMPMASK_VLSTALLCNT       (CL_HTON64(((uint64_t)1)<<32))
2720321936Shselasky#define IB_PIR_COMPMASK_HOQLIFE          (CL_HTON64(((uint64_t)1)<<33))
2721321936Shselasky#define IB_PIR_COMPMASK_OPVLS            (CL_HTON64(((uint64_t)1)<<34))
2722321936Shselasky#define IB_PIR_COMPMASK_PARENFIN         (CL_HTON64(((uint64_t)1)<<35))
2723321936Shselasky#define IB_PIR_COMPMASK_PARENFOUT        (CL_HTON64(((uint64_t)1)<<36))
2724321936Shselasky#define IB_PIR_COMPMASK_FILTERRAWIN      (CL_HTON64(((uint64_t)1)<<37))
2725321936Shselasky#define IB_PIR_COMPMASK_FILTERRAWOUT     (CL_HTON64(((uint64_t)1)<<38))
2726321936Shselasky#define IB_PIR_COMPMASK_MKEYVIO          (CL_HTON64(((uint64_t)1)<<39))
2727321936Shselasky#define IB_PIR_COMPMASK_PKEYVIO          (CL_HTON64(((uint64_t)1)<<40))
2728321936Shselasky#define IB_PIR_COMPMASK_QKEYVIO          (CL_HTON64(((uint64_t)1)<<41))
2729321936Shselasky#define IB_PIR_COMPMASK_GUIDCAP          (CL_HTON64(((uint64_t)1)<<42))
2730321936Shselasky#define IB_PIR_COMPMASK_CLIENTREREG	 (CL_HTON64(((uint64_t)1)<<43))
2731321936Shselasky#define IB_PIR_COMPMASK_RESV3            (CL_HTON64(((uint64_t)1)<<44))
2732321936Shselasky#define IB_PIR_COMPMASK_SUBNTO           (CL_HTON64(((uint64_t)1)<<45))
2733321936Shselasky#define IB_PIR_COMPMASK_RESV4            (CL_HTON64(((uint64_t)1)<<46))
2734321936Shselasky#define IB_PIR_COMPMASK_RESPTIME         (CL_HTON64(((uint64_t)1)<<47))
2735321936Shselasky#define IB_PIR_COMPMASK_LOCALPHYERR      (CL_HTON64(((uint64_t)1)<<48))
2736321936Shselasky#define IB_PIR_COMPMASK_OVERRUNERR       (CL_HTON64(((uint64_t)1)<<49))
2737321936Shselasky#define IB_PIR_COMPMASK_MAXCREDHINT	 (CL_HTON64(((uint64_t)1)<<50))
2738321936Shselasky#define IB_PIR_COMPMASK_RESV5		 (CL_HTON64(((uint64_t)1)<<51))
2739321936Shselasky#define IB_PIR_COMPMASK_LINKRTLAT	 (CL_HTON64(((uint64_t)1)<<52))
2740321936Shselasky#define IB_PIR_COMPMASK_CAPMASK2	 (CL_HTON64(((uint64_t)1)<<53))
2741321936Shselasky#define IB_PIR_COMPMASK_LINKSPDEXTACT	 (CL_HTON64(((uint64_t)1)<<54))
2742321936Shselasky#define IB_PIR_COMPMASK_LINKSPDEXTSUPP	 (CL_HTON64(((uint64_t)1)<<55))
2743321936Shselasky#define IB_PIR_COMPMASK_RESV7		 (CL_HTON64(((uint64_t)1)<<56))
2744321936Shselasky#define IB_PIR_COMPMASK_LINKSPDEXTENAB	 (CL_HTON64(((uint64_t)1)<<57))
2745321936Shselasky
2746321936Shselasky/* Multicast Member Record Component Masks */
2747321936Shselasky#define IB_MCR_COMPMASK_GID         (CL_HTON64(((uint64_t)1)<<0))
2748321936Shselasky#define IB_MCR_COMPMASK_MGID        (CL_HTON64(((uint64_t)1)<<0))
2749321936Shselasky#define IB_MCR_COMPMASK_PORT_GID    (CL_HTON64(((uint64_t)1)<<1))
2750321936Shselasky#define IB_MCR_COMPMASK_QKEY        (CL_HTON64(((uint64_t)1)<<2))
2751321936Shselasky#define IB_MCR_COMPMASK_MLID        (CL_HTON64(((uint64_t)1)<<3))
2752321936Shselasky#define IB_MCR_COMPMASK_MTU_SEL     (CL_HTON64(((uint64_t)1)<<4))
2753321936Shselasky#define IB_MCR_COMPMASK_MTU         (CL_HTON64(((uint64_t)1)<<5))
2754321936Shselasky#define IB_MCR_COMPMASK_TCLASS      (CL_HTON64(((uint64_t)1)<<6))
2755321936Shselasky#define IB_MCR_COMPMASK_PKEY        (CL_HTON64(((uint64_t)1)<<7))
2756321936Shselasky#define IB_MCR_COMPMASK_RATE_SEL    (CL_HTON64(((uint64_t)1)<<8))
2757321936Shselasky#define IB_MCR_COMPMASK_RATE        (CL_HTON64(((uint64_t)1)<<9))
2758321936Shselasky#define IB_MCR_COMPMASK_LIFE_SEL    (CL_HTON64(((uint64_t)1)<<10))
2759321936Shselasky#define IB_MCR_COMPMASK_LIFE        (CL_HTON64(((uint64_t)1)<<11))
2760321936Shselasky#define IB_MCR_COMPMASK_SL          (CL_HTON64(((uint64_t)1)<<12))
2761321936Shselasky#define IB_MCR_COMPMASK_FLOW        (CL_HTON64(((uint64_t)1)<<13))
2762321936Shselasky#define IB_MCR_COMPMASK_HOP         (CL_HTON64(((uint64_t)1)<<14))
2763321936Shselasky#define IB_MCR_COMPMASK_SCOPE       (CL_HTON64(((uint64_t)1)<<15))
2764321936Shselasky#define IB_MCR_COMPMASK_JOIN_STATE  (CL_HTON64(((uint64_t)1)<<16))
2765321936Shselasky#define IB_MCR_COMPMASK_PROXY       (CL_HTON64(((uint64_t)1)<<17))
2766321936Shselasky
2767321936Shselasky/* GUID Info Record Component Masks */
2768321936Shselasky#define IB_GIR_COMPMASK_LID		(CL_HTON64(((uint64_t)1)<<0))
2769321936Shselasky#define IB_GIR_COMPMASK_BLOCKNUM	(CL_HTON64(((uint64_t)1)<<1))
2770321936Shselasky#define IB_GIR_COMPMASK_RESV1		(CL_HTON64(((uint64_t)1)<<2))
2771321936Shselasky#define IB_GIR_COMPMASK_RESV2		(CL_HTON64(((uint64_t)1)<<3))
2772321936Shselasky#define IB_GIR_COMPMASK_GID0		(CL_HTON64(((uint64_t)1)<<4))
2773321936Shselasky#define IB_GIR_COMPMASK_GID1		(CL_HTON64(((uint64_t)1)<<5))
2774321936Shselasky#define IB_GIR_COMPMASK_GID2		(CL_HTON64(((uint64_t)1)<<6))
2775321936Shselasky#define IB_GIR_COMPMASK_GID3		(CL_HTON64(((uint64_t)1)<<7))
2776321936Shselasky#define IB_GIR_COMPMASK_GID4		(CL_HTON64(((uint64_t)1)<<8))
2777321936Shselasky#define IB_GIR_COMPMASK_GID5		(CL_HTON64(((uint64_t)1)<<9))
2778321936Shselasky#define IB_GIR_COMPMASK_GID6		(CL_HTON64(((uint64_t)1)<<10))
2779321936Shselasky#define IB_GIR_COMPMASK_GID7		(CL_HTON64(((uint64_t)1)<<11))
2780321936Shselasky
2781321936Shselasky/* MultiPath Record Component Masks */
2782321936Shselasky#define IB_MPR_COMPMASK_RAWTRAFFIC	(CL_HTON64(((uint64_t)1)<<0))
2783321936Shselasky#define IB_MPR_COMPMASK_RESV0		(CL_HTON64(((uint64_t)1)<<1))
2784321936Shselasky#define IB_MPR_COMPMASK_FLOWLABEL	(CL_HTON64(((uint64_t)1)<<2))
2785321936Shselasky#define IB_MPR_COMPMASK_HOPLIMIT	(CL_HTON64(((uint64_t)1)<<3))
2786321936Shselasky#define IB_MPR_COMPMASK_TCLASS		(CL_HTON64(((uint64_t)1)<<4))
2787321936Shselasky#define IB_MPR_COMPMASK_REVERSIBLE	(CL_HTON64(((uint64_t)1)<<5))
2788321936Shselasky#define IB_MPR_COMPMASK_NUMBPATH	(CL_HTON64(((uint64_t)1)<<6))
2789321936Shselasky#define IB_MPR_COMPMASK_PKEY		(CL_HTON64(((uint64_t)1)<<7))
2790321936Shselasky#define IB_MPR_COMPMASK_QOS_CLASS	(CL_HTON64(((uint64_t)1)<<8))
2791321936Shselasky#define IB_MPR_COMPMASK_SL		(CL_HTON64(((uint64_t)1)<<9))
2792321936Shselasky#define IB_MPR_COMPMASK_MTUSELEC	(CL_HTON64(((uint64_t)1)<<10))
2793321936Shselasky#define IB_MPR_COMPMASK_MTU		(CL_HTON64(((uint64_t)1)<<11))
2794321936Shselasky#define IB_MPR_COMPMASK_RATESELEC	(CL_HTON64(((uint64_t)1)<<12))
2795321936Shselasky#define IB_MPR_COMPMASK_RATE		(CL_HTON64(((uint64_t)1)<<13))
2796321936Shselasky#define IB_MPR_COMPMASK_PKTLIFETIMESELEC (CL_HTON64(((uint64_t)1)<<14))
2797321936Shselasky#define IB_MPR_COMPMASK_PKTLIFETIME	(CL_HTON64(((uint64_t)1)<<15))
2798321936Shselasky#define IB_MPR_COMPMASK_SERVICEID_MSB	(CL_HTON64(((uint64_t)1)<<16))
2799321936Shselasky#define IB_MPR_COMPMASK_INDEPSELEC	(CL_HTON64(((uint64_t)1)<<17))
2800321936Shselasky#define IB_MPR_COMPMASK_RESV3		(CL_HTON64(((uint64_t)1)<<18))
2801321936Shselasky#define IB_MPR_COMPMASK_SGIDCOUNT	(CL_HTON64(((uint64_t)1)<<19))
2802321936Shselasky#define IB_MPR_COMPMASK_DGIDCOUNT	(CL_HTON64(((uint64_t)1)<<20))
2803321936Shselasky#define IB_MPR_COMPMASK_SERVICEID_LSB	(CL_HTON64(((uint64_t)1)<<21))
2804321936Shselasky
2805321936Shselasky#define IB_MPR_COMPMASK_SERVICEID (IB_MPR_COMPMASK_SERVICEID_MSB | \
2806321936Shselasky				   IB_MPR_COMPMASK_SERVICEID_LSB)
2807321936Shselasky
2808321936Shselasky/* SMInfo Record Component Masks */
2809321936Shselasky#define IB_SMIR_COMPMASK_LID		(CL_HTON64(((uint64_t)1)<<0))
2810321936Shselasky#define IB_SMIR_COMPMASK_RESV0		(CL_HTON64(((uint64_t)1)<<1))
2811321936Shselasky#define IB_SMIR_COMPMASK_GUID		(CL_HTON64(((uint64_t)1)<<2))
2812321936Shselasky#define IB_SMIR_COMPMASK_SMKEY		(CL_HTON64(((uint64_t)1)<<3))
2813321936Shselasky#define IB_SMIR_COMPMASK_ACTCOUNT	(CL_HTON64(((uint64_t)1)<<4))
2814321936Shselasky#define IB_SMIR_COMPMASK_PRIORITY	(CL_HTON64(((uint64_t)1)<<5))
2815321936Shselasky#define IB_SMIR_COMPMASK_SMSTATE	(CL_HTON64(((uint64_t)1)<<6))
2816321936Shselasky
2817321936Shselasky/* InformInfo Record Component Masks */
2818321936Shselasky#define IB_IIR_COMPMASK_SUBSCRIBERGID	(CL_HTON64(((uint64_t)1)<<0))
2819321936Shselasky#define IB_IIR_COMPMASK_ENUM		(CL_HTON64(((uint64_t)1)<<1))
2820321936Shselasky#define IB_IIR_COMPMASK_RESV0		(CL_HTON64(((uint64_t)1)<<2))
2821321936Shselasky#define IB_IIR_COMPMASK_GID		(CL_HTON64(((uint64_t)1)<<3))
2822321936Shselasky#define IB_IIR_COMPMASK_LIDRANGEBEGIN	(CL_HTON64(((uint64_t)1)<<4))
2823321936Shselasky#define IB_IIR_COMPMASK_LIDRANGEEND	(CL_HTON64(((uint64_t)1)<<5))
2824321936Shselasky#define IB_IIR_COMPMASK_RESV1		(CL_HTON64(((uint64_t)1)<<6))
2825321936Shselasky#define IB_IIR_COMPMASK_ISGENERIC	(CL_HTON64(((uint64_t)1)<<7))
2826321936Shselasky#define IB_IIR_COMPMASK_SUBSCRIBE	(CL_HTON64(((uint64_t)1)<<8))
2827321936Shselasky#define IB_IIR_COMPMASK_TYPE		(CL_HTON64(((uint64_t)1)<<9))
2828321936Shselasky#define IB_IIR_COMPMASK_TRAPNUMB	(CL_HTON64(((uint64_t)1)<<10))
2829321936Shselasky#define IB_IIR_COMPMASK_DEVICEID	(CL_HTON64(((uint64_t)1)<<10))
2830321936Shselasky#define IB_IIR_COMPMASK_QPN		(CL_HTON64(((uint64_t)1)<<11))
2831321936Shselasky#define IB_IIR_COMPMASK_RESV2		(CL_HTON64(((uint64_t)1)<<12))
2832321936Shselasky#define IB_IIR_COMPMASK_RESPTIME	(CL_HTON64(((uint64_t)1)<<13))
2833321936Shselasky#define IB_IIR_COMPMASK_RESV3		(CL_HTON64(((uint64_t)1)<<14))
2834321936Shselasky#define IB_IIR_COMPMASK_PRODTYPE	(CL_HTON64(((uint64_t)1)<<15))
2835321936Shselasky#define IB_IIR_COMPMASK_VENDID		(CL_HTON64(((uint64_t)1)<<15))
2836321936Shselasky
2837321936Shselasky/****f* IBA Base: Types/ib_path_rec_init_local
2838321936Shselasky* NAME
2839321936Shselasky*	ib_path_rec_init_local
2840321936Shselasky*
2841321936Shselasky* DESCRIPTION
2842321936Shselasky*	Initializes a subnet local path record.
2843321936Shselasky*
2844321936Shselasky* SYNOPSIS
2845321936Shselasky*/
2846321936Shselaskystatic inline void OSM_API
2847321936Shselaskyib_path_rec_init_local(IN ib_path_rec_t * const p_rec,
2848321936Shselasky		       IN ib_gid_t * const p_dgid,
2849321936Shselasky		       IN ib_gid_t * const p_sgid,
2850321936Shselasky		       IN ib_net16_t dlid,
2851321936Shselasky		       IN ib_net16_t slid,
2852321936Shselasky		       IN uint8_t num_path,
2853321936Shselasky		       IN ib_net16_t pkey,
2854321936Shselasky		       IN uint8_t sl,
2855321936Shselasky		       IN uint16_t qos_class,
2856321936Shselasky		       IN uint8_t mtu_selector,
2857321936Shselasky		       IN uint8_t mtu,
2858321936Shselasky		       IN uint8_t rate_selector,
2859321936Shselasky		       IN uint8_t rate,
2860321936Shselasky		       IN uint8_t pkt_life_selector,
2861321936Shselasky		       IN uint8_t pkt_life, IN uint8_t preference)
2862321936Shselasky{
2863321936Shselasky	p_rec->dgid = *p_dgid;
2864321936Shselasky	p_rec->sgid = *p_sgid;
2865321936Shselasky	p_rec->dlid = dlid;
2866321936Shselasky	p_rec->slid = slid;
2867321936Shselasky	p_rec->num_path = num_path;
2868321936Shselasky	p_rec->pkey = pkey;
2869321936Shselasky	p_rec->qos_class_sl = cl_hton16((sl & IB_PATH_REC_SL_MASK) |
2870321936Shselasky					(qos_class << 4));
2871321936Shselasky	p_rec->mtu = (uint8_t) ((mtu & IB_PATH_REC_BASE_MASK) |
2872321936Shselasky				(uint8_t) (mtu_selector << 6));
2873321936Shselasky	p_rec->rate = (uint8_t) ((rate & IB_PATH_REC_BASE_MASK) |
2874321936Shselasky				 (uint8_t) (rate_selector << 6));
2875321936Shselasky	p_rec->pkt_life = (uint8_t) ((pkt_life & IB_PATH_REC_BASE_MASK) |
2876321936Shselasky				     (uint8_t) (pkt_life_selector << 6));
2877321936Shselasky	p_rec->preference = preference;
2878321936Shselasky
2879321936Shselasky	/* Clear global routing fields for local path records */
2880321936Shselasky	p_rec->hop_flow_raw = 0;
2881321936Shselasky	p_rec->tclass = 0;
2882321936Shselasky	p_rec->service_id = 0;
2883321936Shselasky
2884321936Shselasky	memset(p_rec->resv2, 0, sizeof(p_rec->resv2));
2885321936Shselasky}
2886321936Shselasky
2887321936Shselasky/*
2888321936Shselasky* PARAMETERS
2889321936Shselasky*	p_rec
2890321936Shselasky*		[in] Pointer to the path record object.
2891321936Shselasky*
2892321936Shselasky*	dgid
2893321936Shselasky*		[in] GID of destination port.
2894321936Shselasky*
2895321936Shselasky*	sgid
2896321936Shselasky*		[in] GID of source port.
2897321936Shselasky*
2898321936Shselasky*	dlid
2899321936Shselasky*		[in] LID of destination port.
2900321936Shselasky*
2901321936Shselasky*	slid
2902321936Shselasky*		[in] LID of source port.
2903321936Shselasky*
2904321936Shselasky*	num_path
2905321936Shselasky*		[in] Reversible path - 1 bit to say if path is reversible.
2906321936Shselasky*		num_path [6:0] In queries, maximum number of paths to return.
2907321936Shselasky*		In responses, undefined.
2908321936Shselasky*
2909321936Shselasky*	pkey
2910321936Shselasky*		[in] Partition key (P_Key) to use on this path.
2911321936Shselasky*
2912321936Shselasky*	qos_class
2913321936Shselasky*		[in] QoS class to use on this path.  Lower 12-bits are valid.
2914321936Shselasky*
2915321936Shselasky*	sl
2916321936Shselasky*		[in] Service level to use on this path.  Lower 4-bits are valid.
2917321936Shselasky*
2918321936Shselasky*	mtu_selector
2919321936Shselasky*		[in] Encoded MTU selector value to use on this path
2920321936Shselasky*
2921321936Shselasky*	mtu
2922321936Shselasky*		[in] Encoded MTU to use on this path
2923321936Shselasky*
2924321936Shselasky*	rate_selector
2925321936Shselasky*		[in] Encoded rate selector value to use on this path.
2926321936Shselasky*
2927321936Shselasky*	rate
2928321936Shselasky*		[in] Encoded rate to use on this path.
2929321936Shselasky*
2930321936Shselasky*	pkt_life_selector
2931321936Shselasky*		[in] Encoded Packet selector value lifetime for this path.
2932321936Shselasky*
2933321936Shselasky*	pkt_life
2934321936Shselasky*		[in] Encoded Packet lifetime for this path.
2935321936Shselasky*
2936321936Shselasky*	preference
2937321936Shselasky*		[in] Indicates the relative merit of this path versus other path
2938321936Shselasky*		records returned from the SA.  Lower numbers are better.
2939321936Shselasky*
2940321936Shselasky* RETURN VALUES
2941321936Shselasky*	None.
2942321936Shselasky*
2943321936Shselasky* NOTES
2944321936Shselasky*
2945321936Shselasky* SEE ALSO
2946321936Shselasky*	ib_gid_t
2947321936Shselasky*********/
2948321936Shselasky
2949321936Shselasky/****f* IBA Base: Types/ib_path_rec_num_path
2950321936Shselasky* NAME
2951321936Shselasky*	ib_path_rec_num_path
2952321936Shselasky*
2953321936Shselasky* DESCRIPTION
2954321936Shselasky*	Get max number of paths to return.
2955321936Shselasky*
2956321936Shselasky* SYNOPSIS
2957321936Shselasky*/
2958321936Shselaskystatic inline uint8_t OSM_API
2959321936Shselaskyib_path_rec_num_path(IN const ib_path_rec_t * const p_rec)
2960321936Shselasky{
2961321936Shselasky	return (p_rec->num_path & 0x7F);
2962321936Shselasky}
2963321936Shselasky
2964321936Shselasky/*
2965321936Shselasky* PARAMETERS
2966321936Shselasky*	p_rec
2967321936Shselasky*		[in] Pointer to the path record object.
2968321936Shselasky*
2969321936Shselasky* RETURN VALUES
2970321936Shselasky*	Maximum number of paths to return for each unique SGID_DGID combination.
2971321936Shselasky*
2972321936Shselasky* NOTES
2973321936Shselasky*
2974321936Shselasky* SEE ALSO
2975321936Shselasky*	ib_path_rec_t
2976321936Shselasky*********/
2977321936Shselasky
2978321936Shselasky/****f* IBA Base: Types/ib_path_rec_set_sl
2979321936Shselasky* NAME
2980321936Shselasky*	ib_path_rec_set_sl
2981321936Shselasky*
2982321936Shselasky* DESCRIPTION
2983321936Shselasky*	Set path service level.
2984321936Shselasky*
2985321936Shselasky* SYNOPSIS
2986321936Shselasky*/
2987321936Shselaskystatic inline void OSM_API
2988321936Shselaskyib_path_rec_set_sl(IN ib_path_rec_t * const p_rec, IN const uint8_t sl)
2989321936Shselasky{
2990321936Shselasky	p_rec->qos_class_sl =
2991321936Shselasky	    (p_rec->qos_class_sl & CL_HTON16(IB_PATH_REC_QOS_CLASS_MASK)) |
2992321936Shselasky	    cl_hton16(sl & IB_PATH_REC_SL_MASK);
2993321936Shselasky}
2994321936Shselasky
2995321936Shselasky/*
2996321936Shselasky* PARAMETERS
2997321936Shselasky*	p_rec
2998321936Shselasky*		[in] Pointer to the path record object.
2999321936Shselasky*
3000321936Shselasky*	sl
3001321936Shselasky*		[in] Service level to set.
3002321936Shselasky*
3003321936Shselasky* RETURN VALUES
3004321936Shselasky*	None
3005321936Shselasky*
3006321936Shselasky* NOTES
3007321936Shselasky*
3008321936Shselasky* SEE ALSO
3009321936Shselasky*	ib_path_rec_t
3010321936Shselasky*********/
3011321936Shselasky
3012321936Shselasky/****f* IBA Base: Types/ib_path_rec_sl
3013321936Shselasky* NAME
3014321936Shselasky*	ib_path_rec_sl
3015321936Shselasky*
3016321936Shselasky* DESCRIPTION
3017321936Shselasky*	Get path service level.
3018321936Shselasky*
3019321936Shselasky* SYNOPSIS
3020321936Shselasky*/
3021321936Shselaskystatic inline uint8_t OSM_API
3022321936Shselaskyib_path_rec_sl(IN const ib_path_rec_t * const p_rec)
3023321936Shselasky{
3024321936Shselasky	return (uint8_t)(cl_ntoh16(p_rec->qos_class_sl) & IB_PATH_REC_SL_MASK);
3025321936Shselasky}
3026321936Shselasky
3027321936Shselasky/*
3028321936Shselasky* PARAMETERS
3029321936Shselasky*	p_rec
3030321936Shselasky*		[in] Pointer to the path record object.
3031321936Shselasky*
3032321936Shselasky* RETURN VALUES
3033321936Shselasky*	SL.
3034321936Shselasky*
3035321936Shselasky* NOTES
3036321936Shselasky*
3037321936Shselasky* SEE ALSO
3038321936Shselasky*	ib_path_rec_t
3039321936Shselasky*********/
3040321936Shselasky
3041321936Shselasky/****f* IBA Base: Types/ib_path_rec_set_qos_class
3042321936Shselasky* NAME
3043321936Shselasky*	ib_path_rec_set_qos_class
3044321936Shselasky*
3045321936Shselasky* DESCRIPTION
3046321936Shselasky*	Set path QoS class.
3047321936Shselasky*
3048321936Shselasky* SYNOPSIS
3049321936Shselasky*/
3050321936Shselaskystatic inline void OSM_API
3051321936Shselaskyib_path_rec_set_qos_class(IN ib_path_rec_t * const p_rec,
3052321936Shselasky			  IN const uint16_t qos_class)
3053321936Shselasky{
3054321936Shselasky	p_rec->qos_class_sl =
3055321936Shselasky	    (p_rec->qos_class_sl & CL_HTON16(IB_PATH_REC_SL_MASK)) |
3056321936Shselasky	    cl_hton16(qos_class << 4);
3057321936Shselasky}
3058321936Shselasky
3059321936Shselasky/*
3060321936Shselasky* PARAMETERS
3061321936Shselasky*	p_rec
3062321936Shselasky*		[in] Pointer to the path record object.
3063321936Shselasky*
3064321936Shselasky*	qos_class
3065321936Shselasky*		[in] QoS class to set.
3066321936Shselasky*
3067321936Shselasky* RETURN VALUES
3068321936Shselasky*	None
3069321936Shselasky*
3070321936Shselasky* NOTES
3071321936Shselasky*
3072321936Shselasky* SEE ALSO
3073321936Shselasky*	ib_path_rec_t
3074321936Shselasky*********/
3075321936Shselasky
3076321936Shselasky/****f* IBA Base: Types/ib_path_rec_qos_class
3077321936Shselasky* NAME
3078321936Shselasky*	ib_path_rec_qos_class
3079321936Shselasky*
3080321936Shselasky* DESCRIPTION
3081321936Shselasky*	Get QoS class.
3082321936Shselasky*
3083321936Shselasky* SYNOPSIS
3084321936Shselasky*/
3085321936Shselaskystatic inline uint16_t OSM_API
3086321936Shselaskyib_path_rec_qos_class(IN const ib_path_rec_t * const p_rec)
3087321936Shselasky{
3088321936Shselasky	return (cl_ntoh16(p_rec->qos_class_sl) >> 4);
3089321936Shselasky}
3090321936Shselasky
3091321936Shselasky/*
3092321936Shselasky* PARAMETERS
3093321936Shselasky*	p_rec
3094321936Shselasky*		[in] Pointer to the path record object.
3095321936Shselasky*
3096321936Shselasky* RETURN VALUES
3097321936Shselasky*	QoS class of the path record.
3098321936Shselasky*
3099321936Shselasky* NOTES
3100321936Shselasky*
3101321936Shselasky* SEE ALSO
3102321936Shselasky*	ib_path_rec_t
3103321936Shselasky*********/
3104321936Shselasky
3105321936Shselasky/****f* IBA Base: Types/ib_path_rec_mtu
3106321936Shselasky* NAME
3107321936Shselasky*	ib_path_rec_mtu
3108321936Shselasky*
3109321936Shselasky* DESCRIPTION
3110321936Shselasky*	Get encoded path MTU.
3111321936Shselasky*
3112321936Shselasky* SYNOPSIS
3113321936Shselasky*/
3114321936Shselaskystatic inline uint8_t OSM_API
3115321936Shselaskyib_path_rec_mtu(IN const ib_path_rec_t * const p_rec)
3116321936Shselasky{
3117321936Shselasky	return ((uint8_t) (p_rec->mtu & IB_PATH_REC_BASE_MASK));
3118321936Shselasky}
3119321936Shselasky
3120321936Shselasky/*
3121321936Shselasky* PARAMETERS
3122321936Shselasky*	p_rec
3123321936Shselasky*		[in] Pointer to the path record object.
3124321936Shselasky*
3125321936Shselasky* RETURN VALUES
3126321936Shselasky*	Encoded path MTU.
3127321936Shselasky*		1: 256
3128321936Shselasky*		2: 512
3129321936Shselasky*		3: 1024
3130321936Shselasky*		4: 2048
3131321936Shselasky*		5: 4096
3132321936Shselasky*		others: reserved
3133321936Shselasky*
3134321936Shselasky* NOTES
3135321936Shselasky*
3136321936Shselasky* SEE ALSO
3137321936Shselasky*	ib_path_rec_t
3138321936Shselasky*********/
3139321936Shselasky
3140321936Shselasky/****f* IBA Base: Types/ib_path_rec_mtu_sel
3141321936Shselasky* NAME
3142321936Shselasky*	ib_path_rec_mtu_sel
3143321936Shselasky*
3144321936Shselasky* DESCRIPTION
3145321936Shselasky*	Get encoded path MTU selector.
3146321936Shselasky*
3147321936Shselasky* SYNOPSIS
3148321936Shselasky*/
3149321936Shselaskystatic inline uint8_t OSM_API
3150321936Shselaskyib_path_rec_mtu_sel(IN const ib_path_rec_t * const p_rec)
3151321936Shselasky{
3152321936Shselasky	return ((uint8_t) ((p_rec->mtu & IB_PATH_REC_SELECTOR_MASK) >> 6));
3153321936Shselasky}
3154321936Shselasky
3155321936Shselasky/*
3156321936Shselasky* PARAMETERS
3157321936Shselasky*	p_rec
3158321936Shselasky*		[in] Pointer to the path record object.
3159321936Shselasky*
3160321936Shselasky* RETURN VALUES
3161321936Shselasky*	Encoded path MTU selector value (for queries).
3162321936Shselasky*		0: greater than MTU specified
3163321936Shselasky*		1: less than MTU specified
3164321936Shselasky*		2: exactly the MTU specified
3165321936Shselasky*		3: largest MTU available
3166321936Shselasky*
3167321936Shselasky* NOTES
3168321936Shselasky*
3169321936Shselasky* SEE ALSO
3170321936Shselasky*	ib_path_rec_t
3171321936Shselasky*********/
3172321936Shselasky
3173321936Shselasky/****f* IBA Base: Types/ib_path_rec_rate
3174321936Shselasky* NAME
3175321936Shselasky*	ib_path_rec_rate
3176321936Shselasky*
3177321936Shselasky* DESCRIPTION
3178321936Shselasky*	Get encoded path rate.
3179321936Shselasky*
3180321936Shselasky* SYNOPSIS
3181321936Shselasky*/
3182321936Shselaskystatic inline uint8_t OSM_API
3183321936Shselaskyib_path_rec_rate(IN const ib_path_rec_t * const p_rec)
3184321936Shselasky{
3185321936Shselasky	return ((uint8_t) (p_rec->rate & IB_PATH_REC_BASE_MASK));
3186321936Shselasky}
3187321936Shselasky
3188321936Shselasky/*
3189321936Shselasky* PARAMETERS
3190321936Shselasky*	p_rec
3191321936Shselasky*		[in] Pointer to the path record object.
3192321936Shselasky*
3193321936Shselasky* RETURN VALUES
3194321936Shselasky*	Encoded path rate.
3195321936Shselasky*		2: 2.5 Gb/sec.
3196321936Shselasky*		3: 10 Gb/sec.
3197321936Shselasky*		4: 30 Gb/sec.
3198321936Shselasky*		5: 5 Gb/sec.
3199321936Shselasky*		6: 20 Gb/sec.
3200321936Shselasky*		7: 40 Gb/sec.
3201321936Shselasky*		8: 60 Gb/sec.
3202321936Shselasky*		9: 80 Gb/sec.
3203321936Shselasky*		10: 120 Gb/sec.
3204321936Shselasky*		11: 14 Gb/sec.
3205321936Shselasky*		12: 56 Gb/sec.
3206321936Shselasky*		13: 112 Gb/sec.
3207321936Shselasky*		14: 168 Gb/sec.
3208321936Shselasky*		15: 25 Gb/sec.
3209321936Shselasky*		16: 100 Gb/sec.
3210321936Shselasky*		17: 200 Gb/sec.
3211321936Shselasky*		18: 300 Gb/sec.
3212321936Shselasky*		others: reserved
3213321936Shselasky*
3214321936Shselasky* NOTES
3215321936Shselasky*
3216321936Shselasky* SEE ALSO
3217321936Shselasky*	ib_path_rec_t
3218321936Shselasky*********/
3219321936Shselasky
3220321936Shselasky/****f* IBA Base: Types/ib_path_rec_rate_sel
3221321936Shselasky* NAME
3222321936Shselasky*	ib_path_rec_rate_sel
3223321936Shselasky*
3224321936Shselasky* DESCRIPTION
3225321936Shselasky*	Get encoded path rate selector.
3226321936Shselasky*
3227321936Shselasky* SYNOPSIS
3228321936Shselasky*/
3229321936Shselaskystatic inline uint8_t OSM_API
3230321936Shselaskyib_path_rec_rate_sel(IN const ib_path_rec_t * const p_rec)
3231321936Shselasky{
3232321936Shselasky	return ((uint8_t) ((p_rec->rate & IB_PATH_REC_SELECTOR_MASK) >> 6));
3233321936Shselasky}
3234321936Shselasky
3235321936Shselasky/*
3236321936Shselasky* PARAMETERS
3237321936Shselasky*	p_rec
3238321936Shselasky*		[in] Pointer to the path record object.
3239321936Shselasky*
3240321936Shselasky* RETURN VALUES
3241321936Shselasky*	Encoded path rate selector value (for queries).
3242321936Shselasky*		0: greater than rate specified
3243321936Shselasky*		1: less than rate specified
3244321936Shselasky*		2: exactly the rate specified
3245321936Shselasky*		3: largest rate available
3246321936Shselasky*
3247321936Shselasky* NOTES
3248321936Shselasky*
3249321936Shselasky* SEE ALSO
3250321936Shselasky*	ib_path_rec_t
3251321936Shselasky*********/
3252321936Shselasky
3253321936Shselasky/****f* IBA Base: Types/ib_path_rec_pkt_life
3254321936Shselasky* NAME
3255321936Shselasky*	ib_path_rec_pkt_life
3256321936Shselasky*
3257321936Shselasky* DESCRIPTION
3258321936Shselasky*	Get encoded path pkt_life.
3259321936Shselasky*
3260321936Shselasky* SYNOPSIS
3261321936Shselasky*/
3262321936Shselaskystatic inline uint8_t OSM_API
3263321936Shselaskyib_path_rec_pkt_life(IN const ib_path_rec_t * const p_rec)
3264321936Shselasky{
3265321936Shselasky	return ((uint8_t) (p_rec->pkt_life & IB_PATH_REC_BASE_MASK));
3266321936Shselasky}
3267321936Shselasky
3268321936Shselasky/*
3269321936Shselasky* PARAMETERS
3270321936Shselasky*	p_rec
3271321936Shselasky*		[in] Pointer to the path record object.
3272321936Shselasky*
3273321936Shselasky* RETURN VALUES
3274321936Shselasky*	Encoded path pkt_life = 4.096 usec * 2 ** PacketLifeTime.
3275321936Shselasky*
3276321936Shselasky* NOTES
3277321936Shselasky*
3278321936Shselasky* SEE ALSO
3279321936Shselasky*	ib_path_rec_t
3280321936Shselasky*********/
3281321936Shselasky
3282321936Shselasky/****f* IBA Base: Types/ib_path_rec_pkt_life_sel
3283321936Shselasky* NAME
3284321936Shselasky*	ib_path_rec_pkt_life_sel
3285321936Shselasky*
3286321936Shselasky* DESCRIPTION
3287321936Shselasky*	Get encoded path pkt_lifetime selector.
3288321936Shselasky*
3289321936Shselasky* SYNOPSIS
3290321936Shselasky*/
3291321936Shselaskystatic inline uint8_t OSM_API
3292321936Shselaskyib_path_rec_pkt_life_sel(IN const ib_path_rec_t * const p_rec)
3293321936Shselasky{
3294321936Shselasky	return ((uint8_t) ((p_rec->pkt_life & IB_PATH_REC_SELECTOR_MASK) >> 6));
3295321936Shselasky}
3296321936Shselasky
3297321936Shselasky/*
3298321936Shselasky* PARAMETERS
3299321936Shselasky*	p_rec
3300321936Shselasky*		[in] Pointer to the path record object.
3301321936Shselasky*
3302321936Shselasky* RETURN VALUES
3303321936Shselasky*	Encoded path pkt_lifetime selector value (for queries).
3304321936Shselasky*		0: greater than rate specified
3305321936Shselasky*		1: less than rate specified
3306321936Shselasky*		2: exactly the rate specified
3307321936Shselasky*		3: smallest packet lifetime available
3308321936Shselasky*
3309321936Shselasky* NOTES
3310321936Shselasky*
3311321936Shselasky* SEE ALSO
3312321936Shselasky*	ib_path_rec_t
3313321936Shselasky*********/
3314321936Shselasky
3315321936Shselasky/****f* IBA Base: Types/ib_path_rec_flow_lbl
3316321936Shselasky* NAME
3317321936Shselasky*	ib_path_rec_flow_lbl
3318321936Shselasky*
3319321936Shselasky* DESCRIPTION
3320321936Shselasky*	Get flow label.
3321321936Shselasky*
3322321936Shselasky* SYNOPSIS
3323321936Shselasky*/
3324321936Shselaskystatic inline uint32_t OSM_API
3325321936Shselaskyib_path_rec_flow_lbl(IN const ib_path_rec_t * const p_rec)
3326321936Shselasky{
3327321936Shselasky	return (((cl_ntoh32(p_rec->hop_flow_raw) >> 8) & 0x000FFFFF));
3328321936Shselasky}
3329321936Shselasky
3330321936Shselasky/*
3331321936Shselasky* PARAMETERS
3332321936Shselasky*	p_rec
3333321936Shselasky*		[in] Pointer to the path record object.
3334321936Shselasky*
3335321936Shselasky* RETURN VALUES
3336321936Shselasky*	Flow label of the path record.
3337321936Shselasky*
3338321936Shselasky* NOTES
3339321936Shselasky*
3340321936Shselasky* SEE ALSO
3341321936Shselasky*	ib_path_rec_t
3342321936Shselasky*********/
3343321936Shselasky
3344321936Shselasky/****f* IBA Base: Types/ib_path_rec_hop_limit
3345321936Shselasky* NAME
3346321936Shselasky*	ib_path_rec_hop_limit
3347321936Shselasky*
3348321936Shselasky* DESCRIPTION
3349321936Shselasky*	Get hop limit.
3350321936Shselasky*
3351321936Shselasky* SYNOPSIS
3352321936Shselasky*/
3353321936Shselaskystatic inline uint8_t OSM_API
3354321936Shselaskyib_path_rec_hop_limit(IN const ib_path_rec_t * const p_rec)
3355321936Shselasky{
3356321936Shselasky	return ((uint8_t) (cl_ntoh32(p_rec->hop_flow_raw) & 0x000000FF));
3357321936Shselasky}
3358321936Shselasky
3359321936Shselasky/*
3360321936Shselasky* PARAMETERS
3361321936Shselasky*	p_rec
3362321936Shselasky*		[in] Pointer to the path record object.
3363321936Shselasky*
3364321936Shselasky* RETURN VALUES
3365321936Shselasky*	Hop limit of the path record.
3366321936Shselasky*
3367321936Shselasky* NOTES
3368321936Shselasky*
3369321936Shselasky* SEE ALSO
3370321936Shselasky*	ib_path_rec_t
3371321936Shselasky*********/
3372321936Shselasky
3373321936Shselasky/****s* IBA Base: Constants/IB_CLASS_CAP_TRAP
3374321936Shselasky* NAME
3375321936Shselasky*	IB_CLASS_CAP_TRAP
3376321936Shselasky*
3377321936Shselasky* DESCRIPTION
3378321936Shselasky*	ClassPortInfo CapabilityMask bits.  This bit will be set
3379321936Shselasky*	if the class supports Trap() MADs (13.4.8.1).
3380321936Shselasky*
3381321936Shselasky* SEE ALSO
3382321936Shselasky*	ib_class_port_info_t, IB_CLASS_CAP_GETSET, IB_CLASS_CAP_CAPMASK2
3383321936Shselasky*
3384321936Shselasky* SOURCE
3385321936Shselasky*/
3386321936Shselasky#define IB_CLASS_CAP_TRAP					0x0001
3387321936Shselasky/*********/
3388321936Shselasky
3389321936Shselasky/****s* IBA Base: Constants/IB_CLASS_CAP_GETSET
3390321936Shselasky* NAME
3391321936Shselasky*	IB_CLASS_CAP_GETSET
3392321936Shselasky*
3393321936Shselasky* DESCRIPTION
3394321936Shselasky*	ClassPortInfo CapabilityMask bits.  This bit will be set
3395321936Shselasky*	if the class supports Get(Notice) and Set(Notice) MADs (13.4.8.1).
3396321936Shselasky*
3397321936Shselasky* SEE ALSO
3398321936Shselasky*	ib_class_port_info_t, IB_CLASS_CAP_TRAP, IB_CLASS_CAP_CAPMASK2
3399321936Shselasky*
3400321936Shselasky* SOURCE
3401321936Shselasky*/
3402321936Shselasky#define IB_CLASS_CAP_GETSET					0x0002
3403321936Shselasky/*********/
3404321936Shselasky
3405321936Shselasky/****s* IBA Base: Constants/IB_CLASS_CAP_CAPMASK2
3406321936Shselasky* NAME
3407321936Shselasky*	IB_CLASS_CAP_CAPMASK2
3408321936Shselasky*
3409321936Shselasky* DESCRIPTION
3410321936Shselasky*	ClassPortInfo CapabilityMask bits.
3411321936Shselasky*	This bit will be set of the class supports additional class specific
3412321936Shselasky*	capabilities (CapabilityMask2) (13.4.8.1).
3413321936Shselasky*
3414321936Shselasky* SEE ALSO
3415321936Shselasky*	ib_class_port_info_t, IB_CLASS_CAP_TRAP, IB_CLASS_CAP_GETSET
3416321936Shselasky*
3417321936Shselasky* SOURCE
3418321936Shselasky*/
3419321936Shselasky#define IB_CLASS_CAP_CAPMASK2					0x0004
3420321936Shselasky/*********/
3421321936Shselasky
3422321936Shselasky/****s* IBA Base: Constants/IB_CLASS_ENH_PORT0_CC_MASK
3423321936Shselasky* NAME
3424321936Shselasky*	IB_CLASS_ENH_PORT0_CC_MASK
3425321936Shselasky*
3426321936Shselasky* DESCRIPTION
3427321936Shselasky*	ClassPortInfo CapabilityMask bits.
3428321936Shselasky*	Switch only: This bit will be set if the EnhancedPort0
3429321936Shselasky*	supports CA Congestion Control (A10.4.3.1).
3430321936Shselasky*
3431321936Shselasky* SEE ALSO
3432321936Shselasky*	ib_class_port_info_t
3433321936Shselasky*
3434321936Shselasky* SOURCE
3435321936Shselasky*/
3436321936Shselasky#define IB_CLASS_ENH_PORT0_CC_MASK			0x0100
3437321936Shselasky/*********/
3438321936Shselasky
3439321936Shselasky/****s* IBA Base: Constants/IB_CLASS_RESP_TIME_MASK
3440321936Shselasky* NAME
3441321936Shselasky*	IB_CLASS_RESP_TIME_MASK
3442321936Shselasky*
3443321936Shselasky* DESCRIPTION
3444321936Shselasky*	Mask bits to extract the response time value from the
3445321936Shselasky*	cap_mask2_resp_time field of ib_class_port_info_t.
3446321936Shselasky*
3447321936Shselasky* SEE ALSO
3448321936Shselasky*	ib_class_port_info_t
3449321936Shselasky*
3450321936Shselasky* SOURCE
3451321936Shselasky*/
3452321936Shselasky#define IB_CLASS_RESP_TIME_MASK				0x1F
3453321936Shselasky/*********/
3454321936Shselasky
3455321936Shselasky/****s* IBA Base: Constants/IB_CLASS_CAPMASK2_SHIFT
3456321936Shselasky* NAME
3457321936Shselasky*	IB_CLASS_CAPMASK2_SHIFT
3458321936Shselasky*
3459321936Shselasky* DESCRIPTION
3460321936Shselasky*	Number of bits to shift to extract the capability mask2
3461321936Shselasky*	from the cap_mask2_resp_time field of ib_class_port_info_t.
3462321936Shselasky*
3463321936Shselasky* SEE ALSO
3464321936Shselasky*	ib_class_port_info_t
3465321936Shselasky*
3466321936Shselasky* SOURCE
3467321936Shselasky*/
3468321936Shselasky#define IB_CLASS_CAPMASK2_SHIFT				5
3469321936Shselasky/*********/
3470321936Shselasky
3471321936Shselasky/****s* IBA Base: Types/ib_class_port_info_t
3472321936Shselasky* NAME
3473321936Shselasky*	ib_class_port_info_t
3474321936Shselasky*
3475321936Shselasky* DESCRIPTION
3476321936Shselasky*	IBA defined ClassPortInfo attribute (13.4.8.1)
3477321936Shselasky*
3478321936Shselasky* SYNOPSIS
3479321936Shselasky*/
3480321936Shselasky#include <complib/cl_packon.h>
3481321936Shselaskytypedef struct _ib_class_port_info {
3482321936Shselasky	uint8_t base_ver;
3483321936Shselasky	uint8_t class_ver;
3484321936Shselasky	ib_net16_t cap_mask;
3485321936Shselasky	ib_net32_t cap_mask2_resp_time;
3486321936Shselasky	ib_gid_t redir_gid;
3487321936Shselasky	ib_net32_t redir_tc_sl_fl;
3488321936Shselasky	ib_net16_t redir_lid;
3489321936Shselasky	ib_net16_t redir_pkey;
3490321936Shselasky	ib_net32_t redir_qp;
3491321936Shselasky	ib_net32_t redir_qkey;
3492321936Shselasky	ib_gid_t trap_gid;
3493321936Shselasky	ib_net32_t trap_tc_sl_fl;
3494321936Shselasky	ib_net16_t trap_lid;
3495321936Shselasky	ib_net16_t trap_pkey;
3496321936Shselasky	ib_net32_t trap_hop_qp;
3497321936Shselasky	ib_net32_t trap_qkey;
3498321936Shselasky} PACK_SUFFIX ib_class_port_info_t;
3499321936Shselasky#include <complib/cl_packoff.h>
3500321936Shselasky/*
3501321936Shselasky* FIELDS
3502321936Shselasky*	base_ver
3503321936Shselasky*		Maximum supported MAD Base Version.
3504321936Shselasky*
3505321936Shselasky*	class_ver
3506321936Shselasky*		Maximum supported management class version.
3507321936Shselasky*
3508321936Shselasky*	cap_mask
3509321936Shselasky*		Supported capabilities of this management class.
3510321936Shselasky*
3511321936Shselasky*	cap_mask2_resp_time
3512321936Shselasky*		Maximum expected response time and additional
3513321936Shselasky*		supported capabilities of this management class.
3514321936Shselasky*
3515321936Shselasky*	redir_gid
3516321936Shselasky*		GID to use for redirection, or zero
3517321936Shselasky*
3518321936Shselasky*	redir_tc_sl_fl
3519321936Shselasky*		Traffic class, service level and flow label the requester
3520321936Shselasky*		should use if the service is redirected.
3521321936Shselasky*
3522321936Shselasky*	redir_lid
3523321936Shselasky*		LID used for redirection, or zero
3524321936Shselasky*
3525321936Shselasky*	redir_pkey
3526321936Shselasky*		P_Key used for redirection
3527321936Shselasky*
3528321936Shselasky*	redir_qp
3529321936Shselasky*		QP number used for redirection
3530321936Shselasky*
3531321936Shselasky*	redir_qkey
3532321936Shselasky*		Q_Key associated with the redirected QP.  This shall be the
3533321936Shselasky*		well known Q_Key value.
3534321936Shselasky*
3535321936Shselasky*	trap_gid
3536321936Shselasky*		GID value used for trap messages from this service.
3537321936Shselasky*
3538321936Shselasky*	trap_tc_sl_fl
3539321936Shselasky*		Traffic class, service level and flow label used for
3540321936Shselasky*		trap messages originated by this service.
3541321936Shselasky*
3542321936Shselasky*	trap_lid
3543321936Shselasky*		LID used for trap messages, or zero
3544321936Shselasky*
3545321936Shselasky*	trap_pkey
3546321936Shselasky*		P_Key used for trap messages
3547321936Shselasky*
3548321936Shselasky*	trap_hop_qp
3549321936Shselasky*		Hop limit (upper 8 bits) and QP number used for trap messages
3550321936Shselasky*
3551321936Shselasky*	trap_qkey
3552321936Shselasky*		Q_Key associated with the trap messages QP.
3553321936Shselasky*
3554321936Shselasky* SEE ALSO
3555321936Shselasky*	IB_CLASS_CAP_GETSET, IB_CLASS_CAP_TRAP
3556321936Shselasky*
3557321936Shselasky*********/
3558321936Shselasky
3559321936Shselasky#define IB_PM_ALL_PORT_SELECT			(CL_HTON16(((uint16_t)1)<<8))
3560321936Shselasky#define IB_PM_EXT_WIDTH_SUPPORTED		(CL_HTON16(((uint16_t)1)<<9))
3561321936Shselasky#define IB_PM_EXT_WIDTH_NOIETF_SUP		(CL_HTON16(((uint16_t)1)<<10))
3562321936Shselasky#define IB_PM_SAMPLES_ONLY_SUP			(CL_HTON16(((uint16_t)1)<<11))
3563321936Shselasky#define IB_PM_PC_XMIT_WAIT_SUP			(CL_HTON16(((uint16_t)1)<<12))
3564321936Shselasky#define IS_PM_INH_LMTD_PKEY_MC_CONSTR_ERR	(CL_HTON16(((uint16_t)1)<<13))
3565321936Shselasky#define IS_PM_RSFEC_COUNTERS_SUP		(CL_HTON16(((uint16_t)1)<<14))
3566321936Shselasky#define IB_PM_IS_QP1_DROP_SUP			(CL_HTON16(((uint16_t)1)<<15))
3567321936Shselasky/* CapabilityMask2 */
3568321936Shselasky#define IB_PM_IS_PM_KEY_SUPPORTED		(CL_HTON32(((uint32_t)1)<<0))
3569321936Shselasky#define IB_PM_IS_ADDL_PORT_CTRS_EXT_SUP		(CL_HTON32(((uint32_t)1)<<1))
3570321936Shselasky
3571321936Shselasky/****f* IBA Base: Types/ib_class_set_resp_time_val
3572321936Shselasky* NAME
3573321936Shselasky*	ib_class_set_resp_time_val
3574321936Shselasky*
3575321936Shselasky* DESCRIPTION
3576321936Shselasky*	Set maximum expected response time.
3577321936Shselasky*
3578321936Shselasky* SYNOPSIS
3579321936Shselasky*/
3580321936Shselaskystatic inline void OSM_API
3581321936Shselaskyib_class_set_resp_time_val(IN ib_class_port_info_t * const p_cpi,
3582321936Shselasky			   IN const uint8_t val)
3583321936Shselasky{
3584321936Shselasky	p_cpi->cap_mask2_resp_time =
3585321936Shselasky	    (p_cpi->cap_mask2_resp_time & CL_HTON32(~IB_CLASS_RESP_TIME_MASK)) |
3586321936Shselasky	    cl_hton32(val & IB_CLASS_RESP_TIME_MASK);
3587321936Shselasky}
3588321936Shselasky
3589321936Shselasky/*
3590321936Shselasky* PARAMETERS
3591321936Shselasky*	p_cpi
3592321936Shselasky*		[in] Pointer to the class port info object.
3593321936Shselasky*
3594321936Shselasky*	val
3595321936Shselasky*		[in] Response time value to set.
3596321936Shselasky*
3597321936Shselasky* RETURN VALUES
3598321936Shselasky*	None
3599321936Shselasky*
3600321936Shselasky* NOTES
3601321936Shselasky*
3602321936Shselasky* SEE ALSO
3603321936Shselasky*	ib_class_port_info_t
3604321936Shselasky*********/
3605321936Shselasky
3606321936Shselasky/****f* IBA Base: Types/ib_class_resp_time_val
3607321936Shselasky* NAME
3608321936Shselasky*	ib_class_resp_time_val
3609321936Shselasky*
3610321936Shselasky* DESCRIPTION
3611321936Shselasky*	Get response time value.
3612321936Shselasky*
3613321936Shselasky* SYNOPSIS
3614321936Shselasky*/
3615321936Shselaskystatic inline uint8_t OSM_API
3616321936Shselaskyib_class_resp_time_val(IN ib_class_port_info_t * const p_cpi)
3617321936Shselasky{
3618321936Shselasky	return (uint8_t)(cl_ntoh32(p_cpi->cap_mask2_resp_time) &
3619321936Shselasky			 IB_CLASS_RESP_TIME_MASK);
3620321936Shselasky}
3621321936Shselasky
3622321936Shselasky/*
3623321936Shselasky* PARAMETERS
3624321936Shselasky*	p_cpi
3625321936Shselasky*		[in] Pointer to the class port info object.
3626321936Shselasky*
3627321936Shselasky* RETURN VALUES
3628321936Shselasky*	Response time value.
3629321936Shselasky*
3630321936Shselasky* NOTES
3631321936Shselasky*
3632321936Shselasky* SEE ALSO
3633321936Shselasky*	ib_class_port_info_t
3634321936Shselasky*********/
3635321936Shselasky
3636321936Shselasky/****f* IBA Base: Types/ib_class_set_cap_mask2
3637321936Shselasky* NAME
3638321936Shselasky*	ib_class_set_cap_mask2
3639321936Shselasky*
3640321936Shselasky* DESCRIPTION
3641321936Shselasky*	Set ClassPortInfo:CapabilityMask2.
3642321936Shselasky*
3643321936Shselasky* SYNOPSIS
3644321936Shselasky*/
3645321936Shselaskystatic inline void OSM_API
3646321936Shselaskyib_class_set_cap_mask2(IN ib_class_port_info_t * const p_cpi,
3647321936Shselasky		       IN const uint32_t cap_mask2)
3648321936Shselasky{
3649321936Shselasky	p_cpi->cap_mask2_resp_time = (p_cpi->cap_mask2_resp_time &
3650321936Shselasky		CL_HTON32(IB_CLASS_RESP_TIME_MASK)) |
3651321936Shselasky		cl_hton32(cap_mask2 << IB_CLASS_CAPMASK2_SHIFT);
3652321936Shselasky}
3653321936Shselasky
3654321936Shselasky/*
3655321936Shselasky* PARAMETERS
3656321936Shselasky*	p_cpi
3657321936Shselasky*		[in] Pointer to the class port info object.
3658321936Shselasky*
3659321936Shselasky*	cap_mask2
3660321936Shselasky*		[in] CapabilityMask2 value to set.
3661321936Shselasky*
3662321936Shselasky* RETURN VALUES
3663321936Shselasky*	None
3664321936Shselasky*
3665321936Shselasky* NOTES
3666321936Shselasky*
3667321936Shselasky* SEE ALSO
3668321936Shselasky*	ib_class_port_info_t
3669321936Shselasky*********/
3670321936Shselasky
3671321936Shselasky/****f* IBA Base: Types/ib_class_cap_mask2
3672321936Shselasky* NAME
3673321936Shselasky*	ib_class_cap_mask2
3674321936Shselasky*
3675321936Shselasky* DESCRIPTION
3676321936Shselasky*	Get ClassPortInfo:CapabilityMask2.
3677321936Shselasky*
3678321936Shselasky* SYNOPSIS
3679321936Shselasky*/
3680321936Shselaskystatic inline uint32_t OSM_API
3681321936Shselaskyib_class_cap_mask2(IN const ib_class_port_info_t * const p_cpi)
3682321936Shselasky{
3683321936Shselasky	return (cl_ntoh32(p_cpi->cap_mask2_resp_time) >> IB_CLASS_CAPMASK2_SHIFT);
3684321936Shselasky}
3685321936Shselasky
3686321936Shselasky/*
3687321936Shselasky* PARAMETERS
3688321936Shselasky*	p_cpi
3689321936Shselasky*		[in] Pointer to the class port info object.
3690321936Shselasky*
3691321936Shselasky* RETURN VALUES
3692321936Shselasky*	CapabilityMask2 of the ClassPortInfo.
3693321936Shselasky*
3694321936Shselasky* NOTES
3695321936Shselasky*
3696321936Shselasky* SEE ALSO
3697321936Shselasky*	ib_class_port_info_t
3698321936Shselasky*********/
3699321936Shselasky
3700321936Shselasky/****s* IBA Base: Types/ib_sm_info_t
3701321936Shselasky* NAME
3702321936Shselasky*	ib_sm_info_t
3703321936Shselasky*
3704321936Shselasky* DESCRIPTION
3705321936Shselasky*	SMInfo structure (14.2.5.13).
3706321936Shselasky*
3707321936Shselasky* SYNOPSIS
3708321936Shselasky*/
3709321936Shselasky#include <complib/cl_packon.h>
3710321936Shselaskytypedef struct _ib_sm_info {
3711321936Shselasky	ib_net64_t guid;
3712321936Shselasky	ib_net64_t sm_key;
3713321936Shselasky	ib_net32_t act_count;
3714321936Shselasky	uint8_t pri_state;
3715321936Shselasky} PACK_SUFFIX ib_sm_info_t;
3716321936Shselasky#include <complib/cl_packoff.h>
3717321936Shselasky/*
3718321936Shselasky* FIELDS
3719321936Shselasky*	guid
3720321936Shselasky*		Port GUID for this SM.
3721321936Shselasky*
3722321936Shselasky*	sm_key
3723321936Shselasky*		SM_Key of this SM.
3724321936Shselasky*
3725321936Shselasky*	act_count
3726321936Shselasky*		Activity counter used as a heartbeat.
3727321936Shselasky*
3728321936Shselasky*	pri_state
3729321936Shselasky*		Priority and State information
3730321936Shselasky*
3731321936Shselasky* SEE ALSO
3732321936Shselasky*********/
3733321936Shselasky
3734321936Shselasky/****f* IBA Base: Types/ib_sminfo_get_priority
3735321936Shselasky* NAME
3736321936Shselasky*	ib_sminfo_get_priority
3737321936Shselasky*
3738321936Shselasky* DESCRIPTION
3739321936Shselasky*	Returns the priority value.
3740321936Shselasky*
3741321936Shselasky* SYNOPSIS
3742321936Shselasky*/
3743321936Shselaskystatic inline uint8_t OSM_API
3744321936Shselaskyib_sminfo_get_priority(IN const ib_sm_info_t * const p_smi)
3745321936Shselasky{
3746321936Shselasky	return ((uint8_t) ((p_smi->pri_state & 0xF0) >> 4));
3747321936Shselasky}
3748321936Shselasky
3749321936Shselasky/*
3750321936Shselasky* PARAMETERS
3751321936Shselasky*	p_smi
3752321936Shselasky*		[in] Pointer to the SMInfo Attribute.
3753321936Shselasky*
3754321936Shselasky* RETURN VALUES
3755321936Shselasky*	Returns the priority value.
3756321936Shselasky*
3757321936Shselasky* NOTES
3758321936Shselasky*
3759321936Shselasky* SEE ALSO
3760321936Shselasky*********/
3761321936Shselasky
3762321936Shselasky/****f* IBA Base: Types/ib_sminfo_get_state
3763321936Shselasky* NAME
3764321936Shselasky*	ib_sminfo_get_state
3765321936Shselasky*
3766321936Shselasky* DESCRIPTION
3767321936Shselasky*	Returns the state value.
3768321936Shselasky*
3769321936Shselasky* SYNOPSIS
3770321936Shselasky*/
3771321936Shselaskystatic inline uint8_t OSM_API
3772321936Shselaskyib_sminfo_get_state(IN const ib_sm_info_t * const p_smi)
3773321936Shselasky{
3774321936Shselasky	return ((uint8_t) (p_smi->pri_state & 0x0F));
3775321936Shselasky}
3776321936Shselasky
3777321936Shselasky/*
3778321936Shselasky* PARAMETERS
3779321936Shselasky*	p_smi
3780321936Shselasky*		[in] Pointer to the SMInfo Attribute.
3781321936Shselasky*
3782321936Shselasky* RETURN VALUES
3783321936Shselasky*	Returns the state value.
3784321936Shselasky*
3785321936Shselasky* NOTES
3786321936Shselasky*
3787321936Shselasky* SEE ALSO
3788321936Shselasky*********/
3789321936Shselasky
3790321936Shselasky/****s* IBA Base: Types/ib_mad_t
3791321936Shselasky* NAME
3792321936Shselasky*	ib_mad_t
3793321936Shselasky*
3794321936Shselasky* DESCRIPTION
3795321936Shselasky*	IBA defined MAD header (13.4.3)
3796321936Shselasky*
3797321936Shselasky* SYNOPSIS
3798321936Shselasky*/
3799321936Shselasky#include <complib/cl_packon.h>
3800321936Shselaskytypedef struct _ib_mad {
3801321936Shselasky	uint8_t base_ver;
3802321936Shselasky	uint8_t mgmt_class;
3803321936Shselasky	uint8_t class_ver;
3804321936Shselasky	uint8_t method;
3805321936Shselasky	ib_net16_t status;
3806321936Shselasky	ib_net16_t class_spec;
3807321936Shselasky	ib_net64_t trans_id;
3808321936Shselasky	ib_net16_t attr_id;
3809321936Shselasky	ib_net16_t resv;
3810321936Shselasky	ib_net32_t attr_mod;
3811321936Shselasky} PACK_SUFFIX ib_mad_t;
3812321936Shselasky#include <complib/cl_packoff.h>
3813321936Shselasky/*
3814321936Shselasky* FIELDS
3815321936Shselasky*	base_ver
3816321936Shselasky*		MAD base format.
3817321936Shselasky*
3818321936Shselasky*	mgmt_class
3819321936Shselasky*		Class of operation.
3820321936Shselasky*
3821321936Shselasky*	class_ver
3822321936Shselasky*		Version of MAD class-specific format.
3823321936Shselasky*
3824321936Shselasky*	method
3825321936Shselasky*		Method to perform, including 'R' bit.
3826321936Shselasky*
3827321936Shselasky*	status
3828321936Shselasky*		Status of operation.
3829321936Shselasky*
3830321936Shselasky*	class_spec
3831321936Shselasky*		Reserved for subnet management.
3832321936Shselasky*
3833321936Shselasky*	trans_id
3834321936Shselasky*		Transaction ID.
3835321936Shselasky*
3836321936Shselasky*	attr_id
3837321936Shselasky*		Attribute ID.
3838321936Shselasky*
3839321936Shselasky*	resv
3840321936Shselasky*		Reserved field.
3841321936Shselasky*
3842321936Shselasky*	attr_mod
3843321936Shselasky*		Attribute modifier.
3844321936Shselasky*
3845321936Shselasky* SEE ALSO
3846321936Shselasky*********/
3847321936Shselasky
3848321936Shselasky/****s* IBA Base: Types/ib_rmpp_mad_t
3849321936Shselasky* NAME
3850321936Shselasky*	ib_rmpp_mad_t
3851321936Shselasky*
3852321936Shselasky* DESCRIPTION
3853321936Shselasky*	IBA defined MAD RMPP header (13.6.2.1)
3854321936Shselasky*
3855321936Shselasky* SYNOPSIS
3856321936Shselasky*/
3857321936Shselasky#include <complib/cl_packon.h>
3858321936Shselaskytypedef struct _ib_rmpp_mad {
3859321936Shselasky	ib_mad_t common_hdr;
3860321936Shselasky	uint8_t rmpp_version;
3861321936Shselasky	uint8_t rmpp_type;
3862321936Shselasky	uint8_t rmpp_flags;
3863321936Shselasky	uint8_t rmpp_status;
3864321936Shselasky	ib_net32_t seg_num;
3865321936Shselasky	ib_net32_t paylen_newwin;
3866321936Shselasky} PACK_SUFFIX ib_rmpp_mad_t;
3867321936Shselasky#include <complib/cl_packoff.h>
3868321936Shselasky/*
3869321936Shselasky* SEE ALSO
3870321936Shselasky*	ib_mad_t
3871321936Shselasky*********/
3872321936Shselasky
3873321936Shselasky/****f* IBA Base: Types/ib_mad_init_new
3874321936Shselasky* NAME
3875321936Shselasky*	ib_mad_init_new
3876321936Shselasky*
3877321936Shselasky* DESCRIPTION
3878321936Shselasky*	Initializes a MAD common header.
3879321936Shselasky*
3880321936Shselasky* SYNOPSIS
3881321936Shselasky*/
3882321936Shselaskystatic inline void OSM_API
3883321936Shselaskyib_mad_init_new(IN ib_mad_t * const p_mad,
3884321936Shselasky		IN const uint8_t mgmt_class,
3885321936Shselasky		IN const uint8_t class_ver,
3886321936Shselasky		IN const uint8_t method,
3887321936Shselasky		IN const ib_net64_t trans_id,
3888321936Shselasky		IN const ib_net16_t attr_id, IN const ib_net32_t attr_mod)
3889321936Shselasky{
3890321936Shselasky	CL_ASSERT(p_mad);
3891321936Shselasky	p_mad->base_ver = 1;
3892321936Shselasky	p_mad->mgmt_class = mgmt_class;
3893321936Shselasky	p_mad->class_ver = class_ver;
3894321936Shselasky	p_mad->method = method;
3895321936Shselasky	p_mad->status = 0;
3896321936Shselasky	p_mad->class_spec = 0;
3897321936Shselasky	p_mad->trans_id = trans_id;
3898321936Shselasky	p_mad->attr_id = attr_id;
3899321936Shselasky	p_mad->resv = 0;
3900321936Shselasky	p_mad->attr_mod = attr_mod;
3901321936Shselasky}
3902321936Shselasky
3903321936Shselasky/*
3904321936Shselasky* PARAMETERS
3905321936Shselasky*	p_mad
3906321936Shselasky*		[in] Pointer to the MAD common header.
3907321936Shselasky*
3908321936Shselasky*	mgmt_class
3909321936Shselasky*		[in] Class of operation.
3910321936Shselasky*
3911321936Shselasky*	class_ver
3912321936Shselasky*		[in] Version of MAD class-specific format.
3913321936Shselasky*
3914321936Shselasky*	method
3915321936Shselasky*		[in] Method to perform, including 'R' bit.
3916321936Shselasky*
3917321936Shselasky*	trans_Id
3918321936Shselasky*		[in] Transaction ID.
3919321936Shselasky*
3920321936Shselasky*	attr_id
3921321936Shselasky*		[in] Attribute ID.
3922321936Shselasky*
3923321936Shselasky*	attr_mod
3924321936Shselasky*		[in] Attribute modifier.
3925321936Shselasky*
3926321936Shselasky* RETURN VALUES
3927321936Shselasky*	None.
3928321936Shselasky*
3929321936Shselasky* NOTES
3930321936Shselasky*
3931321936Shselasky* SEE ALSO
3932321936Shselasky*	ib_mad_t
3933321936Shselasky*********/
3934321936Shselasky
3935321936Shselasky/****f* IBA Base: Types/ib_mad_init_response
3936321936Shselasky* NAME
3937321936Shselasky*	ib_mad_init_response
3938321936Shselasky*
3939321936Shselasky* DESCRIPTION
3940321936Shselasky*	Initializes a MAD common header as a response.
3941321936Shselasky*
3942321936Shselasky* SYNOPSIS
3943321936Shselasky*/
3944321936Shselaskystatic inline void OSM_API
3945321936Shselaskyib_mad_init_response(IN const ib_mad_t * const p_req_mad,
3946321936Shselasky		     IN ib_mad_t * const p_mad, IN const ib_net16_t status)
3947321936Shselasky{
3948321936Shselasky	CL_ASSERT(p_req_mad);
3949321936Shselasky	CL_ASSERT(p_mad);
3950321936Shselasky	*p_mad = *p_req_mad;
3951321936Shselasky	p_mad->status = status;
3952321936Shselasky	if (p_mad->method == IB_MAD_METHOD_SET)
3953321936Shselasky		p_mad->method = IB_MAD_METHOD_GET;
3954321936Shselasky	p_mad->method |= IB_MAD_METHOD_RESP_MASK;
3955321936Shselasky}
3956321936Shselasky
3957321936Shselasky/*
3958321936Shselasky* PARAMETERS
3959321936Shselasky*	p_req_mad
3960321936Shselasky*		[in] Pointer to the MAD common header in the original request MAD.
3961321936Shselasky*
3962321936Shselasky*	p_mad
3963321936Shselasky*		[in] Pointer to the MAD common header to initialize.
3964321936Shselasky*
3965321936Shselasky*	status
3966321936Shselasky*		[in] MAD Status value to return;
3967321936Shselasky*
3968321936Shselasky* RETURN VALUES
3969321936Shselasky*	None.
3970321936Shselasky*
3971321936Shselasky* NOTES
3972321936Shselasky*	p_req_mad and p_mad may point to the same MAD.
3973321936Shselasky*
3974321936Shselasky* SEE ALSO
3975321936Shselasky*	ib_mad_t
3976321936Shselasky*********/
3977321936Shselasky
3978321936Shselasky/****f* IBA Base: Types/ib_mad_is_response
3979321936Shselasky* NAME
3980321936Shselasky*	ib_mad_is_response
3981321936Shselasky*
3982321936Shselasky* DESCRIPTION
3983321936Shselasky*	Returns TRUE if the MAD is a response ('R' bit set)
3984321936Shselasky*	or if the MAD is a TRAP REPRESS,
3985321936Shselasky*	FALSE otherwise.
3986321936Shselasky*
3987321936Shselasky* SYNOPSIS
3988321936Shselasky*/
3989321936Shselaskystatic inline boolean_t OSM_API
3990321936Shselaskyib_mad_is_response(IN const ib_mad_t * const p_mad)
3991321936Shselasky{
3992321936Shselasky	CL_ASSERT(p_mad);
3993321936Shselasky	return (p_mad->method & IB_MAD_METHOD_RESP_MASK ||
3994321936Shselasky		p_mad->method == IB_MAD_METHOD_TRAP_REPRESS);
3995321936Shselasky}
3996321936Shselasky
3997321936Shselasky/*
3998321936Shselasky* PARAMETERS
3999321936Shselasky*	p_mad
4000321936Shselasky*		[in] Pointer to the MAD.
4001321936Shselasky*
4002321936Shselasky* RETURN VALUES
4003321936Shselasky*	Returns TRUE if the MAD is a response ('R' bit set),
4004321936Shselasky*	FALSE otherwise.
4005321936Shselasky*
4006321936Shselasky* NOTES
4007321936Shselasky*
4008321936Shselasky* SEE ALSO
4009321936Shselasky*	ib_mad_t
4010321936Shselasky*********/
4011321936Shselasky
4012321936Shselasky#define IB_RMPP_TYPE_DATA		1
4013321936Shselasky#define IB_RMPP_TYPE_ACK		2
4014321936Shselasky#define IB_RMPP_TYPE_STOP		3
4015321936Shselasky#define IB_RMPP_TYPE_ABORT		4
4016321936Shselasky
4017321936Shselasky#define IB_RMPP_NO_RESP_TIME		0x1F
4018321936Shselasky#define IB_RMPP_FLAG_ACTIVE		0x01
4019321936Shselasky#define IB_RMPP_FLAG_FIRST		0x02
4020321936Shselasky#define IB_RMPP_FLAG_LAST		0x04
4021321936Shselasky
4022321936Shselasky#define IB_RMPP_STATUS_SUCCESS		0
4023321936Shselasky#define IB_RMPP_STATUS_RESX		1	/* resources exhausted */
4024321936Shselasky#define IB_RMPP_STATUS_T2L		118	/* time too long */
4025321936Shselasky#define IB_RMPP_STATUS_BAD_LEN		119	/* incon. last and payload len */
4026321936Shselasky#define IB_RMPP_STATUS_BAD_SEG		120	/* incon. first and segment no */
4027321936Shselasky#define IB_RMPP_STATUS_BADT		121	/* bad rmpp type */
4028321936Shselasky#define IB_RMPP_STATUS_W2S		122	/* newwindowlast too small */
4029321936Shselasky#define IB_RMPP_STATUS_S2B		123	/* segment no too big */
4030321936Shselasky#define IB_RMPP_STATUS_BAD_STATUS	124	/* illegal status */
4031321936Shselasky#define IB_RMPP_STATUS_UNV		125	/* unsupported version */
4032321936Shselasky#define IB_RMPP_STATUS_TMR		126	/* too many retries */
4033321936Shselasky#define IB_RMPP_STATUS_UNSPEC		127	/* unspecified */
4034321936Shselasky
4035321936Shselasky/****f* IBA Base: Types/ib_rmpp_is_flag_set
4036321936Shselasky* NAME
4037321936Shselasky*	ib_rmpp_is_flag_set
4038321936Shselasky*
4039321936Shselasky* DESCRIPTION
4040321936Shselasky*	Returns TRUE if the MAD has the given RMPP flag set.
4041321936Shselasky*
4042321936Shselasky* SYNOPSIS
4043321936Shselasky*/
4044321936Shselaskystatic inline boolean_t OSM_API
4045321936Shselaskyib_rmpp_is_flag_set(IN const ib_rmpp_mad_t * const p_rmpp_mad,
4046321936Shselasky		    IN const uint8_t flag)
4047321936Shselasky{
4048321936Shselasky	CL_ASSERT(p_rmpp_mad);
4049321936Shselasky	return ((p_rmpp_mad->rmpp_flags & flag) == flag);
4050321936Shselasky}
4051321936Shselasky
4052321936Shselasky/*
4053321936Shselasky* PARAMETERS
4054321936Shselasky*	ib_rmpp_mad_t
4055321936Shselasky*		[in] Pointer to a MAD with an RMPP header.
4056321936Shselasky*
4057321936Shselasky*	flag
4058321936Shselasky*		[in] The RMPP flag being examined.
4059321936Shselasky*
4060321936Shselasky* RETURN VALUES
4061321936Shselasky*	Returns TRUE if the MAD has the given RMPP flag set.
4062321936Shselasky*
4063321936Shselasky* NOTES
4064321936Shselasky*
4065321936Shselasky* SEE ALSO
4066321936Shselasky*	ib_mad_t, ib_rmpp_mad_t
4067321936Shselasky*********/
4068321936Shselasky
4069321936Shselaskystatic inline void OSM_API
4070321936Shselaskyib_rmpp_set_resp_time(IN ib_rmpp_mad_t * const p_rmpp_mad,
4071321936Shselasky		      IN const uint8_t resp_time)
4072321936Shselasky{
4073321936Shselasky	CL_ASSERT(p_rmpp_mad);
4074321936Shselasky	p_rmpp_mad->rmpp_flags |= (resp_time << 3);
4075321936Shselasky}
4076321936Shselasky
4077321936Shselaskystatic inline uint8_t OSM_API
4078321936Shselaskyib_rmpp_get_resp_time(IN const ib_rmpp_mad_t * const p_rmpp_mad)
4079321936Shselasky{
4080321936Shselasky	CL_ASSERT(p_rmpp_mad);
4081321936Shselasky	return ((uint8_t) (p_rmpp_mad->rmpp_flags >> 3));
4082321936Shselasky}
4083321936Shselasky
4084321936Shselasky/****d* IBA Base: Constants/IB_SMP_DIRECTION
4085321936Shselasky* NAME
4086321936Shselasky*	IB_SMP_DIRECTION
4087321936Shselasky*
4088321936Shselasky* DESCRIPTION
4089321936Shselasky*	The Direction bit for directed route SMPs.
4090321936Shselasky*
4091321936Shselasky* SOURCE
4092321936Shselasky*/
4093321936Shselasky#define IB_SMP_DIRECTION_HO		0x8000
4094321936Shselasky#define IB_SMP_DIRECTION		(CL_HTON16(IB_SMP_DIRECTION_HO))
4095321936Shselasky/**********/
4096321936Shselasky
4097321936Shselasky/****d* IBA Base: Constants/IB_SMP_STATUS_MASK
4098321936Shselasky* NAME
4099321936Shselasky*	IB_SMP_STATUS_MASK
4100321936Shselasky*
4101321936Shselasky* DESCRIPTION
4102321936Shselasky*	Mask value for extracting status from a directed route SMP.
4103321936Shselasky*
4104321936Shselasky* SOURCE
4105321936Shselasky*/
4106321936Shselasky#define IB_SMP_STATUS_MASK_HO		0x7FFF
4107321936Shselasky#define IB_SMP_STATUS_MASK		(CL_HTON16(IB_SMP_STATUS_MASK_HO))
4108321936Shselasky/**********/
4109321936Shselasky
4110321936Shselasky/****s* IBA Base: Types/ib_smp_t
4111321936Shselasky* NAME
4112321936Shselasky*	ib_smp_t
4113321936Shselasky*
4114321936Shselasky* DESCRIPTION
4115321936Shselasky*	IBA defined SMP. (14.2.1.2)
4116321936Shselasky*
4117321936Shselasky* SYNOPSIS
4118321936Shselasky*/
4119321936Shselasky#define IB_SMP_DATA_SIZE 64
4120321936Shselasky#include <complib/cl_packon.h>
4121321936Shselaskytypedef struct _ib_smp {
4122321936Shselasky	uint8_t base_ver;
4123321936Shselasky	uint8_t mgmt_class;
4124321936Shselasky	uint8_t class_ver;
4125321936Shselasky	uint8_t method;
4126321936Shselasky	ib_net16_t status;
4127321936Shselasky	uint8_t hop_ptr;
4128321936Shselasky	uint8_t hop_count;
4129321936Shselasky	ib_net64_t trans_id;
4130321936Shselasky	ib_net16_t attr_id;
4131321936Shselasky	ib_net16_t resv;
4132321936Shselasky	ib_net32_t attr_mod;
4133321936Shselasky	ib_net64_t m_key;
4134321936Shselasky	ib_net16_t dr_slid;
4135321936Shselasky	ib_net16_t dr_dlid;
4136321936Shselasky	uint32_t resv1[7];
4137321936Shselasky	uint8_t data[IB_SMP_DATA_SIZE];
4138321936Shselasky	uint8_t initial_path[IB_SUBNET_PATH_HOPS_MAX];
4139321936Shselasky	uint8_t return_path[IB_SUBNET_PATH_HOPS_MAX];
4140321936Shselasky} PACK_SUFFIX ib_smp_t;
4141321936Shselasky#include <complib/cl_packoff.h>
4142321936Shselasky/*
4143321936Shselasky* FIELDS
4144321936Shselasky*	base_ver
4145321936Shselasky*		MAD base format.
4146321936Shselasky*
4147321936Shselasky*	mgmt_class
4148321936Shselasky*		Class of operation.
4149321936Shselasky*
4150321936Shselasky*	class_ver
4151321936Shselasky*		Version of MAD class-specific format.
4152321936Shselasky*
4153321936Shselasky*	method
4154321936Shselasky*		Method to perform, including 'R' bit.
4155321936Shselasky*
4156321936Shselasky*	status
4157321936Shselasky*		Status of operation.
4158321936Shselasky*
4159321936Shselasky*	hop_ptr
4160321936Shselasky*		Hop pointer for directed route MADs.
4161321936Shselasky*
4162321936Shselasky*	hop_count
4163321936Shselasky*		Hop count for directed route MADs.
4164321936Shselasky*
4165321936Shselasky*	trans_Id
4166321936Shselasky*		Transaction ID.
4167321936Shselasky*
4168321936Shselasky*	attr_id
4169321936Shselasky*		Attribute ID.
4170321936Shselasky*
4171321936Shselasky*	resv
4172321936Shselasky*		Reserved field.
4173321936Shselasky*
4174321936Shselasky*	attr_mod
4175321936Shselasky*		Attribute modifier.
4176321936Shselasky*
4177321936Shselasky*	m_key
4178321936Shselasky*		Management key value.
4179321936Shselasky*
4180321936Shselasky*	dr_slid
4181321936Shselasky*		Directed route source LID.
4182321936Shselasky*
4183321936Shselasky*	dr_dlid
4184321936Shselasky*		Directed route destination LID.
4185321936Shselasky*
4186321936Shselasky*	resv0
4187321936Shselasky*		Reserved for 64 byte alignment.
4188321936Shselasky*
4189321936Shselasky*	data
4190321936Shselasky*		MAD data payload.
4191321936Shselasky*
4192321936Shselasky*	initial_path
4193321936Shselasky*		Outbound port list.
4194321936Shselasky*
4195321936Shselasky*	return_path
4196321936Shselasky*		Inbound port list.
4197321936Shselasky*
4198321936Shselasky* SEE ALSO
4199321936Shselasky*********/
4200321936Shselasky
4201321936Shselasky/****f* IBA Base: Types/ib_smp_get_status
4202321936Shselasky* NAME
4203321936Shselasky*	ib_smp_get_status
4204321936Shselasky*
4205321936Shselasky* DESCRIPTION
4206321936Shselasky*	Returns the SMP status value in network order.
4207321936Shselasky*
4208321936Shselasky* SYNOPSIS
4209321936Shselasky*/
4210321936Shselaskystatic inline ib_net16_t OSM_API
4211321936Shselaskyib_smp_get_status(IN const ib_smp_t * const p_smp)
4212321936Shselasky{
4213321936Shselasky	return ((ib_net16_t) (p_smp->status & IB_SMP_STATUS_MASK));
4214321936Shselasky}
4215321936Shselasky
4216321936Shselasky/*
4217321936Shselasky* PARAMETERS
4218321936Shselasky*	p_smp
4219321936Shselasky*		[in] Pointer to the SMP packet.
4220321936Shselasky*
4221321936Shselasky* RETURN VALUES
4222321936Shselasky*	Returns the SMP status value in network order.
4223321936Shselasky*
4224321936Shselasky* NOTES
4225321936Shselasky*
4226321936Shselasky* SEE ALSO
4227321936Shselasky*	ib_smp_t
4228321936Shselasky*********/
4229321936Shselasky
4230321936Shselasky/****f* IBA Base: Types/ib_smp_is_response
4231321936Shselasky* NAME
4232321936Shselasky*	ib_smp_is_response
4233321936Shselasky*
4234321936Shselasky* DESCRIPTION
4235321936Shselasky*	Returns TRUE if the SMP is a response MAD, FALSE otherwise.
4236321936Shselasky*
4237321936Shselasky* SYNOPSIS
4238321936Shselasky*/
4239321936Shselaskystatic inline boolean_t OSM_API
4240321936Shselaskyib_smp_is_response(IN const ib_smp_t * const p_smp)
4241321936Shselasky{
4242321936Shselasky	return (ib_mad_is_response((const ib_mad_t *)p_smp));
4243321936Shselasky}
4244321936Shselasky
4245321936Shselasky/*
4246321936Shselasky* PARAMETERS
4247321936Shselasky*	p_smp
4248321936Shselasky*		[in] Pointer to the SMP packet.
4249321936Shselasky*
4250321936Shselasky* RETURN VALUES
4251321936Shselasky*	Returns TRUE if the SMP is a response MAD, FALSE otherwise.
4252321936Shselasky*
4253321936Shselasky* NOTES
4254321936Shselasky*
4255321936Shselasky* SEE ALSO
4256321936Shselasky*	ib_smp_t
4257321936Shselasky*********/
4258321936Shselasky
4259321936Shselasky/****f* IBA Base: Types/ib_smp_is_d
4260321936Shselasky* NAME
4261321936Shselasky*	ib_smp_is_d
4262321936Shselasky*
4263321936Shselasky* DESCRIPTION
4264321936Shselasky*	Returns TRUE if the SMP 'D' (direction) bit is set.
4265321936Shselasky*
4266321936Shselasky* SYNOPSIS
4267321936Shselasky*/
4268321936Shselaskystatic inline boolean_t OSM_API ib_smp_is_d(IN const ib_smp_t * const p_smp)
4269321936Shselasky{
4270321936Shselasky	return ((p_smp->status & IB_SMP_DIRECTION) == IB_SMP_DIRECTION);
4271321936Shselasky}
4272321936Shselasky
4273321936Shselasky/*
4274321936Shselasky* PARAMETERS
4275321936Shselasky*	p_smp
4276321936Shselasky*		[in] Pointer to the SMP packet.
4277321936Shselasky*
4278321936Shselasky* RETURN VALUES
4279321936Shselasky*	Returns TRUE if the SMP 'D' (direction) bit is set.
4280321936Shselasky*
4281321936Shselasky* NOTES
4282321936Shselasky*
4283321936Shselasky* SEE ALSO
4284321936Shselasky*	ib_smp_t
4285321936Shselasky*********/
4286321936Shselasky
4287321936Shselasky/****f* IBA Base: Types/ib_smp_init_new
4288321936Shselasky* NAME
4289321936Shselasky*	ib_smp_init_new
4290321936Shselasky*
4291321936Shselasky* DESCRIPTION
4292321936Shselasky*	Initializes a MAD common header.
4293321936Shselasky*
4294321936Shselasky* TODO
4295321936Shselasky*	This is too big for inlining, but leave it here for now
4296321936Shselasky*	since there is not yet another convenient spot.
4297321936Shselasky*
4298321936Shselasky* SYNOPSIS
4299321936Shselasky*/
4300321936Shselaskystatic inline void OSM_API
4301321936Shselaskyib_smp_init_new(IN ib_smp_t * const p_smp,
4302321936Shselasky		IN const uint8_t method,
4303321936Shselasky		IN const ib_net64_t trans_id,
4304321936Shselasky		IN const ib_net16_t attr_id,
4305321936Shselasky		IN const ib_net32_t attr_mod,
4306321936Shselasky		IN const uint8_t hop_count,
4307321936Shselasky		IN const ib_net64_t m_key,
4308321936Shselasky		IN const uint8_t * path_out,
4309321936Shselasky		IN const ib_net16_t dr_slid, IN const ib_net16_t dr_dlid)
4310321936Shselasky{
4311321936Shselasky	CL_ASSERT(p_smp);
4312321936Shselasky	CL_ASSERT(hop_count < IB_SUBNET_PATH_HOPS_MAX);
4313321936Shselasky	p_smp->base_ver = 1;
4314321936Shselasky	p_smp->mgmt_class = IB_MCLASS_SUBN_DIR;
4315321936Shselasky	p_smp->class_ver = 1;
4316321936Shselasky	p_smp->method = method;
4317321936Shselasky	p_smp->status = 0;
4318321936Shselasky	p_smp->hop_ptr = 0;
4319321936Shselasky	p_smp->hop_count = hop_count;
4320321936Shselasky	p_smp->trans_id = trans_id;
4321321936Shselasky	p_smp->attr_id = attr_id;
4322321936Shselasky	p_smp->resv = 0;
4323321936Shselasky	p_smp->attr_mod = attr_mod;
4324321936Shselasky	p_smp->m_key = m_key;
4325321936Shselasky	p_smp->dr_slid = dr_slid;
4326321936Shselasky	p_smp->dr_dlid = dr_dlid;
4327321936Shselasky
4328321936Shselasky	memset(p_smp->resv1, 0,
4329321936Shselasky	       sizeof(p_smp->resv1) +
4330321936Shselasky	       sizeof(p_smp->data) +
4331321936Shselasky	       sizeof(p_smp->initial_path) + sizeof(p_smp->return_path));
4332321936Shselasky
4333321936Shselasky	/* copy the path */
4334321936Shselasky	memcpy(&p_smp->initial_path, path_out, sizeof(p_smp->initial_path));
4335321936Shselasky}
4336321936Shselasky
4337321936Shselasky/*
4338321936Shselasky* PARAMETERS
4339321936Shselasky*	p_smp
4340321936Shselasky*		[in] Pointer to the SMP packet.
4341321936Shselasky*
4342321936Shselasky*	method
4343321936Shselasky*		[in] Method to perform, including 'R' bit.
4344321936Shselasky*
4345321936Shselasky*	trans_Id
4346321936Shselasky*		[in] Transaction ID.
4347321936Shselasky*
4348321936Shselasky*	attr_id
4349321936Shselasky*		[in] Attribute ID.
4350321936Shselasky*
4351321936Shselasky*	attr_mod
4352321936Shselasky*		[in] Attribute modifier.
4353321936Shselasky*
4354321936Shselasky*	hop_count
4355321936Shselasky*		[in] Number of hops in the path.
4356321936Shselasky*
4357321936Shselasky*	m_key
4358321936Shselasky*		[in] Management key for this SMP.
4359321936Shselasky*
4360321936Shselasky*	path_out
4361321936Shselasky*		[in] Port array for outbound path.
4362321936Shselasky*
4363321936Shselasky*
4364321936Shselasky* RETURN VALUES
4365321936Shselasky*	None.
4366321936Shselasky*
4367321936Shselasky* NOTES
4368321936Shselasky*	Payload area is initialized to zero.
4369321936Shselasky*
4370321936Shselasky*
4371321936Shselasky* SEE ALSO
4372321936Shselasky*	ib_mad_t
4373321936Shselasky*********/
4374321936Shselasky
4375321936Shselasky/****f* IBA Base: Types/ib_smp_get_payload_ptr
4376321936Shselasky* NAME
4377321936Shselasky*	ib_smp_get_payload_ptr
4378321936Shselasky*
4379321936Shselasky* DESCRIPTION
4380321936Shselasky*	Gets a pointer to the SMP payload area.
4381321936Shselasky*
4382321936Shselasky* SYNOPSIS
4383321936Shselasky*/
4384321936Shselaskystatic inline void *OSM_API
4385321936Shselaskyib_smp_get_payload_ptr(IN const ib_smp_t * const p_smp)
4386321936Shselasky{
4387321936Shselasky	return ((void *)p_smp->data);
4388321936Shselasky}
4389321936Shselasky
4390321936Shselasky/*
4391321936Shselasky* PARAMETERS
4392321936Shselasky*	p_smp
4393321936Shselasky*		[in] Pointer to the SMP packet.
4394321936Shselasky*
4395321936Shselasky* RETURN VALUES
4396321936Shselasky*	Pointer to SMP payload area.
4397321936Shselasky*
4398321936Shselasky* NOTES
4399321936Shselasky*
4400321936Shselasky* SEE ALSO
4401321936Shselasky*	ib_mad_t
4402321936Shselasky*********/
4403321936Shselasky
4404321936Shselasky/****s* IBA Base: Types/ib_node_info_t
4405321936Shselasky* NAME
4406321936Shselasky*	ib_node_info_t
4407321936Shselasky*
4408321936Shselasky* DESCRIPTION
4409321936Shselasky*	IBA defined NodeInfo. (14.2.5.3)
4410321936Shselasky*
4411321936Shselasky* SYNOPSIS
4412321936Shselasky*/
4413321936Shselasky#include <complib/cl_packon.h>
4414321936Shselaskytypedef struct _ib_node_info {
4415321936Shselasky	uint8_t base_version;
4416321936Shselasky	uint8_t class_version;
4417321936Shselasky	uint8_t node_type;
4418321936Shselasky	uint8_t num_ports;
4419321936Shselasky	ib_net64_t sys_guid;
4420321936Shselasky	ib_net64_t node_guid;
4421321936Shselasky	ib_net64_t port_guid;
4422321936Shselasky	ib_net16_t partition_cap;
4423321936Shselasky	ib_net16_t device_id;
4424321936Shselasky	ib_net32_t revision;
4425321936Shselasky	ib_net32_t port_num_vendor_id;
4426321936Shselasky} PACK_SUFFIX ib_node_info_t;
4427321936Shselasky#include <complib/cl_packoff.h>
4428321936Shselasky/************/
4429321936Shselasky
4430321936Shselasky/****s* IBA Base: Types/ib_sa_mad_t
4431321936Shselasky* NAME
4432321936Shselasky*	ib_sa_mad_t
4433321936Shselasky*
4434321936Shselasky* DESCRIPTION
4435321936Shselasky*	IBA defined SA MAD format. (15.2.1)
4436321936Shselasky*
4437321936Shselasky* SYNOPSIS
4438321936Shselasky*/
4439321936Shselasky#define IB_SA_DATA_SIZE 200
4440321936Shselasky
4441321936Shselasky#include <complib/cl_packon.h>
4442321936Shselaskytypedef struct _ib_sa_mad {
4443321936Shselasky	uint8_t base_ver;
4444321936Shselasky	uint8_t mgmt_class;
4445321936Shselasky	uint8_t class_ver;
4446321936Shselasky	uint8_t method;
4447321936Shselasky	ib_net16_t status;
4448321936Shselasky	ib_net16_t resv;
4449321936Shselasky	ib_net64_t trans_id;
4450321936Shselasky	ib_net16_t attr_id;
4451321936Shselasky	ib_net16_t resv1;
4452321936Shselasky	ib_net32_t attr_mod;
4453321936Shselasky	uint8_t rmpp_version;
4454321936Shselasky	uint8_t rmpp_type;
4455321936Shselasky	uint8_t rmpp_flags;
4456321936Shselasky	uint8_t rmpp_status;
4457321936Shselasky	ib_net32_t seg_num;
4458321936Shselasky	ib_net32_t paylen_newwin;
4459321936Shselasky	ib_net64_t sm_key;
4460321936Shselasky	ib_net16_t attr_offset;
4461321936Shselasky	ib_net16_t resv3;
4462321936Shselasky	ib_net64_t comp_mask;
4463321936Shselasky	uint8_t data[IB_SA_DATA_SIZE];
4464321936Shselasky} PACK_SUFFIX ib_sa_mad_t;
4465321936Shselasky#include <complib/cl_packoff.h>
4466321936Shselasky/**********/
4467321936Shselasky#define IB_SA_MAD_HDR_SIZE (sizeof(ib_sa_mad_t) - IB_SA_DATA_SIZE)
4468321936Shselasky
4469321936Shselaskystatic inline uint32_t OSM_API ib_get_attr_size(IN const ib_net16_t attr_offset)
4470321936Shselasky{
4471321936Shselasky	return (((uint32_t) cl_ntoh16(attr_offset)) << 3);
4472321936Shselasky}
4473321936Shselasky
4474321936Shselaskystatic inline ib_net16_t OSM_API ib_get_attr_offset(IN const uint32_t attr_size)
4475321936Shselasky{
4476321936Shselasky	return (cl_hton16((uint16_t) (attr_size >> 3)));
4477321936Shselasky}
4478321936Shselasky
4479321936Shselasky/****f* IBA Base: Types/ib_sa_mad_get_payload_ptr
4480321936Shselasky* NAME
4481321936Shselasky*	ib_sa_mad_get_payload_ptr
4482321936Shselasky*
4483321936Shselasky* DESCRIPTION
4484321936Shselasky*	Gets a pointer to the SA MAD's payload area.
4485321936Shselasky*
4486321936Shselasky* SYNOPSIS
4487321936Shselasky*/
4488321936Shselaskystatic inline void *OSM_API
4489321936Shselaskyib_sa_mad_get_payload_ptr(IN const ib_sa_mad_t * const p_sa_mad)
4490321936Shselasky{
4491321936Shselasky	return ((void *)p_sa_mad->data);
4492321936Shselasky}
4493321936Shselasky
4494321936Shselasky/*
4495321936Shselasky* PARAMETERS
4496321936Shselasky*	p_sa_mad
4497321936Shselasky*		[in] Pointer to the SA MAD packet.
4498321936Shselasky*
4499321936Shselasky* RETURN VALUES
4500321936Shselasky*	Pointer to SA MAD payload area.
4501321936Shselasky*
4502321936Shselasky* NOTES
4503321936Shselasky*
4504321936Shselasky* SEE ALSO
4505321936Shselasky*	ib_mad_t
4506321936Shselasky*********/
4507321936Shselasky
4508321936Shselasky#define IB_NODE_INFO_PORT_NUM_MASK		(CL_HTON32(0xFF000000))
4509321936Shselasky#define IB_NODE_INFO_VEND_ID_MASK		(CL_HTON32(0x00FFFFFF))
4510321936Shselasky#if CPU_LE
4511321936Shselasky#define IB_NODE_INFO_PORT_NUM_SHIFT 0
4512321936Shselasky#else
4513321936Shselasky#define IB_NODE_INFO_PORT_NUM_SHIFT 24
4514321936Shselasky#endif
4515321936Shselasky
4516321936Shselasky/****f* IBA Base: Types/ib_node_info_get_local_port_num
4517321936Shselasky* NAME
4518321936Shselasky*	ib_node_info_get_local_port_num
4519321936Shselasky*
4520321936Shselasky* DESCRIPTION
4521321936Shselasky*	Gets the local port number from the NodeInfo attribute.
4522321936Shselasky*
4523321936Shselasky* SYNOPSIS
4524321936Shselasky*/
4525321936Shselaskystatic inline uint8_t OSM_API
4526321936Shselaskyib_node_info_get_local_port_num(IN const ib_node_info_t * const p_ni)
4527321936Shselasky{
4528321936Shselasky	return ((uint8_t) ((p_ni->port_num_vendor_id &
4529321936Shselasky			    IB_NODE_INFO_PORT_NUM_MASK)
4530321936Shselasky			   >> IB_NODE_INFO_PORT_NUM_SHIFT));
4531321936Shselasky}
4532321936Shselasky
4533321936Shselasky/*
4534321936Shselasky* PARAMETERS
4535321936Shselasky*	p_ni
4536321936Shselasky*		[in] Pointer to a NodeInfo attribute.
4537321936Shselasky*
4538321936Shselasky* RETURN VALUES
4539321936Shselasky*	Local port number that returned the attribute.
4540321936Shselasky*
4541321936Shselasky* NOTES
4542321936Shselasky*
4543321936Shselasky* SEE ALSO
4544321936Shselasky*	ib_node_info_t
4545321936Shselasky*********/
4546321936Shselasky
4547321936Shselasky/****f* IBA Base: Types/ib_node_info_get_vendor_id
4548321936Shselasky* NAME
4549321936Shselasky*	ib_node_info_get_vendor_id
4550321936Shselasky*
4551321936Shselasky* DESCRIPTION
4552321936Shselasky*	Gets the VendorID from the NodeInfo attribute.
4553321936Shselasky*
4554321936Shselasky* SYNOPSIS
4555321936Shselasky*/
4556321936Shselaskystatic inline ib_net32_t OSM_API
4557321936Shselaskyib_node_info_get_vendor_id(IN const ib_node_info_t * const p_ni)
4558321936Shselasky{
4559321936Shselasky	return ((ib_net32_t) (p_ni->port_num_vendor_id &
4560321936Shselasky			      IB_NODE_INFO_VEND_ID_MASK));
4561321936Shselasky}
4562321936Shselasky
4563321936Shselasky/*
4564321936Shselasky* PARAMETERS
4565321936Shselasky*	p_ni
4566321936Shselasky*		[in] Pointer to a NodeInfo attribute.
4567321936Shselasky*
4568321936Shselasky* RETURN VALUES
4569321936Shselasky*	VendorID that returned the attribute.
4570321936Shselasky*
4571321936Shselasky* NOTES
4572321936Shselasky*
4573321936Shselasky* SEE ALSO
4574321936Shselasky*	ib_node_info_t
4575321936Shselasky*********/
4576321936Shselasky
4577321936Shselasky#define IB_NODE_DESCRIPTION_SIZE 64
4578321936Shselasky
4579321936Shselasky#include <complib/cl_packon.h>
4580321936Shselaskytypedef struct _ib_node_desc {
4581321936Shselasky	// Node String is an array of UTF-8 characters
4582321936Shselasky	// that describe the node in text format
4583321936Shselasky	// Note that this string is NOT NULL TERMINATED!
4584321936Shselasky	uint8_t description[IB_NODE_DESCRIPTION_SIZE];
4585321936Shselasky} PACK_SUFFIX ib_node_desc_t;
4586321936Shselasky#include <complib/cl_packoff.h>
4587321936Shselasky
4588321936Shselasky#include <complib/cl_packon.h>
4589321936Shselaskytypedef struct _ib_node_record_t {
4590321936Shselasky	ib_net16_t lid;
4591321936Shselasky	ib_net16_t resv;
4592321936Shselasky	ib_node_info_t node_info;
4593321936Shselasky	ib_node_desc_t node_desc;
4594321936Shselasky	uint8_t pad[4];
4595321936Shselasky} PACK_SUFFIX ib_node_record_t;
4596321936Shselasky#include <complib/cl_packoff.h>
4597321936Shselasky
4598321936Shselasky/****s* IBA Base: Types/ib_port_info_t
4599321936Shselasky* NAME
4600321936Shselasky*	ib_port_info_t
4601321936Shselasky*
4602321936Shselasky* DESCRIPTION
4603321936Shselasky*	IBA defined PortInfo. (14.2.5.6)
4604321936Shselasky*
4605321936Shselasky* SYNOPSIS
4606321936Shselasky*/
4607321936Shselasky#include <complib/cl_packon.h>
4608321936Shselaskytypedef struct _ib_port_info {
4609321936Shselasky	ib_net64_t m_key;
4610321936Shselasky	ib_net64_t subnet_prefix;
4611321936Shselasky	ib_net16_t base_lid;
4612321936Shselasky	ib_net16_t master_sm_base_lid;
4613321936Shselasky	ib_net32_t capability_mask;
4614321936Shselasky	ib_net16_t diag_code;
4615321936Shselasky	ib_net16_t m_key_lease_period;
4616321936Shselasky	uint8_t local_port_num;
4617321936Shselasky	uint8_t link_width_enabled;
4618321936Shselasky	uint8_t link_width_supported;
4619321936Shselasky	uint8_t link_width_active;
4620321936Shselasky	uint8_t state_info1;	/* LinkSpeedSupported and PortState */
4621321936Shselasky	uint8_t state_info2;	/* PortPhysState and LinkDownDefaultState */
4622321936Shselasky	uint8_t mkey_lmc;	/* M_KeyProtectBits and LMC */
4623321936Shselasky	uint8_t link_speed;	/* LinkSpeedEnabled and LinkSpeedActive */
4624321936Shselasky	uint8_t mtu_smsl;
4625321936Shselasky	uint8_t vl_cap;		/* VLCap and InitType */
4626321936Shselasky	uint8_t vl_high_limit;
4627321936Shselasky	uint8_t vl_arb_high_cap;
4628321936Shselasky	uint8_t vl_arb_low_cap;
4629321936Shselasky	uint8_t mtu_cap;
4630321936Shselasky	uint8_t vl_stall_life;
4631321936Shselasky	uint8_t vl_enforce;
4632321936Shselasky	ib_net16_t m_key_violations;
4633321936Shselasky	ib_net16_t p_key_violations;
4634321936Shselasky	ib_net16_t q_key_violations;
4635321936Shselasky	uint8_t guid_cap;
4636321936Shselasky	uint8_t subnet_timeout;	/* cli_rereg(1b), mcast_pkey_trap_suppr(1b), reserv(1b), timeout(5b) */
4637321936Shselasky	uint8_t resp_time_value; /* reserv(3b), rtv(5b) */
4638321936Shselasky	uint8_t error_threshold; /* local phy errors(4b), overrun errors(4b) */
4639321936Shselasky	ib_net16_t max_credit_hint;
4640321936Shselasky	ib_net32_t link_rt_latency; /* reserv(8b), link round trip lat(24b) */
4641321936Shselasky	ib_net16_t capability_mask2;
4642321936Shselasky	uint8_t link_speed_ext;	/* LinkSpeedExtActive and LinkSpeedExtSupported */
4643321936Shselasky	uint8_t link_speed_ext_enabled; /* reserv(3b), LinkSpeedExtEnabled(5b) */
4644321936Shselasky} PACK_SUFFIX ib_port_info_t;
4645321936Shselasky#include <complib/cl_packoff.h>
4646321936Shselasky/************/
4647321936Shselasky
4648321936Shselasky#define IB_PORT_STATE_MASK			0x0F
4649321936Shselasky#define IB_PORT_LMC_MASK			0x07
4650321936Shselasky#define IB_PORT_LMC_MAX				0x07
4651321936Shselasky#define IB_PORT_MPB_MASK			0xC0
4652321936Shselasky#define IB_PORT_MPB_SHIFT			6
4653321936Shselasky#define IB_PORT_LINK_SPEED_SHIFT		4
4654321936Shselasky#define IB_PORT_LINK_SPEED_SUPPORTED_MASK	0xF0
4655321936Shselasky#define IB_PORT_LINK_SPEED_ACTIVE_MASK		0xF0
4656321936Shselasky#define IB_PORT_LINK_SPEED_ENABLED_MASK		0x0F
4657321936Shselasky#define IB_PORT_PHYS_STATE_MASK			0xF0
4658321936Shselasky#define IB_PORT_PHYS_STATE_SHIFT		4
4659321936Shselasky#define IB_PORT_PHYS_STATE_NO_CHANGE		0
4660321936Shselasky#define IB_PORT_PHYS_STATE_SLEEP		1
4661321936Shselasky#define IB_PORT_PHYS_STATE_POLLING		2
4662321936Shselasky#define IB_PORT_PHYS_STATE_DISABLED		3
4663321936Shselasky#define IB_PORT_PHYS_STATE_PORTCONFTRAIN	4
4664321936Shselasky#define IB_PORT_PHYS_STATE_LINKUP	        5
4665321936Shselasky#define IB_PORT_PHYS_STATE_LINKERRRECOVER	6
4666321936Shselasky#define IB_PORT_PHYS_STATE_PHYTEST	        7
4667321936Shselasky#define IB_PORT_LNKDWNDFTSTATE_MASK		0x0F
4668321936Shselasky
4669321936Shselasky#define IB_PORT_CAP_RESV0         (CL_HTON32(0x00000001))
4670321936Shselasky#define IB_PORT_CAP_IS_SM         (CL_HTON32(0x00000002))
4671321936Shselasky#define IB_PORT_CAP_HAS_NOTICE    (CL_HTON32(0x00000004))
4672321936Shselasky#define IB_PORT_CAP_HAS_TRAP      (CL_HTON32(0x00000008))
4673321936Shselasky#define IB_PORT_CAP_HAS_IPD       (CL_HTON32(0x00000010))
4674321936Shselasky#define IB_PORT_CAP_HAS_AUTO_MIG  (CL_HTON32(0x00000020))
4675321936Shselasky#define IB_PORT_CAP_HAS_SL_MAP    (CL_HTON32(0x00000040))
4676321936Shselasky#define IB_PORT_CAP_HAS_NV_MKEY   (CL_HTON32(0x00000080))
4677321936Shselasky#define IB_PORT_CAP_HAS_NV_PKEY   (CL_HTON32(0x00000100))
4678321936Shselasky#define IB_PORT_CAP_HAS_LED_INFO  (CL_HTON32(0x00000200))
4679321936Shselasky#define IB_PORT_CAP_SM_DISAB      (CL_HTON32(0x00000400))
4680321936Shselasky#define IB_PORT_CAP_HAS_SYS_IMG_GUID  (CL_HTON32(0x00000800))
4681321936Shselasky#define IB_PORT_CAP_HAS_PKEY_SW_EXT_PORT_TRAP (CL_HTON32(0x00001000))
4682321936Shselasky#define IB_PORT_CAP_HAS_CABLE_INFO  (CL_HTON32(0x00002000))
4683321936Shselasky#define IB_PORT_CAP_HAS_EXT_SPEEDS  (CL_HTON32(0x00004000))
4684321936Shselasky#define IB_PORT_CAP_HAS_CAP_MASK2 (CL_HTON32(0x00008000))
4685321936Shselasky#define IB_PORT_CAP_HAS_COM_MGT   (CL_HTON32(0x00010000))
4686321936Shselasky#define IB_PORT_CAP_HAS_SNMP      (CL_HTON32(0x00020000))
4687321936Shselasky#define IB_PORT_CAP_REINIT        (CL_HTON32(0x00040000))
4688321936Shselasky#define IB_PORT_CAP_HAS_DEV_MGT   (CL_HTON32(0x00080000))
4689321936Shselasky#define IB_PORT_CAP_HAS_VEND_CLS  (CL_HTON32(0x00100000))
4690321936Shselasky#define IB_PORT_CAP_HAS_DR_NTC    (CL_HTON32(0x00200000))
4691321936Shselasky#define IB_PORT_CAP_HAS_CAP_NTC   (CL_HTON32(0x00400000))
4692321936Shselasky#define IB_PORT_CAP_HAS_BM        (CL_HTON32(0x00800000))
4693321936Shselasky#define IB_PORT_CAP_HAS_LINK_RT_LATENCY (CL_HTON32(0x01000000))
4694321936Shselasky#define IB_PORT_CAP_HAS_CLIENT_REREG (CL_HTON32(0x02000000))
4695321936Shselasky#define IB_PORT_CAP_HAS_OTHER_LOCAL_CHANGES_NTC (CL_HTON32(0x04000000))
4696321936Shselasky#define IB_PORT_CAP_HAS_LINK_SPEED_WIDTH_PAIRS_TBL (CL_HTON32(0x08000000))
4697321936Shselasky#define IB_PORT_CAP_HAS_VEND_MADS (CL_HTON32(0x10000000))
4698321936Shselasky#define IB_PORT_CAP_HAS_MCAST_PKEY_TRAP_SUPPRESS (CL_HTON32(0x20000000))
4699321936Shselasky#define IB_PORT_CAP_HAS_MCAST_FDB_TOP (CL_HTON32(0x40000000))
4700321936Shselasky#define IB_PORT_CAP_HAS_HIER_INFO (CL_HTON32(0x80000000))
4701321936Shselasky
4702321936Shselasky#define IB_PORT_CAP2_IS_SET_NODE_DESC_SUPPORTED (CL_HTON16(0x0001))
4703321936Shselasky#define IB_PORT_CAP2_IS_PORT_INFO_EXT_SUPPORTED (CL_HTON16(0x0002))
4704321936Shselasky#define IB_PORT_CAP2_IS_VIRT_SUPPORTED (CL_HTON16(0x0004))
4705321936Shselasky#define IB_PORT_CAP2_IS_SWITCH_PORT_STATE_TBL_SUPP (CL_HTON16(0x0008))
4706321936Shselasky#define IB_PORT_CAP2_IS_LINK_WIDTH_2X_SUPPORTED (CL_HTON16(0x0010))
4707321936Shselasky
4708321936Shselasky/****s* IBA Base: Types/ib_port_info_ext_t
4709321936Shselasky* NAME
4710321936Shselasky*	ib_port_info_ext_t
4711321936Shselasky*
4712321936Shselasky* DESCRIPTION
4713321936Shselasky*	IBA defined PortInfoExtended. (14.2.5.19)
4714321936Shselasky*
4715321936Shselasky* SYNOPSIS
4716321936Shselasky*/
4717321936Shselasky#include <complib/cl_packon.h>
4718321936Shselaskytypedef struct _ib_port_info_ext {
4719321936Shselasky	ib_net32_t cap_mask;
4720321936Shselasky	ib_net16_t fec_mode_active;
4721321936Shselasky	ib_net16_t fdr_fec_mode_sup;
4722321936Shselasky	ib_net16_t fdr_fec_mode_enable;
4723321936Shselasky	ib_net16_t edr_fec_mode_sup;
4724321936Shselasky	ib_net16_t edr_fec_mode_enable;
4725321936Shselasky	uint8_t reserved[50];
4726321936Shselasky} PACK_SUFFIX ib_port_info_ext_t;
4727321936Shselasky#include <complib/cl_packoff.h>
4728321936Shselasky/************/
4729321936Shselasky
4730321936Shselasky#define IB_PORT_EXT_NO_FEC_MODE_ACTIVE		    0
4731321936Shselasky#define IB_PORT_EXT_FIRE_CODE_FEC_MODE_ACTIVE	    (CL_HTON16(0x0001))
4732321936Shselasky#define IB_PORT_EXT_RS_FEC_MODE_ACTIVE		    (CL_HTON16(0x0002))
4733321936Shselasky#define IB_PORT_EXT_LOW_LATENCY_RS_FEC_MODE_ACTIVE  (CL_HTON16(0x0003))
4734321936Shselasky
4735321936Shselasky#define IB_PORT_EXT_CAP_IS_FEC_MODE_SUPPORTED (CL_HTON32(0x00000001))
4736321936Shselasky/****f* IBA Base: Types/ib_port_info_get_port_state
4737321936Shselasky* NAME
4738321936Shselasky*	ib_port_info_get_port_state
4739321936Shselasky*
4740321936Shselasky* DESCRIPTION
4741321936Shselasky*	Returns the port state.
4742321936Shselasky*
4743321936Shselasky* SYNOPSIS
4744321936Shselasky*/
4745321936Shselaskystatic inline uint8_t OSM_API
4746321936Shselaskyib_port_info_get_port_state(IN const ib_port_info_t * const p_pi)
4747321936Shselasky{
4748321936Shselasky	return ((uint8_t) (p_pi->state_info1 & IB_PORT_STATE_MASK));
4749321936Shselasky}
4750321936Shselasky
4751321936Shselasky/*
4752321936Shselasky* PARAMETERS
4753321936Shselasky*	p_pi
4754321936Shselasky*		[in] Pointer to a PortInfo attribute.
4755321936Shselasky*
4756321936Shselasky* RETURN VALUES
4757321936Shselasky*	Port state.
4758321936Shselasky*
4759321936Shselasky* NOTES
4760321936Shselasky*
4761321936Shselasky* SEE ALSO
4762321936Shselasky*********/
4763321936Shselasky
4764321936Shselasky/****f* IBA Base: Types/ib_port_info_set_port_state
4765321936Shselasky* NAME
4766321936Shselasky*	ib_port_info_set_port_state
4767321936Shselasky*
4768321936Shselasky* DESCRIPTION
4769321936Shselasky*	Sets the port state.
4770321936Shselasky*
4771321936Shselasky* SYNOPSIS
4772321936Shselasky*/
4773321936Shselaskystatic inline void OSM_API
4774321936Shselaskyib_port_info_set_port_state(IN ib_port_info_t * const p_pi,
4775321936Shselasky			    IN const uint8_t port_state)
4776321936Shselasky{
4777321936Shselasky	p_pi->state_info1 = (uint8_t) ((p_pi->state_info1 & 0xF0) | port_state);
4778321936Shselasky}
4779321936Shselasky
4780321936Shselasky/*
4781321936Shselasky* PARAMETERS
4782321936Shselasky*	p_pi
4783321936Shselasky*		[in] Pointer to a PortInfo attribute.
4784321936Shselasky*
4785321936Shselasky*	port_state
4786321936Shselasky*		[in] Port state value to set.
4787321936Shselasky*
4788321936Shselasky* RETURN VALUES
4789321936Shselasky*	None.
4790321936Shselasky*
4791321936Shselasky* NOTES
4792321936Shselasky*
4793321936Shselasky* SEE ALSO
4794321936Shselasky*********/
4795321936Shselasky
4796321936Shselasky/****f* IBA Base: Types/ib_port_info_get_vl_cap
4797321936Shselasky* NAME
4798321936Shselasky*	ib_port_info_get_vl_cap
4799321936Shselasky*
4800321936Shselasky* DESCRIPTION
4801321936Shselasky*	Gets the VL Capability of a port.
4802321936Shselasky*
4803321936Shselasky* SYNOPSIS
4804321936Shselasky*/
4805321936Shselaskystatic inline uint8_t OSM_API
4806321936Shselaskyib_port_info_get_vl_cap(IN const ib_port_info_t * const p_pi)
4807321936Shselasky{
4808321936Shselasky	return ((p_pi->vl_cap >> 4) & 0x0F);
4809321936Shselasky}
4810321936Shselasky
4811321936Shselasky/*
4812321936Shselasky* PARAMETERS
4813321936Shselasky*	p_pi
4814321936Shselasky*		[in] Pointer to a PortInfo attribute.
4815321936Shselasky*
4816321936Shselasky* RETURN VALUES
4817321936Shselasky*	VL_CAP field
4818321936Shselasky*
4819321936Shselasky* NOTES
4820321936Shselasky*
4821321936Shselasky* SEE ALSO
4822321936Shselasky*********/
4823321936Shselasky
4824321936Shselasky/****f* IBA Base: Types/ib_port_info_get_init_type
4825321936Shselasky* NAME
4826321936Shselasky*	ib_port_info_get_init_type
4827321936Shselasky*
4828321936Shselasky* DESCRIPTION
4829321936Shselasky*	Gets the init type of a port.
4830321936Shselasky*
4831321936Shselasky* SYNOPSIS
4832321936Shselasky*/
4833321936Shselaskystatic inline uint8_t OSM_API
4834321936Shselaskyib_port_info_get_init_type(IN const ib_port_info_t * const p_pi)
4835321936Shselasky{
4836321936Shselasky	return (uint8_t) (p_pi->vl_cap & 0x0F);
4837321936Shselasky}
4838321936Shselasky
4839321936Shselasky/*
4840321936Shselasky* PARAMETERS
4841321936Shselasky*	p_pi
4842321936Shselasky*		[in] Pointer to a PortInfo attribute.
4843321936Shselasky*
4844321936Shselasky* RETURN VALUES
4845321936Shselasky*	InitType field
4846321936Shselasky*
4847321936Shselasky* NOTES
4848321936Shselasky*
4849321936Shselasky* SEE ALSO
4850321936Shselasky*********/
4851321936Shselasky
4852321936Shselasky/****f* IBA Base: Types/ib_port_info_get_op_vls
4853321936Shselasky* NAME
4854321936Shselasky*	ib_port_info_get_op_vls
4855321936Shselasky*
4856321936Shselasky* DESCRIPTION
4857321936Shselasky*	Gets the operational VLs on a port.
4858321936Shselasky*
4859321936Shselasky* SYNOPSIS
4860321936Shselasky*/
4861321936Shselaskystatic inline uint8_t OSM_API
4862321936Shselaskyib_port_info_get_op_vls(IN const ib_port_info_t * const p_pi)
4863321936Shselasky{
4864321936Shselasky	return ((p_pi->vl_enforce >> 4) & 0x0F);
4865321936Shselasky}
4866321936Shselasky
4867321936Shselasky/*
4868321936Shselasky* PARAMETERS
4869321936Shselasky*	p_pi
4870321936Shselasky*		[in] Pointer to a PortInfo attribute.
4871321936Shselasky*
4872321936Shselasky* RETURN VALUES
4873321936Shselasky*	OP_VLS field
4874321936Shselasky*
4875321936Shselasky* NOTES
4876321936Shselasky*
4877321936Shselasky* SEE ALSO
4878321936Shselasky*********/
4879321936Shselasky
4880321936Shselasky/****f* IBA Base: Types/ib_port_info_set_op_vls
4881321936Shselasky* NAME
4882321936Shselasky*	ib_port_info_set_op_vls
4883321936Shselasky*
4884321936Shselasky* DESCRIPTION
4885321936Shselasky*	Sets the operational VLs on a port.
4886321936Shselasky*
4887321936Shselasky* SYNOPSIS
4888321936Shselasky*/
4889321936Shselaskystatic inline void OSM_API
4890321936Shselaskyib_port_info_set_op_vls(IN ib_port_info_t * const p_pi, IN const uint8_t op_vls)
4891321936Shselasky{
4892321936Shselasky	p_pi->vl_enforce =
4893321936Shselasky	    (uint8_t) ((p_pi->vl_enforce & 0x0F) | (op_vls << 4));
4894321936Shselasky}
4895321936Shselasky
4896321936Shselasky/*
4897321936Shselasky* PARAMETERS
4898321936Shselasky*	p_pi
4899321936Shselasky*		[in] Pointer to a PortInfo attribute.
4900321936Shselasky*
4901321936Shselasky*	op_vls
4902321936Shselasky*		[in] Encoded operation VLs value.
4903321936Shselasky*
4904321936Shselasky* RETURN VALUES
4905321936Shselasky*	None.
4906321936Shselasky*
4907321936Shselasky* NOTES
4908321936Shselasky*
4909321936Shselasky* SEE ALSO
4910321936Shselasky*********/
4911321936Shselasky
4912321936Shselasky/****f* IBA Base: Types/ib_port_info_set_state_no_change
4913321936Shselasky* NAME
4914321936Shselasky*	ib_port_info_set_state_no_change
4915321936Shselasky*
4916321936Shselasky* DESCRIPTION
4917321936Shselasky*	Sets the port state fields to the value for "no change".
4918321936Shselasky*
4919321936Shselasky* SYNOPSIS
4920321936Shselasky*/
4921321936Shselaskystatic inline void OSM_API
4922321936Shselaskyib_port_info_set_state_no_change(IN ib_port_info_t * const p_pi)
4923321936Shselasky{
4924321936Shselasky	ib_port_info_set_port_state(p_pi, IB_LINK_NO_CHANGE);
4925321936Shselasky	p_pi->state_info2 = 0;
4926321936Shselasky}
4927321936Shselasky
4928321936Shselasky/*
4929321936Shselasky* PARAMETERS
4930321936Shselasky*	p_pi
4931321936Shselasky*		[in] Pointer to a PortInfo attribute.
4932321936Shselasky*
4933321936Shselasky* RETURN VALUES
4934321936Shselasky*	None.
4935321936Shselasky*
4936321936Shselasky* NOTES
4937321936Shselasky*
4938321936Shselasky* SEE ALSO
4939321936Shselasky*********/
4940321936Shselasky
4941321936Shselasky/****f* IBA Base: Types/ib_port_info_get_link_speed_sup
4942321936Shselasky* NAME
4943321936Shselasky*	ib_port_info_get_link_speed_sup
4944321936Shselasky*
4945321936Shselasky* DESCRIPTION
4946321936Shselasky*	Returns the encoded value for the link speed supported.
4947321936Shselasky*
4948321936Shselasky* SYNOPSIS
4949321936Shselasky*/
4950321936Shselaskystatic inline uint8_t OSM_API
4951321936Shselaskyib_port_info_get_link_speed_sup(IN const ib_port_info_t * const p_pi)
4952321936Shselasky{
4953321936Shselasky	return ((uint8_t) ((p_pi->state_info1 &
4954321936Shselasky			    IB_PORT_LINK_SPEED_SUPPORTED_MASK) >>
4955321936Shselasky			   IB_PORT_LINK_SPEED_SHIFT));
4956321936Shselasky}
4957321936Shselasky
4958321936Shselasky/*
4959321936Shselasky* PARAMETERS
4960321936Shselasky*	p_pi
4961321936Shselasky*		[in] Pointer to a PortInfo attribute.
4962321936Shselasky*
4963321936Shselasky* RETURN VALUES
4964321936Shselasky*	Returns the encoded value for the link speed supported.
4965321936Shselasky*
4966321936Shselasky* NOTES
4967321936Shselasky*
4968321936Shselasky* SEE ALSO
4969321936Shselasky*********/
4970321936Shselasky
4971321936Shselasky/****f* IBA Base: Types/ib_port_info_set_link_speed_sup
4972321936Shselasky* NAME
4973321936Shselasky*	ib_port_info_set_link_speed_sup
4974321936Shselasky*
4975321936Shselasky* DESCRIPTION
4976321936Shselasky*	Given an integer of the supported link speed supported.
4977321936Shselasky*	Set the appropriate bits in state_info1
4978321936Shselasky*
4979321936Shselasky* SYNOPSIS
4980321936Shselasky*/
4981321936Shselaskystatic inline void OSM_API
4982321936Shselaskyib_port_info_set_link_speed_sup(IN uint8_t const speed,
4983321936Shselasky				IN ib_port_info_t * p_pi)
4984321936Shselasky{
4985321936Shselasky	p_pi->state_info1 =
4986321936Shselasky	    (~IB_PORT_LINK_SPEED_SUPPORTED_MASK & p_pi->state_info1) |
4987321936Shselasky	    (IB_PORT_LINK_SPEED_SUPPORTED_MASK &
4988321936Shselasky	     (speed << IB_PORT_LINK_SPEED_SHIFT));
4989321936Shselasky}
4990321936Shselasky
4991321936Shselasky/*
4992321936Shselasky* PARAMETERS
4993321936Shselasky*	speed
4994321936Shselasky*		[in] Supported Speeds Code.
4995321936Shselasky*
4996321936Shselasky*	p_pi
4997321936Shselasky*		[in] Pointer to a PortInfo attribute.
4998321936Shselasky*
4999321936Shselasky* RETURN VALUES
5000321936Shselasky*	This function does not return a value.
5001321936Shselasky*
5002321936Shselasky* NOTES
5003321936Shselasky*
5004321936Shselasky* SEE ALSO
5005321936Shselasky*********/
5006321936Shselasky
5007321936Shselasky/****f* IBA Base: Types/ib_port_info_get_port_phys_state
5008321936Shselasky* NAME
5009321936Shselasky*	ib_port_info_get_port_phys_state
5010321936Shselasky*
5011321936Shselasky* DESCRIPTION
5012321936Shselasky*	Returns the encoded value for the port physical state.
5013321936Shselasky*
5014321936Shselasky* SYNOPSIS
5015321936Shselasky*/
5016321936Shselaskystatic inline uint8_t OSM_API
5017321936Shselaskyib_port_info_get_port_phys_state(IN const ib_port_info_t * const p_pi)
5018321936Shselasky{
5019321936Shselasky	return ((uint8_t) ((p_pi->state_info2 &
5020321936Shselasky			    IB_PORT_PHYS_STATE_MASK) >>
5021321936Shselasky			   IB_PORT_PHYS_STATE_SHIFT));
5022321936Shselasky}
5023321936Shselasky
5024321936Shselasky/*
5025321936Shselasky* PARAMETERS
5026321936Shselasky*	p_pi
5027321936Shselasky*		[in] Pointer to a PortInfo attribute.
5028321936Shselasky*
5029321936Shselasky* RETURN VALUES
5030321936Shselasky*	Returns the encoded value for the port physical state.
5031321936Shselasky*
5032321936Shselasky* NOTES
5033321936Shselasky*
5034321936Shselasky* SEE ALSO
5035321936Shselasky*********/
5036321936Shselasky
5037321936Shselasky/****f* IBA Base: Types/ib_port_info_set_port_phys_state
5038321936Shselasky* NAME
5039321936Shselasky*	ib_port_info_set_port_phys_state
5040321936Shselasky*
5041321936Shselasky* DESCRIPTION
5042321936Shselasky*	Given an integer of the port physical state,
5043321936Shselasky*	Set the appropriate bits in state_info2
5044321936Shselasky*
5045321936Shselasky* SYNOPSIS
5046321936Shselasky*/
5047321936Shselaskystatic inline void OSM_API
5048321936Shselaskyib_port_info_set_port_phys_state(IN uint8_t const phys_state,
5049321936Shselasky				 IN ib_port_info_t * p_pi)
5050321936Shselasky{
5051321936Shselasky	p_pi->state_info2 =
5052321936Shselasky	    (~IB_PORT_PHYS_STATE_MASK & p_pi->state_info2) |
5053321936Shselasky	    (IB_PORT_PHYS_STATE_MASK &
5054321936Shselasky	     (phys_state << IB_PORT_PHYS_STATE_SHIFT));
5055321936Shselasky}
5056321936Shselasky
5057321936Shselasky/*
5058321936Shselasky* PARAMETERS
5059321936Shselasky*	phys_state
5060321936Shselasky*		[in] port physical state.
5061321936Shselasky*
5062321936Shselasky*	p_pi
5063321936Shselasky*		[in] Pointer to a PortInfo attribute.
5064321936Shselasky*
5065321936Shselasky* RETURN VALUES
5066321936Shselasky*	This function does not return a value.
5067321936Shselasky*
5068321936Shselasky* NOTES
5069321936Shselasky*
5070321936Shselasky* SEE ALSO
5071321936Shselasky*********/
5072321936Shselasky
5073321936Shselasky/****f* IBA Base: Types/ib_port_info_get_link_down_def_state
5074321936Shselasky* NAME
5075321936Shselasky*	ib_port_info_get_link_down_def_state
5076321936Shselasky*
5077321936Shselasky* DESCRIPTION
5078321936Shselasky*	Returns the link down default state.
5079321936Shselasky*
5080321936Shselasky* SYNOPSIS
5081321936Shselasky*/
5082321936Shselaskystatic inline uint8_t OSM_API
5083321936Shselaskyib_port_info_get_link_down_def_state(IN const ib_port_info_t * const p_pi)
5084321936Shselasky{
5085321936Shselasky	return ((uint8_t) (p_pi->state_info2 & IB_PORT_LNKDWNDFTSTATE_MASK));
5086321936Shselasky}
5087321936Shselasky
5088321936Shselasky/*
5089321936Shselasky* PARAMETERS
5090321936Shselasky*	p_pi
5091321936Shselasky*		[in] Pointer to a PortInfo attribute.
5092321936Shselasky*
5093321936Shselasky* RETURN VALUES
5094321936Shselasky*	link down default state of the port.
5095321936Shselasky*
5096321936Shselasky* NOTES
5097321936Shselasky*
5098321936Shselasky* SEE ALSO
5099321936Shselasky*********/
5100321936Shselasky
5101321936Shselasky/****f* IBA Base: Types/ib_port_info_set_link_down_def_state
5102321936Shselasky* NAME
5103321936Shselasky*	ib_port_info_set_link_down_def_state
5104321936Shselasky*
5105321936Shselasky* DESCRIPTION
5106321936Shselasky*	Sets the link down default state of the port.
5107321936Shselasky*
5108321936Shselasky* SYNOPSIS
5109321936Shselasky*/
5110321936Shselaskystatic inline void OSM_API
5111321936Shselaskyib_port_info_set_link_down_def_state(IN ib_port_info_t * const p_pi,
5112321936Shselasky				     IN const uint8_t link_dwn_state)
5113321936Shselasky{
5114321936Shselasky	p_pi->state_info2 =
5115321936Shselasky	    (uint8_t) ((p_pi->state_info2 & 0xF0) | link_dwn_state);
5116321936Shselasky}
5117321936Shselasky
5118321936Shselasky/*
5119321936Shselasky* PARAMETERS
5120321936Shselasky*	p_pi
5121321936Shselasky*		[in] Pointer to a PortInfo attribute.
5122321936Shselasky*
5123321936Shselasky*	link_dwn_state
5124321936Shselasky*		[in] Link down default state of the port.
5125321936Shselasky*
5126321936Shselasky* RETURN VALUES
5127321936Shselasky*	None.
5128321936Shselasky*
5129321936Shselasky* NOTES
5130321936Shselasky*
5131321936Shselasky* SEE ALSO
5132321936Shselasky*********/
5133321936Shselasky
5134321936Shselasky/****f* IBA Base: Types/ib_port_info_get_link_speed_active
5135321936Shselasky* NAME
5136321936Shselasky*	ib_port_info_get_link_speed_active
5137321936Shselasky*
5138321936Shselasky* DESCRIPTION
5139321936Shselasky*	Returns the Link Speed Active value assigned to this port.
5140321936Shselasky*
5141321936Shselasky* SYNOPSIS
5142321936Shselasky*/
5143321936Shselaskystatic inline uint8_t OSM_API
5144321936Shselaskyib_port_info_get_link_speed_active(IN const ib_port_info_t * const p_pi)
5145321936Shselasky{
5146321936Shselasky	return ((uint8_t) ((p_pi->link_speed &
5147321936Shselasky			    IB_PORT_LINK_SPEED_ACTIVE_MASK) >>
5148321936Shselasky			   IB_PORT_LINK_SPEED_SHIFT));
5149321936Shselasky}
5150321936Shselasky
5151321936Shselasky/*
5152321936Shselasky* PARAMETERS
5153321936Shselasky*	p_pi
5154321936Shselasky*		[in] Pointer to a PortInfo attribute.
5155321936Shselasky*
5156321936Shselasky* RETURN VALUES
5157321936Shselasky*	Returns the link speed active value assigned to this port.
5158321936Shselasky*
5159321936Shselasky* NOTES
5160321936Shselasky*
5161321936Shselasky* SEE ALSO
5162321936Shselasky*********/
5163321936Shselasky
5164321936Shselasky#define IB_LINK_WIDTH_ACTIVE_1X			1
5165321936Shselasky#define IB_LINK_WIDTH_ACTIVE_4X			2
5166321936Shselasky#define IB_LINK_WIDTH_ACTIVE_8X			4
5167321936Shselasky#define IB_LINK_WIDTH_ACTIVE_12X 		8
5168321936Shselasky#define IB_LINK_WIDTH_ACTIVE_2X			16
5169321936Shselasky#define IB_LINK_SPEED_ACTIVE_EXTENDED		0
5170321936Shselasky#define IB_LINK_SPEED_ACTIVE_2_5		1
5171321936Shselasky#define IB_LINK_SPEED_ACTIVE_5			2
5172321936Shselasky#define IB_LINK_SPEED_ACTIVE_10			4
5173321936Shselasky#define IB_LINK_SPEED_EXT_ACTIVE_NONE		0
5174321936Shselasky#define IB_LINK_SPEED_EXT_ACTIVE_14		1
5175321936Shselasky#define IB_LINK_SPEED_EXT_ACTIVE_25		2
5176321936Shselasky#define IB_LINK_SPEED_EXT_DISABLE		30
5177321936Shselasky#define IB_LINK_SPEED_EXT_SET_LSES		31
5178321936Shselasky
5179321936Shselasky/* following v1 ver1.3 p984 */
5180321936Shselasky#define IB_PATH_RECORD_RATE_2_5_GBS		2
5181321936Shselasky#define IB_PATH_RECORD_RATE_10_GBS		3
5182321936Shselasky#define IB_PATH_RECORD_RATE_30_GBS		4
5183321936Shselasky#define IB_PATH_RECORD_RATE_5_GBS		5
5184321936Shselasky#define IB_PATH_RECORD_RATE_20_GBS		6
5185321936Shselasky#define IB_PATH_RECORD_RATE_40_GBS		7
5186321936Shselasky#define IB_PATH_RECORD_RATE_60_GBS		8
5187321936Shselasky#define IB_PATH_RECORD_RATE_80_GBS		9
5188321936Shselasky#define IB_PATH_RECORD_RATE_120_GBS		10
5189321936Shselasky#define IB_PATH_RECORD_RATE_14_GBS		11
5190321936Shselasky#define IB_PATH_RECORD_RATE_56_GBS		12
5191321936Shselasky#define IB_PATH_RECORD_RATE_112_GBS		13
5192321936Shselasky#define IB_PATH_RECORD_RATE_168_GBS		14
5193321936Shselasky#define IB_PATH_RECORD_RATE_25_GBS		15
5194321936Shselasky#define IB_PATH_RECORD_RATE_100_GBS		16
5195321936Shselasky#define IB_PATH_RECORD_RATE_200_GBS		17
5196321936Shselasky#define IB_PATH_RECORD_RATE_300_GBS		18
5197321936Shselasky#define IB_PATH_RECORD_RATE_28_GBS		19
5198321936Shselasky#define IB_PATH_RECORD_RATE_50_GBS		20
5199321936Shselasky
5200321936Shselasky#define IB_MIN_RATE    IB_PATH_RECORD_RATE_2_5_GBS
5201321936Shselasky#define IB_MAX_RATE    IB_PATH_RECORD_RATE_50_GBS
5202321936Shselasky
5203321936Shselaskystatic inline uint8_t OSM_API
5204321936Shselaskyib_port_info_get_link_speed_ext_active(IN const ib_port_info_t * const p_pi);
5205321936Shselasky
5206321936Shselasky/****f* IBA Base: Types/ib_port_info_compute_rate
5207321936Shselasky* NAME
5208321936Shselasky*	ib_port_info_compute_rate
5209321936Shselasky*
5210321936Shselasky* DESCRIPTION
5211321936Shselasky*	Returns the encoded value for the path rate.
5212321936Shselasky*
5213321936Shselasky* SYNOPSIS
5214321936Shselasky*/
5215321936Shselaskystatic inline uint8_t OSM_API
5216321936Shselaskyib_port_info_compute_rate(IN const ib_port_info_t * const p_pi,
5217321936Shselasky			  IN const int extended)
5218321936Shselasky{
5219321936Shselasky	uint8_t rate = 0;
5220321936Shselasky
5221321936Shselasky	if (extended) {
5222321936Shselasky		switch (ib_port_info_get_link_speed_ext_active(p_pi)) {
5223321936Shselasky		case IB_LINK_SPEED_EXT_ACTIVE_14:
5224321936Shselasky			switch (p_pi->link_width_active) {
5225321936Shselasky			case IB_LINK_WIDTH_ACTIVE_1X:
5226321936Shselasky				rate = IB_PATH_RECORD_RATE_14_GBS;
5227321936Shselasky				break;
5228321936Shselasky
5229321936Shselasky			case IB_LINK_WIDTH_ACTIVE_4X:
5230321936Shselasky				rate = IB_PATH_RECORD_RATE_56_GBS;
5231321936Shselasky				break;
5232321936Shselasky
5233321936Shselasky			case IB_LINK_WIDTH_ACTIVE_8X:
5234321936Shselasky				rate = IB_PATH_RECORD_RATE_112_GBS;
5235321936Shselasky				break;
5236321936Shselasky
5237321936Shselasky			case IB_LINK_WIDTH_ACTIVE_12X:
5238321936Shselasky				rate = IB_PATH_RECORD_RATE_168_GBS;
5239321936Shselasky				break;
5240321936Shselasky
5241321936Shselasky			case IB_LINK_WIDTH_ACTIVE_2X:
5242321936Shselasky				rate = IB_PATH_RECORD_RATE_28_GBS;
5243321936Shselasky				break;
5244321936Shselasky
5245321936Shselasky			default:
5246321936Shselasky				rate = IB_PATH_RECORD_RATE_14_GBS;
5247321936Shselasky				break;
5248321936Shselasky			}
5249321936Shselasky			break;
5250321936Shselasky		case IB_LINK_SPEED_EXT_ACTIVE_25:
5251321936Shselasky			switch (p_pi->link_width_active) {
5252321936Shselasky			case IB_LINK_WIDTH_ACTIVE_1X:
5253321936Shselasky				rate = IB_PATH_RECORD_RATE_25_GBS;
5254321936Shselasky				break;
5255321936Shselasky
5256321936Shselasky			case IB_LINK_WIDTH_ACTIVE_4X:
5257321936Shselasky				rate = IB_PATH_RECORD_RATE_100_GBS;
5258321936Shselasky				break;
5259321936Shselasky
5260321936Shselasky			case IB_LINK_WIDTH_ACTIVE_8X:
5261321936Shselasky				rate = IB_PATH_RECORD_RATE_200_GBS;
5262321936Shselasky				break;
5263321936Shselasky
5264321936Shselasky			case IB_LINK_WIDTH_ACTIVE_12X:
5265321936Shselasky				rate = IB_PATH_RECORD_RATE_300_GBS;
5266321936Shselasky				break;
5267321936Shselasky
5268321936Shselasky			case IB_LINK_WIDTH_ACTIVE_2X:
5269321936Shselasky				rate = IB_PATH_RECORD_RATE_50_GBS;
5270321936Shselasky				break;
5271321936Shselasky
5272321936Shselasky			default:
5273321936Shselasky				rate = IB_PATH_RECORD_RATE_25_GBS;
5274321936Shselasky				break;
5275321936Shselasky			}
5276321936Shselasky			break;
5277321936Shselasky		/* IB_LINK_SPEED_EXT_ACTIVE_NONE and any others */
5278321936Shselasky		default:
5279321936Shselasky			break;
5280321936Shselasky		}
5281321936Shselasky		if (rate)
5282321936Shselasky			return rate;
5283321936Shselasky	}
5284321936Shselasky
5285321936Shselasky	switch (ib_port_info_get_link_speed_active(p_pi)) {
5286321936Shselasky	case IB_LINK_SPEED_ACTIVE_2_5:
5287321936Shselasky		switch (p_pi->link_width_active) {
5288321936Shselasky		case IB_LINK_WIDTH_ACTIVE_1X:
5289321936Shselasky			rate = IB_PATH_RECORD_RATE_2_5_GBS;
5290321936Shselasky			break;
5291321936Shselasky
5292321936Shselasky		case IB_LINK_WIDTH_ACTIVE_4X:
5293321936Shselasky			rate = IB_PATH_RECORD_RATE_10_GBS;
5294321936Shselasky			break;
5295321936Shselasky
5296321936Shselasky		case IB_LINK_WIDTH_ACTIVE_8X:
5297321936Shselasky			rate = IB_PATH_RECORD_RATE_20_GBS;
5298321936Shselasky			break;
5299321936Shselasky
5300321936Shselasky		case IB_LINK_WIDTH_ACTIVE_12X:
5301321936Shselasky			rate = IB_PATH_RECORD_RATE_30_GBS;
5302321936Shselasky			break;
5303321936Shselasky
5304321936Shselasky		case IB_LINK_WIDTH_ACTIVE_2X:
5305321936Shselasky			rate = IB_PATH_RECORD_RATE_5_GBS;
5306321936Shselasky			break;
5307321936Shselasky
5308321936Shselasky		default:
5309321936Shselasky			rate = IB_PATH_RECORD_RATE_2_5_GBS;
5310321936Shselasky			break;
5311321936Shselasky		}
5312321936Shselasky		break;
5313321936Shselasky	case IB_LINK_SPEED_ACTIVE_5:
5314321936Shselasky		switch (p_pi->link_width_active) {
5315321936Shselasky		case IB_LINK_WIDTH_ACTIVE_1X:
5316321936Shselasky			rate = IB_PATH_RECORD_RATE_5_GBS;
5317321936Shselasky			break;
5318321936Shselasky
5319321936Shselasky		case IB_LINK_WIDTH_ACTIVE_4X:
5320321936Shselasky			rate = IB_PATH_RECORD_RATE_20_GBS;
5321321936Shselasky			break;
5322321936Shselasky
5323321936Shselasky		case IB_LINK_WIDTH_ACTIVE_8X:
5324321936Shselasky			rate = IB_PATH_RECORD_RATE_40_GBS;
5325321936Shselasky			break;
5326321936Shselasky
5327321936Shselasky		case IB_LINK_WIDTH_ACTIVE_12X:
5328321936Shselasky			rate = IB_PATH_RECORD_RATE_60_GBS;
5329321936Shselasky			break;
5330321936Shselasky
5331321936Shselasky		case IB_LINK_WIDTH_ACTIVE_2X:
5332321936Shselasky			rate = IB_PATH_RECORD_RATE_10_GBS;
5333321936Shselasky			break;
5334321936Shselasky
5335321936Shselasky		default:
5336321936Shselasky			rate = IB_PATH_RECORD_RATE_5_GBS;
5337321936Shselasky			break;
5338321936Shselasky		}
5339321936Shselasky		break;
5340321936Shselasky	case IB_LINK_SPEED_ACTIVE_10:
5341321936Shselasky		switch (p_pi->link_width_active) {
5342321936Shselasky		case IB_LINK_WIDTH_ACTIVE_1X:
5343321936Shselasky			rate = IB_PATH_RECORD_RATE_10_GBS;
5344321936Shselasky			break;
5345321936Shselasky
5346321936Shselasky		case IB_LINK_WIDTH_ACTIVE_4X:
5347321936Shselasky			rate = IB_PATH_RECORD_RATE_40_GBS;
5348321936Shselasky			break;
5349321936Shselasky
5350321936Shselasky		case IB_LINK_WIDTH_ACTIVE_8X:
5351321936Shselasky			rate = IB_PATH_RECORD_RATE_80_GBS;
5352321936Shselasky			break;
5353321936Shselasky
5354321936Shselasky		case IB_LINK_WIDTH_ACTIVE_12X:
5355321936Shselasky			rate = IB_PATH_RECORD_RATE_120_GBS;
5356321936Shselasky			break;
5357321936Shselasky
5358321936Shselasky		case IB_LINK_WIDTH_ACTIVE_2X:
5359321936Shselasky			rate = IB_PATH_RECORD_RATE_20_GBS;
5360321936Shselasky			break;
5361321936Shselasky
5362321936Shselasky		default:
5363321936Shselasky			rate = IB_PATH_RECORD_RATE_10_GBS;
5364321936Shselasky			break;
5365321936Shselasky		}
5366321936Shselasky		break;
5367321936Shselasky	default:
5368321936Shselasky		rate = IB_PATH_RECORD_RATE_2_5_GBS;
5369321936Shselasky		break;
5370321936Shselasky	}
5371321936Shselasky
5372321936Shselasky	return rate;
5373321936Shselasky}
5374321936Shselasky
5375321936Shselasky/*
5376321936Shselasky* PARAMETERS
5377321936Shselasky*	p_pi
5378321936Shselasky*		[in] Pointer to a PortInfo attribute.
5379321936Shselasky*
5380321936Shselasky*	extended
5381321936Shselasky*		[in] Indicates whether or not to use extended link speeds.
5382321936Shselasky*
5383321936Shselasky* RETURN VALUES
5384321936Shselasky*	Returns the encoded value for the link speed supported.
5385321936Shselasky*
5386321936Shselasky* NOTES
5387321936Shselasky*
5388321936Shselasky* SEE ALSO
5389321936Shselasky*********/
5390321936Shselasky
5391321936Shselasky/****f* IBA Base: Types/ib_path_get_ipd
5392321936Shselasky* NAME
5393321936Shselasky*	ib_path_get_ipd
5394321936Shselasky*
5395321936Shselasky* DESCRIPTION
5396321936Shselasky*	Returns the encoded value for the inter packet delay.
5397321936Shselasky*
5398321936Shselasky* SYNOPSIS
5399321936Shselasky*/
5400321936Shselaskystatic inline uint8_t OSM_API
5401321936Shselaskyib_path_get_ipd(IN uint8_t local_link_width_supported, IN uint8_t path_rec_rate)
5402321936Shselasky{
5403321936Shselasky	uint8_t ipd = 0;
5404321936Shselasky
5405321936Shselasky	switch (local_link_width_supported) {
5406321936Shselasky		/* link_width_supported = 1: 1x */
5407321936Shselasky	case 1:
5408321936Shselasky		break;
5409321936Shselasky
5410321936Shselasky		/* link_width_supported = 3: 1x or 4x */
5411321936Shselasky	case 3:
5412321936Shselasky		switch (path_rec_rate & 0x3F) {
5413321936Shselasky		case IB_PATH_RECORD_RATE_2_5_GBS:
5414321936Shselasky			ipd = 3;
5415321936Shselasky			break;
5416321936Shselasky		default:
5417321936Shselasky			break;
5418321936Shselasky		}
5419321936Shselasky		break;
5420321936Shselasky
5421321936Shselasky		/* link_width_supported = 11: 1x or 4x or 12x */
5422321936Shselasky	case 11:
5423321936Shselasky		switch (path_rec_rate & 0x3F) {
5424321936Shselasky		case IB_PATH_RECORD_RATE_2_5_GBS:
5425321936Shselasky			ipd = 11;
5426321936Shselasky			break;
5427321936Shselasky		case IB_PATH_RECORD_RATE_10_GBS:
5428321936Shselasky			ipd = 2;
5429321936Shselasky			break;
5430321936Shselasky		default:
5431321936Shselasky			break;
5432321936Shselasky		}
5433321936Shselasky		break;
5434321936Shselasky
5435321936Shselasky	default:
5436321936Shselasky		break;
5437321936Shselasky	}
5438321936Shselasky
5439321936Shselasky	return ipd;
5440321936Shselasky}
5441321936Shselasky
5442321936Shselasky/*
5443321936Shselasky* PARAMETERS
5444321936Shselasky*	local_link_width_supported
5445321936Shselasky*		[in] link with supported for this port
5446321936Shselasky*
5447321936Shselasky*	path_rec_rate
5448321936Shselasky*		[in] rate field of the path record
5449321936Shselasky*
5450321936Shselasky* RETURN VALUES
5451321936Shselasky*	Returns the ipd
5452321936Shselasky*
5453321936Shselasky* NOTES
5454321936Shselasky*
5455321936Shselasky* SEE ALSO
5456321936Shselasky*********/
5457321936Shselasky
5458321936Shselasky/****f* IBA Base: Types/ib_port_info_get_mtu_cap
5459321936Shselasky* NAME
5460321936Shselasky*	ib_port_info_get_mtu_cap
5461321936Shselasky*
5462321936Shselasky* DESCRIPTION
5463321936Shselasky*	Returns the encoded value for the maximum MTU supported by this port.
5464321936Shselasky*
5465321936Shselasky* SYNOPSIS
5466321936Shselasky*/
5467321936Shselaskystatic inline uint8_t OSM_API
5468321936Shselaskyib_port_info_get_mtu_cap(IN const ib_port_info_t * const p_pi)
5469321936Shselasky{
5470321936Shselasky	return ((uint8_t) (p_pi->mtu_cap & 0x0F));
5471321936Shselasky}
5472321936Shselasky
5473321936Shselasky/*
5474321936Shselasky* PARAMETERS
5475321936Shselasky*	p_pi
5476321936Shselasky*		[in] Pointer to a PortInfo attribute.
5477321936Shselasky*
5478321936Shselasky* RETURN VALUES
5479321936Shselasky*	Returns the encooded value for the maximum MTU supported by this port.
5480321936Shselasky*
5481321936Shselasky* NOTES
5482321936Shselasky*
5483321936Shselasky* SEE ALSO
5484321936Shselasky*********/
5485321936Shselasky
5486321936Shselasky/****f* IBA Base: Types/ib_port_info_get_neighbor_mtu
5487321936Shselasky* NAME
5488321936Shselasky*	ib_port_info_get_neighbor_mtu
5489321936Shselasky*
5490321936Shselasky* DESCRIPTION
5491321936Shselasky*	Returns the encoded value for the neighbor MTU supported by this port.
5492321936Shselasky*
5493321936Shselasky* SYNOPSIS
5494321936Shselasky*/
5495321936Shselaskystatic inline uint8_t OSM_API
5496321936Shselaskyib_port_info_get_neighbor_mtu(IN const ib_port_info_t * const p_pi)
5497321936Shselasky{
5498321936Shselasky	return ((uint8_t) ((p_pi->mtu_smsl & 0xF0) >> 4));
5499321936Shselasky}
5500321936Shselasky
5501321936Shselasky/*
5502321936Shselasky* PARAMETERS
5503321936Shselasky*	p_pi
5504321936Shselasky*		[in] Pointer to a PortInfo attribute.
5505321936Shselasky*
5506321936Shselasky* RETURN VALUES
5507321936Shselasky*	Returns the encoded value for the neighbor MTU at this port.
5508321936Shselasky*
5509321936Shselasky* NOTES
5510321936Shselasky*
5511321936Shselasky* SEE ALSO
5512321936Shselasky*********/
5513321936Shselasky
5514321936Shselasky/****f* IBA Base: Types/ib_port_info_set_neighbor_mtu
5515321936Shselasky* NAME
5516321936Shselasky*	ib_port_info_set_neighbor_mtu
5517321936Shselasky*
5518321936Shselasky* DESCRIPTION
5519321936Shselasky*	Sets the Neighbor MTU value in the PortInfo attribute.
5520321936Shselasky*
5521321936Shselasky* SYNOPSIS
5522321936Shselasky*/
5523321936Shselaskystatic inline void OSM_API
5524321936Shselaskyib_port_info_set_neighbor_mtu(IN ib_port_info_t * const p_pi,
5525321936Shselasky			      IN const uint8_t mtu)
5526321936Shselasky{
5527321936Shselasky	CL_ASSERT(mtu <= 5);
5528321936Shselasky	CL_ASSERT(mtu != 0);
5529321936Shselasky	p_pi->mtu_smsl = (uint8_t) ((p_pi->mtu_smsl & 0x0F) | (mtu << 4));
5530321936Shselasky}
5531321936Shselasky
5532321936Shselasky/*
5533321936Shselasky* PARAMETERS
5534321936Shselasky*	p_pi
5535321936Shselasky*		[in] Pointer to a PortInfo attribute.
5536321936Shselasky*
5537321936Shselasky*	mtu
5538321936Shselasky*		[in] Encoded MTU value to set
5539321936Shselasky*
5540321936Shselasky* RETURN VALUES
5541321936Shselasky*	None.
5542321936Shselasky*
5543321936Shselasky* NOTES
5544321936Shselasky*
5545321936Shselasky* SEE ALSO
5546321936Shselasky*********/
5547321936Shselasky
5548321936Shselasky/****f* IBA Base: Types/ib_port_info_get_master_smsl
5549321936Shselasky* NAME
5550321936Shselasky*	ib_port_info_get_master_smsl
5551321936Shselasky*
5552321936Shselasky* DESCRIPTION
5553321936Shselasky*	Returns the encoded value for the Master SMSL at this port.
5554321936Shselasky*
5555321936Shselasky* SYNOPSIS
5556321936Shselasky*/
5557321936Shselaskystatic inline uint8_t OSM_API
5558321936Shselaskyib_port_info_get_master_smsl(IN const ib_port_info_t * const p_pi)
5559321936Shselasky{
5560321936Shselasky	return (uint8_t) (p_pi->mtu_smsl & 0x0F);
5561321936Shselasky}
5562321936Shselasky
5563321936Shselasky/*
5564321936Shselasky* PARAMETERS
5565321936Shselasky*	p_pi
5566321936Shselasky*		[in] Pointer to a PortInfo attribute.
5567321936Shselasky*
5568321936Shselasky* RETURN VALUES
5569321936Shselasky*	Returns the encoded value for the Master SMSL at this port.
5570321936Shselasky*
5571321936Shselasky* NOTES
5572321936Shselasky*
5573321936Shselasky* SEE ALSO
5574321936Shselasky*********/
5575321936Shselasky
5576321936Shselasky/****f* IBA Base: Types/ib_port_info_set_master_smsl
5577321936Shselasky* NAME
5578321936Shselasky*	ib_port_info_set_master_smsl
5579321936Shselasky*
5580321936Shselasky* DESCRIPTION
5581321936Shselasky*	Sets the Master SMSL value in the PortInfo attribute.
5582321936Shselasky*
5583321936Shselasky* SYNOPSIS
5584321936Shselasky*/
5585321936Shselaskystatic inline void OSM_API
5586321936Shselaskyib_port_info_set_master_smsl(IN ib_port_info_t * const p_pi,
5587321936Shselasky			     IN const uint8_t smsl)
5588321936Shselasky{
5589321936Shselasky	p_pi->mtu_smsl = (uint8_t) ((p_pi->mtu_smsl & 0xF0) | smsl);
5590321936Shselasky}
5591321936Shselasky
5592321936Shselasky/*
5593321936Shselasky* PARAMETERS
5594321936Shselasky*	p_pi
5595321936Shselasky*		[in] Pointer to a PortInfo attribute.
5596321936Shselasky*
5597321936Shselasky*	mtu
5598321936Shselasky*		[in] Encoded Master SMSL value to set
5599321936Shselasky*
5600321936Shselasky* RETURN VALUES
5601321936Shselasky*	None.
5602321936Shselasky*
5603321936Shselasky* NOTES
5604321936Shselasky*
5605321936Shselasky* SEE ALSO
5606321936Shselasky*********/
5607321936Shselasky
5608321936Shselasky/****f* IBA Base: Types/ib_port_info_set_timeout
5609321936Shselasky* NAME
5610321936Shselasky*	ib_port_info_set_timeout
5611321936Shselasky*
5612321936Shselasky* DESCRIPTION
5613321936Shselasky*	Sets the encoded subnet timeout value in the PortInfo attribute.
5614321936Shselasky*
5615321936Shselasky* SYNOPSIS
5616321936Shselasky*/
5617321936Shselaskystatic inline void OSM_API
5618321936Shselaskyib_port_info_set_timeout(IN ib_port_info_t * const p_pi,
5619321936Shselasky			 IN const uint8_t timeout)
5620321936Shselasky{
5621321936Shselasky	CL_ASSERT(timeout <= 0x1F);
5622321936Shselasky	p_pi->subnet_timeout =
5623321936Shselasky	    (uint8_t) ((p_pi->subnet_timeout & 0xE0) | (timeout & 0x1F));
5624321936Shselasky}
5625321936Shselasky
5626321936Shselasky/*
5627321936Shselasky* PARAMETERS
5628321936Shselasky*	p_pi
5629321936Shselasky*		[in] Pointer to a PortInfo attribute.
5630321936Shselasky*
5631321936Shselasky*	timeout
5632321936Shselasky*		[in] Encoded timeout value to set
5633321936Shselasky*
5634321936Shselasky* RETURN VALUES
5635321936Shselasky*	None.
5636321936Shselasky*
5637321936Shselasky* NOTES
5638321936Shselasky*
5639321936Shselasky* SEE ALSO
5640321936Shselasky*********/
5641321936Shselasky
5642321936Shselasky/****f* IBA Base: Types/ib_port_info_set_client_rereg
5643321936Shselasky* NAME
5644321936Shselasky*	ib_port_info_set_client_rereg
5645321936Shselasky*
5646321936Shselasky* DESCRIPTION
5647321936Shselasky*	Sets the encoded client reregistration bit value in the PortInfo attribute.
5648321936Shselasky*
5649321936Shselasky* SYNOPSIS
5650321936Shselasky*/
5651321936Shselaskystatic inline void OSM_API
5652321936Shselaskyib_port_info_set_client_rereg(IN ib_port_info_t * const p_pi,
5653321936Shselasky			      IN const uint8_t client_rereg)
5654321936Shselasky{
5655321936Shselasky	CL_ASSERT(client_rereg <= 0x1);
5656321936Shselasky	p_pi->subnet_timeout =
5657321936Shselasky	    (uint8_t) ((p_pi->subnet_timeout & 0x7F) | (client_rereg << 7));
5658321936Shselasky}
5659321936Shselasky
5660321936Shselasky/*
5661321936Shselasky* PARAMETERS
5662321936Shselasky*	p_pi
5663321936Shselasky*		[in] Pointer to a PortInfo attribute.
5664321936Shselasky*
5665321936Shselasky*	client_rereg
5666321936Shselasky*		[in] Client reregistration value to set (either 1 or 0).
5667321936Shselasky*
5668321936Shselasky* RETURN VALUES
5669321936Shselasky*	None.
5670321936Shselasky*
5671321936Shselasky* NOTES
5672321936Shselasky*
5673321936Shselasky* SEE ALSO
5674321936Shselasky*********/
5675321936Shselasky
5676321936Shselasky/****f* IBA Base: Types/ib_port_info_set_mcast_pkey_trap_suppress
5677321936Shselasky* NAME
5678321936Shselasky*	ib_port_info_set_mcast_pkey_trap_suppress
5679321936Shselasky*
5680321936Shselasky* DESCRIPTION
5681321936Shselasky*	Sets the encoded multicast pkey trap suppression enabled bit value
5682321936Shselasky*	in the PortInfo attribute.
5683321936Shselasky*
5684321936Shselasky* SYNOPSIS
5685321936Shselasky*/
5686321936Shselaskystatic inline void OSM_API
5687321936Shselaskyib_port_info_set_mcast_pkey_trap_suppress(IN ib_port_info_t * const p_pi,
5688321936Shselasky					  IN const uint8_t trap_suppress)
5689321936Shselasky{
5690321936Shselasky	CL_ASSERT(trap_suppress <= 0x1);
5691321936Shselasky	p_pi->subnet_timeout =
5692321936Shselasky	    (uint8_t) ((p_pi->subnet_timeout & 0xBF) | (trap_suppress << 6));
5693321936Shselasky}
5694321936Shselasky
5695321936Shselasky/*
5696321936Shselasky* PARAMETERS
5697321936Shselasky*	p_pi
5698321936Shselasky*		[in] Pointer to a PortInfo attribute.
5699321936Shselasky*
5700321936Shselasky*	trap_suppress
5701321936Shselasky*		[in] Multicast pkey trap suppression enabled value to set
5702321936Shselasky*		     (either 1 or 0).
5703321936Shselasky*
5704321936Shselasky* RETURN VALUES
5705321936Shselasky*	None.
5706321936Shselasky*
5707321936Shselasky* NOTES
5708321936Shselasky*
5709321936Shselasky* SEE ALSO
5710321936Shselasky*********/
5711321936Shselasky
5712321936Shselasky/****f* IBA Base: Types/ib_port_info_get_timeout
5713321936Shselasky* NAME
5714321936Shselasky*	ib_port_info_get_timeout
5715321936Shselasky*
5716321936Shselasky* DESCRIPTION
5717321936Shselasky*	Gets the encoded subnet timeout value in the PortInfo attribute.
5718321936Shselasky*
5719321936Shselasky* SYNOPSIS
5720321936Shselasky*/
5721321936Shselaskystatic inline uint8_t OSM_API
5722321936Shselaskyib_port_info_get_timeout(IN ib_port_info_t const *p_pi)
5723321936Shselasky{
5724321936Shselasky	return (p_pi->subnet_timeout & 0x1F);
5725321936Shselasky}
5726321936Shselasky
5727321936Shselasky/*
5728321936Shselasky* PARAMETERS
5729321936Shselasky*	p_pi
5730321936Shselasky*		[in] Pointer to a PortInfo attribute.
5731321936Shselasky*
5732321936Shselasky* RETURN VALUES
5733321936Shselasky*	The encoded timeout value
5734321936Shselasky*
5735321936Shselasky* NOTES
5736321936Shselasky*
5737321936Shselasky* SEE ALSO
5738321936Shselasky*********/
5739321936Shselasky
5740321936Shselasky/****f* IBA Base: Types/ib_port_info_get_link_speed_ext_active
5741321936Shselasky* NAME
5742321936Shselasky*	ib_port_info_get_link_speed_ext_active
5743321936Shselasky*
5744321936Shselasky* DESCRIPTION
5745321936Shselasky*	Gets the encoded LinkSpeedExtActive value in the PortInfo attribute.
5746321936Shselasky*
5747321936Shselasky* SYNOPSIS
5748321936Shselasky*/
5749321936Shselaskystatic inline uint8_t OSM_API
5750321936Shselaskyib_port_info_get_link_speed_ext_active(IN const ib_port_info_t * const p_pi)
5751321936Shselasky{
5752321936Shselasky	return ((p_pi->link_speed_ext & 0xF0) >> 4);
5753321936Shselasky}
5754321936Shselasky
5755321936Shselasky/*
5756321936Shselasky* PARAMETERS
5757321936Shselasky*	p_pi
5758321936Shselasky*		[in] Pointer to a PortInfo attribute.
5759321936Shselasky*
5760321936Shselasky* RETURN VALUES
5761321936Shselasky*	The encoded LinkSpeedExtActive value
5762321936Shselasky*
5763321936Shselasky* NOTES
5764321936Shselasky*
5765321936Shselasky* SEE ALSO
5766321936Shselasky*********/
5767321936Shselasky
5768321936Shselasky/****f* IBA Base: Types/ib_port_info_get_link_speed_ext_sup
5769321936Shselasky* NAME
5770321936Shselasky*	ib_port_info_get_link_speed_ext_sup
5771321936Shselasky*
5772321936Shselasky* DESCRIPTION
5773321936Shselasky*	Returns the encoded value for the link speed extended supported.
5774321936Shselasky*
5775321936Shselasky* SYNOPSIS
5776321936Shselasky*/
5777321936Shselaskystatic inline uint8_t OSM_API
5778321936Shselaskyib_port_info_get_link_speed_ext_sup(IN const ib_port_info_t * const p_pi)
5779321936Shselasky{
5780321936Shselasky	return (p_pi->link_speed_ext & 0x0F);
5781321936Shselasky}
5782321936Shselasky
5783321936Shselasky/*
5784321936Shselasky* PARAMETERS
5785321936Shselasky*	p_pi
5786321936Shselasky*		[in] Pointer to a PortInfo attribute.
5787321936Shselasky*
5788321936Shselasky* RETURN VALUES
5789321936Shselasky*	The encoded LinkSpeedExtSupported value
5790321936Shselasky*
5791321936Shselasky* NOTES
5792321936Shselasky*
5793321936Shselasky* SEE ALSO
5794321936Shselasky*********/
5795321936Shselasky
5796321936Shselasky/****f* IBA Base: Types/ib_port_info_get_link_speed_ext_enabled
5797321936Shselasky* NAME
5798321936Shselasky*	ib_port_info_get_link_speed_ext_enabled
5799321936Shselasky*
5800321936Shselasky* DESCRIPTION
5801321936Shselasky*	Gets the encoded LinkSpeedExtEnabled value in the PortInfo attribute.
5802321936Shselasky*
5803321936Shselasky* SYNOPSIS
5804321936Shselasky*/
5805321936Shselaskystatic inline uint8_t OSM_API
5806321936Shselaskyib_port_info_get_link_speed_ext_enabled(IN const ib_port_info_t * const p_pi)
5807321936Shselasky{
5808321936Shselasky        return (p_pi->link_speed_ext_enabled & 0x1F);
5809321936Shselasky}
5810321936Shselasky
5811321936Shselasky/*
5812321936Shselasky* PARAMETERS
5813321936Shselasky*	p_pi
5814321936Shselasky*		[in] Pointer to a PortInfo attribute.
5815321936Shselasky*
5816321936Shselasky* RETURN VALUES
5817321936Shselasky*	The encoded LinkSpeedExtEnabled value
5818321936Shselasky*
5819321936Shselasky* NOTES
5820321936Shselasky*
5821321936Shselasky* SEE ALSO
5822321936Shselasky*********/
5823321936Shselasky
5824321936Shselasky/****f* IBA Base: Types/ib_port_info_set_link_speed_ext_enabled
5825321936Shselasky* NAME
5826321936Shselasky*	ib_port_info_set_link_speed_ext_enabled
5827321936Shselasky*
5828321936Shselasky* DESCRIPTION
5829321936Shselasky*	Sets the link speed extended enabled value in the PortInfo attribute.
5830321936Shselasky*
5831321936Shselasky* SYNOPSIS
5832321936Shselasky*/
5833321936Shselaskystatic inline void OSM_API
5834321936Shselaskyib_port_info_set_link_speed_ext_enabled(IN ib_port_info_t * const p_pi,
5835321936Shselasky					IN const uint8_t link_speed_ext_enabled)
5836321936Shselasky{
5837321936Shselasky	CL_ASSERT(link_speed_ext_enabled <= 0x1F);
5838321936Shselasky	p_pi->link_speed_ext_enabled = link_speed_ext_enabled & 0x1F;
5839321936Shselasky}
5840321936Shselasky
5841321936Shselasky/*
5842321936Shselasky* PARAMETERS
5843321936Shselasky*	p_pi
5844321936Shselasky*		[in] Pointer to a PortInfo attribute.
5845321936Shselasky*
5846321936Shselasky*	link_speed_ext_enabled
5847321936Shselasky*		[in] link speed extehded enabled value to set.
5848321936Shselasky*
5849321936Shselasky* RETURN VALUES
5850321936Shselasky*	The encoded LinkSpeedExtEnabled value
5851321936Shselasky*
5852321936Shselasky* NOTES
5853321936Shselasky*
5854321936Shselasky* SEE ALSO
5855321936Shselasky*********/
5856321936Shselasky
5857321936Shselasky/****f* IBA Base: Types/ib_port_info_get_resp_time_value
5858321936Shselasky* NAME
5859321936Shselasky*	ib_port_info_get_resp_time_value
5860321936Shselasky*
5861321936Shselasky* DESCRIPTION
5862321936Shselasky*	Gets the encoded resp time value in the PortInfo attribute.
5863321936Shselasky*
5864321936Shselasky* SYNOPSIS
5865321936Shselasky*/
5866321936Shselaskystatic inline uint8_t OSM_API
5867321936Shselaskyib_port_info_get_resp_time_value(IN const ib_port_info_t * const p_pi)
5868321936Shselasky{
5869321936Shselasky	return (p_pi->resp_time_value & 0x1F);
5870321936Shselasky}
5871321936Shselasky
5872321936Shselasky/*
5873321936Shselasky* PARAMETERS
5874321936Shselasky*	p_pi
5875321936Shselasky*		[in] Pointer to a PortInfo attribute.
5876321936Shselasky*
5877321936Shselasky* RETURN VALUES
5878321936Shselasky*	The encoded resp time value
5879321936Shselasky*
5880321936Shselasky* NOTES
5881321936Shselasky*
5882321936Shselasky* SEE ALSO
5883321936Shselasky*********/
5884321936Shselasky
5885321936Shselasky/****f* IBA Base: Types/ib_port_info_get_client_rereg
5886321936Shselasky* NAME
5887321936Shselasky*	ib_port_info_get_client_rereg
5888321936Shselasky*
5889321936Shselasky* DESCRIPTION
5890321936Shselasky*	Gets the encoded client reregistration bit value in the PortInfo attribute.
5891321936Shselasky*
5892321936Shselasky* SYNOPSIS
5893321936Shselasky*/
5894321936Shselaskystatic inline uint8_t OSM_API
5895321936Shselaskyib_port_info_get_client_rereg(IN ib_port_info_t const *p_pi)
5896321936Shselasky{
5897321936Shselasky	return ((p_pi->subnet_timeout & 0x80) >> 7);
5898321936Shselasky}
5899321936Shselasky
5900321936Shselasky/*
5901321936Shselasky* PARAMETERS
5902321936Shselasky*	p_pi
5903321936Shselasky*		[in] Pointer to a PortInfo attribute.
5904321936Shselasky*
5905321936Shselasky* RETURN VALUES
5906321936Shselasky*	Client reregistration value (either 1 or 0).
5907321936Shselasky*
5908321936Shselasky* NOTES
5909321936Shselasky*
5910321936Shselasky* SEE ALSO
5911321936Shselasky*********/
5912321936Shselasky
5913321936Shselasky/****f* IBA Base: Types/ib_port_info_get_mcast_pkey_trap_suppress
5914321936Shselasky* NAME
5915321936Shselasky*	ib_port_info_get_mcast_pkey_trap_suppress
5916321936Shselasky*
5917321936Shselasky* DESCRIPTION
5918321936Shselasky*	Gets the encoded multicast pkey trap suppression enabled bit value
5919321936Shselasky*	in the PortInfo attribute.
5920321936Shselasky*
5921321936Shselasky* SYNOPSIS
5922321936Shselasky*/
5923321936Shselaskystatic inline uint8_t OSM_API
5924321936Shselaskyib_port_info_get_mcast_pkey_trap_suppress(IN ib_port_info_t const *p_pi)
5925321936Shselasky{
5926321936Shselasky	return ((p_pi->subnet_timeout & 0x40) >> 6);
5927321936Shselasky}
5928321936Shselasky
5929321936Shselasky/*
5930321936Shselasky* PARAMETERS
5931321936Shselasky*	p_pi
5932321936Shselasky*		[in] Pointer to a PortInfo attribute.
5933321936Shselasky*
5934321936Shselasky* RETURN VALUES
5935321936Shselasky*	Multicast PKey trap suppression enabled value (either 1 or 0).
5936321936Shselasky*
5937321936Shselasky* NOTES
5938321936Shselasky*
5939321936Shselasky* SEE ALSO
5940321936Shselasky*********/
5941321936Shselasky
5942321936Shselasky/****f* IBA Base: Types/ib_port_info_set_hoq_lifetime
5943321936Shselasky* NAME
5944321936Shselasky*	ib_port_info_set_hoq_lifetime
5945321936Shselasky*
5946321936Shselasky* DESCRIPTION
5947321936Shselasky*	Sets the Head of Queue Lifetime for which a packet can live in the head
5948321936Shselasky*  of VL queue
5949321936Shselasky*
5950321936Shselasky* SYNOPSIS
5951321936Shselasky*/
5952321936Shselaskystatic inline void OSM_API
5953321936Shselaskyib_port_info_set_hoq_lifetime(IN ib_port_info_t * const p_pi,
5954321936Shselasky			      IN const uint8_t hoq_life)
5955321936Shselasky{
5956321936Shselasky	p_pi->vl_stall_life = (uint8_t) ((hoq_life & 0x1f) |
5957321936Shselasky					 (p_pi->vl_stall_life & 0xe0));
5958321936Shselasky}
5959321936Shselasky
5960321936Shselasky/*
5961321936Shselasky* PARAMETERS
5962321936Shselasky*	p_pi
5963321936Shselasky*		[in] Pointer to a PortInfo attribute.
5964321936Shselasky*
5965321936Shselasky*	hoq_life
5966321936Shselasky*		[in] Encoded lifetime value to set
5967321936Shselasky*
5968321936Shselasky* RETURN VALUES
5969321936Shselasky*	None.
5970321936Shselasky*
5971321936Shselasky* NOTES
5972321936Shselasky*
5973321936Shselasky* SEE ALSO
5974321936Shselasky*********/
5975321936Shselasky
5976321936Shselasky/****f* IBA Base: Types/ib_port_info_get_hoq_lifetime
5977321936Shselasky* NAME
5978321936Shselasky*	ib_port_info_get_hoq_lifetime
5979321936Shselasky*
5980321936Shselasky* DESCRIPTION
5981321936Shselasky*	Gets the Head of Queue Lifetime for which a packet can live in the head
5982321936Shselasky*  of VL queue
5983321936Shselasky*
5984321936Shselasky* SYNOPSIS
5985321936Shselasky*/
5986321936Shselaskystatic inline uint8_t OSM_API
5987321936Shselaskyib_port_info_get_hoq_lifetime(IN const ib_port_info_t * const p_pi)
5988321936Shselasky{
5989321936Shselasky	return ((uint8_t) (p_pi->vl_stall_life & 0x1f));
5990321936Shselasky}
5991321936Shselasky
5992321936Shselasky/*
5993321936Shselasky* PARAMETERS
5994321936Shselasky*	p_pi
5995321936Shselasky*		[in] Pointer to a PortInfo attribute.
5996321936Shselasky*
5997321936Shselasky* RETURN VALUES
5998321936Shselasky*     Encoded lifetime value
5999321936Shselasky*
6000321936Shselasky* NOTES
6001321936Shselasky*
6002321936Shselasky* SEE ALSO
6003321936Shselasky*********/
6004321936Shselasky
6005321936Shselasky/****f* IBA Base: Types/ib_port_info_set_vl_stall_count
6006321936Shselasky* NAME
6007321936Shselasky*	ib_port_info_set_vl_stall_count
6008321936Shselasky*
6009321936Shselasky* DESCRIPTION
6010321936Shselasky*	Sets the VL Stall Count which define the number of contiguous
6011321936Shselasky*  HLL (hoq) drops that will put the VL into stalled mode.
6012321936Shselasky*
6013321936Shselasky* SYNOPSIS
6014321936Shselasky*/
6015321936Shselaskystatic inline void OSM_API
6016321936Shselaskyib_port_info_set_vl_stall_count(IN ib_port_info_t * const p_pi,
6017321936Shselasky				IN const uint8_t vl_stall_count)
6018321936Shselasky{
6019321936Shselasky	p_pi->vl_stall_life = (uint8_t) ((p_pi->vl_stall_life & 0x1f) |
6020321936Shselasky					 ((vl_stall_count << 5) & 0xe0));
6021321936Shselasky}
6022321936Shselasky
6023321936Shselasky/*
6024321936Shselasky* PARAMETERS
6025321936Shselasky*	p_pi
6026321936Shselasky*		[in] Pointer to a PortInfo attribute.
6027321936Shselasky*
6028321936Shselasky*	vl_stall_count
6029321936Shselasky*		[in] value to set
6030321936Shselasky*
6031321936Shselasky* RETURN VALUES
6032321936Shselasky*	None.
6033321936Shselasky*
6034321936Shselasky* NOTES
6035321936Shselasky*
6036321936Shselasky* SEE ALSO
6037321936Shselasky*********/
6038321936Shselasky
6039321936Shselasky/****f* IBA Base: Types/ib_port_info_get_vl_stall_count
6040321936Shselasky* NAME
6041321936Shselasky*	ib_port_info_get_vl_stall_count
6042321936Shselasky*
6043321936Shselasky* DESCRIPTION
6044321936Shselasky*	Gets the VL Stall Count which define the number of contiguous
6045321936Shselasky*  HLL (hoq) drops that will put the VL into stalled mode
6046321936Shselasky*
6047321936Shselasky* SYNOPSIS
6048321936Shselasky*/
6049321936Shselaskystatic inline uint8_t OSM_API
6050321936Shselaskyib_port_info_get_vl_stall_count(IN const ib_port_info_t * const p_pi)
6051321936Shselasky{
6052321936Shselasky	return ((uint8_t) (p_pi->vl_stall_life & 0xe0) >> 5);
6053321936Shselasky}
6054321936Shselasky
6055321936Shselasky/*
6056321936Shselasky* PARAMETERS
6057321936Shselasky*	p_pi
6058321936Shselasky*		[in] Pointer to a PortInfo attribute.
6059321936Shselasky*
6060321936Shselasky* RETURN VALUES
6061321936Shselasky*     vl stall count
6062321936Shselasky*
6063321936Shselasky* NOTES
6064321936Shselasky*
6065321936Shselasky* SEE ALSO
6066321936Shselasky*********/
6067321936Shselasky
6068321936Shselasky/****f* IBA Base: Types/ib_port_info_get_lmc
6069321936Shselasky* NAME
6070321936Shselasky*	ib_port_info_get_lmc
6071321936Shselasky*
6072321936Shselasky* DESCRIPTION
6073321936Shselasky*	Returns the LMC value assigned to this port.
6074321936Shselasky*
6075321936Shselasky* SYNOPSIS
6076321936Shselasky*/
6077321936Shselaskystatic inline uint8_t OSM_API
6078321936Shselaskyib_port_info_get_lmc(IN const ib_port_info_t * const p_pi)
6079321936Shselasky{
6080321936Shselasky	return ((uint8_t) (p_pi->mkey_lmc & IB_PORT_LMC_MASK));
6081321936Shselasky}
6082321936Shselasky
6083321936Shselasky/*
6084321936Shselasky* PARAMETERS
6085321936Shselasky*	p_pi
6086321936Shselasky*		[in] Pointer to a PortInfo attribute.
6087321936Shselasky*
6088321936Shselasky* RETURN VALUES
6089321936Shselasky*	Returns the LMC value assigned to this port.
6090321936Shselasky*
6091321936Shselasky* NOTES
6092321936Shselasky*
6093321936Shselasky* SEE ALSO
6094321936Shselasky*********/
6095321936Shselasky
6096321936Shselasky/****f* IBA Base: Types/ib_port_info_set_lmc
6097321936Shselasky* NAME
6098321936Shselasky*	ib_port_info_set_lmc
6099321936Shselasky*
6100321936Shselasky* DESCRIPTION
6101321936Shselasky*	Sets the LMC value in the PortInfo attribute.
6102321936Shselasky*
6103321936Shselasky* SYNOPSIS
6104321936Shselasky*/
6105321936Shselaskystatic inline void OSM_API
6106321936Shselaskyib_port_info_set_lmc(IN ib_port_info_t * const p_pi, IN const uint8_t lmc)
6107321936Shselasky{
6108321936Shselasky	CL_ASSERT(lmc <= IB_PORT_LMC_MAX);
6109321936Shselasky	p_pi->mkey_lmc = (uint8_t) ((p_pi->mkey_lmc & 0xF8) | lmc);
6110321936Shselasky}
6111321936Shselasky
6112321936Shselasky/*
6113321936Shselasky* PARAMETERS
6114321936Shselasky*	p_pi
6115321936Shselasky*		[in] Pointer to a PortInfo attribute.
6116321936Shselasky*
6117321936Shselasky*	lmc
6118321936Shselasky*		[in] LMC value to set, must be less than 7.
6119321936Shselasky*
6120321936Shselasky* RETURN VALUES
6121321936Shselasky*	None.
6122321936Shselasky*
6123321936Shselasky* NOTES
6124321936Shselasky*
6125321936Shselasky* SEE ALSO
6126321936Shselasky*********/
6127321936Shselasky
6128321936Shselasky/****f* IBA Base: Types/ib_port_info_get_link_speed_enabled
6129321936Shselasky* NAME
6130321936Shselasky*	ib_port_info_get_link_speed_enabled
6131321936Shselasky*
6132321936Shselasky* DESCRIPTION
6133321936Shselasky*	Returns the link speed enabled value assigned to this port.
6134321936Shselasky*
6135321936Shselasky* SYNOPSIS
6136321936Shselasky*/
6137321936Shselaskystatic inline uint8_t OSM_API
6138321936Shselaskyib_port_info_get_link_speed_enabled(IN const ib_port_info_t * const p_pi)
6139321936Shselasky{
6140321936Shselasky	return ((uint8_t) (p_pi->link_speed & IB_PORT_LINK_SPEED_ENABLED_MASK));
6141321936Shselasky}
6142321936Shselasky
6143321936Shselasky/*
6144321936Shselasky* PARAMETERS
6145321936Shselasky*	p_pi
6146321936Shselasky*		[in] Pointer to a PortInfo attribute.
6147321936Shselasky*
6148321936Shselasky* RETURN VALUES
6149321936Shselasky*	Port state.
6150321936Shselasky*
6151321936Shselasky* NOTES
6152321936Shselasky*
6153321936Shselasky* SEE ALSO
6154321936Shselasky*********/
6155321936Shselasky
6156321936Shselasky/****f* IBA Base: Types/ib_port_info_set_link_speed_enabled
6157321936Shselasky* NAME
6158321936Shselasky*	ib_port_info_set_link_speed_enabled
6159321936Shselasky*
6160321936Shselasky* DESCRIPTION
6161321936Shselasky*	Sets the link speed enabled value in the PortInfo attribute.
6162321936Shselasky*
6163321936Shselasky* SYNOPSIS
6164321936Shselasky*/
6165321936Shselaskystatic inline void OSM_API
6166321936Shselaskyib_port_info_set_link_speed_enabled(IN ib_port_info_t * const p_pi,
6167321936Shselasky				    IN const uint8_t link_speed_enabled)
6168321936Shselasky{
6169321936Shselasky	p_pi->link_speed =
6170321936Shselasky	    (uint8_t) ((p_pi->link_speed & 0xF0) | link_speed_enabled);
6171321936Shselasky}
6172321936Shselasky
6173321936Shselasky/*
6174321936Shselasky* PARAMETERS
6175321936Shselasky*	p_pi
6176321936Shselasky*		[in] Pointer to a PortInfo attribute.
6177321936Shselasky*
6178321936Shselasky*	link_speed_enabled
6179321936Shselasky*		[in] link speed enabled value to set.
6180321936Shselasky*
6181321936Shselasky* RETURN VALUES
6182321936Shselasky*	None.
6183321936Shselasky*
6184321936Shselasky* NOTES
6185321936Shselasky*
6186321936Shselasky* SEE ALSO
6187321936Shselasky*********/
6188321936Shselasky
6189321936Shselasky/****f* IBA Base: Types/ib_port_info_get_mpb
6190321936Shselasky* NAME
6191321936Shselasky*	ib_port_info_get_mpb
6192321936Shselasky*
6193321936Shselasky* DESCRIPTION
6194321936Shselasky*	Returns the M_Key protect bits assigned to this port.
6195321936Shselasky*
6196321936Shselasky* SYNOPSIS
6197321936Shselasky*/
6198321936Shselaskystatic inline uint8_t OSM_API
6199321936Shselaskyib_port_info_get_mpb(IN const ib_port_info_t * const p_pi)
6200321936Shselasky{
6201321936Shselasky	return ((uint8_t) ((p_pi->mkey_lmc & IB_PORT_MPB_MASK) >>
6202321936Shselasky			   IB_PORT_MPB_SHIFT));
6203321936Shselasky}
6204321936Shselasky
6205321936Shselasky/*
6206321936Shselasky* PARAMETERS
6207321936Shselasky*	p_ni
6208321936Shselasky*		[in] Pointer to a PortInfo attribute.
6209321936Shselasky*
6210321936Shselasky* RETURN VALUES
6211321936Shselasky*	Returns the M_Key protect bits assigned to this port.
6212321936Shselasky*
6213321936Shselasky* NOTES
6214321936Shselasky*
6215321936Shselasky* SEE ALSO
6216321936Shselasky*********/
6217321936Shselasky
6218321936Shselasky/****f* IBA Base: Types/ib_port_info_set_mpb
6219321936Shselasky* NAME
6220321936Shselasky*	ib_port_info_set_mpb
6221321936Shselasky*
6222321936Shselasky* DESCRIPTION
6223321936Shselasky*	Set the M_Key protect bits of this port.
6224321936Shselasky*
6225321936Shselasky* SYNOPSIS
6226321936Shselasky*/
6227321936Shselaskystatic inline void OSM_API
6228321936Shselaskyib_port_info_set_mpb(IN ib_port_info_t * p_pi, IN uint8_t mpb)
6229321936Shselasky{
6230321936Shselasky	p_pi->mkey_lmc =
6231321936Shselasky	    (~IB_PORT_MPB_MASK & p_pi->mkey_lmc) |
6232321936Shselasky	    (IB_PORT_MPB_MASK & (mpb << IB_PORT_MPB_SHIFT));
6233321936Shselasky}
6234321936Shselasky
6235321936Shselasky/*
6236321936Shselasky* PARAMETERS
6237321936Shselasky*	mpb
6238321936Shselasky*		[in] M_Key protect bits
6239321936Shselasky*	p_ni
6240321936Shselasky*		[in] Pointer to a PortInfo attribute.
6241321936Shselasky*
6242321936Shselasky* RETURN VALUES
6243321936Shselasky*
6244321936Shselasky* NOTES
6245321936Shselasky*
6246321936Shselasky* SEE ALSO
6247321936Shselasky*********/
6248321936Shselasky
6249321936Shselasky/****f* IBA Base: Types/ib_port_info_get_local_phy_err_thd
6250321936Shselasky* NAME
6251321936Shselasky*	ib_port_info_get_local_phy_err_thd
6252321936Shselasky*
6253321936Shselasky* DESCRIPTION
6254321936Shselasky*	Returns the Phy Link Threshold
6255321936Shselasky*
6256321936Shselasky* SYNOPSIS
6257321936Shselasky*/
6258321936Shselaskystatic inline uint8_t OSM_API
6259321936Shselaskyib_port_info_get_local_phy_err_thd(IN const ib_port_info_t * const p_pi)
6260321936Shselasky{
6261321936Shselasky	return (uint8_t) ((p_pi->error_threshold & 0xF0) >> 4);
6262321936Shselasky}
6263321936Shselasky
6264321936Shselasky/*
6265321936Shselasky* PARAMETERS
6266321936Shselasky*	p_pi
6267321936Shselasky*		[in] Pointer to a PortInfo attribute.
6268321936Shselasky*
6269321936Shselasky* RETURN VALUES
6270321936Shselasky*	Returns the Phy Link error threshold assigned to this port.
6271321936Shselasky*
6272321936Shselasky* NOTES
6273321936Shselasky*
6274321936Shselasky* SEE ALSO
6275321936Shselasky*********/
6276321936Shselasky
6277321936Shselasky/****f* IBA Base: Types/ib_port_info_get_overrun_err_thd
6278321936Shselasky* NAME
6279321936Shselasky*	ib_port_info_get_local_overrun_err_thd
6280321936Shselasky*
6281321936Shselasky* DESCRIPTION
6282321936Shselasky*	Returns the Credits Overrun Errors Threshold
6283321936Shselasky*
6284321936Shselasky* SYNOPSIS
6285321936Shselasky*/
6286321936Shselaskystatic inline uint8_t OSM_API
6287321936Shselaskyib_port_info_get_overrun_err_thd(IN const ib_port_info_t * const p_pi)
6288321936Shselasky{
6289321936Shselasky	return (uint8_t) (p_pi->error_threshold & 0x0F);
6290321936Shselasky}
6291321936Shselasky
6292321936Shselasky/*
6293321936Shselasky* PARAMETERS
6294321936Shselasky*	p_pi
6295321936Shselasky*		[in] Pointer to a PortInfo attribute.
6296321936Shselasky*
6297321936Shselasky* RETURN VALUES
6298321936Shselasky*	Returns the Credits Overrun errors threshold assigned to this port.
6299321936Shselasky*
6300321936Shselasky* NOTES
6301321936Shselasky*
6302321936Shselasky* SEE ALSO
6303321936Shselasky*********/
6304321936Shselasky
6305321936Shselasky/****f* IBA Base: Types/ib_port_info_set_phy_and_overrun_err_thd
6306321936Shselasky* NAME
6307321936Shselasky*	ib_port_info_set_phy_and_overrun_err_thd
6308321936Shselasky*
6309321936Shselasky* DESCRIPTION
6310321936Shselasky*	Sets the Phy Link and Credits Overrun Errors Threshold
6311321936Shselasky*
6312321936Shselasky* SYNOPSIS
6313321936Shselasky*/
6314321936Shselaskystatic inline void OSM_API
6315321936Shselaskyib_port_info_set_phy_and_overrun_err_thd(IN ib_port_info_t * const p_pi,
6316321936Shselasky					 IN uint8_t phy_threshold,
6317321936Shselasky					 IN uint8_t overrun_threshold)
6318321936Shselasky{
6319321936Shselasky	p_pi->error_threshold =
6320321936Shselasky	    (uint8_t) (((phy_threshold & 0x0F) << 4) |
6321321936Shselasky		       (overrun_threshold & 0x0F));
6322321936Shselasky}
6323321936Shselasky
6324321936Shselasky/*
6325321936Shselasky* PARAMETERS
6326321936Shselasky*	p_pi
6327321936Shselasky*		[in] Pointer to a PortInfo attribute.
6328321936Shselasky*
6329321936Shselasky*	phy_threshold
6330321936Shselasky*		[in] Physical Link Errors Threshold above which Trap 129 is generated
6331321936Shselasky*
6332321936Shselasky*  overrun_threshold
6333321936Shselasky*     [in] Credits overrun Errors Threshold above which Trap 129 is generated
6334321936Shselasky*
6335321936Shselasky* RETURN VALUES
6336321936Shselasky*	None.
6337321936Shselasky*
6338321936Shselasky* NOTES
6339321936Shselasky*
6340321936Shselasky* SEE ALSO
6341321936Shselasky*********/
6342321936Shselasky
6343321936Shselasky/****f* IBA Base: Types/ib_port_info_get_m_key
6344321936Shselasky* NAME
6345321936Shselasky*	ib_port_info_get_m_key
6346321936Shselasky*
6347321936Shselasky* DESCRIPTION
6348321936Shselasky*	Gets the M_Key
6349321936Shselasky*
6350321936Shselasky* SYNOPSIS
6351321936Shselasky*/
6352321936Shselaskystatic inline ib_net64_t OSM_API
6353321936Shselaskyib_port_info_get_m_key(IN const ib_port_info_t * const p_pi)
6354321936Shselasky{
6355321936Shselasky	return p_pi->m_key;
6356321936Shselasky}
6357321936Shselasky
6358321936Shselasky/*
6359321936Shselasky* PARAMETERS
6360321936Shselasky*	p_pi
6361321936Shselasky*		[in] Pointer to a PortInfo attribute.
6362321936Shselasky*
6363321936Shselasky* RETURN VALUES
6364321936Shselasky*	M_Key.
6365321936Shselasky*
6366321936Shselasky* NOTES
6367321936Shselasky*
6368321936Shselasky* SEE ALSO
6369321936Shselasky*********/
6370321936Shselasky
6371321936Shselasky/****f* IBA Base: Types/ib_port_info_set_m_key
6372321936Shselasky* NAME
6373321936Shselasky*	ib_port_info_set_m_key
6374321936Shselasky*
6375321936Shselasky* DESCRIPTION
6376321936Shselasky*	Sets the M_Key value
6377321936Shselasky*
6378321936Shselasky* SYNOPSIS
6379321936Shselasky*/
6380321936Shselaskystatic inline void OSM_API
6381321936Shselaskyib_port_info_set_m_key(IN ib_port_info_t * const p_pi, IN ib_net64_t m_key)
6382321936Shselasky{
6383321936Shselasky	p_pi->m_key = m_key;
6384321936Shselasky}
6385321936Shselasky
6386321936Shselasky/*
6387321936Shselasky* PARAMETERS
6388321936Shselasky*	p_pi
6389321936Shselasky*		[in] Pointer to a PortInfo attribute.
6390321936Shselasky*	m_key
6391321936Shselasky*		[in] M_Key value.
6392321936Shselasky*
6393321936Shselasky* RETURN VALUES
6394321936Shselasky*	None.
6395321936Shselasky*
6396321936Shselasky* NOTES
6397321936Shselasky*
6398321936Shselasky* SEE ALSO
6399321936Shselasky*********/
6400321936Shselasky
6401321936Shselasky
6402321936Shselasky/****s* IBA Base: Types/ib_mlnx_ext_port_info_t
6403321936Shselasky* NAME
6404321936Shselasky*	ib_mlnx_ext_port_info_t
6405321936Shselasky*
6406321936Shselasky* DESCRIPTION
6407321936Shselasky*	Mellanox ExtendedPortInfo (Vendor specific SM class attribute).
6408321936Shselasky*
6409321936Shselasky* SYNOPSIS
6410321936Shselasky*/
6411321936Shselasky#include <complib/cl_packon.h>
6412321936Shselaskytypedef struct _ib_mlnx_ext_port_info {
6413321936Shselasky	uint8_t resvd1[3];
6414321936Shselasky	uint8_t state_change_enable;
6415321936Shselasky	uint8_t resvd2[3];
6416321936Shselasky	uint8_t link_speed_supported;
6417321936Shselasky	uint8_t resvd3[3];
6418321936Shselasky	uint8_t link_speed_enabled;
6419321936Shselasky	uint8_t resvd4[3];
6420321936Shselasky	uint8_t link_speed_active;
6421321936Shselasky	uint8_t resvd5[48];
6422321936Shselasky} PACK_SUFFIX ib_mlnx_ext_port_info_t;
6423321936Shselasky#include <complib/cl_packoff.h>
6424321936Shselasky/************/
6425321936Shselasky
6426321936Shselasky#define FDR10 0x01
6427321936Shselasky
6428321936Shselaskytypedef uint8_t ib_svc_name_t[64];
6429321936Shselasky
6430321936Shselasky#include <complib/cl_packon.h>
6431321936Shselaskytypedef struct _ib_service_record {
6432321936Shselasky	ib_net64_t service_id;
6433321936Shselasky	ib_gid_t service_gid;
6434321936Shselasky	ib_net16_t service_pkey;
6435321936Shselasky	ib_net16_t resv;
6436321936Shselasky	ib_net32_t service_lease;
6437321936Shselasky	uint8_t service_key[16];
6438321936Shselasky	ib_svc_name_t service_name;
6439321936Shselasky	uint8_t service_data8[16];
6440321936Shselasky	ib_net16_t service_data16[8];
6441321936Shselasky	ib_net32_t service_data32[4];
6442321936Shselasky	ib_net64_t service_data64[2];
6443321936Shselasky} PACK_SUFFIX ib_service_record_t;
6444321936Shselasky#include <complib/cl_packoff.h>
6445321936Shselasky
6446321936Shselasky#include <complib/cl_packon.h>
6447321936Shselaskytypedef struct _ib_portinfo_record {
6448321936Shselasky	ib_net16_t lid;
6449321936Shselasky	uint8_t port_num;
6450321936Shselasky	uint8_t options;
6451321936Shselasky	ib_port_info_t port_info;
6452321936Shselasky	uint8_t pad[4];
6453321936Shselasky} PACK_SUFFIX ib_portinfo_record_t;
6454321936Shselasky#include <complib/cl_packoff.h>
6455321936Shselasky
6456321936Shselasky#include <complib/cl_packon.h>
6457321936Shselaskytypedef struct _ib_portinfoext_record {
6458321936Shselasky	ib_net16_t lid;
6459321936Shselasky	uint8_t port_num;
6460321936Shselasky	uint8_t options;
6461321936Shselasky	ib_port_info_ext_t port_info_ext;
6462321936Shselasky} PACK_SUFFIX ib_portinfoext_record_t;
6463321936Shselasky#include <complib/cl_packoff.h>
6464321936Shselasky
6465321936Shselasky#include <complib/cl_packon.h>
6466321936Shselaskytypedef struct _ib_link_record {
6467321936Shselasky	ib_net16_t from_lid;
6468321936Shselasky	uint8_t from_port_num;
6469321936Shselasky	uint8_t to_port_num;
6470321936Shselasky	ib_net16_t to_lid;
6471321936Shselasky	uint8_t pad[2];
6472321936Shselasky} PACK_SUFFIX ib_link_record_t;
6473321936Shselasky#include <complib/cl_packoff.h>
6474321936Shselasky
6475321936Shselasky#include <complib/cl_packon.h>
6476321936Shselaskytypedef struct _ib_sminfo_record {
6477321936Shselasky	ib_net16_t lid;
6478321936Shselasky	uint16_t resv0;
6479321936Shselasky	ib_sm_info_t sm_info;
6480321936Shselasky	uint8_t pad[7];
6481321936Shselasky} PACK_SUFFIX ib_sminfo_record_t;
6482321936Shselasky#include <complib/cl_packoff.h>
6483321936Shselasky
6484321936Shselasky/****s* IBA Base: Types/ib_lft_record_t
6485321936Shselasky* NAME
6486321936Shselasky*	ib_lft_record_t
6487321936Shselasky*
6488321936Shselasky* DESCRIPTION
6489321936Shselasky*	IBA defined LinearForwardingTableRecord (15.2.5.6)
6490321936Shselasky*
6491321936Shselasky* SYNOPSIS
6492321936Shselasky*/
6493321936Shselasky#include <complib/cl_packon.h>
6494321936Shselaskytypedef struct _ib_lft_record {
6495321936Shselasky	ib_net16_t lid;
6496321936Shselasky	ib_net16_t block_num;
6497321936Shselasky	uint32_t resv0;
6498321936Shselasky	uint8_t lft[64];
6499321936Shselasky} PACK_SUFFIX ib_lft_record_t;
6500321936Shselasky#include <complib/cl_packoff.h>
6501321936Shselasky/************/
6502321936Shselasky
6503321936Shselasky/****s* IBA Base: Types/ib_mft_record_t
6504321936Shselasky* NAME
6505321936Shselasky*	ib_mft_record_t
6506321936Shselasky*
6507321936Shselasky* DESCRIPTION
6508321936Shselasky*	IBA defined MulticastForwardingTableRecord (15.2.5.8)
6509321936Shselasky*
6510321936Shselasky* SYNOPSIS
6511321936Shselasky*/
6512321936Shselasky#include <complib/cl_packon.h>
6513321936Shselaskytypedef struct _ib_mft_record {
6514321936Shselasky	ib_net16_t lid;
6515321936Shselasky	ib_net16_t position_block_num;
6516321936Shselasky	uint32_t resv0;
6517321936Shselasky	ib_net16_t mft[IB_MCAST_BLOCK_SIZE];
6518321936Shselasky} PACK_SUFFIX ib_mft_record_t;
6519321936Shselasky#include <complib/cl_packoff.h>
6520321936Shselasky/************/
6521321936Shselasky
6522321936Shselasky/****s* IBA Base: Types/ib_switch_info_t
6523321936Shselasky* NAME
6524321936Shselasky*	ib_switch_info_t
6525321936Shselasky*
6526321936Shselasky* DESCRIPTION
6527321936Shselasky*	IBA defined SwitchInfo. (14.2.5.4)
6528321936Shselasky*
6529321936Shselasky* SYNOPSIS
6530321936Shselasky*/
6531321936Shselasky#include <complib/cl_packon.h>
6532321936Shselaskytypedef struct _ib_switch_info {
6533321936Shselasky	ib_net16_t lin_cap;
6534321936Shselasky	ib_net16_t rand_cap;
6535321936Shselasky	ib_net16_t mcast_cap;
6536321936Shselasky	ib_net16_t lin_top;
6537321936Shselasky	uint8_t def_port;
6538321936Shselasky	uint8_t def_mcast_pri_port;
6539321936Shselasky	uint8_t def_mcast_not_port;
6540321936Shselasky	uint8_t life_state;
6541321936Shselasky	ib_net16_t lids_per_port;
6542321936Shselasky	ib_net16_t enforce_cap;
6543321936Shselasky	uint8_t flags;
6544321936Shselasky	uint8_t resvd;
6545321936Shselasky	ib_net16_t mcast_top;
6546321936Shselasky} PACK_SUFFIX ib_switch_info_t;
6547321936Shselasky#include <complib/cl_packoff.h>
6548321936Shselasky/************/
6549321936Shselasky
6550321936Shselasky#include <complib/cl_packon.h>
6551321936Shselaskytypedef struct _ib_switch_info_record {
6552321936Shselasky	ib_net16_t lid;
6553321936Shselasky	uint16_t resv0;
6554321936Shselasky	ib_switch_info_t switch_info;
6555321936Shselasky} PACK_SUFFIX ib_switch_info_record_t;
6556321936Shselasky#include <complib/cl_packoff.h>
6557321936Shselasky
6558321936Shselasky#define IB_SWITCH_PSC 0x04
6559321936Shselasky
6560321936Shselasky/****f* IBA Base: Types/ib_switch_info_get_state_change
6561321936Shselasky* NAME
6562321936Shselasky*	ib_switch_info_get_state_change
6563321936Shselasky*
6564321936Shselasky* DESCRIPTION
6565321936Shselasky*	Returns the value of the state change flag.
6566321936Shselasky*
6567321936Shselasky* SYNOPSIS
6568321936Shselasky*/
6569321936Shselaskystatic inline boolean_t OSM_API
6570321936Shselaskyib_switch_info_get_state_change(IN const ib_switch_info_t * const p_si)
6571321936Shselasky{
6572321936Shselasky	return ((p_si->life_state & IB_SWITCH_PSC) == IB_SWITCH_PSC);
6573321936Shselasky}
6574321936Shselasky
6575321936Shselasky/*
6576321936Shselasky* PARAMETERS
6577321936Shselasky*	p_si
6578321936Shselasky*		[in] Pointer to a SwitchInfo attribute.
6579321936Shselasky*
6580321936Shselasky* RETURN VALUES
6581321936Shselasky*	Returns the value of the state change flag.
6582321936Shselasky*
6583321936Shselasky* NOTES
6584321936Shselasky*
6585321936Shselasky* SEE ALSO
6586321936Shselasky*********/
6587321936Shselasky
6588321936Shselasky/****f* IBA Base: Types/ib_switch_info_clear_state_change
6589321936Shselasky* NAME
6590321936Shselasky*	ib_switch_info_clear_state_change
6591321936Shselasky*
6592321936Shselasky* DESCRIPTION
6593321936Shselasky*	Clears the switch's state change bit.
6594321936Shselasky*
6595321936Shselasky* SYNOPSIS
6596321936Shselasky*/
6597321936Shselaskystatic inline void OSM_API
6598321936Shselaskyib_switch_info_clear_state_change(IN ib_switch_info_t * const p_si)
6599321936Shselasky{
6600321936Shselasky	p_si->life_state = (uint8_t) (p_si->life_state & 0xFB);
6601321936Shselasky}
6602321936Shselasky
6603321936Shselasky/*
6604321936Shselasky* PARAMETERS
6605321936Shselasky*	p_si
6606321936Shselasky*		[in] Pointer to a SwitchInfo attribute.
6607321936Shselasky*
6608321936Shselasky* RETURN VALUES
6609321936Shselasky*	None
6610321936Shselasky*
6611321936Shselasky* NOTES
6612321936Shselasky*
6613321936Shselasky* SEE ALSO
6614321936Shselasky*********/
6615321936Shselasky
6616321936Shselasky/****f* IBA Base: Types/ib_switch_info_state_change_set
6617321936Shselasky* NAME
6618321936Shselasky*	ib_switch_info_state_change_set
6619321936Shselasky*
6620321936Shselasky* DESCRIPTION
6621321936Shselasky*	Clears the switch's state change bit.
6622321936Shselasky*
6623321936Shselasky* SYNOPSIS
6624321936Shselasky*/
6625321936Shselaskystatic inline void OSM_API
6626321936Shselaskyib_switch_info_state_change_set(IN ib_switch_info_t * const p_si)
6627321936Shselasky{
6628321936Shselasky	p_si->life_state = (uint8_t) ((p_si->life_state & ~IB_SWITCH_PSC) | IB_SWITCH_PSC);
6629321936Shselasky}
6630321936Shselasky
6631321936Shselasky/*
6632321936Shselasky* PARAMETERS
6633321936Shselasky*	p_si
6634321936Shselasky*		[in] Pointer to a SwitchInfo attribute.
6635321936Shselasky*
6636321936Shselasky* RETURN VALUES
6637321936Shselasky*	None
6638321936Shselasky*
6639321936Shselasky* NOTES
6640321936Shselasky*
6641321936Shselasky* SEE ALSO
6642321936Shselasky*********/
6643321936Shselasky
6644321936Shselasky/****f* IBA Base: Types/ib_switch_info_get_opt_sl2vlmapping
6645321936Shselasky* NAME
6646321936Shselasky*	ib_switch_info_get_state_opt_sl2vlmapping
6647321936Shselasky*
6648321936Shselasky* DESCRIPTION
6649321936Shselasky*       Returns the value of the optimized SLtoVLMapping programming flag.
6650321936Shselasky*
6651321936Shselasky* SYNOPSIS
6652321936Shselasky*/
6653321936Shselaskystatic inline boolean_t OSM_API
6654321936Shselaskyib_switch_info_get_opt_sl2vlmapping(IN const ib_switch_info_t * const p_si)
6655321936Shselasky{
6656321936Shselasky        return ((p_si->life_state & 0x01) == 0x01);
6657321936Shselasky}
6658321936Shselasky
6659321936Shselasky/*
6660321936Shselasky* PARAMETERS
6661321936Shselasky*	p_si
6662321936Shselasky*		[in] Pointer to a SwitchInfo attribute.
6663321936Shselasky*
6664321936Shselasky* RETURN VALUES
6665321936Shselasky*	Returns the value of the optimized SLtoVLMapping programming flag.
6666321936Shselasky*
6667321936Shselasky* NOTES
6668321936Shselasky*
6669321936Shselasky* SEE ALSO
6670321936Shselasky*********/
6671321936Shselasky
6672321936Shselasky/****f* IBA Base: Types/ib_switch_info_set_life_time
6673321936Shselasky* NAME
6674321936Shselasky*	ib_switch_info_set_life_time
6675321936Shselasky*
6676321936Shselasky* DESCRIPTION
6677321936Shselasky*	Sets the value of LifeTimeValue.
6678321936Shselasky*
6679321936Shselasky* SYNOPSIS
6680321936Shselasky*/
6681321936Shselaskystatic inline void OSM_API
6682321936Shselaskyib_switch_info_set_life_time(IN ib_switch_info_t * const p_si,
6683321936Shselasky			     IN const uint8_t life_time_val)
6684321936Shselasky{
6685321936Shselasky	p_si->life_state = (p_si->life_state & 0x1f) |
6686321936Shselasky			   (life_time_val << 3);
6687321936Shselasky}
6688321936Shselasky
6689321936Shselasky/*
6690321936Shselasky* PARAMETERS
6691321936Shselasky*	p_si
6692321936Shselasky*		[in] Pointer to a SwitchInfo attribute.
6693321936Shselasky*	life_time_val
6694321936Shselasky*		[in] LiveTimeValue.
6695321936Shselasky*
6696321936Shselasky* RETURN VALUES
6697321936Shselasky*	None.
6698321936Shselasky*
6699321936Shselasky* NOTES
6700321936Shselasky*
6701321936Shselasky* SEE ALSO
6702321936Shselasky*********/
6703321936Shselasky
6704321936Shselasky/****f* IBA Base: Types/ib_switch_info_is_enhanced_port0
6705321936Shselasky* NAME
6706321936Shselasky*	ib_switch_info_is_enhanced_port0
6707321936Shselasky*
6708321936Shselasky* DESCRIPTION
6709321936Shselasky*	Returns TRUE if the enhancedPort0 bit is on (meaning the switch
6710321936Shselasky*  port zero supports enhanced functions).
6711321936Shselasky*  Returns FALSE otherwise.
6712321936Shselasky*
6713321936Shselasky* SYNOPSIS
6714321936Shselasky*/
6715321936Shselaskystatic inline boolean_t OSM_API
6716321936Shselaskyib_switch_info_is_enhanced_port0(IN const ib_switch_info_t * const p_si)
6717321936Shselasky{
6718321936Shselasky	return ((p_si->flags & 0x08) == 0x08);
6719321936Shselasky}
6720321936Shselasky
6721321936Shselasky/*
6722321936Shselasky* PARAMETERS
6723321936Shselasky*	p_si
6724321936Shselasky*		[in] Pointer to a SwitchInfo attribute.
6725321936Shselasky*
6726321936Shselasky* RETURN VALUES
6727321936Shselasky*	Returns TRUE if the switch supports enhanced port 0. FALSE otherwise.
6728321936Shselasky*
6729321936Shselasky* NOTES
6730321936Shselasky*
6731321936Shselasky* SEE ALSO
6732321936Shselasky*********/
6733321936Shselasky
6734321936Shselasky/****s* IBA Base: Types/ib_guid_info_t
6735321936Shselasky* NAME
6736321936Shselasky*	ib_guid_info_t
6737321936Shselasky*
6738321936Shselasky* DESCRIPTION
6739321936Shselasky*	IBA defined GuidInfo. (14.2.5.5)
6740321936Shselasky*
6741321936Shselasky* SYNOPSIS
6742321936Shselasky*/
6743321936Shselasky#define	GUID_TABLE_MAX_ENTRIES		8
6744321936Shselasky
6745321936Shselasky#include <complib/cl_packon.h>
6746321936Shselaskytypedef struct _ib_guid_info {
6747321936Shselasky	ib_net64_t guid[GUID_TABLE_MAX_ENTRIES];
6748321936Shselasky} PACK_SUFFIX ib_guid_info_t;
6749321936Shselasky#include <complib/cl_packoff.h>
6750321936Shselasky/************/
6751321936Shselasky
6752321936Shselasky#include <complib/cl_packon.h>
6753321936Shselaskytypedef struct _ib_guidinfo_record {
6754321936Shselasky	ib_net16_t lid;
6755321936Shselasky	uint8_t block_num;
6756321936Shselasky	uint8_t resv;
6757321936Shselasky	uint32_t reserved;
6758321936Shselasky	ib_guid_info_t guid_info;
6759321936Shselasky} PACK_SUFFIX ib_guidinfo_record_t;
6760321936Shselasky#include <complib/cl_packoff.h>
6761321936Shselasky
6762321936Shselasky#define IB_MULTIPATH_MAX_GIDS 11	/* Support max that can fit into first MAD (for now) */
6763321936Shselasky
6764321936Shselasky#include <complib/cl_packon.h>
6765321936Shselaskytypedef struct _ib_multipath_rec_t {
6766321936Shselasky	ib_net32_t hop_flow_raw;
6767321936Shselasky	uint8_t tclass;
6768321936Shselasky	uint8_t num_path;
6769321936Shselasky	ib_net16_t pkey;
6770321936Shselasky	ib_net16_t qos_class_sl;
6771321936Shselasky	uint8_t mtu;
6772321936Shselasky	uint8_t rate;
6773321936Shselasky	uint8_t pkt_life;
6774321936Shselasky	uint8_t service_id_8msb;
6775321936Shselasky	uint8_t independence;	/* formerly resv2 */
6776321936Shselasky	uint8_t sgid_count;
6777321936Shselasky	uint8_t dgid_count;
6778321936Shselasky	uint8_t service_id_56lsb[7];
6779321936Shselasky	ib_gid_t gids[IB_MULTIPATH_MAX_GIDS];
6780321936Shselasky} PACK_SUFFIX ib_multipath_rec_t;
6781321936Shselasky#include <complib/cl_packoff.h>
6782321936Shselasky/*
6783321936Shselasky* FIELDS
6784321936Shselasky*       hop_flow_raw
6785321936Shselasky*               Global routing parameters: hop count, flow label and raw bit.
6786321936Shselasky*
6787321936Shselasky*       tclass
6788321936Shselasky*               Another global routing parameter.
6789321936Shselasky*
6790321936Shselasky*       num_path
6791321936Shselasky*     Reversible path - 1 bit to say if path is reversible.
6792321936Shselasky*               num_path [6:0] In queries, maximum number of paths to return.
6793321936Shselasky*               In responses, undefined.
6794321936Shselasky*
6795321936Shselasky*       pkey
6796321936Shselasky*               Partition key (P_Key) to use on this path.
6797321936Shselasky*
6798321936Shselasky*       qos_class_sl
6799321936Shselasky*               QoS class and service level to use on this path.
6800321936Shselasky*
6801321936Shselasky*       mtu
6802321936Shselasky*               MTU and MTU selector fields to use on this path
6803321936Shselasky*       rate
6804321936Shselasky*               Rate and rate selector fields to use on this path.
6805321936Shselasky*
6806321936Shselasky*       pkt_life
6807321936Shselasky*               Packet lifetime
6808321936Shselasky*
6809321936Shselasky*	service_id_8msb
6810321936Shselasky*		8 most significant bits of Service ID
6811321936Shselasky*
6812321936Shselasky*	service_id_56lsb
6813321936Shselasky*		56 least significant bits of Service ID
6814321936Shselasky*
6815321936Shselasky*       preference
6816321936Shselasky*               Indicates the relative merit of this path versus other path
6817321936Shselasky*               records returned from the SA.  Lower numbers are better.
6818321936Shselasky*
6819321936Shselasky* SEE ALSO
6820321936Shselasky*********/
6821321936Shselasky
6822321936Shselasky/****f* IBA Base: Types/ib_multipath_rec_num_path
6823321936Shselasky* NAME
6824321936Shselasky*       ib_multipath_rec_num_path
6825321936Shselasky*
6826321936Shselasky* DESCRIPTION
6827321936Shselasky*       Get max number of paths to return.
6828321936Shselasky*
6829321936Shselasky* SYNOPSIS
6830321936Shselasky*/
6831321936Shselaskystatic inline uint8_t OSM_API
6832321936Shselaskyib_multipath_rec_num_path(IN const ib_multipath_rec_t * const p_rec)
6833321936Shselasky{
6834321936Shselasky	return (p_rec->num_path & 0x7F);
6835321936Shselasky}
6836321936Shselasky
6837321936Shselasky/*
6838321936Shselasky* PARAMETERS
6839321936Shselasky*       p_rec
6840321936Shselasky*               [in] Pointer to the multipath record object.
6841321936Shselasky*
6842321936Shselasky* RETURN VALUES
6843321936Shselasky*       Maximum number of paths to return for each unique SGID_DGID combination.
6844321936Shselasky*
6845321936Shselasky* NOTES
6846321936Shselasky*
6847321936Shselasky* SEE ALSO
6848321936Shselasky*       ib_multipath_rec_t
6849321936Shselasky*********/
6850321936Shselasky
6851321936Shselasky/****f* IBA Base: Types/ib_multipath_rec_set_sl
6852321936Shselasky* NAME
6853321936Shselasky*	ib_multipath_rec_set_sl
6854321936Shselasky*
6855321936Shselasky* DESCRIPTION
6856321936Shselasky*	Set path service level.
6857321936Shselasky*
6858321936Shselasky* SYNOPSIS
6859321936Shselasky*/
6860321936Shselaskystatic inline void OSM_API
6861321936Shselaskyib_multipath_rec_set_sl(
6862321936Shselasky	IN ib_multipath_rec_t* const p_rec,
6863321936Shselasky	IN const uint8_t sl )
6864321936Shselasky{
6865321936Shselasky	p_rec->qos_class_sl =
6866321936Shselasky		(p_rec->qos_class_sl & CL_HTON16(IB_MULTIPATH_REC_QOS_CLASS_MASK)) |
6867321936Shselasky			cl_hton16(sl & IB_MULTIPATH_REC_SL_MASK);
6868321936Shselasky}
6869321936Shselasky/*
6870321936Shselasky* PARAMETERS
6871321936Shselasky*	p_rec
6872321936Shselasky*		[in] Pointer to the MultiPath record object.
6873321936Shselasky*
6874321936Shselasky*	sl
6875321936Shselasky*		[in] Service level to set.
6876321936Shselasky*
6877321936Shselasky* RETURN VALUES
6878321936Shselasky*	None
6879321936Shselasky*
6880321936Shselasky* NOTES
6881321936Shselasky*
6882321936Shselasky* SEE ALSO
6883321936Shselasky*	ib_multipath_rec_t
6884321936Shselasky*********/
6885321936Shselasky
6886321936Shselasky/****f* IBA Base: Types/ib_multipath_rec_sl
6887321936Shselasky* NAME
6888321936Shselasky*       ib_multipath_rec_sl
6889321936Shselasky*
6890321936Shselasky* DESCRIPTION
6891321936Shselasky*       Get multipath service level.
6892321936Shselasky*
6893321936Shselasky* SYNOPSIS
6894321936Shselasky*/
6895321936Shselaskystatic inline uint8_t OSM_API
6896321936Shselaskyib_multipath_rec_sl(IN const ib_multipath_rec_t * const p_rec)
6897321936Shselasky{
6898321936Shselasky	return ((uint8_t) ((cl_ntoh16(p_rec->qos_class_sl)) & IB_MULTIPATH_REC_SL_MASK));
6899321936Shselasky}
6900321936Shselasky
6901321936Shselasky/*
6902321936Shselasky* PARAMETERS
6903321936Shselasky*       p_rec
6904321936Shselasky*               [in] Pointer to the multipath record object.
6905321936Shselasky*
6906321936Shselasky* RETURN VALUES
6907321936Shselasky*	SL.
6908321936Shselasky*
6909321936Shselasky* NOTES
6910321936Shselasky*
6911321936Shselasky* SEE ALSO
6912321936Shselasky*       ib_multipath_rec_t
6913321936Shselasky*********/
6914321936Shselasky
6915321936Shselasky/****f* IBA Base: Types/ib_multipath_rec_set_qos_class
6916321936Shselasky* NAME
6917321936Shselasky*	ib_multipath_rec_set_qos_class
6918321936Shselasky*
6919321936Shselasky* DESCRIPTION
6920321936Shselasky*	Set path QoS class.
6921321936Shselasky*
6922321936Shselasky* SYNOPSIS
6923321936Shselasky*/
6924321936Shselaskystatic inline void	OSM_API
6925321936Shselaskyib_multipath_rec_set_qos_class(
6926321936Shselasky	IN ib_multipath_rec_t* const p_rec,
6927321936Shselasky	IN const uint16_t qos_class )
6928321936Shselasky{
6929321936Shselasky	p_rec->qos_class_sl =
6930321936Shselasky		(p_rec->qos_class_sl & CL_HTON16(IB_MULTIPATH_REC_SL_MASK)) |
6931321936Shselasky			cl_hton16(qos_class << 4);
6932321936Shselasky}
6933321936Shselasky/*
6934321936Shselasky* PARAMETERS
6935321936Shselasky*	p_rec
6936321936Shselasky*		[in] Pointer to the MultiPath record object.
6937321936Shselasky*
6938321936Shselasky*	qos_class
6939321936Shselasky*		[in] QoS class to set.
6940321936Shselasky*
6941321936Shselasky* RETURN VALUES
6942321936Shselasky*	None
6943321936Shselasky*
6944321936Shselasky* NOTES
6945321936Shselasky*
6946321936Shselasky* SEE ALSO
6947321936Shselasky*	ib_multipath_rec_t
6948321936Shselasky*********/
6949321936Shselasky
6950321936Shselasky/****f* IBA Base: Types/ib_multipath_rec_qos_class
6951321936Shselasky* NAME
6952321936Shselasky*	ib_multipath_rec_qos_class
6953321936Shselasky*
6954321936Shselasky* DESCRIPTION
6955321936Shselasky*	Get QoS class.
6956321936Shselasky*
6957321936Shselasky* SYNOPSIS
6958321936Shselasky*/
6959321936Shselaskystatic inline uint16_t	OSM_API
6960321936Shselaskyib_multipath_rec_qos_class(
6961321936Shselasky	IN	const	ib_multipath_rec_t* const	p_rec )
6962321936Shselasky{
6963321936Shselasky	return (cl_ntoh16( p_rec->qos_class_sl ) >> 4);
6964321936Shselasky}
6965321936Shselasky/*
6966321936Shselasky* PARAMETERS
6967321936Shselasky*	p_rec
6968321936Shselasky*		[in] Pointer to the MultiPath record object.
6969321936Shselasky*
6970321936Shselasky* RETURN VALUES
6971321936Shselasky*	QoS class of the MultiPath record.
6972321936Shselasky*
6973321936Shselasky* NOTES
6974321936Shselasky*
6975321936Shselasky* SEE ALSO
6976321936Shselasky*	ib_multipath_rec_t
6977321936Shselasky*********/
6978321936Shselasky
6979321936Shselasky/****f* IBA Base: Types/ib_multipath_rec_mtu
6980321936Shselasky* NAME
6981321936Shselasky*       ib_multipath_rec_mtu
6982321936Shselasky*
6983321936Shselasky* DESCRIPTION
6984321936Shselasky*       Get encoded path MTU.
6985321936Shselasky*
6986321936Shselasky* SYNOPSIS
6987321936Shselasky*/
6988321936Shselaskystatic inline uint8_t OSM_API
6989321936Shselaskyib_multipath_rec_mtu(IN const ib_multipath_rec_t * const p_rec)
6990321936Shselasky{
6991321936Shselasky	return ((uint8_t) (p_rec->mtu & IB_MULTIPATH_REC_BASE_MASK));
6992321936Shselasky}
6993321936Shselasky
6994321936Shselasky/*
6995321936Shselasky* PARAMETERS
6996321936Shselasky*       p_rec
6997321936Shselasky*               [in] Pointer to the multipath record object.
6998321936Shselasky*
6999321936Shselasky* RETURN VALUES
7000321936Shselasky*       Encoded path MTU.
7001321936Shselasky*               1: 256
7002321936Shselasky*               2: 512
7003321936Shselasky*               3: 1024
7004321936Shselasky*               4: 2048
7005321936Shselasky*               5: 4096
7006321936Shselasky*               others: reserved
7007321936Shselasky*
7008321936Shselasky* NOTES
7009321936Shselasky*
7010321936Shselasky* SEE ALSO
7011321936Shselasky*       ib_multipath_rec_t
7012321936Shselasky*********/
7013321936Shselasky
7014321936Shselasky/****f* IBA Base: Types/ib_multipath_rec_mtu_sel
7015321936Shselasky* NAME
7016321936Shselasky*       ib_multipath_rec_mtu_sel
7017321936Shselasky*
7018321936Shselasky* DESCRIPTION
7019321936Shselasky*       Get encoded multipath MTU selector.
7020321936Shselasky*
7021321936Shselasky* SYNOPSIS
7022321936Shselasky*/
7023321936Shselaskystatic inline uint8_t OSM_API
7024321936Shselaskyib_multipath_rec_mtu_sel(IN const ib_multipath_rec_t * const p_rec)
7025321936Shselasky{
7026321936Shselasky	return ((uint8_t) ((p_rec->mtu & IB_MULTIPATH_REC_SELECTOR_MASK) >> 6));
7027321936Shselasky}
7028321936Shselasky
7029321936Shselasky/*
7030321936Shselasky* PARAMETERS
7031321936Shselasky*       p_rec
7032321936Shselasky*               [in] Pointer to the multipath record object.
7033321936Shselasky*
7034321936Shselasky* RETURN VALUES
7035321936Shselasky*       Encoded path MTU selector value (for queries).
7036321936Shselasky*               0: greater than MTU specified
7037321936Shselasky*               1: less than MTU specified
7038321936Shselasky*               2: exactly the MTU specified
7039321936Shselasky*               3: largest MTU available
7040321936Shselasky*
7041321936Shselasky* NOTES
7042321936Shselasky*
7043321936Shselasky* SEE ALSO
7044321936Shselasky*       ib_multipath_rec_t
7045321936Shselasky*********/
7046321936Shselasky
7047321936Shselasky/****f* IBA Base: Types/ib_multipath_rec_rate
7048321936Shselasky* NAME
7049321936Shselasky*	ib_multipath_rec_rate
7050321936Shselasky*
7051321936Shselasky* DESCRIPTION
7052321936Shselasky*	Get encoded multipath rate.
7053321936Shselasky*
7054321936Shselasky* SYNOPSIS
7055321936Shselasky*/
7056321936Shselaskystatic inline uint8_t OSM_API
7057321936Shselaskyib_multipath_rec_rate(IN const ib_multipath_rec_t * const p_rec)
7058321936Shselasky{
7059321936Shselasky	return ((uint8_t) (p_rec->rate & IB_MULTIPATH_REC_BASE_MASK));
7060321936Shselasky}
7061321936Shselasky
7062321936Shselasky/*
7063321936Shselasky* PARAMETERS
7064321936Shselasky*	p_rec
7065321936Shselasky*		[in] Pointer to the multipath record object.
7066321936Shselasky*
7067321936Shselasky* RETURN VALUES
7068321936Shselasky*	Encoded multipath rate.
7069321936Shselasky*		2: 2.5 Gb/sec.
7070321936Shselasky*		3: 10 Gb/sec.
7071321936Shselasky*		4: 30 Gb/sec.
7072321936Shselasky*		5: 5 Gb/sec.
7073321936Shselasky*		6: 20 Gb/sec.
7074321936Shselasky*		7: 40 Gb/sec.
7075321936Shselasky*		8: 60 Gb/sec.
7076321936Shselasky*		9: 80 Gb/sec.
7077321936Shselasky*		10: 120 Gb/sec.
7078321936Shselasky*		11: 14 Gb/sec.
7079321936Shselasky*		12: 56 Gb/sec.
7080321936Shselasky*		13: 112 Gb/sec.
7081321936Shselasky*		14: 168 Gb/sec.
7082321936Shselasky*		15: 25 Gb/sec.
7083321936Shselasky*		16: 100 Gb/sec.
7084321936Shselasky*		17: 200 Gb/sec.
7085321936Shselasky*		18: 300 Gb/sec.
7086321936Shselasky*               others: reserved
7087321936Shselasky*
7088321936Shselasky* NOTES
7089321936Shselasky*
7090321936Shselasky* SEE ALSO
7091321936Shselasky*       ib_multipath_rec_t
7092321936Shselasky*********/
7093321936Shselasky
7094321936Shselasky/****f* IBA Base: Types/ib_multipath_rec_rate_sel
7095321936Shselasky* NAME
7096321936Shselasky*       ib_multipath_rec_rate_sel
7097321936Shselasky*
7098321936Shselasky* DESCRIPTION
7099321936Shselasky*       Get encoded multipath rate selector.
7100321936Shselasky*
7101321936Shselasky* SYNOPSIS
7102321936Shselasky*/
7103321936Shselaskystatic inline uint8_t OSM_API
7104321936Shselaskyib_multipath_rec_rate_sel(IN const ib_multipath_rec_t * const p_rec)
7105321936Shselasky{
7106321936Shselasky	return ((uint8_t)
7107321936Shselasky		((p_rec->rate & IB_MULTIPATH_REC_SELECTOR_MASK) >> 6));
7108321936Shselasky}
7109321936Shselasky
7110321936Shselasky/*
7111321936Shselasky* PARAMETERS
7112321936Shselasky*       p_rec
7113321936Shselasky*               [in] Pointer to the multipath record object.
7114321936Shselasky*
7115321936Shselasky* RETURN VALUES
7116321936Shselasky*       Encoded path rate selector value (for queries).
7117321936Shselasky*               0: greater than rate specified
7118321936Shselasky*               1: less than rate specified
7119321936Shselasky*               2: exactly the rate specified
7120321936Shselasky*               3: largest rate available
7121321936Shselasky*
7122321936Shselasky* NOTES
7123321936Shselasky*
7124321936Shselasky* SEE ALSO
7125321936Shselasky*       ib_multipath_rec_t
7126321936Shselasky*********/
7127321936Shselasky
7128321936Shselasky/****f* IBA Base: Types/ib_multipath_rec_pkt_life
7129321936Shselasky* NAME
7130321936Shselasky*       ib_multipath_rec_pkt_life
7131321936Shselasky*
7132321936Shselasky* DESCRIPTION
7133321936Shselasky*       Get encoded multipath pkt_life.
7134321936Shselasky*
7135321936Shselasky* SYNOPSIS
7136321936Shselasky*/
7137321936Shselaskystatic inline uint8_t OSM_API
7138321936Shselaskyib_multipath_rec_pkt_life(IN const ib_multipath_rec_t * const p_rec)
7139321936Shselasky{
7140321936Shselasky	return ((uint8_t) (p_rec->pkt_life & IB_MULTIPATH_REC_BASE_MASK));
7141321936Shselasky}
7142321936Shselasky
7143321936Shselasky/*
7144321936Shselasky* PARAMETERS
7145321936Shselasky*       p_rec
7146321936Shselasky*               [in] Pointer to the multipath record object.
7147321936Shselasky*
7148321936Shselasky* RETURN VALUES
7149321936Shselasky*       Encoded multipath pkt_life = 4.096 usec * 2 ** PacketLifeTime.
7150321936Shselasky*
7151321936Shselasky* NOTES
7152321936Shselasky*
7153321936Shselasky* SEE ALSO
7154321936Shselasky*       ib_multipath_rec_t
7155321936Shselasky*********/
7156321936Shselasky
7157321936Shselasky/****f* IBA Base: Types/ib_multipath_rec_pkt_life_sel
7158321936Shselasky* NAME
7159321936Shselasky*       ib_multipath_rec_pkt_life_sel
7160321936Shselasky*
7161321936Shselasky* DESCRIPTION
7162321936Shselasky*       Get encoded multipath pkt_lifetime selector.
7163321936Shselasky*
7164321936Shselasky* SYNOPSIS
7165321936Shselasky*/
7166321936Shselaskystatic inline uint8_t OSM_API
7167321936Shselaskyib_multipath_rec_pkt_life_sel(IN const ib_multipath_rec_t * const p_rec)
7168321936Shselasky{
7169321936Shselasky	return ((uint8_t)
7170321936Shselasky		((p_rec->pkt_life & IB_MULTIPATH_REC_SELECTOR_MASK) >> 6));
7171321936Shselasky}
7172321936Shselasky
7173321936Shselasky/*
7174321936Shselasky* PARAMETERS
7175321936Shselasky*       p_rec
7176321936Shselasky*               [in] Pointer to the multipath record object.
7177321936Shselasky*
7178321936Shselasky* RETURN VALUES
7179321936Shselasky*       Encoded path pkt_lifetime selector value (for queries).
7180321936Shselasky*               0: greater than rate specified
7181321936Shselasky*               1: less than rate specified
7182321936Shselasky*               2: exactly the rate specified
7183321936Shselasky*               3: smallest packet lifetime available
7184321936Shselasky*
7185321936Shselasky* NOTES
7186321936Shselasky*
7187321936Shselasky* SEE ALSO
7188321936Shselasky*       ib_multipath_rec_t
7189321936Shselasky*********/
7190321936Shselasky
7191321936Shselasky/****f* IBA Base: Types/ib_multipath_rec_service_id
7192321936Shselasky* NAME
7193321936Shselasky*	ib_multipath_rec_service_id
7194321936Shselasky*
7195321936Shselasky* DESCRIPTION
7196321936Shselasky*	Get multipath service id.
7197321936Shselasky*
7198321936Shselasky* SYNOPSIS
7199321936Shselasky*/
7200321936Shselaskystatic inline ib_net64_t OSM_API
7201321936Shselaskyib_multipath_rec_service_id(IN const ib_multipath_rec_t * const p_rec)
7202321936Shselasky{
7203321936Shselasky	union {
7204321936Shselasky		ib_net64_t sid;
7205321936Shselasky		uint8_t sid_arr[8];
7206321936Shselasky	} sid_union;
7207321936Shselasky	sid_union.sid_arr[0] = p_rec->service_id_8msb;
7208321936Shselasky	memcpy(&sid_union.sid_arr[1], p_rec->service_id_56lsb, 7);
7209321936Shselasky	return sid_union.sid;
7210321936Shselasky}
7211321936Shselasky
7212321936Shselasky/*
7213321936Shselasky* PARAMETERS
7214321936Shselasky*	p_rec
7215321936Shselasky*		[in] Pointer to the multipath record object.
7216321936Shselasky*
7217321936Shselasky* RETURN VALUES
7218321936Shselasky*	Service ID
7219321936Shselasky*
7220321936Shselasky* NOTES
7221321936Shselasky*
7222321936Shselasky* SEE ALSO
7223321936Shselasky*	ib_multipath_rec_t
7224321936Shselasky*********/
7225321936Shselasky
7226321936Shselasky#define IB_NUM_PKEY_ELEMENTS_IN_BLOCK		32
7227321936Shselasky/****s* IBA Base: Types/ib_pkey_table_t
7228321936Shselasky* NAME
7229321936Shselasky*	ib_pkey_table_t
7230321936Shselasky*
7231321936Shselasky* DESCRIPTION
7232321936Shselasky*	IBA defined PKey table. (14.2.5.7)
7233321936Shselasky*
7234321936Shselasky* SYNOPSIS
7235321936Shselasky*/
7236321936Shselasky
7237321936Shselasky#include <complib/cl_packon.h>
7238321936Shselaskytypedef struct _ib_pkey_table {
7239321936Shselasky	ib_net16_t pkey_entry[IB_NUM_PKEY_ELEMENTS_IN_BLOCK];
7240321936Shselasky} PACK_SUFFIX ib_pkey_table_t;
7241321936Shselasky#include <complib/cl_packoff.h>
7242321936Shselasky/************/
7243321936Shselasky
7244321936Shselasky/****s* IBA Base: Types/ib_pkey_table_record_t
7245321936Shselasky* NAME
7246321936Shselasky*	ib_pkey_table_record_t
7247321936Shselasky*
7248321936Shselasky* DESCRIPTION
7249321936Shselasky*	IBA defined P_Key Table Record for SA Query. (15.2.5.11)
7250321936Shselasky*
7251321936Shselasky* SYNOPSIS
7252321936Shselasky*/
7253321936Shselasky#include <complib/cl_packon.h>
7254321936Shselaskytypedef struct _ib_pkey_table_record {
7255321936Shselasky	ib_net16_t lid;		// for CA: lid of port, for switch lid of port 0
7256321936Shselasky	ib_net16_t block_num;
7257321936Shselasky	uint8_t port_num;	// for switch: port number, for CA: reserved
7258321936Shselasky	uint8_t reserved1;
7259321936Shselasky	uint16_t reserved2;
7260321936Shselasky	ib_pkey_table_t pkey_tbl;
7261321936Shselasky} PACK_SUFFIX ib_pkey_table_record_t;
7262321936Shselasky#include <complib/cl_packoff.h>
7263321936Shselasky/************/
7264321936Shselasky
7265321936Shselasky#define IB_DROP_VL 15
7266321936Shselasky#define IB_MAX_NUM_VLS 16
7267321936Shselasky/****s* IBA Base: Types/ib_slvl_table_t
7268321936Shselasky* NAME
7269321936Shselasky*	ib_slvl_table_t
7270321936Shselasky*
7271321936Shselasky* DESCRIPTION
7272321936Shselasky*	IBA defined SL2VL Mapping Table Attribute. (14.2.5.8)
7273321936Shselasky*
7274321936Shselasky* SYNOPSIS
7275321936Shselasky*/
7276321936Shselasky#include <complib/cl_packon.h>
7277321936Shselaskytypedef struct _ib_slvl_table {
7278321936Shselasky	uint8_t raw_vl_by_sl[IB_MAX_NUM_VLS / 2];
7279321936Shselasky} PACK_SUFFIX ib_slvl_table_t;
7280321936Shselasky#include <complib/cl_packoff.h>
7281321936Shselasky/************/
7282321936Shselasky
7283321936Shselasky/****s* IBA Base: Types/ib_slvl_table_record_t
7284321936Shselasky* NAME
7285321936Shselasky*	ib_slvl_table_record_t
7286321936Shselasky*
7287321936Shselasky* DESCRIPTION
7288321936Shselasky*	IBA defined SL to VL Mapping Table Record for SA Query. (15.2.5.4)
7289321936Shselasky*
7290321936Shselasky* SYNOPSIS
7291321936Shselasky*/
7292321936Shselasky#include <complib/cl_packon.h>
7293321936Shselaskytypedef struct _ib_slvl_table_record {
7294321936Shselasky	ib_net16_t lid;		// for CA: lid of port, for switch lid of port 0
7295321936Shselasky	uint8_t in_port_num;	// reserved for CAs
7296321936Shselasky	uint8_t out_port_num;	// reserved for CAs
7297321936Shselasky	uint32_t resv;
7298321936Shselasky	ib_slvl_table_t slvl_tbl;
7299321936Shselasky} PACK_SUFFIX ib_slvl_table_record_t;
7300321936Shselasky#include <complib/cl_packoff.h>
7301321936Shselasky/************/
7302321936Shselasky
7303321936Shselasky/****f* IBA Base: Types/ib_slvl_table_set
7304321936Shselasky* NAME
7305321936Shselasky*	ib_slvl_table_set
7306321936Shselasky*
7307321936Shselasky* DESCRIPTION
7308321936Shselasky*	Set slvl table entry.
7309321936Shselasky*
7310321936Shselasky* SYNOPSIS
7311321936Shselasky*/
7312321936Shselaskystatic inline void OSM_API
7313321936Shselaskyib_slvl_table_set(IN ib_slvl_table_t * p_slvl_tbl,
7314321936Shselasky		  IN uint8_t sl_index, IN uint8_t vl)
7315321936Shselasky{
7316321936Shselasky	uint8_t idx = sl_index / 2;
7317321936Shselasky	CL_ASSERT(vl <= 15);
7318321936Shselasky	CL_ASSERT(sl_index <= 15);
7319321936Shselasky
7320321936Shselasky	if (sl_index % 2)
7321321936Shselasky		/* this is an odd sl. Need to update the ls bits */
7322321936Shselasky		p_slvl_tbl->raw_vl_by_sl[idx] =
7323321936Shselasky		    (p_slvl_tbl->raw_vl_by_sl[idx] & 0xF0) | vl;
7324321936Shselasky	else
7325321936Shselasky		/* this is an even sl. Need to update the ms bits */
7326321936Shselasky		p_slvl_tbl->raw_vl_by_sl[idx] =
7327321936Shselasky		    (vl << 4) | (p_slvl_tbl->raw_vl_by_sl[idx] & 0x0F);
7328321936Shselasky}
7329321936Shselasky
7330321936Shselasky/*
7331321936Shselasky* PARAMETERS
7332321936Shselasky*	p_slvl_tbl
7333321936Shselasky*		[in] pointer to ib_slvl_table_t object.
7334321936Shselasky*
7335321936Shselasky*	sl_index
7336321936Shselasky*		[in] the sl index in the table to be updated.
7337321936Shselasky*
7338321936Shselasky*	vl
7339321936Shselasky*		[in] the vl value to update for that sl.
7340321936Shselasky*
7341321936Shselasky* RETURN VALUES
7342321936Shselasky*	None
7343321936Shselasky*
7344321936Shselasky* NOTES
7345321936Shselasky*
7346321936Shselasky* SEE ALSO
7347321936Shselasky*	ib_slvl_table_t
7348321936Shselasky*********/
7349321936Shselasky
7350321936Shselasky/****f* IBA Base: Types/ib_slvl_table_get
7351321936Shselasky* NAME
7352321936Shselasky*	ib_slvl_table_get
7353321936Shselasky*
7354321936Shselasky* DESCRIPTION
7355321936Shselasky*	Get slvl table entry.
7356321936Shselasky*
7357321936Shselasky* SYNOPSIS
7358321936Shselasky*/
7359321936Shselaskystatic inline uint8_t OSM_API
7360321936Shselaskyib_slvl_table_get(IN const ib_slvl_table_t * p_slvl_tbl, IN uint8_t sl_index)
7361321936Shselasky{
7362321936Shselasky	uint8_t idx = sl_index / 2;
7363321936Shselasky	CL_ASSERT(sl_index <= 15);
7364321936Shselasky
7365321936Shselasky	if (sl_index % 2)
7366321936Shselasky		/* this is an odd sl. Need to return the ls bits. */
7367321936Shselasky		return (p_slvl_tbl->raw_vl_by_sl[idx] & 0x0F);
7368321936Shselasky	else
7369321936Shselasky		/* this is an even sl. Need to return the ms bits. */
7370321936Shselasky		return ((p_slvl_tbl->raw_vl_by_sl[idx] & 0xF0) >> 4);
7371321936Shselasky}
7372321936Shselasky
7373321936Shselasky/*
7374321936Shselasky* PARAMETERS
7375321936Shselasky*	p_slvl_tbl
7376321936Shselasky*		[in] pointer to ib_slvl_table_t object.
7377321936Shselasky*
7378321936Shselasky*	sl_index
7379321936Shselasky*		[in] the sl index in the table whose value should be returned.
7380321936Shselasky*
7381321936Shselasky* RETURN VALUES
7382321936Shselasky*	vl for the requested sl_index.
7383321936Shselasky*
7384321936Shselasky* NOTES
7385321936Shselasky*
7386321936Shselasky* SEE ALSO
7387321936Shselasky*	ib_slvl_table_t
7388321936Shselasky*********/
7389321936Shselasky
7390321936Shselasky/****s* IBA Base: Types/ib_vl_arb_element_t
7391321936Shselasky* NAME
7392321936Shselasky*	ib_vl_arb_element_t
7393321936Shselasky*
7394321936Shselasky* DESCRIPTION
7395321936Shselasky*	IBA defined VL Arbitration Table Element. (14.2.5.9)
7396321936Shselasky*
7397321936Shselasky* SYNOPSIS
7398321936Shselasky*/
7399321936Shselasky#include <complib/cl_packon.h>
7400321936Shselaskytypedef struct _ib_vl_arb_element {
7401321936Shselasky	uint8_t vl;
7402321936Shselasky	uint8_t weight;
7403321936Shselasky} PACK_SUFFIX ib_vl_arb_element_t;
7404321936Shselasky#include <complib/cl_packoff.h>
7405321936Shselasky/************/
7406321936Shselasky
7407321936Shselasky#define IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK 32
7408321936Shselasky
7409321936Shselasky/****s* IBA Base: Types/ib_vl_arb_table_t
7410321936Shselasky* NAME
7411321936Shselasky*	ib_vl_arb_table_t
7412321936Shselasky*
7413321936Shselasky* DESCRIPTION
7414321936Shselasky*	IBA defined VL Arbitration Table. (14.2.5.9)
7415321936Shselasky*
7416321936Shselasky* SYNOPSIS
7417321936Shselasky*/
7418321936Shselasky#include <complib/cl_packon.h>
7419321936Shselaskytypedef struct _ib_vl_arb_table {
7420321936Shselasky	ib_vl_arb_element_t vl_entry[IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK];
7421321936Shselasky} PACK_SUFFIX ib_vl_arb_table_t;
7422321936Shselasky#include <complib/cl_packoff.h>
7423321936Shselasky/************/
7424321936Shselasky
7425321936Shselasky/****s* IBA Base: Types/ib_vl_arb_table_record_t
7426321936Shselasky* NAME
7427321936Shselasky*	ib_vl_arb_table_record_t
7428321936Shselasky*
7429321936Shselasky* DESCRIPTION
7430321936Shselasky*	IBA defined VL Arbitration Table Record for SA Query. (15.2.5.9)
7431321936Shselasky*
7432321936Shselasky* SYNOPSIS
7433321936Shselasky*/
7434321936Shselasky#include <complib/cl_packon.h>
7435321936Shselaskytypedef struct _ib_vl_arb_table_record {
7436321936Shselasky	ib_net16_t lid;		// for CA: lid of port, for switch lid of port 0
7437321936Shselasky	uint8_t port_num;
7438321936Shselasky	uint8_t block_num;
7439321936Shselasky	uint32_t reserved;
7440321936Shselasky	ib_vl_arb_table_t vl_arb_tbl;
7441321936Shselasky} PACK_SUFFIX ib_vl_arb_table_record_t;
7442321936Shselasky#include <complib/cl_packoff.h>
7443321936Shselasky/************/
7444321936Shselasky
7445321936Shselasky/*
7446321936Shselasky *	Global route header information received with unreliable datagram messages
7447321936Shselasky */
7448321936Shselasky#include <complib/cl_packon.h>
7449321936Shselaskytypedef struct _ib_grh {
7450321936Shselasky	ib_net32_t ver_class_flow;
7451321936Shselasky	ib_net16_t resv1;
7452321936Shselasky	uint8_t resv2;
7453321936Shselasky	uint8_t hop_limit;
7454321936Shselasky	ib_gid_t src_gid;
7455321936Shselasky	ib_gid_t dest_gid;
7456321936Shselasky} PACK_SUFFIX ib_grh_t;
7457321936Shselasky#include <complib/cl_packoff.h>
7458321936Shselasky
7459321936Shselasky/****f* IBA Base: Types/ib_grh_get_ver_class_flow
7460321936Shselasky* NAME
7461321936Shselasky*	ib_grh_get_ver_class_flow
7462321936Shselasky*
7463321936Shselasky* DESCRIPTION
7464321936Shselasky*	Get encoded version, traffic class and flow label in grh
7465321936Shselasky*
7466321936Shselasky* SYNOPSIS
7467321936Shselasky*/
7468321936Shselaskystatic inline void OSM_API
7469321936Shselaskyib_grh_get_ver_class_flow(IN const ib_net32_t ver_class_flow,
7470321936Shselasky			  OUT uint8_t * const p_ver,
7471321936Shselasky			  OUT uint8_t * const p_tclass,
7472321936Shselasky			  OUT uint32_t * const p_flow_lbl)
7473321936Shselasky{
7474321936Shselasky	ib_net32_t tmp_ver_class_flow;
7475321936Shselasky
7476321936Shselasky	if (p_ver)
7477321936Shselasky		*p_ver = (uint8_t) (ver_class_flow & 0x0f);
7478321936Shselasky
7479321936Shselasky	tmp_ver_class_flow = ver_class_flow >> 4;
7480321936Shselasky
7481321936Shselasky	if (p_tclass)
7482321936Shselasky		*p_tclass = (uint8_t) (tmp_ver_class_flow & 0xff);
7483321936Shselasky
7484321936Shselasky	tmp_ver_class_flow = tmp_ver_class_flow >> 8;
7485321936Shselasky
7486321936Shselasky	if (p_flow_lbl)
7487321936Shselasky		*p_flow_lbl = tmp_ver_class_flow & 0xfffff;
7488321936Shselasky}
7489321936Shselasky
7490321936Shselasky/*
7491321936Shselasky* PARAMETERS
7492321936Shselasky*	ver_class_flow
7493321936Shselasky*		[in] the version, traffic class and flow label info.
7494321936Shselasky*
7495321936Shselasky* RETURN VALUES
7496321936Shselasky*	p_ver
7497321936Shselasky*		[out] pointer to the version info.
7498321936Shselasky*
7499321936Shselasky*	p_tclass
7500321936Shselasky*		[out] pointer to the traffic class info.
7501321936Shselasky*
7502321936Shselasky*	p_flow_lbl
7503321936Shselasky*		[out] pointer to the flow label info
7504321936Shselasky*
7505321936Shselasky* NOTES
7506321936Shselasky*
7507321936Shselasky* SEE ALSO
7508321936Shselasky*	ib_grh_t
7509321936Shselasky*********/
7510321936Shselasky
7511321936Shselasky/****f* IBA Base: Types/ib_grh_set_ver_class_flow
7512321936Shselasky* NAME
7513321936Shselasky*	ib_grh_set_ver_class_flow
7514321936Shselasky*
7515321936Shselasky* DESCRIPTION
7516321936Shselasky*	Set encoded version, traffic class and flow label in grh
7517321936Shselasky*
7518321936Shselasky* SYNOPSIS
7519321936Shselasky*/
7520321936Shselaskystatic inline ib_net32_t OSM_API
7521321936Shselaskyib_grh_set_ver_class_flow(IN const uint8_t ver,
7522321936Shselasky			  IN const uint8_t tclass, IN const uint32_t flow_lbl)
7523321936Shselasky{
7524321936Shselasky	ib_net32_t ver_class_flow;
7525321936Shselasky
7526321936Shselasky	ver_class_flow = flow_lbl;
7527321936Shselasky	ver_class_flow = ver_class_flow << 8;
7528321936Shselasky	ver_class_flow = ver_class_flow | tclass;
7529321936Shselasky	ver_class_flow = ver_class_flow << 4;
7530321936Shselasky	ver_class_flow = ver_class_flow | ver;
7531321936Shselasky	return (ver_class_flow);
7532321936Shselasky}
7533321936Shselasky
7534321936Shselasky/*
7535321936Shselasky* PARAMETERS
7536321936Shselasky*	ver
7537321936Shselasky*		[in] the version info.
7538321936Shselasky*
7539321936Shselasky*	tclass
7540321936Shselasky*		[in] the traffic class info.
7541321936Shselasky*
7542321936Shselasky*	flow_lbl
7543321936Shselasky*		[in] the flow label info
7544321936Shselasky*
7545321936Shselasky* RETURN VALUES
7546321936Shselasky*	ver_class_flow
7547321936Shselasky*		[out] the version, traffic class and flow label info.
7548321936Shselasky*
7549321936Shselasky* NOTES
7550321936Shselasky*
7551321936Shselasky* SEE ALSO
7552321936Shselasky*	ib_grh_t
7553321936Shselasky*********/
7554321936Shselasky
7555321936Shselasky/****s* IBA Base: Types/ib_member_rec_t
7556321936Shselasky* NAME
7557321936Shselasky*	ib_member_rec_t
7558321936Shselasky*
7559321936Shselasky* DESCRIPTION
7560321936Shselasky*	Multicast member record, used to create, join, and leave multicast
7561321936Shselasky*	groups.
7562321936Shselasky*
7563321936Shselasky* SYNOPSIS
7564321936Shselasky*/
7565321936Shselasky#include <complib/cl_packon.h>
7566321936Shselaskytypedef struct _ib_member_rec {
7567321936Shselasky	ib_gid_t mgid;
7568321936Shselasky	ib_gid_t port_gid;
7569321936Shselasky	ib_net32_t qkey;
7570321936Shselasky	ib_net16_t mlid;
7571321936Shselasky	uint8_t mtu;
7572321936Shselasky	uint8_t tclass;
7573321936Shselasky	ib_net16_t pkey;
7574321936Shselasky	uint8_t rate;
7575321936Shselasky	uint8_t pkt_life;
7576321936Shselasky	ib_net32_t sl_flow_hop;
7577321936Shselasky	uint8_t scope_state;
7578321936Shselasky	uint8_t proxy_join:1;
7579321936Shselasky	uint8_t reserved[2];
7580321936Shselasky	uint8_t pad[4];
7581321936Shselasky} PACK_SUFFIX ib_member_rec_t;
7582321936Shselasky#include <complib/cl_packoff.h>
7583321936Shselasky/*
7584321936Shselasky* FIELDS
7585321936Shselasky*	mgid
7586321936Shselasky*		Multicast GID address for this multicast group.
7587321936Shselasky*
7588321936Shselasky*	port_gid
7589321936Shselasky*		Valid GID of the endpoint joining this multicast group.
7590321936Shselasky*
7591321936Shselasky*	qkey
7592321936Shselasky*		Q_Key to be sued by this multicast group.
7593321936Shselasky*
7594321936Shselasky*	mlid
7595321936Shselasky*		Multicast LID for this multicast group.
7596321936Shselasky*
7597321936Shselasky*	mtu
7598321936Shselasky*		MTU and MTU selector fields to use on this path
7599321936Shselasky*
7600321936Shselasky*	tclass
7601321936Shselasky*		Another global routing parameter.
7602321936Shselasky*
7603321936Shselasky*	pkey
7604321936Shselasky*		Partition key (P_Key) to use for this member.
7605321936Shselasky*
7606321936Shselasky*	rate
7607321936Shselasky*		Rate and rate selector fields to use on this path.
7608321936Shselasky*
7609321936Shselasky*	pkt_life
7610321936Shselasky*		Packet lifetime
7611321936Shselasky*
7612321936Shselasky*	sl_flow_hop
7613321936Shselasky*		Global routing parameters: service level, hop count, and flow label.
7614321936Shselasky*
7615321936Shselasky*	scope_state
7616321936Shselasky*		MGID scope and JoinState of multicast request.
7617321936Shselasky*
7618321936Shselasky*	proxy_join
7619321936Shselasky*		Enables others in the Partition to proxy add/remove from the group
7620321936Shselasky*
7621321936Shselasky* SEE ALSO
7622321936Shselasky*********/
7623321936Shselasky
7624321936Shselasky/****f* IBA Base: Types/ib_member_get_sl_flow_hop
7625321936Shselasky* NAME
7626321936Shselasky*	ib_member_get_sl_flow_hop
7627321936Shselasky*
7628321936Shselasky* DESCRIPTION
7629321936Shselasky*	Get encoded sl, flow label, and hop limit
7630321936Shselasky*
7631321936Shselasky* SYNOPSIS
7632321936Shselasky*/
7633321936Shselaskystatic inline void OSM_API
7634321936Shselaskyib_member_get_sl_flow_hop(IN const ib_net32_t sl_flow_hop,
7635321936Shselasky			  OUT uint8_t * const p_sl,
7636321936Shselasky			  OUT uint32_t * const p_flow_lbl,
7637321936Shselasky			  OUT uint8_t * const p_hop)
7638321936Shselasky{
7639321936Shselasky	uint32_t tmp;
7640321936Shselasky
7641321936Shselasky	tmp = cl_ntoh32(sl_flow_hop);
7642321936Shselasky	if (p_hop)
7643321936Shselasky		*p_hop = (uint8_t) tmp;
7644321936Shselasky	tmp >>= 8;
7645321936Shselasky
7646321936Shselasky	if (p_flow_lbl)
7647321936Shselasky		*p_flow_lbl = (uint32_t) (tmp & 0xfffff);
7648321936Shselasky	tmp >>= 20;
7649321936Shselasky
7650321936Shselasky	if (p_sl)
7651321936Shselasky		*p_sl = (uint8_t) tmp;
7652321936Shselasky}
7653321936Shselasky
7654321936Shselasky/*
7655321936Shselasky* PARAMETERS
7656321936Shselasky*	sl_flow_hop
7657321936Shselasky*		[in] the sl, flow label, and hop limit of MC Group
7658321936Shselasky*
7659321936Shselasky* RETURN VALUES
7660321936Shselasky*	p_sl
7661321936Shselasky*		[out] pointer to the service level
7662321936Shselasky*
7663321936Shselasky*	p_flow_lbl
7664321936Shselasky*		[out] pointer to the flow label info
7665321936Shselasky*
7666321936Shselasky*	p_hop
7667321936Shselasky*		[out] pointer to the hop count limit.
7668321936Shselasky*
7669321936Shselasky* NOTES
7670321936Shselasky*
7671321936Shselasky* SEE ALSO
7672321936Shselasky*	ib_member_rec_t
7673321936Shselasky*********/
7674321936Shselasky
7675321936Shselasky/****f* IBA Base: Types/ib_member_set_sl_flow_hop
7676321936Shselasky* NAME
7677321936Shselasky*	ib_member_set_sl_flow_hop
7678321936Shselasky*
7679321936Shselasky* DESCRIPTION
7680321936Shselasky*	Set encoded sl, flow label, and hop limit
7681321936Shselasky*
7682321936Shselasky* SYNOPSIS
7683321936Shselasky*/
7684321936Shselaskystatic inline ib_net32_t OSM_API
7685321936Shselaskyib_member_set_sl_flow_hop(IN const uint8_t sl,
7686321936Shselasky			  IN const uint32_t flow_label,
7687321936Shselasky			  IN const uint8_t hop_limit)
7688321936Shselasky{
7689321936Shselasky	uint32_t tmp;
7690321936Shselasky
7691321936Shselasky	tmp = (sl << 28) | ((flow_label & 0xfffff) << 8) | hop_limit;
7692321936Shselasky	return cl_hton32(tmp);
7693321936Shselasky}
7694321936Shselasky
7695321936Shselasky/*
7696321936Shselasky* PARAMETERS
7697321936Shselasky*	sl
7698321936Shselasky*		[in] the service level.
7699321936Shselasky*
7700321936Shselasky*	flow_lbl
7701321936Shselasky*		[in] the flow label info
7702321936Shselasky*
7703321936Shselasky*	hop_limit
7704321936Shselasky*		[in] the hop limit.
7705321936Shselasky*
7706321936Shselasky* RETURN VALUES
7707321936Shselasky*	sl_flow_hop
7708321936Shselasky*		[out] the encoded sl, flow label, and hop limit
7709321936Shselasky*
7710321936Shselasky* NOTES
7711321936Shselasky*
7712321936Shselasky* SEE ALSO
7713321936Shselasky*	ib_member_rec_t
7714321936Shselasky*********/
7715321936Shselasky
7716321936Shselasky/****f* IBA Base: Types/ib_member_get_scope_state
7717321936Shselasky* NAME
7718321936Shselasky*	ib_member_get_scope_state
7719321936Shselasky*
7720321936Shselasky* DESCRIPTION
7721321936Shselasky*	Get encoded MGID scope and JoinState
7722321936Shselasky*
7723321936Shselasky* SYNOPSIS
7724321936Shselasky*/
7725321936Shselaskystatic inline void OSM_API
7726321936Shselaskyib_member_get_scope_state(IN const uint8_t scope_state,
7727321936Shselasky			  OUT uint8_t * const p_scope,
7728321936Shselasky			  OUT uint8_t * const p_state)
7729321936Shselasky{
7730321936Shselasky	uint8_t tmp_scope_state;
7731321936Shselasky
7732321936Shselasky	if (p_state)
7733321936Shselasky		*p_state = (uint8_t) (scope_state & 0x0f);
7734321936Shselasky
7735321936Shselasky	tmp_scope_state = scope_state >> 4;
7736321936Shselasky
7737321936Shselasky	if (p_scope)
7738321936Shselasky		*p_scope = (uint8_t) (tmp_scope_state & 0x0f);
7739321936Shselasky
7740321936Shselasky}
7741321936Shselasky
7742321936Shselasky/*
7743321936Shselasky* PARAMETERS
7744321936Shselasky*	scope_state
7745321936Shselasky*		[in] the scope and state
7746321936Shselasky*
7747321936Shselasky* RETURN VALUES
7748321936Shselasky*	p_scope
7749321936Shselasky*		[out] pointer to the MGID scope
7750321936Shselasky*
7751321936Shselasky*	p_state
7752321936Shselasky*		[out] pointer to the join state
7753321936Shselasky*
7754321936Shselasky* NOTES
7755321936Shselasky*
7756321936Shselasky* SEE ALSO
7757321936Shselasky*	ib_member_rec_t
7758321936Shselasky*********/
7759321936Shselasky
7760321936Shselasky/****f* IBA Base: Types/ib_member_set_scope_state
7761321936Shselasky* NAME
7762321936Shselasky*	ib_member_set_scope_state
7763321936Shselasky*
7764321936Shselasky* DESCRIPTION
7765321936Shselasky*	Set encoded version, MGID scope and JoinState
7766321936Shselasky*
7767321936Shselasky* SYNOPSIS
7768321936Shselasky*/
7769321936Shselaskystatic inline uint8_t OSM_API
7770321936Shselaskyib_member_set_scope_state(IN const uint8_t scope, IN const uint8_t state)
7771321936Shselasky{
7772321936Shselasky	uint8_t scope_state;
7773321936Shselasky
7774321936Shselasky	scope_state = scope;
7775321936Shselasky	scope_state = scope_state << 4;
7776321936Shselasky	scope_state = scope_state | state;
7777321936Shselasky	return (scope_state);
7778321936Shselasky}
7779321936Shselasky
7780321936Shselasky/*
7781321936Shselasky* PARAMETERS
7782321936Shselasky*	scope
7783321936Shselasky*		[in] the MGID scope
7784321936Shselasky*
7785321936Shselasky*	state
7786321936Shselasky*		[in] the JoinState
7787321936Shselasky*
7788321936Shselasky* RETURN VALUES
7789321936Shselasky*	scope_state
7790321936Shselasky*		[out] the encoded one
7791321936Shselasky*
7792321936Shselasky* NOTES
7793321936Shselasky*
7794321936Shselasky* SEE ALSO
7795321936Shselasky*	ib_member_rec_t
7796321936Shselasky*********/
7797321936Shselasky
7798321936Shselasky/****f* IBA Base: Types/ib_member_set_join_state
7799321936Shselasky* NAME
7800321936Shselasky*	ib_member_set_join_state
7801321936Shselasky*
7802321936Shselasky* DESCRIPTION
7803321936Shselasky*	Set JoinState
7804321936Shselasky*
7805321936Shselasky* SYNOPSIS
7806321936Shselasky*/
7807321936Shselaskystatic inline void OSM_API
7808321936Shselaskyib_member_set_join_state(IN OUT ib_member_rec_t * p_mc_rec,
7809321936Shselasky			 IN const uint8_t state)
7810321936Shselasky{
7811321936Shselasky	/* keep the scope as it is */
7812321936Shselasky	p_mc_rec->scope_state = (p_mc_rec->scope_state & 0xF0) | (0x0f & state);
7813321936Shselasky}
7814321936Shselasky
7815321936Shselasky/*
7816321936Shselasky* PARAMETERS
7817321936Shselasky*	p_mc_rec
7818321936Shselasky*		[in] pointer to the member record
7819321936Shselasky*
7820321936Shselasky*	state
7821321936Shselasky*		[in] the JoinState
7822321936Shselasky*
7823321936Shselasky* RETURN VALUES
7824321936Shselasky*	NONE
7825321936Shselasky*
7826321936Shselasky* NOTES
7827321936Shselasky*
7828321936Shselasky* SEE ALSO
7829321936Shselasky*	ib_member_rec_t
7830321936Shselasky*********/
7831321936Shselasky
7832321936Shselasky/*
7833321936Shselasky * Join State Codes:
7834321936Shselasky */
7835321936Shselasky#define IB_MC_REC_STATE_FULL_MEMBER 0x01
7836321936Shselasky#define IB_MC_REC_STATE_NON_MEMBER 0x02
7837321936Shselasky#define IB_MC_REC_STATE_SEND_ONLY_NON_MEMBER 0x04
7838321936Shselasky
7839321936Shselasky/*
7840321936Shselasky *	Generic MAD notice types
7841321936Shselasky */
7842321936Shselasky#define IB_NOTICE_TYPE_FATAL				0x00
7843321936Shselasky#define IB_NOTICE_TYPE_URGENT				0x01
7844321936Shselasky#define IB_NOTICE_TYPE_SECURITY				0x02
7845321936Shselasky#define IB_NOTICE_TYPE_SUBN_MGMT			0x03
7846321936Shselasky#define IB_NOTICE_TYPE_INFO				0x04
7847321936Shselasky#define IB_NOTICE_TYPE_EMPTY				0x7F
7848321936Shselasky
7849321936Shselasky#define SM_GID_IN_SERVICE_TRAP				64
7850321936Shselasky#define SM_GID_OUT_OF_SERVICE_TRAP			65
7851321936Shselasky#define SM_MGID_CREATED_TRAP				66
7852321936Shselasky#define SM_MGID_DESTROYED_TRAP				67
7853321936Shselasky#define SM_UNPATH_TRAP					68
7854321936Shselasky#define SM_REPATH_TRAP					69
7855321936Shselasky#define SM_LINK_STATE_CHANGED_TRAP			128
7856321936Shselasky#define SM_LINK_INTEGRITY_THRESHOLD_TRAP		129
7857321936Shselasky#define SM_BUFFER_OVERRUN_THRESHOLD_TRAP		130
7858321936Shselasky#define SM_WATCHDOG_TIMER_EXPIRED_TRAP			131
7859321936Shselasky#define SM_LOCAL_CHANGES_TRAP				144
7860321936Shselasky#define SM_SYS_IMG_GUID_CHANGED_TRAP			145
7861321936Shselasky#define SM_BAD_MKEY_TRAP				256
7862321936Shselasky#define SM_BAD_PKEY_TRAP				257
7863321936Shselasky#define SM_BAD_QKEY_TRAP				258
7864321936Shselasky#define SM_BAD_SWITCH_PKEY_TRAP				259
7865321936Shselasky
7866321936Shselasky#include <complib/cl_packon.h>
7867321936Shselaskytypedef struct _ib_mad_notice_attr	// Total Size calc  Accumulated
7868321936Shselasky{
7869321936Shselasky	uint8_t generic_type;	// 1                1
7870321936Shselasky	union _notice_g_or_v {
7871321936Shselasky		struct _notice_generic	// 5                6
7872321936Shselasky		{
7873321936Shselasky			uint8_t prod_type_msb;
7874321936Shselasky			ib_net16_t prod_type_lsb;
7875321936Shselasky			ib_net16_t trap_num;
7876321936Shselasky		} PACK_SUFFIX generic;
7877321936Shselasky		struct _notice_vend {
7878321936Shselasky			uint8_t vend_id_msb;
7879321936Shselasky			ib_net16_t vend_id_lsb;
7880321936Shselasky			ib_net16_t dev_id;
7881321936Shselasky		} PACK_SUFFIX vend;
7882321936Shselasky	} g_or_v;
7883321936Shselasky	ib_net16_t issuer_lid;	// 2                 8
7884321936Shselasky	ib_net16_t toggle_count;	// 2                 10
7885321936Shselasky	union _data_details	// 54                64
7886321936Shselasky	{
7887321936Shselasky		struct _raw_data {
7888321936Shselasky			uint8_t details[54];
7889321936Shselasky		} PACK_SUFFIX raw_data;
7890321936Shselasky		struct _ntc_64_67 {
7891321936Shselasky			uint8_t res[6];
7892321936Shselasky			ib_gid_t gid;	// the Node or Multicast Group that came in/out
7893321936Shselasky		} PACK_SUFFIX ntc_64_67;
7894321936Shselasky		struct _ntc_128 {
7895321936Shselasky			ib_net16_t sw_lid;	// the sw lid of which link state changed
7896321936Shselasky		} PACK_SUFFIX ntc_128;
7897321936Shselasky		struct _ntc_129_131 {
7898321936Shselasky			ib_net16_t pad;
7899321936Shselasky			ib_net16_t lid;	// lid and port number of the violation
7900321936Shselasky			uint8_t port_num;
7901321936Shselasky		} PACK_SUFFIX ntc_129_131;
7902321936Shselasky		struct _ntc_144 {
7903321936Shselasky			ib_net16_t pad1;
7904321936Shselasky			ib_net16_t lid;             // lid where change occured
7905321936Shselasky			uint8_t    pad2;            // reserved
7906321936Shselasky			uint8_t    local_changes;   // 7b reserved 1b local changes
7907321936Shselasky			ib_net32_t new_cap_mask;    // new capability mask
7908321936Shselasky			ib_net16_t change_flgs;     // 10b reserved 6b change flags
7909321936Shselasky			ib_net16_t cap_mask2;
7910321936Shselasky		} PACK_SUFFIX ntc_144;
7911321936Shselasky		struct _ntc_145 {
7912321936Shselasky			ib_net16_t pad1;
7913321936Shselasky			ib_net16_t lid;	// lid where sys guid changed
7914321936Shselasky			ib_net16_t pad2;
7915321936Shselasky			ib_net64_t new_sys_guid;	// new system image guid
7916321936Shselasky		} PACK_SUFFIX ntc_145;
7917321936Shselasky		struct _ntc_256 {	// total: 54
7918321936Shselasky			ib_net16_t pad1;	// 2
7919321936Shselasky			ib_net16_t lid;	// 2
7920321936Shselasky			ib_net16_t dr_slid;	// 2
7921321936Shselasky			uint8_t method;	// 1
7922321936Shselasky			uint8_t pad2;	// 1
7923321936Shselasky			ib_net16_t attr_id;	// 2
7924321936Shselasky			ib_net32_t attr_mod;	// 4
7925321936Shselasky			ib_net64_t mkey;	// 8
7926321936Shselasky			uint8_t pad3;	// 1
7927321936Shselasky			uint8_t dr_trunc_hop;	// 1
7928321936Shselasky			uint8_t dr_rtn_path[30];	// 30
7929321936Shselasky		} PACK_SUFFIX ntc_256;
7930321936Shselasky		struct _ntc_257_258	// violation of p/q_key // 49
7931321936Shselasky		{
7932321936Shselasky			ib_net16_t pad1;	// 2
7933321936Shselasky			ib_net16_t lid1;	// 2
7934321936Shselasky			ib_net16_t lid2;	// 2
7935321936Shselasky			ib_net32_t key;	// 4
7936321936Shselasky			ib_net32_t qp1;	// 4b sl, 4b pad, 24b qp1
7937321936Shselasky			ib_net32_t qp2;	// 8b pad, 24b qp2
7938321936Shselasky			ib_gid_t gid1;	// 16
7939321936Shselasky			ib_gid_t gid2;	// 16
7940321936Shselasky		} PACK_SUFFIX ntc_257_258;
7941321936Shselasky		struct _ntc_259	// pkey violation from switch 51
7942321936Shselasky		{
7943321936Shselasky			ib_net16_t data_valid;	// 2
7944321936Shselasky			ib_net16_t lid1;	// 2
7945321936Shselasky			ib_net16_t lid2;	// 2
7946321936Shselasky			ib_net16_t pkey;	// 2
7947321936Shselasky			ib_net32_t sl_qp1; // 4b sl, 4b pad, 24b qp1
7948321936Shselasky			ib_net32_t qp2; // 8b pad, 24b qp2
7949321936Shselasky			ib_gid_t gid1;	// 16
7950321936Shselasky			ib_gid_t gid2;	// 16
7951321936Shselasky			ib_net16_t sw_lid;	// 2
7952321936Shselasky			uint8_t port_no;	// 1
7953321936Shselasky		} PACK_SUFFIX ntc_259;
7954321936Shselasky		struct _ntc_bkey_259	// bkey violation
7955321936Shselasky		{
7956321936Shselasky			ib_net16_t lidaddr;
7957321936Shselasky			uint8_t method;
7958321936Shselasky			uint8_t reserved;
7959321936Shselasky			ib_net16_t attribute_id;
7960321936Shselasky			ib_net32_t attribute_modifier;
7961321936Shselasky			ib_net32_t qp;		// qp is low 24 bits
7962321936Shselasky			ib_net64_t bkey;
7963321936Shselasky			ib_gid_t gid;
7964321936Shselasky		} PACK_SUFFIX ntc_bkey_259;
7965321936Shselasky		struct _ntc_cckey_0	// CC key violation
7966321936Shselasky		{
7967321936Shselasky			ib_net16_t slid;     // source LID from offending packet LRH
7968321936Shselasky			uint8_t method;      // method, from common MAD header
7969321936Shselasky			uint8_t resv0;
7970321936Shselasky			ib_net16_t attribute_id; // Attribute ID, from common MAD header
7971321936Shselasky			ib_net16_t resv1;
7972321936Shselasky			ib_net32_t attribute_modifier; // Attribute Modif, from common MAD header
7973321936Shselasky			ib_net32_t qp;       // 8b pad, 24b dest QP from BTH
7974321936Shselasky			ib_net64_t cc_key;   // CC key of the offending packet
7975321936Shselasky			ib_gid_t source_gid; // GID from GRH of the offending packet
7976321936Shselasky			uint8_t padding[14]; // Padding - ignored on read
7977321936Shselasky		} PACK_SUFFIX ntc_cckey_0;
7978321936Shselasky	} data_details;
7979321936Shselasky	ib_gid_t issuer_gid;	// 16          80
7980321936Shselasky} PACK_SUFFIX ib_mad_notice_attr_t;
7981321936Shselasky#include <complib/cl_packoff.h>
7982321936Shselasky
7983321936Shselasky/**
7984321936Shselasky * Trap 259 masks
7985321936Shselasky */
7986321936Shselasky#define TRAP_259_MASK_SL (CL_HTON32(0xF0000000))
7987321936Shselasky#define TRAP_259_MASK_QP (CL_HTON32(0x00FFFFFF))
7988321936Shselasky
7989321936Shselasky/**
7990321936Shselasky * Trap 144 masks
7991321936Shselasky */
7992321936Shselasky#define TRAP_144_MASK_OTHER_LOCAL_CHANGES      0x01
7993321936Shselasky#define TRAP_144_MASK_CAPABILITY_MASK2_CHANGE  (CL_HTON16(0x0020))
7994321936Shselasky#define TRAP_144_MASK_HIERARCHY_INFO_CHANGE    (CL_HTON16(0x0010))
7995321936Shselasky#define TRAP_144_MASK_SM_PRIORITY_CHANGE       (CL_HTON16(0x0008))
7996321936Shselasky#define TRAP_144_MASK_LINK_SPEED_ENABLE_CHANGE (CL_HTON16(0x0004))
7997321936Shselasky#define TRAP_144_MASK_LINK_WIDTH_ENABLE_CHANGE (CL_HTON16(0x0002))
7998321936Shselasky#define TRAP_144_MASK_NODE_DESCRIPTION_CHANGE  (CL_HTON16(0x0001))
7999321936Shselasky
8000321936Shselasky/****f* IBA Base: Types/ib_notice_is_generic
8001321936Shselasky* NAME
8002321936Shselasky*	ib_notice_is_generic
8003321936Shselasky*
8004321936Shselasky* DESCRIPTION
8005321936Shselasky*	Check if the notice is generic
8006321936Shselasky*
8007321936Shselasky* SYNOPSIS
8008321936Shselasky*/
8009321936Shselaskystatic inline boolean_t OSM_API
8010321936Shselaskyib_notice_is_generic(IN const ib_mad_notice_attr_t * p_ntc)
8011321936Shselasky{
8012321936Shselasky	return (p_ntc->generic_type & 0x80);
8013321936Shselasky}
8014321936Shselasky
8015321936Shselasky/*
8016321936Shselasky* PARAMETERS
8017321936Shselasky*	p_ntc
8018321936Shselasky*		[in] Pointer to the notice MAD attribute
8019321936Shselasky*
8020321936Shselasky* RETURN VALUES
8021321936Shselasky*	TRUE if notice MAD is generic
8022321936Shselasky*
8023321936Shselasky* SEE ALSO
8024321936Shselasky*	ib_mad_notice_attr_t
8025321936Shselasky*********/
8026321936Shselasky
8027321936Shselasky/****f* IBA Base: Types/ib_notice_get_type
8028321936Shselasky* NAME
8029321936Shselasky*	ib_notice_get_type
8030321936Shselasky*
8031321936Shselasky* DESCRIPTION
8032321936Shselasky*	Get the notice type
8033321936Shselasky*
8034321936Shselasky* SYNOPSIS
8035321936Shselasky*/
8036321936Shselaskystatic inline uint8_t OSM_API
8037321936Shselaskyib_notice_get_type(IN const ib_mad_notice_attr_t * p_ntc)
8038321936Shselasky{
8039321936Shselasky	return p_ntc->generic_type & 0x7f;
8040321936Shselasky}
8041321936Shselasky
8042321936Shselasky/*
8043321936Shselasky* PARAMETERS
8044321936Shselasky*	p_ntc
8045321936Shselasky*		[in] Pointer to  the notice MAD attribute
8046321936Shselasky*
8047321936Shselasky* RETURN VALUES
8048321936Shselasky*	TRUE if mad is generic
8049321936Shselasky*
8050321936Shselasky* SEE ALSO
8051321936Shselasky*	ib_mad_notice_attr_t
8052321936Shselasky*********/
8053321936Shselasky
8054321936Shselasky/****f* IBA Base: Types/ib_notice_get_prod_type
8055321936Shselasky* NAME
8056321936Shselasky*	ib_notice_get_prod_type
8057321936Shselasky*
8058321936Shselasky* DESCRIPTION
8059321936Shselasky*	Get the notice Producer Type of Generic Notice
8060321936Shselasky*
8061321936Shselasky* SYNOPSIS
8062321936Shselasky*/
8063321936Shselaskystatic inline ib_net32_t OSM_API
8064321936Shselaskyib_notice_get_prod_type(IN const ib_mad_notice_attr_t * p_ntc)
8065321936Shselasky{
8066321936Shselasky	uint32_t pt;
8067321936Shselasky
8068321936Shselasky	pt = cl_ntoh16(p_ntc->g_or_v.generic.prod_type_lsb) |
8069321936Shselasky	    (p_ntc->g_or_v.generic.prod_type_msb << 16);
8070321936Shselasky	return cl_hton32(pt);
8071321936Shselasky}
8072321936Shselasky
8073321936Shselasky/*
8074321936Shselasky* PARAMETERS
8075321936Shselasky*	p_ntc
8076321936Shselasky*		[in] Pointer to the notice MAD attribute
8077321936Shselasky*
8078321936Shselasky* RETURN VALUES
8079321936Shselasky*	The producer type
8080321936Shselasky*
8081321936Shselasky* SEE ALSO
8082321936Shselasky*	ib_mad_notice_attr_t
8083321936Shselasky*********/
8084321936Shselasky
8085321936Shselasky/****f* IBA Base: Types/ib_notice_set_prod_type
8086321936Shselasky* NAME
8087321936Shselasky*	ib_notice_set_prod_type
8088321936Shselasky*
8089321936Shselasky* DESCRIPTION
8090321936Shselasky*	Set the notice Producer Type of Generic Notice
8091321936Shselasky*
8092321936Shselasky* SYNOPSIS
8093321936Shselasky*/
8094321936Shselaskystatic inline void OSM_API
8095321936Shselaskyib_notice_set_prod_type(IN ib_mad_notice_attr_t * p_ntc,
8096321936Shselasky			IN ib_net32_t prod_type_val)
8097321936Shselasky{
8098321936Shselasky	uint32_t ptv = cl_ntoh32(prod_type_val);
8099321936Shselasky	p_ntc->g_or_v.generic.prod_type_lsb =
8100321936Shselasky	    cl_hton16((uint16_t) (ptv & 0x0000ffff));
8101321936Shselasky	p_ntc->g_or_v.generic.prod_type_msb =
8102321936Shselasky	    (uint8_t) ((ptv & 0x00ff0000) >> 16);
8103321936Shselasky}
8104321936Shselasky
8105321936Shselasky/*
8106321936Shselasky* PARAMETERS
8107321936Shselasky*	p_ntc
8108321936Shselasky*		[in] Pointer to the notice MAD attribute
8109321936Shselasky*
8110321936Shselasky*  prod_type
8111321936Shselasky*     [in] The producer Type code
8112321936Shselasky*
8113321936Shselasky* RETURN VALUES
8114321936Shselasky*	None
8115321936Shselasky*
8116321936Shselasky* SEE ALSO
8117321936Shselasky*	ib_mad_notice_attr_t
8118321936Shselasky*********/
8119321936Shselasky
8120321936Shselasky/****f* IBA Base: Types/ib_notice_set_prod_type_ho
8121321936Shselasky* NAME
8122321936Shselasky*	ib_notice_set_prod_type_ho
8123321936Shselasky*
8124321936Shselasky* DESCRIPTION
8125321936Shselasky*	Set the notice Producer Type of Generic Notice given Host Order
8126321936Shselasky*
8127321936Shselasky* SYNOPSIS
8128321936Shselasky*/
8129321936Shselaskystatic inline void OSM_API
8130321936Shselaskyib_notice_set_prod_type_ho(IN ib_mad_notice_attr_t * p_ntc,
8131321936Shselasky			   IN uint32_t prod_type_val_ho)
8132321936Shselasky{
8133321936Shselasky	p_ntc->g_or_v.generic.prod_type_lsb =
8134321936Shselasky	    cl_hton16((uint16_t) (prod_type_val_ho & 0x0000ffff));
8135321936Shselasky	p_ntc->g_or_v.generic.prod_type_msb =
8136321936Shselasky	    (uint8_t) ((prod_type_val_ho & 0x00ff0000) >> 16);
8137321936Shselasky}
8138321936Shselasky
8139321936Shselasky/*
8140321936Shselasky* PARAMETERS
8141321936Shselasky*	p_ntc
8142321936Shselasky*		[in] Pointer to the notice MAD attribute
8143321936Shselasky*
8144321936Shselasky*	prod_type
8145321936Shselasky*		[in] The producer Type code in host order
8146321936Shselasky*
8147321936Shselasky* RETURN VALUES
8148321936Shselasky*	None
8149321936Shselasky*
8150321936Shselasky* SEE ALSO
8151321936Shselasky*	ib_mad_notice_attr_t
8152321936Shselasky*********/
8153321936Shselasky
8154321936Shselasky/****f* IBA Base: Types/ib_notice_get_vend_id
8155321936Shselasky* NAME
8156321936Shselasky*	ib_notice_get_vend_id
8157321936Shselasky*
8158321936Shselasky* DESCRIPTION
8159321936Shselasky*	Get the Vendor Id of Vendor type Notice
8160321936Shselasky*
8161321936Shselasky* SYNOPSIS
8162321936Shselasky*/
8163321936Shselaskystatic inline ib_net32_t OSM_API
8164321936Shselaskyib_notice_get_vend_id(IN const ib_mad_notice_attr_t * p_ntc)
8165321936Shselasky{
8166321936Shselasky	uint32_t vi;
8167321936Shselasky
8168321936Shselasky	vi = cl_ntoh16(p_ntc->g_or_v.vend.vend_id_lsb) |
8169321936Shselasky	    (p_ntc->g_or_v.vend.vend_id_msb << 16);
8170321936Shselasky	return cl_hton32(vi);
8171321936Shselasky}
8172321936Shselasky
8173321936Shselasky/*
8174321936Shselasky* PARAMETERS
8175321936Shselasky*	p_ntc
8176321936Shselasky*		[in] Pointer to the notice MAD attribute
8177321936Shselasky*
8178321936Shselasky* RETURN VALUES
8179321936Shselasky*	The Vendor Id of Vendor type Notice
8180321936Shselasky*
8181321936Shselasky* SEE ALSO
8182321936Shselasky*	ib_mad_notice_attr_t
8183321936Shselasky*********/
8184321936Shselasky
8185321936Shselasky/****f* IBA Base: Types/ib_notice_set_vend_id
8186321936Shselasky* NAME
8187321936Shselasky*	ib_notice_set_vend_id
8188321936Shselasky*
8189321936Shselasky* DESCRIPTION
8190321936Shselasky*	Set the notice Producer Type of Generic Notice
8191321936Shselasky*
8192321936Shselasky* SYNOPSIS
8193321936Shselasky*/
8194321936Shselaskystatic inline void OSM_API
8195321936Shselaskyib_notice_set_vend_id(IN ib_mad_notice_attr_t * p_ntc, IN ib_net32_t vend_id)
8196321936Shselasky{
8197321936Shselasky	uint32_t vi = cl_ntoh32(vend_id);
8198321936Shselasky	p_ntc->g_or_v.vend.vend_id_lsb =
8199321936Shselasky	    cl_hton16((uint16_t) (vi & 0x0000ffff));
8200321936Shselasky	p_ntc->g_or_v.vend.vend_id_msb = (uint8_t) ((vi & 0x00ff0000) >> 16);
8201321936Shselasky}
8202321936Shselasky
8203321936Shselasky/*
8204321936Shselasky* PARAMETERS
8205321936Shselasky*	p_ntc
8206321936Shselasky*		[in] Pointer to the notice MAD attribute
8207321936Shselasky*
8208321936Shselasky*	vend_id
8209321936Shselasky*		[in] The producer Type code
8210321936Shselasky*
8211321936Shselasky* RETURN VALUES
8212321936Shselasky*	None
8213321936Shselasky*
8214321936Shselasky* SEE ALSO
8215321936Shselasky*	ib_mad_notice_attr_t
8216321936Shselasky*********/
8217321936Shselasky
8218321936Shselasky/****f* IBA Base: Types/ib_notice_set_vend_id_ho
8219321936Shselasky* NAME
8220321936Shselasky*	ib_notice_set_vend_id_ho
8221321936Shselasky*
8222321936Shselasky* DESCRIPTION
8223321936Shselasky*	Set the notice Producer Type of Generic Notice given a host order value
8224321936Shselasky*
8225321936Shselasky* SYNOPSIS
8226321936Shselasky*/
8227321936Shselaskystatic inline void OSM_API
8228321936Shselaskyib_notice_set_vend_id_ho(IN ib_mad_notice_attr_t * p_ntc,
8229321936Shselasky			 IN uint32_t vend_id_ho)
8230321936Shselasky{
8231321936Shselasky	p_ntc->g_or_v.vend.vend_id_lsb =
8232321936Shselasky	    cl_hton16((uint16_t) (vend_id_ho & 0x0000ffff));
8233321936Shselasky	p_ntc->g_or_v.vend.vend_id_msb =
8234321936Shselasky	    (uint8_t) ((vend_id_ho & 0x00ff0000) >> 16);
8235321936Shselasky}
8236321936Shselasky
8237321936Shselasky/*
8238321936Shselasky* PARAMETERS
8239321936Shselasky*	p_ntc
8240321936Shselasky*		[in] Pointer to the notice MAD attribute
8241321936Shselasky*
8242321936Shselasky*	vend_id_ho
8243321936Shselasky*		[in] The producer Type code in host order
8244321936Shselasky*
8245321936Shselasky* RETURN VALUES
8246321936Shselasky*	None
8247321936Shselasky*
8248321936Shselasky* SEE ALSO
8249321936Shselasky*	ib_mad_notice_attr_t
8250321936Shselasky*********/
8251321936Shselasky
8252321936Shselasky#include <complib/cl_packon.h>
8253321936Shselaskytypedef struct _ib_inform_info {
8254321936Shselasky	ib_gid_t gid;
8255321936Shselasky	ib_net16_t lid_range_begin;
8256321936Shselasky	ib_net16_t lid_range_end;
8257321936Shselasky	ib_net16_t reserved1;
8258321936Shselasky	uint8_t is_generic;
8259321936Shselasky	uint8_t subscribe;
8260321936Shselasky	ib_net16_t trap_type;
8261321936Shselasky	union _inform_g_or_v {
8262321936Shselasky		struct _inform_generic {
8263321936Shselasky			ib_net16_t trap_num;
8264321936Shselasky			ib_net32_t qpn_resp_time_val;
8265321936Shselasky			uint8_t reserved2;
8266321936Shselasky			uint8_t node_type_msb;
8267321936Shselasky			ib_net16_t node_type_lsb;
8268321936Shselasky		} PACK_SUFFIX generic;
8269321936Shselasky		struct _inform_vend {
8270321936Shselasky			ib_net16_t dev_id;
8271321936Shselasky			ib_net32_t qpn_resp_time_val;
8272321936Shselasky			uint8_t reserved2;
8273321936Shselasky			uint8_t vendor_id_msb;
8274321936Shselasky			ib_net16_t vendor_id_lsb;
8275321936Shselasky		} PACK_SUFFIX vend;
8276321936Shselasky	} PACK_SUFFIX g_or_v;
8277321936Shselasky} PACK_SUFFIX ib_inform_info_t;
8278321936Shselasky#include <complib/cl_packoff.h>
8279321936Shselasky
8280321936Shselasky/****f* IBA Base: Types/ib_inform_info_get_qpn_resp_time
8281321936Shselasky* NAME
8282321936Shselasky*	ib_inform_info_get_qpn_resp_time
8283321936Shselasky*
8284321936Shselasky* DESCRIPTION
8285321936Shselasky*	Get QPN of the inform info
8286321936Shselasky*
8287321936Shselasky* SYNOPSIS
8288321936Shselasky*/
8289321936Shselaskystatic inline void OSM_API
8290321936Shselaskyib_inform_info_get_qpn_resp_time(IN const ib_net32_t qpn_resp_time_val,
8291321936Shselasky				 OUT ib_net32_t * const p_qpn,
8292321936Shselasky				 OUT uint8_t * const p_resp_time_val)
8293321936Shselasky{
8294321936Shselasky	uint32_t tmp = cl_ntoh32(qpn_resp_time_val);
8295321936Shselasky
8296321936Shselasky	if (p_qpn)
8297321936Shselasky		*p_qpn = cl_hton32((tmp & 0xffffff00) >> 8);
8298321936Shselasky	if (p_resp_time_val)
8299321936Shselasky		*p_resp_time_val = (uint8_t) (tmp & 0x0000001f);
8300321936Shselasky}
8301321936Shselasky
8302321936Shselasky/*
8303321936Shselasky* PARAMETERS
8304321936Shselasky*	qpn_resp_time_val
8305321936Shselasky*		[in] the  qpn and resp time val from the mad
8306321936Shselasky*
8307321936Shselasky* RETURN VALUES
8308321936Shselasky*	p_qpn
8309321936Shselasky*		[out] pointer to the qpn
8310321936Shselasky*
8311321936Shselasky*	p_state
8312321936Shselasky*		[out] pointer to the resp time val
8313321936Shselasky*
8314321936Shselasky* NOTES
8315321936Shselasky*
8316321936Shselasky* SEE ALSO
8317321936Shselasky*	ib_inform_info_t
8318321936Shselasky*********/
8319321936Shselasky
8320321936Shselasky/****f* IBA Base: Types/ib_inform_info_set_qpn
8321321936Shselasky* NAME
8322321936Shselasky*	ib_inform_info_set_qpn
8323321936Shselasky*
8324321936Shselasky* DESCRIPTION
8325321936Shselasky*	Set the QPN of the inform info
8326321936Shselasky*
8327321936Shselasky* SYNOPSIS
8328321936Shselasky*/
8329321936Shselaskystatic inline void OSM_API
8330321936Shselaskyib_inform_info_set_qpn(IN ib_inform_info_t * p_ii, IN ib_net32_t const qpn)
8331321936Shselasky{
8332321936Shselasky	uint32_t tmp = cl_ntoh32(p_ii->g_or_v.generic.qpn_resp_time_val);
8333321936Shselasky	uint32_t qpn_h = cl_ntoh32(qpn);
8334321936Shselasky
8335321936Shselasky	p_ii->g_or_v.generic.qpn_resp_time_val =
8336321936Shselasky	    cl_hton32((tmp & 0x000000ff) | ((qpn_h << 8) & 0xffffff00)
8337321936Shselasky	    );
8338321936Shselasky}
8339321936Shselasky
8340321936Shselasky/*
8341321936Shselasky* PARAMETERS
8342321936Shselasky*
8343321936Shselasky* NOTES
8344321936Shselasky*
8345321936Shselasky* SEE ALSO
8346321936Shselasky*	ib_inform_info_t
8347321936Shselasky*********/
8348321936Shselasky
8349321936Shselasky/****f* IBA Base: Types/ib_inform_info_get_prod_type
8350321936Shselasky* NAME
8351321936Shselasky*	ib_inform_info_get_prod_type
8352321936Shselasky*
8353321936Shselasky* DESCRIPTION
8354321936Shselasky*	Get Producer Type of the Inform Info
8355321936Shselasky*	13.4.8.3 InformInfo
8356321936Shselasky*
8357321936Shselasky* SYNOPSIS
8358321936Shselasky*/
8359321936Shselaskystatic inline ib_net32_t OSM_API
8360321936Shselaskyib_inform_info_get_prod_type(IN const ib_inform_info_t * p_inf)
8361321936Shselasky{
8362321936Shselasky	uint32_t nt;
8363321936Shselasky
8364321936Shselasky	nt = cl_ntoh16(p_inf->g_or_v.generic.node_type_lsb) |
8365321936Shselasky	    (p_inf->g_or_v.generic.node_type_msb << 16);
8366321936Shselasky	return cl_hton32(nt);
8367321936Shselasky}
8368321936Shselasky
8369321936Shselasky/*
8370321936Shselasky* PARAMETERS
8371321936Shselasky*	p_inf
8372321936Shselasky*		[in] pointer to an inform info
8373321936Shselasky*
8374321936Shselasky* RETURN VALUES
8375321936Shselasky*     The producer type
8376321936Shselasky*
8377321936Shselasky* NOTES
8378321936Shselasky*
8379321936Shselasky* SEE ALSO
8380321936Shselasky*	ib_inform_info_t
8381321936Shselasky*********/
8382321936Shselasky
8383321936Shselasky/****f* IBA Base: Types/ib_inform_info_get_vend_id
8384321936Shselasky* NAME
8385321936Shselasky*	ib_inform_info_get_vend_id
8386321936Shselasky*
8387321936Shselasky* DESCRIPTION
8388321936Shselasky*	Get Node Type of the Inform Info
8389321936Shselasky*
8390321936Shselasky* SYNOPSIS
8391321936Shselasky*/
8392321936Shselaskystatic inline ib_net32_t OSM_API
8393321936Shselaskyib_inform_info_get_vend_id(IN const ib_inform_info_t * p_inf)
8394321936Shselasky{
8395321936Shselasky	uint32_t vi;
8396321936Shselasky
8397321936Shselasky	vi = cl_ntoh16(p_inf->g_or_v.vend.vendor_id_lsb) |
8398321936Shselasky	    (p_inf->g_or_v.vend.vendor_id_msb << 16);
8399321936Shselasky	return cl_hton32(vi);
8400321936Shselasky}
8401321936Shselasky
8402321936Shselasky/*
8403321936Shselasky* PARAMETERS
8404321936Shselasky*	p_inf
8405321936Shselasky*		[in] pointer to an inform info
8406321936Shselasky*
8407321936Shselasky* RETURN VALUES
8408321936Shselasky*     The node type
8409321936Shselasky*
8410321936Shselasky* NOTES
8411321936Shselasky*
8412321936Shselasky* SEE ALSO
8413321936Shselasky*	ib_inform_info_t
8414321936Shselasky*********/
8415321936Shselasky
8416321936Shselasky/****s* IBA Base: Types/ib_inform_info_record_t
8417321936Shselasky* NAME
8418321936Shselasky*	ib_inform_info_record_t
8419321936Shselasky*
8420321936Shselasky* DESCRIPTION
8421321936Shselasky*	IBA defined InformInfo Record. (15.2.5.12)
8422321936Shselasky*
8423321936Shselasky* SYNOPSIS
8424321936Shselasky*/
8425321936Shselasky#include <complib/cl_packon.h>
8426321936Shselaskytypedef struct _ib_inform_info_record {
8427321936Shselasky	ib_gid_t subscriber_gid;
8428321936Shselasky	ib_net16_t subscriber_enum;
8429321936Shselasky	uint8_t reserved[6];
8430321936Shselasky	ib_inform_info_t inform_info;
8431321936Shselasky	uint8_t pad[4];
8432321936Shselasky} PACK_SUFFIX ib_inform_info_record_t;
8433321936Shselasky#include <complib/cl_packoff.h>
8434321936Shselasky
8435321936Shselasky/****s* IBA Base: Types/ib_perfmgt_mad_t
8436321936Shselasky* NAME
8437321936Shselasky*	ib_perfmgt_mad_t
8438321936Shselasky*
8439321936Shselasky* DESCRIPTION
8440321936Shselasky*	IBA defined Perf Management MAD (16.3.1)
8441321936Shselasky*
8442321936Shselasky* SYNOPSIS
8443321936Shselasky*/
8444321936Shselasky#include <complib/cl_packon.h>
8445321936Shselaskytypedef struct _ib_perfmgt_mad {
8446321936Shselasky	ib_mad_t header;
8447321936Shselasky	uint8_t resv[40];
8448321936Shselasky#define	IB_PM_DATA_SIZE		192
8449321936Shselasky	uint8_t data[IB_PM_DATA_SIZE];
8450321936Shselasky} PACK_SUFFIX ib_perfmgt_mad_t;
8451321936Shselasky#include <complib/cl_packoff.h>
8452321936Shselasky/*
8453321936Shselasky* FIELDS
8454321936Shselasky*	header
8455321936Shselasky*		Common MAD header.
8456321936Shselasky*
8457321936Shselasky*	resv
8458321936Shselasky*		Reserved.
8459321936Shselasky*
8460321936Shselasky*	data
8461321936Shselasky*		Performance Management payload.  The structure and content of this field
8462321936Shselasky*		depends upon the method, attr_id, and attr_mod fields in the header.
8463321936Shselasky*
8464321936Shselasky* SEE ALSO
8465321936Shselasky* ib_mad_t
8466321936Shselasky*********/
8467321936Shselasky
8468321936Shselasky/****s* IBA Base: Types/ib_port_counters
8469321936Shselasky* NAME
8470321936Shselasky*	ib_port_counters_t
8471321936Shselasky*
8472321936Shselasky* DESCRIPTION
8473321936Shselasky*	IBA defined PortCounters Attribute. (16.1.3.5)
8474321936Shselasky*
8475321936Shselasky* SYNOPSIS
8476321936Shselasky*/
8477321936Shselasky#include <complib/cl_packon.h>
8478321936Shselaskytypedef struct _ib_port_counters {
8479321936Shselasky	uint8_t reserved;
8480321936Shselasky	uint8_t port_select;
8481321936Shselasky	ib_net16_t counter_select;
8482321936Shselasky	ib_net16_t symbol_err_cnt;
8483321936Shselasky	uint8_t link_err_recover;
8484321936Shselasky	uint8_t link_downed;
8485321936Shselasky	ib_net16_t rcv_err;
8486321936Shselasky	ib_net16_t rcv_rem_phys_err;
8487321936Shselasky	ib_net16_t rcv_switch_relay_err;
8488321936Shselasky	ib_net16_t xmit_discards;
8489321936Shselasky	uint8_t xmit_constraint_err;
8490321936Shselasky	uint8_t rcv_constraint_err;
8491321936Shselasky	uint8_t counter_select2;
8492321936Shselasky	uint8_t link_int_buffer_overrun;
8493321936Shselasky	ib_net16_t qp1_dropped;
8494321936Shselasky	ib_net16_t vl15_dropped;
8495321936Shselasky	ib_net32_t xmit_data;
8496321936Shselasky	ib_net32_t rcv_data;
8497321936Shselasky	ib_net32_t xmit_pkts;
8498321936Shselasky	ib_net32_t rcv_pkts;
8499321936Shselasky	ib_net32_t xmit_wait;
8500321936Shselasky} PACK_SUFFIX ib_port_counters_t;
8501321936Shselasky#include <complib/cl_packoff.h>
8502321936Shselasky
8503321936Shselasky#define PC_LINK_INT(integ_buf_over) ((integ_buf_over & 0xF0) >> 4)
8504321936Shselasky#define PC_BUF_OVERRUN(integ_buf_over) (integ_buf_over & 0x0F)
8505321936Shselasky
8506321936Shselasky/****s* IBA Base: Types/ib_port_counters_ext
8507321936Shselasky* NAME
8508321936Shselasky*	ib_port_counters_ext_t
8509321936Shselasky*
8510321936Shselasky* DESCRIPTION
8511321936Shselasky*	IBA defined PortCounters Extended Attribute. (16.1.4.11)
8512321936Shselasky*
8513321936Shselasky* SYNOPSIS
8514321936Shselasky*/
8515321936Shselasky#include <complib/cl_packon.h>
8516321936Shselaskytypedef struct _ib_port_counters_ext {
8517321936Shselasky	uint8_t reserved;
8518321936Shselasky	uint8_t port_select;
8519321936Shselasky	ib_net16_t counter_select;
8520321936Shselasky	ib_net32_t counter_select2;
8521321936Shselasky	ib_net64_t xmit_data;
8522321936Shselasky	ib_net64_t rcv_data;
8523321936Shselasky	ib_net64_t xmit_pkts;
8524321936Shselasky	ib_net64_t rcv_pkts;
8525321936Shselasky	ib_net64_t unicast_xmit_pkts;
8526321936Shselasky	ib_net64_t unicast_rcv_pkts;
8527321936Shselasky	ib_net64_t multicast_xmit_pkts;
8528321936Shselasky	ib_net64_t multicast_rcv_pkts;
8529321936Shselasky	ib_net64_t symbol_err_cnt;
8530321936Shselasky	ib_net64_t link_err_recover;
8531321936Shselasky	ib_net64_t link_downed;
8532321936Shselasky	ib_net64_t rcv_err;
8533321936Shselasky	ib_net64_t rcv_rem_phys_err;
8534321936Shselasky	ib_net64_t rcv_switch_relay_err;
8535321936Shselasky	ib_net64_t xmit_discards;
8536321936Shselasky	ib_net64_t xmit_constraint_err;
8537321936Shselasky	ib_net64_t rcv_constraint_err;
8538321936Shselasky	ib_net64_t link_integrity_err;
8539321936Shselasky	ib_net64_t buffer_overrun;
8540321936Shselasky	ib_net64_t vl15_dropped;
8541321936Shselasky	ib_net64_t xmit_wait;
8542321936Shselasky	ib_net64_t qp1_dropped;
8543321936Shselasky} PACK_SUFFIX ib_port_counters_ext_t;
8544321936Shselasky#include <complib/cl_packoff.h>
8545321936Shselasky
8546321936Shselasky/****s* IBA Base: Types/ib_port_samples_control
8547321936Shselasky* NAME
8548321936Shselasky*	ib_port_samples_control_t
8549321936Shselasky*
8550321936Shselasky* DESCRIPTION
8551321936Shselasky*	IBA defined PortSamplesControl Attribute. (16.1.3.2)
8552321936Shselasky*
8553321936Shselasky* SYNOPSIS
8554321936Shselasky*/
8555321936Shselasky#include <complib/cl_packon.h>
8556321936Shselaskytypedef struct _ib_port_samples_control {
8557321936Shselasky	uint8_t op_code;
8558321936Shselasky	uint8_t port_select;
8559321936Shselasky	uint8_t tick;
8560321936Shselasky	uint8_t counter_width;	/* 5 bits res : 3bits counter_width */
8561321936Shselasky	ib_net32_t counter_mask;	/* 2 bits res : 3 bits counter_mask : 27 bits counter_masks_1to9 */
8562321936Shselasky	ib_net16_t counter_mask_10to14;	/* 1 bits res : 15 bits counter_masks_10to14 */
8563321936Shselasky	uint8_t sample_mech;
8564321936Shselasky	uint8_t sample_status;	/* 6 bits res : 2 bits sample_status */
8565321936Shselasky	ib_net64_t option_mask;
8566321936Shselasky	ib_net64_t vendor_mask;
8567321936Shselasky	ib_net32_t sample_start;
8568321936Shselasky	ib_net32_t sample_interval;
8569321936Shselasky	ib_net16_t tag;
8570321936Shselasky	ib_net16_t counter_select0;
8571321936Shselasky	ib_net16_t counter_select1;
8572321936Shselasky	ib_net16_t counter_select2;
8573321936Shselasky	ib_net16_t counter_select3;
8574321936Shselasky	ib_net16_t counter_select4;
8575321936Shselasky	ib_net16_t counter_select5;
8576321936Shselasky	ib_net16_t counter_select6;
8577321936Shselasky	ib_net16_t counter_select7;
8578321936Shselasky	ib_net16_t counter_select8;
8579321936Shselasky	ib_net16_t counter_select9;
8580321936Shselasky	ib_net16_t counter_select10;
8581321936Shselasky	ib_net16_t counter_select11;
8582321936Shselasky	ib_net16_t counter_select12;
8583321936Shselasky	ib_net16_t counter_select13;
8584321936Shselasky	ib_net16_t counter_select14;
8585321936Shselasky} PACK_SUFFIX ib_port_samples_control_t;
8586321936Shselasky#include <complib/cl_packoff.h>
8587321936Shselasky
8588321936Shselasky/****d* IBA Base: Types/CounterSelect values
8589321936Shselasky* NAME
8590321936Shselasky*       Counter select values
8591321936Shselasky*
8592321936Shselasky* DESCRIPTION
8593321936Shselasky*	Mandatory counter select values (16.1.3.3)
8594321936Shselasky*
8595321936Shselasky* SYNOPSIS
8596321936Shselasky*/
8597321936Shselasky#define IB_CS_PORT_XMIT_DATA (CL_HTON16(0x0001))
8598321936Shselasky#define IB_CS_PORT_RCV_DATA  (CL_HTON16(0x0002))
8599321936Shselasky#define IB_CS_PORT_XMIT_PKTS (CL_HTON16(0x0003))
8600321936Shselasky#define IB_CS_PORT_RCV_PKTS  (CL_HTON16(0x0004))
8601321936Shselasky#define IB_CS_PORT_XMIT_WAIT (CL_HTON16(0x0005))
8602321936Shselasky
8603321936Shselasky/****s* IBA Base: Types/ib_port_samples_result
8604321936Shselasky* NAME
8605321936Shselasky*	ib_port_samples_result_t
8606321936Shselasky*
8607321936Shselasky* DESCRIPTION
8608321936Shselasky*	IBA defined PortSamplesControl Attribute. (16.1.3.2)
8609321936Shselasky*
8610321936Shselasky* SYNOPSIS
8611321936Shselasky*/
8612321936Shselasky#include <complib/cl_packon.h>
8613321936Shselaskytypedef struct _ib_port_samples_result {
8614321936Shselasky	ib_net16_t tag;
8615321936Shselasky	ib_net16_t sample_status;	/* 14 bits res : 2 bits sample_status */
8616321936Shselasky	ib_net32_t counter0;
8617321936Shselasky	ib_net32_t counter1;
8618321936Shselasky	ib_net32_t counter2;
8619321936Shselasky	ib_net32_t counter3;
8620321936Shselasky	ib_net32_t counter4;
8621321936Shselasky	ib_net32_t counter5;
8622321936Shselasky	ib_net32_t counter6;
8623321936Shselasky	ib_net32_t counter7;
8624321936Shselasky	ib_net32_t counter8;
8625321936Shselasky	ib_net32_t counter9;
8626321936Shselasky	ib_net32_t counter10;
8627321936Shselasky	ib_net32_t counter11;
8628321936Shselasky	ib_net32_t counter12;
8629321936Shselasky	ib_net32_t counter13;
8630321936Shselasky	ib_net32_t counter14;
8631321936Shselasky} PACK_SUFFIX ib_port_samples_result_t;
8632321936Shselasky#include <complib/cl_packoff.h>
8633321936Shselasky
8634321936Shselasky/****s* IBA Base: Types/ib_port_xmit_data_sl
8635321936Shselasky* NAME
8636321936Shselasky*	ib_port_xmit_data_sl_t
8637321936Shselasky*
8638321936Shselasky* DESCRIPTION
8639321936Shselasky*       IBA defined PortXmitDataSL Attribute. (A13.6.4)
8640321936Shselasky*
8641321936Shselasky* SYNOPSIS
8642321936Shselasky*/
8643321936Shselasky#include <complib/cl_packon.h>
8644321936Shselaskytypedef struct _ib_port_xmit_data_sl {
8645321936Shselasky	uint8_t reserved;
8646321936Shselasky	uint8_t port_select;
8647321936Shselasky	ib_net16_t counter_select;
8648321936Shselasky	ib_net32_t port_xmit_data_sl[16];
8649321936Shselasky	uint8_t resv[124];
8650321936Shselasky} PACK_SUFFIX ib_port_xmit_data_sl_t;
8651321936Shselasky#include <complib/cl_packoff.h>
8652321936Shselasky
8653321936Shselasky/****s* IBA Base: Types/ib_port_rcv_data_sl
8654321936Shselasky* NAME
8655321936Shselasky*	ib_port_rcv_data_sl_t
8656321936Shselasky*
8657321936Shselasky* DESCRIPTION
8658321936Shselasky*	IBA defined PortRcvDataSL Attribute. (A13.6.4)
8659321936Shselasky*
8660321936Shselasky* SYNOPSIS
8661321936Shselasky*/
8662321936Shselasky#include <complib/cl_packon.h>
8663321936Shselaskytypedef struct _ib_port_rcv_data_sl {
8664321936Shselasky	uint8_t reserved;
8665321936Shselasky	uint8_t port_select;
8666321936Shselasky	ib_net16_t counter_select;
8667321936Shselasky	ib_net32_t port_rcv_data_sl[16];
8668321936Shselasky	uint8_t resv[124];
8669321936Shselasky} PACK_SUFFIX ib_port_rcv_data_sl_t;
8670321936Shselasky#include <complib/cl_packoff.h>
8671321936Shselasky
8672321936Shselasky/****d* IBA Base: Types/DM_SVC_NAME
8673321936Shselasky* NAME
8674321936Shselasky*	DM_SVC_NAME
8675321936Shselasky*
8676321936Shselasky* DESCRIPTION
8677321936Shselasky*	IBA defined Device Management service name (16.3)
8678321936Shselasky*
8679321936Shselasky* SYNOPSIS
8680321936Shselasky*/
8681321936Shselasky#define	DM_SVC_NAME				"DeviceManager.IBTA"
8682321936Shselasky/*
8683321936Shselasky* SEE ALSO
8684321936Shselasky*********/
8685321936Shselasky
8686321936Shselasky/****s* IBA Base: Types/ib_dm_mad_t
8687321936Shselasky* NAME
8688321936Shselasky*	ib_dm_mad_t
8689321936Shselasky*
8690321936Shselasky* DESCRIPTION
8691321936Shselasky*	IBA defined Device Management MAD (16.3.1)
8692321936Shselasky*
8693321936Shselasky* SYNOPSIS
8694321936Shselasky*/
8695321936Shselasky#include <complib/cl_packon.h>
8696321936Shselaskytypedef struct _ib_dm_mad {
8697321936Shselasky	ib_mad_t header;
8698321936Shselasky	uint8_t resv[40];
8699321936Shselasky#define	IB_DM_DATA_SIZE		192
8700321936Shselasky	uint8_t data[IB_DM_DATA_SIZE];
8701321936Shselasky} PACK_SUFFIX ib_dm_mad_t;
8702321936Shselasky#include <complib/cl_packoff.h>
8703321936Shselasky/*
8704321936Shselasky* FIELDS
8705321936Shselasky*	header
8706321936Shselasky*		Common MAD header.
8707321936Shselasky*
8708321936Shselasky*	resv
8709321936Shselasky*		Reserved.
8710321936Shselasky*
8711321936Shselasky*	data
8712321936Shselasky*		Device Management payload.  The structure and content of this field
8713321936Shselasky*		depend upon the method, attr_id, and attr_mod fields in the header.
8714321936Shselasky*
8715321936Shselasky* SEE ALSO
8716321936Shselasky* ib_mad_t
8717321936Shselasky*********/
8718321936Shselasky
8719321936Shselasky/****s* IBA Base: Types/ib_iou_info_t
8720321936Shselasky* NAME
8721321936Shselasky*	ib_iou_info_t
8722321936Shselasky*
8723321936Shselasky* DESCRIPTION
8724321936Shselasky*	IBA defined IO Unit information structure (16.3.3.3)
8725321936Shselasky*
8726321936Shselasky* SYNOPSIS
8727321936Shselasky*/
8728321936Shselasky#include <complib/cl_packon.h>
8729321936Shselaskytypedef struct _ib_iou_info {
8730321936Shselasky	ib_net16_t change_id;
8731321936Shselasky	uint8_t max_controllers;
8732321936Shselasky	uint8_t diag_rom;
8733321936Shselasky#define	IB_DM_CTRL_LIST_SIZE	128
8734321936Shselasky	uint8_t controller_list[IB_DM_CTRL_LIST_SIZE];
8735321936Shselasky#define	IOC_NOT_INSTALLED		0x0
8736321936Shselasky#define	IOC_INSTALLED			0x1
8737321936Shselasky//              Reserved values                         0x02-0xE
8738321936Shselasky#define	SLOT_DOES_NOT_EXIST		0xF
8739321936Shselasky} PACK_SUFFIX ib_iou_info_t;
8740321936Shselasky#include <complib/cl_packoff.h>
8741321936Shselasky/*
8742321936Shselasky* FIELDS
8743321936Shselasky*	change_id
8744321936Shselasky*		Value incremented, with rollover, by any change to the controller_list.
8745321936Shselasky*
8746321936Shselasky*	max_controllers
8747321936Shselasky*		Number of slots in controller_list.
8748321936Shselasky*
8749321936Shselasky*	diag_rom
8750321936Shselasky*		A byte containing two fields: DiagDeviceID and OptionROM.
8751321936Shselasky*		These fields may be read using the ib_iou_info_diag_dev_id
8752321936Shselasky*		and ib_iou_info_option_rom functions.
8753321936Shselasky*
8754321936Shselasky*	controller_list
8755321936Shselasky*		A series of 4-bit nibbles, with each nibble representing a slot
8756321936Shselasky*		in the IO Unit.  Individual nibbles may be read using the
8757321936Shselasky*		ioc_at_slot function.
8758321936Shselasky*
8759321936Shselasky* SEE ALSO
8760321936Shselasky* ib_dm_mad_t, ib_iou_info_diag_dev_id, ib_iou_info_option_rom, ioc_at_slot
8761321936Shselasky*********/
8762321936Shselasky
8763321936Shselasky/****f* IBA Base: Types/ib_iou_info_diag_dev_id
8764321936Shselasky* NAME
8765321936Shselasky*	ib_iou_info_diag_dev_id
8766321936Shselasky*
8767321936Shselasky* DESCRIPTION
8768321936Shselasky*	Returns the DiagDeviceID.
8769321936Shselasky*
8770321936Shselasky* SYNOPSIS
8771321936Shselasky*/
8772321936Shselaskystatic inline uint8_t OSM_API
8773321936Shselaskyib_iou_info_diag_dev_id(IN const ib_iou_info_t * const p_iou_info)
8774321936Shselasky{
8775321936Shselasky	return ((uint8_t) (p_iou_info->diag_rom >> 6 & 1));
8776321936Shselasky}
8777321936Shselasky
8778321936Shselasky/*
8779321936Shselasky* PARAMETERS
8780321936Shselasky*	p_iou_info
8781321936Shselasky*		[in] Pointer to the IO Unit information structure.
8782321936Shselasky*
8783321936Shselasky* RETURN VALUES
8784321936Shselasky*	DiagDeviceID field of the IO Unit information.
8785321936Shselasky*
8786321936Shselasky* NOTES
8787321936Shselasky*
8788321936Shselasky* SEE ALSO
8789321936Shselasky*	ib_iou_info_t
8790321936Shselasky*********/
8791321936Shselasky
8792321936Shselasky/****f* IBA Base: Types/ib_iou_info_option_rom
8793321936Shselasky* NAME
8794321936Shselasky*	ib_iou_info_option_rom
8795321936Shselasky*
8796321936Shselasky* DESCRIPTION
8797321936Shselasky*	Returns the OptionROM.
8798321936Shselasky*
8799321936Shselasky* SYNOPSIS
8800321936Shselasky*/
8801321936Shselaskystatic inline uint8_t OSM_API
8802321936Shselaskyib_iou_info_option_rom(IN const ib_iou_info_t * const p_iou_info)
8803321936Shselasky{
8804321936Shselasky	return ((uint8_t) (p_iou_info->diag_rom >> 7));
8805321936Shselasky}
8806321936Shselasky
8807321936Shselasky/*
8808321936Shselasky* PARAMETERS
8809321936Shselasky*	p_iou_info
8810321936Shselasky*		[in] Pointer to the IO Unit information structure.
8811321936Shselasky*
8812321936Shselasky* RETURN VALUES
8813321936Shselasky*	OptionROM field of the IO Unit information.
8814321936Shselasky*
8815321936Shselasky* NOTES
8816321936Shselasky*
8817321936Shselasky* SEE ALSO
8818321936Shselasky*	ib_iou_info_t
8819321936Shselasky*********/
8820321936Shselasky
8821321936Shselasky/****f* IBA Base: Types/ioc_at_slot
8822321936Shselasky* NAME
8823321936Shselasky*	ioc_at_slot
8824321936Shselasky*
8825321936Shselasky* DESCRIPTION
8826321936Shselasky*	Returns the IOC value at the specified slot.
8827321936Shselasky*
8828321936Shselasky* SYNOPSIS
8829321936Shselasky*/
8830321936Shselaskystatic inline uint8_t OSM_API
8831321936Shselaskyioc_at_slot(IN const ib_iou_info_t * const p_iou_info, IN uint8_t slot)
8832321936Shselasky{
8833321936Shselasky	if (slot >= IB_DM_CTRL_LIST_SIZE)
8834321936Shselasky		return SLOT_DOES_NOT_EXIST;
8835321936Shselasky	else
8836321936Shselasky		return (int8_t)
8837321936Shselasky		    ((slot % 2) ?
8838321936Shselasky		     ((p_iou_info->controller_list[slot / 2] & 0xf0) >> 4) :
8839321936Shselasky		     (p_iou_info->controller_list[slot / 2] & 0x0f));
8840321936Shselasky}
8841321936Shselasky
8842321936Shselasky/*
8843321936Shselasky* PARAMETERS
8844321936Shselasky*	p_iou_info
8845321936Shselasky*		[in] Pointer to the IO Unit information structure.
8846321936Shselasky*
8847321936Shselasky*	slot
8848321936Shselasky*		[in] Pointer to the IO Unit information structure.
8849321936Shselasky*
8850321936Shselasky* RETURN VALUES
8851321936Shselasky*	OptionROM field of the IO Unit information.
8852321936Shselasky*
8853321936Shselasky* NOTES
8854321936Shselasky*
8855321936Shselasky* SEE ALSO
8856321936Shselasky*	ib_iou_info_t
8857321936Shselasky*********/
8858321936Shselasky
8859321936Shselasky/****s* IBA Base: Types/ib_ioc_profile_t
8860321936Shselasky* NAME
8861321936Shselasky*	ib_ioc_profile_t
8862321936Shselasky*
8863321936Shselasky* DESCRIPTION
8864321936Shselasky*	IBA defined IO Controller profile structure (16.3.3.4)
8865321936Shselasky*
8866321936Shselasky* SYNOPSIS
8867321936Shselasky*/
8868321936Shselasky#include <complib/cl_packon.h>
8869321936Shselaskytypedef struct _ib_ioc_profile {
8870321936Shselasky	ib_net64_t ioc_guid;
8871321936Shselasky	ib_net32_t vend_id;
8872321936Shselasky	ib_net32_t dev_id;
8873321936Shselasky	ib_net16_t dev_ver;
8874321936Shselasky	ib_net16_t resv2;
8875321936Shselasky	ib_net32_t subsys_vend_id;
8876321936Shselasky	ib_net32_t subsys_id;
8877321936Shselasky	ib_net16_t io_class;
8878321936Shselasky	ib_net16_t io_subclass;
8879321936Shselasky	ib_net16_t protocol;
8880321936Shselasky	ib_net16_t protocol_ver;
8881321936Shselasky	ib_net32_t resv3;
8882321936Shselasky	ib_net16_t send_msg_depth;
8883321936Shselasky	uint8_t resv4;
8884321936Shselasky	uint8_t rdma_read_depth;
8885321936Shselasky	ib_net32_t send_msg_size;
8886321936Shselasky	ib_net32_t rdma_size;
8887321936Shselasky	uint8_t ctrl_ops_cap;
8888321936Shselasky#define	CTRL_OPS_CAP_ST		0x01
8889321936Shselasky#define	CTRL_OPS_CAP_SF		0x02
8890321936Shselasky#define	CTRL_OPS_CAP_RT		0x04
8891321936Shselasky#define	CTRL_OPS_CAP_RF		0x08
8892321936Shselasky#define	CTRL_OPS_CAP_WT		0x10
8893321936Shselasky#define	CTRL_OPS_CAP_WF		0x20
8894321936Shselasky#define	CTRL_OPS_CAP_AT		0x40
8895321936Shselasky#define	CTRL_OPS_CAP_AF		0x80
8896321936Shselasky	uint8_t resv5;
8897321936Shselasky	uint8_t num_svc_entries;
8898321936Shselasky#define	MAX_NUM_SVC_ENTRIES	0xff
8899321936Shselasky	uint8_t resv6[9];
8900321936Shselasky#define	CTRL_ID_STRING_LEN	64
8901321936Shselasky	char id_string[CTRL_ID_STRING_LEN];
8902321936Shselasky} PACK_SUFFIX ib_ioc_profile_t;
8903321936Shselasky#include <complib/cl_packoff.h>
8904321936Shselasky/*
8905321936Shselasky* FIELDS
8906321936Shselasky*	ioc_guid
8907321936Shselasky*		An EUI-64 GUID used to uniquely identify the IO controller.
8908321936Shselasky*
8909321936Shselasky*	vend_id
8910321936Shselasky*		IO controller vendor ID, IEEE format.
8911321936Shselasky*
8912321936Shselasky*	dev_id
8913321936Shselasky*		A number assigned by the vendor to identify the type of controller.
8914321936Shselasky*
8915321936Shselasky*	dev_ver
8916321936Shselasky*		A number assigned by the vendor to identify the divice version.
8917321936Shselasky*
8918321936Shselasky*	subsys_vend_id
8919321936Shselasky*		ID of the vendor of the enclosure, if any, in which the IO controller
8920321936Shselasky*		resides in IEEE format; otherwise zero.
8921321936Shselasky*
8922321936Shselasky*	subsys_id
8923321936Shselasky*		A number identifying the subsystem where the controller resides.
8924321936Shselasky*
8925321936Shselasky*	io_class
8926321936Shselasky*		0x0000 - 0xfffe = reserved for IO classes encompased by InfiniBand
8927321936Shselasky*		Architecture.  0xffff = Vendor specific.
8928321936Shselasky*
8929321936Shselasky*	io_subclass
8930321936Shselasky*		0x0000 - 0xfffe = reserved for IO subclasses encompased by InfiniBand
8931321936Shselasky*		Architecture.  0xffff = Vendor specific.  This shall be set to 0xfff
8932321936Shselasky*		if the io_class component is 0xffff.
8933321936Shselasky*
8934321936Shselasky*	protocol
8935321936Shselasky*		0x0000 - 0xfffe = reserved for IO subclasses encompased by InfiniBand
8936321936Shselasky*		Architecture.  0xffff = Vendor specific.  This shall be set to 0xfff
8937321936Shselasky*		if the io_class component is 0xffff.
8938321936Shselasky*
8939321936Shselasky*	protocol_ver
8940321936Shselasky*		Protocol specific.
8941321936Shselasky*
8942321936Shselasky*	send_msg_depth
8943321936Shselasky*		Maximum depth of the send message queue.
8944321936Shselasky*
8945321936Shselasky*	rdma_read_depth
8946321936Shselasky*		Maximum depth of the per-channel RDMA read queue.
8947321936Shselasky*
8948321936Shselasky*	send_msg_size
8949321936Shselasky*		Maximum size of send messages.
8950321936Shselasky*
8951321936Shselasky*	ctrl_ops_cap
8952321936Shselasky*		Supported operation types of this IO controller.  A bit set to one
8953321936Shselasky*		for affirmation of supported capability.
8954321936Shselasky*
8955321936Shselasky*	num_svc_entries
8956321936Shselasky*		Number of entries in the service entries table.
8957321936Shselasky*
8958321936Shselasky*	id_string
8959321936Shselasky*		UTF-8 encoded string for identifying the controller to an operator.
8960321936Shselasky*
8961321936Shselasky* SEE ALSO
8962321936Shselasky* ib_dm_mad_t
8963321936Shselasky*********/
8964321936Shselasky
8965321936Shselaskystatic inline uint32_t OSM_API
8966321936Shselaskyib_ioc_profile_get_vend_id(IN const ib_ioc_profile_t * const p_ioc_profile)
8967321936Shselasky{
8968321936Shselasky	return (cl_ntoh32(p_ioc_profile->vend_id) >> 8);
8969321936Shselasky}
8970321936Shselasky
8971321936Shselaskystatic inline void OSM_API
8972321936Shselaskyib_ioc_profile_set_vend_id(IN ib_ioc_profile_t * const p_ioc_profile,
8973321936Shselasky			   IN const uint32_t vend_id)
8974321936Shselasky{
8975321936Shselasky	p_ioc_profile->vend_id = (cl_hton32(vend_id) << 8);
8976321936Shselasky}
8977321936Shselasky
8978321936Shselasky/****s* IBA Base: Types/ib_svc_entry_t
8979321936Shselasky* NAME
8980321936Shselasky*	ib_svc_entry_t
8981321936Shselasky*
8982321936Shselasky* DESCRIPTION
8983321936Shselasky*	IBA defined IO Controller service entry structure (16.3.3.5)
8984321936Shselasky*
8985321936Shselasky* SYNOPSIS
8986321936Shselasky*/
8987321936Shselasky#include <complib/cl_packon.h>
8988321936Shselaskytypedef struct _ib_svc_entry {
8989321936Shselasky#define	MAX_SVC_ENTRY_NAME_LEN		40
8990321936Shselasky	char name[MAX_SVC_ENTRY_NAME_LEN];
8991321936Shselasky	ib_net64_t id;
8992321936Shselasky} PACK_SUFFIX ib_svc_entry_t;
8993321936Shselasky#include <complib/cl_packoff.h>
8994321936Shselasky/*
8995321936Shselasky* FIELDS
8996321936Shselasky*	name
8997321936Shselasky*		UTF-8 encoded, null-terminated name of the service.
8998321936Shselasky*
8999321936Shselasky*	id
9000321936Shselasky*		An identifier of the associated Service.
9001321936Shselasky*
9002321936Shselasky* SEE ALSO
9003321936Shselasky* ib_svc_entries_t
9004321936Shselasky*********/
9005321936Shselasky
9006321936Shselasky/****s* IBA Base: Types/ib_svc_entries_t
9007321936Shselasky* NAME
9008321936Shselasky*	ib_svc_entries_t
9009321936Shselasky*
9010321936Shselasky* DESCRIPTION
9011321936Shselasky*	IBA defined IO Controller service entry array (16.3.3.5)
9012321936Shselasky*
9013321936Shselasky* SYNOPSIS
9014321936Shselasky*/
9015321936Shselasky#include <complib/cl_packon.h>
9016321936Shselaskytypedef struct _ib_svc_entries {
9017321936Shselasky#define	SVC_ENTRY_COUNT			4
9018321936Shselasky	ib_svc_entry_t service_entry[SVC_ENTRY_COUNT];
9019321936Shselasky} PACK_SUFFIX ib_svc_entries_t;
9020321936Shselasky#include <complib/cl_packoff.h>
9021321936Shselasky/*
9022321936Shselasky* FIELDS
9023321936Shselasky*	service_entry
9024321936Shselasky*		An array of IO controller service entries.
9025321936Shselasky*
9026321936Shselasky* SEE ALSO
9027321936Shselasky* ib_dm_mad_t, ib_svc_entry_t
9028321936Shselasky*********/
9029321936Shselasky
9030321936Shselaskystatic inline void OSM_API
9031321936Shselaskyib_dm_get_slot_lo_hi(IN const ib_net32_t slot_lo_hi,
9032321936Shselasky		     OUT uint8_t * const p_slot,
9033321936Shselasky		     OUT uint8_t * const p_lo, OUT uint8_t * const p_hi)
9034321936Shselasky{
9035321936Shselasky	ib_net32_t tmp_slot_lo_hi = CL_NTOH32(slot_lo_hi);
9036321936Shselasky
9037321936Shselasky	if (p_slot)
9038321936Shselasky		*p_slot = (uint8_t) ((tmp_slot_lo_hi >> 16) & 0x0f);
9039321936Shselasky	if (p_hi)
9040321936Shselasky		*p_hi = (uint8_t) ((tmp_slot_lo_hi >> 8) & 0xff);
9041321936Shselasky	if (p_lo)
9042321936Shselasky		*p_lo = (uint8_t) ((tmp_slot_lo_hi >> 0) & 0xff);
9043321936Shselasky}
9044321936Shselasky
9045321936Shselasky/*
9046321936Shselasky *	IBA defined information describing an I/O controller
9047321936Shselasky */
9048321936Shselasky#include <complib/cl_packon.h>
9049321936Shselaskytypedef struct _ib_ioc_info {
9050321936Shselasky	ib_net64_t module_guid;
9051321936Shselasky	ib_net64_t iou_guid;
9052321936Shselasky	ib_ioc_profile_t ioc_profile;
9053321936Shselasky	ib_net64_t access_key;
9054321936Shselasky	uint16_t initiators_conf;
9055321936Shselasky	uint8_t resv[38];
9056321936Shselasky} PACK_SUFFIX ib_ioc_info_t;
9057321936Shselasky#include <complib/cl_packoff.h>
9058321936Shselasky
9059321936Shselasky/*
9060321936Shselasky *	The following definitions are shared between the Access Layer and VPD
9061321936Shselasky */
9062321936Shselaskytypedef struct _ib_ca *__ptr64 ib_ca_handle_t;
9063321936Shselaskytypedef struct _ib_pd *__ptr64 ib_pd_handle_t;
9064321936Shselaskytypedef struct _ib_rdd *__ptr64 ib_rdd_handle_t;
9065321936Shselaskytypedef struct _ib_mr *__ptr64 ib_mr_handle_t;
9066321936Shselaskytypedef struct _ib_mw *__ptr64 ib_mw_handle_t;
9067321936Shselaskytypedef struct _ib_qp *__ptr64 ib_qp_handle_t;
9068321936Shselaskytypedef struct _ib_eec *__ptr64 ib_eec_handle_t;
9069321936Shselaskytypedef struct _ib_cq *__ptr64 ib_cq_handle_t;
9070321936Shselaskytypedef struct _ib_av *__ptr64 ib_av_handle_t;
9071321936Shselaskytypedef struct _ib_mcast *__ptr64 ib_mcast_handle_t;
9072321936Shselasky
9073321936Shselasky/* Currently for windows branch, use the extended version of ib special verbs struct
9074321936Shselasky	in order to be compliant with Infinicon ib_types; later we'll change it to support
9075321936Shselasky	OpenSM ib_types.h */
9076321936Shselasky
9077321936Shselasky#ifndef __WIN__
9078321936Shselasky/****d* Access Layer/ib_api_status_t
9079321936Shselasky* NAME
9080321936Shselasky*	ib_api_status_t
9081321936Shselasky*
9082321936Shselasky* DESCRIPTION
9083321936Shselasky*	Function return codes indicating the success or failure of an API call.
9084321936Shselasky*	Note that success is indicated by the return value IB_SUCCESS, which
9085321936Shselasky*	is always zero.
9086321936Shselasky*
9087321936Shselasky* NOTES
9088321936Shselasky*	IB_VERBS_PROCESSING_DONE is used by UVP library to terminate a verbs call
9089321936Shselasky*	in the pre-ioctl step itself.
9090321936Shselasky*
9091321936Shselasky* SYNOPSIS
9092321936Shselasky*/
9093321936Shselaskytypedef enum _ib_api_status_t {
9094321936Shselasky	IB_SUCCESS,
9095321936Shselasky	IB_INSUFFICIENT_RESOURCES,
9096321936Shselasky	IB_INSUFFICIENT_MEMORY,
9097321936Shselasky	IB_INVALID_PARAMETER,
9098321936Shselasky	IB_INVALID_SETTING,
9099321936Shselasky	IB_NOT_FOUND,
9100321936Shselasky	IB_TIMEOUT,
9101321936Shselasky	IB_CANCELED,
9102321936Shselasky	IB_INTERRUPTED,
9103321936Shselasky	IB_INVALID_PERMISSION,
9104321936Shselasky	IB_UNSUPPORTED,
9105321936Shselasky	IB_OVERFLOW,
9106321936Shselasky	IB_MAX_MCAST_QPS_REACHED,
9107321936Shselasky	IB_INVALID_QP_STATE,
9108321936Shselasky	IB_INVALID_EEC_STATE,
9109321936Shselasky	IB_INVALID_APM_STATE,
9110321936Shselasky	IB_INVALID_PORT_STATE,
9111321936Shselasky	IB_INVALID_STATE,
9112321936Shselasky	IB_RESOURCE_BUSY,
9113321936Shselasky	IB_INVALID_PKEY,
9114321936Shselasky	IB_INVALID_LKEY,
9115321936Shselasky	IB_INVALID_RKEY,
9116321936Shselasky	IB_INVALID_MAX_WRS,
9117321936Shselasky	IB_INVALID_MAX_SGE,
9118321936Shselasky	IB_INVALID_CQ_SIZE,
9119321936Shselasky	IB_INVALID_SERVICE_TYPE,
9120321936Shselasky	IB_INVALID_GID,
9121321936Shselasky	IB_INVALID_LID,
9122321936Shselasky	IB_INVALID_GUID,
9123321936Shselasky	IB_INVALID_CA_HANDLE,
9124321936Shselasky	IB_INVALID_AV_HANDLE,
9125321936Shselasky	IB_INVALID_CQ_HANDLE,
9126321936Shselasky	IB_INVALID_EEC_HANDLE,
9127321936Shselasky	IB_INVALID_QP_HANDLE,
9128321936Shselasky	IB_INVALID_PD_HANDLE,
9129321936Shselasky	IB_INVALID_MR_HANDLE,
9130321936Shselasky	IB_INVALID_MW_HANDLE,
9131321936Shselasky	IB_INVALID_RDD_HANDLE,
9132321936Shselasky	IB_INVALID_MCAST_HANDLE,
9133321936Shselasky	IB_INVALID_CALLBACK,
9134321936Shselasky	IB_INVALID_AL_HANDLE,	/* InfiniBand Access Layer */
9135321936Shselasky	IB_INVALID_HANDLE,	/* InfiniBand Access Layer */
9136321936Shselasky	IB_ERROR,		/* InfiniBand Access Layer */
9137321936Shselasky	IB_REMOTE_ERROR,	/* Infiniband Access Layer */
9138321936Shselasky	IB_VERBS_PROCESSING_DONE,	/* See Notes above         */
9139321936Shselasky	IB_INVALID_WR_TYPE,
9140321936Shselasky	IB_QP_IN_TIMEWAIT,
9141321936Shselasky	IB_EE_IN_TIMEWAIT,
9142321936Shselasky	IB_INVALID_PORT,
9143321936Shselasky	IB_NOT_DONE,
9144321936Shselasky	IB_UNKNOWN_ERROR	/* ALWAYS LAST ENUM VALUE! */
9145321936Shselasky} ib_api_status_t;
9146321936Shselasky/*****/
9147321936Shselasky
9148321936ShselaskyOSM_EXPORT const char *ib_error_str[];
9149321936Shselasky
9150321936Shselasky/****f* IBA Base: Types/ib_get_err_str
9151321936Shselasky* NAME
9152321936Shselasky*	ib_get_err_str
9153321936Shselasky*
9154321936Shselasky* DESCRIPTION
9155321936Shselasky*	Returns a string for the specified status value.
9156321936Shselasky*
9157321936Shselasky* SYNOPSIS
9158321936Shselasky*/
9159321936Shselaskystatic inline const char *OSM_API ib_get_err_str(IN ib_api_status_t status)
9160321936Shselasky{
9161321936Shselasky	if (status > IB_UNKNOWN_ERROR)
9162321936Shselasky		status = IB_UNKNOWN_ERROR;
9163321936Shselasky	return (ib_error_str[status]);
9164321936Shselasky}
9165321936Shselasky
9166321936Shselasky/*
9167321936Shselasky* PARAMETERS
9168321936Shselasky*	status
9169321936Shselasky*		[in] status value
9170321936Shselasky*
9171321936Shselasky* RETURN VALUES
9172321936Shselasky*	Pointer to the status description string.
9173321936Shselasky*
9174321936Shselasky* NOTES
9175321936Shselasky*
9176321936Shselasky* SEE ALSO
9177321936Shselasky*********/
9178321936Shselasky
9179321936Shselasky/****d* Verbs/ib_async_event_t
9180321936Shselasky* NAME
9181321936Shselasky*	ib_async_event_t -- Async event types
9182321936Shselasky*
9183321936Shselasky* DESCRIPTION
9184321936Shselasky*	This type indicates the reason the async callback was called.
9185321936Shselasky*	The context in the ib_event_rec_t indicates the resource context
9186321936Shselasky*	that associated with the callback.  For example, for IB_AE_CQ_ERROR
9187321936Shselasky*	the context provided during the ib_create_cq is returned in the event.
9188321936Shselasky*
9189321936Shselasky* SYNOPSIS
9190321936Shselasky*/
9191321936Shselaskytypedef enum _ib_async_event_t {
9192321936Shselasky	IB_AE_SQ_ERROR = 1,
9193321936Shselasky	IB_AE_SQ_DRAINED,
9194321936Shselasky	IB_AE_RQ_ERROR,
9195321936Shselasky	IB_AE_CQ_ERROR,
9196321936Shselasky	IB_AE_QP_FATAL,
9197321936Shselasky	IB_AE_QP_COMM,
9198321936Shselasky	IB_AE_QP_APM,
9199321936Shselasky	IB_AE_EEC_FATAL,
9200321936Shselasky	IB_AE_EEC_COMM,
9201321936Shselasky	IB_AE_EEC_APM,
9202321936Shselasky	IB_AE_LOCAL_FATAL,
9203321936Shselasky	IB_AE_PKEY_TRAP,
9204321936Shselasky	IB_AE_QKEY_TRAP,
9205321936Shselasky	IB_AE_MKEY_TRAP,
9206321936Shselasky	IB_AE_PORT_TRAP,
9207321936Shselasky	IB_AE_SYSIMG_GUID_TRAP,
9208321936Shselasky	IB_AE_BUF_OVERRUN,
9209321936Shselasky	IB_AE_LINK_INTEGRITY,
9210321936Shselasky	IB_AE_FLOW_CTRL_ERROR,
9211321936Shselasky	IB_AE_BKEY_TRAP,
9212321936Shselasky	IB_AE_QP_APM_ERROR,
9213321936Shselasky	IB_AE_EEC_APM_ERROR,
9214321936Shselasky	IB_AE_WQ_REQ_ERROR,
9215321936Shselasky	IB_AE_WQ_ACCESS_ERROR,
9216321936Shselasky	IB_AE_PORT_ACTIVE,
9217321936Shselasky	IB_AE_PORT_DOWN,
9218321936Shselasky	IB_AE_UNKNOWN		/* ALWAYS LAST ENUM VALUE */
9219321936Shselasky} ib_async_event_t;
9220321936Shselasky/*
9221321936Shselasky* VALUES
9222321936Shselasky*	IB_AE_SQ_ERROR
9223321936Shselasky*		An error occurred when accessing the send queue of the QP or EEC.
9224321936Shselasky*		This event is optional.
9225321936Shselasky*
9226321936Shselasky*	IB_AE_SQ_DRAINED
9227321936Shselasky*		The send queue of the specified QP has completed the outstanding
9228321936Shselasky*		messages in progress when the state change was requested and, if
9229321936Shselasky*		applicable, has received all acknowledgements for those messages.
9230321936Shselasky*
9231321936Shselasky*	IB_AE_RQ_ERROR
9232321936Shselasky*		An error occurred when accessing the receive queue of the QP or EEC.
9233321936Shselasky*		This event is optional.
9234321936Shselasky*
9235321936Shselasky*	IB_AE_CQ_ERROR
9236321936Shselasky*		An error occurred when writing an entry to the CQ.
9237321936Shselasky*
9238321936Shselasky*	IB_AE_QP_FATAL
9239321936Shselasky*		A catastrophic error occurred while accessing or processing the
9240321936Shselasky*		work queue that prevents reporting of completions.
9241321936Shselasky*
9242321936Shselasky*	IB_AE_QP_COMM
9243321936Shselasky*		The first packet has arrived for the receive work queue where the
9244321936Shselasky*		QP is still in the RTR state.
9245321936Shselasky*
9246321936Shselasky*	IB_AE_QP_APM
9247321936Shselasky*		If alternate path migration is supported, this event indicates that
9248321936Shselasky*		the QP connection has migrated to the alternate path.
9249321936Shselasky*
9250321936Shselasky*	IB_AE_EEC_FATAL
9251321936Shselasky*		If reliable datagram service is supported, this event indicates that
9252321936Shselasky*		a catastrophic error occurred while accessing or processing the EEC
9253321936Shselasky*		that prevents reporting of completions.
9254321936Shselasky*
9255321936Shselasky*	IB_AE_EEC_COMM
9256321936Shselasky*		If reliable datagram service is supported, this event indicates that
9257321936Shselasky*		the first packet has arrived for the receive work queue where the
9258321936Shselasky*		EEC is still in the RTR state.
9259321936Shselasky*
9260321936Shselasky*	IB_AE_EEC_APM
9261321936Shselasky*		If reliable datagram service and alternate path migration is supported,
9262321936Shselasky*		this event indicates that the EEC connection has migrated to the
9263321936Shselasky*		alternate path.
9264321936Shselasky*
9265321936Shselasky*	IB_AE_LOCAL_FATAL
9266321936Shselasky*		A catastrophic HCA error occurred which cannot be attributed to
9267321936Shselasky*		any resource; behavior is indeterminate.
9268321936Shselasky*
9269321936Shselasky*	IB_AE_PKEY_TRAP
9270321936Shselasky*		A PKEY violation was detected.  This event is optional.
9271321936Shselasky*
9272321936Shselasky*	IB_AE_QKEY_TRAP
9273321936Shselasky*		A QKEY violation was detected.  This event is optional.
9274321936Shselasky*
9275321936Shselasky*	IB_AE_MKEY_TRAP
9276321936Shselasky*		A MKEY violation was detected.  This event is optional.
9277321936Shselasky*
9278321936Shselasky*	IB_AE_PORT_TRAP
9279321936Shselasky*		A port capability change was detected.  This event is optional.
9280321936Shselasky*
9281321936Shselasky*	IB_AE_SYSIMG_GUID_TRAP
9282321936Shselasky*		If the system image GUID is supported, this event indicates that
9283321936Shselasky*		the system image GUID of this HCA has been changed.  This event
9284321936Shselasky*		is optional.
9285321936Shselasky*
9286321936Shselasky*	IB_AE_BUF_OVERRUN
9287321936Shselasky*		The number of consecutive flow control update periods with at least
9288321936Shselasky*		one overrun error in each period has exceeded the threshold specified
9289321936Shselasky*		in the port info attributes.  This event is optional.
9290321936Shselasky*
9291321936Shselasky*	IB_AE_LINK_INTEGRITY
9292321936Shselasky*		The detection of excessively frequent local physical errors has
9293321936Shselasky*		exceeded the threshold specified in the port info attributes.  This
9294321936Shselasky*		event is optional.
9295321936Shselasky*
9296321936Shselasky*	IB_AE_FLOW_CTRL_ERROR
9297321936Shselasky*		An HCA watchdog timer monitoring the arrival of flow control updates
9298321936Shselasky*		has expired without receiving an update.  This event is optional.
9299321936Shselasky*
9300321936Shselasky*	IB_AE_BKEY_TRAP
9301321936Shselasky*		An BKEY violation was detected.  This event is optional.
9302321936Shselasky*
9303321936Shselasky*	IB_AE_QP_APM_ERROR
9304321936Shselasky*		If alternate path migration is supported, this event indicates that
9305321936Shselasky*		an incoming path migration request to this QP was not accepted.
9306321936Shselasky*
9307321936Shselasky*	IB_AE_EEC_APM_ERROR
9308321936Shselasky*		If reliable datagram service and alternate path migration is supported,
9309321936Shselasky*		this event indicates that an incoming path migration request to this
9310321936Shselasky*		EEC was not accepted.
9311321936Shselasky*
9312321936Shselasky*	IB_AE_WQ_REQ_ERROR
9313321936Shselasky*		An OpCode violation was detected at the responder.
9314321936Shselasky*
9315321936Shselasky*	IB_AE_WQ_ACCESS_ERROR
9316321936Shselasky*		An access violation was detected at the responder.
9317321936Shselasky*
9318321936Shselasky*	IB_AE_PORT_ACTIVE
9319321936Shselasky*		If the port active event is supported, this event is generated
9320321936Shselasky*		when the link becomes active: IB_LINK_ACTIVE.
9321321936Shselasky*
9322321936Shselasky*	IB_AE_PORT_DOWN
9323321936Shselasky*		The link is declared unavailable: IB_LINK_INIT, IB_LINK_ARMED,
9324321936Shselasky*		IB_LINK_DOWN.
9325321936Shselasky*
9326321936Shselasky*	IB_AE_UNKNOWN
9327321936Shselasky*		An unknown error occurred which cannot be attributed to any
9328321936Shselasky*		resource; behavior is indeterminate.
9329321936Shselasky*
9330321936Shselasky*****/
9331321936Shselasky
9332321936ShselaskyOSM_EXPORT const char *ib_async_event_str[];
9333321936Shselasky
9334321936Shselasky/****f* IBA Base: Types/ib_get_async_event_str
9335321936Shselasky* NAME
9336321936Shselasky*	ib_get_async_event_str
9337321936Shselasky*
9338321936Shselasky* DESCRIPTION
9339321936Shselasky*	Returns a string for the specified asynchronous event.
9340321936Shselasky*
9341321936Shselasky* SYNOPSIS
9342321936Shselasky*/
9343321936Shselaskystatic inline const char *OSM_API
9344321936Shselaskyib_get_async_event_str(IN ib_async_event_t event)
9345321936Shselasky{
9346321936Shselasky	if (event > IB_AE_UNKNOWN)
9347321936Shselasky		event = IB_AE_UNKNOWN;
9348321936Shselasky	return (ib_async_event_str[event]);
9349321936Shselasky}
9350321936Shselasky
9351321936Shselasky/*
9352321936Shselasky* PARAMETERS
9353321936Shselasky*	event
9354321936Shselasky*		[in] event value
9355321936Shselasky*
9356321936Shselasky* RETURN VALUES
9357321936Shselasky*	Pointer to the asynchronous event description string.
9358321936Shselasky*
9359321936Shselasky* NOTES
9360321936Shselasky*
9361321936Shselasky* SEE ALSO
9362321936Shselasky*********/
9363321936Shselasky
9364321936Shselasky/****s* Verbs/ib_event_rec_t
9365321936Shselasky* NAME
9366321936Shselasky*	ib_event_rec_t -- Async event notification record
9367321936Shselasky*
9368321936Shselasky* DESCRIPTION
9369321936Shselasky*	When an async event callback is made, this structure is passed to indicate
9370321936Shselasky*	the type of event, the source of event that caused it, and the context
9371321936Shselasky*	associated with this event.
9372321936Shselasky*
9373321936Shselasky*	context -- Context of the resource that caused the event.
9374321936Shselasky*		-- ca_context if this is a port/adapter event.
9375321936Shselasky*		-- qp_context if the source is a QP event
9376321936Shselasky*		-- cq_context if the source is a CQ event.
9377321936Shselasky*		-- ee_context if the source is an EE event.
9378321936Shselasky*
9379321936Shselasky* SYNOPSIS
9380321936Shselasky*/
9381321936Shselaskytypedef struct _ib_event_rec {
9382321936Shselasky	void *context;
9383321936Shselasky	ib_async_event_t type;
9384321936Shselasky	/* HCA vendor specific event information. */
9385321936Shselasky	uint64_t vendor_specific;
9386321936Shselasky	/* The following structures are valid only for trap types. */
9387321936Shselasky	union _trap {
9388321936Shselasky		struct {
9389321936Shselasky			uint16_t lid;
9390321936Shselasky			ib_net64_t port_guid;
9391321936Shselasky			uint8_t port_num;
9392321936Shselasky			/*
9393321936Shselasky			 * The following structure is valid only for
9394321936Shselasky			 * P_KEY, Q_KEY, and M_KEY violation traps.
9395321936Shselasky			 */
9396321936Shselasky			struct {
9397321936Shselasky				uint8_t sl;
9398321936Shselasky				uint16_t src_lid;
9399321936Shselasky				uint16_t dest_lid;
9400321936Shselasky				union _key {
9401321936Shselasky					uint16_t pkey;
9402321936Shselasky					uint32_t qkey;
9403321936Shselasky					uint64_t mkey;
9404321936Shselasky				} key;
9405321936Shselasky				uint32_t src_qp;
9406321936Shselasky				uint32_t dest_qp;
9407321936Shselasky				ib_gid_t src_gid;
9408321936Shselasky				ib_gid_t dest_gid;
9409321936Shselasky			} violation;
9410321936Shselasky		} info;
9411321936Shselasky		ib_net64_t sysimg_guid;
9412321936Shselasky	} trap;
9413321936Shselasky} ib_event_rec_t;
9414321936Shselasky/*******/
9415321936Shselasky
9416321936Shselasky/****d* Access Layer/ib_atomic_t
9417321936Shselasky* NAME
9418321936Shselasky*	ib_atomic_t
9419321936Shselasky*
9420321936Shselasky* DESCRIPTION
9421321936Shselasky*	Indicates atomicity levels supported by an adapter.
9422321936Shselasky*
9423321936Shselasky* SYNOPSIS
9424321936Shselasky*/
9425321936Shselaskytypedef enum _ib_atomic_t {
9426321936Shselasky	IB_ATOMIC_NONE,
9427321936Shselasky	IB_ATOMIC_LOCAL,
9428321936Shselasky	IB_ATOMIC_GLOBAL
9429321936Shselasky} ib_atomic_t;
9430321936Shselasky/*
9431321936Shselasky* VALUES
9432321936Shselasky*	IB_ATOMIC_NONE
9433321936Shselasky*		Atomic operations not supported.
9434321936Shselasky*
9435321936Shselasky*	IB_ATOMIC_LOCAL
9436321936Shselasky*		Atomic operations guaranteed between QPs of a single CA.
9437321936Shselasky*
9438321936Shselasky*	IB_ATOMIC_GLOBAL
9439321936Shselasky*		Atomic operations are guaranteed between CA and any other entity
9440321936Shselasky*		in the system.
9441321936Shselasky*****/
9442321936Shselasky
9443321936Shselasky/****s* Access Layer/ib_port_cap_t
9444321936Shselasky* NAME
9445321936Shselasky*	ib_port_cap_t
9446321936Shselasky*
9447321936Shselasky* DESCRIPTION
9448321936Shselasky*	Indicates which management agents are currently available on the specified
9449321936Shselasky*	port.
9450321936Shselasky*
9451321936Shselasky* SYNOPSIS
9452321936Shselasky*/
9453321936Shselaskytypedef struct _ib_port_cap {
9454321936Shselasky	boolean_t cm;
9455321936Shselasky	boolean_t snmp;
9456321936Shselasky	boolean_t dev_mgmt;
9457321936Shselasky	boolean_t vend;
9458321936Shselasky	boolean_t sm;
9459321936Shselasky	boolean_t sm_disable;
9460321936Shselasky	boolean_t qkey_ctr;
9461321936Shselasky	boolean_t pkey_ctr;
9462321936Shselasky	boolean_t notice;
9463321936Shselasky	boolean_t trap;
9464321936Shselasky	boolean_t apm;
9465321936Shselasky	boolean_t slmap;
9466321936Shselasky	boolean_t pkey_nvram;
9467321936Shselasky	boolean_t mkey_nvram;
9468321936Shselasky	boolean_t sysguid;
9469321936Shselasky	boolean_t dr_notice;
9470321936Shselasky	boolean_t boot_mgmt;
9471321936Shselasky	boolean_t capm_notice;
9472321936Shselasky	boolean_t reinit;
9473321936Shselasky	boolean_t ledinfo;
9474321936Shselasky	boolean_t port_active;
9475321936Shselasky} ib_port_cap_t;
9476321936Shselasky/*****/
9477321936Shselasky
9478321936Shselasky/****d* Access Layer/ib_init_type_t
9479321936Shselasky* NAME
9480321936Shselasky*	ib_init_type_t
9481321936Shselasky*
9482321936Shselasky* DESCRIPTION
9483321936Shselasky*	If supported by the HCA, the type of initialization requested by
9484321936Shselasky*	this port before SM moves it to the active or armed state.  If the
9485321936Shselasky*	SM implements reinitialization, it shall set these bits to indicate
9486321936Shselasky*	the type of initialization performed prior to activating the port.
9487321936Shselasky*	Otherwise, these bits shall be set to 0.
9488321936Shselasky*
9489321936Shselasky* SYNOPSIS
9490321936Shselasky*/
9491321936Shselaskytypedef uint8_t ib_init_type_t;
9492321936Shselasky#define IB_INIT_TYPE_NO_LOAD			0x01
9493321936Shselasky#define IB_INIT_TYPE_PRESERVE_CONTENT		0x02
9494321936Shselasky#define IB_INIT_TYPE_PRESERVE_PRESENCE		0x04
9495321936Shselasky#define IB_INIT_TYPE_DO_NOT_RESUSCITATE		0x08
9496321936Shselasky/*****/
9497321936Shselasky
9498321936Shselasky/****s* Access Layer/ib_port_attr_mod_t
9499321936Shselasky* NAME
9500321936Shselasky*	ib_port_attr_mod_t
9501321936Shselasky*
9502321936Shselasky* DESCRIPTION
9503321936Shselasky*	Port attributes that may be modified.
9504321936Shselasky*
9505321936Shselasky* SYNOPSIS
9506321936Shselasky*/
9507321936Shselaskytypedef struct _ib_port_attr_mod {
9508321936Shselasky	ib_port_cap_t cap;
9509321936Shselasky	uint16_t pkey_ctr;
9510321936Shselasky	uint16_t qkey_ctr;
9511321936Shselasky	ib_init_type_t init_type;
9512321936Shselasky	ib_net64_t system_image_guid;
9513321936Shselasky} ib_port_attr_mod_t;
9514321936Shselasky/*
9515321936Shselasky* SEE ALSO
9516321936Shselasky*	ib_port_cap_t
9517321936Shselasky*****/
9518321936Shselasky
9519321936Shselasky/****s* Access Layer/ib_port_attr_t
9520321936Shselasky* NAME
9521321936Shselasky*	ib_port_attr_t
9522321936Shselasky*
9523321936Shselasky* DESCRIPTION
9524321936Shselasky*	Information about a port on a given channel adapter.
9525321936Shselasky*
9526321936Shselasky* SYNOPSIS
9527321936Shselasky*/
9528321936Shselaskytypedef struct _ib_port_attr {
9529321936Shselasky	ib_net64_t port_guid;
9530321936Shselasky	uint8_t port_num;
9531321936Shselasky	uint8_t mtu;
9532321936Shselasky	uint64_t max_msg_size;
9533321936Shselasky	ib_net16_t lid;
9534321936Shselasky	uint8_t lmc;
9535321936Shselasky	/*
9536321936Shselasky	 * LinkWidthSupported as defined in PortInfo.  Required to calculate
9537321936Shselasky	 * inter-packet delay (a.k.a. static rate).
9538321936Shselasky	 */
9539321936Shselasky	uint8_t link_width_supported;
9540321936Shselasky	uint16_t max_vls;
9541321936Shselasky	ib_net16_t sm_lid;
9542321936Shselasky	uint8_t sm_sl;
9543321936Shselasky	uint8_t link_state;
9544321936Shselasky	ib_init_type_t init_type_reply;	/* Optional */
9545321936Shselasky	/*
9546321936Shselasky	 * subnet_timeout:
9547321936Shselasky	 * The maximum expected subnet propagation delay to reach any port on
9548321936Shselasky	 * the subnet.  This value also determines the rate at which traps can
9549321936Shselasky	 * be generated from this node.
9550321936Shselasky	 *
9551321936Shselasky	 * timeout = 4.096 microseconds * 2^subnet_timeout
9552321936Shselasky	 */
9553321936Shselasky	uint8_t subnet_timeout;
9554321936Shselasky	ib_port_cap_t cap;
9555321936Shselasky	uint16_t pkey_ctr;
9556321936Shselasky	uint16_t qkey_ctr;
9557321936Shselasky	uint16_t num_gids;
9558321936Shselasky	uint16_t num_pkeys;
9559321936Shselasky	/*
9560321936Shselasky	 * Pointers at the end of the structure to allow doing a simple
9561321936Shselasky	 * memory comparison of contents up to the first pointer.
9562321936Shselasky	 */
9563321936Shselasky	ib_gid_t *p_gid_table;
9564321936Shselasky	ib_net16_t *p_pkey_table;
9565321936Shselasky} ib_port_attr_t;
9566321936Shselasky/*
9567321936Shselasky* SEE ALSO
9568321936Shselasky*	uint8_t, ib_port_cap_t, ib_link_states_t
9569321936Shselasky*****/
9570321936Shselasky
9571321936Shselasky/****s* Access Layer/ib_ca_attr_t
9572321936Shselasky* NAME
9573321936Shselasky*	ib_ca_attr_t
9574321936Shselasky*
9575321936Shselasky* DESCRIPTION
9576321936Shselasky*	Information about a channel adapter.
9577321936Shselasky*
9578321936Shselasky* SYNOPSIS
9579321936Shselasky*/
9580321936Shselaskytypedef struct _ib_ca_attr {
9581321936Shselasky	ib_net64_t ca_guid;
9582321936Shselasky	uint32_t vend_id;
9583321936Shselasky	uint16_t dev_id;
9584321936Shselasky	uint16_t revision;
9585321936Shselasky	uint64_t fw_ver;
9586321936Shselasky	/*
9587321936Shselasky	 * Total size of the ca attributes in bytes
9588321936Shselasky	 */
9589321936Shselasky	uint32_t size;
9590321936Shselasky	uint32_t max_qps;
9591321936Shselasky	uint32_t max_wrs;
9592321936Shselasky	uint32_t max_sges;
9593321936Shselasky	uint32_t max_rd_sges;
9594321936Shselasky	uint32_t max_cqs;
9595321936Shselasky	uint32_t max_cqes;
9596321936Shselasky	uint32_t max_pds;
9597321936Shselasky	uint32_t init_regions;
9598321936Shselasky	uint64_t init_region_size;
9599321936Shselasky	uint32_t init_windows;
9600321936Shselasky	uint32_t max_addr_handles;
9601321936Shselasky	uint32_t max_partitions;
9602321936Shselasky	ib_atomic_t atomicity;
9603321936Shselasky	uint8_t max_qp_resp_res;
9604321936Shselasky	uint8_t max_eec_resp_res;
9605321936Shselasky	uint8_t max_resp_res;
9606321936Shselasky	uint8_t max_qp_init_depth;
9607321936Shselasky	uint8_t max_eec_init_depth;
9608321936Shselasky	uint32_t max_eecs;
9609321936Shselasky	uint32_t max_rdds;
9610321936Shselasky	uint32_t max_ipv6_qps;
9611321936Shselasky	uint32_t max_ether_qps;
9612321936Shselasky	uint32_t max_mcast_grps;
9613321936Shselasky	uint32_t max_mcast_qps;
9614321936Shselasky	uint32_t max_qps_per_mcast_grp;
9615321936Shselasky	uint32_t max_fmr;
9616321936Shselasky	uint32_t max_map_per_fmr;
9617321936Shselasky	/*
9618321936Shselasky	 * local_ack_delay:
9619321936Shselasky	 * Specifies the maximum time interval between the local CA receiving
9620321936Shselasky	 * a message and the transmission of the associated ACK or NAK.
9621321936Shselasky	 *
9622321936Shselasky	 * timeout = 4.096 microseconds * 2^local_ack_delay
9623321936Shselasky	 */
9624321936Shselasky	uint8_t local_ack_delay;
9625321936Shselasky	boolean_t bad_pkey_ctr_support;
9626321936Shselasky	boolean_t bad_qkey_ctr_support;
9627321936Shselasky	boolean_t raw_mcast_support;
9628321936Shselasky	boolean_t apm_support;
9629321936Shselasky	boolean_t av_port_check;
9630321936Shselasky	boolean_t change_primary_port;
9631321936Shselasky	boolean_t modify_wr_depth;
9632321936Shselasky	boolean_t current_qp_state_support;
9633321936Shselasky	boolean_t shutdown_port_capability;
9634321936Shselasky	boolean_t init_type_support;
9635321936Shselasky	boolean_t port_active_event_support;
9636321936Shselasky	boolean_t system_image_guid_support;
9637321936Shselasky	boolean_t hw_agents;
9638321936Shselasky	ib_net64_t system_image_guid;
9639321936Shselasky	uint32_t num_page_sizes;
9640321936Shselasky	uint8_t num_ports;
9641321936Shselasky	uint32_t *p_page_size;
9642321936Shselasky	ib_port_attr_t *p_port_attr;
9643321936Shselasky} ib_ca_attr_t;
9644321936Shselasky/*
9645321936Shselasky* FIELDS
9646321936Shselasky*	ca_guid
9647321936Shselasky*		GUID for this adapter.
9648321936Shselasky*
9649321936Shselasky*	vend_id
9650321936Shselasky*		IEEE vendor ID for this adapter
9651321936Shselasky*
9652321936Shselasky*	dev_id
9653321936Shselasky*		Device ID of this adapter. (typically from PCI device ID)
9654321936Shselasky*
9655321936Shselasky*	revision
9656321936Shselasky*		Revision ID of this adapter
9657321936Shselasky*
9658321936Shselasky*	fw_ver
9659321936Shselasky*		Device Firmware version.
9660321936Shselasky*
9661321936Shselasky*	size
9662321936Shselasky*		Total size in bytes for the HCA attributes.  This size includes total
9663321936Shselasky*		size required for all the variable members of the structure.  If a
9664321936Shselasky*		vendor requires to pass vendor specific fields beyond this structure,
9665321936Shselasky*		the HCA vendor can choose to report a larger size.  If a vendor is
9666321936Shselasky*		reporting extended vendor specific features, they should also provide
9667321936Shselasky*		appropriate access functions to aid with the required interpretation.
9668321936Shselasky*
9669321936Shselasky*	max_qps
9670321936Shselasky*		Maximum number of QP's supported by this HCA.
9671321936Shselasky*
9672321936Shselasky*	max_wrs
9673321936Shselasky*		Maximum number of work requests supported by this HCA.
9674321936Shselasky*
9675321936Shselasky*	max_sges
9676321936Shselasky*		Maximum number of scatter gather elements supported per work request.
9677321936Shselasky*
9678321936Shselasky*	max_rd_sges
9679321936Shselasky*		Maximum number of scatter gather elements supported for READ work
9680321936Shselasky*		requests for a Reliable Datagram QP.  This value must be zero if RD
9681321936Shselasky*		service is not supported.
9682321936Shselasky*
9683321936Shselasky*	max_cqs
9684321936Shselasky*		Maximum number of Completion Queues supported.
9685321936Shselasky*
9686321936Shselasky*	max_cqes
9687321936Shselasky*		Maximum number of CQ elements supported per CQ.
9688321936Shselasky*
9689321936Shselasky*	max_pds
9690321936Shselasky*		Maximum number of protection domains supported.
9691321936Shselasky*
9692321936Shselasky*	init_regions
9693321936Shselasky*		Initial number of memory regions supported.  These are only informative
9694321936Shselasky*		values.  HCA vendors can extended and grow these limits on demand.
9695321936Shselasky*
9696321936Shselasky*	init_region_size
9697321936Shselasky*		Initial limit on the size of the registered memory region.
9698321936Shselasky*
9699321936Shselasky*	init_windows
9700321936Shselasky*		Initial number of window entries supported.
9701321936Shselasky*
9702321936Shselasky*	max_addr_handles
9703321936Shselasky*		Maximum number of address handles supported.
9704321936Shselasky*
9705321936Shselasky*	max_partitions
9706321936Shselasky*		Maximum number of partitions supported.
9707321936Shselasky*
9708321936Shselasky*	atomicity
9709321936Shselasky*		Indicates level of atomic operations supported by this HCA.
9710321936Shselasky*
9711321936Shselasky*	max_qp_resp_res
9712321936Shselasky*	max_eec_resp_res
9713321936Shselasky*		Maximum limit on number of responder resources for incoming RDMA
9714321936Shselasky*		operations, on QPs and EEC's respectively.
9715321936Shselasky*
9716321936Shselasky*	max_resp_res
9717321936Shselasky*		Maximum number of responder resources per HCA, with this HCA used as
9718321936Shselasky*		the target.
9719321936Shselasky*
9720321936Shselasky*	max_qp_init_depth
9721321936Shselasky*	max_eec_init_depth
9722321936Shselasky*		Maximimum initiator depth per QP or EEC for initiating RDMA reads and
9723321936Shselasky*		atomic operations.
9724321936Shselasky*
9725321936Shselasky*	max_eecs
9726321936Shselasky*		Maximimum number of EEC's supported by the HCA.
9727321936Shselasky*
9728321936Shselasky*	max_rdds
9729321936Shselasky*		Maximum number of Reliable datagram domains supported.
9730321936Shselasky*
9731321936Shselasky*	max_ipv6_qps
9732321936Shselasky*	max_ether_qps
9733321936Shselasky*		Maximum number of IPV6 and raw ether QP's supported by this HCA.
9734321936Shselasky*
9735321936Shselasky*	max_mcast_grps
9736321936Shselasky*		Maximum number of multicast groups supported.
9737321936Shselasky*
9738321936Shselasky*	max_mcast_qps
9739321936Shselasky*		Maximum number of QP's that can support multicast operations.
9740321936Shselasky*
9741321936Shselasky*	max_qps_per_mcast_grp
9742321936Shselasky*		Maximum number of multicast QP's per multicast group.
9743321936Shselasky*
9744321936Shselasky*	local_ack_delay
9745321936Shselasky*		Specifies the maximum time interval between the local CA receiving
9746321936Shselasky*		a message and the transmission of the associated ACK or NAK.
9747321936Shselasky*		timeout = 4.096 microseconds * 2^local_ack_delay
9748321936Shselasky*
9749321936Shselasky*	bad_pkey_ctr_support
9750321936Shselasky*	bad_qkey_ctr_support
9751321936Shselasky*		Indicates support for the bad pkey and qkey counters.
9752321936Shselasky*
9753321936Shselasky*	raw_mcast_support
9754321936Shselasky*		Indicates support for raw packet multicast.
9755321936Shselasky*
9756321936Shselasky*	apm_support
9757321936Shselasky*		Indicates support for Automatic Path Migration.
9758321936Shselasky*
9759321936Shselasky*	av_port_check
9760321936Shselasky*		Indicates ability to check port number in address handles.
9761321936Shselasky*
9762321936Shselasky*	change_primary_port
9763321936Shselasky*		Indicates ability to change primary port for a QP or EEC during a
9764321936Shselasky*		SQD->RTS transition.
9765321936Shselasky*
9766321936Shselasky*	modify_wr_depth
9767321936Shselasky*		Indicates ability to modify QP depth during a modify QP operation.
9768321936Shselasky*		Check the verb specification for permitted states.
9769321936Shselasky*
9770321936Shselasky*	current_qp_state_support
9771321936Shselasky*		Indicates ability of the HCA to support the current QP state modifier
9772321936Shselasky*		during a modify QP operation.
9773321936Shselasky*
9774321936Shselasky*	shutdown_port_capability
9775321936Shselasky*		Shutdown port capability support indicator.
9776321936Shselasky*
9777321936Shselasky*	init_type_support
9778321936Shselasky*		Indicates init_type_reply and ability to set init_type is supported.
9779321936Shselasky*
9780321936Shselasky*	port_active_event_support
9781321936Shselasky*		Port active event support indicator.
9782321936Shselasky*
9783321936Shselasky*	system_image_guid_support
9784321936Shselasky*		System image GUID support indicator.
9785321936Shselasky*
9786321936Shselasky*	hw_agents
9787321936Shselasky*		Indicates SMA is implemented in HW.
9788321936Shselasky*
9789321936Shselasky*	system_image_guid
9790321936Shselasky*		Optional system image GUID.  This field is valid only if the
9791321936Shselasky*		system_image_guid_support flag is set.
9792321936Shselasky*
9793321936Shselasky*	num_page_sizes
9794321936Shselasky*		Indicates support for different page sizes supported by the HCA.
9795321936Shselasky*		The variable size array can be obtained from p_page_size.
9796321936Shselasky*
9797321936Shselasky*	num_ports
9798321936Shselasky*		Number of physical ports supported on this HCA.
9799321936Shselasky*
9800321936Shselasky*	p_page_size
9801321936Shselasky*		Array holding different page size supported.
9802321936Shselasky*
9803321936Shselasky*	p_port_attr
9804321936Shselasky*		Array holding port attributes.
9805321936Shselasky*
9806321936Shselasky* NOTES
9807321936Shselasky*	This structure contains the attributes of a channel adapter.  Users must
9808321936Shselasky*	call ib_copy_ca_attr to copy the contents of this structure to a new
9809321936Shselasky*	memory region.
9810321936Shselasky*
9811321936Shselasky* SEE ALSO
9812321936Shselasky*	ib_port_attr_t, ib_atomic_t, ib_copy_ca_attr
9813321936Shselasky*****/
9814321936Shselasky
9815321936Shselasky/****f* Access layer/ib_copy_ca_attr
9816321936Shselasky* NAME
9817321936Shselasky*	ib_copy_ca_attr
9818321936Shselasky*
9819321936Shselasky* DESCRIPTION
9820321936Shselasky*	Copies CA attributes.
9821321936Shselasky*
9822321936Shselasky* SYNOPSIS
9823321936Shselasky*/
9824321936Shselaskyib_ca_attr_t *ib_copy_ca_attr(IN ib_ca_attr_t * const p_dest,
9825321936Shselasky			      IN const ib_ca_attr_t * const p_src);
9826321936Shselasky/*
9827321936Shselasky* PARAMETERS
9828321936Shselasky*	p_dest
9829321936Shselasky*		Pointer to the buffer that is the destination of the copy.
9830321936Shselasky*
9831321936Shselasky*	p_src
9832321936Shselasky*		Pointer to the CA attributes to copy.
9833321936Shselasky*
9834321936Shselasky* RETURN VALUE
9835321936Shselasky*	Pointer to the copied CA attributes.
9836321936Shselasky*
9837321936Shselasky* NOTES
9838321936Shselasky*	The buffer pointed to by the p_dest parameter must be at least the size
9839321936Shselasky*	specified in the size field of the buffer pointed to by p_src.
9840321936Shselasky*
9841321936Shselasky* SEE ALSO
9842321936Shselasky*	ib_ca_attr_t, ib_dup_ca_attr, ib_free_ca_attr
9843321936Shselasky*****/
9844321936Shselasky
9845321936Shselasky/****s* Access Layer/ib_av_attr_t
9846321936Shselasky* NAME
9847321936Shselasky*	ib_av_attr_t
9848321936Shselasky*
9849321936Shselasky* DESCRIPTION
9850321936Shselasky*	IBA address vector.
9851321936Shselasky*
9852321936Shselasky* SYNOPSIS
9853321936Shselasky*/
9854321936Shselaskytypedef struct _ib_av_attr {
9855321936Shselasky	uint8_t port_num;
9856321936Shselasky	uint8_t sl;
9857321936Shselasky	ib_net16_t dlid;
9858321936Shselasky	boolean_t grh_valid;
9859321936Shselasky	ib_grh_t grh;
9860321936Shselasky	uint8_t static_rate;
9861321936Shselasky	uint8_t path_bits;
9862321936Shselasky	struct _av_conn {
9863321936Shselasky		uint8_t path_mtu;
9864321936Shselasky		uint8_t local_ack_timeout;
9865321936Shselasky		uint8_t seq_err_retry_cnt;
9866321936Shselasky		uint8_t rnr_retry_cnt;
9867321936Shselasky	} conn;
9868321936Shselasky} ib_av_attr_t;
9869321936Shselasky/*
9870321936Shselasky* SEE ALSO
9871321936Shselasky*	ib_gid_t
9872321936Shselasky*****/
9873321936Shselasky
9874321936Shselasky/****d* Access Layer/ib_qp_type_t
9875321936Shselasky* NAME
9876321936Shselasky*	ib_qp_type_t
9877321936Shselasky*
9878321936Shselasky* DESCRIPTION
9879321936Shselasky*	Indicates the type of queue pair being created.
9880321936Shselasky*
9881321936Shselasky* SYNOPSIS
9882321936Shselasky*/
9883321936Shselaskytypedef enum _ib_qp_type {
9884321936Shselasky	IB_QPT_RELIABLE_CONN = 0,	/* Matches CM REQ transport type */
9885321936Shselasky	IB_QPT_UNRELIABLE_CONN = 1,	/* Matches CM REQ transport type */
9886321936Shselasky	IB_QPT_RELIABLE_DGRM = 2,	/* Matches CM REQ transport type */
9887321936Shselasky	IB_QPT_UNRELIABLE_DGRM,
9888321936Shselasky	IB_QPT_QP0,
9889321936Shselasky	IB_QPT_QP1,
9890321936Shselasky	IB_QPT_RAW_IPV6,
9891321936Shselasky	IB_QPT_RAW_ETHER,
9892321936Shselasky	IB_QPT_MAD,		/* InfiniBand Access Layer */
9893321936Shselasky	IB_QPT_QP0_ALIAS,	/* InfiniBand Access Layer */
9894321936Shselasky	IB_QPT_QP1_ALIAS	/* InfiniBand Access Layer */
9895321936Shselasky} ib_qp_type_t;
9896321936Shselasky/*
9897321936Shselasky* VALUES
9898321936Shselasky*	IB_QPT_RELIABLE_CONN
9899321936Shselasky*		Reliable, connected queue pair.
9900321936Shselasky*
9901321936Shselasky*	IB_QPT_UNRELIABLE_CONN
9902321936Shselasky*		Unreliable, connected queue pair.
9903321936Shselasky*
9904321936Shselasky*	IB_QPT_RELIABLE_DGRM
9905321936Shselasky*		Reliable, datagram queue pair.
9906321936Shselasky*
9907321936Shselasky*	IB_QPT_UNRELIABLE_DGRM
9908321936Shselasky*		Unreliable, datagram queue pair.
9909321936Shselasky*
9910321936Shselasky*	IB_QPT_QP0
9911321936Shselasky*		Queue pair 0.
9912321936Shselasky*
9913321936Shselasky*	IB_QPT_QP1
9914321936Shselasky*		Queue pair 1.
9915321936Shselasky*
9916321936Shselasky*	IB_QPT_RAW_DGRM
9917321936Shselasky*		Raw datagram queue pair.
9918321936Shselasky*
9919321936Shselasky*	IB_QPT_RAW_IPV6
9920321936Shselasky*		Raw IP version 6 queue pair.
9921321936Shselasky*
9922321936Shselasky*	IB_QPT_RAW_ETHER
9923321936Shselasky*		Raw Ethernet queue pair.
9924321936Shselasky*
9925321936Shselasky*	IB_QPT_MAD
9926321936Shselasky*		Unreliable, datagram queue pair that will send and receive management
9927321936Shselasky*		datagrams with assistance from the access layer.
9928321936Shselasky*
9929321936Shselasky*	IB_QPT_QP0_ALIAS
9930321936Shselasky*		Alias to queue pair 0.  Aliased QPs can only be created on an aliased
9931321936Shselasky*		protection domain.
9932321936Shselasky*
9933321936Shselasky*	IB_QPT_QP1_ALIAS
9934321936Shselasky*		Alias to queue pair 1.  Aliased QPs can only be created on an aliased
9935321936Shselasky*		protection domain.
9936321936Shselasky*****/
9937321936Shselasky
9938321936Shselasky/****d* Access Layer/ib_access_t
9939321936Shselasky* NAME
9940321936Shselasky*	ib_access_t
9941321936Shselasky*
9942321936Shselasky* DESCRIPTION
9943321936Shselasky*	Indicates the type of access is permitted on resources such as QPs,
9944321936Shselasky*	memory regions and memory windows.
9945321936Shselasky*
9946321936Shselasky* SYNOPSIS
9947321936Shselasky*/
9948321936Shselaskytypedef uint32_t ib_access_t;
9949321936Shselasky#define IB_AC_RDMA_READ				0x00000001
9950321936Shselasky#define IB_AC_RDMA_WRITE			0x00000002
9951321936Shselasky#define IB_AC_ATOMIC				0x00000004
9952321936Shselasky#define IB_AC_LOCAL_WRITE			0x00000008
9953321936Shselasky#define IB_AC_MW_BIND				0x00000010
9954321936Shselasky/*
9955321936Shselasky* NOTES
9956321936Shselasky*	Users may combine access rights using a bit-wise or operation to specify
9957321936Shselasky*	additional access.  For example: IB_AC_RDMA_READ | IB_AC_RDMA_WRITE grants
9958321936Shselasky*	RDMA read and write access.
9959321936Shselasky*****/
9960321936Shselasky
9961321936Shselasky/****d* Access Layer/ib_qp_state_t
9962321936Shselasky* NAME
9963321936Shselasky*	ib_qp_state_t
9964321936Shselasky*
9965321936Shselasky* DESCRIPTION
9966321936Shselasky*	Indicates or sets the state of a queue pair.  The current state of a queue
9967321936Shselasky*	pair is returned through the ib_qp_query call and set via the
9968321936Shselasky*	ib_qp_modify call.
9969321936Shselasky*
9970321936Shselasky* SYNOPSIS
9971321936Shselasky*/
9972321936Shselaskytypedef uint32_t ib_qp_state_t;
9973321936Shselasky#define IB_QPS_RESET				0x00000001
9974321936Shselasky#define IB_QPS_INIT				0x00000002
9975321936Shselasky#define IB_QPS_RTR				0x00000004
9976321936Shselasky#define IB_QPS_RTS				0x00000008
9977321936Shselasky#define IB_QPS_SQD				0x00000010
9978321936Shselasky#define IB_QPS_SQD_DRAINING			0x00000030
9979321936Shselasky#define IB_QPS_SQD_DRAINED			0x00000050
9980321936Shselasky#define IB_QPS_SQERR				0x00000080
9981321936Shselasky#define IB_QPS_ERROR				0x00000100
9982321936Shselasky#define IB_QPS_TIME_WAIT			0xDEAD0000	/* InfiniBand Access Layer */
9983321936Shselasky/*****/
9984321936Shselasky
9985321936Shselasky/****d* Access Layer/ib_apm_state_t
9986321936Shselasky* NAME
9987321936Shselasky*	ib_apm_state_t
9988321936Shselasky*
9989321936Shselasky* DESCRIPTION
9990321936Shselasky*	The current automatic path migration state of a queue pair
9991321936Shselasky*
9992321936Shselasky* SYNOPSIS
9993321936Shselasky*/
9994321936Shselaskytypedef enum _ib_apm_state {
9995321936Shselasky	IB_APM_MIGRATED = 1,
9996321936Shselasky	IB_APM_REARM,
9997321936Shselasky	IB_APM_ARMED
9998321936Shselasky} ib_apm_state_t;
9999321936Shselasky/*****/
10000321936Shselasky
10001321936Shselasky/****s* Access Layer/ib_qp_create_t
10002321936Shselasky* NAME
10003321936Shselasky*	ib_qp_create_t
10004321936Shselasky*
10005321936Shselasky* DESCRIPTION
10006321936Shselasky*	Attributes used to initialize a queue pair at creation time.
10007321936Shselasky*
10008321936Shselasky* SYNOPSIS
10009321936Shselasky*/
10010321936Shselaskytypedef struct _ib_qp_create {
10011321936Shselasky	ib_qp_type_t qp_type;
10012321936Shselasky	ib_rdd_handle_t h_rdd;
10013321936Shselasky	uint32_t sq_depth;
10014321936Shselasky	uint32_t rq_depth;
10015321936Shselasky	uint32_t sq_sge;
10016321936Shselasky	uint32_t rq_sge;
10017321936Shselasky	ib_cq_handle_t h_sq_cq;
10018321936Shselasky	ib_cq_handle_t h_rq_cq;
10019321936Shselasky	boolean_t sq_signaled;
10020321936Shselasky} ib_qp_create_t;
10021321936Shselasky/*
10022321936Shselasky* FIELDS
10023321936Shselasky*	type
10024321936Shselasky*		Specifies the type of queue pair to create.
10025321936Shselasky*
10026321936Shselasky*	h_rdd
10027321936Shselasky*		A handle to a reliable datagram domain to associate with the queue
10028321936Shselasky*		pair.  This field is ignored if the queue pair is not a reliable
10029321936Shselasky*		datagram type queue pair.
10030321936Shselasky*
10031321936Shselasky*	sq_depth
10032321936Shselasky*		Indicates the requested maximum number of work requests that may be
10033321936Shselasky*		outstanding on the queue pair's send queue.  This value must be less
10034321936Shselasky*		than or equal to the maximum reported by the channel adapter associated
10035321936Shselasky*		with the queue pair.
10036321936Shselasky*
10037321936Shselasky*	rq_depth
10038321936Shselasky*		Indicates the requested maximum number of work requests that may be
10039321936Shselasky*		outstanding on the queue pair's receive queue.  This value must be less
10040321936Shselasky*		than or equal to the maximum reported by the channel adapter associated
10041321936Shselasky*		with the queue pair.
10042321936Shselasky*
10043321936Shselasky*	sq_sge
10044321936Shselasky*		Indicates the maximum number scatter-gather elements that may be
10045321936Shselasky*		given in a send work request.  This value must be less
10046321936Shselasky*		than or equal to the maximum reported by the channel adapter associated
10047321936Shselasky*		with the queue pair.
10048321936Shselasky*
10049321936Shselasky*	rq_sge
10050321936Shselasky*		Indicates the maximum number scatter-gather elements that may be
10051321936Shselasky*		given in a receive work request.  This value must be less
10052321936Shselasky*		than or equal to the maximum reported by the channel adapter associated
10053321936Shselasky*		with the queue pair.
10054321936Shselasky*
10055321936Shselasky*	h_sq_cq
10056321936Shselasky*		A handle to the completion queue that will be used to report send work
10057321936Shselasky*		request completions.  This handle must be NULL if the type is
10058321936Shselasky*		IB_QPT_MAD, IB_QPT_QP0_ALIAS, or IB_QPT_QP1_ALIAS.
10059321936Shselasky*
10060321936Shselasky*	h_rq_cq
10061321936Shselasky*		A handle to the completion queue that will be used to report receive
10062321936Shselasky*		work request completions.  This handle must be NULL if the type is
10063321936Shselasky*		IB_QPT_MAD, IB_QPT_QP0_ALIAS, or IB_QPT_QP1_ALIAS.
10064321936Shselasky*
10065321936Shselasky*	sq_signaled
10066321936Shselasky*		A flag that is used to indicate whether the queue pair will signal
10067321936Shselasky*		an event upon completion of a send work request.  If set to
10068321936Shselasky*		TRUE, send work requests will always generate a completion
10069321936Shselasky*		event.  If set to FALSE, a completion event will only be
10070321936Shselasky*		generated if the send_opt field of the send work request has the
10071321936Shselasky*		IB_SEND_OPT_SIGNALED flag set.
10072321936Shselasky*
10073321936Shselasky* SEE ALSO
10074321936Shselasky*	ib_qp_type_t, ib_qp_attr_t
10075321936Shselasky*****/
10076321936Shselasky
10077321936Shselasky/****s* Access Layer/ib_qp_attr_t
10078321936Shselasky* NAME
10079321936Shselasky*	ib_qp_attr_t
10080321936Shselasky*
10081321936Shselasky* DESCRIPTION
10082321936Shselasky*	Queue pair attributes returned through ib_query_qp.
10083321936Shselasky*
10084321936Shselasky* SYNOPSIS
10085321936Shselasky*/
10086321936Shselaskytypedef struct _ib_qp_attr {
10087321936Shselasky	ib_pd_handle_t h_pd;
10088321936Shselasky	ib_qp_type_t qp_type;
10089321936Shselasky	ib_access_t access_ctrl;
10090321936Shselasky	uint16_t pkey_index;
10091321936Shselasky	uint32_t sq_depth;
10092321936Shselasky	uint32_t rq_depth;
10093321936Shselasky	uint32_t sq_sge;
10094321936Shselasky	uint32_t rq_sge;
10095321936Shselasky	uint8_t init_depth;
10096321936Shselasky	uint8_t resp_res;
10097321936Shselasky	ib_cq_handle_t h_sq_cq;
10098321936Shselasky	ib_cq_handle_t h_rq_cq;
10099321936Shselasky	ib_rdd_handle_t h_rdd;
10100321936Shselasky	boolean_t sq_signaled;
10101321936Shselasky	ib_qp_state_t state;
10102321936Shselasky	ib_net32_t num;
10103321936Shselasky	ib_net32_t dest_num;
10104321936Shselasky	ib_net32_t qkey;
10105321936Shselasky	ib_net32_t sq_psn;
10106321936Shselasky	ib_net32_t rq_psn;
10107321936Shselasky	uint8_t primary_port;
10108321936Shselasky	uint8_t alternate_port;
10109321936Shselasky	ib_av_attr_t primary_av;
10110321936Shselasky	ib_av_attr_t alternate_av;
10111321936Shselasky	ib_apm_state_t apm_state;
10112321936Shselasky} ib_qp_attr_t;
10113321936Shselasky/*
10114321936Shselasky* FIELDS
10115321936Shselasky*	h_pd
10116321936Shselasky*		This is a handle to a protection domain associated with the queue
10117321936Shselasky*		pair, or NULL if the queue pair is type IB_QPT_RELIABLE_DGRM.
10118321936Shselasky*
10119321936Shselasky* NOTES
10120321936Shselasky*	Other fields are defined by the Infiniband specification.
10121321936Shselasky*
10122321936Shselasky* SEE ALSO
10123321936Shselasky*	ib_qp_type_t, ib_access_t, ib_qp_state_t, ib_av_attr_t, ib_apm_state_t
10124321936Shselasky*****/
10125321936Shselasky
10126321936Shselasky/****d* Access Layer/ib_qp_opts_t
10127321936Shselasky* NAME
10128321936Shselasky*	ib_qp_opts_t
10129321936Shselasky*
10130321936Shselasky* DESCRIPTION
10131321936Shselasky*	Optional fields supplied in the modify QP operation.
10132321936Shselasky*
10133321936Shselasky* SYNOPSIS
10134321936Shselasky*/
10135321936Shselaskytypedef uint32_t ib_qp_opts_t;
10136321936Shselasky#define IB_MOD_QP_ALTERNATE_AV			0x00000001
10137321936Shselasky#define IB_MOD_QP_PKEY				0x00000002
10138321936Shselasky#define IB_MOD_QP_APM_STATE			0x00000004
10139321936Shselasky#define IB_MOD_QP_PRIMARY_AV			0x00000008
10140321936Shselasky#define IB_MOD_QP_RNR_NAK_TIMEOUT		0x00000010
10141321936Shselasky#define IB_MOD_QP_RESP_RES			0x00000020
10142321936Shselasky#define IB_MOD_QP_INIT_DEPTH			0x00000040
10143321936Shselasky#define IB_MOD_QP_PRIMARY_PORT			0x00000080
10144321936Shselasky#define IB_MOD_QP_ACCESS_CTRL			0x00000100
10145321936Shselasky#define IB_MOD_QP_QKEY				0x00000200
10146321936Shselasky#define IB_MOD_QP_SQ_DEPTH			0x00000400
10147321936Shselasky#define IB_MOD_QP_RQ_DEPTH			0x00000800
10148321936Shselasky#define IB_MOD_QP_CURRENT_STATE			0x00001000
10149321936Shselasky#define IB_MOD_QP_RETRY_CNT			0x00002000
10150321936Shselasky#define IB_MOD_QP_LOCAL_ACK_TIMEOUT		0x00004000
10151321936Shselasky#define IB_MOD_QP_RNR_RETRY_CNT			0x00008000
10152321936Shselasky/*
10153321936Shselasky* SEE ALSO
10154321936Shselasky*	ib_qp_mod_t
10155321936Shselasky*****/
10156321936Shselasky
10157321936Shselasky/****s* Access Layer/ib_qp_mod_t
10158321936Shselasky* NAME
10159321936Shselasky*	ib_qp_mod_t
10160321936Shselasky*
10161321936Shselasky* DESCRIPTION
10162321936Shselasky*	Information needed to change the state of a queue pair through the
10163321936Shselasky*	ib_modify_qp call.
10164321936Shselasky*
10165321936Shselasky* SYNOPSIS
10166321936Shselasky*/
10167321936Shselaskytypedef struct _ib_qp_mod {
10168321936Shselasky	ib_qp_state_t req_state;
10169321936Shselasky	union _qp_state {
10170321936Shselasky		struct _qp_reset {
10171321936Shselasky			/*
10172321936Shselasky			 * Time, in milliseconds, that the QP needs to spend in
10173321936Shselasky			 * the time wait state before being reused.
10174321936Shselasky			 */
10175321936Shselasky			uint32_t timewait;
10176321936Shselasky		} reset;
10177321936Shselasky		struct _qp_init {
10178321936Shselasky			ib_qp_opts_t opts;
10179321936Shselasky			uint8_t primary_port;
10180321936Shselasky			ib_net32_t qkey;
10181321936Shselasky			uint16_t pkey_index;
10182321936Shselasky			ib_access_t access_ctrl;
10183321936Shselasky		} init;
10184321936Shselasky		struct _qp_rtr {
10185321936Shselasky			ib_net32_t rq_psn;
10186321936Shselasky			ib_net32_t dest_qp;
10187321936Shselasky			ib_av_attr_t primary_av;
10188321936Shselasky			uint8_t resp_res;
10189321936Shselasky			ib_qp_opts_t opts;
10190321936Shselasky			ib_av_attr_t alternate_av;
10191321936Shselasky			ib_net32_t qkey;
10192321936Shselasky			uint16_t pkey_index;
10193321936Shselasky			ib_access_t access_ctrl;
10194321936Shselasky			uint32_t sq_depth;
10195321936Shselasky			uint32_t rq_depth;
10196321936Shselasky			uint8_t rnr_nak_timeout;
10197321936Shselasky		} rtr;
10198321936Shselasky		struct _qp_rts {
10199321936Shselasky			ib_net32_t sq_psn;
10200321936Shselasky			uint8_t retry_cnt;
10201321936Shselasky			uint8_t rnr_retry_cnt;
10202321936Shselasky			uint8_t rnr_nak_timeout;
10203321936Shselasky			uint8_t local_ack_timeout;
10204321936Shselasky			uint8_t init_depth;
10205321936Shselasky			ib_qp_opts_t opts;
10206321936Shselasky			ib_qp_state_t current_state;
10207321936Shselasky			ib_net32_t qkey;
10208321936Shselasky			ib_access_t access_ctrl;
10209321936Shselasky			uint8_t resp_res;
10210321936Shselasky			ib_av_attr_t primary_av;
10211321936Shselasky			ib_av_attr_t alternate_av;
10212321936Shselasky			uint32_t sq_depth;
10213321936Shselasky			uint32_t rq_depth;
10214321936Shselasky			ib_apm_state_t apm_state;
10215321936Shselasky			uint8_t primary_port;
10216321936Shselasky			uint16_t pkey_index;
10217321936Shselasky		} rts;
10218321936Shselasky		struct _qp_sqd {
10219321936Shselasky			boolean_t sqd_event;
10220321936Shselasky		} sqd;
10221321936Shselasky	} state;
10222321936Shselasky} ib_qp_mod_t;
10223321936Shselasky/*
10224321936Shselasky* SEE ALSO
10225321936Shselasky*	ib_qp_state_t, ib_access_t, ib_av_attr_t, ib_apm_state_t
10226321936Shselasky*****/
10227321936Shselasky
10228321936Shselasky/****s* Access Layer/ib_eec_attr_t
10229321936Shselasky* NAME
10230321936Shselasky*	ib_eec_attr_t
10231321936Shselasky*
10232321936Shselasky* DESCRIPTION
10233321936Shselasky*	Information about an end-to-end context.
10234321936Shselasky*
10235321936Shselasky* SYNOPSIS
10236321936Shselasky*/
10237321936Shselaskytypedef struct _ib_eec_attr {
10238321936Shselasky	ib_qp_state_t state;
10239321936Shselasky	ib_rdd_handle_t h_rdd;
10240321936Shselasky	ib_net32_t local_eecn;
10241321936Shselasky	ib_net32_t sq_psn;
10242321936Shselasky	ib_net32_t rq_psn;
10243321936Shselasky	uint8_t primary_port;
10244321936Shselasky	uint16_t pkey_index;
10245321936Shselasky	uint32_t resp_res;
10246321936Shselasky	ib_net32_t remote_eecn;
10247321936Shselasky	uint32_t init_depth;
10248321936Shselasky	uint32_t dest_num;	// ??? What is this?
10249321936Shselasky	ib_av_attr_t primary_av;
10250321936Shselasky	ib_av_attr_t alternate_av;
10251321936Shselasky	ib_apm_state_t apm_state;
10252321936Shselasky} ib_eec_attr_t;
10253321936Shselasky/*
10254321936Shselasky* SEE ALSO
10255321936Shselasky*	ib_qp_state_t, ib_av_attr_t, ib_apm_state_t
10256321936Shselasky*****/
10257321936Shselasky
10258321936Shselasky/****d* Access Layer/ib_eec_opts_t
10259321936Shselasky* NAME
10260321936Shselasky*	ib_eec_opts_t
10261321936Shselasky*
10262321936Shselasky* DESCRIPTION
10263321936Shselasky*	Optional fields supplied in the modify EEC operation.
10264321936Shselasky*
10265321936Shselasky* SYNOPSIS
10266321936Shselasky*/
10267321936Shselaskytypedef uint32_t ib_eec_opts_t;
10268321936Shselasky#define IB_MOD_EEC_ALTERNATE_AV			0x00000001
10269321936Shselasky#define IB_MOD_EEC_PKEY				0x00000002
10270321936Shselasky#define IB_MOD_EEC_APM_STATE			0x00000004
10271321936Shselasky#define IB_MOD_EEC_PRIMARY_AV			0x00000008
10272321936Shselasky#define IB_MOD_EEC_RNR				0x00000010
10273321936Shselasky#define IB_MOD_EEC_RESP_RES			0x00000020
10274321936Shselasky#define IB_MOD_EEC_OUTSTANDING			0x00000040
10275321936Shselasky#define IB_MOD_EEC_PRIMARY_PORT			0x00000080
10276321936Shselasky/*
10277321936Shselasky* NOTES
10278321936Shselasky*
10279321936Shselasky*
10280321936Shselasky*****/
10281321936Shselasky
10282321936Shselasky/****s* Access Layer/ib_eec_mod_t
10283321936Shselasky* NAME
10284321936Shselasky*	ib_eec_mod_t
10285321936Shselasky*
10286321936Shselasky* DESCRIPTION
10287321936Shselasky*	Information needed to change the state of an end-to-end context through
10288321936Shselasky*	the ib_modify_eec function.
10289321936Shselasky*
10290321936Shselasky* SYNOPSIS
10291321936Shselasky*/
10292321936Shselaskytypedef struct _ib_eec_mod {
10293321936Shselasky	ib_qp_state_t req_state;
10294321936Shselasky	union _eec_state {
10295321936Shselasky		struct _eec_init {
10296321936Shselasky			uint8_t primary_port;
10297321936Shselasky			uint16_t pkey_index;
10298321936Shselasky		} init;
10299321936Shselasky		struct _eec_rtr {
10300321936Shselasky			ib_net32_t rq_psn;
10301321936Shselasky			ib_net32_t remote_eecn;
10302321936Shselasky			ib_av_attr_t primary_av;
10303321936Shselasky			uint8_t resp_res;
10304321936Shselasky			ib_eec_opts_t opts;
10305321936Shselasky			ib_av_attr_t alternate_av;
10306321936Shselasky			uint16_t pkey_index;
10307321936Shselasky		} rtr;
10308321936Shselasky		struct _eec_rts {
10309321936Shselasky			ib_net32_t sq_psn;
10310321936Shselasky			uint8_t retry_cnt;
10311321936Shselasky			uint8_t rnr_retry_cnt;
10312321936Shselasky			uint8_t local_ack_timeout;
10313321936Shselasky			uint8_t init_depth;
10314321936Shselasky			ib_eec_opts_t opts;
10315321936Shselasky			ib_av_attr_t alternate_av;
10316321936Shselasky			ib_apm_state_t apm_state;
10317321936Shselasky			ib_av_attr_t primary_av;
10318321936Shselasky			uint16_t pkey_index;
10319321936Shselasky			uint8_t primary_port;
10320321936Shselasky		} rts;
10321321936Shselasky		struct _eec_sqd {
10322321936Shselasky			boolean_t sqd_event;
10323321936Shselasky		} sqd;
10324321936Shselasky	} state;
10325321936Shselasky} ib_eec_mod_t;
10326321936Shselasky/*
10327321936Shselasky* SEE ALSO
10328321936Shselasky*	ib_qp_state_t, ib_av_attr_t, ib_apm_state_t
10329321936Shselasky*****/
10330321936Shselasky
10331321936Shselasky/****d* Access Layer/ib_wr_type_t
10332321936Shselasky* NAME
10333321936Shselasky*	ib_wr_type_t
10334321936Shselasky*
10335321936Shselasky* DESCRIPTION
10336321936Shselasky*	Identifies the type of work request posted to a queue pair.
10337321936Shselasky*
10338321936Shselasky* SYNOPSIS
10339321936Shselasky*/
10340321936Shselaskytypedef enum _ib_wr_type_t {
10341321936Shselasky	WR_SEND = 1,
10342321936Shselasky	WR_RDMA_WRITE,
10343321936Shselasky	WR_RDMA_READ,
10344321936Shselasky	WR_COMPARE_SWAP,
10345321936Shselasky	WR_FETCH_ADD
10346321936Shselasky} ib_wr_type_t;
10347321936Shselasky/*****/
10348321936Shselasky
10349321936Shselasky/****s* Access Layer/ib_local_ds_t
10350321936Shselasky* NAME
10351321936Shselasky*	ib_local_ds_t
10352321936Shselasky*
10353321936Shselasky* DESCRIPTION
10354321936Shselasky*	Local data segment information referenced by send and receive work
10355321936Shselasky*	requests.  This is used to specify local data buffers used as part of a
10356321936Shselasky*	work request.
10357321936Shselasky*
10358321936Shselasky* SYNOPSIS
10359321936Shselasky*/
10360321936Shselaskytypedef struct _ib_local_ds {
10361321936Shselasky	void *vaddr;
10362321936Shselasky	uint32_t length;
10363321936Shselasky	uint32_t lkey;
10364321936Shselasky} ib_local_ds_t;
10365321936Shselasky/*****/
10366321936Shselasky
10367321936Shselasky/****d* Access Layer/ib_send_opt_t
10368321936Shselasky* NAME
10369321936Shselasky*	ib_send_opt_t
10370321936Shselasky*
10371321936Shselasky* DESCRIPTION
10372321936Shselasky*	Optional flags used when posting send work requests.  These flags
10373321936Shselasky*	indicate specific processing for the send operation.
10374321936Shselasky*
10375321936Shselasky* SYNOPSIS
10376321936Shselasky*/
10377321936Shselaskytypedef uint32_t ib_send_opt_t;
10378321936Shselasky#define IB_SEND_OPT_IMMEDIATE		0x00000001
10379321936Shselasky#define IB_SEND_OPT_FENCE		0x00000002
10380321936Shselasky#define IB_SEND_OPT_SIGNALED		0x00000004
10381321936Shselasky#define IB_SEND_OPT_SOLICITED		0x00000008
10382321936Shselasky#define IB_SEND_OPT_INLINE		0x00000010
10383321936Shselasky#define IB_SEND_OPT_LOCAL		0x00000020
10384321936Shselasky#define IB_SEND_OPT_VEND_MASK		0xFFFF0000
10385321936Shselasky/*
10386321936Shselasky* VALUES
10387321936Shselasky*	The following flags determine the behavior of a work request when
10388321936Shselasky*	posted to the send side.
10389321936Shselasky*
10390321936Shselasky*	IB_SEND_OPT_IMMEDIATE
10391321936Shselasky*		Send immediate data with the given request.
10392321936Shselasky*
10393321936Shselasky*	IB_SEND_OPT_FENCE
10394321936Shselasky*		The operation is fenced.  Complete all pending send operations
10395321936Shselasky*		before processing this request.
10396321936Shselasky*
10397321936Shselasky*	IB_SEND_OPT_SIGNALED
10398321936Shselasky*		If the queue pair is configured for signaled completion, then
10399321936Shselasky*		generate a completion queue entry when this request completes.
10400321936Shselasky*
10401321936Shselasky*	IB_SEND_OPT_SOLICITED
10402321936Shselasky*		Set the solicited bit on the last packet of this request.
10403321936Shselasky*
10404321936Shselasky*	IB_SEND_OPT_INLINE
10405321936Shselasky*		Indicates that the requested send data should be copied into a VPD
10406321936Shselasky*		owned data buffer.  This flag permits the user to issue send operations
10407321936Shselasky*		without first needing to register the buffer(s) associated with the
10408321936Shselasky*		send operation.  Verb providers that support this operation may place
10409321936Shselasky*		vendor specific restrictions on the size of send operation that may
10410321936Shselasky*		be performed as inline.
10411321936Shselasky*
10412321936Shselasky*
10413321936Shselasky*  IB_SEND_OPT_LOCAL
10414321936Shselasky*     Indicates that a sent MAD request should be given to the local VPD for
10415321936Shselasky*     processing.  MADs sent using this option are not placed on the wire.
10416321936Shselasky*     This send option is only valid for MAD send operations.
10417321936Shselasky*
10418321936Shselasky*
10419321936Shselasky*	IB_SEND_OPT_VEND_MASK
10420321936Shselasky*		This mask indicates bits reserved in the send options that may be used
10421321936Shselasky*		by the verbs provider to indicate vendor specific options.  Bits set
10422321936Shselasky*		in this area of the send options are ignored by the Access Layer, but
10423321936Shselasky*		may have specific meaning to the underlying VPD.
10424321936Shselasky*
10425321936Shselasky*****/
10426321936Shselasky
10427321936Shselasky/****s* Access Layer/ib_send_wr_t
10428321936Shselasky* NAME
10429321936Shselasky*	ib_send_wr_t
10430321936Shselasky*
10431321936Shselasky* DESCRIPTION
10432321936Shselasky*	Information used to submit a work request to the send queue of a queue
10433321936Shselasky*	pair.
10434321936Shselasky*
10435321936Shselasky* SYNOPSIS
10436321936Shselasky*/
10437321936Shselaskytypedef struct _ib_send_wr {
10438321936Shselasky	struct _ib_send_wr *p_next;
10439321936Shselasky	uint64_t wr_id;
10440321936Shselasky	ib_wr_type_t wr_type;
10441321936Shselasky	ib_send_opt_t send_opt;
10442321936Shselasky	uint32_t num_ds;
10443321936Shselasky	ib_local_ds_t *ds_array;
10444321936Shselasky	ib_net32_t immediate_data;
10445321936Shselasky	union _send_dgrm {
10446321936Shselasky		struct _send_ud {
10447321936Shselasky			ib_net32_t remote_qp;
10448321936Shselasky			ib_net32_t remote_qkey;
10449321936Shselasky			ib_av_handle_t h_av;
10450321936Shselasky		} ud;
10451321936Shselasky		struct _send_rd {
10452321936Shselasky			ib_net32_t remote_qp;
10453321936Shselasky			ib_net32_t remote_qkey;
10454321936Shselasky			ib_net32_t eecn;
10455321936Shselasky		} rd;
10456321936Shselasky		struct _send_raw_ether {
10457321936Shselasky			ib_net16_t dest_lid;
10458321936Shselasky			uint8_t path_bits;
10459321936Shselasky			uint8_t sl;
10460321936Shselasky			uint8_t max_static_rate;
10461321936Shselasky			ib_net16_t ether_type;
10462321936Shselasky		} raw_ether;
10463321936Shselasky		struct _send_raw_ipv6 {
10464321936Shselasky			ib_net16_t dest_lid;
10465321936Shselasky			uint8_t path_bits;
10466321936Shselasky			uint8_t sl;
10467321936Shselasky			uint8_t max_static_rate;
10468321936Shselasky		} raw_ipv6;
10469321936Shselasky	} dgrm;
10470321936Shselasky	struct _send_remote_ops {
10471321936Shselasky		uint64_t vaddr;
10472321936Shselasky		uint32_t rkey;
10473321936Shselasky		ib_net64_t atomic1;
10474321936Shselasky		ib_net64_t atomic2;
10475321936Shselasky	} remote_ops;
10476321936Shselasky} ib_send_wr_t;
10477321936Shselasky/*
10478321936Shselasky* FIELDS
10479321936Shselasky*	p_next
10480321936Shselasky*		A pointer used to chain work requests together.  This permits multiple
10481321936Shselasky*		work requests to be posted to a queue pair through a single function
10482321936Shselasky*		call.  This value is set to NULL to mark the end of the chain.
10483321936Shselasky*
10484321936Shselasky*	wr_id
10485321936Shselasky*		A 64-bit work request identifier that is returned to the consumer
10486321936Shselasky*		as part of the work completion.
10487321936Shselasky*
10488321936Shselasky*	wr_type
10489321936Shselasky*		The type of work request being submitted to the send queue.
10490321936Shselasky*
10491321936Shselasky*	send_opt
10492321936Shselasky*		Optional send control parameters.
10493321936Shselasky*
10494321936Shselasky*	num_ds
10495321936Shselasky*		Number of local data segments specified by this work request.
10496321936Shselasky*
10497321936Shselasky*	ds_array
10498321936Shselasky*		A reference to an array of local data segments used by the send
10499321936Shselasky*		operation.
10500321936Shselasky*
10501321936Shselasky*	immediate_data
10502321936Shselasky*		32-bit field sent as part of a message send or RDMA write operation.
10503321936Shselasky*		This field is only valid if the send_opt flag IB_SEND_OPT_IMMEDIATE
10504321936Shselasky*		has been set.
10505321936Shselasky*
10506321936Shselasky*	dgrm.ud.remote_qp
10507321936Shselasky*		Identifies the destination queue pair of an unreliable datagram send
10508321936Shselasky*		operation.
10509321936Shselasky*
10510321936Shselasky*	dgrm.ud.remote_qkey
10511321936Shselasky*		The qkey for the destination queue pair.
10512321936Shselasky*
10513321936Shselasky*	dgrm.ud.h_av
10514321936Shselasky*		An address vector that specifies the path information used to route
10515321936Shselasky*		the outbound datagram to the destination queue pair.
10516321936Shselasky*
10517321936Shselasky*	dgrm.rd.remote_qp
10518321936Shselasky*		Identifies the destination queue pair of a reliable datagram send
10519321936Shselasky*		operation.
10520321936Shselasky*
10521321936Shselasky*	dgrm.rd.remote_qkey
10522321936Shselasky*		The qkey for the destination queue pair.
10523321936Shselasky*
10524321936Shselasky*	dgrm.rd.eecn
10525321936Shselasky*		The local end-to-end context number to use with the reliable datagram
10526321936Shselasky*		send operation.
10527321936Shselasky*
10528321936Shselasky*	dgrm.raw_ether.dest_lid
10529321936Shselasky*		The destination LID that will receive this raw ether send.
10530321936Shselasky*
10531321936Shselasky*	dgrm.raw_ether.path_bits
10532321936Shselasky*		path bits...
10533321936Shselasky*
10534321936Shselasky*	dgrm.raw_ether.sl
10535321936Shselasky*		service level...
10536321936Shselasky*
10537321936Shselasky*	dgrm.raw_ether.max_static_rate
10538321936Shselasky*		static rate...
10539321936Shselasky*
10540321936Shselasky*	dgrm.raw_ether.ether_type
10541321936Shselasky*		ether type...
10542321936Shselasky*
10543321936Shselasky*	dgrm.raw_ipv6.dest_lid
10544321936Shselasky*		The destination LID that will receive this raw ether send.
10545321936Shselasky*
10546321936Shselasky*	dgrm.raw_ipv6.path_bits
10547321936Shselasky*		path bits...
10548321936Shselasky*
10549321936Shselasky*	dgrm.raw_ipv6.sl
10550321936Shselasky*		service level...
10551321936Shselasky*
10552321936Shselasky*	dgrm.raw_ipv6.max_static_rate
10553321936Shselasky*		static rate...
10554321936Shselasky*
10555321936Shselasky*	remote_ops.vaddr
10556321936Shselasky*		The registered virtual memory address of the remote memory to access
10557321936Shselasky*		with an RDMA or atomic operation.
10558321936Shselasky*
10559321936Shselasky*	remote_ops.rkey
10560321936Shselasky*		The rkey associated with the specified remote vaddr. This data must
10561321936Shselasky*		be presented exactly as obtained from the remote node. No swapping
10562321936Shselasky*		of data must be performed.
10563321936Shselasky*
10564321936Shselasky*	atomic1
10565321936Shselasky*		The first operand for an atomic operation.
10566321936Shselasky*
10567321936Shselasky*	atomic2
10568321936Shselasky*		The second operand for an atomic operation.
10569321936Shselasky*
10570321936Shselasky* NOTES
10571321936Shselasky*	The format of data sent over the fabric is user-defined and is considered
10572321936Shselasky*	opaque to the access layer.  The sole exception to this are MADs posted
10573321936Shselasky*	to a MAD QP service.  MADs are expected to match the format defined by
10574321936Shselasky*	the Infiniband specification and must be in network-byte order when posted
10575321936Shselasky*	to the MAD QP service.
10576321936Shselasky*
10577321936Shselasky* SEE ALSO
10578321936Shselasky*	ib_wr_type_t, ib_local_ds_t, ib_send_opt_t
10579321936Shselasky*****/
10580321936Shselasky
10581321936Shselasky/****s* Access Layer/ib_recv_wr_t
10582321936Shselasky* NAME
10583321936Shselasky*	ib_recv_wr_t
10584321936Shselasky*
10585321936Shselasky* DESCRIPTION
10586321936Shselasky*	Information used to submit a work request to the receive queue of a queue
10587321936Shselasky*	pair.
10588321936Shselasky*
10589321936Shselasky* SYNOPSIS
10590321936Shselasky*/
10591321936Shselaskytypedef struct _ib_recv_wr {
10592321936Shselasky	struct _ib_recv_wr *p_next;
10593321936Shselasky	uint64_t wr_id;
10594321936Shselasky	uint32_t num_ds;
10595321936Shselasky	ib_local_ds_t *ds_array;
10596321936Shselasky} ib_recv_wr_t;
10597321936Shselasky/*
10598321936Shselasky* FIELDS
10599321936Shselasky*	p_next
10600321936Shselasky*		A pointer used to chain work requests together.  This permits multiple
10601321936Shselasky*		work requests to be posted to a queue pair through a single function
10602321936Shselasky*		call.  This value is set to NULL to mark the end of the chain.
10603321936Shselasky*
10604321936Shselasky*	wr_id
10605321936Shselasky*		A 64-bit work request identifier that is returned to the consumer
10606321936Shselasky*		as part of the work completion.
10607321936Shselasky*
10608321936Shselasky*	num_ds
10609321936Shselasky*		Number of local data segments specified by this work request.
10610321936Shselasky*
10611321936Shselasky*	ds_array
10612321936Shselasky*		A reference to an array of local data segments used by the send
10613321936Shselasky*		operation.
10614321936Shselasky*
10615321936Shselasky* SEE ALSO
10616321936Shselasky*	ib_local_ds_t
10617321936Shselasky*****/
10618321936Shselasky
10619321936Shselasky/****s* Access Layer/ib_bind_wr_t
10620321936Shselasky* NAME
10621321936Shselasky*	ib_bind_wr_t
10622321936Shselasky*
10623321936Shselasky* DESCRIPTION
10624321936Shselasky*	Information used to submit a memory window bind work request to the send
10625321936Shselasky*	queue of a queue pair.
10626321936Shselasky*
10627321936Shselasky* SYNOPSIS
10628321936Shselasky*/
10629321936Shselaskytypedef struct _ib_bind_wr {
10630321936Shselasky	uint64_t wr_id;
10631321936Shselasky	ib_send_opt_t send_opt;
10632321936Shselasky	ib_mr_handle_t h_mr;
10633321936Shselasky	ib_access_t access_ctrl;
10634321936Shselasky	uint32_t current_rkey;
10635321936Shselasky	ib_local_ds_t local_ds;
10636321936Shselasky} ib_bind_wr_t;
10637321936Shselasky/*
10638321936Shselasky* FIELDS
10639321936Shselasky*	wr_id
10640321936Shselasky*		A 64-bit work request identifier that is returned to the consumer
10641321936Shselasky*		as part of the work completion.
10642321936Shselasky*
10643321936Shselasky*	send_opt
10644321936Shselasky*		Optional send control parameters.
10645321936Shselasky*
10646321936Shselasky*	h_mr
10647321936Shselasky*		Handle to the memory region to which this window is being bound.
10648321936Shselasky*
10649321936Shselasky*	access_ctrl
10650321936Shselasky*		Access rights for this memory window.
10651321936Shselasky*
10652321936Shselasky*	current_rkey
10653321936Shselasky*		The current rkey assigned to this window for remote access.
10654321936Shselasky*
10655321936Shselasky*	local_ds
10656321936Shselasky*		A reference to a local data segment used by the bind operation.
10657321936Shselasky*
10658321936Shselasky* SEE ALSO
10659321936Shselasky*	ib_send_opt_t, ib_access_t, ib_local_ds_t
10660321936Shselasky*****/
10661321936Shselasky
10662321936Shselasky/****d* Access Layer/ib_wc_status_t
10663321936Shselasky* NAME
10664321936Shselasky*	ib_wc_status_t
10665321936Shselasky*
10666321936Shselasky* DESCRIPTION
10667321936Shselasky*	Indicates the status of a completed work request.  These VALUES are
10668321936Shselasky*	returned to the user when retrieving completions.  Note that success is
10669321936Shselasky*	identified as IB_WCS_SUCCESS, which is always zero.
10670321936Shselasky*
10671321936Shselasky* SYNOPSIS
10672321936Shselasky*/
10673321936Shselaskytypedef enum _ib_wc_status_t {
10674321936Shselasky	IB_WCS_SUCCESS,
10675321936Shselasky	IB_WCS_LOCAL_LEN_ERR,
10676321936Shselasky	IB_WCS_LOCAL_OP_ERR,
10677321936Shselasky	IB_WCS_LOCAL_EEC_OP_ERR,
10678321936Shselasky	IB_WCS_LOCAL_PROTECTION_ERR,
10679321936Shselasky	IB_WCS_WR_FLUSHED_ERR,
10680321936Shselasky	IB_WCS_MEM_WINDOW_BIND_ERR,
10681321936Shselasky	IB_WCS_REM_ACCESS_ERR,
10682321936Shselasky	IB_WCS_REM_OP_ERR,
10683321936Shselasky	IB_WCS_RNR_RETRY_ERR,
10684321936Shselasky	IB_WCS_TIMEOUT_RETRY_ERR,
10685321936Shselasky	IB_WCS_REM_INVALID_REQ_ERR,
10686321936Shselasky	IB_WCS_REM_INVALID_RD_REQ_ERR,
10687321936Shselasky	IB_WCS_INVALID_EECN,
10688321936Shselasky	IB_WCS_INVALID_EEC_STATE,
10689321936Shselasky	IB_WCS_UNMATCHED_RESPONSE,	/* InfiniBand Access Layer */
10690321936Shselasky	IB_WCS_CANCELED,	/* InfiniBand Access Layer */
10691321936Shselasky	IB_WCS_UNKNOWN		/* Must be last. */
10692321936Shselasky} ib_wc_status_t;
10693321936Shselasky/*
10694321936Shselasky* VALUES
10695321936Shselasky*	IB_WCS_SUCCESS
10696321936Shselasky*		Work request completed successfully.
10697321936Shselasky*
10698321936Shselasky*	IB_WCS_MAD
10699321936Shselasky*		The completed work request was associated with a managmenet datagram
10700321936Shselasky*		that requires post processing.  The MAD will be returned to the user
10701321936Shselasky*		through a callback once all post processing has completed.
10702321936Shselasky*
10703321936Shselasky*	IB_WCS_LOCAL_LEN_ERR
10704321936Shselasky*		Generated for a work request posted to the send queue when the
10705321936Shselasky*		total of the data segment lengths exceeds the message length of the
10706321936Shselasky*		channel.  Generated for a work request posted to the receive queue when
10707321936Shselasky*		the total of the data segment lengths is too small for a
10708321936Shselasky*		valid incoming message.
10709321936Shselasky*
10710321936Shselasky*	IB_WCS_LOCAL_OP_ERR
10711321936Shselasky*		An internal QP consistency error was generated while processing this
10712321936Shselasky*		work request.  This may indicate that the QP was in an incorrect state
10713321936Shselasky*		for the requested operation.
10714321936Shselasky*
10715321936Shselasky*	IB_WCS_LOCAL_EEC_OP_ERR
10716321936Shselasky*		An internal EEC consistency error was generated while processing
10717321936Shselasky*		this work request.  This may indicate that the EEC was in an incorrect
10718321936Shselasky*		state for the requested operation.
10719321936Shselasky*
10720321936Shselasky*	IB_WCS_LOCAL_PROTECTION_ERR
10721321936Shselasky*		The data segments of the locally posted work request did not refer to
10722321936Shselasky*		a valid memory region.  The memory may not have been properly
10723321936Shselasky*		registered for the requested operation.
10724321936Shselasky*
10725321936Shselasky*	IB_WCS_WR_FLUSHED_ERR
10726321936Shselasky*		The work request was flushed from the QP before being completed.
10727321936Shselasky*
10728321936Shselasky*	IB_WCS_MEM_WINDOW_BIND_ERR
10729321936Shselasky*		A memory window bind operation failed due to insufficient access
10730321936Shselasky*		rights.
10731321936Shselasky*
10732321936Shselasky*	IB_WCS_REM_ACCESS_ERR,
10733321936Shselasky*		A protection error was detected at the remote node for a RDMA or atomic
10734321936Shselasky*		operation.
10735321936Shselasky*
10736321936Shselasky*	IB_WCS_REM_OP_ERR,
10737321936Shselasky*		The operation could not be successfully completed at the remote node.
10738321936Shselasky*		This may indicate that the remote QP was in an invalid state or
10739321936Shselasky*		contained an invalid work request.
10740321936Shselasky*
10741321936Shselasky*	IB_WCS_RNR_RETRY_ERR,
10742321936Shselasky*		The RNR retry count was exceeded while trying to send this message.
10743321936Shselasky*
10744321936Shselasky*	IB_WCS_TIMEOUT_RETRY_ERR
10745321936Shselasky*		The local transport timeout counter expired while trying to send this
10746321936Shselasky*		message.
10747321936Shselasky*
10748321936Shselasky*	IB_WCS_REM_INVALID_REQ_ERR,
10749321936Shselasky*		The remote node detected an invalid message on the channel.  This error
10750321936Shselasky*		is usually a result of one of the following:
10751321936Shselasky*			- The operation was not supported on receive queue.
10752321936Shselasky*			- There was insufficient buffers to receive a new RDMA request.
10753321936Shselasky*			- There was insufficient buffers to receive a new atomic operation.
10754321936Shselasky*			- An RDMA request was larger than 2^31 bytes.
10755321936Shselasky*
10756321936Shselasky*	IB_WCS_REM_INVALID_RD_REQ_ERR,
10757321936Shselasky*		Responder detected an invalid RD message.  This may be the result of an
10758321936Shselasky*		invalid qkey or an RDD mismatch.
10759321936Shselasky*
10760321936Shselasky*	IB_WCS_INVALID_EECN
10761321936Shselasky*		An invalid EE context number was detected.
10762321936Shselasky*
10763321936Shselasky*	IB_WCS_INVALID_EEC_STATE
10764321936Shselasky*		The EEC was in an invalid state for the specified request.
10765321936Shselasky*
10766321936Shselasky*	IB_WCS_UNMATCHED_RESPONSE
10767321936Shselasky*		A response MAD was received for which there was no matching send.  The
10768321936Shselasky*		send operation may have been canceled by the user or may have timed
10769321936Shselasky*		out.
10770321936Shselasky*
10771321936Shselasky*	IB_WCS_CANCELED
10772321936Shselasky*		The completed work request was canceled by the user.
10773321936Shselasky*****/
10774321936Shselasky
10775321936ShselaskyOSM_EXPORT const char *ib_wc_status_str[];
10776321936Shselasky
10777321936Shselasky/****f* IBA Base: Types/ib_get_wc_status_str
10778321936Shselasky* NAME
10779321936Shselasky*	ib_get_wc_status_str
10780321936Shselasky*
10781321936Shselasky* DESCRIPTION
10782321936Shselasky*	Returns a string for the specified work completion status.
10783321936Shselasky*
10784321936Shselasky* SYNOPSIS
10785321936Shselasky*/
10786321936Shselaskystatic inline const char *OSM_API
10787321936Shselaskyib_get_wc_status_str(IN ib_wc_status_t wc_status)
10788321936Shselasky{
10789321936Shselasky	if (wc_status > IB_WCS_UNKNOWN)
10790321936Shselasky		wc_status = IB_WCS_UNKNOWN;
10791321936Shselasky	return (ib_wc_status_str[wc_status]);
10792321936Shselasky}
10793321936Shselasky
10794321936Shselasky/*
10795321936Shselasky* PARAMETERS
10796321936Shselasky*	wc_status
10797321936Shselasky*		[in] work completion status value
10798321936Shselasky*
10799321936Shselasky* RETURN VALUES
10800321936Shselasky*	Pointer to the work completion status description string.
10801321936Shselasky*
10802321936Shselasky* NOTES
10803321936Shselasky*
10804321936Shselasky* SEE ALSO
10805321936Shselasky*********/
10806321936Shselasky
10807321936Shselasky/****d* Access Layer/ib_wc_type_t
10808321936Shselasky* NAME
10809321936Shselasky*	ib_wc_type_t
10810321936Shselasky*
10811321936Shselasky* DESCRIPTION
10812321936Shselasky*	Indicates the type of work completion.
10813321936Shselasky*
10814321936Shselasky* SYNOPSIS
10815321936Shselasky*/
10816321936Shselaskytypedef enum _ib_wc_type_t {
10817321936Shselasky	IB_WC_SEND,
10818321936Shselasky	IB_WC_RDMA_WRITE,
10819321936Shselasky	IB_WC_RECV,
10820321936Shselasky	IB_WC_RDMA_READ,
10821321936Shselasky	IB_WC_MW_BIND,
10822321936Shselasky	IB_WC_FETCH_ADD,
10823321936Shselasky	IB_WC_COMPARE_SWAP,
10824321936Shselasky	IB_WC_RECV_RDMA_WRITE
10825321936Shselasky} ib_wc_type_t;
10826321936Shselasky/*****/
10827321936Shselasky
10828321936Shselasky/****d* Access Layer/ib_recv_opt_t
10829321936Shselasky* NAME
10830321936Shselasky*	ib_recv_opt_t
10831321936Shselasky*
10832321936Shselasky* DESCRIPTION
10833321936Shselasky*	Indicates optional fields valid in a receive work completion.
10834321936Shselasky*
10835321936Shselasky* SYNOPSIS
10836321936Shselasky*/
10837321936Shselaskytypedef uint32_t ib_recv_opt_t;
10838321936Shselasky#define	IB_RECV_OPT_IMMEDIATE		0x00000001
10839321936Shselasky#define IB_RECV_OPT_FORWARD		0x00000002
10840321936Shselasky#define IB_RECV_OPT_GRH_VALID		0x00000004
10841321936Shselasky#define IB_RECV_OPT_VEND_MASK		0xFFFF0000
10842321936Shselasky/*
10843321936Shselasky* VALUES
10844321936Shselasky*	IB_RECV_OPT_IMMEDIATE
10845321936Shselasky*		Indicates that immediate data is valid for this work completion.
10846321936Shselasky*
10847321936Shselasky*	IB_RECV_OPT_FORWARD
10848321936Shselasky*		Indicates that the received trap should be forwarded to the SM.
10849321936Shselasky*
10850321936Shselasky*	IB_RECV_OPT_GRH_VALID
10851321936Shselasky*		Indicates presence of the global route header. When set, the
10852321936Shselasky*		first 40 bytes received are the GRH.
10853321936Shselasky*
10854321936Shselasky*	IB_RECV_OPT_VEND_MASK
10855321936Shselasky*		This mask indicates bits reserved in the receive options that may be
10856321936Shselasky*		used by the verbs provider to indicate vendor specific options.  Bits
10857321936Shselasky*		set in this area of the receive options are ignored by the Access Layer,
10858321936Shselasky*		but may have specific meaning to the underlying VPD.
10859321936Shselasky*****/
10860321936Shselasky
10861321936Shselasky/****s* Access Layer/ib_wc_t
10862321936Shselasky* NAME
10863321936Shselasky*	ib_wc_t
10864321936Shselasky*
10865321936Shselasky* DESCRIPTION
10866321936Shselasky*	Work completion information.
10867321936Shselasky*
10868321936Shselasky* SYNOPSIS
10869321936Shselasky*/
10870321936Shselaskytypedef struct _ib_wc {
10871321936Shselasky	struct _ib_wc *p_next;
10872321936Shselasky	uint64_t wr_id;
10873321936Shselasky	ib_wc_type_t wc_type;
10874321936Shselasky	uint32_t length;
10875321936Shselasky	ib_wc_status_t status;
10876321936Shselasky	uint64_t vendor_specific;
10877321936Shselasky	union _wc_recv {
10878321936Shselasky		struct _wc_conn {
10879321936Shselasky			ib_recv_opt_t recv_opt;
10880321936Shselasky			ib_net32_t immediate_data;
10881321936Shselasky		} conn;
10882321936Shselasky		struct _wc_ud {
10883321936Shselasky			ib_recv_opt_t recv_opt;
10884321936Shselasky			ib_net32_t immediate_data;
10885321936Shselasky			ib_net32_t remote_qp;
10886321936Shselasky			uint16_t pkey_index;
10887321936Shselasky			ib_net16_t remote_lid;
10888321936Shselasky			uint8_t remote_sl;
10889321936Shselasky			uint8_t path_bits;
10890321936Shselasky		} ud;
10891321936Shselasky		struct _wc_rd {
10892321936Shselasky			ib_net32_t remote_eecn;
10893321936Shselasky			ib_net32_t remote_qp;
10894321936Shselasky			ib_net16_t remote_lid;
10895321936Shselasky			uint8_t remote_sl;
10896321936Shselasky			uint32_t free_cnt;
10897321936Shselasky
10898321936Shselasky		} rd;
10899321936Shselasky		struct _wc_raw_ipv6 {
10900321936Shselasky			ib_net16_t remote_lid;
10901321936Shselasky			uint8_t remote_sl;
10902321936Shselasky			uint8_t path_bits;
10903321936Shselasky		} raw_ipv6;
10904321936Shselasky		struct _wc_raw_ether {
10905321936Shselasky			ib_net16_t remote_lid;
10906321936Shselasky			uint8_t remote_sl;
10907321936Shselasky			uint8_t path_bits;
10908321936Shselasky			ib_net16_t ether_type;
10909321936Shselasky		} raw_ether;
10910321936Shselasky	} recv;
10911321936Shselasky} ib_wc_t;
10912321936Shselasky/*
10913321936Shselasky* FIELDS
10914321936Shselasky*	p_next
10915321936Shselasky*		A pointer used to chain work completions.  This permits multiple
10916321936Shselasky*		work completions to be retrieved from a completion queue through a
10917321936Shselasky*		single function call.  This value is set to NULL to mark the end of
10918321936Shselasky*		the chain.
10919321936Shselasky*
10920321936Shselasky*	wr_id
10921321936Shselasky*		The 64-bit work request identifier that was specified when posting the
10922321936Shselasky*		work request.
10923321936Shselasky*
10924321936Shselasky*	wc_type
10925321936Shselasky*		Indicates the type of work completion.
10926321936Shselasky*
10927321936Shselasky*
10928321936Shselasky*	length
10929321936Shselasky*		The total length of the data sent or received with the work request.
10930321936Shselasky*
10931321936Shselasky*	status
10932321936Shselasky*		The result of the work request.
10933321936Shselasky*
10934321936Shselasky*	vendor_specific
10935321936Shselasky*		HCA vendor specific information returned as part of the completion.
10936321936Shselasky*
10937321936Shselasky*	recv.conn.recv_opt
10938321936Shselasky*		Indicates optional fields valid as part of a work request that
10939321936Shselasky*		completed on a connected (reliable or unreliable) queue pair.
10940321936Shselasky*
10941321936Shselasky*	recv.conn.immediate_data
10942321936Shselasky*		32-bit field received as part of an inbound message on a connected
10943321936Shselasky*		queue pair.  This field is only valid if the recv_opt flag
10944321936Shselasky*		IB_RECV_OPT_IMMEDIATE has been set.
10945321936Shselasky*
10946321936Shselasky*	recv.ud.recv_opt
10947321936Shselasky*		Indicates optional fields valid as part of a work request that
10948321936Shselasky*		completed on an unreliable datagram queue pair.
10949321936Shselasky*
10950321936Shselasky*	recv.ud.immediate_data
10951321936Shselasky*		32-bit field received as part of an inbound message on a unreliable
10952321936Shselasky*		datagram queue pair.  This field is only valid if the recv_opt flag
10953321936Shselasky*		IB_RECV_OPT_IMMEDIATE has been set.
10954321936Shselasky*
10955321936Shselasky*	recv.ud.remote_qp
10956321936Shselasky*		Identifies the source queue pair of a received datagram.
10957321936Shselasky*
10958321936Shselasky*	recv.ud.pkey_index
10959321936Shselasky*		The pkey index for the source queue pair. This is valid only for
10960321936Shselasky*		GSI type QP's.
10961321936Shselasky*
10962321936Shselasky*	recv.ud.remote_lid
10963321936Shselasky*		The source LID of the received datagram.
10964321936Shselasky*
10965321936Shselasky*	recv.ud.remote_sl
10966321936Shselasky*		The service level used by the source of the received datagram.
10967321936Shselasky*
10968321936Shselasky*	recv.ud.path_bits
10969321936Shselasky*		path bits...
10970321936Shselasky*
10971321936Shselasky*	recv.rd.remote_eecn
10972321936Shselasky*		The remote end-to-end context number that sent the received message.
10973321936Shselasky*
10974321936Shselasky*	recv.rd.remote_qp
10975321936Shselasky*		Identifies the source queue pair of a received message.
10976321936Shselasky*
10977321936Shselasky*	recv.rd.remote_lid
10978321936Shselasky*		The source LID of the received message.
10979321936Shselasky*
10980321936Shselasky*	recv.rd.remote_sl
10981321936Shselasky*		The service level used by the source of the received message.
10982321936Shselasky*
10983321936Shselasky*	recv.rd.free_cnt
10984321936Shselasky*		The number of available entries in the completion queue.  Reliable
10985321936Shselasky*		datagrams may complete out of order, so this field may be used to
10986321936Shselasky*		determine the number of additional completions that may occur.
10987321936Shselasky*
10988321936Shselasky*	recv.raw_ipv6.remote_lid
10989321936Shselasky*		The source LID of the received message.
10990321936Shselasky*
10991321936Shselasky*	recv.raw_ipv6.remote_sl
10992321936Shselasky*		The service level used by the source of the received message.
10993321936Shselasky*
10994321936Shselasky*	recv.raw_ipv6.path_bits
10995321936Shselasky*		path bits...
10996321936Shselasky*
10997321936Shselasky*	recv.raw_ether.remote_lid
10998321936Shselasky*		The source LID of the received message.
10999321936Shselasky*
11000321936Shselasky*	recv.raw_ether.remote_sl
11001321936Shselasky*		The service level used by the source of the received message.
11002321936Shselasky*
11003321936Shselasky*	recv.raw_ether.path_bits
11004321936Shselasky*		path bits...
11005321936Shselasky*
11006321936Shselasky*	recv.raw_ether.ether_type
11007321936Shselasky*		ether type...
11008321936Shselasky* NOTES
11009321936Shselasky*	When the work request completes with error, the only values that the
11010321936Shselasky*	consumer can depend on are the wr_id field, and the status of the
11011321936Shselasky*	operation.
11012321936Shselasky*
11013321936Shselasky*	If the consumer is using the same CQ for completions from more than
11014321936Shselasky*	one type of QP (i.e Reliable Connected, Datagram etc), then the consumer
11015321936Shselasky*	must have additional information to decide what fields of the union are
11016321936Shselasky*	valid.
11017321936Shselasky* SEE ALSO
11018321936Shselasky*	ib_wc_type_t, ib_qp_type_t, ib_wc_status_t, ib_recv_opt_t
11019321936Shselasky*****/
11020321936Shselasky
11021321936Shselasky/****s* Access Layer/ib_mr_create_t
11022321936Shselasky* NAME
11023321936Shselasky*	ib_mr_create_t
11024321936Shselasky*
11025321936Shselasky* DESCRIPTION
11026321936Shselasky*	Information required to create a registered memory region.
11027321936Shselasky*
11028321936Shselasky* SYNOPSIS
11029321936Shselasky*/
11030321936Shselaskytypedef struct _ib_mr_create {
11031321936Shselasky	void *vaddr;
11032321936Shselasky	uint64_t length;
11033321936Shselasky	ib_access_t access_ctrl;
11034321936Shselasky} ib_mr_create_t;
11035321936Shselasky/*
11036321936Shselasky* FIELDS
11037321936Shselasky*	vaddr
11038321936Shselasky*		Starting virtual address of the region being registered.
11039321936Shselasky*
11040321936Shselasky*	length
11041321936Shselasky*		Length of the buffer to register.
11042321936Shselasky*
11043321936Shselasky*	access_ctrl
11044321936Shselasky*		Access rights of the registered region.
11045321936Shselasky*
11046321936Shselasky* SEE ALSO
11047321936Shselasky*	ib_access_t
11048321936Shselasky*****/
11049321936Shselasky
11050321936Shselasky/****s* Access Layer/ib_phys_create_t
11051321936Shselasky* NAME
11052321936Shselasky*	ib_phys_create_t
11053321936Shselasky*
11054321936Shselasky* DESCRIPTION
11055321936Shselasky*	Information required to create a physical memory region.
11056321936Shselasky*
11057321936Shselasky* SYNOPSIS
11058321936Shselasky*/
11059321936Shselaskytypedef struct _ib_phys_create {
11060321936Shselasky	uint64_t length;
11061321936Shselasky	uint32_t num_bufs;
11062321936Shselasky	uint64_t *buf_array;
11063321936Shselasky	uint32_t buf_offset;
11064321936Shselasky	uint32_t page_size;
11065321936Shselasky	ib_access_t access_ctrl;
11066321936Shselasky} ib_phys_create_t;
11067321936Shselasky/*
11068321936Shselasky*	length
11069321936Shselasky*		The length of the memory region in bytes.
11070321936Shselasky*
11071321936Shselasky*	num_bufs
11072321936Shselasky*		Number of buffers listed in the specified buffer array.
11073321936Shselasky*
11074321936Shselasky*	buf_array
11075321936Shselasky*		An array of physical buffers to be registered as a single memory
11076321936Shselasky*		region.
11077321936Shselasky*
11078321936Shselasky*	buf_offset
11079321936Shselasky*		The offset into the first physical page of the specified memory
11080321936Shselasky*		region to start the virtual address.
11081321936Shselasky*
11082321936Shselasky*	page_size
11083321936Shselasky*		The physical page size of the memory being registered.
11084321936Shselasky*
11085321936Shselasky*	access_ctrl
11086321936Shselasky*		Access rights of the registered region.
11087321936Shselasky*
11088321936Shselasky* SEE ALSO
11089321936Shselasky*	ib_access_t
11090321936Shselasky*****/
11091321936Shselasky
11092321936Shselasky/****s* Access Layer/ib_mr_attr_t
11093321936Shselasky* NAME
11094321936Shselasky*	ib_mr_attr_t
11095321936Shselasky*
11096321936Shselasky* DESCRIPTION
11097321936Shselasky*	Attributes of a registered memory region.
11098321936Shselasky*
11099321936Shselasky* SYNOPSIS
11100321936Shselasky*/
11101321936Shselaskytypedef struct _ib_mr_attr {
11102321936Shselasky	ib_pd_handle_t h_pd;
11103321936Shselasky	void *local_lb;
11104321936Shselasky	void *local_ub;
11105321936Shselasky	void *remote_lb;
11106321936Shselasky	void *remote_ub;
11107321936Shselasky	ib_access_t access_ctrl;
11108321936Shselasky	uint32_t lkey;
11109321936Shselasky	uint32_t rkey;
11110321936Shselasky} ib_mr_attr_t;
11111321936Shselasky/*
11112321936Shselasky* DESCRIPTION
11113321936Shselasky*	h_pd
11114321936Shselasky*		Handle to the protection domain for this memory region.
11115321936Shselasky*
11116321936Shselasky*	local_lb
11117321936Shselasky*		The virtual address of the lower bound of protection for local
11118321936Shselasky*		memory access.
11119321936Shselasky*
11120321936Shselasky*	local_ub
11121321936Shselasky*		The virtual address of the upper bound of protection for local
11122321936Shselasky*		memory access.
11123321936Shselasky*
11124321936Shselasky*	remote_lb
11125321936Shselasky*		The virtual address of the lower bound of protection for remote
11126321936Shselasky*		memory access.
11127321936Shselasky*
11128321936Shselasky*	remote_ub
11129321936Shselasky*		The virtual address of the upper bound of protection for remote
11130321936Shselasky*		memory access.
11131321936Shselasky*
11132321936Shselasky*	access_ctrl
11133321936Shselasky*		Access rights for the specified memory region.
11134321936Shselasky*
11135321936Shselasky*	lkey
11136321936Shselasky*		The lkey associated with this memory region.
11137321936Shselasky*
11138321936Shselasky*	rkey
11139321936Shselasky*		The rkey associated with this memory region.
11140321936Shselasky*
11141321936Shselasky* NOTES
11142321936Shselasky*	The remote_lb, remote_ub, and rkey are only valid if remote memory access
11143321936Shselasky*	is enabled for this memory region.
11144321936Shselasky*
11145321936Shselasky* SEE ALSO
11146321936Shselasky*	ib_access_t
11147321936Shselasky*****/
11148321936Shselasky
11149321936Shselasky/****d* Access Layer/ib_ca_mod_t
11150321936Shselasky* NAME
11151321936Shselasky*	ib_ca_mod_t -- Modify port attributes and error counters
11152321936Shselasky*
11153321936Shselasky* DESCRIPTION
11154321936Shselasky*	Specifies modifications to the port attributes of a channel adapter.
11155321936Shselasky*
11156321936Shselasky* SYNOPSIS
11157321936Shselasky*/
11158321936Shselaskytypedef uint32_t ib_ca_mod_t;
11159321936Shselasky#define IB_CA_MOD_IS_CM_SUPPORTED		0x00000001
11160321936Shselasky#define IB_CA_MOD_IS_SNMP_SUPPORTED		0x00000002
11161321936Shselasky#define	IB_CA_MOD_IS_DEV_MGMT_SUPPORTED		0x00000004
11162321936Shselasky#define	IB_CA_MOD_IS_VEND_SUPPORTED		0x00000008
11163321936Shselasky#define	IB_CA_MOD_IS_SM				0x00000010
11164321936Shselasky#define IB_CA_MOD_IS_SM_DISABLED		0x00000020
11165321936Shselasky#define IB_CA_MOD_QKEY_CTR			0x00000040
11166321936Shselasky#define IB_CA_MOD_PKEY_CTR			0x00000080
11167321936Shselasky#define IB_CA_MOD_IS_NOTICE_SUPPORTED		0x00000100
11168321936Shselasky#define IB_CA_MOD_IS_TRAP_SUPPORTED		0x00000200
11169321936Shselasky#define IB_CA_MOD_IS_APM_SUPPORTED		0x00000400
11170321936Shselasky#define IB_CA_MOD_IS_SLMAP_SUPPORTED		0x00000800
11171321936Shselasky#define IB_CA_MOD_IS_PKEY_NVRAM_SUPPORTED	0x00001000
11172321936Shselasky#define IB_CA_MOD_IS_MKEY_NVRAM_SUPPORTED	0x00002000
11173321936Shselasky#define IB_CA_MOD_IS_SYSGUID_SUPPORTED		0x00004000
11174321936Shselasky#define IB_CA_MOD_IS_DR_NOTICE_SUPPORTED	0x00008000
11175321936Shselasky#define IB_CA_MOD_IS_BOOT_MGMT_SUPPORTED	0x00010000
11176321936Shselasky#define IB_CA_MOD_IS_CAPM_NOTICE_SUPPORTED	0x00020000
11177321936Shselasky#define IB_CA_MOD_IS_REINIT_SUPORTED		0x00040000
11178321936Shselasky#define IB_CA_MOD_IS_LEDINFO_SUPPORTED		0x00080000
11179321936Shselasky#define IB_CA_MOD_SHUTDOWN_PORT			0x00100000
11180321936Shselasky#define IB_CA_MOD_INIT_TYPE_VALUE		0x00200000
11181321936Shselasky#define IB_CA_MOD_SYSTEM_IMAGE_GUID		0x00400000
11182321936Shselasky/*
11183321936Shselasky* VALUES
11184321936Shselasky*	IB_CA_MOD_IS_CM_SUPPORTED
11185321936Shselasky*		Indicates if there is a communication manager accessible through
11186321936Shselasky*		the port.
11187321936Shselasky*
11188321936Shselasky*	IB_CA_MOD_IS_SNMP_SUPPORTED
11189321936Shselasky*		Indicates if there is an SNMP agent accessible through the port.
11190321936Shselasky*
11191321936Shselasky*	IB_CA_MOD_IS_DEV_MGMT_SUPPORTED
11192321936Shselasky*		Indicates if there is a device management agent accessible
11193321936Shselasky*		through the port.
11194321936Shselasky*
11195321936Shselasky*	IB_CA_MOD_IS_VEND_SUPPORTED
11196321936Shselasky*		Indicates if there is a vendor supported agent accessible
11197321936Shselasky*		through the port.
11198321936Shselasky*
11199321936Shselasky*	IB_CA_MOD_IS_SM
11200321936Shselasky*		Indicates if there is a subnet manager accessible through
11201321936Shselasky*		the port.
11202321936Shselasky*
11203321936Shselasky*	IB_CA_MOD_IS_SM_DISABLED
11204321936Shselasky*		Indicates if the port has been disabled for configuration by the
11205321936Shselasky*		subnet manager.
11206321936Shselasky*
11207321936Shselasky*	IB_CA_MOD_QKEY_CTR
11208321936Shselasky*		Used to reset the qkey violation counter associated with the
11209321936Shselasky*		port.
11210321936Shselasky*
11211321936Shselasky*	IB_CA_MOD_PKEY_CTR
11212321936Shselasky*		Used to reset the pkey violation counter associated with the
11213321936Shselasky*		port.
11214321936Shselasky*
11215321936Shselasky*	IB_CA_MOD_IS_NOTICE_SUPPORTED
11216321936Shselasky*		Indicates that this CA supports ability to generate Notices for
11217321936Shselasky*		Port State changes. (only applicable to switches)
11218321936Shselasky*
11219321936Shselasky*	IB_CA_MOD_IS_TRAP_SUPPORTED
11220321936Shselasky*		Indicates that this management port supports ability to generate
11221321936Shselasky*		trap messages. (only applicable to switches)
11222321936Shselasky*
11223321936Shselasky*	IB_CA_MOD_IS_APM_SUPPORTED
11224321936Shselasky*		Indicates that this port is capable of performing Automatic
11225321936Shselasky*		Path Migration.
11226321936Shselasky*
11227321936Shselasky*	IB_CA_MOD_IS_SLMAP_SUPPORTED
11228321936Shselasky*		Indicates this port supports SLMAP capability.
11229321936Shselasky*
11230321936Shselasky*	IB_CA_MOD_IS_PKEY_NVRAM_SUPPORTED
11231321936Shselasky*		Indicates that PKEY is supported in NVRAM
11232321936Shselasky*
11233321936Shselasky*	IB_CA_MOD_IS_MKEY_NVRAM_SUPPORTED
11234321936Shselasky*		Indicates that MKEY is supported in NVRAM
11235321936Shselasky*
11236321936Shselasky*	IB_CA_MOD_IS_SYSGUID_SUPPORTED
11237321936Shselasky*		Indicates System Image GUID support.
11238321936Shselasky*
11239321936Shselasky*	IB_CA_MOD_IS_DR_NOTICE_SUPPORTED
11240321936Shselasky*		Indicate support for generating Direct Routed Notices
11241321936Shselasky*
11242321936Shselasky*	IB_CA_MOD_IS_BOOT_MGMT_SUPPORTED
11243321936Shselasky*		Indicates support for Boot Management
11244321936Shselasky*
11245321936Shselasky*	IB_CA_MOD_IS_CAPM_NOTICE_SUPPORTED
11246321936Shselasky*		Indicates capability to generate notices for changes to CAPMASK
11247321936Shselasky*
11248321936Shselasky*	IB_CA_MOD_IS_REINIT_SUPORTED
11249321936Shselasky*		Indicates type of node init supported. Refer to Chapter 14 for
11250321936Shselasky*		Initialization actions.
11251321936Shselasky*
11252321936Shselasky*	IB_CA_MOD_IS_LEDINFO_SUPPORTED
11253321936Shselasky*		Indicates support for LED info.
11254321936Shselasky*
11255321936Shselasky*	IB_CA_MOD_SHUTDOWN_PORT
11256321936Shselasky*		Used to modify the port active indicator.
11257321936Shselasky*
11258321936Shselasky*	IB_CA_MOD_INIT_TYPE_VALUE
11259321936Shselasky*		Used to modify the init_type value for the port.
11260321936Shselasky*
11261321936Shselasky*	IB_CA_MOD_SYSTEM_IMAGE_GUID
11262321936Shselasky*		Used to modify the system image GUID for the port.
11263321936Shselasky*****/
11264321936Shselasky
11265321936Shselasky/****d* Access Layer/ib_mr_mod_t
11266321936Shselasky* NAME
11267321936Shselasky*	ib_mr_mod_t
11268321936Shselasky*
11269321936Shselasky* DESCRIPTION
11270321936Shselasky*	Mask used to specify which attributes of a registered memory region are
11271321936Shselasky*	being modified.
11272321936Shselasky*
11273321936Shselasky* SYNOPSIS
11274321936Shselasky*/
11275321936Shselaskytypedef uint32_t ib_mr_mod_t;
11276321936Shselasky#define IB_MR_MOD_ADDR					0x00000001
11277321936Shselasky#define IB_MR_MOD_PD					0x00000002
11278321936Shselasky#define IB_MR_MOD_ACCESS				0x00000004
11279321936Shselasky/*
11280321936Shselasky* PARAMETERS
11281321936Shselasky*	IB_MEM_MOD_ADDR
11282321936Shselasky*		The address of the memory region is being modified.
11283321936Shselasky*
11284321936Shselasky*	IB_MEM_MOD_PD
11285321936Shselasky*		The protection domain associated with the memory region is being
11286321936Shselasky*		modified.
11287321936Shselasky*
11288321936Shselasky*	IB_MEM_MOD_ACCESS
11289321936Shselasky*		The access rights the memory region are being modified.
11290321936Shselasky*****/
11291321936Shselasky
11292321936Shselasky/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_HANDOVER
11293321936Shselasky* NAME
11294321936Shselasky*	IB_SMINFO_ATTR_MOD_HANDOVER
11295321936Shselasky*
11296321936Shselasky* DESCRIPTION
11297321936Shselasky*	Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.
11298321936Shselasky*
11299321936Shselasky* SOURCE
11300321936Shselasky*/
11301321936Shselasky#define IB_SMINFO_ATTR_MOD_HANDOVER		(CL_HTON32(0x000001))
11302321936Shselasky/**********/
11303321936Shselasky
11304321936Shselasky/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_ACKNOWLEDGE
11305321936Shselasky* NAME
11306321936Shselasky*	IB_SMINFO_ATTR_MOD_ACKNOWLEDGE
11307321936Shselasky*
11308321936Shselasky* DESCRIPTION
11309321936Shselasky*	Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.
11310321936Shselasky*
11311321936Shselasky* SOURCE
11312321936Shselasky*/
11313321936Shselasky#define IB_SMINFO_ATTR_MOD_ACKNOWLEDGE		(CL_HTON32(0x000002))
11314321936Shselasky/**********/
11315321936Shselasky
11316321936Shselasky/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_DISABLE
11317321936Shselasky* NAME
11318321936Shselasky*	IB_SMINFO_ATTR_MOD_DISABLE
11319321936Shselasky*
11320321936Shselasky* DESCRIPTION
11321321936Shselasky*	Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.
11322321936Shselasky*
11323321936Shselasky* SOURCE
11324321936Shselasky*/
11325321936Shselasky#define IB_SMINFO_ATTR_MOD_DISABLE			(CL_HTON32(0x000003))
11326321936Shselasky/**********/
11327321936Shselasky
11328321936Shselasky/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_STANDBY
11329321936Shselasky* NAME
11330321936Shselasky*	IB_SMINFO_ATTR_MOD_STANDBY
11331321936Shselasky*
11332321936Shselasky* DESCRIPTION
11333321936Shselasky*	Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.
11334321936Shselasky*
11335321936Shselasky* SOURCE
11336321936Shselasky*/
11337321936Shselasky#define IB_SMINFO_ATTR_MOD_STANDBY			(CL_HTON32(0x000004))
11338321936Shselasky/**********/
11339321936Shselasky
11340321936Shselasky/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_DISCOVER
11341321936Shselasky* NAME
11342321936Shselasky*	IB_SMINFO_ATTR_MOD_DISCOVER
11343321936Shselasky*
11344321936Shselasky* DESCRIPTION
11345321936Shselasky*	Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.
11346321936Shselasky*
11347321936Shselasky* SOURCE
11348321936Shselasky*/
11349321936Shselasky#define IB_SMINFO_ATTR_MOD_DISCOVER			(CL_HTON32(0x000005))
11350321936Shselasky/**********/
11351321936Shselasky
11352321936Shselasky/****s* Access Layer/ib_ci_op_t
11353321936Shselasky* NAME
11354321936Shselasky*	ib_ci_op_t
11355321936Shselasky*
11356321936Shselasky* DESCRIPTION
11357321936Shselasky*	A structure used for vendor specific CA interface communication.
11358321936Shselasky*
11359321936Shselasky* SYNOPSIS
11360321936Shselasky*/
11361321936Shselaskytypedef struct _ib_ci_op {
11362321936Shselasky	IN uint32_t command;
11363321936Shselasky	IN OUT void *p_buf OPTIONAL;
11364321936Shselasky	IN uint32_t buf_size;
11365321936Shselasky	IN OUT uint32_t num_bytes_ret;
11366321936Shselasky	IN OUT int32_t status;
11367321936Shselasky} ib_ci_op_t;
11368321936Shselasky/*
11369321936Shselasky* FIELDS
11370321936Shselasky*	command
11371321936Shselasky*		A command code that is understood by the verbs provider.
11372321936Shselasky*
11373321936Shselasky*	p_buf
11374321936Shselasky*		A reference to a buffer containing vendor specific data.  The verbs
11375321936Shselasky*		provider must not access pointers in the p_buf between user-mode and
11376321936Shselasky*		kernel-mode.  Any pointers embedded in the p_buf are invalidated by
11377321936Shselasky*		the user-mode/kernel-mode transition.
11378321936Shselasky*
11379321936Shselasky*	buf_size
11380321936Shselasky*		The size of the buffer in bytes.
11381321936Shselasky*
11382321936Shselasky*	num_bytes_ret
11383321936Shselasky*		The size in bytes of the vendor specific data returned in the buffer.
11384321936Shselasky*		This field is set by the verbs provider.  The verbs provider should
11385321936Shselasky*		verify that the buffer size is sufficient to hold the data being
11386321936Shselasky*		returned.
11387321936Shselasky*
11388321936Shselasky*	status
11389321936Shselasky*		The completion status from the verbs provider.  This field should be
11390321936Shselasky*		initialize to indicate an error to allow detection and cleanup in
11391321936Shselasky*		case a communication error occurs between user-mode and kernel-mode.
11392321936Shselasky*
11393321936Shselasky* NOTES
11394321936Shselasky*	This structure is provided to allow the exchange of vendor specific
11395321936Shselasky*	data between the originator and the verbs provider.  Users of this
11396321936Shselasky*	structure are expected to know the format of data in the p_buf based
11397321936Shselasky*	on the structure command field or the usage context.
11398321936Shselasky*****/
11399321936Shselasky
11400321936Shselasky/****s* IBA Base: Types/ib_cc_mad_t
11401321936Shselasky* NAME
11402321936Shselasky*	ib_cc_mad_t
11403321936Shselasky*
11404321936Shselasky* DESCRIPTION
11405321936Shselasky*	IBA defined Congestion Control MAD format. (A10.4.1)
11406321936Shselasky*
11407321936Shselasky* SYNOPSIS
11408321936Shselasky*/
11409321936Shselasky#define IB_CC_LOG_DATA_SIZE 32
11410321936Shselasky#define IB_CC_MGT_DATA_SIZE 192
11411321936Shselasky#define IB_CC_MAD_HDR_SIZE (sizeof(ib_sa_mad_t) - IB_CC_LOG_DATA_SIZE \
11412321936Shselasky						- IB_CC_MGT_DATA_SIZE)
11413321936Shselasky
11414321936Shselasky#include <complib/cl_packon.h>
11415321936Shselaskytypedef struct _ib_cc_mad {
11416321936Shselasky	ib_mad_t header;
11417321936Shselasky	ib_net64_t cc_key;
11418321936Shselasky	uint8_t log_data[IB_CC_LOG_DATA_SIZE];
11419321936Shselasky	uint8_t mgt_data[IB_CC_MGT_DATA_SIZE];
11420321936Shselasky} PACK_SUFFIX ib_cc_mad_t;
11421321936Shselasky#include <complib/cl_packoff.h>
11422321936Shselasky/*
11423321936Shselasky* FIELDS
11424321936Shselasky*	header
11425321936Shselasky*		Common MAD header.
11426321936Shselasky*
11427321936Shselasky*	cc_key
11428321936Shselasky*		CC_Key of the Congestion Control MAD.
11429321936Shselasky*
11430321936Shselasky*	log_data
11431321936Shselasky*		Congestion Control log data of the CC MAD.
11432321936Shselasky*
11433321936Shselasky*	mgt_data
11434321936Shselasky*		Congestion Control management data of the CC MAD.
11435321936Shselasky*
11436321936Shselasky* SEE ALSO
11437321936Shselasky* ib_mad_t
11438321936Shselasky*********/
11439321936Shselasky
11440321936Shselasky/****f* IBA Base: Types/ib_cc_mad_get_cc_key
11441321936Shselasky* NAME
11442321936Shselasky*	ib_cc_mad_get_cc_key
11443321936Shselasky*
11444321936Shselasky* DESCRIPTION
11445321936Shselasky*	Gets a CC_Key of the CC MAD.
11446321936Shselasky*
11447321936Shselasky* SYNOPSIS
11448321936Shselasky*/
11449321936Shselaskystatic inline ib_net64_t OSM_API
11450321936Shselaskyib_cc_mad_get_cc_key(IN const ib_cc_mad_t * const p_cc_mad)
11451321936Shselasky{
11452321936Shselasky	return p_cc_mad->cc_key;
11453321936Shselasky}
11454321936Shselasky/*
11455321936Shselasky* PARAMETERS
11456321936Shselasky*	p_cc_mad
11457321936Shselasky*		[in] Pointer to the CC MAD packet.
11458321936Shselasky*
11459321936Shselasky* RETURN VALUES
11460321936Shselasky*	CC_Key of the provided CC MAD packet.
11461321936Shselasky*
11462321936Shselasky* NOTES
11463321936Shselasky*
11464321936Shselasky* SEE ALSO
11465321936Shselasky*	ib_cc_mad_t
11466321936Shselasky*********/
11467321936Shselasky
11468321936Shselasky/****f* IBA Base: Types/ib_cc_mad_get_log_data_ptr
11469321936Shselasky* NAME
11470321936Shselasky*	ib_cc_mad_get_log_data_ptr
11471321936Shselasky*
11472321936Shselasky* DESCRIPTION
11473321936Shselasky*	Gets a pointer to the CC MAD's log data area.
11474321936Shselasky*
11475321936Shselasky* SYNOPSIS
11476321936Shselasky*/
11477321936Shselaskystatic inline void * OSM_API
11478321936Shselaskyib_cc_mad_get_log_data_ptr(IN const ib_cc_mad_t * const p_cc_mad)
11479321936Shselasky{
11480321936Shselasky	return ((void *)p_cc_mad->log_data);
11481321936Shselasky}
11482321936Shselasky/*
11483321936Shselasky* PARAMETERS
11484321936Shselasky*	p_cc_mad
11485321936Shselasky*		[in] Pointer to the CC MAD packet.
11486321936Shselasky*
11487321936Shselasky* RETURN VALUES
11488321936Shselasky*	Pointer to CC MAD log data area.
11489321936Shselasky*
11490321936Shselasky* NOTES
11491321936Shselasky*
11492321936Shselasky* SEE ALSO
11493321936Shselasky*	ib_cc_mad_t
11494321936Shselasky*********/
11495321936Shselasky
11496321936Shselasky/****f* IBA Base: Types/ib_cc_mad_get_mgt_data_ptr
11497321936Shselasky* NAME
11498321936Shselasky*	ib_cc_mad_get_mgt_data_ptr
11499321936Shselasky*
11500321936Shselasky* DESCRIPTION
11501321936Shselasky*	Gets a pointer to the CC MAD's management data area.
11502321936Shselasky*
11503321936Shselasky* SYNOPSIS
11504321936Shselasky*/
11505321936Shselaskystatic inline void * OSM_API
11506321936Shselaskyib_cc_mad_get_mgt_data_ptr(IN const ib_cc_mad_t * const p_cc_mad)
11507321936Shselasky{
11508321936Shselasky	return ((void *)p_cc_mad->mgt_data);
11509321936Shselasky}
11510321936Shselasky/*
11511321936Shselasky* PARAMETERS
11512321936Shselasky*	p_cc_mad
11513321936Shselasky*		[in] Pointer to the CC MAD packet.
11514321936Shselasky*
11515321936Shselasky* RETURN VALUES
11516321936Shselasky*	Pointer to CC MAD management data area.
11517321936Shselasky*
11518321936Shselasky* NOTES
11519321936Shselasky*
11520321936Shselasky* SEE ALSO
11521321936Shselasky*	ib_cc_mad_t
11522321936Shselasky*********/
11523321936Shselasky
11524321936Shselasky/****s* IBA Base: Types/ib_cong_info_t
11525321936Shselasky* NAME
11526321936Shselasky*	ib_cong_info_t
11527321936Shselasky*
11528321936Shselasky* DESCRIPTION
11529321936Shselasky*	IBA defined CongestionInfo attribute (A10.4.3.3)
11530321936Shselasky*
11531321936Shselasky* SYNOPSIS
11532321936Shselasky*/
11533321936Shselasky#include <complib/cl_packon.h>
11534321936Shselaskytypedef struct _ib_cong_info {
11535321936Shselasky	uint8_t cong_info;
11536321936Shselasky	uint8_t resv;
11537321936Shselasky	uint8_t ctrl_table_cap;
11538321936Shselasky} PACK_SUFFIX ib_cong_info_t;
11539321936Shselasky#include <complib/cl_packoff.h>
11540321936Shselasky/*
11541321936Shselasky* FIELDS
11542321936Shselasky*	cong_info
11543321936Shselasky*		Congestion control capabilities of the node.
11544321936Shselasky*
11545321936Shselasky*	ctrl_table_cap
11546321936Shselasky*		Number of 64 entry blocks in the CongestionControlTable.
11547321936Shselasky*
11548321936Shselasky* SEE ALSO
11549321936Shselasky*	ib_cc_mad_t
11550321936Shselasky*********/
11551321936Shselasky
11552321936Shselasky/****s* IBA Base: Types/ib_cong_key_info_t
11553321936Shselasky* NAME
11554321936Shselasky*	ib_cong_key_info_t
11555321936Shselasky*
11556321936Shselasky* DESCRIPTION
11557321936Shselasky*	IBA defined CongestionKeyInfo attribute (A10.4.3.4)
11558321936Shselasky*
11559321936Shselasky* SYNOPSIS
11560321936Shselasky*/
11561321936Shselasky#include <complib/cl_packon.h>
11562321936Shselaskytypedef struct _ib_cong_key_info {
11563321936Shselasky	ib_net64_t cc_key;
11564321936Shselasky	ib_net16_t protect_bit;
11565321936Shselasky	ib_net16_t lease_period;
11566321936Shselasky	ib_net16_t violations;
11567321936Shselasky} PACK_SUFFIX ib_cong_key_info_t;
11568321936Shselasky#include <complib/cl_packoff.h>
11569321936Shselasky/*
11570321936Shselasky* FIELDS
11571321936Shselasky*	cc_key
11572321936Shselasky*		8-byte CC Key.
11573321936Shselasky*
11574321936Shselasky*	protect_bit
11575321936Shselasky*		Bit 0 is a CC Key Protect Bit, other 15 bits are reserved.
11576321936Shselasky*
11577321936Shselasky*	lease_period
11578321936Shselasky*		How long the CC Key protect bit is to remain non-zero.
11579321936Shselasky*
11580321936Shselasky*	violations
11581321936Shselasky*		Number of received MADs that violated CC Key.
11582321936Shselasky*
11583321936Shselasky* SEE ALSO
11584321936Shselasky*	ib_cc_mad_t
11585321936Shselasky*********/
11586321936Shselasky
11587321936Shselasky/****s* IBA Base: Types/ib_cong_log_event_sw_t
11588321936Shselasky* NAME
11589321936Shselasky*	ib_cong_log_event_sw_t
11590321936Shselasky*
11591321936Shselasky* DESCRIPTION
11592321936Shselasky*	IBA defined CongestionLogEvent (SW) entry (A10.4.3.5)
11593321936Shselasky*
11594321936Shselasky* SYNOPSIS
11595321936Shselasky*/
11596321936Shselasky#include <complib/cl_packon.h>
11597321936Shselaskytypedef struct _ib_cong_log_event_sw {
11598321936Shselasky	ib_net16_t slid;
11599321936Shselasky	ib_net16_t dlid;
11600321936Shselasky	ib_net32_t sl;
11601321936Shselasky	ib_net32_t time_stamp;
11602321936Shselasky} PACK_SUFFIX ib_cong_log_event_sw_t;
11603321936Shselasky#include <complib/cl_packoff.h>
11604321936Shselasky/*
11605321936Shselasky* FIELDS
11606321936Shselasky*	slid
11607321936Shselasky*		Source LID of congestion event.
11608321936Shselasky*
11609321936Shselasky*	dlid
11610321936Shselasky*		Destination LID of congestion event.
11611321936Shselasky*
11612321936Shselasky*	sl
11613321936Shselasky*		4 bits - SL of congestion event.
11614321936Shselasky*		rest of the bits are reserved.
11615321936Shselasky*
11616321936Shselasky*	time_stamp
11617321936Shselasky*		Timestamp of congestion event.
11618321936Shselasky*
11619321936Shselasky* SEE ALSO
11620321936Shselasky*	ib_cc_mad_t, ib_cong_log_t
11621321936Shselasky*********/
11622321936Shselasky
11623321936Shselasky/****s* IBA Base: Types/ib_cong_log_event_ca_t
11624321936Shselasky* NAME
11625321936Shselasky*	ib_cong_log_event_ca_t
11626321936Shselasky*
11627321936Shselasky* DESCRIPTION
11628321936Shselasky*	IBA defined CongestionLogEvent (CA) entry (A10.4.3.5)
11629321936Shselasky*
11630321936Shselasky* SYNOPSIS
11631321936Shselasky*/
11632321936Shselasky#include <complib/cl_packon.h>
11633321936Shselaskytypedef struct _ib_cong_log_event_ca {
11634321936Shselasky	ib_net32_t local_qp_resv0;
11635321936Shselasky	ib_net32_t remote_qp_sl_service_type;
11636321936Shselasky	ib_net16_t remote_lid;
11637321936Shselasky	ib_net16_t resv1;
11638321936Shselasky	ib_net32_t time_stamp;
11639321936Shselasky} PACK_SUFFIX ib_cong_log_event_ca_t;
11640321936Shselasky#include <complib/cl_packoff.h>
11641321936Shselasky/*
11642321936Shselasky* FIELDS
11643321936Shselasky*	resv0_local_qp
11644321936Shselasky*		bits [31:8] local QP that reached CN threshold.
11645321936Shselasky*		bits [7:0] reserved.
11646321936Shselasky*
11647321936Shselasky*	remote_qp_sl_service_type
11648321936Shselasky*		bits [31:8] remote QP that is connected to local QP.
11649321936Shselasky*		bits [7:4] SL of the local QP.
11650321936Shselasky*		bits [3:0] Service Type of the local QP.
11651321936Shselasky*
11652321936Shselasky*	remote_lid
11653321936Shselasky*		LID of the remote port that is connected to local QP.
11654321936Shselasky*
11655321936Shselasky*	time_stamp
11656321936Shselasky*		Timestamp when threshold reached.
11657321936Shselasky*
11658321936Shselasky* SEE ALSO
11659321936Shselasky*	ib_cc_mad_t, ib_cong_log_t
11660321936Shselasky*********/
11661321936Shselasky
11662321936Shselasky/****s* IBA Base: Types/ib_cong_log_t
11663321936Shselasky* NAME
11664321936Shselasky*	ib_cong_log_t
11665321936Shselasky*
11666321936Shselasky* DESCRIPTION
11667321936Shselasky*	IBA defined CongestionLog attribute (A10.4.3.5)
11668321936Shselasky*
11669321936Shselasky* SYNOPSIS
11670321936Shselasky*/
11671321936Shselasky#include <complib/cl_packon.h>
11672321936Shselaskytypedef struct _ib_cong_log {
11673321936Shselasky	uint8_t log_type;
11674321936Shselasky	union _log_details
11675321936Shselasky	{
11676321936Shselasky		struct _log_sw {
11677321936Shselasky			uint8_t cong_flags;
11678321936Shselasky			ib_net16_t event_counter;
11679321936Shselasky			ib_net32_t time_stamp;
11680321936Shselasky			uint8_t port_map[32];
11681321936Shselasky			ib_cong_log_event_sw_t entry_list[15];
11682321936Shselasky		} PACK_SUFFIX log_sw;
11683321936Shselasky
11684321936Shselasky		struct _log_ca {
11685321936Shselasky			uint8_t cong_flags;
11686321936Shselasky			ib_net16_t event_counter;
11687321936Shselasky			ib_net16_t event_map;
11688321936Shselasky			ib_net16_t resv;
11689321936Shselasky			ib_net32_t time_stamp;
11690321936Shselasky			ib_cong_log_event_ca_t log_event[13];
11691321936Shselasky		} PACK_SUFFIX log_ca;
11692321936Shselasky
11693321936Shselasky	} log_details;
11694321936Shselasky} PACK_SUFFIX ib_cong_log_t;
11695321936Shselasky#include <complib/cl_packoff.h>
11696321936Shselasky/*
11697321936Shselasky* FIELDS
11698321936Shselasky*
11699321936Shselasky*	log_{sw,ca}.log_type
11700321936Shselasky*		Log type: 0x1 is for Switch, 0x2 is for CA
11701321936Shselasky*
11702321936Shselasky*	log_{sw,ca}.cong_flags
11703321936Shselasky*		Congestion Flags.
11704321936Shselasky*
11705321936Shselasky*	log_{sw,ca}.event_counter
11706321936Shselasky*		Number of events since log last sent.
11707321936Shselasky*
11708321936Shselasky*	log_{sw,ca}.time_stamp
11709321936Shselasky*		Timestamp when log sent.
11710321936Shselasky*
11711321936Shselasky*	log_sw.port_map
11712321936Shselasky*		If a bit set to 1, then the corresponding port
11713321936Shselasky*		has marked packets with a FECN.
11714321936Shselasky*		bits 0 and 255 - reserved
11715321936Shselasky*		bits [254..1] - ports [254..1].
11716321936Shselasky*
11717321936Shselasky*	log_sw.entry_list
11718321936Shselasky*		Array of 13 most recent congestion log events.
11719321936Shselasky*
11720321936Shselasky*	log_ca.event_map
11721321936Shselasky*		array 16 bits, one for each SL.
11722321936Shselasky*
11723321936Shselasky*	log_ca.log_event
11724321936Shselasky*		Array of 13 most recent congestion log events.
11725321936Shselasky*
11726321936Shselasky* SEE ALSO
11727321936Shselasky*	ib_cc_mad_t, ib_cong_log_event_sw_t, ib_cong_log_event_ca_t
11728321936Shselasky*********/
11729321936Shselasky
11730321936Shselasky/****s* IBA Base: Types/ib_sw_cong_setting_t
11731321936Shselasky* NAME
11732321936Shselasky*	ib_sw_cong_setting_t
11733321936Shselasky*
11734321936Shselasky* DESCRIPTION
11735321936Shselasky*	IBA defined SwitchCongestionSetting attribute (A10.4.3.6)
11736321936Shselasky*
11737321936Shselasky* SYNOPSIS
11738321936Shselasky*/
11739321936Shselasky#define IB_CC_PORT_MASK_DATA_SIZE 32
11740321936Shselasky#include <complib/cl_packon.h>
11741321936Shselaskytypedef struct _ib_sw_cong_setting {
11742321936Shselasky	ib_net32_t control_map;
11743321936Shselasky	uint8_t victim_mask[IB_CC_PORT_MASK_DATA_SIZE];
11744321936Shselasky	uint8_t credit_mask[IB_CC_PORT_MASK_DATA_SIZE];
11745321936Shselasky	uint8_t threshold_resv;
11746321936Shselasky	uint8_t packet_size;
11747321936Shselasky	ib_net16_t cs_threshold_resv;
11748321936Shselasky	ib_net16_t cs_return_delay;
11749321936Shselasky	ib_net16_t marking_rate;
11750321936Shselasky} PACK_SUFFIX ib_sw_cong_setting_t;
11751321936Shselasky#include <complib/cl_packoff.h>
11752321936Shselasky/*
11753321936Shselasky* FIELDS
11754321936Shselasky*
11755321936Shselasky*	control_map
11756321936Shselasky*		Indicates which components of this attribute are valid
11757321936Shselasky*
11758321936Shselasky*	victim_mask
11759321936Shselasky*		If the bit set to 1, then the port corresponding to
11760321936Shselasky*		that bit shall mark packets that encounter congestion
11761321936Shselasky*		with a FECN, whether they are the source or victim
11762321936Shselasky*		of congestion. (See A10.2.1.1.1)
11763321936Shselasky*		  bit 0: port 0 (enhanced port 0 only)
11764321936Shselasky*		  bits [254..1]: ports [254..1]
11765321936Shselasky*		  bit 255: reserved
11766321936Shselasky*
11767321936Shselasky*	credit_mask
11768321936Shselasky*		If the bit set to 1, then the port corresponding
11769321936Shselasky*		to that bit shall apply Credit Starvation.
11770321936Shselasky*		  bit 0: port 0 (enhanced port 0 only)
11771321936Shselasky*		  bits [254..1]: ports [254..1]
11772321936Shselasky*		  bit 255: reserved
11773321936Shselasky*
11774321936Shselasky*	threshold_resv
11775321936Shselasky*		bits [7..4] Indicates how aggressive cong. marking should be
11776321936Shselasky*		bits [3..0] Reserved
11777321936Shselasky*
11778321936Shselasky*	packet_size
11779321936Shselasky*		Any packet less than this size won't be marked with FECN
11780321936Shselasky*
11781321936Shselasky*	cs_threshold_resv
11782321936Shselasky*		bits [15..12] How aggressive Credit Starvation should be
11783321936Shselasky*		bits [11..0] Reserved
11784321936Shselasky*
11785321936Shselasky*	cs_return_delay
11786321936Shselasky*		Value that controls credit return rate.
11787321936Shselasky*
11788321936Shselasky*	marking_rate
11789321936Shselasky*		The value that provides the mean number of packets
11790321936Shselasky*		between marking eligible packets with FECN.
11791321936Shselasky*
11792321936Shselasky* SEE ALSO
11793321936Shselasky*	ib_cc_mad_t
11794321936Shselasky*********/
11795321936Shselasky
11796321936Shselasky/****s* IBA Base: Types/ib_sw_port_cong_setting_element_t
11797321936Shselasky* NAME
11798321936Shselasky*	ib_sw_port_cong_setting_element_t
11799321936Shselasky*
11800321936Shselasky* DESCRIPTION
11801321936Shselasky*	IBA defined SwitchPortCongestionSettingElement (A10.4.3.7)
11802321936Shselasky*
11803321936Shselasky* SYNOPSIS
11804321936Shselasky*/
11805321936Shselasky#include <complib/cl_packon.h>
11806321936Shselaskytypedef struct _ib_sw_port_cong_setting_element {
11807321936Shselasky	uint8_t valid_ctrl_type_res_threshold;
11808321936Shselasky	uint8_t packet_size;
11809321936Shselasky	ib_net16_t cong_param;
11810321936Shselasky} PACK_SUFFIX ib_sw_port_cong_setting_element_t;
11811321936Shselasky#include <complib/cl_packoff.h>
11812321936Shselasky/*
11813321936Shselasky* FIELDS
11814321936Shselasky*
11815321936Shselasky*	valid_ctrl_type_res_threshold
11816321936Shselasky*		bit 7: "Valid"
11817321936Shselasky*			when set to 1, indicates this switch
11818321936Shselasky*			port congestion setting element is valid.
11819321936Shselasky*		bit 6: "Control Type"
11820321936Shselasky*			Indicates which type of attribute is being set:
11821321936Shselasky*			0b = Congestion Control parameters are being set.
11822321936Shselasky*			1b = Credit Starvation parameters are being set.
11823321936Shselasky*		bits [5..4]: reserved
11824321936Shselasky*		bits [3..0]: "Threshold"
11825321936Shselasky*			When Control Type is 0, contains the congestion
11826321936Shselasky*			threshold value (Threshold) for this port.
11827321936Shselasky*			When Control Type is 1, contains the credit
11828321936Shselasky*			starvation threshold (CS_Threshold) value for
11829321936Shselasky*			this port.
11830321936Shselasky*
11831321936Shselasky*	packet_size
11832321936Shselasky*		When Control Type is 0, this field contains the minimum
11833321936Shselasky*		size of packets that may be marked with a FECN.
11834321936Shselasky*		When Control Type is 1, this field is reserved.
11835321936Shselasky*
11836321936Shselasky*	cong_parm
11837321936Shselasky*		When Control Type is 0, this field contains the port
11838321936Shselasky*		marking_rate.
11839321936Shselasky*		When Control Type is 1, this field is reserved.
11840321936Shselasky*
11841321936Shselasky* SEE ALSO
11842321936Shselasky*	ib_cc_mad_t, ib_sw_port_cong_setting_t
11843321936Shselasky*********/
11844321936Shselasky
11845321936Shselasky/****d* IBA Base: Types/ib_sw_port_cong_setting_block_t
11846321936Shselasky* NAME
11847321936Shselasky*	ib_sw_port_cong_setting_block_t
11848321936Shselasky*
11849321936Shselasky* DESCRIPTION
11850321936Shselasky*	Defines the SwitchPortCongestionSetting Block (A10.4.3.7).
11851321936Shselasky*
11852321936Shselasky* SOURCE
11853321936Shselasky*/
11854321936Shselasky#define IB_CC_SW_PORT_SETTING_ELEMENTS 32
11855321936Shselaskytypedef ib_sw_port_cong_setting_element_t ib_sw_port_cong_setting_block_t[IB_CC_SW_PORT_SETTING_ELEMENTS];
11856321936Shselasky/**********/
11857321936Shselasky
11858321936Shselasky/****s* IBA Base: Types/ib_sw_port_cong_setting_t
11859321936Shselasky* NAME
11860321936Shselasky*	ib_sw_port_cong_setting_t
11861321936Shselasky*
11862321936Shselasky* DESCRIPTION
11863321936Shselasky*	IBA defined SwitchPortCongestionSetting attribute (A10.4.3.7)
11864321936Shselasky*
11865321936Shselasky* SYNOPSIS
11866321936Shselasky*/
11867321936Shselasky
11868321936Shselasky#include <complib/cl_packon.h>
11869321936Shselaskytypedef struct _ib_sw_port_cong_setting {
11870321936Shselasky	ib_sw_port_cong_setting_block_t block;
11871321936Shselasky} PACK_SUFFIX ib_sw_port_cong_setting_t;
11872321936Shselasky#include <complib/cl_packoff.h>
11873321936Shselasky/*
11874321936Shselasky* FIELDS
11875321936Shselasky*
11876321936Shselasky*	block
11877321936Shselasky*		SwitchPortCongestionSetting block.
11878321936Shselasky*
11879321936Shselasky* SEE ALSO
11880321936Shselasky*	ib_cc_mad_t, ib_sw_port_cong_setting_element_t
11881321936Shselasky*********/
11882321936Shselasky
11883321936Shselasky/****s* IBA Base: Types/ib_ca_cong_entry_t
11884321936Shselasky* NAME
11885321936Shselasky*	ib_ca_cong_entry_t
11886321936Shselasky*
11887321936Shselasky* DESCRIPTION
11888321936Shselasky*	IBA defined CACongestionEntry (A10.4.3.8)
11889321936Shselasky*
11890321936Shselasky* SYNOPSIS
11891321936Shselasky*/
11892321936Shselasky#include <complib/cl_packon.h>
11893321936Shselaskytypedef struct _ib_ca_cong_entry {
11894321936Shselasky	ib_net16_t ccti_timer;
11895321936Shselasky	uint8_t ccti_increase;
11896321936Shselasky	uint8_t trigger_threshold;
11897321936Shselasky	uint8_t ccti_min;
11898321936Shselasky	uint8_t resv0;
11899321936Shselasky	ib_net16_t resv1;
11900321936Shselasky} PACK_SUFFIX ib_ca_cong_entry_t;
11901321936Shselasky#include <complib/cl_packoff.h>
11902321936Shselasky/*
11903321936Shselasky* FIELDS
11904321936Shselasky*
11905321936Shselasky*	ccti_timer
11906321936Shselasky*		When the timer expires it will be reset to its specified
11907321936Shselasky*		value, and 1 will be decremented from the CCTI.
11908321936Shselasky*
11909321936Shselasky*	ccti_increase
11910321936Shselasky*		The number to be added to the table Index (CCTI)
11911321936Shselasky*		on the receipt of a BECN.
11912321936Shselasky*
11913321936Shselasky*	trigger_threshold
11914321936Shselasky*		When the CCTI is equal to this value, an event
11915321936Shselasky*		is logged in the CAs cyclic event log.
11916321936Shselasky*
11917321936Shselasky*	ccti_min
11918321936Shselasky*		The minimum value permitted for the CCTI.
11919321936Shselasky*
11920321936Shselasky* SEE ALSO
11921321936Shselasky*	ib_cc_mad_t
11922321936Shselasky*********/
11923321936Shselasky
11924321936Shselasky/****s* IBA Base: Types/ib_ca_cong_setting_t
11925321936Shselasky* NAME
11926321936Shselasky*	ib_ca_cong_setting_t
11927321936Shselasky*
11928321936Shselasky* DESCRIPTION
11929321936Shselasky*	IBA defined CACongestionSetting attribute (A10.4.3.8)
11930321936Shselasky*
11931321936Shselasky* SYNOPSIS
11932321936Shselasky*/
11933321936Shselasky#define IB_CA_CONG_ENTRY_DATA_SIZE 16
11934321936Shselasky#include <complib/cl_packon.h>
11935321936Shselaskytypedef struct _ib_ca_cong_setting {
11936321936Shselasky	ib_net16_t port_control;
11937321936Shselasky	ib_net16_t control_map;
11938321936Shselasky	ib_ca_cong_entry_t entry_list[IB_CA_CONG_ENTRY_DATA_SIZE];
11939321936Shselasky} PACK_SUFFIX ib_ca_cong_setting_t;
11940321936Shselasky#include <complib/cl_packoff.h>
11941321936Shselasky/*
11942321936Shselasky* FIELDS
11943321936Shselasky*
11944321936Shselasky*	port_control
11945321936Shselasky*		Congestion attributes for this port:
11946321936Shselasky*		  bit0 = 0: QP based CC
11947321936Shselasky*		  bit0 = 1: SL/Port based CC
11948321936Shselasky*		All other bits are reserved
11949321936Shselasky*
11950321936Shselasky*	control_map
11951321936Shselasky*		An array of sixteen bits, one for each SL. Each bit indicates
11952321936Shselasky*		whether or not the corresponding entry is to be modified.
11953321936Shselasky*
11954321936Shselasky*	entry_list
11955321936Shselasky*		List of 16 CACongestionEntries, one per SL.
11956321936Shselasky*
11957321936Shselasky* SEE ALSO
11958321936Shselasky*	ib_cc_mad_t
11959321936Shselasky*********/
11960321936Shselasky
11961321936Shselasky/****s* IBA Base: Types/ib_cc_tbl_entry_t
11962321936Shselasky* NAME
11963321936Shselasky*	ib_cc_tbl_entry_t
11964321936Shselasky*
11965321936Shselasky* DESCRIPTION
11966321936Shselasky*	IBA defined CongestionControlTableEntry (A10.4.3.9)
11967321936Shselasky*
11968321936Shselasky* SYNOPSIS
11969321936Shselasky*/
11970321936Shselasky#include <complib/cl_packon.h>
11971321936Shselaskytypedef struct _ib_cc_tbl_entry {
11972321936Shselasky	ib_net16_t shift_multiplier;
11973321936Shselasky} PACK_SUFFIX ib_cc_tbl_entry_t;
11974321936Shselasky#include <complib/cl_packoff.h>
11975321936Shselasky/*
11976321936Shselasky* FIELDS
11977321936Shselasky*
11978321936Shselasky*	shift_multiplier
11979321936Shselasky*		bits [15..14] - CCT Shift
11980321936Shselasky*		  used when calculating the injection rate delay
11981321936Shselasky*		bits [13..0] - CCT Multiplier
11982321936Shselasky*		  used when calculating the injection rate delay
11983321936Shselasky*
11984321936Shselasky* SEE ALSO
11985321936Shselasky*	ib_cc_mad_t
11986321936Shselasky*********/
11987321936Shselasky
11988321936Shselasky/****s* IBA Base: Types/ib_cc_tbl_t
11989321936Shselasky* NAME
11990321936Shselasky*	ib_cc_tbl_t
11991321936Shselasky*
11992321936Shselasky* DESCRIPTION
11993321936Shselasky*	IBA defined CongestionControlTable attribute (A10.4.3.9)
11994321936Shselasky*
11995321936Shselasky* SYNOPSIS
11996321936Shselasky*/
11997321936Shselasky#define IB_CC_TBL_ENTRY_LIST_MAX 64
11998321936Shselasky#include <complib/cl_packon.h>
11999321936Shselaskytypedef struct _ib_cc_tbl {
12000321936Shselasky	ib_net16_t ccti_limit;
12001321936Shselasky	ib_net16_t resv;
12002321936Shselasky	ib_cc_tbl_entry_t entry_list[IB_CC_TBL_ENTRY_LIST_MAX];
12003321936Shselasky} PACK_SUFFIX ib_cc_tbl_t;
12004321936Shselasky#include <complib/cl_packoff.h>
12005321936Shselasky/*
12006321936Shselasky* FIELDS
12007321936Shselasky*
12008321936Shselasky*	ccti_limit
12009321936Shselasky*		Maximum valid CCTI for this table.
12010321936Shselasky*
12011321936Shselasky*	entry_list
12012321936Shselasky*		List of up to 64 CongestionControlTableEntries.
12013321936Shselasky*
12014321936Shselasky* SEE ALSO
12015321936Shselasky*	ib_cc_mad_t
12016321936Shselasky*********/
12017321936Shselasky
12018321936Shselasky/****s* IBA Base: Types/ib_time_stamp_t
12019321936Shselasky* NAME
12020321936Shselasky*	ib_time_stamp_t
12021321936Shselasky*
12022321936Shselasky* DESCRIPTION
12023321936Shselasky*	IBA defined TimeStamp attribute (A10.4.3.10)
12024321936Shselasky*
12025321936Shselasky* SOURCE
12026321936Shselasky*/
12027321936Shselasky#include <complib/cl_packon.h>
12028321936Shselaskytypedef struct _ib_time_stamp {
12029321936Shselasky	ib_net32_t value;
12030321936Shselasky} PACK_SUFFIX ib_time_stamp_t;
12031321936Shselasky#include <complib/cl_packoff.h>
12032321936Shselasky/*
12033321936Shselasky* FIELDS
12034321936Shselasky*
12035321936Shselasky*	value
12036321936Shselasky*		Free running clock that provides relative time info
12037321936Shselasky*		for a device. Time is kept in 1.024 usec units.
12038321936Shselasky*
12039321936Shselasky* SEE ALSO
12040321936Shselasky*	ib_cc_mad_t
12041321936Shselasky*********/
12042321936Shselasky
12043321936ShselaskyEND_C_DECLS
12044321936Shselasky#else				/* ndef __WIN__ */
12045321936Shselasky#include <iba/ib_types_extended.h>
12046321936Shselasky#endif
12047321936Shselasky#endif				/* __IB_TYPES_H__ */
12048