Bladeren bron

[infiniband] Respect hop pointer when building directed route SMP return path

The return path in directed route SMPs lists the egress ports in order
from SM to node, rather than from node to SM.

To write to the correct offset within the return path, we need to
parse the hop pointer.  This is held within the class-specific data
portion of the MAD header, which was previously unused by us and
defined to be a uint16_t.  Define this field to be a union type; this
requires some rearrangement of ib_mad.h and corresponding changes to
ipoib.c.
tags/v0.9.6
Michael Brown 15 jaren geleden
bovenliggende
commit
1b3edd9e11
3 gewijzigde bestanden met toevoegingen van 175 en 138 verwijderingen
  1. 13
    1
      src/drivers/infiniband/ib_sma.c
  2. 47
    45
      src/drivers/net/ipoib.c
  3. 115
    92
      src/include/gpxe/ib_mad.h

+ 13
- 1
src/drivers/infiniband/ib_sma.c Bestand weergeven

264
 	struct ib_mad_hdr *hdr = &mad->hdr;
264
 	struct ib_mad_hdr *hdr = &mad->hdr;
265
 	struct ib_mad_smp *smp = &mad->smp;
265
 	struct ib_mad_smp *smp = &mad->smp;
266
 	struct ib_sma_handler *handler = NULL;
266
 	struct ib_sma_handler *handler = NULL;
267
+	unsigned int hop_pointer;
268
+	unsigned int hop_count;
267
 	int rc;
269
 	int rc;
268
 
270
 
269
 	DBGC ( sma, "SMA %p received SMP with bv=%02x mc=%02x cv=%02x "
271
 	DBGC ( sma, "SMA %p received SMP with bv=%02x mc=%02x cv=%02x "
336
 	/* Set response fields for directed route SMPs */
338
 	/* Set response fields for directed route SMPs */
337
 	if ( hdr->mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE ) {
339
 	if ( hdr->mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE ) {
338
 		hdr->status |= htons ( IB_SMP_STATUS_D_INBOUND );
340
 		hdr->status |= htons ( IB_SMP_STATUS_D_INBOUND );
339
-		smp->return_path.hops[0] = ibdev->port;
341
+		hop_pointer = smp->mad_hdr.class_specific.smp.hop_pointer;
342
+		hop_count = smp->mad_hdr.class_specific.smp.hop_count;
343
+		assert ( hop_count == hop_pointer );
344
+		if ( hop_pointer < ( sizeof ( smp->return_path.hops ) /
345
+				     sizeof ( smp->return_path.hops[0] ) ) ) {
346
+			smp->return_path.hops[hop_pointer] = ibdev->port;
347
+		} else {
348
+			DBGC ( sma, "SMA %p invalid hop pointer %d\n",
349
+			       sma, hop_pointer );
350
+			return -EINVAL;
351
+		}
340
 	}
352
 	}
341
 
353
 
342
 	DBGC ( sma, "SMA %p responding with status=%04x\n",
354
 	DBGC ( sma, "SMA %p responding with status=%04x\n",

+ 47
- 45
src/drivers/net/ipoib.c Bestand weergeven

440
 				   struct ib_gid *gid ) {
440
 				   struct ib_gid *gid ) {
441
 	struct ib_device *ibdev = ipoib->ibdev;
441
 	struct ib_device *ibdev = ipoib->ibdev;
442
 	struct io_buffer *iobuf;
442
 	struct io_buffer *iobuf;
443
-	struct ib_mad_path_record *path_record;
443
+	struct ib_mad_sa *sa;
444
 	struct ib_address_vector av;
444
 	struct ib_address_vector av;
445
 	int rc;
445
 	int rc;
446
 
446
 
447
 	/* Allocate I/O buffer */
447
 	/* Allocate I/O buffer */
448
-	iobuf = alloc_iob ( sizeof ( *path_record ) );
448
+	iobuf = alloc_iob ( sizeof ( *sa ) );
449
 	if ( ! iobuf )
449
 	if ( ! iobuf )
450
 		return -ENOMEM;
450
 		return -ENOMEM;
451
-	iob_put ( iobuf, sizeof ( *path_record ) );
452
-	path_record = iobuf->data;
453
-	memset ( path_record, 0, sizeof ( *path_record ) );
451
+	iob_put ( iobuf, sizeof ( *sa ) );
452
+	sa = iobuf->data;
453
+	memset ( sa, 0, sizeof ( *sa ) );
454
 
454
 
455
 	/* Construct path record request */
455
 	/* Construct path record request */
456
-	path_record->mad_hdr.base_version = IB_MGMT_BASE_VERSION;
457
-	path_record->mad_hdr.mgmt_class = IB_MGMT_CLASS_SUBN_ADM;
458
-	path_record->mad_hdr.class_version = 2;
459
-	path_record->mad_hdr.method = IB_MGMT_METHOD_GET;
460
-	path_record->mad_hdr.attr_id = htons ( IB_SA_ATTR_PATH_REC );
461
-	path_record->mad_hdr.tid[0] = IPOIB_TID_GET_PATH_REC;
462
-	path_record->mad_hdr.tid[1] = ipoib_meta_tid++;
463
-	path_record->sa_hdr.comp_mask[1] =
456
+	sa->mad_hdr.base_version = IB_MGMT_BASE_VERSION;
457
+	sa->mad_hdr.mgmt_class = IB_MGMT_CLASS_SUBN_ADM;
458
+	sa->mad_hdr.class_version = 2;
459
+	sa->mad_hdr.method = IB_MGMT_METHOD_GET;
460
+	sa->mad_hdr.attr_id = htons ( IB_SA_ATTR_PATH_REC );
461
+	sa->mad_hdr.tid[0] = IPOIB_TID_GET_PATH_REC;
462
+	sa->mad_hdr.tid[1] = ipoib_meta_tid++;
463
+	sa->sa_hdr.comp_mask[1] =
464
 		htonl ( IB_SA_PATH_REC_DGID | IB_SA_PATH_REC_SGID );
464
 		htonl ( IB_SA_PATH_REC_DGID | IB_SA_PATH_REC_SGID );
465
-	memcpy ( &path_record->dgid, gid, sizeof ( path_record->dgid ) );
466
-	memcpy ( &path_record->sgid, &ibdev->gid,
467
-		 sizeof ( path_record->sgid ) );
465
+	memcpy ( &sa->sa_data.path_record.dgid, gid,
466
+		 sizeof ( sa->sa_data.path_record.dgid ) );
467
+	memcpy ( &sa->sa_data.path_record.sgid, &ibdev->gid,
468
+		 sizeof ( sa->sa_data.path_record.sgid ) );
468
 
469
 
469
 	/* Construct address vector */
470
 	/* Construct address vector */
470
 	memset ( &av, 0, sizeof ( av ) );
471
 	memset ( &av, 0, sizeof ( av ) );
497
 				    struct ib_gid *gid, int join ) {
498
 				    struct ib_gid *gid, int join ) {
498
 	struct ib_device *ibdev = ipoib->ibdev;
499
 	struct ib_device *ibdev = ipoib->ibdev;
499
 	struct io_buffer *iobuf;
500
 	struct io_buffer *iobuf;
500
-	struct ib_mad_mc_member_record *mc_member_record;
501
+	struct ib_mad_sa *sa;
501
 	struct ib_address_vector av;
502
 	struct ib_address_vector av;
502
 	int rc;
503
 	int rc;
503
 
504
 
504
 	/* Allocate I/O buffer */
505
 	/* Allocate I/O buffer */
505
-	iobuf = alloc_iob ( sizeof ( *mc_member_record ) );
506
+	iobuf = alloc_iob ( sizeof ( *sa ) );
506
 	if ( ! iobuf )
507
 	if ( ! iobuf )
507
 		return -ENOMEM;
508
 		return -ENOMEM;
508
-	iob_put ( iobuf, sizeof ( *mc_member_record ) );
509
-	mc_member_record = iobuf->data;
510
-	memset ( mc_member_record, 0, sizeof ( *mc_member_record ) );
509
+	iob_put ( iobuf, sizeof ( *sa ) );
510
+	sa = iobuf->data;
511
+	memset ( sa, 0, sizeof ( *sa ) );
511
 
512
 
512
 	/* Construct path record request */
513
 	/* Construct path record request */
513
-	mc_member_record->mad_hdr.base_version = IB_MGMT_BASE_VERSION;
514
-	mc_member_record->mad_hdr.mgmt_class = IB_MGMT_CLASS_SUBN_ADM;
515
-	mc_member_record->mad_hdr.class_version = 2;
516
-	mc_member_record->mad_hdr.method = 
514
+	sa->mad_hdr.base_version = IB_MGMT_BASE_VERSION;
515
+	sa->mad_hdr.mgmt_class = IB_MGMT_CLASS_SUBN_ADM;
516
+	sa->mad_hdr.class_version = 2;
517
+	sa->mad_hdr.method =
517
 		( join ? IB_MGMT_METHOD_SET : IB_MGMT_METHOD_DELETE );
518
 		( join ? IB_MGMT_METHOD_SET : IB_MGMT_METHOD_DELETE );
518
-	mc_member_record->mad_hdr.attr_id = htons ( IB_SA_ATTR_MC_MEMBER_REC );
519
-	mc_member_record->mad_hdr.tid[0] = IPOIB_TID_MC_MEMBER_REC;
520
-	mc_member_record->mad_hdr.tid[1] = ipoib_meta_tid++;
521
-	mc_member_record->sa_hdr.comp_mask[1] =
519
+	sa->mad_hdr.attr_id = htons ( IB_SA_ATTR_MC_MEMBER_REC );
520
+	sa->mad_hdr.tid[0] = IPOIB_TID_MC_MEMBER_REC;
521
+	sa->mad_hdr.tid[1] = ipoib_meta_tid++;
522
+	sa->sa_hdr.comp_mask[1] =
522
 		htonl ( IB_SA_MCMEMBER_REC_MGID | IB_SA_MCMEMBER_REC_PORT_GID |
523
 		htonl ( IB_SA_MCMEMBER_REC_MGID | IB_SA_MCMEMBER_REC_PORT_GID |
523
 			IB_SA_MCMEMBER_REC_JOIN_STATE );
524
 			IB_SA_MCMEMBER_REC_JOIN_STATE );
524
-	mc_member_record->scope__join_state = 1;
525
-	memcpy ( &mc_member_record->mgid, gid,
526
-		 sizeof ( mc_member_record->mgid ) );
527
-	memcpy ( &mc_member_record->port_gid, &ibdev->gid,
528
-		 sizeof ( mc_member_record->port_gid ) );
525
+	sa->sa_data.mc_member_record.scope__join_state = 1;
526
+	memcpy ( &sa->sa_data.mc_member_record.mgid, gid,
527
+		 sizeof ( sa->sa_data.mc_member_record.mgid ) );
528
+	memcpy ( &sa->sa_data.mc_member_record.port_gid, &ibdev->gid,
529
+		 sizeof ( sa->sa_data.mc_member_record.port_gid ) );
529
 
530
 
530
 	/* Construct address vector */
531
 	/* Construct address vector */
531
 	memset ( &av, 0, sizeof ( av ) );
532
 	memset ( &av, 0, sizeof ( av ) );
701
  * @v path_record	Path record
702
  * @v path_record	Path record
702
  */
703
  */
703
 static void ipoib_recv_path_record ( struct ipoib_device *ipoib,
704
 static void ipoib_recv_path_record ( struct ipoib_device *ipoib,
704
-				     struct ib_mad_path_record *path_record ) {
705
+				     struct ib_path_record *path_record ) {
705
 	struct ipoib_peer *peer;
706
 	struct ipoib_peer *peer;
706
 
707
 
707
 	/* Locate peer cache entry */
708
 	/* Locate peer cache entry */
728
  * @v mc_member_record	Multicast membership record
729
  * @v mc_member_record	Multicast membership record
729
  */
730
  */
730
 static void ipoib_recv_mc_member_record ( struct ipoib_device *ipoib,
731
 static void ipoib_recv_mc_member_record ( struct ipoib_device *ipoib,
731
-			  struct ib_mad_mc_member_record *mc_member_record ) {
732
+			       struct ib_mc_member_record *mc_member_record ) {
732
 	int joined;
733
 	int joined;
733
 	int rc;
734
 	int rc;
734
 
735
 
765
 			   struct io_buffer *iobuf, int rc ) {
766
 			   struct io_buffer *iobuf, int rc ) {
766
 	struct net_device *netdev = ib_qp_get_ownerdata ( qp );
767
 	struct net_device *netdev = ib_qp_get_ownerdata ( qp );
767
 	struct ipoib_device *ipoib = netdev->priv;
768
 	struct ipoib_device *ipoib = netdev->priv;
768
-	union ib_mad *mad;
769
+	struct ib_mad_sa *sa;
769
 
770
 
770
 	if ( rc != 0 ) {
771
 	if ( rc != 0 ) {
771
 		DBGC ( ipoib, "IPoIB %p metadata RX completion error: %s\n",
772
 		DBGC ( ipoib, "IPoIB %p metadata RX completion error: %s\n",
773
 		goto done;
774
 		goto done;
774
 	}
775
 	}
775
 
776
 
776
-	if ( iob_len ( iobuf ) < sizeof ( *mad ) ) {
777
+	if ( iob_len ( iobuf ) < sizeof ( *sa ) ) {
777
 		DBGC ( ipoib, "IPoIB %p received metadata packet too short "
778
 		DBGC ( ipoib, "IPoIB %p received metadata packet too short "
778
 		       "to contain reply\n", ipoib );
779
 		       "to contain reply\n", ipoib );
779
 		DBGC_HD ( ipoib, iobuf->data, iob_len ( iobuf ) );
780
 		DBGC_HD ( ipoib, iobuf->data, iob_len ( iobuf ) );
780
 		goto done;
781
 		goto done;
781
 	}
782
 	}
782
-	mad = iobuf->data;
783
+	sa = iobuf->data;
783
 
784
 
784
-	if ( mad->hdr.status != 0 ) {
785
+	if ( sa->mad_hdr.status != 0 ) {
785
 		DBGC ( ipoib, "IPoIB %p metadata RX err status %04x\n",
786
 		DBGC ( ipoib, "IPoIB %p metadata RX err status %04x\n",
786
-		       ipoib, ntohs ( mad->hdr.status ) );
787
+		       ipoib, ntohs ( sa->mad_hdr.status ) );
787
 		goto done;
788
 		goto done;
788
 	}
789
 	}
789
 
790
 
790
-	switch ( mad->hdr.tid[0] ) {
791
+	switch ( sa->mad_hdr.tid[0] ) {
791
 	case IPOIB_TID_GET_PATH_REC:
792
 	case IPOIB_TID_GET_PATH_REC:
792
-		ipoib_recv_path_record ( ipoib, &mad->path_record );
793
+		ipoib_recv_path_record ( ipoib, &sa->sa_data.path_record );
793
 		break;
794
 		break;
794
 	case IPOIB_TID_MC_MEMBER_REC:
795
 	case IPOIB_TID_MC_MEMBER_REC:
795
-		ipoib_recv_mc_member_record ( ipoib, &mad->mc_member_record );
796
+		ipoib_recv_mc_member_record ( ipoib,
797
+					      &sa->sa_data.mc_member_record );
796
 		break;
798
 		break;
797
 	default:
799
 	default:
798
 		DBGC ( ipoib, "IPoIB %p unwanted response:\n",
800
 		DBGC ( ipoib, "IPoIB %p unwanted response:\n",
799
 		       ipoib );
801
 		       ipoib );
800
-		DBGC_HD ( ipoib, mad, sizeof ( *mad ) );
802
+		DBGC_HD ( ipoib, sa, sizeof ( *sa ) );
801
 		break;
803
 		break;
802
 	}
804
 	}
803
 
805
 

+ 115
- 92
src/include/gpxe/ib_mad.h Bestand weergeven

10
 #include <stdint.h>
10
 #include <stdint.h>
11
 #include <gpxe/ib_packet.h>
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
 	uint64_t mkey;
25
 	uint64_t mkey;
78
 	uint16_t slid;
26
 	uint16_t slid;
79
 	uint16_t dlid;
27
 	uint16_t dlid;
80
 	uint8_t reserved[28];
28
 	uint8_t reserved[28];
81
 } __attribute__ (( packed ));
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
 /** Subnet management class version */
31
 /** Subnet management class version */
91
 #define IB_SMP_CLASS_VERSION			1
32
 #define IB_SMP_CLASS_VERSION			1
92
 
33
 
242
 
183
 
243
 /** A subnet management directed route path */
184
 /** A subnet management directed route path */
244
 struct ib_smp_dr_path {
185
 struct ib_smp_dr_path {
245
-	uint8_t reserved;
246
-	uint8_t hops[63];
186
+	uint8_t hops[64];
247
 } __attribute__ (( packed ));
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
 } __attribute__ (( packed ));
204
 } __attribute__ (( packed ));
257
 
205
 
258
 struct ib_sa_hdr {
206
 struct ib_sa_hdr {
262
 	uint32_t comp_mask[2];
210
 	uint32_t comp_mask[2];
263
 } __attribute__ (( packed ));
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
 	uint32_t reserved0[2];
217
 	uint32_t reserved0[2];
274
 	struct ib_gid dgid;
218
 	struct ib_gid dgid;
275
 	struct ib_gid sgid;
219
 	struct ib_gid sgid;
285
 	uint32_t reserved2[35];
229
 	uint32_t reserved2[35];
286
 } __attribute__ (( packed ));
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
 	struct ib_gid mgid;
236
 	struct ib_gid mgid;
293
 	struct ib_gid port_gid;
237
 	struct ib_gid port_gid;
294
 	uint32_t qkey;
238
 	uint32_t qkey;
305
 	uint32_t reserved1[37];
249
 	uint32_t reserved1[37];
306
 } __attribute__ (( packed ));
250
 } __attribute__ (( packed ));
307
 
251
 
308
-#define IB_SA_ATTR_MC_MEMBER_REC		0x38
309
-#define IB_SA_ATTR_PATH_REC			0x35
310
-
311
 #define IB_SA_MCMEMBER_REC_MGID			(1<<0)
252
 #define IB_SA_MCMEMBER_REC_MGID			(1<<0)
312
 #define IB_SA_MCMEMBER_REC_PORT_GID		(1<<1)
253
 #define IB_SA_MCMEMBER_REC_PORT_GID		(1<<1)
313
 #define IB_SA_MCMEMBER_REC_QKEY			(1<<2)
254
 #define IB_SA_MCMEMBER_REC_QKEY			(1<<2)
327
 #define IB_SA_MCMEMBER_REC_JOIN_STATE		(1<<16)
268
 #define IB_SA_MCMEMBER_REC_JOIN_STATE		(1<<16)
328
 #define IB_SA_MCMEMBER_REC_PROXY_JOIN		(1<<17)
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
 union ib_mad {
357
 union ib_mad {
334
 	struct ib_mad_hdr hdr;
358
 	struct ib_mad_hdr hdr;
335
 	struct ib_mad_smp smp;
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
 	uint8_t bytes[256];
361
 	uint8_t bytes[256];
339
 } __attribute__ (( packed ));
362
 } __attribute__ (( packed ));
340
 
363
 

Laden…
Annuleren
Opslaan