xref: /illumos-gate/usr/src/uts/common/sys/ib/mgt/ib_mad.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_IB_MAD_H
28 #define	_SYS_IB_MGT_IB_MAD_H
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #include <sys/ib/ib_types.h>
35 
36 #define	MAD_SIZE_IN_BYTES 256
37 
38 typedef struct _ib_mad_hdr_t {
39 	uint8_t		BaseVersion;		/* version of MAD base format */
40 	uint8_t		MgmtClass;		/* class of operation */
41 	uint8_t		ClassVersion;		/* ver. of MAD class format */
42 	uint8_t		R_Method;		/* response bit & method to   */
43 						/* perform based on mgmtclass */
44 	uint16_t	Status;			/* status of operation */
45 	uint16_t	ClassSpecific;		/* reserved except for SMPs   */
46 	uint64_t	TransactionID;		/* transaction id */
47 	uint16_t	AttributeID;		/* defines class spec objects */
48 	uint16_t	Reserved;
49 	uint32_t	AttributeModifier;	/* further scope to attrs. */
50 } ib_mad_hdr_t;
51 
52 #define	MAD_CLASS_BASE_VERS_1	1
53 
54 /* Defines and Masks that go with MAD header */
55 #define	MAD_MGMT_CLASS_SUBN_LID_ROUTED		0x01
56 #define	MAD_MGMT_CLASS_SUBN_DIRECT_ROUTE	0x81
57 #define	MAD_MGMT_CLASS_SUBN_ADM			0x03
58 #define	MAD_MGMT_CLASS_PERF			0x04
59 #define	MAD_MGMT_CLASS_BM			0x05
60 #define	MAD_MGMT_CLASS_DEV_MGT			0x06
61 #define	MAD_MGMT_CLASS_COMM_MGT			0x07
62 #define	MAD_MGMT_CLASS_SNMP			0x08
63 #define	MAD_MGMT_CLASS_VENDOR_START		0x09
64 #define	MAD_MGMT_CLASS_VENDOR_END		0x0F
65 #define	MAD_MGMT_CLASS_VENDOR2_START		0x30
66 #define	MAD_MGMT_CLASS_VENDOR2_END		0x4F
67 #define	MAD_MGMT_CLASS_APPLICATION_START	0x10
68 #define	MAD_MGMT_CLASS_APPLICATION_END		0x2F
69 #define	MAD_RESPONSE_BIT			0x80
70 #define	MAD_RESPONSE_BIT_MASK			0x80
71 #define	MAD_METHOD_MASK				0x7F
72 #define	MAD_METHOD_GET				0x01
73 #define	MAD_METHOD_SET				0x02
74 #define	MAD_METHOD_GET_RESPONSE			0x81
75 #define	MAD_METHOD_SEND				0x03
76 #define	MAD_METHOD_TRAP				0x05
77 #define	MAD_METHOD_REPORT			0x06
78 #define	MAD_METHOD_REPORT_RESPONSE		0x86
79 #define	MAD_METHOD_TRAP_REPRESS			0x07
80 #define	MAD_STATUS_BUSY				0x01
81 #define	MAD_STATUS_REDIRECT_REQUIRED		0x02
82 #define	MAD_STATUS_NO_INVALID_FIELDS		0x00
83 #define	MAD_STATUS_BAD_VERSION			0x04
84 #define	MAD_STATUS_UNSUPP_METHOD		0x08
85 #define	MAD_STATUS_UNSUPP_METHOD_ATTR		0x0C
86 #define	MAD_STATUS_INVALID_FIELD		0x1C
87 #define	MAD_ATTR_ID_CLASSPORTINFO		0x01
88 #define	MAD_ATTR_ID_NOTICE			0x02
89 #define	MAD_ATTR_ID_INFORMINFO			0x03
90 
91 /* ClassPortInfo: table 104 */
92 #if defined(_BIT_FIELDS_HTOL)
93 typedef struct ib_mad_classportinfo_s {
94 	uint8_t		BaseVersion;		/* ver. of MAD base format */
95 	uint8_t		ClassVersion;		/* ver. of MAD class format */
96 	uint16_t	CapabilityMask;		/* capabilities of this class */
97 	uint32_t	RespTimeValue;		/* max time btwn req and resp */
98 						/* (lower 5 bit field, upper */
99 						/* 27 bits are reserved) */
100 	uint64_t	RedirectGID_hi;		/* dest gid of redirect msgs */
101 	uint64_t	RedirectGID_lo;		/* dest gid of redirect msgs */
102 	uint32_t	RedirectTC	:8;	/* traffic class */
103 	uint32_t	RedirectSL	:4;	/* SL to access services */
104 	uint32_t	RedirectFL	:20;	/* flow label to use */
105 	ib_lid_t	RedirectLID;		/* dlid for class services */
106 	ib_pkey_t	RedirectP_Key;		/* p_key for class services */
107 	uint32_t	Reserved2	:8;
108 	uint32_t	RedirectQP	:24;	/* QP for class services */
109 	ib_qkey_t	RedirectQ_Key;		/* q_key for class services */
110 	uint64_t	TrapGID_hi;		/* dest gid of trap msgs */
111 	uint64_t	TrapGID_lo;		/* dest gid of trap msgs */
112 	uint32_t	TrapTC		:8;	/* traffic class for traps */
113 	uint32_t	TrapSL		:4;	/* SL for traps */
114 	uint32_t	TrapFL		:20;	/* flow label for traps */
115 	ib_lid_t	TrapLID;		/* dlid for traps */
116 	ib_pkey_t	TrapP_Key;		/* p_key for traps */
117 	uint32_t	TrapHL		:8;	/* hop limit for traps */
118 	uint32_t	TrapQP		:24;	/* QP for traps */
119 	ib_qkey_t	TrapQ_Key;		/* q_key for traps */
120 } ib_mad_classportinfo_t;
121 
122 #elif defined(_BIT_FIELDS_LTOH)
123 
124 typedef struct ib_mad_classportinfo_s {
125 	uint8_t		BaseVersion;		/* ver. of MAD base format */
126 	uint8_t		ClassVersion;		/* ver. of MAD class format */
127 	uint16_t	CapabilityMask;		/* capabilities of this class */
128 	uint32_t	RespTimeValue;		/* max time btwn req and resp */
129 						/* (lower 5 bit field, upper */
130 						/* 27 bits are reserved) */
131 	uint64_t	RedirectGID_hi;		/* dest gid of redirect msgs */
132 	uint64_t	RedirectGID_lo;		/* dest gid of redirect msgs */
133 	uint32_t	RedirectFL	:20;	/* flow label to use */
134 	uint32_t	RedirectSL	:4;	/* SL to access services */
135 	uint32_t	RedirectTC	:8;	/* traffic class */
136 	ib_lid_t	RedirectLID;		/* dlid for class services */
137 	ib_pkey_t	RedirectP_Key;		/* p_key for class services */
138 	uint32_t	RedirectQP	:24;	/* QP for class services */
139 	uint32_t	Reserved2	:8;
140 	ib_qkey_t	RedirectQ_Key;		/* q_key for class services */
141 	uint64_t	TrapGID_hi;		/* dest gid of trap msgs */
142 	uint64_t	TrapGID_lo;		/* dest gid of trap msgs */
143 	uint32_t	TrapFL		:20;	/* flow label for traps */
144 	uint32_t	TrapSL		:4;	/* SL for traps */
145 	uint32_t	TrapTC		:8;	/* traffic class for traps */
146 	ib_lid_t	TrapLID;		/* dlid for traps */
147 	ib_pkey_t	TrapP_Key;		/* p_key for traps */
148 	uint32_t	TrapQP		:24;	/* QP for traps */
149 	uint32_t	TrapHL		:8;	/* hop limit for traps */
150 	ib_qkey_t	TrapQ_Key;		/* q_key for traps */
151 } ib_mad_classportinfo_t;
152 #else
153 #error	One of _BIT_FIELDS_HTOL or _BIT_FIELDS_LTOH must be defined
154 #endif /* _BIT_FIELDS_HTOL */
155 
156 #define	MAD_CLASSPORTINFO_CAP_MASK_TRAPS	0x01
157 #define	MAD_CLASSPORTINFO_CAP_MASK_NOTICES	0x02
158 
159 /*
160  * Trap/Notice: Table 105
161  */
162 #if defined(_BIT_FIELDS_HTOL)
163 typedef struct ib_mad_notice_s {
164 	uint32_t	IsGeneric	:1;	/* is generic or vendor spec. */
165 	uint32_t	Type		:7;	/* type of the trap */
166 
167 	/* if generic, indicates type of event's producer, else vendor id */
168 	uint32_t	ProducerType_VendorID:24;
169 
170 	uint16_t	TrapNumber_DeviceID;	/* trap num or device id */
171 	uint16_t	IssuerLID;		/* generator's LID */
172 	uint16_t	NoticeToggle	:1;	/* alt 0/1 between notices */
173 	uint16_t	NoticeCount	:15;	/* num notices queued */
174 	uint8_t		DataDetails[54];	/* notice/dtrap data details */
175 	ib_gid_t	IssuerGID;		/* GID of issuer port */
176 } ib_mad_notice_t;
177 
178 #elif defined(_BIT_FIELDS_LTOH)
179 
180 typedef struct ib_mad_notice_s {
181 	/* if generic, indicates type of event's producer, else vendor id */
182 	uint32_t	ProducerType_VendorID:24;
183 
184 	uint32_t	Type		:7;	/* type of the trap */
185 	uint32_t	IsGeneric	:1;	/* is generic or vendor spec. */
186 
187 	uint16_t	TrapNumber_DeviceID;	/* trap num or device id */
188 	uint16_t	IssuerLID;		/* generator's LID */
189 	uint16_t	NoticeCount	:15;	/* num notices queued */
190 	uint16_t	NoticeToggle	:1;	/* alt 0/1 between notices */
191 	uint8_t		DataDetails[54];	/* notice/dtrap data details */
192 	ib_gid_t	IssuerGID;		/* GID of issuer port */
193 } ib_mad_notice_t;
194 #else
195 #error	One of _BIT_FIELDS_HTOL or _BIT_FIELDS_LTOH must be defined
196 #endif /* _BIT_FIELDS_HTOL */
197 
198 #define	MAD_NOTICE_IS_GENERIC			0x1
199 
200 #define	MAD_NOTICE_TYPE_FATAL			0x0
201 #define	MAD_NOTICE_TYPE_URGENT			0x1
202 #define	MAD_NOTICE_TYPE_SECURITY			0x2
203 #define	MAD_NOTICE_TYPE_SUBNET_MGMT		0x3
204 #define	MAD_NOTICE_TYPE_INFO			0x4
205 
206 #define	MAD_NOTICE_NODETYPE_CA			0x1
207 #define	MAD_NOTICE_NODETYPE_SWITCH		0x2
208 #define	MAD_NOTICE_NODETYPE_ROUTER		0x3
209 #define	MAD_NOTICE_NODETYPE_SUBNET_MANAGEMENT	0x4
210 
211 #define	MAD_NOTICE_TRAP_NUMBER_RESERVED		0xFFFF
212 
213 /* InformInfo: Table 106 */
214 #if defined(_BIT_FIELDS_HTOL)
215 typedef struct ib_mad_informinfo_s {
216 	ib_gid_t	GID;			/* specific GID to sub. for */
217 	ib_lid_t	LIDRangeBegin;		/* lowest LID to sub. for */
218 	ib_lid_t	LIDRangeEnd;		/* highest LID to sub. for */
219 	uint16_t	Reserved;
220 	uint8_t		IsGeneric;		/* forward generic traps */
221 	uint8_t		Subscribe;		/* 1 subscribe, 0 unsubscribe */
222 	uint16_t	Type;			/* type of trap */
223 	uint16_t	TrapNumber_DeviceID;	/* trap num or device id */
224 	uint32_t	QPN		:24;	/* queue pair for results */
225 	uint32_t	Reserved2	:3;
226 	uint32_t	RespTimeValue	:5;	/* response time value */
227 	uint32_t	Reserved3	:8;
228 	uint32_t	ProducerType_VendorID:24; /* type of event's producer */
229 } ib_mad_informinfo_t;
230 
231 #elif defined(_BIT_FIELDS_LTOH)
232 
233 typedef struct ib_mad_informinfo_s {
234 	ib_gid_t	GID;			/* specific GID to sub. for */
235 	ib_lid_t	LIDRangeBegin;		/* lowest LID to sub. for */
236 	ib_lid_t	LIDRangeEnd;		/* highest LID to sub. for */
237 	uint16_t	Reserved;
238 	uint8_t		IsGeneric;		/* forward generic traps */
239 	uint8_t		Subscribe;		/* 1 subscribe, 0 unsubscribe */
240 	uint16_t	Type;			/* type of trap */
241 	uint16_t	TrapNumber_DeviceID;	/* trap num or device id */
242 	uint32_t	RespTimeValue	:5;	/* response time value */
243 	uint32_t	Reserved2	:3;
244 	uint32_t	QPN		:24;	/* queue pair for results */
245 	uint32_t	ProducerType_VendorID:24; /* type of event's producer */
246 	uint32_t	Reserved3	:8;
247 } ib_mad_informinfo_t;
248 #else
249 #error	One of _BIT_FIELDS_HTOL or _BIT_FIELDS_LTOH must be defined
250 #endif /* _BIT_FIELDS_HTOL */
251 
252 #define	MAD_INFORMINFO_ALL_ENDPORTS_RANGE		0xFFFF
253 
254 #define	MAD_INFORMINFO_FORWARD_GENERIC			0x1
255 #define	MAD_INFORMINFO_FORWARD_VENDOR_SPECIFIC		0x0
256 
257 #define	MAD_INFORMINFO_SUBSCRIBE			0x1
258 #define	MAD_INFORMINFO_UNSUBSCRIBE			0x0
259 
260 #define	MAD_INFORMINFO_TRAP_NUMBER_FORWARD_ALL		0xFFFF
261 
262 #define	MAD_INFORMINFO_TRAP_TYPE_FATAL			0x0
263 #define	MAD_INFORMINFO_TRAP_TYPE_URGENT			0x1
264 #define	MAD_INFORMINFO_TRAP_TYPE_SECURITY		0x2
265 #define	MAD_INFORMINFO_TRAP_TYPE_SUBNET_MGMT		0x3
266 #define	MAD_INFORMINFO_TRAP_TYPE_INFORM			0x4
267 #define	MAD_INFORMINFO_TRAP_TYPE_FORWARD_ALL		0xFFFF
268 
269 #define	MAD_INFORMINFO_NODETYPE_CA			0x1
270 #define	MAD_INFORMINFO_NODETYPE_SWITCH			0x2
271 #define	MAD_INFORMINFO_NODETYPE_ROUTER			0x3
272 #define	MAD_INFORMINFO_NODETYPE_SUBNET_MANAGEMENT	0x4
273 
274 #ifdef __cplusplus
275 }
276 #endif
277 
278 #endif /* _SYS_IB_MGT_IB_MAD_H */
279