Browse Source

[infiniband] Match GID/GUID terminology as used in the IBA

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 14 years ago
parent
commit
52e54a8c69

+ 6
- 6
src/drivers/infiniband/arbel.c View File

396
 }
396
 }
397
 
397
 
398
 static inline int
398
 static inline int
399
-arbel_cmd_mgid_hash ( struct arbel *arbel, const struct ib_gid *gid,
399
+arbel_cmd_mgid_hash ( struct arbel *arbel, const union ib_gid *gid,
400
 		      struct arbelprm_mgm_hash *hash ) {
400
 		      struct arbelprm_mgm_hash *hash ) {
401
 	return arbel_cmd ( arbel,
401
 	return arbel_cmd ( arbel,
402
 			   ARBEL_HCR_INOUT_CMD ( ARBEL_HCR_MGID_HASH,
402
 			   ARBEL_HCR_INOUT_CMD ( ARBEL_HCR_MGID_HASH,
998
 }
998
 }
999
 
999
 
1000
 /** GID used for GID-less send work queue entries */
1000
 /** GID used for GID-less send work queue entries */
1001
-static const struct ib_gid arbel_no_gid = {
1002
-	{ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0 } }
1001
+static const union ib_gid arbel_no_gid = {
1002
+	.bytes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0 },
1003
 };
1003
 };
1004
 
1004
 
1005
 /**
1005
 /**
1023
 	struct arbelprm_ud_send_wqe *wqe;
1023
 	struct arbelprm_ud_send_wqe *wqe;
1024
 	struct arbelprm_qp_db_record *qp_db_rec;
1024
 	struct arbelprm_qp_db_record *qp_db_rec;
1025
 	union arbelprm_doorbell_register db_reg;
1025
 	union arbelprm_doorbell_register db_reg;
1026
-	const struct ib_gid *gid;
1026
+	const union ib_gid *gid;
1027
 	unsigned int wqe_idx_mask;
1027
 	unsigned int wqe_idx_mask;
1028
 	size_t nds;
1028
 	size_t nds;
1029
 
1029
 
1565
  */
1565
  */
1566
 static int arbel_mcast_attach ( struct ib_device *ibdev,
1566
 static int arbel_mcast_attach ( struct ib_device *ibdev,
1567
 				struct ib_queue_pair *qp,
1567
 				struct ib_queue_pair *qp,
1568
-				struct ib_gid *gid ) {
1568
+				union ib_gid *gid ) {
1569
 	struct arbel *arbel = ib_get_drvdata ( ibdev );
1569
 	struct arbel *arbel = ib_get_drvdata ( ibdev );
1570
 	struct arbelprm_mgm_hash hash;
1570
 	struct arbelprm_mgm_hash hash;
1571
 	struct arbelprm_mgm_entry mgm;
1571
 	struct arbelprm_mgm_entry mgm;
1620
  */
1620
  */
1621
 static void arbel_mcast_detach ( struct ib_device *ibdev,
1621
 static void arbel_mcast_detach ( struct ib_device *ibdev,
1622
 				 struct ib_queue_pair *qp __unused,
1622
 				 struct ib_queue_pair *qp __unused,
1623
-				 struct ib_gid *gid ) {
1623
+				 union ib_gid *gid ) {
1624
 	struct arbel *arbel = ib_get_drvdata ( ibdev );
1624
 	struct arbel *arbel = ib_get_drvdata ( ibdev );
1625
 	struct arbelprm_mgm_hash hash;
1625
 	struct arbelprm_mgm_hash hash;
1626
 	struct arbelprm_mgm_entry mgm;
1626
 	struct arbelprm_mgm_entry mgm;

+ 3
- 3
src/drivers/infiniband/hermon.c View File

474
 }
474
 }
475
 
475
 
476
 static inline int
476
 static inline int
477
-hermon_cmd_mgid_hash ( struct hermon *hermon, const struct ib_gid *gid,
477
+hermon_cmd_mgid_hash ( struct hermon *hermon, const union ib_gid *gid,
478
 		       struct hermonprm_mgm_hash *hash ) {
478
 		       struct hermonprm_mgm_hash *hash ) {
479
 	return hermon_cmd ( hermon,
479
 	return hermon_cmd ( hermon,
480
 			    HERMON_HCR_INOUT_CMD ( HERMON_HCR_MGID_HASH,
480
 			    HERMON_HCR_INOUT_CMD ( HERMON_HCR_MGID_HASH,
2012
  */
2012
  */
2013
 static int hermon_mcast_attach ( struct ib_device *ibdev,
2013
 static int hermon_mcast_attach ( struct ib_device *ibdev,
2014
 				 struct ib_queue_pair *qp,
2014
 				 struct ib_queue_pair *qp,
2015
-				 struct ib_gid *gid ) {
2015
+				 union ib_gid *gid ) {
2016
 	struct hermon *hermon = ib_get_drvdata ( ibdev );
2016
 	struct hermon *hermon = ib_get_drvdata ( ibdev );
2017
 	struct hermonprm_mgm_hash hash;
2017
 	struct hermonprm_mgm_hash hash;
2018
 	struct hermonprm_mcg_entry mcg;
2018
 	struct hermonprm_mcg_entry mcg;
2066
  */
2066
  */
2067
 static void hermon_mcast_detach ( struct ib_device *ibdev,
2067
 static void hermon_mcast_detach ( struct ib_device *ibdev,
2068
 				  struct ib_queue_pair *qp __unused,
2068
 				  struct ib_queue_pair *qp __unused,
2069
-				  struct ib_gid *gid ) {
2069
+				  union ib_gid *gid ) {
2070
 	struct hermon *hermon = ib_get_drvdata ( ibdev );
2070
 	struct hermon *hermon = ib_get_drvdata ( ibdev );
2071
 	struct hermonprm_mgm_hash hash;
2071
 	struct hermonprm_mgm_hash hash;
2072
 	struct hermonprm_mcg_entry mcg;
2072
 	struct hermonprm_mcg_entry mcg;

+ 7
- 10
src/drivers/infiniband/linda.c View File

1456
  */
1456
  */
1457
 static int linda_mcast_attach ( struct ib_device *ibdev,
1457
 static int linda_mcast_attach ( struct ib_device *ibdev,
1458
 				struct ib_queue_pair *qp,
1458
 				struct ib_queue_pair *qp,
1459
-				struct ib_gid *gid ) {
1459
+				union ib_gid *gid ) {
1460
 	struct linda *linda = ib_get_drvdata ( ibdev );
1460
 	struct linda *linda = ib_get_drvdata ( ibdev );
1461
 
1461
 
1462
 	( void ) linda;
1462
 	( void ) linda;
1474
  */
1474
  */
1475
 static void linda_mcast_detach ( struct ib_device *ibdev,
1475
 static void linda_mcast_detach ( struct ib_device *ibdev,
1476
 				 struct ib_queue_pair *qp,
1476
 				 struct ib_queue_pair *qp,
1477
-				 struct ib_gid *gid ) {
1477
+				 union ib_gid *gid ) {
1478
 	struct linda *linda = ib_get_drvdata ( ibdev );
1478
 	struct linda *linda = ib_get_drvdata ( ibdev );
1479
 
1479
 
1480
 	( void ) linda;
1480
 	( void ) linda;
1631
  * @v guid		GUID to fill in
1631
  * @v guid		GUID to fill in
1632
  * @ret rc		Return status code
1632
  * @ret rc		Return status code
1633
  */
1633
  */
1634
-static int linda_read_eeprom ( struct linda *linda,
1635
-			       struct ib_gid_half *guid ) {
1634
+static int linda_read_eeprom ( struct linda *linda, union ib_guid *guid ) {
1636
 	struct i2c_interface *i2c = &linda->i2c.i2c;
1635
 	struct i2c_interface *i2c = &linda->i2c.i2c;
1637
 	int rc;
1636
 	int rc;
1638
 
1637
 
1639
 	/* Read GUID */
1638
 	/* Read GUID */
1640
 	if ( ( rc = i2c->read ( i2c, &linda->eeprom, LINDA_EEPROM_GUID_OFFSET,
1639
 	if ( ( rc = i2c->read ( i2c, &linda->eeprom, LINDA_EEPROM_GUID_OFFSET,
1641
-				guid->u.bytes, sizeof ( *guid ) ) ) != 0 ) {
1640
+				guid->bytes, sizeof ( *guid ) ) ) != 0 ) {
1642
 		DBGC ( linda, "Linda %p could not read GUID: %s\n",
1641
 		DBGC ( linda, "Linda %p could not read GUID: %s\n",
1643
 		       linda, strerror ( rc ) );
1642
 		       linda, strerror ( rc ) );
1644
 		return rc;
1643
 		return rc;
1645
 	}
1644
 	}
1646
-	DBGC2 ( linda, "Linda %p has GUID %02x:%02x:%02x:%02x:%02x:%02x:"
1647
-		"%02x:%02x\n", linda, guid->u.bytes[0], guid->u.bytes[1],
1648
-		guid->u.bytes[2], guid->u.bytes[3], guid->u.bytes[4],
1649
-		guid->u.bytes[5], guid->u.bytes[6], guid->u.bytes[7] );
1645
+	DBGC2 ( linda, "Linda %p has GUID " IB_GUID_FMT "\n",
1646
+		linda, IB_GUID_ARGS ( guid ) );
1650
 
1647
 
1651
 	/* Read serial number (debug only) */
1648
 	/* Read serial number (debug only) */
1652
 	if ( DBG_LOG ) {
1649
 	if ( DBG_LOG ) {
2367
 		goto err_init_i2c;
2364
 		goto err_init_i2c;
2368
 
2365
 
2369
 	/* Read EEPROM parameters */
2366
 	/* Read EEPROM parameters */
2370
-	if ( ( rc = linda_read_eeprom ( linda, &ibdev->gid.u.half[1] ) ) != 0 )
2367
+	if ( ( rc = linda_read_eeprom ( linda, &ibdev->gid.s.guid ) ) != 0 )
2371
 		goto err_read_eeprom;
2368
 		goto err_read_eeprom;
2372
 
2369
 
2373
 	/* Initialise send datapath */
2370
 	/* Initialise send datapath */

+ 11
- 13
src/drivers/infiniband/qib7322.c View File

118
 	struct i2c_device eeprom;
118
 	struct i2c_device eeprom;
119
 
119
 
120
 	/** Base GUID */
120
 	/** Base GUID */
121
-	struct ib_gid_half guid;
121
+	union ib_guid guid;
122
 	/** Infiniband devices */
122
 	/** Infiniband devices */
123
 	struct ib_device *ibdev[QIB7322_MAX_PORTS];
123
 	struct ib_device *ibdev[QIB7322_MAX_PORTS];
124
 };
124
 };
1770
  */
1770
  */
1771
 static int qib7322_mcast_attach ( struct ib_device *ibdev,
1771
 static int qib7322_mcast_attach ( struct ib_device *ibdev,
1772
 				  struct ib_queue_pair *qp,
1772
 				  struct ib_queue_pair *qp,
1773
-				  struct ib_gid *gid ) {
1773
+				  union ib_gid *gid ) {
1774
 	struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
1774
 	struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
1775
 
1775
 
1776
 	( void ) qib7322;
1776
 	( void ) qib7322;
1788
  */
1788
  */
1789
 static void qib7322_mcast_detach ( struct ib_device *ibdev,
1789
 static void qib7322_mcast_detach ( struct ib_device *ibdev,
1790
 				   struct ib_queue_pair *qp,
1790
 				   struct ib_queue_pair *qp,
1791
-				   struct ib_gid *gid ) {
1791
+				   union ib_gid *gid ) {
1792
 	struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
1792
 	struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
1793
 
1793
 
1794
 	( void ) qib7322;
1794
 	( void ) qib7322;
1946
  */
1946
  */
1947
 static int qib7322_read_eeprom ( struct qib7322 *qib7322 ) {
1947
 static int qib7322_read_eeprom ( struct qib7322 *qib7322 ) {
1948
 	struct i2c_interface *i2c = &qib7322->i2c.i2c;
1948
 	struct i2c_interface *i2c = &qib7322->i2c.i2c;
1949
-	struct ib_gid_half *guid = &qib7322->guid;
1949
+	union ib_guid *guid = &qib7322->guid;
1950
 	int rc;
1950
 	int rc;
1951
 
1951
 
1952
 	/* Read GUID */
1952
 	/* Read GUID */
1953
 	if ( ( rc = i2c->read ( i2c, &qib7322->eeprom,
1953
 	if ( ( rc = i2c->read ( i2c, &qib7322->eeprom,
1954
-				QIB7322_EEPROM_GUID_OFFSET, guid->u.bytes,
1954
+				QIB7322_EEPROM_GUID_OFFSET, guid->bytes,
1955
 				sizeof ( *guid ) ) ) != 0 ) {
1955
 				sizeof ( *guid ) ) ) != 0 ) {
1956
 		DBGC ( qib7322, "QIB7322 %p could not read GUID: %s\n",
1956
 		DBGC ( qib7322, "QIB7322 %p could not read GUID: %s\n",
1957
 		       qib7322, strerror ( rc ) );
1957
 		       qib7322, strerror ( rc ) );
1958
 		return rc;
1958
 		return rc;
1959
 	}
1959
 	}
1960
-	DBGC2 ( qib7322, "QIB7322 %p has GUID %02x:%02x:%02x:%02x:%02x:%02x:"
1961
-		"%02x:%02x\n", qib7322, guid->u.bytes[0], guid->u.bytes[1],
1962
-		guid->u.bytes[2], guid->u.bytes[3], guid->u.bytes[4],
1963
-		guid->u.bytes[5], guid->u.bytes[6], guid->u.bytes[7] );
1960
+	DBGC2 ( qib7322, "QIB7322 %p has GUID " IB_GUID_FMT "\n",
1961
+		qib7322, IB_GUID_ARGS ( guid ) );
1964
 
1962
 
1965
 	/* Read serial number (debug only) */
1963
 	/* Read serial number (debug only) */
1966
 	if ( DBG_LOG ) {
1964
 	if ( DBG_LOG ) {
2359
 			IB_LINK_WIDTH_4X; /* 1x does not work */
2357
 			IB_LINK_WIDTH_4X; /* 1x does not work */
2360
 		ibdev->link_speed_enabled = ibdev->link_speed_supported =
2358
 		ibdev->link_speed_enabled = ibdev->link_speed_supported =
2361
 			IB_LINK_SPEED_SDR; /* to avoid need for link tuning */
2359
 			IB_LINK_SPEED_SDR; /* to avoid need for link tuning */
2362
-		memcpy ( &ibdev->gid.u.half[1], &qib7322->guid,
2363
-			 sizeof ( ibdev->gid.u.half[1] ) );
2364
-		assert ( ( ibdev->gid.u.half[1].u.bytes[7] & i ) == 0 );
2365
-		ibdev->gid.u.half[1].u.bytes[7] |= i;
2360
+		memcpy ( &ibdev->gid.s.guid, &qib7322->guid,
2361
+			 sizeof ( ibdev->gid.s.guid ) );
2362
+		assert ( ( ibdev->gid.s.guid.bytes[7] & i ) == 0 );
2363
+		ibdev->gid.s.guid.bytes[7] |= i;
2366
 		ib_set_drvdata ( ibdev, qib7322 );
2364
 		ib_set_drvdata ( ibdev, qib7322 );
2367
 	}
2365
 	}
2368
 
2366
 

+ 25
- 25
src/drivers/net/ipoib.c View File

72
 /** Broadcast IPoIB address */
72
 /** Broadcast IPoIB address */
73
 static struct ipoib_mac ipoib_broadcast = {
73
 static struct ipoib_mac ipoib_broadcast = {
74
 	.flags__qpn = htonl ( IB_QPN_BROADCAST ),
74
 	.flags__qpn = htonl ( IB_QPN_BROADCAST ),
75
-	.gid.u.bytes = 	{ 0xff, 0x12, 0x40, 0x1b, 0x00, 0x00, 0x00, 0x00,
76
-			  0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff },
75
+	.gid.bytes = { 0xff, 0x12, 0x40, 0x1b, 0x00, 0x00, 0x00, 0x00,
76
+		       0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff },
77
 };
77
 };
78
 
78
 
79
 /** Link status for "broadcast join in progress" */
79
 /** Link status for "broadcast join in progress" */
266
  * @v ll_addr		Link-layer address
266
  * @v ll_addr		Link-layer address
267
  */
267
  */
268
 static void ipoib_init_addr ( const void *hw_addr, void *ll_addr ) {
268
 static void ipoib_init_addr ( const void *hw_addr, void *ll_addr ) {
269
-	const struct ib_gid_half *guid = hw_addr;
269
+	const union ib_guid *guid = hw_addr;
270
 	struct ipoib_mac *mac = ll_addr;
270
 	struct ipoib_mac *mac = ll_addr;
271
 
271
 
272
 	memset ( mac, 0, sizeof ( *mac ) );
272
 	memset ( mac, 0, sizeof ( *mac ) );
273
-	memcpy ( &mac->gid.u.half[1], guid, sizeof ( mac->gid.u.half[1] ) );
273
+	memcpy ( &mac->gid.s.guid, guid, sizeof ( mac->gid.s.guid ) );
274
 }
274
 }
275
 
275
 
276
 /**
276
 /**
284
 	const struct ipoib_mac *mac = ll_addr;
284
 	const struct ipoib_mac *mac = ll_addr;
285
 
285
 
286
 	snprintf ( buf, sizeof ( buf ), "%08x:%08x:%08x:%08x:%08x",
286
 	snprintf ( buf, sizeof ( buf ), "%08x:%08x:%08x:%08x:%08x",
287
-		   htonl ( mac->flags__qpn ), htonl ( mac->gid.u.dwords[0] ),
288
-		   htonl ( mac->gid.u.dwords[1] ),
289
-		   htonl ( mac->gid.u.dwords[2] ),
290
-		   htonl ( mac->gid.u.dwords[3] ) );
287
+		   htonl ( mac->flags__qpn ), htonl ( mac->gid.dwords[0] ),
288
+		   htonl ( mac->gid.dwords[1] ),
289
+		   htonl ( mac->gid.dwords[2] ),
290
+		   htonl ( mac->gid.dwords[3] ) );
291
 	return buf;
291
 	return buf;
292
 }
292
 }
293
 
293
 
312
  * @v ll_addr		Link-layer address
312
  * @v ll_addr		Link-layer address
313
  * @v eth_addr		Ethernet-compatible address to fill in
313
  * @v eth_addr		Ethernet-compatible address to fill in
314
  */
314
  */
315
-static int ipoib_mlx_eth_addr ( const struct ib_gid_half *guid,
315
+static int ipoib_mlx_eth_addr ( const union ib_guid *guid,
316
 				uint8_t *eth_addr ) {
316
 				uint8_t *eth_addr ) {
317
-	eth_addr[0] = ( ( guid->u.bytes[3] == 2 ) ? 0x00 : 0x02 );
318
-	eth_addr[1] = guid->u.bytes[1];
319
-	eth_addr[2] = guid->u.bytes[2];
320
-	eth_addr[3] = guid->u.bytes[5];
321
-	eth_addr[4] = guid->u.bytes[6];
322
-	eth_addr[5] = guid->u.bytes[7];
317
+	eth_addr[0] = ( ( guid->bytes[3] == 2 ) ? 0x00 : 0x02 );
318
+	eth_addr[1] = guid->bytes[1];
319
+	eth_addr[2] = guid->bytes[2];
320
+	eth_addr[3] = guid->bytes[5];
321
+	eth_addr[4] = guid->bytes[6];
322
+	eth_addr[5] = guid->bytes[7];
323
 	return 0;
323
 	return 0;
324
 }
324
 }
325
 
325
 
330
 	/** GUID byte 2 */
330
 	/** GUID byte 2 */
331
 	uint8_t byte2;
331
 	uint8_t byte2;
332
 	/** Handler */
332
 	/** Handler */
333
-	int ( * eth_addr ) ( const struct ib_gid_half *guid,
333
+	int ( * eth_addr ) ( const union ib_guid *guid,
334
 			     uint8_t *eth_addr );
334
 			     uint8_t *eth_addr );
335
 };
335
 };
336
 
336
 
347
  */
347
  */
348
 static int ipoib_eth_addr ( const void *ll_addr, void *eth_addr ) {
348
 static int ipoib_eth_addr ( const void *ll_addr, void *eth_addr ) {
349
 	const struct ipoib_mac *ipoib_addr = ll_addr;
349
 	const struct ipoib_mac *ipoib_addr = ll_addr;
350
-	const struct ib_gid_half *guid = &ipoib_addr->gid.u.half[1];
350
+	const union ib_guid *guid = &ipoib_addr->gid.s.guid;
351
 	struct ipoib_eth_addr_handler *handler;
351
 	struct ipoib_eth_addr_handler *handler;
352
 	unsigned int i;
352
 	unsigned int i;
353
 
353
 
354
 	for ( i = 0 ; i < ( sizeof ( ipoib_eth_addr_handlers ) /
354
 	for ( i = 0 ; i < ( sizeof ( ipoib_eth_addr_handlers ) /
355
 			    sizeof ( ipoib_eth_addr_handlers[0] ) ) ; i++ ) {
355
 			    sizeof ( ipoib_eth_addr_handlers[0] ) ) ; i++ ) {
356
 		handler = &ipoib_eth_addr_handlers[i];
356
 		handler = &ipoib_eth_addr_handlers[i];
357
-		if ( ( handler->byte1 == guid->u.bytes[1] ) &&
358
-		     ( handler->byte2 == guid->u.bytes[2] ) ) {
357
+		if ( ( handler->byte1 == guid->bytes[1] ) &&
358
+		     ( handler->byte2 == guid->bytes[2] ) ) {
359
 			return handler->eth_addr ( guid, eth_addr );
359
 			return handler->eth_addr ( guid, eth_addr );
360
 		}
360
 		}
361
 	}
361
 	}
366
 struct ll_protocol ipoib_protocol __ll_protocol = {
366
 struct ll_protocol ipoib_protocol __ll_protocol = {
367
 	.name		= "IPoIB",
367
 	.name		= "IPoIB",
368
 	.ll_proto	= htons ( ARPHRD_INFINIBAND ),
368
 	.ll_proto	= htons ( ARPHRD_INFINIBAND ),
369
-	.hw_addr_len	= sizeof ( struct ib_gid_half ),
369
+	.hw_addr_len	= sizeof ( union ib_guid ),
370
 	.ll_addr_len	= IPOIB_ALEN,
370
 	.ll_addr_len	= IPOIB_ALEN,
371
 	.ll_header_len	= IPOIB_HLEN,
371
 	.ll_header_len	= IPOIB_HLEN,
372
 	.push		= ipoib_push,
372
 	.push		= ipoib_push,
612
 	ipoib_leave_broadcast_group ( ipoib );
612
 	ipoib_leave_broadcast_group ( ipoib );
613
 
613
 
614
 	/* Update MAC address based on potentially-new GID prefix */
614
 	/* Update MAC address based on potentially-new GID prefix */
615
-	memcpy ( &mac->gid.u.half[0], &ibdev->gid.u.half[0],
616
-		 sizeof ( mac->gid.u.half[0] ) );
615
+	memcpy ( &mac->gid.s.prefix, &ibdev->gid.s.prefix,
616
+		 sizeof ( mac->gid.s.prefix ) );
617
 
617
 
618
 	/* Update broadcast GID based on potentially-new partition key */
618
 	/* Update broadcast GID based on potentially-new partition key */
619
-	ipoib->broadcast.gid.u.words[2] =
619
+	ipoib->broadcast.gid.words[2] =
620
 		htons ( ibdev->pkey | IB_PKEY_FULL );
620
 		htons ( ibdev->pkey | IB_PKEY_FULL );
621
 
621
 
622
 	/* Set net device link state to reflect Infiniband link state */
622
 	/* Set net device link state to reflect Infiniband link state */
750
 	ipoib->ibdev = ibdev;
750
 	ipoib->ibdev = ibdev;
751
 
751
 
752
 	/* Extract hardware address */
752
 	/* Extract hardware address */
753
-	memcpy ( netdev->hw_addr, &ibdev->gid.u.half[1],
754
-		 sizeof ( ibdev->gid.u.half[1] ) );
753
+	memcpy ( netdev->hw_addr, &ibdev->gid.s.guid,
754
+		 sizeof ( ibdev->gid.s.guid ) );
755
 
755
 
756
 	/* Set default broadcast address */
756
 	/* Set default broadcast address */
757
 	memcpy ( &ipoib->broadcast, &ipoib_broadcast,
757
 	memcpy ( &ipoib->broadcast, &ipoib_broadcast,

+ 2
- 2
src/include/ipxe/ib_cm.h View File

42
 	/** Remote communication ID */
42
 	/** Remote communication ID */
43
 	uint32_t remote_id;
43
 	uint32_t remote_id;
44
 	/** Target service ID */
44
 	/** Target service ID */
45
-	struct ib_gid_half service_id;
45
+	union ib_guid service_id;
46
 	/** Connection operations */
46
 	/** Connection operations */
47
 	struct ib_connection_operations *op;
47
 	struct ib_connection_operations *op;
48
 
48
 
62
 
62
 
63
 extern struct ib_connection *
63
 extern struct ib_connection *
64
 ib_create_conn ( struct ib_device *ibdev, struct ib_queue_pair *qp,
64
 ib_create_conn ( struct ib_device *ibdev, struct ib_queue_pair *qp,
65
-		 struct ib_gid *dgid, struct ib_gid_half *service_id,
65
+		 union ib_gid *dgid, union ib_guid *service_id,
66
 		 void *req_private_data, size_t req_private_data_len,
66
 		 void *req_private_data, size_t req_private_data_len,
67
 		 struct ib_connection_operations *op );
67
 		 struct ib_connection_operations *op );
68
 extern void ib_destroy_conn ( struct ib_device *ibdev,
68
 extern void ib_destroy_conn ( struct ib_device *ibdev,

+ 2
- 2
src/include/ipxe/ib_cmrc.h View File

14
 
14
 
15
 extern int ib_cmrc_open ( struct interface *xfer,
15
 extern int ib_cmrc_open ( struct interface *xfer,
16
 			  struct ib_device *ibdev,
16
 			  struct ib_device *ibdev,
17
-			  struct ib_gid *dgid,
18
-			  struct ib_gid_half *service_id );
17
+			  union ib_gid *dgid,
18
+			  union ib_guid *service_id );
19
 
19
 
20
 #endif /* _IPXE_IB_CMRC_H */
20
 #endif /* _IPXE_IB_CMRC_H */

+ 12
- 12
src/include/ipxe/ib_mad.h View File

75
 	uint8_t class_version;
75
 	uint8_t class_version;
76
 	uint8_t node_type;
76
 	uint8_t node_type;
77
 	uint8_t num_ports;
77
 	uint8_t num_ports;
78
-	struct ib_gid_half sys_guid;
79
-	struct ib_gid_half node_guid;
80
-	struct ib_gid_half port_guid;
78
+	union ib_guid sys_guid;
79
+	union ib_guid node_guid;
80
+	union ib_guid port_guid;
81
 	uint16_t partition_cap;
81
 	uint16_t partition_cap;
82
 	uint16_t device_id;
82
 	uint16_t device_id;
83
 	uint32_t revision;
83
 	uint32_t revision;
221
 
221
 
222
 struct ib_path_record {
222
 struct ib_path_record {
223
 	uint32_t reserved0[2];
223
 	uint32_t reserved0[2];
224
-	struct ib_gid dgid;
225
-	struct ib_gid sgid;
224
+	union ib_gid dgid;
225
+	union ib_gid sgid;
226
 	uint16_t dlid;
226
 	uint16_t dlid;
227
 	uint16_t slid;
227
 	uint16_t slid;
228
 	uint32_t hop_limit__flow_label__raw_traffic;
228
 	uint32_t hop_limit__flow_label__raw_traffic;
239
 #define IB_SA_PATH_REC_SGID			(1<<3)
239
 #define IB_SA_PATH_REC_SGID			(1<<3)
240
 
240
 
241
 struct ib_mc_member_record {
241
 struct ib_mc_member_record {
242
-	struct ib_gid mgid;
243
-	struct ib_gid port_gid;
242
+	union ib_gid mgid;
243
+	union ib_gid port_gid;
244
 	uint32_t qkey;
244
 	uint32_t qkey;
245
 	uint16_t mlid;
245
 	uint16_t mlid;
246
 	uint8_t mtu_selector__mtu;
246
 	uint8_t mtu_selector__mtu;
320
 	/** Remote port LID */
320
 	/** Remote port LID */
321
 	uint16_t remote_lid;
321
 	uint16_t remote_lid;
322
 	/** Local port GID */
322
 	/** Local port GID */
323
-	struct ib_gid local_gid;
323
+	union ib_gid local_gid;
324
 	/** Remote port GID */
324
 	/** Remote port GID */
325
-	struct ib_gid remote_gid;
325
+	union ib_gid remote_gid;
326
 	/** Flow label and rate */
326
 	/** Flow label and rate */
327
 	uint32_t flow_label__rate;
327
 	uint32_t flow_label__rate;
328
 	/** Traffic class */
328
 	/** Traffic class */
345
 	/** Reserved */
345
 	/** Reserved */
346
 	uint32_t reserved0[1];
346
 	uint32_t reserved0[1];
347
 	/** Service ID */
347
 	/** Service ID */
348
-	struct ib_gid_half service_id;
348
+	union ib_guid service_id;
349
 	/** Local CA GUID */
349
 	/** Local CA GUID */
350
-	struct ib_gid_half local_ca;
350
+	union ib_guid local_ca;
351
 	/** Reserved */
351
 	/** Reserved */
352
 	uint32_t reserved1[1];
352
 	uint32_t reserved1[1];
353
 	/** Local queue key */
353
 	/** Local queue key */
433
 	/** RNR retry count, SRQ */
433
 	/** RNR retry count, SRQ */
434
 	uint8_t rnr_retry__srq;
434
 	uint8_t rnr_retry__srq;
435
 	/** Local CA GUID */
435
 	/** Local CA GUID */
436
-	struct ib_gid_half local_ca;
436
+	union ib_guid local_ca;
437
 	/** Private data */
437
 	/** Private data */
438
 	uint8_t private_data[196];
438
 	uint8_t private_data[196];
439
 } __attribute__ (( packed ));
439
 } __attribute__ (( packed ));

+ 2
- 2
src/include/ipxe/ib_mcast.h View File

18
 	/** Queue pair */
18
 	/** Queue pair */
19
 	struct ib_queue_pair *qp;
19
 	struct ib_queue_pair *qp;
20
 	/** Multicast GID */
20
 	/** Multicast GID */
21
-	struct ib_gid gid;
21
+	union ib_gid gid;
22
 	/** Multicast group join transaction */
22
 	/** Multicast group join transaction */
23
 	struct ib_mad_transaction *madx;
23
 	struct ib_mad_transaction *madx;
24
 	/** Handle join success/failure
24
 	/** Handle join success/failure
36
 
36
 
37
 extern int ib_mcast_join ( struct ib_device *ibdev, struct ib_queue_pair *qp,
37
 extern int ib_mcast_join ( struct ib_device *ibdev, struct ib_queue_pair *qp,
38
 			   struct ib_mc_membership *membership,
38
 			   struct ib_mc_membership *membership,
39
-			   struct ib_gid *gid,
39
+			   union ib_gid *gid,
40
 			   void ( * joined ) ( struct ib_device *ibdev,
40
 			   void ( * joined ) ( struct ib_device *ibdev,
41
 					       struct ib_queue_pair *qp,
41
 					       struct ib_queue_pair *qp,
42
 					       struct ib_mc_membership *memb,
42
 					       struct ib_mc_membership *memb,

+ 29
- 16
src/include/ipxe/ib_packet.h View File

14
 struct ib_address_vector;
14
 struct ib_address_vector;
15
 struct io_buffer;
15
 struct io_buffer;
16
 
16
 
17
-/** Half of an Infiniband Global Identifier */
18
-struct ib_gid_half {
19
-	union {
20
-		uint8_t bytes[8];
21
-		uint16_t words[4];
22
-		uint32_t dwords[2];
23
-	} u;
17
+/** An Infiniband Globally Unique Identifier */
18
+union ib_guid {
19
+	uint8_t bytes[8];
20
+	uint16_t words[4];
21
+	uint32_t dwords[2];
24
 };
22
 };
25
 
23
 
24
+/** Infiniband Globally Unique Identifier debug message format */
25
+#define IB_GUID_FMT "%08x:%08x"
26
+
27
+/** Infiniband Globally Unique Identifier debug message arguments */
28
+#define IB_GUID_ARGS( guid ) \
29
+	ntohl ( (guid)->dwords[0] ), ntohl ( (guid)->dwords[1] )
30
+
26
 /** An Infiniband Global Identifier */
31
 /** An Infiniband Global Identifier */
27
-struct ib_gid {
28
-	union {
29
-		uint8_t bytes[16];
30
-		uint16_t words[8];
31
-		uint32_t dwords[4];
32
-		struct ib_gid_half half[2];
33
-	} u;
32
+union ib_gid {
33
+	uint8_t bytes[16];
34
+	uint16_t words[8];
35
+	uint32_t dwords[4];
36
+	struct {
37
+		union ib_guid prefix;
38
+		union ib_guid guid;
39
+	} s;
34
 };
40
 };
35
 
41
 
42
+/** Infiniband Global Identifier debug message format */
43
+#define IB_GID_FMT IB_GUID_FMT ":" IB_GUID_FMT
44
+
45
+/** Infiniband Global Identifier debug message arguments */
46
+#define IB_GID_ARGS( gid ) \
47
+	IB_GUID_ARGS ( &(gid)->s.prefix ), IB_GUID_ARGS ( &(gid)->s.guid )
48
+
36
 /** An Infiniband Local Route Header */
49
 /** An Infiniband Local Route Header */
37
 struct ib_local_route_header {
50
 struct ib_local_route_header {
38
 	/** Virtual lane and link version */
51
 	/** Virtual lane and link version */
83
 	/** Hop limit */
96
 	/** Hop limit */
84
 	uint8_t hoplmt;
97
 	uint8_t hoplmt;
85
 	/** Source GID */
98
 	/** Source GID */
86
-	struct ib_gid sgid;
99
+	union ib_gid sgid;
87
 	/** Destiniation GID */
100
 	/** Destiniation GID */
88
-	struct ib_gid dgid;
101
+	union ib_gid dgid;
89
 } __attribute__ (( packed ));
102
 } __attribute__ (( packed ));
90
 
103
 
91
 #define IB_GRH_IPVER_IPv6 0x06
104
 #define IB_GRH_IPVER_IPv6 0x06

+ 7
- 7
src/include/ipxe/ib_srp.h View File

20
 	/** Infiniband version of port identifier */
20
 	/** Infiniband version of port identifier */
21
 	struct {
21
 	struct {
22
 		/** Identifier extension */
22
 		/** Identifier extension */
23
-		struct ib_gid_half id_ext;
23
+		union ib_guid id_ext;
24
 		/** IB channel adapter GUID */
24
 		/** IB channel adapter GUID */
25
-		struct ib_gid_half hca_guid;
25
+		union ib_guid hca_guid;
26
 	} __attribute__ (( packed )) ib;
26
 	} __attribute__ (( packed )) ib;
27
 };
27
 };
28
 
28
 
33
 	/** Infiniband version of port identifier */
33
 	/** Infiniband version of port identifier */
34
 	struct {
34
 	struct {
35
 		/** Identifier extension */
35
 		/** Identifier extension */
36
-		struct ib_gid_half id_ext;
36
+		union ib_guid id_ext;
37
 		/** I/O controller GUID */
37
 		/** I/O controller GUID */
38
-		struct ib_gid_half ioc_guid;
38
+		union ib_guid ioc_guid;
39
 	} __attribute__ (( packed )) ib;
39
 	} __attribute__ (( packed )) ib;
40
 };
40
 };
41
 
41
 
44
  */
44
  */
45
 struct sbft_ib_subtable {
45
 struct sbft_ib_subtable {
46
 	/** Source GID */
46
 	/** Source GID */
47
-	struct ib_gid sgid;
47
+	union ib_gid sgid;
48
 	/** Destination GID */
48
 	/** Destination GID */
49
-	struct ib_gid dgid;
49
+	union ib_gid dgid;
50
 	/** Service ID */
50
 	/** Service ID */
51
-	struct ib_gid_half service_id;
51
+	union ib_guid service_id;
52
 	/** Partition key */
52
 	/** Partition key */
53
 	uint16_t pkey;
53
 	uint16_t pkey;
54
 	/** Reserved */
54
 	/** Reserved */

+ 10
- 10
src/include/ipxe/infiniband.h View File

88
 	/** GID is present */
88
 	/** GID is present */
89
 	unsigned int gid_present;
89
 	unsigned int gid_present;
90
 	/** GID, if present */
90
 	/** GID, if present */
91
-	struct ib_gid gid;
91
+	union ib_gid gid;
92
 };
92
 };
93
 
93
 
94
 /** An Infiniband Work Queue */
94
 /** An Infiniband Work Queue */
126
 	/** List of multicast GIDs on this QP */
126
 	/** List of multicast GIDs on this QP */
127
 	struct list_head list;
127
 	struct list_head list;
128
 	/** Multicast GID */
128
 	/** Multicast GID */
129
-	struct ib_gid gid;
129
+	union ib_gid gid;
130
 };
130
 };
131
 
131
 
132
 /** An Infiniband queue pair type */
132
 /** An Infiniband queue pair type */
338
 	 */
338
 	 */
339
 	int ( * mcast_attach ) ( struct ib_device *ibdev,
339
 	int ( * mcast_attach ) ( struct ib_device *ibdev,
340
 				 struct ib_queue_pair *qp,
340
 				 struct ib_queue_pair *qp,
341
-				 struct ib_gid *gid );
341
+				 union ib_gid *gid );
342
 	/** Detach from multicast group
342
 	/** Detach from multicast group
343
 	 *
343
 	 *
344
 	 * @v ibdev		Infiniband device
344
 	 * @v ibdev		Infiniband device
347
 	 */
347
 	 */
348
 	void ( * mcast_detach ) ( struct ib_device *ibdev,
348
 	void ( * mcast_detach ) ( struct ib_device *ibdev,
349
 				  struct ib_queue_pair *qp,
349
 				  struct ib_queue_pair *qp,
350
-				  struct ib_gid *gid );
350
+				  union ib_gid *gid );
351
 	/** Set port information
351
 	/** Set port information
352
 	 *
352
 	 *
353
 	 * @v ibdev		Infiniband device
353
 	 * @v ibdev		Infiniband device
405
 	/** Link speed active */
405
 	/** Link speed active */
406
 	uint8_t link_speed_active;
406
 	uint8_t link_speed_active;
407
 	/** Port GID */
407
 	/** Port GID */
408
-	struct ib_gid gid;
408
+	union ib_gid gid;
409
 	/** Port LID */
409
 	/** Port LID */
410
 	uint16_t lid;
410
 	uint16_t lid;
411
 	/** Subnet manager LID */
411
 	/** Subnet manager LID */
479
 extern struct ib_queue_pair * ib_find_qp_qpn ( struct ib_device *ibdev,
479
 extern struct ib_queue_pair * ib_find_qp_qpn ( struct ib_device *ibdev,
480
 					       unsigned long qpn );
480
 					       unsigned long qpn );
481
 extern struct ib_queue_pair * ib_find_qp_mgid ( struct ib_device *ibdev,
481
 extern struct ib_queue_pair * ib_find_qp_mgid ( struct ib_device *ibdev,
482
-						struct ib_gid *gid );
482
+						union ib_gid *gid );
483
 extern struct ib_work_queue * ib_find_wq ( struct ib_completion_queue *cq,
483
 extern struct ib_work_queue * ib_find_wq ( struct ib_completion_queue *cq,
484
 					   unsigned long qpn, int is_send );
484
 					   unsigned long qpn, int is_send );
485
 extern int ib_post_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
485
 extern int ib_post_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
500
 extern void ib_close ( struct ib_device *ibdev );
500
 extern void ib_close ( struct ib_device *ibdev );
501
 extern int ib_link_rc ( struct ib_device *ibdev );
501
 extern int ib_link_rc ( struct ib_device *ibdev );
502
 extern int ib_mcast_attach ( struct ib_device *ibdev, struct ib_queue_pair *qp,
502
 extern int ib_mcast_attach ( struct ib_device *ibdev, struct ib_queue_pair *qp,
503
-			     struct ib_gid *gid );
503
+			     union ib_gid *gid );
504
 extern void ib_mcast_detach ( struct ib_device *ibdev,
504
 extern void ib_mcast_detach ( struct ib_device *ibdev,
505
-			      struct ib_queue_pair *qp, struct ib_gid *gid );
505
+			      struct ib_queue_pair *qp, union ib_gid *gid );
506
 extern int ib_get_hca_info ( struct ib_device *ibdev,
506
 extern int ib_get_hca_info ( struct ib_device *ibdev,
507
-			     struct ib_gid_half *hca_guid );
507
+			     union ib_guid *hca_guid );
508
 extern int ib_set_port_info ( struct ib_device *ibdev, union ib_mad *mad );
508
 extern int ib_set_port_info ( struct ib_device *ibdev, union ib_mad *mad );
509
 extern int ib_set_pkey_table ( struct ib_device *ibdev, union ib_mad *mad );
509
 extern int ib_set_pkey_table ( struct ib_device *ibdev, union ib_mad *mad );
510
 extern struct ib_device * alloc_ibdev ( size_t priv_size );
510
 extern struct ib_device * alloc_ibdev ( size_t priv_size );
511
 extern int register_ibdev ( struct ib_device *ibdev );
511
 extern int register_ibdev ( struct ib_device *ibdev );
512
 extern void unregister_ibdev ( struct ib_device *ibdev );
512
 extern void unregister_ibdev ( struct ib_device *ibdev );
513
-extern struct ib_device * find_ibdev ( struct ib_gid *gid );
513
+extern struct ib_device * find_ibdev ( union ib_gid *gid );
514
 extern struct ib_device * last_opened_ibdev ( void );
514
 extern struct ib_device * last_opened_ibdev ( void );
515
 extern void ib_link_state_changed ( struct ib_device *ibdev );
515
 extern void ib_link_state_changed ( struct ib_device *ibdev );
516
 extern void ib_poll_eq ( struct ib_device *ibdev );
516
 extern void ib_poll_eq ( struct ib_device *ibdev );

+ 1
- 1
src/include/ipxe/ipoib.h View File

22
 	 */
22
 	 */
23
 	uint32_t flags__qpn;
23
 	uint32_t flags__qpn;
24
 	/** Port GID */
24
 	/** Port GID */
25
-	struct ib_gid gid;
25
+	union ib_gid gid;
26
 } __attribute__ (( packed ));
26
 } __attribute__ (( packed ));
27
 
27
 
28
 /** IPoIB link-layer header length */
28
 /** IPoIB link-layer header length */

+ 6
- 7
src/net/infiniband.c View File

341
  * @ret qp		Queue pair, or NULL
341
  * @ret qp		Queue pair, or NULL
342
  */
342
  */
343
 struct ib_queue_pair * ib_find_qp_mgid ( struct ib_device *ibdev,
343
 struct ib_queue_pair * ib_find_qp_mgid ( struct ib_device *ibdev,
344
-					 struct ib_gid *gid ) {
344
+					 union ib_gid *gid ) {
345
 	struct ib_queue_pair *qp;
345
 	struct ib_queue_pair *qp;
346
 	struct ib_multicast_gid *mgid;
346
 	struct ib_multicast_gid *mgid;
347
 
347
 
703
  * the multicast group on the subnet.
703
  * the multicast group on the subnet.
704
  */
704
  */
705
 int ib_mcast_attach ( struct ib_device *ibdev, struct ib_queue_pair *qp,
705
 int ib_mcast_attach ( struct ib_device *ibdev, struct ib_queue_pair *qp,
706
-		      struct ib_gid *gid ) {
706
+		      union ib_gid *gid ) {
707
 	struct ib_multicast_gid *mgid;
707
 	struct ib_multicast_gid *mgid;
708
 	int rc;
708
 	int rc;
709
 
709
 
737
  * @v gid		Multicast GID
737
  * @v gid		Multicast GID
738
  */
738
  */
739
 void ib_mcast_detach ( struct ib_device *ibdev, struct ib_queue_pair *qp,
739
 void ib_mcast_detach ( struct ib_device *ibdev, struct ib_queue_pair *qp,
740
-		       struct ib_gid *gid ) {
740
+		       union ib_gid *gid ) {
741
 	struct ib_multicast_gid *mgid;
741
 	struct ib_multicast_gid *mgid;
742
 
742
 
743
 	/* Remove from hardware multicast GID list */
743
 	/* Remove from hardware multicast GID list */
767
  * @ret hca_guid	HCA GUID
767
  * @ret hca_guid	HCA GUID
768
  * @ret num_ports	Number of ports
768
  * @ret num_ports	Number of ports
769
  */
769
  */
770
-int ib_get_hca_info ( struct ib_device *ibdev,
771
-		      struct ib_gid_half *hca_guid ) {
770
+int ib_get_hca_info ( struct ib_device *ibdev, union ib_guid *hca_guid ) {
772
 	struct ib_device *tmp;
771
 	struct ib_device *tmp;
773
 	int num_ports = 0;
772
 	int num_ports = 0;
774
 
773
 
779
 		if ( tmp->dev != ibdev->dev )
778
 		if ( tmp->dev != ibdev->dev )
780
 			continue;
779
 			continue;
781
 		if ( num_ports == 0 ) {
780
 		if ( num_ports == 0 ) {
782
-			memcpy ( hca_guid, &tmp->gid.u.half[1],
781
+			memcpy ( hca_guid, &tmp->gid.s.guid,
783
 				 sizeof ( *hca_guid ) );
782
 				 sizeof ( *hca_guid ) );
784
 		}
783
 		}
785
 		num_ports++;
784
 		num_ports++;
969
  * @v gid		GID
968
  * @v gid		GID
970
  * @ret ibdev		Infiniband device, or NULL
969
  * @ret ibdev		Infiniband device, or NULL
971
  */
970
  */
972
-struct ib_device * find_ibdev ( struct ib_gid *gid ) {
971
+struct ib_device * find_ibdev ( union ib_gid *gid ) {
973
 	struct ib_device *ibdev;
972
 	struct ib_device *ibdev;
974
 
973
 
975
 	for_each_ibdev ( ibdev ) {
974
 	for_each_ibdev ( ibdev ) {

+ 3
- 6
src/net/infiniband/ib_cm.c View File

432
  */
432
  */
433
 struct ib_connection *
433
 struct ib_connection *
434
 ib_create_conn ( struct ib_device *ibdev, struct ib_queue_pair *qp,
434
 ib_create_conn ( struct ib_device *ibdev, struct ib_queue_pair *qp,
435
-		 struct ib_gid *dgid, struct ib_gid_half *service_id,
435
+		 union ib_gid *dgid, union ib_guid *service_id,
436
 		 void *private_data, size_t private_data_len,
436
 		 void *private_data, size_t private_data_len,
437
 		 struct ib_connection_operations *op ) {
437
 		 struct ib_connection_operations *op ) {
438
 	struct ib_connection *conn;
438
 	struct ib_connection *conn;
463
 
463
 
464
 	DBGC ( conn, "CM %p created for IBDEV %p QPN %lx\n",
464
 	DBGC ( conn, "CM %p created for IBDEV %p QPN %lx\n",
465
 	       conn, ibdev, qp->qpn );
465
 	       conn, ibdev, qp->qpn );
466
-	DBGC ( conn, "CM %p connecting to %08x:%08x:%08x:%08x %08x:%08x\n",
467
-	       conn, ntohl ( dgid->u.dwords[0] ), ntohl ( dgid->u.dwords[1] ),
468
-	       ntohl ( dgid->u.dwords[2] ), ntohl ( dgid->u.dwords[3] ),
469
-	       ntohl ( service_id->u.dwords[0] ),
470
-	       ntohl ( service_id->u.dwords[1] ) );
466
+	DBGC ( conn, "CM %p connecting to " IB_GID_FMT " " IB_GUID_FMT "\n",
467
+	       conn, IB_GID_ARGS ( dgid ), IB_GUID_ARGS ( service_id ) );
471
 
468
 
472
 	return conn;
469
 	return conn;
473
 
470
 

+ 3
- 3
src/net/infiniband/ib_cmrc.c View File

80
 	/** Connection */
80
 	/** Connection */
81
 	struct ib_connection *conn;
81
 	struct ib_connection *conn;
82
 	/** Destination GID */
82
 	/** Destination GID */
83
-	struct ib_gid dgid;
83
+	union ib_gid dgid;
84
 	/** Service ID */
84
 	/** Service ID */
85
-	struct ib_gid_half service_id;
85
+	union ib_guid service_id;
86
 	/** QP is connected */
86
 	/** QP is connected */
87
 	int connected;
87
 	int connected;
88
 	/** Shutdown process */
88
 	/** Shutdown process */
357
  * @ret rc		Returns status code
357
  * @ret rc		Returns status code
358
  */
358
  */
359
 int ib_cmrc_open ( struct interface *xfer, struct ib_device *ibdev,
359
 int ib_cmrc_open ( struct interface *xfer, struct ib_device *ibdev,
360
-		   struct ib_gid *dgid, struct ib_gid_half *service_id ) {
360
+		   union ib_gid *dgid, union ib_guid *service_id ) {
361
 	struct ib_cmrc_connection *cmrc;
361
 	struct ib_cmrc_connection *cmrc;
362
 	int rc;
362
 	int rc;
363
 
363
 

+ 10
- 16
src/net/infiniband/ib_mcast.c View File

41
  * @v join		Join (rather than leave) group
41
  * @v join		Join (rather than leave) group
42
  * @v mad		MAD to fill in
42
  * @v mad		MAD to fill in
43
  */
43
  */
44
-static void ib_mcast_mad ( struct ib_device *ibdev, struct ib_gid *gid,
44
+static void ib_mcast_mad ( struct ib_device *ibdev, union ib_gid *gid,
45
 			   int join, union ib_mad *mad ) {
45
 			   int join, union ib_mad *mad ) {
46
 	struct ib_mad_sa *sa = &mad->sa;
46
 	struct ib_mad_sa *sa = &mad->sa;
47
 
47
 
79
 				struct ib_address_vector *av __unused ) {
79
 				struct ib_address_vector *av __unused ) {
80
 	struct ib_mc_membership *membership = ib_madx_get_ownerdata ( madx );
80
 	struct ib_mc_membership *membership = ib_madx_get_ownerdata ( madx );
81
 	struct ib_queue_pair *qp = membership->qp;
81
 	struct ib_queue_pair *qp = membership->qp;
82
-	struct ib_gid *gid = &membership->gid;
82
+	union ib_gid *gid = &membership->gid;
83
 	struct ib_mc_member_record *mc_member_record =
83
 	struct ib_mc_member_record *mc_member_record =
84
 		&mad->sa.sa_data.mc_member_record;
84
 		&mad->sa.sa_data.mc_member_record;
85
 	int joined;
85
 	int joined;
97
 	/* Extract values from MAD */
97
 	/* Extract values from MAD */
98
 	joined = ( mad->hdr.method == IB_MGMT_METHOD_GET_RESP );
98
 	joined = ( mad->hdr.method == IB_MGMT_METHOD_GET_RESP );
99
 	qkey = ntohl ( mc_member_record->qkey );
99
 	qkey = ntohl ( mc_member_record->qkey );
100
-	DBGC ( ibdev, "IBDEV %p QPN %lx %s %08x:%08x:%08x:%08x qkey %lx\n",
100
+	DBGC ( ibdev, "IBDEV %p QPN %lx %s " IB_GID_FMT " qkey %lx\n",
101
 	       ibdev, qp->qpn, ( joined ? "joined" : "left" ),
101
 	       ibdev, qp->qpn, ( joined ? "joined" : "left" ),
102
-	       ntohl ( gid->u.dwords[0] ), ntohl ( gid->u.dwords[1] ),
103
-	       ntohl ( gid->u.dwords[2] ), ntohl ( gid->u.dwords[3] ),
104
-	       qkey );
102
+	       IB_GID_ARGS ( gid ), qkey );
105
 
103
 
106
 	/* Set queue key */
104
 	/* Set queue key */
107
 	qp->qkey = qkey;
105
 	qp->qkey = qkey;
136
  * @ret rc		Return status code
134
  * @ret rc		Return status code
137
  */
135
  */
138
 int ib_mcast_join ( struct ib_device *ibdev, struct ib_queue_pair *qp,
136
 int ib_mcast_join ( struct ib_device *ibdev, struct ib_queue_pair *qp,
139
-		    struct ib_mc_membership *membership, struct ib_gid *gid,
137
+		    struct ib_mc_membership *membership, union ib_gid *gid,
140
 		    void ( * complete ) ( struct ib_device *ibdev,
138
 		    void ( * complete ) ( struct ib_device *ibdev,
141
 					  struct ib_queue_pair *qp,
139
 					  struct ib_queue_pair *qp,
142
 					  struct ib_mc_membership *membership,
140
 					  struct ib_mc_membership *membership,
144
 	union ib_mad mad;
142
 	union ib_mad mad;
145
 	int rc;
143
 	int rc;
146
 
144
 
147
-	DBGC ( ibdev, "IBDEV %p QPN %lx joining %08x:%08x:%08x:%08x\n",
148
-	       ibdev, qp->qpn, ntohl ( gid->u.dwords[0] ),
149
-	       ntohl ( gid->u.dwords[1] ), ntohl ( gid->u.dwords[2] ),
150
-	       ntohl ( gid->u.dwords[3] ) );
145
+	DBGC ( ibdev, "IBDEV %p QPN %lx joining " IB_GID_FMT "\n",
146
+	       ibdev, qp->qpn, IB_GID_ARGS ( gid ) );
151
 
147
 
152
 	/* Initialise structure */
148
 	/* Initialise structure */
153
 	membership->qp = qp;
149
 	membership->qp = qp;
191
  */
187
  */
192
 void ib_mcast_leave ( struct ib_device *ibdev, struct ib_queue_pair *qp,
188
 void ib_mcast_leave ( struct ib_device *ibdev, struct ib_queue_pair *qp,
193
 		      struct ib_mc_membership *membership ) {
189
 		      struct ib_mc_membership *membership ) {
194
-	struct ib_gid *gid = &membership->gid;
190
+	union ib_gid *gid = &membership->gid;
195
 	union ib_mad mad;
191
 	union ib_mad mad;
196
 	int rc;
192
 	int rc;
197
 
193
 
198
-	DBGC ( ibdev, "IBDEV %p QPN %lx leaving %08x:%08x:%08x:%08x\n",
199
-	       ibdev, qp->qpn, ntohl ( gid->u.dwords[0] ),
200
-	       ntohl ( gid->u.dwords[1] ), ntohl ( gid->u.dwords[2] ),
201
-	       ntohl ( gid->u.dwords[3] ) );
194
+	DBGC ( ibdev, "IBDEV %p QPN %lx leaving " IB_GID_FMT "\n",
195
+	       ibdev, qp->qpn, IB_GID_ARGS ( gid ) );
202
 
196
 
203
 	/* Detach from multicast GID */
197
 	/* Detach from multicast GID */
204
 	ib_mcast_detach ( ibdev, qp, &membership->gid );
198
 	ib_mcast_detach ( ibdev, qp, &membership->gid );

+ 2
- 5
src/net/infiniband/ib_packet.c View File

215
 		if ( IB_LID_MULTICAST ( lid ) && grh ) {
215
 		if ( IB_LID_MULTICAST ( lid ) && grh ) {
216
 			if ( ! ( *qp = ib_find_qp_mgid ( ibdev, &grh->dgid ))){
216
 			if ( ! ( *qp = ib_find_qp_mgid ( ibdev, &grh->dgid ))){
217
 				DBGC ( ibdev, "IBDEV %p RX for unknown MGID "
217
 				DBGC ( ibdev, "IBDEV %p RX for unknown MGID "
218
-				       "%08x:%08x:%08x:%08x\n", ibdev,
219
-				       ntohl ( grh->dgid.u.dwords[0] ),
220
-				       ntohl ( grh->dgid.u.dwords[1] ),
221
-				       ntohl ( grh->dgid.u.dwords[2] ),
222
-				       ntohl ( grh->dgid.u.dwords[3] ) );
218
+				       IB_GID_FMT "\n",
219
+				       ibdev, IB_GID_ARGS ( &grh->dgid ) );
223
 				return -ENODEV;
220
 				return -ENODEV;
224
 			}
221
 			}
225
 		} else {
222
 		} else {

+ 14
- 22
src/net/infiniband/ib_pathrec.c View File

49
 			       int rc, union ib_mad *mad,
49
 			       int rc, union ib_mad *mad,
50
 			       struct ib_address_vector *av __unused ) {
50
 			       struct ib_address_vector *av __unused ) {
51
 	struct ib_path *path = ib_madx_get_ownerdata ( madx );
51
 	struct ib_path *path = ib_madx_get_ownerdata ( madx );
52
-	struct ib_gid *dgid = &path->av.gid;
52
+	union ib_gid *dgid = &path->av.gid;
53
 	struct ib_path_record *pathrec = &mad->sa.sa_data.path_record;
53
 	struct ib_path_record *pathrec = &mad->sa.sa_data.path_record;
54
 
54
 
55
 	/* Report failures */
55
 	/* Report failures */
56
 	if ( ( rc == 0 ) && ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ))
56
 	if ( ( rc == 0 ) && ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ))
57
 		rc = -ENETUNREACH;
57
 		rc = -ENETUNREACH;
58
 	if ( rc != 0 ) {
58
 	if ( rc != 0 ) {
59
-		DBGC ( ibdev, "IBDEV %p path lookup for %08x:%08x:%08x:%08x "
60
-		       "failed: %s\n", ibdev, htonl ( dgid->u.dwords[0] ),
61
-		       htonl ( dgid->u.dwords[1] ),
62
-		       htonl ( dgid->u.dwords[2] ),
63
-		       htonl ( dgid->u.dwords[3] ), strerror ( rc ) );
59
+		DBGC ( ibdev, "IBDEV %p path lookup for " IB_GID_FMT
60
+		       " failed: %s\n",
61
+		       ibdev, IB_GID_ARGS ( dgid ), strerror ( rc ) );
64
 		goto out;
62
 		goto out;
65
 	}
63
 	}
66
 
64
 
68
 	path->av.lid = ntohs ( pathrec->dlid );
66
 	path->av.lid = ntohs ( pathrec->dlid );
69
 	path->av.sl = ( pathrec->reserved__sl & 0x0f );
67
 	path->av.sl = ( pathrec->reserved__sl & 0x0f );
70
 	path->av.rate = ( pathrec->rate_selector__rate & 0x3f );
68
 	path->av.rate = ( pathrec->rate_selector__rate & 0x3f );
71
-	DBGC ( ibdev, "IBDEV %p path to %08x:%08x:%08x:%08x is %04x sl %d "
72
-	       "rate %d\n", ibdev, htonl ( dgid->u.dwords[0] ),
73
-	       htonl ( dgid->u.dwords[1] ), htonl ( dgid->u.dwords[2] ),
74
-	       htonl ( dgid->u.dwords[3] ), path->av.lid, path->av.sl,
69
+	DBGC ( ibdev, "IBDEV %p path to " IB_GID_FMT " is %04x sl %d rate "
70
+	       "%d\n", ibdev, IB_GID_ARGS ( dgid ), path->av.lid, path->av.sl,
75
 	       path->av.rate );
71
 	       path->av.rate );
76
 
72
 
77
  out:
73
  out:
179
  * @ret path		Path cache entry, or NULL
175
  * @ret path		Path cache entry, or NULL
180
  */
176
  */
181
 static struct ib_cached_path *
177
 static struct ib_cached_path *
182
-ib_find_path_cache_entry ( struct ib_device *ibdev, struct ib_gid *dgid ) {
178
+ib_find_path_cache_entry ( struct ib_device *ibdev, union ib_gid *dgid ) {
183
 	struct ib_cached_path *cached;
179
 	struct ib_cached_path *cached;
184
 	unsigned int i;
180
 	unsigned int i;
185
 
181
 
240
  * cache similar to ARP.
236
  * cache similar to ARP.
241
  */
237
  */
242
 int ib_resolve_path ( struct ib_device *ibdev, struct ib_address_vector *av ) {
238
 int ib_resolve_path ( struct ib_device *ibdev, struct ib_address_vector *av ) {
243
-	struct ib_gid *gid = &av->gid;
239
+	union ib_gid *gid = &av->gid;
244
 	struct ib_cached_path *cached;
240
 	struct ib_cached_path *cached;
245
 	unsigned int cache_idx;
241
 	unsigned int cache_idx;
246
 
242
 
247
 	/* Sanity check */
243
 	/* Sanity check */
248
 	if ( ! av->gid_present ) {
244
 	if ( ! av->gid_present ) {
249
-		DBGC ( ibdev, "IBDEV %p attempt to look up path "
250
-		       "without GID\n", ibdev );
245
+		DBGC ( ibdev, "IBDEV %p attempt to look up path without GID\n",
246
+		       ibdev );
251
 		return -EINVAL;
247
 		return -EINVAL;
252
 	}
248
 	}
253
 
249
 
258
 		av->lid = cached->path->av.lid;
254
 		av->lid = cached->path->av.lid;
259
 		av->rate = cached->path->av.rate;
255
 		av->rate = cached->path->av.rate;
260
 		av->sl = cached->path->av.sl;
256
 		av->sl = cached->path->av.sl;
261
-		DBGC2 ( ibdev, "IBDEV %p cache hit for %08x:%08x:%08x:%08x\n",
262
-			ibdev, htonl ( gid->u.dwords[0] ),
263
-			htonl ( gid->u.dwords[1] ), htonl ( gid->u.dwords[2] ),
264
-			htonl ( gid->u.dwords[3] ) );
257
+		DBGC2 ( ibdev, "IBDEV %p cache hit for " IB_GID_FMT "\n",
258
+			ibdev, IB_GID_ARGS ( gid ) );
265
 		return 0;
259
 		return 0;
266
 	}
260
 	}
267
-	DBGC ( ibdev, "IBDEV %p cache miss for %08x:%08x:%08x:%08x%s\n",
268
-	       ibdev, htonl ( gid->u.dwords[0] ), htonl ( gid->u.dwords[1] ),
269
-	       htonl ( gid->u.dwords[2] ), htonl ( gid->u.dwords[3] ),
270
-	       ( cached ? " (in progress)" : "" ) );
261
+	DBGC ( ibdev, "IBDEV %p cache miss for " IB_GID_FMT "%s\n", ibdev,
262
+	       IB_GID_ARGS ( gid ), ( cached ? " (in progress)" : "" ) );
271
 
263
 
272
 	/* If lookup is already in progress, do nothing */
264
 	/* If lookup is already in progress, do nothing */
273
 	if ( cached )
265
 	if ( cached )

+ 9
- 9
src/net/infiniband/ib_sma.c View File

61
 	node_info->num_ports = ib_get_hca_info ( ibdev, &node_info->sys_guid );
61
 	node_info->num_ports = ib_get_hca_info ( ibdev, &node_info->sys_guid );
62
 	memcpy ( &node_info->node_guid, &node_info->sys_guid,
62
 	memcpy ( &node_info->node_guid, &node_info->sys_guid,
63
 		 sizeof ( node_info->node_guid ) );
63
 		 sizeof ( node_info->node_guid ) );
64
-	memcpy ( &node_info->port_guid, &ibdev->gid.u.half[1],
64
+	memcpy ( &node_info->port_guid, &ibdev->gid.s.guid,
65
 		 sizeof ( node_info->port_guid ) );
65
 		 sizeof ( node_info->port_guid ) );
66
 	node_info->partition_cap = htons ( 1 );
66
 	node_info->partition_cap = htons ( 1 );
67
 	node_info->local_port_num = ibdev->port;
67
 	node_info->local_port_num = ibdev->port;
88
 			       union ib_mad *mad,
88
 			       union ib_mad *mad,
89
 			       struct ib_address_vector *av ) {
89
 			       struct ib_address_vector *av ) {
90
 	struct ib_node_desc *node_desc = &mad->smp.smp_data.node_desc;
90
 	struct ib_node_desc *node_desc = &mad->smp.smp_data.node_desc;
91
-	struct ib_gid_half guid;
91
+	union ib_guid guid;
92
 	char hostname[ sizeof ( node_desc->node_string ) ];
92
 	char hostname[ sizeof ( node_desc->node_string ) ];
93
 	int hostname_len;
93
 	int hostname_len;
94
 	int rc;
94
 	int rc;
101
 	snprintf ( node_desc->node_string, sizeof ( node_desc->node_string ),
101
 	snprintf ( node_desc->node_string, sizeof ( node_desc->node_string ),
102
 		   "iPXE %s%s%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x (%s)",
102
 		   "iPXE %s%s%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x (%s)",
103
 		   hostname, ( ( hostname_len >= 0 ) ? " " : "" ),
103
 		   hostname, ( ( hostname_len >= 0 ) ? " " : "" ),
104
-		   guid.u.bytes[0], guid.u.bytes[1], guid.u.bytes[2],
105
-		   guid.u.bytes[3], guid.u.bytes[4], guid.u.bytes[5],
106
-		   guid.u.bytes[6], guid.u.bytes[7], ibdev->dev->name );
104
+		   guid.bytes[0], guid.bytes[1], guid.bytes[2], guid.bytes[3],
105
+		   guid.bytes[4], guid.bytes[5], guid.bytes[6], guid.bytes[7],
106
+		   ibdev->dev->name );
107
 
107
 
108
 	/* Send GetResponse */
108
 	/* Send GetResponse */
109
 	mad->hdr.method = IB_MGMT_METHOD_GET_RESP;
109
 	mad->hdr.method = IB_MGMT_METHOD_GET_RESP;
131
 
131
 
132
 	/* Fill in information */
132
 	/* Fill in information */
133
 	memset ( guid_info, 0, sizeof ( *guid_info ) );
133
 	memset ( guid_info, 0, sizeof ( *guid_info ) );
134
-	memcpy ( guid_info->guid[0], &ibdev->gid.u.half[1],
134
+	memcpy ( guid_info->guid[0], &ibdev->gid.s.guid,
135
 		 sizeof ( guid_info->guid[0] ) );
135
 		 sizeof ( guid_info->guid[0] ) );
136
 
136
 
137
 	/* Send GetResponse */
137
 	/* Send GetResponse */
160
 	int rc;
160
 	int rc;
161
 
161
 
162
 	/* Set parameters */
162
 	/* Set parameters */
163
-	memcpy ( &ibdev->gid.u.half[0], port_info->gid_prefix,
164
-		 sizeof ( ibdev->gid.u.half[0] ) );
163
+	memcpy ( &ibdev->gid.s.prefix, port_info->gid_prefix,
164
+		 sizeof ( ibdev->gid.s.prefix ) );
165
 	ibdev->lid = ntohs ( port_info->lid );
165
 	ibdev->lid = ntohs ( port_info->lid );
166
 	ibdev->sm_lid = ntohs ( port_info->mastersm_lid );
166
 	ibdev->sm_lid = ntohs ( port_info->mastersm_lid );
167
 	if ( ( link_width_enabled = port_info->link_width_enabled ) )
167
 	if ( ( link_width_enabled = port_info->link_width_enabled ) )
210
 
210
 
211
 	/* Fill in information */
211
 	/* Fill in information */
212
 	memset ( port_info, 0, sizeof ( *port_info ) );
212
 	memset ( port_info, 0, sizeof ( *port_info ) );
213
-	memcpy ( port_info->gid_prefix, &ibdev->gid.u.half[0],
213
+	memcpy ( port_info->gid_prefix, &ibdev->gid.s.prefix,
214
 		 sizeof ( port_info->gid_prefix ) );
214
 		 sizeof ( port_info->gid_prefix ) );
215
 	port_info->lid = ntohs ( ibdev->lid );
215
 	port_info->lid = ntohs ( ibdev->lid );
216
 	port_info->mastersm_lid = ntohs ( ibdev->sm_lid );
216
 	port_info->mastersm_lid = ntohs ( ibdev->sm_lid );

+ 6
- 9
src/net/infiniband/ib_smc.c View File

141
 	 */
141
 	 */
142
 	if ( ( rc = ib_smc_get_port_info ( ibdev, local_mad, &mad ) ) != 0 )
142
 	if ( ( rc = ib_smc_get_port_info ( ibdev, local_mad, &mad ) ) != 0 )
143
 		return rc;
143
 		return rc;
144
-	memcpy ( &ibdev->gid.u.half[0], port_info->gid_prefix,
145
-		 sizeof ( ibdev->gid.u.half[0] ) );
144
+	memcpy ( &ibdev->gid.s.prefix, port_info->gid_prefix,
145
+		 sizeof ( ibdev->gid.s.prefix ) );
146
 	ibdev->lid = ntohs ( port_info->lid );
146
 	ibdev->lid = ntohs ( port_info->lid );
147
 	ibdev->sm_lid = ntohs ( port_info->mastersm_lid );
147
 	ibdev->sm_lid = ntohs ( port_info->mastersm_lid );
148
 	ibdev->link_width_enabled = port_info->link_width_enabled;
148
 	ibdev->link_width_enabled = port_info->link_width_enabled;
161
 	/* GUID info gives us the second half of the port GID */
161
 	/* GUID info gives us the second half of the port GID */
162
 	if ( ( rc = ib_smc_get_guid_info ( ibdev, local_mad, &mad ) ) != 0 )
162
 	if ( ( rc = ib_smc_get_guid_info ( ibdev, local_mad, &mad ) ) != 0 )
163
 		return rc;
163
 		return rc;
164
-	memcpy ( &ibdev->gid.u.half[1], guid_info->guid[0],
165
-		 sizeof ( ibdev->gid.u.half[1] ) );
164
+	memcpy ( &ibdev->gid.s.guid, guid_info->guid[0],
165
+		 sizeof ( ibdev->gid.s.guid ) );
166
 
166
 
167
 	/* Get partition key */
167
 	/* Get partition key */
168
 	if ( ( rc = ib_smc_get_pkey_table ( ibdev, local_mad, &mad ) ) != 0 )
168
 	if ( ( rc = ib_smc_get_pkey_table ( ibdev, local_mad, &mad ) ) != 0 )
169
 		return rc;
169
 		return rc;
170
 	ibdev->pkey = ntohs ( pkey_table->pkey[0] );
170
 	ibdev->pkey = ntohs ( pkey_table->pkey[0] );
171
 
171
 
172
-	DBGC ( ibdev, "IBDEV %p port GID is %08x:%08x:%08x:%08x\n", ibdev,
173
-	       htonl ( ibdev->gid.u.dwords[0] ),
174
-	       htonl ( ibdev->gid.u.dwords[1] ),
175
-	       htonl ( ibdev->gid.u.dwords[2] ),
176
-	       htonl ( ibdev->gid.u.dwords[3] ) );
172
+	DBGC ( ibdev, "IBDEV %p port GID is " IB_GID_FMT "\n",
173
+	       ibdev, IB_GID_ARGS ( &ibdev->gid ) );
177
 
174
 
178
 	return 0;
175
 	return 0;
179
 }
176
 }

+ 16
- 19
src/net/infiniband/ib_srp.c View File

81
 	struct ib_device *ibdev;
81
 	struct ib_device *ibdev;
82
 
82
 
83
 	/** Destination GID (for boot firmware table) */
83
 	/** Destination GID (for boot firmware table) */
84
-	struct ib_gid dgid;
84
+	union ib_gid dgid;
85
 	/** Service ID (for boot firmware table) */
85
 	/** Service ID (for boot firmware table) */
86
-	struct ib_gid_half service_id;
86
+	union ib_guid service_id;
87
 };
87
 };
88
 
88
 
89
 /**
89
 /**
184
  * @ret rc		Return status code
184
  * @ret rc		Return status code
185
  */
185
  */
186
 static int ib_srp_open ( struct interface *block, struct ib_device *ibdev,
186
 static int ib_srp_open ( struct interface *block, struct ib_device *ibdev,
187
-			 struct ib_gid *dgid, struct ib_gid_half *service_id,
187
+			 union ib_gid *dgid, union ib_guid *service_id,
188
 			 union srp_port_id *initiator,
188
 			 union srp_port_id *initiator,
189
 			 union srp_port_id *target, struct scsi_lun *lun ) {
189
 			 union srp_port_id *target, struct scsi_lun *lun ) {
190
 	struct ib_srp_device *ib_srp;
190
 	struct ib_srp_device *ib_srp;
200
 	intf_init ( &ib_srp->srp, &ib_srp_srp_desc, &ib_srp->refcnt );
200
 	intf_init ( &ib_srp->srp, &ib_srp_srp_desc, &ib_srp->refcnt );
201
 	intf_init ( &ib_srp->cmrc, &ib_srp_cmrc_desc, &ib_srp->refcnt );
201
 	intf_init ( &ib_srp->cmrc, &ib_srp_cmrc_desc, &ib_srp->refcnt );
202
 	ib_srp->ibdev = ibdev_get ( ibdev );
202
 	ib_srp->ibdev = ibdev_get ( ibdev );
203
-	DBGC ( ib_srp, "IBSRP %p created for %08x%08x%08x%08x:%08x%08x\n",
204
-	       ib_srp, ntohl ( dgid->u.dwords[0] ),
205
-	       ntohl ( dgid->u.dwords[1] ), ntohl ( dgid->u.dwords[2] ),
206
-	       ntohl ( dgid->u.dwords[3] ), ntohl ( service_id->u.dwords[0] ),
207
-	       ntohl ( service_id->u.dwords[1] ) );
203
+	DBGC ( ib_srp, "IBSRP %p for " IB_GID_FMT " " IB_GUID_FMT "\n",
204
+	       ib_srp, IB_GID_ARGS ( dgid ), IB_GUID_ARGS ( service_id ) );
208
 
205
 
209
 	/* Preserve parameters required for boot firmware table */
206
 	/* Preserve parameters required for boot firmware table */
210
 	memcpy ( &ib_srp->dgid, dgid, sizeof ( ib_srp->dgid ) );
207
 	memcpy ( &ib_srp->dgid, dgid, sizeof ( ib_srp->dgid ) );
256
 /** IB SRP root path parameters */
253
 /** IB SRP root path parameters */
257
 struct ib_srp_root_path {
254
 struct ib_srp_root_path {
258
 	/** Source GID */
255
 	/** Source GID */
259
-	struct ib_gid sgid;
256
+	union ib_gid sgid;
260
 	/** Initiator port ID */
257
 	/** Initiator port ID */
261
 	union ib_srp_initiator_port_id initiator;
258
 	union ib_srp_initiator_port_id initiator;
262
 	/** Destination GID */
259
 	/** Destination GID */
263
-	struct ib_gid dgid;
260
+	union ib_gid dgid;
264
 	/** Partition key */
261
 	/** Partition key */
265
 	uint16_t pkey;
262
 	uint16_t pkey;
266
 	/** Service ID */
263
 	/** Service ID */
267
-	struct ib_gid_half service_id;
264
+	union ib_guid service_id;
268
 	/** SCSI LUN */
265
 	/** SCSI LUN */
269
 	struct scsi_lun lun;
266
 	struct scsi_lun lun;
270
 	/** Target port ID */
267
 	/** Target port ID */
337
 	if ( ( ibdev = last_opened_ibdev() ) != NULL )
334
 	if ( ( ibdev = last_opened_ibdev() ) != NULL )
338
 		memcpy ( &rp->sgid, &ibdev->gid, sizeof ( rp->sgid ) );
335
 		memcpy ( &rp->sgid, &ibdev->gid, sizeof ( rp->sgid ) );
339
 
336
 
340
-	return ib_srp_parse_byte_string ( rp_comp, rp->sgid.u.bytes,
337
+	return ib_srp_parse_byte_string ( rp_comp, rp->sgid.bytes,
341
 					  ( sizeof ( rp->sgid ) |
338
 					  ( sizeof ( rp->sgid ) |
342
 					    IB_SRP_PARSE_OPTIONAL ) );
339
 					    IB_SRP_PARSE_OPTIONAL ) );
343
 }
340
 }
353
 					   struct ib_srp_root_path *rp ) {
350
 					   struct ib_srp_root_path *rp ) {
354
 	union ib_srp_initiator_port_id *port_id = &rp->initiator;
351
 	union ib_srp_initiator_port_id *port_id = &rp->initiator;
355
 
352
 
356
-	return ib_srp_parse_byte_string ( rp_comp, port_id->ib.id_ext.u.bytes,
353
+	return ib_srp_parse_byte_string ( rp_comp, port_id->ib.id_ext.bytes,
357
 					  ( sizeof ( port_id->ib.id_ext ) |
354
 					  ( sizeof ( port_id->ib.id_ext ) |
358
 					    IB_SRP_PARSE_OPTIONAL ) );
355
 					    IB_SRP_PARSE_OPTIONAL ) );
359
 }
356
 }
370
 	union ib_srp_initiator_port_id *port_id = &rp->initiator;
367
 	union ib_srp_initiator_port_id *port_id = &rp->initiator;
371
 
368
 
372
 	/* Default to the GUID portion of the source GID */
369
 	/* Default to the GUID portion of the source GID */
373
-	memcpy ( &port_id->ib.hca_guid, &rp->sgid.u.half[1],
370
+	memcpy ( &port_id->ib.hca_guid, &rp->sgid.s.guid,
374
 		 sizeof ( port_id->ib.hca_guid ) );
371
 		 sizeof ( port_id->ib.hca_guid ) );
375
 
372
 
376
-	return ib_srp_parse_byte_string ( rp_comp, port_id->ib.hca_guid.u.bytes,
373
+	return ib_srp_parse_byte_string ( rp_comp, port_id->ib.hca_guid.bytes,
377
 					  ( sizeof ( port_id->ib.hca_guid ) |
374
 					  ( sizeof ( port_id->ib.hca_guid ) |
378
 					    IB_SRP_PARSE_OPTIONAL ) );
375
 					    IB_SRP_PARSE_OPTIONAL ) );
379
 }
376
 }
387
  */
384
  */
388
 static int ib_srp_parse_dgid ( const char *rp_comp,
385
 static int ib_srp_parse_dgid ( const char *rp_comp,
389
 			       struct ib_srp_root_path *rp ) {
386
 			       struct ib_srp_root_path *rp ) {
390
-	return ib_srp_parse_byte_string ( rp_comp, rp->dgid.u.bytes,
387
+	return ib_srp_parse_byte_string ( rp_comp, rp->dgid.bytes,
391
 					  ( sizeof ( rp->dgid ) |
388
 					  ( sizeof ( rp->dgid ) |
392
 					    IB_SRP_PARSE_REQUIRED ) );
389
 					    IB_SRP_PARSE_REQUIRED ) );
393
 }
390
 }
418
  */
415
  */
419
 static int ib_srp_parse_service_id ( const char *rp_comp,
416
 static int ib_srp_parse_service_id ( const char *rp_comp,
420
 				     struct ib_srp_root_path *rp ) {
417
 				     struct ib_srp_root_path *rp ) {
421
-	return ib_srp_parse_byte_string ( rp_comp, rp->service_id.u.bytes,
418
+	return ib_srp_parse_byte_string ( rp_comp, rp->service_id.bytes,
422
 					  ( sizeof ( rp->service_id ) |
419
 					  ( sizeof ( rp->service_id ) |
423
 					    IB_SRP_PARSE_REQUIRED ) );
420
 					    IB_SRP_PARSE_REQUIRED ) );
424
 }
421
 }
446
 					struct ib_srp_root_path *rp ) {
443
 					struct ib_srp_root_path *rp ) {
447
 	union ib_srp_target_port_id *port_id = &rp->target;
444
 	union ib_srp_target_port_id *port_id = &rp->target;
448
 
445
 
449
-	return ib_srp_parse_byte_string ( rp_comp, port_id->ib.id_ext.u.bytes,
446
+	return ib_srp_parse_byte_string ( rp_comp, port_id->ib.id_ext.bytes,
450
 					  ( sizeof ( port_id->ib.id_ext ) |
447
 					  ( sizeof ( port_id->ib.id_ext ) |
451
 					    IB_SRP_PARSE_REQUIRED ) );
448
 					    IB_SRP_PARSE_REQUIRED ) );
452
 }
449
 }
462
 					  struct ib_srp_root_path *rp ) {
459
 					  struct ib_srp_root_path *rp ) {
463
 	union ib_srp_target_port_id *port_id = &rp->target;
460
 	union ib_srp_target_port_id *port_id = &rp->target;
464
 
461
 
465
-	return ib_srp_parse_byte_string ( rp_comp, port_id->ib.ioc_guid.u.bytes,
462
+	return ib_srp_parse_byte_string ( rp_comp, port_id->ib.ioc_guid.bytes,
466
 					  ( sizeof ( port_id->ib.ioc_guid ) |
463
 					  ( sizeof ( port_id->ib.ioc_guid ) |
467
 					    IB_SRP_PARSE_REQUIRED ) );
464
 					    IB_SRP_PARSE_REQUIRED ) );
468
 }
465
 }

Loading…
Cancel
Save