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