Преглед изворни кода

[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 година
родитељ
комит
52e54a8c69

+ 6
- 6
src/drivers/infiniband/arbel.c Прегледај датотеку

@@ -396,7 +396,7 @@ arbel_cmd_write_mgm ( struct arbel *arbel, unsigned int index,
396 396
 }
397 397
 
398 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 400
 		      struct arbelprm_mgm_hash *hash ) {
401 401
 	return arbel_cmd ( arbel,
402 402
 			   ARBEL_HCR_INOUT_CMD ( ARBEL_HCR_MGID_HASH,
@@ -998,8 +998,8 @@ static void arbel_ring_doorbell ( struct arbel *arbel,
998 998
 }
999 999
 
1000 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,7 +1023,7 @@ static int arbel_post_send ( struct ib_device *ibdev,
1023 1023
 	struct arbelprm_ud_send_wqe *wqe;
1024 1024
 	struct arbelprm_qp_db_record *qp_db_rec;
1025 1025
 	union arbelprm_doorbell_register db_reg;
1026
-	const struct ib_gid *gid;
1026
+	const union ib_gid *gid;
1027 1027
 	unsigned int wqe_idx_mask;
1028 1028
 	size_t nds;
1029 1029
 
@@ -1565,7 +1565,7 @@ static void arbel_close ( struct ib_device *ibdev ) {
1565 1565
  */
1566 1566
 static int arbel_mcast_attach ( struct ib_device *ibdev,
1567 1567
 				struct ib_queue_pair *qp,
1568
-				struct ib_gid *gid ) {
1568
+				union ib_gid *gid ) {
1569 1569
 	struct arbel *arbel = ib_get_drvdata ( ibdev );
1570 1570
 	struct arbelprm_mgm_hash hash;
1571 1571
 	struct arbelprm_mgm_entry mgm;
@@ -1620,7 +1620,7 @@ static int arbel_mcast_attach ( struct ib_device *ibdev,
1620 1620
  */
1621 1621
 static void arbel_mcast_detach ( struct ib_device *ibdev,
1622 1622
 				 struct ib_queue_pair *qp __unused,
1623
-				 struct ib_gid *gid ) {
1623
+				 union ib_gid *gid ) {
1624 1624
 	struct arbel *arbel = ib_get_drvdata ( ibdev );
1625 1625
 	struct arbelprm_mgm_hash hash;
1626 1626
 	struct arbelprm_mgm_entry mgm;

+ 3
- 3
src/drivers/infiniband/hermon.c Прегледај датотеку

@@ -474,7 +474,7 @@ hermon_cmd_write_mcg ( struct hermon *hermon, unsigned int index,
474 474
 }
475 475
 
476 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 478
 		       struct hermonprm_mgm_hash *hash ) {
479 479
 	return hermon_cmd ( hermon,
480 480
 			    HERMON_HCR_INOUT_CMD ( HERMON_HCR_MGID_HASH,
@@ -2012,7 +2012,7 @@ static int hermon_inform_sma ( struct ib_device *ibdev,
2012 2012
  */
2013 2013
 static int hermon_mcast_attach ( struct ib_device *ibdev,
2014 2014
 				 struct ib_queue_pair *qp,
2015
-				 struct ib_gid *gid ) {
2015
+				 union ib_gid *gid ) {
2016 2016
 	struct hermon *hermon = ib_get_drvdata ( ibdev );
2017 2017
 	struct hermonprm_mgm_hash hash;
2018 2018
 	struct hermonprm_mcg_entry mcg;
@@ -2066,7 +2066,7 @@ static int hermon_mcast_attach ( struct ib_device *ibdev,
2066 2066
  */
2067 2067
 static void hermon_mcast_detach ( struct ib_device *ibdev,
2068 2068
 				  struct ib_queue_pair *qp __unused,
2069
-				  struct ib_gid *gid ) {
2069
+				  union ib_gid *gid ) {
2070 2070
 	struct hermon *hermon = ib_get_drvdata ( ibdev );
2071 2071
 	struct hermonprm_mgm_hash hash;
2072 2072
 	struct hermonprm_mcg_entry mcg;

+ 7
- 10
src/drivers/infiniband/linda.c Прегледај датотеку

@@ -1456,7 +1456,7 @@ static void linda_close ( struct ib_device *ibdev ) {
1456 1456
  */
1457 1457
 static int linda_mcast_attach ( struct ib_device *ibdev,
1458 1458
 				struct ib_queue_pair *qp,
1459
-				struct ib_gid *gid ) {
1459
+				union ib_gid *gid ) {
1460 1460
 	struct linda *linda = ib_get_drvdata ( ibdev );
1461 1461
 
1462 1462
 	( void ) linda;
@@ -1474,7 +1474,7 @@ static int linda_mcast_attach ( struct ib_device *ibdev,
1474 1474
  */
1475 1475
 static void linda_mcast_detach ( struct ib_device *ibdev,
1476 1476
 				 struct ib_queue_pair *qp,
1477
-				 struct ib_gid *gid ) {
1477
+				 union ib_gid *gid ) {
1478 1478
 	struct linda *linda = ib_get_drvdata ( ibdev );
1479 1479
 
1480 1480
 	( void ) linda;
@@ -1631,22 +1631,19 @@ static int linda_init_i2c ( struct linda *linda ) {
1631 1631
  * @v guid		GUID to fill in
1632 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 1635
 	struct i2c_interface *i2c = &linda->i2c.i2c;
1637 1636
 	int rc;
1638 1637
 
1639 1638
 	/* Read GUID */
1640 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 1641
 		DBGC ( linda, "Linda %p could not read GUID: %s\n",
1643 1642
 		       linda, strerror ( rc ) );
1644 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 1648
 	/* Read serial number (debug only) */
1652 1649
 	if ( DBG_LOG ) {
@@ -2367,7 +2364,7 @@ static int linda_probe ( struct pci_device *pci,
2367 2364
 		goto err_init_i2c;
2368 2365
 
2369 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 2368
 		goto err_read_eeprom;
2372 2369
 
2373 2370
 	/* Initialise send datapath */

+ 11
- 13
src/drivers/infiniband/qib7322.c Прегледај датотеку

@@ -118,7 +118,7 @@ struct qib7322 {
118 118
 	struct i2c_device eeprom;
119 119
 
120 120
 	/** Base GUID */
121
-	struct ib_gid_half guid;
121
+	union ib_guid guid;
122 122
 	/** Infiniband devices */
123 123
 	struct ib_device *ibdev[QIB7322_MAX_PORTS];
124 124
 };
@@ -1770,7 +1770,7 @@ static void qib7322_close ( struct ib_device *ibdev ) {
1770 1770
  */
1771 1771
 static int qib7322_mcast_attach ( struct ib_device *ibdev,
1772 1772
 				  struct ib_queue_pair *qp,
1773
-				  struct ib_gid *gid ) {
1773
+				  union ib_gid *gid ) {
1774 1774
 	struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
1775 1775
 
1776 1776
 	( void ) qib7322;
@@ -1788,7 +1788,7 @@ static int qib7322_mcast_attach ( struct ib_device *ibdev,
1788 1788
  */
1789 1789
 static void qib7322_mcast_detach ( struct ib_device *ibdev,
1790 1790
 				   struct ib_queue_pair *qp,
1791
-				   struct ib_gid *gid ) {
1791
+				   union ib_gid *gid ) {
1792 1792
 	struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
1793 1793
 
1794 1794
 	( void ) qib7322;
@@ -1946,21 +1946,19 @@ static int qib7322_init_i2c ( struct qib7322 *qib7322 ) {
1946 1946
  */
1947 1947
 static int qib7322_read_eeprom ( struct qib7322 *qib7322 ) {
1948 1948
 	struct i2c_interface *i2c = &qib7322->i2c.i2c;
1949
-	struct ib_gid_half *guid = &qib7322->guid;
1949
+	union ib_guid *guid = &qib7322->guid;
1950 1950
 	int rc;
1951 1951
 
1952 1952
 	/* Read GUID */
1953 1953
 	if ( ( rc = i2c->read ( i2c, &qib7322->eeprom,
1954
-				QIB7322_EEPROM_GUID_OFFSET, guid->u.bytes,
1954
+				QIB7322_EEPROM_GUID_OFFSET, guid->bytes,
1955 1955
 				sizeof ( *guid ) ) ) != 0 ) {
1956 1956
 		DBGC ( qib7322, "QIB7322 %p could not read GUID: %s\n",
1957 1957
 		       qib7322, strerror ( rc ) );
1958 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 1963
 	/* Read serial number (debug only) */
1966 1964
 	if ( DBG_LOG ) {
@@ -2359,10 +2357,10 @@ static int qib7322_probe ( struct pci_device *pci,
2359 2357
 			IB_LINK_WIDTH_4X; /* 1x does not work */
2360 2358
 		ibdev->link_speed_enabled = ibdev->link_speed_supported =
2361 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 2364
 		ib_set_drvdata ( ibdev, qib7322 );
2367 2365
 	}
2368 2366
 

+ 25
- 25
src/drivers/net/ipoib.c Прегледај датотеку

@@ -72,8 +72,8 @@ struct ipoib_device {
72 72
 /** Broadcast IPoIB address */
73 73
 static struct ipoib_mac ipoib_broadcast = {
74 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 79
 /** Link status for "broadcast join in progress" */
@@ -266,11 +266,11 @@ static int ipoib_pull ( struct net_device *netdev,
266 266
  * @v ll_addr		Link-layer address
267 267
  */
268 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 270
 	struct ipoib_mac *mac = ll_addr;
271 271
 
272 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,10 +284,10 @@ const char * ipoib_ntoa ( const void *ll_addr ) {
284 284
 	const struct ipoib_mac *mac = ll_addr;
285 285
 
286 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 291
 	return buf;
292 292
 }
293 293
 
@@ -312,14 +312,14 @@ static int ipoib_mc_hash ( unsigned int af __unused,
312 312
  * @v ll_addr		Link-layer address
313 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 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 323
 	return 0;
324 324
 }
325 325
 
@@ -330,7 +330,7 @@ struct ipoib_eth_addr_handler {
330 330
 	/** GUID byte 2 */
331 331
 	uint8_t byte2;
332 332
 	/** Handler */
333
-	int ( * eth_addr ) ( const struct ib_gid_half *guid,
333
+	int ( * eth_addr ) ( const union ib_guid *guid,
334 334
 			     uint8_t *eth_addr );
335 335
 };
336 336
 
@@ -347,15 +347,15 @@ static struct ipoib_eth_addr_handler ipoib_eth_addr_handlers[] = {
347 347
  */
348 348
 static int ipoib_eth_addr ( const void *ll_addr, void *eth_addr ) {
349 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 351
 	struct ipoib_eth_addr_handler *handler;
352 352
 	unsigned int i;
353 353
 
354 354
 	for ( i = 0 ; i < ( sizeof ( ipoib_eth_addr_handlers ) /
355 355
 			    sizeof ( ipoib_eth_addr_handlers[0] ) ) ; i++ ) {
356 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 359
 			return handler->eth_addr ( guid, eth_addr );
360 360
 		}
361 361
 	}
@@ -366,7 +366,7 @@ static int ipoib_eth_addr ( const void *ll_addr, void *eth_addr ) {
366 366
 struct ll_protocol ipoib_protocol __ll_protocol = {
367 367
 	.name		= "IPoIB",
368 368
 	.ll_proto	= htons ( ARPHRD_INFINIBAND ),
369
-	.hw_addr_len	= sizeof ( struct ib_gid_half ),
369
+	.hw_addr_len	= sizeof ( union ib_guid ),
370 370
 	.ll_addr_len	= IPOIB_ALEN,
371 371
 	.ll_header_len	= IPOIB_HLEN,
372 372
 	.push		= ipoib_push,
@@ -612,11 +612,11 @@ static void ipoib_link_state_changed ( struct ib_device *ibdev ) {
612 612
 	ipoib_leave_broadcast_group ( ipoib );
613 613
 
614 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 618
 	/* Update broadcast GID based on potentially-new partition key */
619
-	ipoib->broadcast.gid.u.words[2] =
619
+	ipoib->broadcast.gid.words[2] =
620 620
 		htons ( ibdev->pkey | IB_PKEY_FULL );
621 621
 
622 622
 	/* Set net device link state to reflect Infiniband link state */
@@ -750,8 +750,8 @@ static int ipoib_probe ( struct ib_device *ibdev ) {
750 750
 	ipoib->ibdev = ibdev;
751 751
 
752 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 756
 	/* Set default broadcast address */
757 757
 	memcpy ( &ipoib->broadcast, &ipoib_broadcast,

+ 2
- 2
src/include/ipxe/ib_cm.h Прегледај датотеку

@@ -42,7 +42,7 @@ struct ib_connection {
42 42
 	/** Remote communication ID */
43 43
 	uint32_t remote_id;
44 44
 	/** Target service ID */
45
-	struct ib_gid_half service_id;
45
+	union ib_guid service_id;
46 46
 	/** Connection operations */
47 47
 	struct ib_connection_operations *op;
48 48
 
@@ -62,7 +62,7 @@ struct ib_connection {
62 62
 
63 63
 extern struct ib_connection *
64 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 66
 		 void *req_private_data, size_t req_private_data_len,
67 67
 		 struct ib_connection_operations *op );
68 68
 extern void ib_destroy_conn ( struct ib_device *ibdev,

+ 2
- 2
src/include/ipxe/ib_cmrc.h Прегледај датотеку

@@ -14,7 +14,7 @@ FILE_LICENCE ( BSD2 );
14 14
 
15 15
 extern int ib_cmrc_open ( struct interface *xfer,
16 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 20
 #endif /* _IPXE_IB_CMRC_H */

+ 12
- 12
src/include/ipxe/ib_mad.h Прегледај датотеку

@@ -75,9 +75,9 @@ struct ib_node_info {
75 75
 	uint8_t class_version;
76 76
 	uint8_t node_type;
77 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 81
 	uint16_t partition_cap;
82 82
 	uint16_t device_id;
83 83
 	uint32_t revision;
@@ -221,8 +221,8 @@ struct ib_sa_hdr {
221 221
 
222 222
 struct ib_path_record {
223 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 226
 	uint16_t dlid;
227 227
 	uint16_t slid;
228 228
 	uint32_t hop_limit__flow_label__raw_traffic;
@@ -239,8 +239,8 @@ struct ib_path_record {
239 239
 #define IB_SA_PATH_REC_SGID			(1<<3)
240 240
 
241 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 244
 	uint32_t qkey;
245 245
 	uint16_t mlid;
246 246
 	uint8_t mtu_selector__mtu;
@@ -320,9 +320,9 @@ struct ib_cm_path {
320 320
 	/** Remote port LID */
321 321
 	uint16_t remote_lid;
322 322
 	/** Local port GID */
323
-	struct ib_gid local_gid;
323
+	union ib_gid local_gid;
324 324
 	/** Remote port GID */
325
-	struct ib_gid remote_gid;
325
+	union ib_gid remote_gid;
326 326
 	/** Flow label and rate */
327 327
 	uint32_t flow_label__rate;
328 328
 	/** Traffic class */
@@ -345,9 +345,9 @@ struct ib_cm_connect_request {
345 345
 	/** Reserved */
346 346
 	uint32_t reserved0[1];
347 347
 	/** Service ID */
348
-	struct ib_gid_half service_id;
348
+	union ib_guid service_id;
349 349
 	/** Local CA GUID */
350
-	struct ib_gid_half local_ca;
350
+	union ib_guid local_ca;
351 351
 	/** Reserved */
352 352
 	uint32_t reserved1[1];
353 353
 	/** Local queue key */
@@ -433,7 +433,7 @@ struct ib_cm_connect_reply {
433 433
 	/** RNR retry count, SRQ */
434 434
 	uint8_t rnr_retry__srq;
435 435
 	/** Local CA GUID */
436
-	struct ib_gid_half local_ca;
436
+	union ib_guid local_ca;
437 437
 	/** Private data */
438 438
 	uint8_t private_data[196];
439 439
 } __attribute__ (( packed ));

+ 2
- 2
src/include/ipxe/ib_mcast.h Прегледај датотеку

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

+ 29
- 16
src/include/ipxe/ib_packet.h Прегледај датотеку

@@ -14,25 +14,38 @@ struct ib_queue_pair;
14 14
 struct ib_address_vector;
15 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 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 49
 /** An Infiniband Local Route Header */
37 50
 struct ib_local_route_header {
38 51
 	/** Virtual lane and link version */
@@ -83,9 +96,9 @@ struct ib_global_route_header {
83 96
 	/** Hop limit */
84 97
 	uint8_t hoplmt;
85 98
 	/** Source GID */
86
-	struct ib_gid sgid;
99
+	union ib_gid sgid;
87 100
 	/** Destiniation GID */
88
-	struct ib_gid dgid;
101
+	union ib_gid dgid;
89 102
 } __attribute__ (( packed ));
90 103
 
91 104
 #define IB_GRH_IPVER_IPv6 0x06

+ 7
- 7
src/include/ipxe/ib_srp.h Прегледај датотеку

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

+ 10
- 10
src/include/ipxe/infiniband.h Прегледај датотеку

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

+ 1
- 1
src/include/ipxe/ipoib.h Прегледај датотеку

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

+ 6
- 7
src/net/infiniband.c Прегледај датотеку

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

+ 3
- 6
src/net/infiniband/ib_cm.c Прегледај датотеку

@@ -432,7 +432,7 @@ static struct ib_path_operations ib_cm_path_op = {
432 432
  */
433 433
 struct ib_connection *
434 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 436
 		 void *private_data, size_t private_data_len,
437 437
 		 struct ib_connection_operations *op ) {
438 438
 	struct ib_connection *conn;
@@ -463,11 +463,8 @@ ib_create_conn ( struct ib_device *ibdev, struct ib_queue_pair *qp,
463 463
 
464 464
 	DBGC ( conn, "CM %p created for IBDEV %p QPN %lx\n",
465 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 469
 	return conn;
473 470
 

+ 3
- 3
src/net/infiniband/ib_cmrc.c Прегледај датотеку

@@ -80,9 +80,9 @@ struct ib_cmrc_connection {
80 80
 	/** Connection */
81 81
 	struct ib_connection *conn;
82 82
 	/** Destination GID */
83
-	struct ib_gid dgid;
83
+	union ib_gid dgid;
84 84
 	/** Service ID */
85
-	struct ib_gid_half service_id;
85
+	union ib_guid service_id;
86 86
 	/** QP is connected */
87 87
 	int connected;
88 88
 	/** Shutdown process */
@@ -357,7 +357,7 @@ static struct interface_descriptor ib_cmrc_xfer_desc =
357 357
  * @ret rc		Returns status code
358 358
  */
359 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 361
 	struct ib_cmrc_connection *cmrc;
362 362
 	int rc;
363 363
 

+ 10
- 16
src/net/infiniband/ib_mcast.c Прегледај датотеку

@@ -41,7 +41,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
41 41
  * @v join		Join (rather than leave) group
42 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 45
 			   int join, union ib_mad *mad ) {
46 46
 	struct ib_mad_sa *sa = &mad->sa;
47 47
 
@@ -79,7 +79,7 @@ static void ib_mcast_complete ( struct ib_device *ibdev,
79 79
 				struct ib_address_vector *av __unused ) {
80 80
 	struct ib_mc_membership *membership = ib_madx_get_ownerdata ( madx );
81 81
 	struct ib_queue_pair *qp = membership->qp;
82
-	struct ib_gid *gid = &membership->gid;
82
+	union ib_gid *gid = &membership->gid;
83 83
 	struct ib_mc_member_record *mc_member_record =
84 84
 		&mad->sa.sa_data.mc_member_record;
85 85
 	int joined;
@@ -97,11 +97,9 @@ static void ib_mcast_complete ( struct ib_device *ibdev,
97 97
 	/* Extract values from MAD */
98 98
 	joined = ( mad->hdr.method == IB_MGMT_METHOD_GET_RESP );
99 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 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 104
 	/* Set queue key */
107 105
 	qp->qkey = qkey;
@@ -136,7 +134,7 @@ static struct ib_mad_transaction_operations ib_mcast_op = {
136 134
  * @ret rc		Return status code
137 135
  */
138 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 138
 		    void ( * complete ) ( struct ib_device *ibdev,
141 139
 					  struct ib_queue_pair *qp,
142 140
 					  struct ib_mc_membership *membership,
@@ -144,10 +142,8 @@ int ib_mcast_join ( struct ib_device *ibdev, struct ib_queue_pair *qp,
144 142
 	union ib_mad mad;
145 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 148
 	/* Initialise structure */
153 149
 	membership->qp = qp;
@@ -191,14 +187,12 @@ int ib_mcast_join ( struct ib_device *ibdev, struct ib_queue_pair *qp,
191 187
  */
192 188
 void ib_mcast_leave ( struct ib_device *ibdev, struct ib_queue_pair *qp,
193 189
 		      struct ib_mc_membership *membership ) {
194
-	struct ib_gid *gid = &membership->gid;
190
+	union ib_gid *gid = &membership->gid;
195 191
 	union ib_mad mad;
196 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 197
 	/* Detach from multicast GID */
204 198
 	ib_mcast_detach ( ibdev, qp, &membership->gid );

+ 2
- 5
src/net/infiniband/ib_packet.c Прегледај датотеку

@@ -215,11 +215,8 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
215 215
 		if ( IB_LID_MULTICAST ( lid ) && grh ) {
216 216
 			if ( ! ( *qp = ib_find_qp_mgid ( ibdev, &grh->dgid ))){
217 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 220
 				return -ENODEV;
224 221
 			}
225 222
 		} else {

+ 14
- 22
src/net/infiniband/ib_pathrec.c Прегледај датотеку

@@ -49,18 +49,16 @@ static void ib_path_complete ( struct ib_device *ibdev,
49 49
 			       int rc, union ib_mad *mad,
50 50
 			       struct ib_address_vector *av __unused ) {
51 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 53
 	struct ib_path_record *pathrec = &mad->sa.sa_data.path_record;
54 54
 
55 55
 	/* Report failures */
56 56
 	if ( ( rc == 0 ) && ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ))
57 57
 		rc = -ENETUNREACH;
58 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 62
 		goto out;
65 63
 	}
66 64
 
@@ -68,10 +66,8 @@ static void ib_path_complete ( struct ib_device *ibdev,
68 66
 	path->av.lid = ntohs ( pathrec->dlid );
69 67
 	path->av.sl = ( pathrec->reserved__sl & 0x0f );
70 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 71
 	       path->av.rate );
76 72
 
77 73
  out:
@@ -179,7 +175,7 @@ static unsigned int ib_path_cache_idx;
179 175
  * @ret path		Path cache entry, or NULL
180 176
  */
181 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 179
 	struct ib_cached_path *cached;
184 180
 	unsigned int i;
185 181
 
@@ -240,14 +236,14 @@ static struct ib_path_operations ib_cached_path_op = {
240 236
  * cache similar to ARP.
241 237
  */
242 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 240
 	struct ib_cached_path *cached;
245 241
 	unsigned int cache_idx;
246 242
 
247 243
 	/* Sanity check */
248 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 247
 		return -EINVAL;
252 248
 	}
253 249
 
@@ -258,16 +254,12 @@ int ib_resolve_path ( struct ib_device *ibdev, struct ib_address_vector *av ) {
258 254
 		av->lid = cached->path->av.lid;
259 255
 		av->rate = cached->path->av.rate;
260 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 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 264
 	/* If lookup is already in progress, do nothing */
273 265
 	if ( cached )

+ 9
- 9
src/net/infiniband/ib_sma.c Прегледај датотеку

@@ -61,7 +61,7 @@ static void ib_sma_node_info ( struct ib_device *ibdev,
61 61
 	node_info->num_ports = ib_get_hca_info ( ibdev, &node_info->sys_guid );
62 62
 	memcpy ( &node_info->node_guid, &node_info->sys_guid,
63 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 65
 		 sizeof ( node_info->port_guid ) );
66 66
 	node_info->partition_cap = htons ( 1 );
67 67
 	node_info->local_port_num = ibdev->port;
@@ -88,7 +88,7 @@ static void ib_sma_node_desc ( struct ib_device *ibdev,
88 88
 			       union ib_mad *mad,
89 89
 			       struct ib_address_vector *av ) {
90 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 92
 	char hostname[ sizeof ( node_desc->node_string ) ];
93 93
 	int hostname_len;
94 94
 	int rc;
@@ -101,9 +101,9 @@ static void ib_sma_node_desc ( struct ib_device *ibdev,
101 101
 	snprintf ( node_desc->node_string, sizeof ( node_desc->node_string ),
102 102
 		   "iPXE %s%s%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x (%s)",
103 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 108
 	/* Send GetResponse */
109 109
 	mad->hdr.method = IB_MGMT_METHOD_GET_RESP;
@@ -131,7 +131,7 @@ static void ib_sma_guid_info ( struct ib_device *ibdev,
131 131
 
132 132
 	/* Fill in information */
133 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 135
 		 sizeof ( guid_info->guid[0] ) );
136 136
 
137 137
 	/* Send GetResponse */
@@ -160,8 +160,8 @@ static int ib_sma_set_port_info ( struct ib_device *ibdev,
160 160
 	int rc;
161 161
 
162 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 165
 	ibdev->lid = ntohs ( port_info->lid );
166 166
 	ibdev->sm_lid = ntohs ( port_info->mastersm_lid );
167 167
 	if ( ( link_width_enabled = port_info->link_width_enabled ) )
@@ -210,7 +210,7 @@ static void ib_sma_port_info ( struct ib_device *ibdev,
210 210
 
211 211
 	/* Fill in information */
212 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 214
 		 sizeof ( port_info->gid_prefix ) );
215 215
 	port_info->lid = ntohs ( ibdev->lid );
216 216
 	port_info->mastersm_lid = ntohs ( ibdev->sm_lid );

+ 6
- 9
src/net/infiniband/ib_smc.c Прегледај датотеку

@@ -141,8 +141,8 @@ int ib_smc_update ( struct ib_device *ibdev, ib_local_mad_t local_mad ) {
141 141
 	 */
142 142
 	if ( ( rc = ib_smc_get_port_info ( ibdev, local_mad, &mad ) ) != 0 )
143 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 146
 	ibdev->lid = ntohs ( port_info->lid );
147 147
 	ibdev->sm_lid = ntohs ( port_info->mastersm_lid );
148 148
 	ibdev->link_width_enabled = port_info->link_width_enabled;
@@ -161,19 +161,16 @@ int ib_smc_update ( struct ib_device *ibdev, ib_local_mad_t local_mad ) {
161 161
 	/* GUID info gives us the second half of the port GID */
162 162
 	if ( ( rc = ib_smc_get_guid_info ( ibdev, local_mad, &mad ) ) != 0 )
163 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 167
 	/* Get partition key */
168 168
 	if ( ( rc = ib_smc_get_pkey_table ( ibdev, local_mad, &mad ) ) != 0 )
169 169
 		return rc;
170 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 175
 	return 0;
179 176
 }

+ 16
- 19
src/net/infiniband/ib_srp.c Прегледај датотеку

@@ -81,9 +81,9 @@ struct ib_srp_device {
81 81
 	struct ib_device *ibdev;
82 82
 
83 83
 	/** Destination GID (for boot firmware table) */
84
-	struct ib_gid dgid;
84
+	union ib_gid dgid;
85 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,7 +184,7 @@ static struct interface_descriptor ib_srp_srp_desc =
184 184
  * @ret rc		Return status code
185 185
  */
186 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 188
 			 union srp_port_id *initiator,
189 189
 			 union srp_port_id *target, struct scsi_lun *lun ) {
190 190
 	struct ib_srp_device *ib_srp;
@@ -200,11 +200,8 @@ static int ib_srp_open ( struct interface *block, struct ib_device *ibdev,
200 200
 	intf_init ( &ib_srp->srp, &ib_srp_srp_desc, &ib_srp->refcnt );
201 201
 	intf_init ( &ib_srp->cmrc, &ib_srp_cmrc_desc, &ib_srp->refcnt );
202 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 206
 	/* Preserve parameters required for boot firmware table */
210 207
 	memcpy ( &ib_srp->dgid, dgid, sizeof ( ib_srp->dgid ) );
@@ -256,15 +253,15 @@ enum ib_srp_parse_flags {
256 253
 /** IB SRP root path parameters */
257 254
 struct ib_srp_root_path {
258 255
 	/** Source GID */
259
-	struct ib_gid sgid;
256
+	union ib_gid sgid;
260 257
 	/** Initiator port ID */
261 258
 	union ib_srp_initiator_port_id initiator;
262 259
 	/** Destination GID */
263
-	struct ib_gid dgid;
260
+	union ib_gid dgid;
264 261
 	/** Partition key */
265 262
 	uint16_t pkey;
266 263
 	/** Service ID */
267
-	struct ib_gid_half service_id;
264
+	union ib_guid service_id;
268 265
 	/** SCSI LUN */
269 266
 	struct scsi_lun lun;
270 267
 	/** Target port ID */
@@ -337,7 +334,7 @@ static int ib_srp_parse_sgid ( const char *rp_comp,
337 334
 	if ( ( ibdev = last_opened_ibdev() ) != NULL )
338 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 338
 					  ( sizeof ( rp->sgid ) |
342 339
 					    IB_SRP_PARSE_OPTIONAL ) );
343 340
 }
@@ -353,7 +350,7 @@ static int ib_srp_parse_initiator_id_ext ( const char *rp_comp,
353 350
 					   struct ib_srp_root_path *rp ) {
354 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 354
 					  ( sizeof ( port_id->ib.id_ext ) |
358 355
 					    IB_SRP_PARSE_OPTIONAL ) );
359 356
 }
@@ -370,10 +367,10 @@ static int ib_srp_parse_initiator_hca_guid ( const char *rp_comp,
370 367
 	union ib_srp_initiator_port_id *port_id = &rp->initiator;
371 368
 
372 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 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 374
 					  ( sizeof ( port_id->ib.hca_guid ) |
378 375
 					    IB_SRP_PARSE_OPTIONAL ) );
379 376
 }
@@ -387,7 +384,7 @@ static int ib_srp_parse_initiator_hca_guid ( const char *rp_comp,
387 384
  */
388 385
 static int ib_srp_parse_dgid ( const char *rp_comp,
389 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 388
 					  ( sizeof ( rp->dgid ) |
392 389
 					    IB_SRP_PARSE_REQUIRED ) );
393 390
 }
@@ -418,7 +415,7 @@ static int ib_srp_parse_pkey ( const char *rp_comp,
418 415
  */
419 416
 static int ib_srp_parse_service_id ( const char *rp_comp,
420 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 419
 					  ( sizeof ( rp->service_id ) |
423 420
 					    IB_SRP_PARSE_REQUIRED ) );
424 421
 }
@@ -446,7 +443,7 @@ static int ib_srp_parse_target_id_ext ( const char *rp_comp,
446 443
 					struct ib_srp_root_path *rp ) {
447 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 447
 					  ( sizeof ( port_id->ib.id_ext ) |
451 448
 					    IB_SRP_PARSE_REQUIRED ) );
452 449
 }
@@ -462,7 +459,7 @@ static int ib_srp_parse_target_ioc_guid ( const char *rp_comp,
462 459
 					  struct ib_srp_root_path *rp ) {
463 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 463
 					  ( sizeof ( port_id->ib.ioc_guid ) |
467 464
 					    IB_SRP_PARSE_REQUIRED ) );
468 465
 }

Loading…
Откажи
Сачувај