summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/drivers/infiniband/arbel.c12
-rw-r--r--src/drivers/infiniband/hermon.c6
-rw-r--r--src/drivers/infiniband/linda.c17
-rw-r--r--src/drivers/infiniband/qib7322.c24
-rw-r--r--src/drivers/net/ipoib.c50
-rw-r--r--src/include/ipxe/ib_cm.h4
-rw-r--r--src/include/ipxe/ib_cmrc.h4
-rw-r--r--src/include/ipxe/ib_mad.h24
-rw-r--r--src/include/ipxe/ib_mcast.h4
-rw-r--r--src/include/ipxe/ib_packet.h45
-rw-r--r--src/include/ipxe/ib_srp.h14
-rw-r--r--src/include/ipxe/infiniband.h20
-rw-r--r--src/include/ipxe/ipoib.h2
-rw-r--r--src/net/infiniband.c13
-rw-r--r--src/net/infiniband/ib_cm.c9
-rw-r--r--src/net/infiniband/ib_cmrc.c6
-rw-r--r--src/net/infiniband/ib_mcast.c26
-rw-r--r--src/net/infiniband/ib_packet.c7
-rw-r--r--src/net/infiniband/ib_pathrec.c36
-rw-r--r--src/net/infiniband/ib_sma.c18
-rw-r--r--src/net/infiniband/ib_smc.c15
-rw-r--r--src/net/infiniband/ib_srp.c35
22 files changed, 186 insertions, 205 deletions
diff --git a/src/drivers/infiniband/arbel.c b/src/drivers/infiniband/arbel.c
index 5937c5249..129ec574e 100644
--- a/src/drivers/infiniband/arbel.c
+++ b/src/drivers/infiniband/arbel.c
@@ -396,7 +396,7 @@ arbel_cmd_write_mgm ( struct arbel *arbel, unsigned int index,
}
static inline int
-arbel_cmd_mgid_hash ( struct arbel *arbel, const struct ib_gid *gid,
+arbel_cmd_mgid_hash ( struct arbel *arbel, const union ib_gid *gid,
struct arbelprm_mgm_hash *hash ) {
return arbel_cmd ( arbel,
ARBEL_HCR_INOUT_CMD ( ARBEL_HCR_MGID_HASH,
@@ -998,8 +998,8 @@ static void arbel_ring_doorbell ( struct arbel *arbel,
}
/** GID used for GID-less send work queue entries */
-static const struct ib_gid arbel_no_gid = {
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0 } }
+static const union ib_gid arbel_no_gid = {
+ .bytes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0 },
};
/**
@@ -1023,7 +1023,7 @@ static int arbel_post_send ( struct ib_device *ibdev,
struct arbelprm_ud_send_wqe *wqe;
struct arbelprm_qp_db_record *qp_db_rec;
union arbelprm_doorbell_register db_reg;
- const struct ib_gid *gid;
+ const union ib_gid *gid;
unsigned int wqe_idx_mask;
size_t nds;
@@ -1565,7 +1565,7 @@ static void arbel_close ( struct ib_device *ibdev ) {
*/
static int arbel_mcast_attach ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
- struct ib_gid *gid ) {
+ union ib_gid *gid ) {
struct arbel *arbel = ib_get_drvdata ( ibdev );
struct arbelprm_mgm_hash hash;
struct arbelprm_mgm_entry mgm;
@@ -1620,7 +1620,7 @@ static int arbel_mcast_attach ( struct ib_device *ibdev,
*/
static void arbel_mcast_detach ( struct ib_device *ibdev,
struct ib_queue_pair *qp __unused,
- struct ib_gid *gid ) {
+ union ib_gid *gid ) {
struct arbel *arbel = ib_get_drvdata ( ibdev );
struct arbelprm_mgm_hash hash;
struct arbelprm_mgm_entry mgm;
diff --git a/src/drivers/infiniband/hermon.c b/src/drivers/infiniband/hermon.c
index f074386ff..8b5c2487c 100644
--- a/src/drivers/infiniband/hermon.c
+++ b/src/drivers/infiniband/hermon.c
@@ -474,7 +474,7 @@ hermon_cmd_write_mcg ( struct hermon *hermon, unsigned int index,
}
static inline int
-hermon_cmd_mgid_hash ( struct hermon *hermon, const struct ib_gid *gid,
+hermon_cmd_mgid_hash ( struct hermon *hermon, const union ib_gid *gid,
struct hermonprm_mgm_hash *hash ) {
return hermon_cmd ( hermon,
HERMON_HCR_INOUT_CMD ( HERMON_HCR_MGID_HASH,
@@ -2012,7 +2012,7 @@ static int hermon_inform_sma ( struct ib_device *ibdev,
*/
static int hermon_mcast_attach ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
- struct ib_gid *gid ) {
+ union ib_gid *gid ) {
struct hermon *hermon = ib_get_drvdata ( ibdev );
struct hermonprm_mgm_hash hash;
struct hermonprm_mcg_entry mcg;
@@ -2066,7 +2066,7 @@ static int hermon_mcast_attach ( struct ib_device *ibdev,
*/
static void hermon_mcast_detach ( struct ib_device *ibdev,
struct ib_queue_pair *qp __unused,
- struct ib_gid *gid ) {
+ union ib_gid *gid ) {
struct hermon *hermon = ib_get_drvdata ( ibdev );
struct hermonprm_mgm_hash hash;
struct hermonprm_mcg_entry mcg;
diff --git a/src/drivers/infiniband/linda.c b/src/drivers/infiniband/linda.c
index 83d473c7f..12a09a047 100644
--- a/src/drivers/infiniband/linda.c
+++ b/src/drivers/infiniband/linda.c
@@ -1456,7 +1456,7 @@ static void linda_close ( struct ib_device *ibdev ) {
*/
static int linda_mcast_attach ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
- struct ib_gid *gid ) {
+ union ib_gid *gid ) {
struct linda *linda = ib_get_drvdata ( ibdev );
( void ) linda;
@@ -1474,7 +1474,7 @@ static int linda_mcast_attach ( struct ib_device *ibdev,
*/
static void linda_mcast_detach ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
- struct ib_gid *gid ) {
+ union ib_gid *gid ) {
struct linda *linda = ib_get_drvdata ( ibdev );
( void ) linda;
@@ -1631,22 +1631,19 @@ static int linda_init_i2c ( struct linda *linda ) {
* @v guid GUID to fill in
* @ret rc Return status code
*/
-static int linda_read_eeprom ( struct linda *linda,
- struct ib_gid_half *guid ) {
+static int linda_read_eeprom ( struct linda *linda, union ib_guid *guid ) {
struct i2c_interface *i2c = &linda->i2c.i2c;
int rc;
/* Read GUID */
if ( ( rc = i2c->read ( i2c, &linda->eeprom, LINDA_EEPROM_GUID_OFFSET,
- guid->u.bytes, sizeof ( *guid ) ) ) != 0 ) {
+ guid->bytes, sizeof ( *guid ) ) ) != 0 ) {
DBGC ( linda, "Linda %p could not read GUID: %s\n",
linda, strerror ( rc ) );
return rc;
}
- DBGC2 ( linda, "Linda %p has GUID %02x:%02x:%02x:%02x:%02x:%02x:"
- "%02x:%02x\n", linda, guid->u.bytes[0], guid->u.bytes[1],
- guid->u.bytes[2], guid->u.bytes[3], guid->u.bytes[4],
- guid->u.bytes[5], guid->u.bytes[6], guid->u.bytes[7] );
+ DBGC2 ( linda, "Linda %p has GUID " IB_GUID_FMT "\n",
+ linda, IB_GUID_ARGS ( guid ) );
/* Read serial number (debug only) */
if ( DBG_LOG ) {
@@ -2367,7 +2364,7 @@ static int linda_probe ( struct pci_device *pci,
goto err_init_i2c;
/* Read EEPROM parameters */
- if ( ( rc = linda_read_eeprom ( linda, &ibdev->gid.u.half[1] ) ) != 0 )
+ if ( ( rc = linda_read_eeprom ( linda, &ibdev->gid.s.guid ) ) != 0 )
goto err_read_eeprom;
/* Initialise send datapath */
diff --git a/src/drivers/infiniband/qib7322.c b/src/drivers/infiniband/qib7322.c
index e8b41a47c..b1902cfa9 100644
--- a/src/drivers/infiniband/qib7322.c
+++ b/src/drivers/infiniband/qib7322.c
@@ -118,7 +118,7 @@ struct qib7322 {
struct i2c_device eeprom;
/** Base GUID */
- struct ib_gid_half guid;
+ union ib_guid guid;
/** Infiniband devices */
struct ib_device *ibdev[QIB7322_MAX_PORTS];
};
@@ -1770,7 +1770,7 @@ static void qib7322_close ( struct ib_device *ibdev ) {
*/
static int qib7322_mcast_attach ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
- struct ib_gid *gid ) {
+ union ib_gid *gid ) {
struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
( void ) qib7322;
@@ -1788,7 +1788,7 @@ static int qib7322_mcast_attach ( struct ib_device *ibdev,
*/
static void qib7322_mcast_detach ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
- struct ib_gid *gid ) {
+ union ib_gid *gid ) {
struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
( void ) qib7322;
@@ -1946,21 +1946,19 @@ static int qib7322_init_i2c ( struct qib7322 *qib7322 ) {
*/
static int qib7322_read_eeprom ( struct qib7322 *qib7322 ) {
struct i2c_interface *i2c = &qib7322->i2c.i2c;
- struct ib_gid_half *guid = &qib7322->guid;
+ union ib_guid *guid = &qib7322->guid;
int rc;
/* Read GUID */
if ( ( rc = i2c->read ( i2c, &qib7322->eeprom,
- QIB7322_EEPROM_GUID_OFFSET, guid->u.bytes,
+ QIB7322_EEPROM_GUID_OFFSET, guid->bytes,
sizeof ( *guid ) ) ) != 0 ) {
DBGC ( qib7322, "QIB7322 %p could not read GUID: %s\n",
qib7322, strerror ( rc ) );
return rc;
}
- DBGC2 ( qib7322, "QIB7322 %p has GUID %02x:%02x:%02x:%02x:%02x:%02x:"
- "%02x:%02x\n", qib7322, guid->u.bytes[0], guid->u.bytes[1],
- guid->u.bytes[2], guid->u.bytes[3], guid->u.bytes[4],
- guid->u.bytes[5], guid->u.bytes[6], guid->u.bytes[7] );
+ DBGC2 ( qib7322, "QIB7322 %p has GUID " IB_GUID_FMT "\n",
+ qib7322, IB_GUID_ARGS ( guid ) );
/* Read serial number (debug only) */
if ( DBG_LOG ) {
@@ -2359,10 +2357,10 @@ static int qib7322_probe ( struct pci_device *pci,
IB_LINK_WIDTH_4X; /* 1x does not work */
ibdev->link_speed_enabled = ibdev->link_speed_supported =
IB_LINK_SPEED_SDR; /* to avoid need for link tuning */
- memcpy ( &ibdev->gid.u.half[1], &qib7322->guid,
- sizeof ( ibdev->gid.u.half[1] ) );
- assert ( ( ibdev->gid.u.half[1].u.bytes[7] & i ) == 0 );
- ibdev->gid.u.half[1].u.bytes[7] |= i;
+ memcpy ( &ibdev->gid.s.guid, &qib7322->guid,
+ sizeof ( ibdev->gid.s.guid ) );
+ assert ( ( ibdev->gid.s.guid.bytes[7] & i ) == 0 );
+ ibdev->gid.s.guid.bytes[7] |= i;
ib_set_drvdata ( ibdev, qib7322 );
}
diff --git a/src/drivers/net/ipoib.c b/src/drivers/net/ipoib.c
index 82d7ca999..52ac5f03a 100644
--- a/src/drivers/net/ipoib.c
+++ b/src/drivers/net/ipoib.c
@@ -72,8 +72,8 @@ struct ipoib_device {
/** Broadcast IPoIB address */
static struct ipoib_mac ipoib_broadcast = {
.flags__qpn = htonl ( IB_QPN_BROADCAST ),
- .gid.u.bytes = { 0xff, 0x12, 0x40, 0x1b, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff },
+ .gid.bytes = { 0xff, 0x12, 0x40, 0x1b, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff },
};
/** Link status for "broadcast join in progress" */
@@ -266,11 +266,11 @@ static int ipoib_pull ( struct net_device *netdev,
* @v ll_addr Link-layer address
*/
static void ipoib_init_addr ( const void *hw_addr, void *ll_addr ) {
- const struct ib_gid_half *guid = hw_addr;
+ const union ib_guid *guid = hw_addr;
struct ipoib_mac *mac = ll_addr;
memset ( mac, 0, sizeof ( *mac ) );
- memcpy ( &mac->gid.u.half[1], guid, sizeof ( mac->gid.u.half[1] ) );
+ memcpy ( &mac->gid.s.guid, guid, sizeof ( mac->gid.s.guid ) );
}
/**
@@ -284,10 +284,10 @@ const char * ipoib_ntoa ( const void *ll_addr ) {
const struct ipoib_mac *mac = ll_addr;
snprintf ( buf, sizeof ( buf ), "%08x:%08x:%08x:%08x:%08x",
- htonl ( mac->flags__qpn ), htonl ( mac->gid.u.dwords[0] ),
- htonl ( mac->gid.u.dwords[1] ),
- htonl ( mac->gid.u.dwords[2] ),
- htonl ( mac->gid.u.dwords[3] ) );
+ htonl ( mac->flags__qpn ), htonl ( mac->gid.dwords[0] ),
+ htonl ( mac->gid.dwords[1] ),
+ htonl ( mac->gid.dwords[2] ),
+ htonl ( mac->gid.dwords[3] ) );
return buf;
}
@@ -312,14 +312,14 @@ static int ipoib_mc_hash ( unsigned int af __unused,
* @v ll_addr Link-layer address
* @v eth_addr Ethernet-compatible address to fill in
*/
-static int ipoib_mlx_eth_addr ( const struct ib_gid_half *guid,
+static int ipoib_mlx_eth_addr ( const union ib_guid *guid,
uint8_t *eth_addr ) {
- eth_addr[0] = ( ( guid->u.bytes[3] == 2 ) ? 0x00 : 0x02 );
- eth_addr[1] = guid->u.bytes[1];
- eth_addr[2] = guid->u.bytes[2];
- eth_addr[3] = guid->u.bytes[5];
- eth_addr[4] = guid->u.bytes[6];
- eth_addr[5] = guid->u.bytes[7];
+ eth_addr[0] = ( ( guid->bytes[3] == 2 ) ? 0x00 : 0x02 );
+ eth_addr[1] = guid->bytes[1];
+ eth_addr[2] = guid->bytes[2];
+ eth_addr[3] = guid->bytes[5];
+ eth_addr[4] = guid->bytes[6];
+ eth_addr[5] = guid->bytes[7];
return 0;
}
@@ -330,7 +330,7 @@ struct ipoib_eth_addr_handler {
/** GUID byte 2 */
uint8_t byte2;
/** Handler */
- int ( * eth_addr ) ( const struct ib_gid_half *guid,
+ int ( * eth_addr ) ( const union ib_guid *guid,
uint8_t *eth_addr );
};
@@ -347,15 +347,15 @@ static struct ipoib_eth_addr_handler ipoib_eth_addr_handlers[] = {
*/
static int ipoib_eth_addr ( const void *ll_addr, void *eth_addr ) {
const struct ipoib_mac *ipoib_addr = ll_addr;
- const struct ib_gid_half *guid = &ipoib_addr->gid.u.half[1];
+ const union ib_guid *guid = &ipoib_addr->gid.s.guid;
struct ipoib_eth_addr_handler *handler;
unsigned int i;
for ( i = 0 ; i < ( sizeof ( ipoib_eth_addr_handlers ) /
sizeof ( ipoib_eth_addr_handlers[0] ) ) ; i++ ) {
handler = &ipoib_eth_addr_handlers[i];
- if ( ( handler->byte1 == guid->u.bytes[1] ) &&
- ( handler->byte2 == guid->u.bytes[2] ) ) {
+ if ( ( handler->byte1 == guid->bytes[1] ) &&
+ ( handler->byte2 == guid->bytes[2] ) ) {
return handler->eth_addr ( guid, eth_addr );
}
}
@@ -366,7 +366,7 @@ static int ipoib_eth_addr ( const void *ll_addr, void *eth_addr ) {
struct ll_protocol ipoib_protocol __ll_protocol = {
.name = "IPoIB",
.ll_proto = htons ( ARPHRD_INFINIBAND ),
- .hw_addr_len = sizeof ( struct ib_gid_half ),
+ .hw_addr_len = sizeof ( union ib_guid ),
.ll_addr_len = IPOIB_ALEN,
.ll_header_len = IPOIB_HLEN,
.push = ipoib_push,
@@ -612,11 +612,11 @@ static void ipoib_link_state_changed ( struct ib_device *ibdev ) {
ipoib_leave_broadcast_group ( ipoib );
/* Update MAC address based on potentially-new GID prefix */
- memcpy ( &mac->gid.u.half[0], &ibdev->gid.u.half[0],
- sizeof ( mac->gid.u.half[0] ) );
+ memcpy ( &mac->gid.s.prefix, &ibdev->gid.s.prefix,
+ sizeof ( mac->gid.s.prefix ) );
/* Update broadcast GID based on potentially-new partition key */
- ipoib->broadcast.gid.u.words[2] =
+ ipoib->broadcast.gid.words[2] =
htons ( ibdev->pkey | IB_PKEY_FULL );
/* Set net device link state to reflect Infiniband link state */
@@ -750,8 +750,8 @@ static int ipoib_probe ( struct ib_device *ibdev ) {
ipoib->ibdev = ibdev;
/* Extract hardware address */
- memcpy ( netdev->hw_addr, &ibdev->gid.u.half[1],
- sizeof ( ibdev->gid.u.half[1] ) );
+ memcpy ( netdev->hw_addr, &ibdev->gid.s.guid,
+ sizeof ( ibdev->gid.s.guid ) );
/* Set default broadcast address */
memcpy ( &ipoib->broadcast, &ipoib_broadcast,
diff --git a/src/include/ipxe/ib_cm.h b/src/include/ipxe/ib_cm.h
index 136e4943b..7d08cd9b1 100644
--- a/src/include/ipxe/ib_cm.h
+++ b/src/include/ipxe/ib_cm.h
@@ -42,7 +42,7 @@ struct ib_connection {
/** Remote communication ID */
uint32_t remote_id;
/** Target service ID */
- struct ib_gid_half service_id;
+ union ib_guid service_id;
/** Connection operations */
struct ib_connection_operations *op;
@@ -62,7 +62,7 @@ struct ib_connection {
extern struct ib_connection *
ib_create_conn ( struct ib_device *ibdev, struct ib_queue_pair *qp,
- struct ib_gid *dgid, struct ib_gid_half *service_id,
+ union ib_gid *dgid, union ib_guid *service_id,
void *req_private_data, size_t req_private_data_len,
struct ib_connection_operations *op );
extern void ib_destroy_conn ( struct ib_device *ibdev,
diff --git a/src/include/ipxe/ib_cmrc.h b/src/include/ipxe/ib_cmrc.h
index 4f2eae69e..47ad27fa6 100644
--- a/src/include/ipxe/ib_cmrc.h
+++ b/src/include/ipxe/ib_cmrc.h
@@ -14,7 +14,7 @@ FILE_LICENCE ( BSD2 );
extern int ib_cmrc_open ( struct interface *xfer,
struct ib_device *ibdev,
- struct ib_gid *dgid,
- struct ib_gid_half *service_id );
+ union ib_gid *dgid,
+ union ib_guid *service_id );
#endif /* _IPXE_IB_CMRC_H */
diff --git a/src/include/ipxe/ib_mad.h b/src/include/ipxe/ib_mad.h
index 23c2657ca..b8694833e 100644
--- a/src/include/ipxe/ib_mad.h
+++ b/src/include/ipxe/ib_mad.h
@@ -75,9 +75,9 @@ struct ib_node_info {
uint8_t class_version;
uint8_t node_type;
uint8_t num_ports;
- struct ib_gid_half sys_guid;
- struct ib_gid_half node_guid;
- struct ib_gid_half port_guid;
+ union ib_guid sys_guid;
+ union ib_guid node_guid;
+ union ib_guid port_guid;
uint16_t partition_cap;
uint16_t device_id;
uint32_t revision;
@@ -221,8 +221,8 @@ struct ib_sa_hdr {
struct ib_path_record {
uint32_t reserved0[2];
- struct ib_gid dgid;
- struct ib_gid sgid;
+ union ib_gid dgid;
+ union ib_gid sgid;
uint16_t dlid;
uint16_t slid;
uint32_t hop_limit__flow_label__raw_traffic;
@@ -239,8 +239,8 @@ struct ib_path_record {
#define IB_SA_PATH_REC_SGID (1<<3)
struct ib_mc_member_record {
- struct ib_gid mgid;
- struct ib_gid port_gid;
+ union ib_gid mgid;
+ union ib_gid port_gid;
uint32_t qkey;
uint16_t mlid;
uint8_t mtu_selector__mtu;
@@ -320,9 +320,9 @@ struct ib_cm_path {
/** Remote port LID */
uint16_t remote_lid;
/** Local port GID */
- struct ib_gid local_gid;
+ union ib_gid local_gid;
/** Remote port GID */
- struct ib_gid remote_gid;
+ union ib_gid remote_gid;
/** Flow label and rate */
uint32_t flow_label__rate;
/** Traffic class */
@@ -345,9 +345,9 @@ struct ib_cm_connect_request {
/** Reserved */
uint32_t reserved0[1];
/** Service ID */
- struct ib_gid_half service_id;
+ union ib_guid service_id;
/** Local CA GUID */
- struct ib_gid_half local_ca;
+ union ib_guid local_ca;
/** Reserved */
uint32_t reserved1[1];
/** Local queue key */
@@ -433,7 +433,7 @@ struct ib_cm_connect_reply {
/** RNR retry count, SRQ */
uint8_t rnr_retry__srq;
/** Local CA GUID */
- struct ib_gid_half local_ca;
+ union ib_guid local_ca;
/** Private data */
uint8_t private_data[196];
} __attribute__ (( packed ));
diff --git a/src/include/ipxe/ib_mcast.h b/src/include/ipxe/ib_mcast.h
index 86d570908..a5c22a03e 100644
--- a/src/include/ipxe/ib_mcast.h
+++ b/src/include/ipxe/ib_mcast.h
@@ -18,7 +18,7 @@ struct ib_mc_membership {
/** Queue pair */
struct ib_queue_pair *qp;
/** Multicast GID */
- struct ib_gid gid;
+ union ib_gid gid;
/** Multicast group join transaction */
struct ib_mad_transaction *madx;
/** Handle join success/failure
@@ -36,7 +36,7 @@ struct ib_mc_membership {
extern int ib_mcast_join ( struct ib_device *ibdev, struct ib_queue_pair *qp,
struct ib_mc_membership *membership,
- struct ib_gid *gid,
+ union ib_gid *gid,
void ( * joined ) ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
struct ib_mc_membership *memb,
diff --git a/src/include/ipxe/ib_packet.h b/src/include/ipxe/ib_packet.h
index 09042957b..4bd335764 100644
--- a/src/include/ipxe/ib_packet.h
+++ b/src/include/ipxe/ib_packet.h
@@ -14,25 +14,38 @@ struct ib_queue_pair;
struct ib_address_vector;
struct io_buffer;
-/** Half of an Infiniband Global Identifier */
-struct ib_gid_half {
- union {
- uint8_t bytes[8];
- uint16_t words[4];
- uint32_t dwords[2];
- } u;
+/** An Infiniband Globally Unique Identifier */
+union ib_guid {
+ uint8_t bytes[8];
+ uint16_t words[4];
+ uint32_t dwords[2];
};
+/** Infiniband Globally Unique Identifier debug message format */
+#define IB_GUID_FMT "%08x:%08x"
+
+/** Infiniband Globally Unique Identifier debug message arguments */
+#define IB_GUID_ARGS( guid ) \
+ ntohl ( (guid)->dwords[0] ), ntohl ( (guid)->dwords[1] )
+
/** An Infiniband Global Identifier */
-struct ib_gid {
- union {
- uint8_t bytes[16];
- uint16_t words[8];
- uint32_t dwords[4];
- struct ib_gid_half half[2];
- } u;
+union ib_gid {
+ uint8_t bytes[16];
+ uint16_t words[8];
+ uint32_t dwords[4];
+ struct {
+ union ib_guid prefix;
+ union ib_guid guid;
+ } s;
};
+/** Infiniband Global Identifier debug message format */
+#define IB_GID_FMT IB_GUID_FMT ":" IB_GUID_FMT
+
+/** Infiniband Global Identifier debug message arguments */
+#define IB_GID_ARGS( gid ) \
+ IB_GUID_ARGS ( &(gid)->s.prefix ), IB_GUID_ARGS ( &(gid)->s.guid )
+
/** An Infiniband Local Route Header */
struct ib_local_route_header {
/** Virtual lane and link version */
@@ -83,9 +96,9 @@ struct ib_global_route_header {
/** Hop limit */
uint8_t hoplmt;
/** Source GID */
- struct ib_gid sgid;
+ union ib_gid sgid;
/** Destiniation GID */
- struct ib_gid dgid;
+ union ib_gid dgid;
} __attribute__ (( packed ));
#define IB_GRH_IPVER_IPv6 0x06
diff --git a/src/include/ipxe/ib_srp.h b/src/include/ipxe/ib_srp.h
index 902bef562..ad407b0cf 100644
--- a/src/include/ipxe/ib_srp.h
+++ b/src/include/ipxe/ib_srp.h
@@ -20,9 +20,9 @@ union ib_srp_initiator_port_id {
/** Infiniband version of port identifier */
struct {
/** Identifier extension */
- struct ib_gid_half id_ext;
+ union ib_guid id_ext;
/** IB channel adapter GUID */
- struct ib_gid_half hca_guid;
+ union ib_guid hca_guid;
} __attribute__ (( packed )) ib;
};
@@ -33,9 +33,9 @@ union ib_srp_target_port_id {
/** Infiniband version of port identifier */
struct {
/** Identifier extension */
- struct ib_gid_half id_ext;
+ union ib_guid id_ext;
/** I/O controller GUID */
- struct ib_gid_half ioc_guid;
+ union ib_guid ioc_guid;
} __attribute__ (( packed )) ib;
};
@@ -44,11 +44,11 @@ union ib_srp_target_port_id {
*/
struct sbft_ib_subtable {
/** Source GID */
- struct ib_gid sgid;
+ union ib_gid sgid;
/** Destination GID */
- struct ib_gid dgid;
+ union ib_gid dgid;
/** Service ID */
- struct ib_gid_half service_id;
+ union ib_guid service_id;
/** Partition key */
uint16_t pkey;
/** Reserved */
diff --git a/src/include/ipxe/infiniband.h b/src/include/ipxe/infiniband.h
index edcce371c..aa67dd4ab 100644
--- a/src/include/ipxe/infiniband.h
+++ b/src/include/ipxe/infiniband.h
@@ -88,7 +88,7 @@ struct ib_address_vector {
/** GID is present */
unsigned int gid_present;
/** GID, if present */
- struct ib_gid gid;
+ union ib_gid gid;
};
/** An Infiniband Work Queue */
@@ -126,7 +126,7 @@ struct ib_multicast_gid {
/** List of multicast GIDs on this QP */
struct list_head list;
/** Multicast GID */
- struct ib_gid gid;
+ union ib_gid gid;
};
/** An Infiniband queue pair type */
@@ -338,7 +338,7 @@ struct ib_device_operations {
*/
int ( * mcast_attach ) ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
- struct ib_gid *gid );
+ union ib_gid *gid );
/** Detach from multicast group
*
* @v ibdev Infiniband device
@@ -347,7 +347,7 @@ struct ib_device_operations {
*/
void ( * mcast_detach ) ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
- struct ib_gid *gid );
+ union ib_gid *gid );
/** Set port information
*
* @v ibdev Infiniband device
@@ -405,7 +405,7 @@ struct ib_device {
/** Link speed active */
uint8_t link_speed_active;
/** Port GID */
- struct ib_gid gid;
+ union ib_gid gid;
/** Port LID */
uint16_t lid;
/** Subnet manager LID */
@@ -479,7 +479,7 @@ extern void ib_destroy_qp ( struct ib_device *ibdev,
extern struct ib_queue_pair * ib_find_qp_qpn ( struct ib_device *ibdev,
unsigned long qpn );
extern struct ib_queue_pair * ib_find_qp_mgid ( struct ib_device *ibdev,
- struct ib_gid *gid );
+ union ib_gid *gid );
extern struct ib_work_queue * ib_find_wq ( struct ib_completion_queue *cq,
unsigned long qpn, int is_send );
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 );
extern void ib_close ( struct ib_device *ibdev );
extern int ib_link_rc ( struct ib_device *ibdev );
extern int ib_mcast_attach ( struct ib_device *ibdev, struct ib_queue_pair *qp,
- struct ib_gid *gid );
+ union ib_gid *gid );
extern void ib_mcast_detach ( struct ib_device *ibdev,
- struct ib_queue_pair *qp, struct ib_gid *gid );
+ struct ib_queue_pair *qp, union ib_gid *gid );
extern int ib_get_hca_info ( struct ib_device *ibdev,
- struct ib_gid_half *hca_guid );
+ union ib_guid *hca_guid );
extern int ib_set_port_info ( struct ib_device *ibdev, union ib_mad *mad );
extern int ib_set_pkey_table ( struct ib_device *ibdev, union ib_mad *mad );
extern struct ib_device * alloc_ibdev ( size_t priv_size );
extern int register_ibdev ( struct ib_device *ibdev );
extern void unregister_ibdev ( struct ib_device *ibdev );
-extern struct ib_device * find_ibdev ( struct ib_gid *gid );
+extern struct ib_device * find_ibdev ( union ib_gid *gid );
extern struct ib_device * last_opened_ibdev ( void );
extern void ib_link_state_changed ( struct ib_device *ibdev );
extern void ib_poll_eq ( struct ib_device *ibdev );
diff --git a/src/include/ipxe/ipoib.h b/src/include/ipxe/ipoib.h
index 6a3fd607a..e8f12dc5d 100644
--- a/src/include/ipxe/ipoib.h
+++ b/src/include/ipxe/ipoib.h
@@ -22,7 +22,7 @@ struct ipoib_mac {
*/
uint32_t flags__qpn;
/** Port GID */
- struct ib_gid gid;
+ union ib_gid gid;
} __attribute__ (( packed ));
/** IPoIB link-layer header length */
diff --git a/src/net/infiniband.c b/src/net/infiniband.c
index 76fce3bd9..d7cbf697a 100644
--- a/src/net/infiniband.c
+++ b/src/net/infiniband.c
@@ -341,7 +341,7 @@ struct ib_queue_pair * ib_find_qp_qpn ( struct ib_device *ibdev,
* @ret qp Queue pair, or NULL
*/
struct ib_queue_pair * ib_find_qp_mgid ( struct ib_device *ibdev,
- struct ib_gid *gid ) {
+ union ib_gid *gid ) {
struct ib_queue_pair *qp;
struct ib_multicast_gid *mgid;
@@ -703,7 +703,7 @@ void ib_close ( struct ib_device *ibdev ) {
* the multicast group on the subnet.
*/
int ib_mcast_attach ( struct ib_device *ibdev, struct ib_queue_pair *qp,
- struct ib_gid *gid ) {
+ union ib_gid *gid ) {
struct ib_multicast_gid *mgid;
int rc;
@@ -737,7 +737,7 @@ int ib_mcast_attach ( struct ib_device *ibdev, struct ib_queue_pair *qp,
* @v gid Multicast GID
*/
void ib_mcast_detach ( struct ib_device *ibdev, struct ib_queue_pair *qp,
- struct ib_gid *gid ) {
+ union ib_gid *gid ) {
struct ib_multicast_gid *mgid;
/* Remove from hardware multicast GID list */
@@ -767,8 +767,7 @@ void ib_mcast_detach ( struct ib_device *ibdev, struct ib_queue_pair *qp,
* @ret hca_guid HCA GUID
* @ret num_ports Number of ports
*/
-int ib_get_hca_info ( struct ib_device *ibdev,
- struct ib_gid_half *hca_guid ) {
+int ib_get_hca_info ( struct ib_device *ibdev, union ib_guid *hca_guid ) {
struct ib_device *tmp;
int num_ports = 0;
@@ -779,7 +778,7 @@ int ib_get_hca_info ( struct ib_device *ibdev,
if ( tmp->dev != ibdev->dev )
continue;
if ( num_ports == 0 ) {
- memcpy ( hca_guid, &tmp->gid.u.half[1],
+ memcpy ( hca_guid, &tmp->gid.s.guid,
sizeof ( *hca_guid ) );
}
num_ports++;
@@ -969,7 +968,7 @@ void unregister_ibdev ( struct ib_device *ibdev ) {
* @v gid GID
* @ret ibdev Infiniband device, or NULL
*/
-struct ib_device * find_ibdev ( struct ib_gid *gid ) {
+struct ib_device * find_ibdev ( union ib_gid *gid ) {
struct ib_device *ibdev;
for_each_ibdev ( ibdev ) {
diff --git a/src/net/infiniband/ib_cm.c b/src/net/infiniband/ib_cm.c
index cac0a983e..bbba5727e 100644
--- a/src/net/infiniband/ib_cm.c
+++ b/src/net/infiniband/ib_cm.c
@@ -432,7 +432,7 @@ static struct ib_path_operations ib_cm_path_op = {
*/
struct ib_connection *
ib_create_conn ( struct ib_device *ibdev, struct ib_queue_pair *qp,
- struct ib_gid *dgid, struct ib_gid_half *service_id,
+ union ib_gid *dgid, union ib_guid *service_id,
void *private_data, size_t private_data_len,
struct ib_connection_operations *op ) {
struct ib_connection *conn;
@@ -463,11 +463,8 @@ ib_create_conn ( struct ib_device *ibdev, struct ib_queue_pair *qp,
DBGC ( conn, "CM %p created for IBDEV %p QPN %lx\n",
conn, ibdev, qp->qpn );
- DBGC ( conn, "CM %p connecting to %08x:%08x:%08x:%08x %08x:%08x\n",
- conn, ntohl ( dgid->u.dwords[0] ), ntohl ( dgid->u.dwords[1] ),
- ntohl ( dgid->u.dwords[2] ), ntohl ( dgid->u.dwords[3] ),
- ntohl ( service_id->u.dwords[0] ),
- ntohl ( service_id->u.dwords[1] ) );
+ DBGC ( conn, "CM %p connecting to " IB_GID_FMT " " IB_GUID_FMT "\n",
+ conn, IB_GID_ARGS ( dgid ), IB_GUID_ARGS ( service_id ) );
return conn;
diff --git a/src/net/infiniband/ib_cmrc.c b/src/net/infiniband/ib_cmrc.c
index f596c36dc..011ff3e06 100644
--- a/src/net/infiniband/ib_cmrc.c
+++ b/src/net/infiniband/ib_cmrc.c
@@ -80,9 +80,9 @@ struct ib_cmrc_connection {
/** Connection */
struct ib_connection *conn;
/** Destination GID */
- struct ib_gid dgid;
+ union ib_gid dgid;
/** Service ID */
- struct ib_gid_half service_id;
+ union ib_guid service_id;
/** QP is connected */
int connected;
/** Shutdown process */
@@ -357,7 +357,7 @@ static struct interface_descriptor ib_cmrc_xfer_desc =
* @ret rc Returns status code
*/
int ib_cmrc_open ( struct interface *xfer, struct ib_device *ibdev,
- struct ib_gid *dgid, struct ib_gid_half *service_id ) {
+ union ib_gid *dgid, union ib_guid *service_id ) {
struct ib_cmrc_connection *cmrc;
int rc;
diff --git a/src/net/infiniband/ib_mcast.c b/src/net/infiniband/ib_mcast.c
index 9eff1899e..0f03b54ac 100644
--- a/src/net/infiniband/ib_mcast.c
+++ b/src/net/infiniband/ib_mcast.c
@@ -41,7 +41,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
* @v join Join (rather than leave) group
* @v mad MAD to fill in
*/
-static void ib_mcast_mad ( struct ib_device *ibdev, struct ib_gid *gid,
+static void ib_mcast_mad ( struct ib_device *ibdev, union ib_gid *gid,
int join, union ib_mad *mad ) {
struct ib_mad_sa *sa = &mad->sa;
@@ -79,7 +79,7 @@ static void ib_mcast_complete ( struct ib_device *ibdev,
struct ib_address_vector *av __unused ) {
struct ib_mc_membership *membership = ib_madx_get_ownerdata ( madx );
struct ib_queue_pair *qp = membership->qp;
- struct ib_gid *gid = &membership->gid;
+ union ib_gid *gid = &membership->gid;
struct ib_mc_member_record *mc_member_record =
&mad->sa.sa_data.mc_member_record;
int joined;
@@ -97,11 +97,9 @@ static void ib_mcast_complete ( struct ib_device *ibdev,
/* Extract values from MAD */
joined = ( mad->hdr.method == IB_MGMT_METHOD_GET_RESP );
qkey = ntohl ( mc_member_record->qkey );
- DBGC ( ibdev, "IBDEV %p QPN %lx %s %08x:%08x:%08x:%08x qkey %lx\n",
+ DBGC ( ibdev, "IBDEV %p QPN %lx %s " IB_GID_FMT " qkey %lx\n",
ibdev, qp->qpn, ( joined ? "joined" : "left" ),
- ntohl ( gid->u.dwords[0] ), ntohl ( gid->u.dwords[1] ),
- ntohl ( gid->u.dwords[2] ), ntohl ( gid->u.dwords[3] ),
- qkey );
+ IB_GID_ARGS ( gid ), qkey );
/* Set queue key */
qp->qkey = qkey;
@@ -136,7 +134,7 @@ static struct ib_mad_transaction_operations ib_mcast_op = {
* @ret rc Return status code
*/
int ib_mcast_join ( struct ib_device *ibdev, struct ib_queue_pair *qp,
- struct ib_mc_membership *membership, struct ib_gid *gid,
+ struct ib_mc_membership *membership, union ib_gid *gid,
void ( * complete ) ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
struct ib_mc_membership *membership,
@@ -144,10 +142,8 @@ int ib_mcast_join ( struct ib_device *ibdev, struct ib_queue_pair *qp,
union ib_mad mad;
int rc;
- DBGC ( ibdev, "IBDEV %p QPN %lx joining %08x:%08x:%08x:%08x\n",
- ibdev, qp->qpn, ntohl ( gid->u.dwords[0] ),
- ntohl ( gid->u.dwords[1] ), ntohl ( gid->u.dwords[2] ),
- ntohl ( gid->u.dwords[3] ) );
+ DBGC ( ibdev, "IBDEV %p QPN %lx joining " IB_GID_FMT "\n",
+ ibdev, qp->qpn, IB_GID_ARGS ( gid ) );
/* Initialise structure */
membership->qp = qp;
@@ -191,14 +187,12 @@ int ib_mcast_join ( struct ib_device *ibdev, struct ib_queue_pair *qp,
*/
void ib_mcast_leave ( struct ib_device *ibdev, struct ib_queue_pair *qp,
struct ib_mc_membership *membership ) {
- struct ib_gid *gid = &membership->gid;
+ union ib_gid *gid = &membership->gid;
union ib_mad mad;
int rc;
- DBGC ( ibdev, "IBDEV %p QPN %lx leaving %08x:%08x:%08x:%08x\n",
- ibdev, qp->qpn, ntohl ( gid->u.dwords[0] ),
- ntohl ( gid->u.dwords[1] ), ntohl ( gid->u.dwords[2] ),
- ntohl ( gid->u.dwords[3] ) );
+ DBGC ( ibdev, "IBDEV %p QPN %lx leaving " IB_GID_FMT "\n",
+ ibdev, qp->qpn, IB_GID_ARGS ( gid ) );
/* Detach from multicast GID */
ib_mcast_detach ( ibdev, qp, &membership->gid );
diff --git a/src/net/infiniband/ib_packet.c b/src/net/infiniband/ib_packet.c
index 943f39571..d58e0ad4b 100644
--- a/src/net/infiniband/ib_packet.c
+++ b/src/net/infiniband/ib_packet.c
@@ -215,11 +215,8 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
if ( IB_LID_MULTICAST ( lid ) && grh ) {
if ( ! ( *qp = ib_find_qp_mgid ( ibdev, &grh->dgid ))){
DBGC ( ibdev, "IBDEV %p RX for unknown MGID "
- "%08x:%08x:%08x:%08x\n", ibdev,
- ntohl ( grh->dgid.u.dwords[0] ),
- ntohl ( grh->dgid.u.dwords[1] ),
- ntohl ( grh->dgid.u.dwords[2] ),
- ntohl ( grh->dgid.u.dwords[3] ) );
+ IB_GID_FMT "\n",
+ ibdev, IB_GID_ARGS ( &grh->dgid ) );
return -ENODEV;
}
} else {
diff --git a/src/net/infiniband/ib_pathrec.c b/src/net/infiniband/ib_pathrec.c
index e1fa53068..7b9146547 100644
--- a/src/net/infiniband/ib_pathrec.c
+++ b/src/net/infiniband/ib_pathrec.c
@@ -49,18 +49,16 @@ static void ib_path_complete ( struct ib_device *ibdev,
int rc, union ib_mad *mad,
struct ib_address_vector *av __unused ) {
struct ib_path *path = ib_madx_get_ownerdata ( madx );
- struct ib_gid *dgid = &path->av.gid;
+ union ib_gid *dgid = &path->av.gid;
struct ib_path_record *pathrec = &mad->sa.sa_data.path_record;
/* Report failures */
if ( ( rc == 0 ) && ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ))
rc = -ENETUNREACH;
if ( rc != 0 ) {
- DBGC ( ibdev, "IBDEV %p path lookup for %08x:%08x:%08x:%08x "
- "failed: %s\n", ibdev, htonl ( dgid->u.dwords[0] ),
- htonl ( dgid->u.dwords[1] ),
- htonl ( dgid->u.dwords[2] ),
- htonl ( dgid->u.dwords[3] ), strerror ( rc ) );
+ DBGC ( ibdev, "IBDEV %p path lookup for " IB_GID_FMT
+ " failed: %s\n",
+ ibdev, IB_GID_ARGS ( dgid ), strerror ( rc ) );
goto out;
}
@@ -68,10 +66,8 @@ static void ib_path_complete ( struct ib_device *ibdev,
path->av.lid = ntohs ( pathrec->dlid );
path->av.sl = ( pathrec->reserved__sl & 0x0f );
path->av.rate = ( pathrec->rate_selector__rate & 0x3f );
- DBGC ( ibdev, "IBDEV %p path to %08x:%08x:%08x:%08x is %04x sl %d "
- "rate %d\n", ibdev, htonl ( dgid->u.dwords[0] ),
- htonl ( dgid->u.dwords[1] ), htonl ( dgid->u.dwords[2] ),
- htonl ( dgid->u.dwords[3] ), path->av.lid, path->av.sl,
+ DBGC ( ibdev, "IBDEV %p path to " IB_GID_FMT " is %04x sl %d rate "
+ "%d\n", ibdev, IB_GID_ARGS ( dgid ), path->av.lid, path->av.sl,
path->av.rate );
out:
@@ -179,7 +175,7 @@ static unsigned int ib_path_cache_idx;
* @ret path Path cache entry, or NULL
*/
static struct ib_cached_path *
-ib_find_path_cache_entry ( struct ib_device *ibdev, struct ib_gid *dgid ) {
+ib_find_path_cache_entry ( struct ib_device *ibdev, union ib_gid *dgid ) {
struct ib_cached_path *cached;
unsigned int i;
@@ -240,14 +236,14 @@ static struct ib_path_operations ib_cached_path_op = {
* cache similar to ARP.
*/
int ib_resolve_path ( struct ib_device *ibdev, struct ib_address_vector *av ) {
- struct ib_gid *gid = &av->gid;
+ union ib_gid *gid = &av->gid;
struct ib_cached_path *cached;
unsigned int cache_idx;
/* Sanity check */
if ( ! av->gid_present ) {
- DBGC ( ibdev, "IBDEV %p attempt to look up path "
- "without GID\n", ibdev );
+ DBGC ( ibdev, "IBDEV %p attempt to look up path without GID\n",
+ ibdev );
return -EINVAL;
}
@@ -258,16 +254,12 @@ int ib_resolve_path ( struct ib_device *ibdev, struct ib_address_vector *av ) {
av->lid = cached->path->av.lid;
av->rate = cached->path->av.rate;
av->sl = cached->path->av.sl;
- DBGC2 ( ibdev, "IBDEV %p cache hit for %08x:%08x:%08x:%08x\n",
- ibdev, htonl ( gid->u.dwords[0] ),
- htonl ( gid->u.dwords[1] ), htonl ( gid->u.dwords[2] ),
- htonl ( gid->u.dwords[3] ) );
+ DBGC2 ( ibdev, "IBDEV %p cache hit for " IB_GID_FMT "\n",
+ ibdev, IB_GID_ARGS ( gid ) );
return 0;
}
- DBGC ( ibdev, "IBDEV %p cache miss for %08x:%08x:%08x:%08x%s\n",
- ibdev, htonl ( gid->u.dwords[0] ), htonl ( gid->u.dwords[1] ),
- htonl ( gid->u.dwords[2] ), htonl ( gid->u.dwords[3] ),
- ( cached ? " (in progress)" : "" ) );
+ DBGC ( ibdev, "IBDEV %p cache miss for " IB_GID_FMT "%s\n", ibdev,
+ IB_GID_ARGS ( gid ), ( cached ? " (in progress)" : "" ) );
/* If lookup is already in progress, do nothing */
if ( cached )
diff --git a/src/net/infiniband/ib_sma.c b/src/net/infiniband/ib_sma.c
index b8327355f..45a1e4469 100644
--- a/src/net/infiniband/ib_sma.c
+++ b/src/net/infiniband/ib_sma.c
@@ -61,7 +61,7 @@ static void ib_sma_node_info ( struct ib_device *ibdev,
node_info->num_ports = ib_get_hca_info ( ibdev, &node_info->sys_guid );
memcpy ( &node_info->node_guid, &node_info->sys_guid,
sizeof ( node_info->node_guid ) );
- memcpy ( &node_info->port_guid, &ibdev->gid.u.half[1],
+ memcpy ( &node_info->port_guid, &ibdev->gid.s.guid,
sizeof ( node_info->port_guid ) );
node_info->partition_cap = htons ( 1 );
node_info->local_port_num = ibdev->port;
@@ -88,7 +88,7 @@ static void ib_sma_node_desc ( struct ib_device *ibdev,
union ib_mad *mad,
struct ib_address_vector *av ) {
struct ib_node_desc *node_desc = &mad->smp.smp_data.node_desc;
- struct ib_gid_half guid;
+ union ib_guid guid;
char hostname[ sizeof ( node_desc->node_string ) ];
int hostname_len;
int rc;
@@ -101,9 +101,9 @@ static void ib_sma_node_desc ( struct ib_device *ibdev,
snprintf ( node_desc->node_string, sizeof ( node_desc->node_string ),
"iPXE %s%s%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x (%s)",
hostname, ( ( hostname_len >= 0 ) ? " " : "" ),
- guid.u.bytes[0], guid.u.bytes[1], guid.u.bytes[2],
- guid.u.bytes[3], guid.u.bytes[4], guid.u.bytes[5],
- guid.u.bytes[6], guid.u.bytes[7], ibdev->dev->name );
+ guid.bytes[0], guid.bytes[1], guid.bytes[2], guid.bytes[3],
+ guid.bytes[4], guid.bytes[5], guid.bytes[6], guid.bytes[7],
+ ibdev->dev->name );
/* Send GetResponse */
mad->hdr.method = IB_MGMT_METHOD_GET_RESP;
@@ -131,7 +131,7 @@ static void ib_sma_guid_info ( struct ib_device *ibdev,
/* Fill in information */
memset ( guid_info, 0, sizeof ( *guid_info ) );
- memcpy ( guid_info->guid[0], &ibdev->gid.u.half[1],
+ memcpy ( guid_info->guid[0], &ibdev->gid.s.guid,
sizeof ( guid_info->guid[0] ) );
/* Send GetResponse */
@@ -160,8 +160,8 @@ static int ib_sma_set_port_info ( struct ib_device *ibdev,
int rc;
/* Set parameters */
- memcpy ( &ibdev->gid.u.half[0], port_info->gid_prefix,
- sizeof ( ibdev->gid.u.half[0] ) );
+ memcpy ( &ibdev->gid.s.prefix, port_info->gid_prefix,
+ sizeof ( ibdev->gid.s.prefix ) );
ibdev->lid = ntohs ( port_info->lid );
ibdev->sm_lid = ntohs ( port_info->mastersm_lid );
if ( ( link_width_enabled = port_info->link_width_enabled ) )
@@ -210,7 +210,7 @@ static void ib_sma_port_info ( struct ib_device *ibdev,
/* Fill in information */
memset ( port_info, 0, sizeof ( *port_info ) );
- memcpy ( port_info->gid_prefix, &ibdev->gid.u.half[0],
+ memcpy ( port_info->gid_prefix, &ibdev->gid.s.prefix,
sizeof ( port_info->gid_prefix ) );
port_info->lid = ntohs ( ibdev->lid );
port_info->mastersm_lid = ntohs ( ibdev->sm_lid );
diff --git a/src/net/infiniband/ib_smc.c b/src/net/infiniband/ib_smc.c
index 7d5963594..5eef8255a 100644
--- a/src/net/infiniband/ib_smc.c
+++ b/src/net/infiniband/ib_smc.c
@@ -141,8 +141,8 @@ int ib_smc_update ( struct ib_device *ibdev, ib_local_mad_t local_mad ) {
*/
if ( ( rc = ib_smc_get_port_info ( ibdev, local_mad, &mad ) ) != 0 )
return rc;
- memcpy ( &ibdev->gid.u.half[0], port_info->gid_prefix,
- sizeof ( ibdev->gid.u.half[0] ) );
+ memcpy ( &ibdev->gid.s.prefix, port_info->gid_prefix,
+ sizeof ( ibdev->gid.s.prefix ) );
ibdev->lid = ntohs ( port_info->lid );
ibdev->sm_lid = ntohs ( port_info->mastersm_lid );
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 ) {
/* GUID info gives us the second half of the port GID */
if ( ( rc = ib_smc_get_guid_info ( ibdev, local_mad, &mad ) ) != 0 )
return rc;
- memcpy ( &ibdev->gid.u.half[1], guid_info->guid[0],
- sizeof ( ibdev->gid.u.half[1] ) );
+ memcpy ( &ibdev->gid.s.guid, guid_info->guid[0],
+ sizeof ( ibdev->gid.s.guid ) );
/* Get partition key */
if ( ( rc = ib_smc_get_pkey_table ( ibdev, local_mad, &mad ) ) != 0 )
return rc;
ibdev->pkey = ntohs ( pkey_table->pkey[0] );
- DBGC ( ibdev, "IBDEV %p port GID is %08x:%08x:%08x:%08x\n", ibdev,
- htonl ( ibdev->gid.u.dwords[0] ),
- htonl ( ibdev->gid.u.dwords[1] ),
- htonl ( ibdev->gid.u.dwords[2] ),
- htonl ( ibdev->gid.u.dwords[3] ) );
+ DBGC ( ibdev, "IBDEV %p port GID is " IB_GID_FMT "\n",
+ ibdev, IB_GID_ARGS ( &ibdev->gid ) );
return 0;
}
diff --git a/src/net/infiniband/ib_srp.c b/src/net/infiniband/ib_srp.c
index 41416a202..7b2b2b4ea 100644
--- a/src/net/infiniband/ib_srp.c
+++ b/src/net/infiniband/ib_srp.c
@@ -81,9 +81,9 @@ struct ib_srp_device {
struct ib_device *ibdev;
/** Destination GID (for boot firmware table) */
- struct ib_gid dgid;
+ union ib_gid dgid;
/** Service ID (for boot firmware table) */
- struct ib_gid_half service_id;
+ union ib_guid service_id;
};
/**
@@ -184,7 +184,7 @@ static struct interface_descriptor ib_srp_srp_desc =
* @ret rc Return status code
*/
static int ib_srp_open ( struct interface *block, struct ib_device *ibdev,
- struct ib_gid *dgid, struct ib_gid_half *service_id,
+ union ib_gid *dgid, union ib_guid *service_id,
union srp_port_id *initiator,
union srp_port_id *target, struct scsi_lun *lun ) {
struct ib_srp_device *ib_srp;
@@ -200,11 +200,8 @@ static int ib_srp_open ( struct interface *block, struct ib_device *ibdev,
intf_init ( &ib_srp->srp, &ib_srp_srp_desc, &ib_srp->refcnt );
intf_init ( &ib_srp->cmrc, &ib_srp_cmrc_desc, &ib_srp->refcnt );
ib_srp->ibdev = ibdev_get ( ibdev );
- DBGC ( ib_srp, "IBSRP %p created for %08x%08x%08x%08x:%08x%08x\n",
- ib_srp, ntohl ( dgid->u.dwords[0] ),
- ntohl ( dgid->u.dwords[1] ), ntohl ( dgid->u.dwords[2] ),
- ntohl ( dgid->u.dwords[3] ), ntohl ( service_id->u.dwords[0] ),
- ntohl ( service_id->u.dwords[1] ) );
+ DBGC ( ib_srp, "IBSRP %p for " IB_GID_FMT " " IB_GUID_FMT "\n",
+ ib_srp, IB_GID_ARGS ( dgid ), IB_GUID_ARGS ( service_id ) );
/* Preserve parameters required for boot firmware table */
memcpy ( &ib_srp->dgid, dgid, sizeof ( ib_srp->dgid ) );
@@ -256,15 +253,15 @@ enum ib_srp_parse_flags {
/** IB SRP root path parameters */
struct ib_srp_root_path {
/** Source GID */
- struct ib_gid sgid;
+ union ib_gid sgid;
/** Initiator port ID */
union ib_srp_initiator_port_id initiator;
/** Destination GID */
- struct ib_gid dgid;
+ union ib_gid dgid;
/** Partition key */
uint16_t pkey;
/** Service ID */
- struct ib_gid_half service_id;
+ union ib_guid service_id;
/** SCSI LUN */
struct scsi_lun lun;
/** Target port ID */
@@ -337,7 +334,7 @@ static int ib_srp_parse_sgid ( const char *rp_comp,
if ( ( ibdev = last_opened_ibdev() ) != NULL )
memcpy ( &rp->sgid, &ibdev->gid, sizeof ( rp->sgid ) );
- return ib_srp_parse_byte_string ( rp_comp, rp->sgid.u.bytes,
+ return ib_srp_parse_byte_string ( rp_comp, rp->sgid.bytes,
( sizeof ( rp->sgid ) |
IB_SRP_PARSE_OPTIONAL ) );
}
@@ -353,7 +350,7 @@ static int ib_srp_parse_initiator_id_ext ( const char *rp_comp,
struct ib_srp_root_path *rp ) {
union ib_srp_initiator_port_id *port_id = &rp->initiator;
- return ib_srp_parse_byte_string ( rp_comp, port_id->ib.id_ext.u.bytes,
+ return ib_srp_parse_byte_string ( rp_comp, port_id->ib.id_ext.bytes,
( sizeof ( port_id->ib.id_ext ) |
IB_SRP_PARSE_OPTIONAL ) );
}
@@ -370,10 +367,10 @@ static int ib_srp_parse_initiator_hca_guid ( const char *rp_comp,
union ib_srp_initiator_port_id *port_id = &rp->initiator;
/* Default to the GUID portion of the source GID */
- memcpy ( &port_id->ib.hca_guid, &rp->sgid.u.half[1],
+ memcpy ( &port_id->ib.hca_guid, &rp->sgid.s.guid,
sizeof ( port_id->ib.hca_guid ) );
- return ib_srp_parse_byte_string ( rp_comp, port_id->ib.hca_guid.u.bytes,
+ return ib_srp_parse_byte_string ( rp_comp, port_id->ib.hca_guid.bytes,
( sizeof ( port_id->ib.hca_guid ) |
IB_SRP_PARSE_OPTIONAL ) );
}
@@ -387,7 +384,7 @@ static int ib_srp_parse_initiator_hca_guid ( const char *rp_comp,
*/
static int ib_srp_parse_dgid ( const char *rp_comp,
struct ib_srp_root_path *rp ) {
- return ib_srp_parse_byte_string ( rp_comp, rp->dgid.u.bytes,
+ return ib_srp_parse_byte_string ( rp_comp, rp->dgid.bytes,
( sizeof ( rp->dgid ) |
IB_SRP_PARSE_REQUIRED ) );
}
@@ -418,7 +415,7 @@ static int ib_srp_parse_pkey ( const char *rp_comp,
*/
static int ib_srp_parse_service_id ( const char *rp_comp,
struct ib_srp_root_path *rp ) {
- return ib_srp_parse_byte_string ( rp_comp, rp->service_id.u.bytes,
+ return ib_srp_parse_byte_string ( rp_comp, rp->service_id.bytes,
( sizeof ( rp->service_id ) |
IB_SRP_PARSE_REQUIRED ) );
}
@@ -446,7 +443,7 @@ static int ib_srp_parse_target_id_ext ( const char *rp_comp,
struct ib_srp_root_path *rp ) {
union ib_srp_target_port_id *port_id = &rp->target;
- return ib_srp_parse_byte_string ( rp_comp, port_id->ib.id_ext.u.bytes,
+ return ib_srp_parse_byte_string ( rp_comp, port_id->ib.id_ext.bytes,
( sizeof ( port_id->ib.id_ext ) |
IB_SRP_PARSE_REQUIRED ) );
}
@@ -462,7 +459,7 @@ static int ib_srp_parse_target_ioc_guid ( const char *rp_comp,
struct ib_srp_root_path *rp ) {
union ib_srp_target_port_id *port_id = &rp->target;
- return ib_srp_parse_byte_string ( rp_comp, port_id->ib.ioc_guid.u.bytes,
+ return ib_srp_parse_byte_string ( rp_comp, port_id->ib.ioc_guid.bytes,
( sizeof ( port_id->ib.ioc_guid ) |
IB_SRP_PARSE_REQUIRED ) );
}