|
@@ -10,83 +10,24 @@
|
10
|
10
|
#include <stdint.h>
|
11
|
11
|
#include <gpxe/ib_packet.h>
|
12
|
12
|
|
13
|
|
-/** A management datagram common header
|
|
13
|
+/*****************************************************************************
|
14
|
14
|
*
|
15
|
|
- * Defined in section 13.4.2 of the IBA.
|
16
|
|
- */
|
17
|
|
-struct ib_mad_hdr {
|
18
|
|
- uint8_t base_version;
|
19
|
|
- uint8_t mgmt_class;
|
20
|
|
- uint8_t class_version;
|
21
|
|
- uint8_t method;
|
22
|
|
- uint16_t status;
|
23
|
|
- uint16_t class_specific;
|
24
|
|
- uint32_t tid[2];
|
25
|
|
- uint16_t attr_id;
|
26
|
|
- uint8_t reserved[2];
|
27
|
|
- uint32_t attr_mod;
|
28
|
|
-} __attribute__ (( packed ));
|
29
|
|
-
|
30
|
|
-/* Management base version */
|
31
|
|
-#define IB_MGMT_BASE_VERSION 1
|
32
|
|
-
|
33
|
|
-/* Management classes */
|
34
|
|
-#define IB_MGMT_CLASS_SUBN_LID_ROUTED 0x01
|
35
|
|
-#define IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE 0x81
|
36
|
|
-#define IB_MGMT_CLASS_SUBN_ADM 0x03
|
37
|
|
-#define IB_MGMT_CLASS_PERF_MGMT 0x04
|
38
|
|
-#define IB_MGMT_CLASS_BM 0x05
|
39
|
|
-#define IB_MGMT_CLASS_DEVICE_MGMT 0x06
|
40
|
|
-#define IB_MGMT_CLASS_CM 0x07
|
41
|
|
-#define IB_MGMT_CLASS_SNMP 0x08
|
42
|
|
-#define IB_MGMT_CLASS_VENDOR_RANGE2_START 0x30
|
43
|
|
-#define IB_MGMT_CLASS_VENDOR_RANGE2_END 0x4F
|
44
|
|
-
|
45
|
|
-/* Management methods */
|
46
|
|
-#define IB_MGMT_METHOD_GET 0x01
|
47
|
|
-#define IB_MGMT_METHOD_SET 0x02
|
48
|
|
-#define IB_MGMT_METHOD_GET_RESP 0x81
|
49
|
|
-#define IB_MGMT_METHOD_SEND 0x03
|
50
|
|
-#define IB_MGMT_METHOD_TRAP 0x05
|
51
|
|
-#define IB_MGMT_METHOD_REPORT 0x06
|
52
|
|
-#define IB_MGMT_METHOD_REPORT_RESP 0x86
|
53
|
|
-#define IB_MGMT_METHOD_TRAP_REPRESS 0x07
|
54
|
|
-#define IB_MGMT_METHOD_DELETE 0x15
|
55
|
|
-
|
56
|
|
-/* Status codes */
|
57
|
|
-#define IB_MGMT_STATUS_OK 0x0000
|
58
|
|
-#define IB_MGMT_STATUS_BAD_VERSION 0x0001
|
59
|
|
-#define IB_MGMT_STATUS_UNSUPPORTED_METHOD 0x0002
|
60
|
|
-#define IB_MGMT_STATUS_UNSUPPORTED_METHOD_ATTR 0x0003
|
61
|
|
-#define IB_MGMT_STATUS_INVALID_VALUE 0x0004
|
62
|
|
-
|
63
|
|
-/** A LID routed SMP header
|
|
15
|
+ * Subnet management MADs
|
64
|
16
|
*
|
65
|
|
- * Defined in section 14.2.1.1 of the IBA.
|
|
17
|
+ *****************************************************************************
|
66
|
18
|
*/
|
67
|
|
-struct ib_smp_lr_hdr {
|
68
|
|
- uint64_t mkey;
|
69
|
|
- uint8_t reserved[32];
|
70
|
|
-} __attribute__ (( packed ));
|
71
|
19
|
|
72
|
|
-/** A directed route SMP header
|
|
20
|
+/** A subnet management header
|
73
|
21
|
*
|
74
|
|
- * Defined in section 14.2.1.2 of the IBA.
|
|
22
|
+ * Defined in sections 14.2.1.1 and 14.2.1.2 of the IBA.
|
75
|
23
|
*/
|
76
|
|
-struct ib_smp_dr_hdr {
|
|
24
|
+struct ib_smp_hdr {
|
77
|
25
|
uint64_t mkey;
|
78
|
26
|
uint16_t slid;
|
79
|
27
|
uint16_t dlid;
|
80
|
28
|
uint8_t reserved[28];
|
81
|
29
|
} __attribute__ (( packed ));
|
82
|
30
|
|
83
|
|
-/** A subnet management header */
|
84
|
|
-union ib_smp_hdr {
|
85
|
|
- uint64_t mkey;
|
86
|
|
- struct ib_smp_lr_hdr lr;
|
87
|
|
- struct ib_smp_dr_hdr dr;
|
88
|
|
-} __attribute__ (( packed ));
|
89
|
|
-
|
90
|
31
|
/** Subnet management class version */
|
91
|
32
|
#define IB_SMP_CLASS_VERSION 1
|
92
|
33
|
|
|
@@ -242,17 +183,24 @@ union ib_smp_data {
|
242
|
183
|
|
243
|
184
|
/** A subnet management directed route path */
|
244
|
185
|
struct ib_smp_dr_path {
|
245
|
|
- uint8_t reserved;
|
246
|
|
- uint8_t hops[63];
|
|
186
|
+ uint8_t hops[64];
|
247
|
187
|
} __attribute__ (( packed ));
|
248
|
188
|
|
249
|
|
-/** A subnet management MAD */
|
250
|
|
-struct ib_mad_smp {
|
251
|
|
- struct ib_mad_hdr mad_hdr;
|
252
|
|
- union ib_smp_hdr smp_hdr;
|
253
|
|
- union ib_smp_data smp_data;
|
254
|
|
- struct ib_smp_dr_path initial_path;
|
255
|
|
- struct ib_smp_dr_path return_path;
|
|
189
|
+/** Subnet management MAD class-specific data */
|
|
190
|
+struct ib_smp_class_specific {
|
|
191
|
+ uint8_t hop_pointer;
|
|
192
|
+ uint8_t hop_count;
|
|
193
|
+} __attribute__ (( packed ));
|
|
194
|
+
|
|
195
|
+/*****************************************************************************
|
|
196
|
+ *
|
|
197
|
+ * Subnet administration MADs
|
|
198
|
+ *
|
|
199
|
+ *****************************************************************************
|
|
200
|
+ */
|
|
201
|
+
|
|
202
|
+struct ib_rmpp_hdr {
|
|
203
|
+ uint32_t raw[3];
|
256
|
204
|
} __attribute__ (( packed ));
|
257
|
205
|
|
258
|
206
|
struct ib_sa_hdr {
|
|
@@ -262,14 +210,10 @@ struct ib_sa_hdr {
|
262
|
210
|
uint32_t comp_mask[2];
|
263
|
211
|
} __attribute__ (( packed ));
|
264
|
212
|
|
265
|
|
-struct ib_rmpp_hdr {
|
266
|
|
- uint32_t raw[3];
|
267
|
|
-} __attribute__ (( packed ));
|
|
213
|
+#define IB_SA_ATTR_MC_MEMBER_REC 0x38
|
|
214
|
+#define IB_SA_ATTR_PATH_REC 0x35
|
268
|
215
|
|
269
|
|
-struct ib_mad_path_record {
|
270
|
|
- struct ib_mad_hdr mad_hdr;
|
271
|
|
- struct ib_rmpp_hdr rmpp_hdr;
|
272
|
|
- struct ib_sa_hdr sa_hdr;
|
|
216
|
+struct ib_path_record {
|
273
|
217
|
uint32_t reserved0[2];
|
274
|
218
|
struct ib_gid dgid;
|
275
|
219
|
struct ib_gid sgid;
|
|
@@ -285,10 +229,10 @@ struct ib_mad_path_record {
|
285
|
229
|
uint32_t reserved2[35];
|
286
|
230
|
} __attribute__ (( packed ));
|
287
|
231
|
|
288
|
|
-struct ib_mad_mc_member_record {
|
289
|
|
- struct ib_mad_hdr mad_hdr;
|
290
|
|
- struct ib_rmpp_hdr rmpp_hdr;
|
291
|
|
- struct ib_sa_hdr sa_hdr;
|
|
232
|
+#define IB_SA_PATH_REC_DGID (1<<2)
|
|
233
|
+#define IB_SA_PATH_REC_SGID (1<<3)
|
|
234
|
+
|
|
235
|
+struct ib_mc_member_record {
|
292
|
236
|
struct ib_gid mgid;
|
293
|
237
|
struct ib_gid port_gid;
|
294
|
238
|
uint32_t qkey;
|
|
@@ -305,9 +249,6 @@ struct ib_mad_mc_member_record {
|
305
|
249
|
uint32_t reserved1[37];
|
306
|
250
|
} __attribute__ (( packed ));
|
307
|
251
|
|
308
|
|
-#define IB_SA_ATTR_MC_MEMBER_REC 0x38
|
309
|
|
-#define IB_SA_ATTR_PATH_REC 0x35
|
310
|
|
-
|
311
|
252
|
#define IB_SA_MCMEMBER_REC_MGID (1<<0)
|
312
|
253
|
#define IB_SA_MCMEMBER_REC_PORT_GID (1<<1)
|
313
|
254
|
#define IB_SA_MCMEMBER_REC_QKEY (1<<2)
|
|
@@ -327,14 +268,96 @@ struct ib_mad_mc_member_record {
|
327
|
268
|
#define IB_SA_MCMEMBER_REC_JOIN_STATE (1<<16)
|
328
|
269
|
#define IB_SA_MCMEMBER_REC_PROXY_JOIN (1<<17)
|
329
|
270
|
|
330
|
|
-#define IB_SA_PATH_REC_DGID (1<<2)
|
331
|
|
-#define IB_SA_PATH_REC_SGID (1<<3)
|
|
271
|
+union ib_sa_data {
|
|
272
|
+ struct ib_path_record path_record;
|
|
273
|
+ struct ib_mc_member_record mc_member_record;
|
|
274
|
+} __attribute__ (( packed ));
|
|
275
|
+
|
|
276
|
+/*****************************************************************************
|
|
277
|
+ *
|
|
278
|
+ * MADs
|
|
279
|
+ *
|
|
280
|
+ *****************************************************************************
|
|
281
|
+ */
|
|
282
|
+
|
|
283
|
+/** Management datagram class_specific data */
|
|
284
|
+union ib_mad_class_specific {
|
|
285
|
+ uint16_t raw;
|
|
286
|
+ struct ib_smp_class_specific smp;
|
|
287
|
+} __attribute__ (( packed ));
|
|
288
|
+
|
|
289
|
+/** A management datagram common header
|
|
290
|
+ *
|
|
291
|
+ * Defined in section 13.4.2 of the IBA.
|
|
292
|
+ */
|
|
293
|
+struct ib_mad_hdr {
|
|
294
|
+ uint8_t base_version;
|
|
295
|
+ uint8_t mgmt_class;
|
|
296
|
+ uint8_t class_version;
|
|
297
|
+ uint8_t method;
|
|
298
|
+ uint16_t status;
|
|
299
|
+ union ib_mad_class_specific class_specific;
|
|
300
|
+ uint32_t tid[2];
|
|
301
|
+ uint16_t attr_id;
|
|
302
|
+ uint8_t reserved[2];
|
|
303
|
+ uint32_t attr_mod;
|
|
304
|
+} __attribute__ (( packed ));
|
|
305
|
+
|
|
306
|
+/* Management base version */
|
|
307
|
+#define IB_MGMT_BASE_VERSION 1
|
|
308
|
+
|
|
309
|
+/* Management classes */
|
|
310
|
+#define IB_MGMT_CLASS_SUBN_LID_ROUTED 0x01
|
|
311
|
+#define IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE 0x81
|
|
312
|
+#define IB_MGMT_CLASS_SUBN_ADM 0x03
|
|
313
|
+#define IB_MGMT_CLASS_PERF_MGMT 0x04
|
|
314
|
+#define IB_MGMT_CLASS_BM 0x05
|
|
315
|
+#define IB_MGMT_CLASS_DEVICE_MGMT 0x06
|
|
316
|
+#define IB_MGMT_CLASS_CM 0x07
|
|
317
|
+#define IB_MGMT_CLASS_SNMP 0x08
|
|
318
|
+#define IB_MGMT_CLASS_VENDOR_RANGE2_START 0x30
|
|
319
|
+#define IB_MGMT_CLASS_VENDOR_RANGE2_END 0x4F
|
|
320
|
+
|
|
321
|
+/* Management methods */
|
|
322
|
+#define IB_MGMT_METHOD_GET 0x01
|
|
323
|
+#define IB_MGMT_METHOD_SET 0x02
|
|
324
|
+#define IB_MGMT_METHOD_GET_RESP 0x81
|
|
325
|
+#define IB_MGMT_METHOD_SEND 0x03
|
|
326
|
+#define IB_MGMT_METHOD_TRAP 0x05
|
|
327
|
+#define IB_MGMT_METHOD_REPORT 0x06
|
|
328
|
+#define IB_MGMT_METHOD_REPORT_RESP 0x86
|
|
329
|
+#define IB_MGMT_METHOD_TRAP_REPRESS 0x07
|
|
330
|
+#define IB_MGMT_METHOD_DELETE 0x15
|
|
331
|
+
|
|
332
|
+/* Status codes */
|
|
333
|
+#define IB_MGMT_STATUS_OK 0x0000
|
|
334
|
+#define IB_MGMT_STATUS_BAD_VERSION 0x0001
|
|
335
|
+#define IB_MGMT_STATUS_UNSUPPORTED_METHOD 0x0002
|
|
336
|
+#define IB_MGMT_STATUS_UNSUPPORTED_METHOD_ATTR 0x0003
|
|
337
|
+#define IB_MGMT_STATUS_INVALID_VALUE 0x0004
|
|
338
|
+
|
|
339
|
+/** A subnet management MAD */
|
|
340
|
+struct ib_mad_smp {
|
|
341
|
+ struct ib_mad_hdr mad_hdr;
|
|
342
|
+ struct ib_smp_hdr smp_hdr;
|
|
343
|
+ union ib_smp_data smp_data;
|
|
344
|
+ struct ib_smp_dr_path initial_path;
|
|
345
|
+ struct ib_smp_dr_path return_path;
|
|
346
|
+} __attribute__ (( packed ));
|
|
347
|
+
|
|
348
|
+/** A subnet administration MAD */
|
|
349
|
+struct ib_mad_sa {
|
|
350
|
+ struct ib_mad_hdr mad_hdr;
|
|
351
|
+ struct ib_rmpp_hdr rmpp_hdr;
|
|
352
|
+ struct ib_sa_hdr sa_hdr;
|
|
353
|
+ union ib_sa_data sa_data;
|
|
354
|
+} __attribute__ (( packed ));
|
332
|
355
|
|
|
356
|
+/** A management datagram */
|
333
|
357
|
union ib_mad {
|
334
|
358
|
struct ib_mad_hdr hdr;
|
335
|
359
|
struct ib_mad_smp smp;
|
336
|
|
- struct ib_mad_path_record path_record;
|
337
|
|
- struct ib_mad_mc_member_record mc_member_record;
|
|
360
|
+ struct ib_mad_sa sa;
|
338
|
361
|
uint8_t bytes[256];
|
339
|
362
|
} __attribute__ (( packed ));
|
340
|
363
|
|