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