xref: /illumos-gate/usr/src/uts/common/sys/ib/mgt/sa_recs.h (revision 2d6eb4a5e0a47d30189497241345dc5466bb68ab)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_IB_MGT_SA_RECS_H
28 #define	_SYS_IB_MGT_SA_RECS_H
29 
30 /*
31  * This file contains the definitions of the SA-specific records in IB spec
32  * volume 1, release 1.1, chapter 15.
33  */
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 #include <sys/ib/ib_types.h>
40 #include <sys/ib/mgt/sm_attr.h>
41 
42 /* class header for SA MADs */
43 typedef struct _ib_sa_hdr_t {
44 	uint64_t	SM_KEY;
45 	uint16_t	AttributeOffset;
46 	uint16_t	Reserved;
47 	uint64_t	ComponentMask;
48 } ib_sa_hdr_t;
49 
50 /* subnet administration methods */
51 #define	SA_SUBN_ADM_GET			0x01
52 #define	SA_SUBN_ADM_GET_RESP		0x81
53 #define	SA_SUBN_ADM_SET			0x02
54 #define	SA_SUBN_ADM_REPORT		0x06
55 #define	SA_SUBN_ADM_REPORT_RESP		0x86
56 #define	SA_SUBN_ADM_GET_TABLE		0x12
57 #define	SA_SUBN_ADM_GET_TABLE_RESP	0x92
58 #define	SA_SUBN_ADM_GET_TRACE_TABLE	0x13
59 #define	SA_SUBN_ADM_GET_MULTI		0x14
60 #define	SA_SUBN_ADM_GET_MULTI_RESP	0x94
61 #define	SA_SUBN_ADM_DELETE		0x15
62 #define	SA_SUBN_ADM_DELETE_RESP		0x95
63 
64 /* sa MAD status field bit value */
65 #define	SA_STATUS_NO_ERROR				0x0000
66 #define	SA_STATUS_ERR_NO_RESOURCES			0x0100
67 #define	SA_STATUS_ERR_REQ_INVALID			0x0200
68 #define	SA_STATUS_ERR_NO_RECORDS			0x0300
69 #define	SA_STATUS_ERR_TOO_MANY_RECORDS			0x0400
70 #define	SA_STATUS_ERR_REQ_INVALID_GID			0x0500
71 #define	SA_STATUS_ERR_REQ_INSUFFICIENT_COMPONENTS	0x0600
72 #define	SA_STATUS_ERROR_MASK				0xFF00
73 
74 
75 /* SA-Specific ClassPortinfo::CapabilityMask Bits: Table 152 */
76 #define	SA_CAPMASK_OPT_RECORDS_SUPPORTED	0x100
77 #define	SA_CAPMASK_UD_MCAST_SUPPORTED		0x200
78 #define	SA_CAPMASK_MULTIPATH_SUPPORTED		0x400
79 #define	SA_CAPMASK_REINIT_SUPPORTED		0x800
80 
81 /* SA attribute IDs: Table 155 */
82 #define	SA_CLASSPORTINFO_ATTRID		0x01
83 #define	SA_NOTICE_ATTRID		0x02
84 #define	SA_INFORMINFO_ATTRID		0x03
85 #define	SA_NODERECORD_ATTRID		0x11
86 #define	SA_PORTINFORECORD_ATTRID	0x12
87 #define	SA_SLTOVLRECORD_ATTRID		0x13
88 #define	SA_SWITCHINFORECORD_ATTRID	0x14
89 #define	SA_LINEARFDBRECORD_ATTRID	0x15
90 #define	SA_RANDOMFDBRECORD_ATTRID	0x16
91 #define	SA_MULTICASTFDBRECORD_ATTRID	0x17
92 #define	SA_SMINFORECORD_ATTRID		0x18
93 #define	SA_INFORMINFORECORD_ATTRID	0xF3
94 #define	SA_LINKRECORD_ATTRID		0x20
95 #define	SA_GUIDINFORECORD_ATTRID	0x30
96 #define	SA_SERVICERECORD_ATTRID		0x31
97 #define	SA_PARTITIONRECORD_ATTRID	0x33
98 #define	SA_PATHRECORD_ATTRID		0x35
99 #define	SA_VLARBRECORD_ATTRID		0x36
100 #define	SA_MCMEMBERRECORD_ATTRID	0x38
101 #define	SA_TRACERECORD_ATTRID		0x39
102 #define	SA_MULTIPATHRECORD_ATTRID	0x3A
103 #define	SA_SERVICEASSNRECORD_ATTRID	0x3B
104 
105 /* Node Record: Table 157 */
106 typedef	struct sa_node_record_s {
107 	ib_lid_t	LID;			/* LID of a port of the node */
108 	uint16_t	Reserved;
109 	sm_nodeinfo_t	NodeInfo;		/* NodeInfo attr. contents */
110 	sm_nodedesc_t	NodeDescription;	/* NodeDesc attr. contents */
111 } sa_node_record_t;
112 
113 #define	SA_NODEINFO_COMPMASK_NODELID		0x1
114 #define	SA_NODEINFO_COMPMASK_RESERVED		0x2
115 #define	SA_NODEINFO_COMPMASK_BASEVERSION	0x4
116 #define	SA_NODEINFO_COMPMASK_CLASSVERSION	0x8
117 #define	SA_NODEINFO_COMPMASK_NODETYPE		0x10
118 #define	SA_NODEINFO_COMPMASK_NUMPORTS		0x20
119 #define	SA_NODEINFO_COMPMASK_SYSIMAGEGUID	0x40
120 #define	SA_NODEINFO_COMPMASK_NODEGUID		0x80
121 #define	SA_NODEINFO_COMPMASK_PORTGUID		0x100
122 #define	SA_NODEINFO_COMPMASK_PARTITIONCAP	0x200
123 #define	SA_NODEINFO_COMPMASK_DEVICEID		0x400
124 #define	SA_NODEINFO_COMPMASK_REVISION		0x800
125 #define	SA_NODEINFO_COMPMASK_LOCALPORTNUM	0x1000
126 #define	SA_NODEINFO_COMPMASK_VENDORID		0x2000
127 #define	SA_NODEINFO_COMPMASK_NODEDESCRIPTION	0x4000
128 
129 /* Portinfo Record: Table 158 */
130 typedef struct sa_portinfo_record_s {
131 	ib_lid_t	EndportLID;		/* LID of the port */
132 	uint8_t		PortNum;		/* port number (for switch) */
133 	uint8_t		Reserved;
134 	sm_portinfo_t	PortInfo;		/* PortInfo attr. contents */
135 } sa_portinfo_record_t;
136 
137 /* first 3 components are atomic */
138 #define	SA_PORTINFO_COMPMASK_PORTLID		0x1
139 #define	SA_PORTINFO_COMPMASK_PORTNUM		0x2
140 #define	SA_PORTINFO_COMPMASK_RESERVED		0x4
141 #define	SA_PORTINFO_COMPMASK_MKEY		0x8
142 #define	SA_PORTINFO_COMPMASK_GIDPREFIX		0x10
143 #define	SA_PORTINFO_COMPMASK_LID		0x20
144 #define	SA_PORTINFO_COMPMASK_MASTERSMLID	0x40
145 #define	SA_PORTINFO_COMPMASK_CAPMASK		0x80
146 #define	SA_PORTINFO_COMPMASK_DIAGCODE		0x100
147 #define	SA_PORTINFO_COMPMASK_MKEYLEASE		0x200
148 #define	SA_PORTINFO_COMPMASK_LOCALPORTNUM	0x400
149 #define	SA_PORTINFO_COMPMASK_LINKWIDTHEN	0x800
150 #define	SA_PORTINFO_COMPMASK_LINKWIDTHSUPP	0x1000
151 #define	SA_PORTINFO_COMPMASK_LINKWIDTHACT	0x2000
152 #define	SA_PORTINFO_COMPMASK_LINKSPEEDSUPP	0x4000
153 #define	SA_PORTINFO_COMPMASK_PORTSTATE		0x8000
154 #define	SA_PORTINFO_COMPMASK_PORTPHYSICALSTATE	0x10000
155 #define	SA_PORTINFO_COMPMASK_LINKDOWNDEFSTATE	0x20000
156 #define	SA_PORTINFO_COMPMASK_MKEYPROTBITS	0x40000
157 #define	SA_PORTINFO_COMPMASK_RESERVED2		0x80000
158 #define	SA_PORTINFO_COMPMASK_LMC		0x100000
159 #define	SA_PORTINFO_COMPMASK_LINKSPEEDACT	0x200000
160 #define	SA_PORTINFO_COMPMASK_LINKSPEEDEN	0x400000
161 #define	SA_PORTINFO_COMPMASK_NEIGHBORMTU	0x800000
162 #define	SA_PORTINFO_COMPMASK_MASTERSMSL		0x1000000
163 #define	SA_PORTINFO_COMPMASK_VLCAP		0x2000000
164 #define	SA_PORTINFO_COMPMASK_INITTYPE		0x4000000
165 #define	SA_PORTINFO_COMPMASK_VLHIGHLIMIT	0x8000000
166 #define	SA_PORTINFO_COMPMASK_VLARBHIGHCAP	0x10000000
167 #define	SA_PORTINFO_COMPMASK_VLARBLOWCAP	0x20000000
168 #define	SA_PORTINFO_COMPMASK_INITTYPEREPLY	0x40000000
169 #define	SA_PORTINFO_COMPMASK_MTUCAP		0x80000000
170 #define	SA_PORTINFO_COMPMASK_VLSTALLCOUNT	0x100000000
171 #define	SA_PORTINFO_COMPMASK_HOQLIFE		0x200000000
172 #define	SA_PORTINFO_COMPMASK_OPERATIONALVLS	0x400000000
173 #define	SA_PORTINFO_COMPMASK_PARTENFINBOUND	0x800000000
174 #define	SA_PORTINFO_COMPMASK_PARTENFOUTBOUND	0x1000000000
175 #define	SA_PORTINFO_COMPMASK_FILTERRAWPKTIN	0x2000000000
176 #define	SA_PORTINFO_COMPMASK_FILTERRAWPKTOUT	0x4000000000
177 #define	SA_PORTINFO_COMPMASK_MKEYVIOLATIONS	0x8000000000
178 #define	SA_PORTINFO_COMPMASK_PKEYVIOLATIONS	0x10000000000
179 #define	SA_PORTINFO_COMPMASK_QKEYVIOLATIONS	0x20000000000
180 #define	SA_PORTINFO_COMPMASK_GUIDCAP		0x40000000000
181 #define	SA_PORTINFO_COMPMASK_RESERVED5		0x80000000000
182 #define	SA_PORTINFO_COMPMASK_SUBNETTIMEOUT	0x100000000000
183 #define	SA_PORTINFO_COMPMASK_RESERVED6		0x200000000000
184 #define	SA_PORTINFO_COMPMASK_RESPTIMEVALUE	0x400000000000
185 #define	SA_PORTINFO_COMPMASK_LOCALPHYERRORS	0x800000000000
186 #define	SA_PORTINFO_COMPMASK_OVERRUNERRORS	0x1000000000000
187 
188 /* SLtoVL Mapping Table Record: Table 159 */
189 typedef struct sa_SLtoVLmapping_record_s {
190 	ib_lid_t			LID;
191 	uint8_t				InputPortNum;
192 	uint8_t				OutputPortNum;
193 	uint32_t			Reserved;
194 	sm_SLtoVL_mapping_table_t	SLtoVLMappingTable;
195 } sa_SLtoVLmapping_record_t;
196 
197 #define	SA_SLTOVL_COMPMASK_PORTLID		0x1
198 #define	SA_SLTOVL_COMPMASK_INPUTPORTNUM		0x2
199 #define	SA_SLTOVL_COMPMASK_OUTPUTPORTNUM	0x4
200 #define	SA_SLTOVL_COMPMASK_RESERVED		0x8
201 #define	SA_SLTOVL_COMPMASK_SL0TOVL		0x10
202 #define	SA_SLTOVL_COMPMASK_SL1TOVL		0x20
203 #define	SA_SLTOVL_COMPMASK_SL2TOVL		0x40
204 #define	SA_SLTOVL_COMPMASK_SL3TOVL		0x80
205 #define	SA_SLTOVL_COMPMASK_SL4TOVL		0x100
206 #define	SA_SLTOVL_COMPMASK_SL5TOVL		0x200
207 #define	SA_SLTOVL_COMPMASK_SL6TOVL		0x400
208 #define	SA_SLTOVL_COMPMASK_SL7TOVL		0x800
209 #define	SA_SLTOVL_COMPMASK_SL8TOVL		0x1000
210 #define	SA_SLTOVL_COMPMASK_SL9TOVL		0x2000
211 #define	SA_SLTOVL_COMPMASK_SL10TOVL		0x4000
212 #define	SA_SLTOVL_COMPMASK_SL11TOVL		0x8000
213 #define	SA_SLTOVL_COMPMASK_SL12TOVL		0x10000
214 #define	SA_SLTOVL_COMPMASK_SL13TOVL		0x20000
215 #define	SA_SLTOVL_COMPMASK_SL14TOVL		0x40000
216 #define	SA_SLTOVL_COMPMASK_SL15TOVL		0x80000
217 
218 /* Switchinfo Record: Table 160 */
219 typedef struct sa_switchinfo_record_s {
220 	ib_lid_t	LID;			/* LID of switch port 0 */
221 	uint16_t	Reserved;
222 	sm_switchinfo_t	SwitchInfo;		/* SwitchInfo attr. contents */
223 } sa_switchinfo_record_t;
224 
225 #define	SA_SWITCHINFO_COMPMASK_SWITCHLID		0x1
226 #define	SA_SWITCHINFO_COMPMASK_RESERVED			0x2
227 #define	SA_SWITCHINFO_COMPMASK_LINEARFDBCAP		0x4
228 #define	SA_SWITCHINFO_COMPMASK_RANDOMFDBCAP		0x8
229 #define	SA_SWITCHINFO_COMPMASK_MCASTFDBCAP		0x10
230 #define	SA_SWITCHINFO_COMPMASK_LINEARFDBTOP		0x20
231 #define	SA_SWITCHINFO_COMPMASK_DEFAULTPORT		0x40
232 #define	SA_SWITCHINFO_COMPMASK_DEFAULTMCASTPPORT	0x80
233 #define	SA_SWITCHINFO_COMPMASK_DEFAULTMCASTNPPORT 	0x100
234 #define	SA_SWITCHINFO_COMPMASK_LIFETIMEVALUE		0x200
235 #define	SA_SWITCHINFO_COMPMASK_PORTSTATECHANGE		0x400
236 #define	SA_SWITCHINFO_COMPMASK_RESERVED2		0x800
237 #define	SA_SWITCHINFO_COMPMASK_LIDSPERPORT		0x1000
238 #define	SA_SWITCHINFO_COMPMASK_PARTENFCAP		0x2000
239 #define	SA_SWITCHINFO_COMPMASK_INBOUNDENFCAP		0x4000
240 #define	SA_SWITCHINFO_COMPMASK_OUTBOUNDENFCAP		0x8000
241 #define	SA_SWITCHINFO_COMPMASK_FILTERRAWPKTINCAP	0x10000
242 #define	SA_SWITCHINFO_COMPMASK_FILTERRAWPKTOUTCAP	0x20000
243 #define	SA_SWITCHINFO_COMPMASK_ENHANCED_PORT_0		0x40000
244 
245 /* Linear Forwarding Table Record: Table 161 */
246 typedef struct sa_linearft_record_s {
247 	ib_lid_t	LID;
248 	uint16_t	BlockNum;
249 	uint32_t	Reserved;
250 	sm_linear_forwarding_table_t	LinearFT;
251 } sa_linearft_record_t;
252 
253 #define	SA_LFT_COMPMASK_LFTLID			0x1
254 #define	SA_LFT_COMPMASK_BLOCKNUM		0x2
255 #define	SA_LFT_COMPMASK_RESERVED		0x4
256 #define	SA_LFT_COMPMASK_LINEARFORWARDINGTABLE	0x8
257 
258 /* Random Forwarding Table Record: Table 162 */
259 typedef struct sa_randomft_record_s {
260 	ib_lid_t	LID;
261 	uint16_t	BlockNum;
262 	uint32_t	Reserved;
263 	sm_random_forwarding_table_t	RandomFT;
264 } sa_randomft_record_t;
265 
266 #define	SA_RFT_COMPMASK_RFTLID			0x1
267 #define	SA_RFT_COMPMASK_BLOCKNUM		0x2
268 #define	SA_RFT_COMPMASK_RESERVED		0x4
269 #define	SA_RFT_COMPMASK_RANDOMFORWARDINGTABLE	0x8
270 
271 /* Multicast Forwarding Table Record: Table 163 */
272 
273 #if defined(_BIT_FIELDS_HTOL)
274 typedef struct sa_multicastft_record_s {
275 	ib_lid_t	LID;
276 	uint16_t	Position	:4;	/* position field of attr */
277 	uint16_t	Reserved	:3;
278 	uint16_t	BlockNum	:9;
279 	uint32_t	Reserved2;
280 	sm_multicast_forwarding_table_t	MulticastFT;
281 } sa_multicastft_record_t;
282 
283 #elif defined(_BIT_FIELDS_LTOH)
284 
285 typedef struct sa_multicastft_record_s {
286 	ib_lid_t	LID;
287 	uint16_t	BlockNum	:9;
288 	uint16_t	Reserved	:3;
289 	uint16_t	Position	:4;	/* position field of attr */
290 	uint32_t	Reserved2;
291 	sm_multicast_forwarding_table_t	MulticastFT;
292 } sa_multicastft_record_t;
293 
294 #else
295 #error	One of _BIT_FIELDS_HTOL or _BIT_FIELDS_HTOL must be defined
296 #endif /* _BIT_FIELDS_HTOL */
297 
298 #define	SA_MFT_COMPMASK_MFTLID				0x1
299 #define	SA_MFT_COMPMASK_POSITION			0x2
300 #define	SA_MFT_COMPMASK_RESERVED			0x4
301 #define	SA_MFT_COMPMASK_BLOCKNUM			0x8
302 #define	SA_MFT_COMPMASK_RESERVED2			0x10
303 #define	SA_MFT_COMPMASK_MULTICASTFORWARDINGTABLE	0x20
304 
305 /* VLArbitration Table Record: Table 164 */
306 typedef struct sa_VLarb_table_record_s {
307 	ib_lid_t	LID;
308 	uint8_t		OutputPortNum;
309 	uint8_t		BlockNum;
310 	uint32_t	Reserved;
311 	sm_VLarb_table_t VLArbTable;
312 } sa_VLarb_table_record_t;
313 
314 #define	SA_VLARB_COMPMASK_NODELID		0x1
315 #define	SA_VLARB_COMPMASK_OUTPUTPORTNUM		0x2
316 #define	SA_VLARB_COMPMASK_BLOCKNUM		0x4
317 #define	SA_VLARB_COMPMASK_RESERVED		0x8
318 #define	SA_VLARB_COMPMASK_VLARBTABLE		0x10
319 
320 /* SMInfo Record: Table 165 */
321 typedef struct _sminfo_record_s {
322 	ib_lid_t	LID;
323 	uint16_t	Reserved;
324 	sm_sminfo_t	SMInfo;
325 } sa_sminfo_record_t;
326 
327 #define	SA_SMINFO_COMPMASK_NODELID		0x1
328 #define	SA_SMINFO_COMPMASK_RESERVED		0x2
329 #define	SA_SMINFO_COMPMASK_GUID			0x4
330 #define	SA_SMINFO_COMPMASK_SMKEY		0x8
331 #define	SA_SMINFO_COMPMASK_ACTCOUNT		0x10
332 #define	SA_SMINFO_COMPMASK_PRIORITY		0x20
333 #define	SA_SMINFO_COMPMASK_SMSTATE		0x40
334 
335 /* P_Key Table Record: Table 166 */
336 typedef struct sa_pkey_table_record_s {
337 	ib_lid_t	LID;
338 	uint16_t 	BlockNum;
339 	uint8_t		PortNum;
340 	uint8_t		Reserved[3];
341 	sm_pkey_table_t	P_KeyTable;
342 } sa_pkey_table_record_t;
343 
344 #define	SA_PKEY_COMPMASK_PORTLID		0x1
345 #define	SA_PKEY_COMPMASK_BLOCKNUM		0x2
346 #define	SA_PKEY_COMPMASK_PORTNUM 		0x4
347 #define	SA_PKEY_COMPMASK_RESERVED		0x8
348 #define	SA_PKEY_COMPMASK_PKEYTABLE		0x10
349 
350 /* InformInfo Record: Table 167 */
351 typedef struct sa_informinfo_record_s {
352 	ib_gid_t		SubscriberGID;
353 	uint16_t		Enum;
354 	uint8_t			Reserved[6];
355 	ib_mad_informinfo_t	InformInfo;
356 } sa_informinfo_record_t;
357 
358 #define	SA_INFORMINFO_COMPMASK_SUBGID		0x1
359 #define	SA_INFORMINFO_COMPMASK_ENUM		0x2
360 #define	SA_INFORMINFO_COMPMASK_RESERVED		0x4
361 #define	SA_INFORMINFO_COMPMASK_GID		0x8
362 #define	SA_INFORMINFO_COMPMASK_LIDRANGEBEGIN	0x10
363 #define	SA_INFORMINFO_COMPMASK_LIDRANGEEND	0x20
364 #define	SA_INFORMINFO_COMPMASK_RESERVED2	0x40
365 #define	SA_INFORMINFO_COMPMASK_ISGENERIC	0x80
366 #define	SA_INFORMINFO_COMPMASK_SUBSCRIBE	0x100
367 #define	SA_INFORMINFO_COMPMASK_TYPE		0x200
368 #define	SA_INFORMINFO_COMPMASK_TRAPNUM_DEVID	0x400
369 #define	SA_INFORMINFO_COMPMASK_QPN		0x800
370 #define	SA_INFORMINFO_COMPMASK_RESERVED3	0x1000
371 #define	SA_INFORMINFO_COMPMASK_RESPTIMEVALUE	0x2000
372 #define	SA_INFORMINFO_COMPMASK_RESERVED4	0x4000
373 #define	SA_INFORMINFO_COMPMASK_PRODTYPE_VENDID	0x8000
374 
375 /* Link Record: Table 168 */
376 typedef struct sa_link_record_s {
377 	ib_lid_t	FromLID;
378 	uint8_t		FromPort;
379 	uint8_t		ToPort;
380 	ib_lid_t	ToLID;
381 } sa_link_record_t;
382 
383 #define	SA_LINKRECORD_COMPMASK_FROMLID		0x1
384 #define	SA_LINKRECORD_COMPMASK_FROMPORT		0x2
385 #define	SA_LINKRECORD_COMPMASK_TOPORT		0x4
386 #define	SA_LINKRECORD_COMPMASK_TOLID		0x8
387 
388 /* Service Record: Table 169 */
389 typedef struct sa_service_record_s {
390 	uint64_t	ServiceID;		/* id of service on port */
391 	ib_gid_t	ServiceGID;		/* port GID for this service */
392 	uint16_t	ServiceP_Key;		/* p_key used to contact serv */
393 	uint16_t	Reserved;
394 	uint32_t	ServiceLease;		/* lease period remaining */
395 	uint64_t	ServiceKey_hi;		/* key value assoc. with serv */
396 	uint64_t	ServiceKey_lo;
397 	uint8_t		ServiceName[IB_SVC_NAME_LEN];
398 						/* UTF-8 encoded service name */
399 	uint8_t		ServiceData[IB_SVC_DATA_LEN];
400 						/* data for this service rec. */
401 } sa_service_record_t;
402 
403 #define	SA_SR_INDEFINITE_SERVICE_LEASE	0xFFFFFFFF
404 
405 /*
406  * #defines mapping individual bits of the service record component mask
407  * to components in the service record.  ServiceData uses one component mask per
408  * bit.  See the IB spec for details.
409  */
410 #define	SA_SR_COMPMASK_ID		0x1
411 #define	SA_SR_COMPMASK_GID		0x2
412 #define	SA_SR_COMPMASK_PKEY		0x4
413 #define	SA_SR_COMPMASK_RESERVED		0x8
414 #define	SA_SR_COMPMASK_LEASE		0x10
415 #define	SA_SR_COMPMASK_KEY		0x20
416 #define	SA_SR_COMPMASK_NAME		0x40
417 
418 /* masks all ServiceData fields */
419 #define	SA_SR_COMPMASK_ALL_DATA		0x1FFFFFFF80
420 
421 /* Service Association Record: Table 170 */
422 typedef struct sa_service_assn_record_s {
423 	uint64_t	ServiceKey_hi;
424 	uint64_t	ServiceKey_lo;
425 	uint8_t		ServiceName[IB_SVC_NAME_LEN];
426 } sa_service_assn_record_t;
427 
428 #define	SA_SERVASSOC_COMPMASK_SERVICEKEY		0x1
429 #define	SA_SERVASSOC_COMPMASK_SERVICENAME	0x2
430 
431 /* Path Record: Table 171 */
432 
433 #if defined(_BIT_FIELDS_HTOL)
434 typedef struct sa_path_record_s {
435 	uint32_t	Reserved;
436 	uint32_t	Reserved2;
437 	ib_gid_t	DGID;			/* dest gid of path */
438 	ib_gid_t	SGID;			/* source gid of path */
439 	uint16_t	DLID;			/* dest lid */
440 	uint16_t	SLID;			/* source lid */
441 	uint32_t	RawTraffic	:1;	/* raw pkt path */
442 	uint32_t	Reserved3	:3;
443 	uint32_t	FlowLabel	:20;	/* flow label */
444 	uint32_t	HopLimit	:8;	/* hop limit */
445 	uint8_t		TClass;			/* TClass */
446 	uint8_t		Reversible	:1;	/* reversible path required */
447 	uint8_t		NumbPath	:7;	/* max num. of paths to ret. */
448 	uint16_t	P_Key;			/* partition key for path */
449 	uint16_t	Reserved4	:12;
450 	uint16_t	SL		:4;	/* service level for path */
451 	uint8_t		MtuSelector	:2;	/* MTU selector */
452 	uint8_t		Mtu		:6;	/* required MTU */
453 	uint8_t		RateSelector	:2;	/* rate selector */
454 	uint8_t		Rate		:6;	/* value of rate */
455 	uint8_t		PacketLifeTimeSelector:2; /* pkt life time selector */
456 	uint8_t		PacketLifeTime	:6;	/* total packet life time */
457 	uint8_t		Preference;		/* in response, order of pref */
458 						/* among all paths */
459 	uint8_t		Reserved5[6];
460 } sa_path_record_t;
461 
462 #elif defined(_BIT_FIELDS_LTOH)
463 
464 typedef struct sa_path_record_s {
465 	uint32_t	Reserved;
466 	uint32_t	Reserved2;
467 	ib_gid_t	DGID;			/* dest gid of path */
468 	ib_gid_t	SGID;			/* source gid of path */
469 	uint16_t	DLID;			/* dest lid */
470 	uint16_t	SLID;			/* source lid */
471 	uint32_t	HopLimit	:8;	/* hop limit */
472 	uint32_t	FlowLabel	:20;	/* flow label */
473 	uint32_t	Reserved3	:3;
474 	uint32_t	RawTraffic	:1;	/* raw pkt path */
475 	uint8_t		TClass;			/* TClass */
476 	uint8_t		NumbPath	:7;	/* max num. of paths to ret. */
477 	uint8_t		Reversible	:1;	/* reversible path required */
478 	uint16_t	P_Key;			/* partition key for path */
479 	uint16_t	SL		:4;	/* service level for path */
480 	uint16_t	Reserved4	:12;
481 	uint8_t		Mtu		:6;	/* required MTU */
482 	uint8_t		MtuSelector	:2;	/* MTU selector */
483 	uint8_t		Rate		:6;	/* value of rate */
484 	uint8_t		RateSelector	:2;	/* rate selector */
485 	uint8_t		PacketLifeTime	:6;	/* total packet life time */
486 	uint8_t		PacketLifeTimeSelector:2; /* pkt life time selector */
487 	uint8_t		Preference;		/* in response, order of pref */
488 						/* among all paths */
489 	uint8_t		Reserved5[6];
490 } sa_path_record_t;
491 
492 #else
493 #error	One of _BIT_FIELDS_HTOL or _BIT_FIELDS_HTOL must be defined
494 #endif /* _BIT_FIELDS_HTOL */
495 
496 /*
497  * #defines mapping individual bits of the path record component mask
498  * to components in the path record
499  */
500 #define	SA_PR_COMPMASK_RESERVED		0x1
501 #define	SA_PR_COMPMASK_RESERVED2	0x2
502 #define	SA_PR_COMPMASK_DGID		0x4
503 #define	SA_PR_COMPMASK_SGID		0x8
504 #define	SA_PR_COMPMASK_DLID		0x10
505 #define	SA_PR_COMPMASK_SLID		0x20
506 #define	SA_PR_COMPMASK_RAWTRAFFIC	0x40
507 #define	SA_PR_COMPMASK_RESERVED3	0x80
508 #define	SA_PR_COMPMASK_FLOWLABEL	0x100
509 #define	SA_PR_COMPMASK_HOPLIMIT		0x200
510 #define	SA_PR_COMPMASK_TCLASS		0x400
511 #define	SA_PR_COMPMASK_REVERSIBLE	0x800
512 #define	SA_PR_COMPMASK_NUMBPATH		0x1000
513 #define	SA_PR_COMPMASK_PKEY		0x2000
514 #define	SA_PR_COMPMASK_RESERVED4	0x4000
515 #define	SA_PR_COMPMASK_SL		0x8000
516 #define	SA_PR_COMPMASK_MTUSELECTOR	0x10000
517 #define	SA_PR_COMPMASK_MTU		0x20000
518 #define	SA_PR_COMPMASK_RATESELECTOR	0x40000
519 #define	SA_PR_COMPMASK_RATE		0x80000
520 #define	SA_PR_COMPMASK_PKTLTSELECTOR	0x100000
521 #define	SA_PR_COMPMASK_PKTLT		0x200000
522 #define	SA_PR_COMPMASK_PREFERENCE	0x400000
523 
524 #define	SA_PR_RAWTRAFFIC_PKEY		0x1
525 #define	SA_PR_RAWTRAFFIC_NO_PKEY 	0x0
526 #define	SA_PR_MTU_SEL_GREATER		0x0
527 #define	SA_PR_MTU_SEL_LESS		0x1
528 #define	SA_PR_MTU_SEL_EXACTLY		0x2
529 #define	SA_PR_MTU_SEL_LARGEST_AVAIL	0x3
530 #define	SA_PR_MTU_256			0x1
531 #define	SA_PR_MTU_512			0x2
532 #define	SA_PR_MTU_1024			0x3
533 #define	SA_PR_MTU_2048			0x4
534 #define	SA_PR_MTU_4096			0x5
535 #define	SA_PR_RATE_SEL_GREATER		0x0
536 #define	SA_PR_RATE_SEL_LESS		0x1
537 #define	SA_PR_RATE_SEL_EXACTLY		0x2
538 #define	SA_PR_RATE_SEL_LARGEST_AVAIL	0x3
539 #define	SA_PR_RATE_25			0x2
540 #define	SA_PR_RATE_10			0x3
541 #define	SA_PR_RATE_30			0x4
542 #define	SA_PR_LT_SEL_GREATER		0x0
543 #define	SA_PR_LT_SEL_LESS		0x1
544 #define	SA_PR_LT_SEL_EXACTLY		0x2
545 #define	SA_PR_LT_SEL_SMALLEST_AVAIL	0x3
546 
547 /* MCMember Record: Table 176 */
548 
549 #if defined(_BIT_FIELDS_HTOL)
550 typedef struct sa_mcmember_record_s {
551 	ib_gid_t	MGID;
552 	ib_gid_t	PortGID;
553 	uint32_t	Q_Key;
554 	ib_lid_t	MLID;
555 	uint8_t		MTUSelector		:2;
556 	uint8_t		MTU			:6;
557 	uint8_t		TClass;
558 	uint16_t	P_Key;
559 	uint8_t		RateSelector		:2;
560 	uint8_t		Rate			:6;
561 	uint8_t		PacketLifeTimeSelector	:2;
562 	uint8_t		PacketLifeTime		:6;
563 	uint32_t	SL			:4;
564 	uint32_t	FlowLabel		:20;
565 	uint32_t	HopLimit		:8;
566 	uint32_t	Scope			:4;
567 	uint32_t	JoinState		:4;
568 	uint32_t	ProxyJoin		:1;
569 	uint32_t	Reserved		:23;
570 } sa_mcmember_record_t;
571 
572 #elif defined(_BIT_FIELDS_LTOH)
573 
574 typedef struct sa_mcmember_record_s {
575 	ib_gid_t	MGID;
576 	ib_gid_t	PortGID;
577 	uint32_t	Q_Key;
578 	ib_lid_t	MLID;
579 	uint8_t		MTU			:6;
580 	uint8_t		MTUSelector		:2;
581 	uint8_t		TClass;
582 	uint16_t	P_Key;
583 	uint8_t		Rate			:6;
584 	uint8_t		RateSelector		:2;
585 	uint8_t		PacketLifeTime		:6;
586 	uint8_t		PacketLifeTimeSelector	:2;
587 	uint32_t	HopLimit		:8;
588 	uint32_t	FlowLabel		:20;
589 	uint32_t	SL			:4;
590 	uint32_t	Reserved		:23;
591 	uint32_t	ProxyJoin		:1;
592 	uint32_t	JoinState		:4;
593 	uint32_t	Scope			:4;
594 } sa_mcmember_record_t;
595 
596 #else
597 #error	One of _BIT_FIELDS_HTOL or _BIT_FIELDS_HTOL must be defined
598 #endif /* _BIT_FIELDS_HTOL */
599 
600 #define	SA_MC_COMPMASK_MGID		0x1
601 #define	SA_MC_COMPMASK_PORTGID		0x2
602 #define	SA_MC_COMPMASK_QKEY		0x4
603 #define	SA_MC_COMPMASK_MLID		0x8
604 #define	SA_MC_COMPMASK_MTUSELECTOR	0x10
605 #define	SA_MC_COMPMASK_MTU		0x20
606 #define	SA_MC_COMPMASK_TCLASS		0x40
607 #define	SA_MC_COMPMASK_PKEY		0x80
608 #define	SA_MC_COMPMASK_RATESELECTOR	0x100
609 #define	SA_MC_COMPMASK_RATE		0x200
610 #define	SA_MC_COMPMASK_PKTLTSELECTOR	0x400
611 #define	SA_MC_COMPMASK_PKTLT		0x800
612 #define	SA_MC_COMPMASK_SL		0x1000
613 #define	SA_MC_COMPMASK_FLOWLABEL	0x2000
614 #define	SA_MC_COMPMASK_HOPLIMIT		0x4000
615 #define	SA_MC_COMPMASK_SCOPE		0x8000
616 #define	SA_MC_COMPMASK_JOINSTATE	0x10000
617 #define	SA_MC_COMPMASK_PROXYJOIN	0x20000
618 #define	SA_MC_COMPMASK_RESERVED		0x40000
619 
620 #define	SA_MC_MTU_SEL_GREATER		0x0
621 #define	SA_MC_MTU_SEL_LESS		0x1
622 #define	SA_MC_MTU_SEL_EXACTLY		0x2
623 #define	SA_MC_MTU_SEL_LARGEST_AVAIL	0x3
624 #define	SA_MC_MTU_256			0x1
625 #define	SA_MC_MTU_512			0x2
626 #define	SA_MC_MTU_1024			0x3
627 #define	SA_MC_MTU_2048			0x4
628 #define	SA_MC_MTU_4096			0x5
629 #define	SA_MC_RATE_SEL_GREATER		0x0
630 #define	SA_MC_RATE_SEL_LESS		0x1
631 #define	SA_MC_RATE_SEL_EXACTLY		0x2
632 #define	SA_MC_RATE_SEL_LARGEST_AVAIL	0x3
633 #define	SA_MC_RATE_25			0x2
634 #define	SA_MC_RATE_10			0x3
635 #define	SA_MC_RATE_30			0x4
636 #define	SA_MC_LT_SEL_GREATER		0x0
637 #define	SA_MC_LT_SEL_LESS		0x1
638 #define	SA_MC_LT_SEL_EXACTLY		0x2
639 #define	SA_MC_LT_SMALLEST_AVAIL		0x3
640 
641 /* GUIDInfo Record: Table 177 */
642 typedef struct sa_guidinfo_record_s {
643 	ib_lid_t	LID;
644 	uint8_t		BlockNum;
645 	uint8_t		Reserved;
646 	uint32_t	Reserved2;
647 	sm_guidinfo_t	GUIDInfo;
648 } sa_guidinfo_record_t;
649 
650 #define	SA_GUIDINFO_COMPMASK_PORTLID	0x1
651 #define	SA_GUIDINFO_COMPMASK_BLOCKNUM	0x2
652 #define	SA_GUIDINFO_COMPMASK_RESERVED	0x4
653 #define	SA_GUIDINFO_COMPMASK_RESERVEVD2	0x8
654 #define	SA_GUIDINFO_COMPMASK_GUIDINFO	0x10
655 
656 /* Trace Record: Table 178 */
657 typedef struct sa_trace_record_s {
658 	ib_sn_prefix_t	GIDPrefix;
659 	uint16_t	IOCGeneration;
660 	uint8_t		Reserved;
661 	uint8_t		NodeType;
662 	uint64_t	NodeID;
663 	uint64_t	ChassisID;
664 	uint64_t	EntryPortID;
665 	uint64_t	ExitPortID;
666 	uint8_t		EntryPort;
667 	uint8_t		ExitPort;
668 } sa_trace_record_t;
669 
670 #define	SA_TRACE_COMPMASK_GIDPREFIX	0x1
671 #define	SA_TRACE_COMPMASK_IOCGENERATION	0x2
672 #define	SA_TRACE_COMPMASK_RESERVED	0x4
673 #define	SA_TRACE_COMPMASK_NODETYPE	0x8
674 #define	SA_TRACE_COMPMASK_NODEID	0x10
675 #define	SA_TRACE_COMPMASK_CHASSISID	0x20
676 #define	SA_TRACE_COMPMASK_ENTRYPORTID	0x40
677 #define	SA_TRACE_COMPMASK_EXITPORTID	0x80
678 #define	SA_TRACE_COMPMASK_ENTRYPORT	0x100
679 #define	SA_TRACE_COMPMASK_EXITPORT	0x200
680 
681 /*
682  * MultiPath Record: Table 179
683  * This structure only includes the constant portion of the multipath record.
684  * The multipath record request will contain a variable number of SGIDs and
685  * DGIDs at the end of this structure, as specified in the SGIDCount and
686  * DGIDCount fields.
687  */
688 
689 #if defined(_BIT_FIELDS_HTOL)
690 typedef struct sa_mutipath_record_s {
691 	uint32_t	RawTraffic	:1;	/* raw pkt path */
692 	uint32_t	Reserved	:3;
693 	uint32_t	FlowLabel	:20;	/* flow label */
694 	uint32_t	HopLimit	:8;	/* hop limit */
695 	uint8_t		TClass;			/* TClass */
696 	uint8_t		Reversible	:1;	/* reversible path required */
697 	uint8_t		NumbPath	:7;	/* max num. of paths to ret. */
698 	uint16_t	P_Key;			/* partition key for path */
699 	uint16_t	Reserved2	:12;
700 	uint16_t	SL		:4;	/* service level for path */
701 	uint8_t		MtuSelector	:2;	/* MTU selector */
702 	uint8_t		Mtu		:6;	/* required MTU */
703 	uint8_t		RateSelector	:2;	/* rate selector */
704 	uint8_t		Rate		:6;	/* value of rate */
705 	uint8_t		PacketLifeTimeSelector:2; /* pkt life time selector */
706 	uint8_t		PacketLifeTime	:6;	/* total packet life time */
707 	uint8_t		Reserved3;
708 	uint8_t		IndependenceSelector:2;	/* fault-tolerant paths */
709 	uint8_t		Reserved4	:6;
710 	uint8_t		SGIDCount;		/* number of SGIDS */
711 	uint8_t		DGIDCount;		/* number of DGIDS */
712 	uint8_t		Reserved5[7];
713 } sa_multipath_record_t;
714 
715 #elif defined(_BIT_FIELDS_LTOH)
716 
717 typedef struct sa_mutipath_record_s {
718 	uint32_t	HopLimit	:8;	/* hop limit */
719 	uint32_t	FlowLabel	:20;	/* flow label */
720 	uint32_t	Reserved	:3;
721 	uint32_t	RawTraffic	:1;	/* raw pkt path */
722 	uint8_t		TClass;			/* TClass */
723 	uint8_t		NumbPath	:7;	/* max num. of paths to ret. */
724 	uint8_t		Reversible	:1;	/* reversible path required */
725 	uint16_t	P_Key;			/* partition key for path */
726 	uint16_t	SL		:4;	/* service level for path */
727 	uint16_t	Reserved2	:12;
728 	uint8_t		Mtu		:6;	/* required MTU */
729 	uint8_t		MtuSelector	:2;	/* MTU selector */
730 	uint8_t		Rate		:6;	/* value of rate */
731 	uint8_t		RateSelector	:2;	/* rate selector */
732 	uint8_t		PacketLifeTime	:6;	/* total packet life time */
733 	uint8_t		PacketLifeTimeSelector:2; /* pkt life time selector */
734 	uint8_t		Reserved3;
735 	uint8_t		Reserved4	:6;
736 	uint8_t		IndependenceSelector:2;	/* fault-tolerant paths */
737 	uint8_t		SGIDCount;		/* number of SGIDS */
738 	uint8_t		DGIDCount;		/* number of DGIDS */
739 	uint8_t		Reserved5[7];
740 } sa_multipath_record_t;
741 
742 #else
743 #error	One of _BIT_FIELDS_HTOL or _BIT_FIELDS_HTOL must be defined
744 #endif /* _BIT_FIELDS_HTOL */
745 
746 #define	SA_MPR_COMPMASK_RAWTRAFFIC	0x1
747 #define	SA_MPR_COMPMASK_RESERVED	0x2
748 #define	SA_MPR_COMPMASK_FLOWLABEL	0x4
749 #define	SA_MPR_COMPMASK_HOPLIMIT	0x8
750 #define	SA_MPR_COMPMASK_TCLASS		0x10
751 #define	SA_MPR_COMPMASK_REVERSIBLE	0x20
752 #define	SA_MPR_COMPMASK_NUMBPATH	0x40
753 #define	SA_MPR_COMPMASK_PKEY		0x80
754 #define	SA_MPR_COMPMASK_RESERVED2	0x100
755 #define	SA_MPR_COMPMASK_SL		0x200
756 #define	SA_MPR_COMPMASK_MTUSELECTOR	0x400
757 #define	SA_MPR_COMPMASK_MTU		0x800
758 #define	SA_MPR_COMPMASK_RATESELECTOR	0x1000
759 #define	SA_MPR_COMPMASK_RATE		0x2000
760 #define	SA_MPR_COMPMASK_PKTLTSELECTOR	0x4000
761 #define	SA_MPR_COMPMASK_PKTLT		0x8000
762 #define	SA_MPR_COMPMASK_RESERVED3	0x10000
763 #define	SA_MPR_COMPMASK_INDEPSEL	0x20000
764 #define	SA_MPR_COMPMASK_RESERVED4	0x40000
765 #define	SA_MPR_COMPMASK_SGIDCOUNT	0x80000
766 #define	SA_MPR_COMPMASK_DGIDCOUNT	0x100000
767 #define	SA_MPR_COMPMASK_RESERVED5	0x200000
768 
769 #ifdef __cplusplus
770 }
771 #endif
772 
773 #endif	/* _SYS_IB_MGT_SA_RECS_H */
774