6 * Infiniband management datagrams
10 FILE_LICENCE ( GPL2_OR_LATER );
13 #include <gpxe/ib_packet.h>
15 /*****************************************************************************
17 * Subnet management MADs
19 *****************************************************************************
22 /** A subnet management header
24 * Defined in sections 14.2.1.1 and 14.2.1.2 of the IBA.
31 } __attribute__ (( packed ));
33 /** Subnet management class version */
34 #define IB_SMP_CLASS_VERSION 1
36 /** Subnet management direction bit
38 * This bit resides in the "status" field in the MAD header.
40 #define IB_SMP_STATUS_D_INBOUND 0x8000
42 /* Subnet management attributes */
43 #define IB_SMP_ATTR_NOTICE 0x0002
44 #define IB_SMP_ATTR_NODE_DESC 0x0010
45 #define IB_SMP_ATTR_NODE_INFO 0x0011
46 #define IB_SMP_ATTR_SWITCH_INFO 0x0012
47 #define IB_SMP_ATTR_GUID_INFO 0x0014
48 #define IB_SMP_ATTR_PORT_INFO 0x0015
49 #define IB_SMP_ATTR_PKEY_TABLE 0x0016
50 #define IB_SMP_ATTR_SL_TO_VL_TABLE 0x0017
51 #define IB_SMP_ATTR_VL_ARB_TABLE 0x0018
52 #define IB_SMP_ATTR_LINEAR_FORWARD_TABLE 0x0019
53 #define IB_SMP_ATTR_RANDOM_FORWARD_TABLE 0x001A
54 #define IB_SMP_ATTR_MCAST_FORWARD_TABLE 0x001B
55 #define IB_SMP_ATTR_SM_INFO 0x0020
56 #define IB_SMP_ATTR_VENDOR_DIAG 0x0030
57 #define IB_SMP_ATTR_LED_INFO 0x0031
58 #define IB_SMP_ATTR_VENDOR_MASK 0xFF00
61 * A Node Description attribute
63 * Defined in section 14.2.5.2 of the IBA
67 } __attribute__ (( packed ));
69 /** A Node Information attribute
71 * Defined in section 14.2.5.3 of the IBA.
75 uint8_t class_version;
78 struct ib_gid_half sys_guid;
79 struct ib_gid_half node_guid;
80 struct ib_gid_half port_guid;
81 uint16_t partition_cap;
84 uint8_t local_port_num;
86 } __attribute__ ((packed));
88 #define IB_NODE_TYPE_HCA 0x01
89 #define IB_NODE_TYPE_SWITCH 0x02
90 #define IB_NODE_TYPE_ROUTER 0x03
92 /** A GUID Information attribute
94 * Defined in section 14.2.5.5 of the IBA.
98 } __attribute__ (( packed ));
100 /** A Port Information attribute
102 * Defined in section 14.2.5.6 of the IBA.
104 struct ib_port_info {
106 uint8_t gid_prefix[8];
108 uint16_t mastersm_lid;
111 uint16_t mkey_lease_period;
112 uint8_t local_port_num;
113 uint8_t link_width_enabled;
114 uint8_t link_width_supported;
115 uint8_t link_width_active;
116 uint8_t link_speed_supported__port_state;
117 uint8_t port_phys_state__link_down_def_state;
118 uint8_t mkey_prot_bits__lmc;
119 uint8_t link_speed_active__link_speed_enabled;
120 uint8_t neighbour_mtu__mastersm_sl;
121 uint8_t vl_cap__init_type;
122 uint8_t vl_high_limit;
123 uint8_t vl_arbitration_high_cap;
124 uint8_t vl_arbitration_low_cap;
125 uint8_t init_type_reply__mtu_cap;
126 uint8_t vl_stall_count__hoq_life;
127 uint8_t operational_vls__enforcement;
128 uint16_t mkey_violations;
129 uint16_t pkey_violations;
130 uint16_t qkey_violations;
132 uint8_t client_reregister__subnet_timeout;
133 uint8_t resp_time_value;
134 uint8_t local_phy_errors__overrun_errors;
135 uint16_t max_credit_hint;
136 uint32_t link_round_trip_latency;
137 } __attribute__ (( packed ));
139 #define IB_LINK_WIDTH_1X 0x01
140 #define IB_LINK_WIDTH_4X 0x02
141 #define IB_LINK_WIDTH_8X 0x04
142 #define IB_LINK_WIDTH_12X 0x08
144 #define IB_LINK_SPEED_SDR 0x01
145 #define IB_LINK_SPEED_DDR 0x02
146 #define IB_LINK_SPEED_QDR 0x04
148 #define IB_PORT_STATE_DOWN 0x01
149 #define IB_PORT_STATE_INIT 0x02
150 #define IB_PORT_STATE_ARMED 0x03
151 #define IB_PORT_STATE_ACTIVE 0x04
153 #define IB_PORT_PHYS_STATE_SLEEP 0x01
154 #define IB_PORT_PHYS_STATE_POLLING 0x02
156 #define IB_MTU_256 0x01
157 #define IB_MTU_512 0x02
158 #define IB_MTU_1024 0x03
159 #define IB_MTU_2048 0x04
160 #define IB_MTU_4096 0x05
163 #define IB_VL_0_1 0x02
164 #define IB_VL_0_3 0x03
165 #define IB_VL_0_7 0x04
166 #define IB_VL_0_14 0x05
168 /** A Partition Key Table attribute
170 * Defined in section 14.2.5.7 of the IBA.
172 struct ib_pkey_table {
174 } __attribute__ (( packed ));
176 /** A subnet management attribute */
178 struct ib_node_desc node_desc;
179 struct ib_node_info node_info;
180 struct ib_guid_info guid_info;
181 struct ib_port_info port_info;
182 struct ib_pkey_table pkey_table;
184 } __attribute__ (( packed ));
186 /** A subnet management directed route path */
187 struct ib_smp_dr_path {
189 } __attribute__ (( packed ));
191 /** Subnet management MAD class-specific data */
192 struct ib_smp_class_specific {
195 } __attribute__ (( packed ));
197 /*****************************************************************************
199 * Subnet administration MADs
201 *****************************************************************************
204 #define IB_SA_CLASS_VERSION 2
208 } __attribute__ (( packed ));
213 uint16_t attrib_offset;
214 uint32_t comp_mask[2];
215 } __attribute__ (( packed ));
217 #define IB_SA_ATTR_MC_MEMBER_REC 0x38
218 #define IB_SA_ATTR_PATH_REC 0x35
220 struct ib_path_record {
221 uint32_t reserved0[2];
226 uint32_t hop_limit__flow_label__raw_traffic;
227 uint32_t pkey__numb_path__reversible__tclass;
229 uint8_t reserved__sl;
230 uint8_t mtu_selector__mtu;
231 uint8_t rate_selector__rate;
232 uint32_t preference__packet_lifetime__packet_lifetime_selector;
233 uint32_t reserved2[35];
234 } __attribute__ (( packed ));
236 #define IB_SA_PATH_REC_DGID (1<<2)
237 #define IB_SA_PATH_REC_SGID (1<<3)
239 struct ib_mc_member_record {
241 struct ib_gid port_gid;
244 uint8_t mtu_selector__mtu;
247 uint8_t rate_selector__rate;
248 uint8_t packet_lifetime_selector__packet_lifetime;
249 uint32_t sl__flow_label__hop_limit;
250 uint8_t scope__join_state;
251 uint8_t proxy_join__reserved;
253 uint32_t reserved1[37];
254 } __attribute__ (( packed ));
256 #define IB_SA_MCMEMBER_REC_MGID (1<<0)
257 #define IB_SA_MCMEMBER_REC_PORT_GID (1<<1)
258 #define IB_SA_MCMEMBER_REC_QKEY (1<<2)
259 #define IB_SA_MCMEMBER_REC_MLID (1<<3)
260 #define IB_SA_MCMEMBER_REC_MTU_SELECTOR (1<<4)
261 #define IB_SA_MCMEMBER_REC_MTU (1<<5)
262 #define IB_SA_MCMEMBER_REC_TRAFFIC_CLASS (1<<6)
263 #define IB_SA_MCMEMBER_REC_PKEY (1<<7)
264 #define IB_SA_MCMEMBER_REC_RATE_SELECTOR (1<<8)
265 #define IB_SA_MCMEMBER_REC_RATE (1<<9)
266 #define IB_SA_MCMEMBER_REC_PACKET_LIFE_TIME_SELECTOR (1<<10)
267 #define IB_SA_MCMEMBER_REC_PACKET_LIFE_TIME (1<<11)
268 #define IB_SA_MCMEMBER_REC_SL (1<<12)
269 #define IB_SA_MCMEMBER_REC_FLOW_LABEL (1<<13)
270 #define IB_SA_MCMEMBER_REC_HOP_LIMIT (1<<14)
271 #define IB_SA_MCMEMBER_REC_SCOPE (1<<15)
272 #define IB_SA_MCMEMBER_REC_JOIN_STATE (1<<16)
273 #define IB_SA_MCMEMBER_REC_PROXY_JOIN (1<<17)
276 struct ib_path_record path_record;
277 struct ib_mc_member_record mc_member_record;
278 } __attribute__ (( packed ));
280 /*****************************************************************************
284 *****************************************************************************
287 /** Management datagram class_specific data */
288 union ib_mad_class_specific {
290 struct ib_smp_class_specific smp;
291 } __attribute__ (( packed ));
293 /** A management datagram common header
295 * Defined in section 13.4.2 of the IBA.
298 uint8_t base_version;
300 uint8_t class_version;
303 union ib_mad_class_specific class_specific;
308 } __attribute__ (( packed ));
310 /* Management base version */
311 #define IB_MGMT_BASE_VERSION 1
313 /* Management classes */
314 #define IB_MGMT_CLASS_SUBN_LID_ROUTED 0x01
315 #define IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE 0x81
316 #define IB_MGMT_CLASS_SUBN_ADM 0x03
317 #define IB_MGMT_CLASS_PERF_MGMT 0x04
318 #define IB_MGMT_CLASS_BM 0x05
319 #define IB_MGMT_CLASS_DEVICE_MGMT 0x06
320 #define IB_MGMT_CLASS_CM 0x07
321 #define IB_MGMT_CLASS_SNMP 0x08
322 #define IB_MGMT_CLASS_VENDOR_RANGE2_START 0x30
323 #define IB_MGMT_CLASS_VENDOR_RANGE2_END 0x4F
325 /* Management methods */
326 #define IB_MGMT_METHOD_GET 0x01
327 #define IB_MGMT_METHOD_SET 0x02
328 #define IB_MGMT_METHOD_GET_RESP 0x81
329 #define IB_MGMT_METHOD_SEND 0x03
330 #define IB_MGMT_METHOD_TRAP 0x05
331 #define IB_MGMT_METHOD_REPORT 0x06
332 #define IB_MGMT_METHOD_REPORT_RESP 0x86
333 #define IB_MGMT_METHOD_TRAP_REPRESS 0x07
334 #define IB_MGMT_METHOD_DELETE 0x15
337 #define IB_MGMT_STATUS_OK 0x0000
338 #define IB_MGMT_STATUS_BAD_VERSION 0x0001
339 #define IB_MGMT_STATUS_UNSUPPORTED_METHOD 0x0002
340 #define IB_MGMT_STATUS_UNSUPPORTED_METHOD_ATTR 0x0003
341 #define IB_MGMT_STATUS_INVALID_VALUE 0x0004
343 /** A subnet management MAD */
345 struct ib_mad_hdr mad_hdr;
346 struct ib_smp_hdr smp_hdr;
347 union ib_smp_data smp_data;
348 struct ib_smp_dr_path initial_path;
349 struct ib_smp_dr_path return_path;
350 } __attribute__ (( packed ));
352 /** A subnet administration MAD */
354 struct ib_mad_hdr mad_hdr;
355 struct ib_rmpp_hdr rmpp_hdr;
356 struct ib_sa_hdr sa_hdr;
357 union ib_sa_data sa_data;
358 } __attribute__ (( packed ));
360 /** A management datagram */
362 struct ib_mad_hdr hdr;
363 struct ib_mad_smp smp;
366 } __attribute__ (( packed ));
368 #endif /* _GPXE_IB_MAD_H */