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

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2010-09-15 19:25:05 +01:00
parent 3ea3c846d8
commit 52e54a8c69
22 changed files with 186 additions and 205 deletions

View File

@@ -396,7 +396,7 @@ arbel_cmd_write_mgm ( struct arbel *arbel, unsigned int index,
} }
static inline int 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 ) { struct arbelprm_mgm_hash *hash ) {
return arbel_cmd ( arbel, return arbel_cmd ( arbel,
ARBEL_HCR_INOUT_CMD ( ARBEL_HCR_MGID_HASH, 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 */ /** GID used for GID-less send work queue entries */
static const struct ib_gid arbel_no_gid = { static const union ib_gid arbel_no_gid = {
{ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0 } } .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_ud_send_wqe *wqe;
struct arbelprm_qp_db_record *qp_db_rec; struct arbelprm_qp_db_record *qp_db_rec;
union arbelprm_doorbell_register db_reg; union arbelprm_doorbell_register db_reg;
const struct ib_gid *gid; const union ib_gid *gid;
unsigned int wqe_idx_mask; unsigned int wqe_idx_mask;
size_t nds; size_t nds;
@@ -1565,7 +1565,7 @@ static void arbel_close ( struct ib_device *ibdev ) {
*/ */
static int arbel_mcast_attach ( struct ib_device *ibdev, static int arbel_mcast_attach ( struct ib_device *ibdev,
struct ib_queue_pair *qp, struct ib_queue_pair *qp,
struct ib_gid *gid ) { union ib_gid *gid ) {
struct arbel *arbel = ib_get_drvdata ( ibdev ); struct arbel *arbel = ib_get_drvdata ( ibdev );
struct arbelprm_mgm_hash hash; struct arbelprm_mgm_hash hash;
struct arbelprm_mgm_entry mgm; 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, static void arbel_mcast_detach ( struct ib_device *ibdev,
struct ib_queue_pair *qp __unused, struct ib_queue_pair *qp __unused,
struct ib_gid *gid ) { union ib_gid *gid ) {
struct arbel *arbel = ib_get_drvdata ( ibdev ); struct arbel *arbel = ib_get_drvdata ( ibdev );
struct arbelprm_mgm_hash hash; struct arbelprm_mgm_hash hash;
struct arbelprm_mgm_entry mgm; struct arbelprm_mgm_entry mgm;

View File

@@ -474,7 +474,7 @@ hermon_cmd_write_mcg ( struct hermon *hermon, unsigned int index,
} }
static inline int 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 ) { struct hermonprm_mgm_hash *hash ) {
return hermon_cmd ( hermon, return hermon_cmd ( hermon,
HERMON_HCR_INOUT_CMD ( HERMON_HCR_MGID_HASH, 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, static int hermon_mcast_attach ( struct ib_device *ibdev,
struct ib_queue_pair *qp, struct ib_queue_pair *qp,
struct ib_gid *gid ) { union ib_gid *gid ) {
struct hermon *hermon = ib_get_drvdata ( ibdev ); struct hermon *hermon = ib_get_drvdata ( ibdev );
struct hermonprm_mgm_hash hash; struct hermonprm_mgm_hash hash;
struct hermonprm_mcg_entry mcg; 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, static void hermon_mcast_detach ( struct ib_device *ibdev,
struct ib_queue_pair *qp __unused, struct ib_queue_pair *qp __unused,
struct ib_gid *gid ) { union ib_gid *gid ) {
struct hermon *hermon = ib_get_drvdata ( ibdev ); struct hermon *hermon = ib_get_drvdata ( ibdev );
struct hermonprm_mgm_hash hash; struct hermonprm_mgm_hash hash;
struct hermonprm_mcg_entry mcg; struct hermonprm_mcg_entry mcg;

View File

@@ -1456,7 +1456,7 @@ static void linda_close ( struct ib_device *ibdev ) {
*/ */
static int linda_mcast_attach ( struct ib_device *ibdev, static int linda_mcast_attach ( struct ib_device *ibdev,
struct ib_queue_pair *qp, struct ib_queue_pair *qp,
struct ib_gid *gid ) { union ib_gid *gid ) {
struct linda *linda = ib_get_drvdata ( ibdev ); struct linda *linda = ib_get_drvdata ( ibdev );
( void ) linda; ( void ) linda;
@@ -1474,7 +1474,7 @@ static int linda_mcast_attach ( struct ib_device *ibdev,
*/ */
static void linda_mcast_detach ( struct ib_device *ibdev, static void linda_mcast_detach ( struct ib_device *ibdev,
struct ib_queue_pair *qp, struct ib_queue_pair *qp,
struct ib_gid *gid ) { union ib_gid *gid ) {
struct linda *linda = ib_get_drvdata ( ibdev ); struct linda *linda = ib_get_drvdata ( ibdev );
( void ) linda; ( void ) linda;
@@ -1631,22 +1631,19 @@ static int linda_init_i2c ( struct linda *linda ) {
* @v guid GUID to fill in * @v guid GUID to fill in
* @ret rc Return status code * @ret rc Return status code
*/ */
static int linda_read_eeprom ( struct linda *linda, static int linda_read_eeprom ( struct linda *linda, union ib_guid *guid ) {
struct ib_gid_half *guid ) {
struct i2c_interface *i2c = &linda->i2c.i2c; struct i2c_interface *i2c = &linda->i2c.i2c;
int rc; int rc;
/* Read GUID */ /* Read GUID */
if ( ( rc = i2c->read ( i2c, &linda->eeprom, LINDA_EEPROM_GUID_OFFSET, 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", DBGC ( linda, "Linda %p could not read GUID: %s\n",
linda, strerror ( rc ) ); linda, strerror ( rc ) );
return rc; return rc;
} }
DBGC2 ( linda, "Linda %p has GUID %02x:%02x:%02x:%02x:%02x:%02x:" DBGC2 ( linda, "Linda %p has GUID " IB_GUID_FMT "\n",
"%02x:%02x\n", linda, guid->u.bytes[0], guid->u.bytes[1], linda, IB_GUID_ARGS ( guid ) );
guid->u.bytes[2], guid->u.bytes[3], guid->u.bytes[4],
guid->u.bytes[5], guid->u.bytes[6], guid->u.bytes[7] );
/* Read serial number (debug only) */ /* Read serial number (debug only) */
if ( DBG_LOG ) { if ( DBG_LOG ) {
@@ -2367,7 +2364,7 @@ static int linda_probe ( struct pci_device *pci,
goto err_init_i2c; goto err_init_i2c;
/* Read EEPROM parameters */ /* 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; goto err_read_eeprom;
/* Initialise send datapath */ /* Initialise send datapath */

View File

@@ -118,7 +118,7 @@ struct qib7322 {
struct i2c_device eeprom; struct i2c_device eeprom;
/** Base GUID */ /** Base GUID */
struct ib_gid_half guid; union ib_guid guid;
/** Infiniband devices */ /** Infiniband devices */
struct ib_device *ibdev[QIB7322_MAX_PORTS]; 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, static int qib7322_mcast_attach ( struct ib_device *ibdev,
struct ib_queue_pair *qp, struct ib_queue_pair *qp,
struct ib_gid *gid ) { union ib_gid *gid ) {
struct qib7322 *qib7322 = ib_get_drvdata ( ibdev ); struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
( void ) qib7322; ( void ) qib7322;
@@ -1788,7 +1788,7 @@ static int qib7322_mcast_attach ( struct ib_device *ibdev,
*/ */
static void qib7322_mcast_detach ( struct ib_device *ibdev, static void qib7322_mcast_detach ( struct ib_device *ibdev,
struct ib_queue_pair *qp, struct ib_queue_pair *qp,
struct ib_gid *gid ) { union ib_gid *gid ) {
struct qib7322 *qib7322 = ib_get_drvdata ( ibdev ); struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
( void ) qib7322; ( void ) qib7322;
@@ -1946,21 +1946,19 @@ static int qib7322_init_i2c ( struct qib7322 *qib7322 ) {
*/ */
static int qib7322_read_eeprom ( struct qib7322 *qib7322 ) { static int qib7322_read_eeprom ( struct qib7322 *qib7322 ) {
struct i2c_interface *i2c = &qib7322->i2c.i2c; struct i2c_interface *i2c = &qib7322->i2c.i2c;
struct ib_gid_half *guid = &qib7322->guid; union ib_guid *guid = &qib7322->guid;
int rc; int rc;
/* Read GUID */ /* Read GUID */
if ( ( rc = i2c->read ( i2c, &qib7322->eeprom, if ( ( rc = i2c->read ( i2c, &qib7322->eeprom,
QIB7322_EEPROM_GUID_OFFSET, guid->u.bytes, QIB7322_EEPROM_GUID_OFFSET, guid->bytes,
sizeof ( *guid ) ) ) != 0 ) { sizeof ( *guid ) ) ) != 0 ) {
DBGC ( qib7322, "QIB7322 %p could not read GUID: %s\n", DBGC ( qib7322, "QIB7322 %p could not read GUID: %s\n",
qib7322, strerror ( rc ) ); qib7322, strerror ( rc ) );
return rc; return rc;
} }
DBGC2 ( qib7322, "QIB7322 %p has GUID %02x:%02x:%02x:%02x:%02x:%02x:" DBGC2 ( qib7322, "QIB7322 %p has GUID " IB_GUID_FMT "\n",
"%02x:%02x\n", qib7322, guid->u.bytes[0], guid->u.bytes[1], qib7322, IB_GUID_ARGS ( guid ) );
guid->u.bytes[2], guid->u.bytes[3], guid->u.bytes[4],
guid->u.bytes[5], guid->u.bytes[6], guid->u.bytes[7] );
/* Read serial number (debug only) */ /* Read serial number (debug only) */
if ( DBG_LOG ) { if ( DBG_LOG ) {
@@ -2359,10 +2357,10 @@ static int qib7322_probe ( struct pci_device *pci,
IB_LINK_WIDTH_4X; /* 1x does not work */ IB_LINK_WIDTH_4X; /* 1x does not work */
ibdev->link_speed_enabled = ibdev->link_speed_supported = ibdev->link_speed_enabled = ibdev->link_speed_supported =
IB_LINK_SPEED_SDR; /* to avoid need for link tuning */ IB_LINK_SPEED_SDR; /* to avoid need for link tuning */
memcpy ( &ibdev->gid.u.half[1], &qib7322->guid, memcpy ( &ibdev->gid.s.guid, &qib7322->guid,
sizeof ( ibdev->gid.u.half[1] ) ); sizeof ( ibdev->gid.s.guid ) );
assert ( ( ibdev->gid.u.half[1].u.bytes[7] & i ) == 0 ); assert ( ( ibdev->gid.s.guid.bytes[7] & i ) == 0 );
ibdev->gid.u.half[1].u.bytes[7] |= i; ibdev->gid.s.guid.bytes[7] |= i;
ib_set_drvdata ( ibdev, qib7322 ); ib_set_drvdata ( ibdev, qib7322 );
} }

View File

@@ -72,7 +72,7 @@ struct ipoib_device {
/** Broadcast IPoIB address */ /** Broadcast IPoIB address */
static struct ipoib_mac ipoib_broadcast = { static struct ipoib_mac ipoib_broadcast = {
.flags__qpn = htonl ( IB_QPN_BROADCAST ), .flags__qpn = htonl ( IB_QPN_BROADCAST ),
.gid.u.bytes = { 0xff, 0x12, 0x40, 0x1b, 0x00, 0x00, 0x00, 0x00, .gid.bytes = { 0xff, 0x12, 0x40, 0x1b, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff }, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff },
}; };
@@ -266,11 +266,11 @@ static int ipoib_pull ( struct net_device *netdev,
* @v ll_addr Link-layer address * @v ll_addr Link-layer address
*/ */
static void ipoib_init_addr ( const void *hw_addr, void *ll_addr ) { 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; struct ipoib_mac *mac = ll_addr;
memset ( mac, 0, sizeof ( *mac ) ); 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; const struct ipoib_mac *mac = ll_addr;
snprintf ( buf, sizeof ( buf ), "%08x:%08x:%08x:%08x:%08x", snprintf ( buf, sizeof ( buf ), "%08x:%08x:%08x:%08x:%08x",
htonl ( mac->flags__qpn ), htonl ( mac->gid.u.dwords[0] ), htonl ( mac->flags__qpn ), htonl ( mac->gid.dwords[0] ),
htonl ( mac->gid.u.dwords[1] ), htonl ( mac->gid.dwords[1] ),
htonl ( mac->gid.u.dwords[2] ), htonl ( mac->gid.dwords[2] ),
htonl ( mac->gid.u.dwords[3] ) ); htonl ( mac->gid.dwords[3] ) );
return buf; return buf;
} }
@@ -312,14 +312,14 @@ static int ipoib_mc_hash ( unsigned int af __unused,
* @v ll_addr Link-layer address * @v ll_addr Link-layer address
* @v eth_addr Ethernet-compatible address to fill in * @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 ) { uint8_t *eth_addr ) {
eth_addr[0] = ( ( guid->u.bytes[3] == 2 ) ? 0x00 : 0x02 ); eth_addr[0] = ( ( guid->bytes[3] == 2 ) ? 0x00 : 0x02 );
eth_addr[1] = guid->u.bytes[1]; eth_addr[1] = guid->bytes[1];
eth_addr[2] = guid->u.bytes[2]; eth_addr[2] = guid->bytes[2];
eth_addr[3] = guid->u.bytes[5]; eth_addr[3] = guid->bytes[5];
eth_addr[4] = guid->u.bytes[6]; eth_addr[4] = guid->bytes[6];
eth_addr[5] = guid->u.bytes[7]; eth_addr[5] = guid->bytes[7];
return 0; return 0;
} }
@@ -330,7 +330,7 @@ struct ipoib_eth_addr_handler {
/** GUID byte 2 */ /** GUID byte 2 */
uint8_t byte2; uint8_t byte2;
/** Handler */ /** Handler */
int ( * eth_addr ) ( const struct ib_gid_half *guid, int ( * eth_addr ) ( const union ib_guid *guid,
uint8_t *eth_addr ); 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 ) { static int ipoib_eth_addr ( const void *ll_addr, void *eth_addr ) {
const struct ipoib_mac *ipoib_addr = ll_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; struct ipoib_eth_addr_handler *handler;
unsigned int i; unsigned int i;
for ( i = 0 ; i < ( sizeof ( ipoib_eth_addr_handlers ) / for ( i = 0 ; i < ( sizeof ( ipoib_eth_addr_handlers ) /
sizeof ( ipoib_eth_addr_handlers[0] ) ) ; i++ ) { sizeof ( ipoib_eth_addr_handlers[0] ) ) ; i++ ) {
handler = &ipoib_eth_addr_handlers[i]; handler = &ipoib_eth_addr_handlers[i];
if ( ( handler->byte1 == guid->u.bytes[1] ) && if ( ( handler->byte1 == guid->bytes[1] ) &&
( handler->byte2 == guid->u.bytes[2] ) ) { ( handler->byte2 == guid->bytes[2] ) ) {
return handler->eth_addr ( guid, eth_addr ); 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 = { struct ll_protocol ipoib_protocol __ll_protocol = {
.name = "IPoIB", .name = "IPoIB",
.ll_proto = htons ( ARPHRD_INFINIBAND ), .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_addr_len = IPOIB_ALEN,
.ll_header_len = IPOIB_HLEN, .ll_header_len = IPOIB_HLEN,
.push = ipoib_push, .push = ipoib_push,
@@ -612,11 +612,11 @@ static void ipoib_link_state_changed ( struct ib_device *ibdev ) {
ipoib_leave_broadcast_group ( ipoib ); ipoib_leave_broadcast_group ( ipoib );
/* Update MAC address based on potentially-new GID prefix */ /* Update MAC address based on potentially-new GID prefix */
memcpy ( &mac->gid.u.half[0], &ibdev->gid.u.half[0], memcpy ( &mac->gid.s.prefix, &ibdev->gid.s.prefix,
sizeof ( mac->gid.u.half[0] ) ); sizeof ( mac->gid.s.prefix ) );
/* Update broadcast GID based on potentially-new partition key */ /* 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 ); htons ( ibdev->pkey | IB_PKEY_FULL );
/* Set net device link state to reflect Infiniband link state */ /* 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; ipoib->ibdev = ibdev;
/* Extract hardware address */ /* Extract hardware address */
memcpy ( netdev->hw_addr, &ibdev->gid.u.half[1], memcpy ( netdev->hw_addr, &ibdev->gid.s.guid,
sizeof ( ibdev->gid.u.half[1] ) ); sizeof ( ibdev->gid.s.guid ) );
/* Set default broadcast address */ /* Set default broadcast address */
memcpy ( &ipoib->broadcast, &ipoib_broadcast, memcpy ( &ipoib->broadcast, &ipoib_broadcast,

View File

@@ -42,7 +42,7 @@ struct ib_connection {
/** Remote communication ID */ /** Remote communication ID */
uint32_t remote_id; uint32_t remote_id;
/** Target service ID */ /** Target service ID */
struct ib_gid_half service_id; union ib_guid service_id;
/** Connection operations */ /** Connection operations */
struct ib_connection_operations *op; struct ib_connection_operations *op;
@@ -62,7 +62,7 @@ struct ib_connection {
extern struct ib_connection * extern struct ib_connection *
ib_create_conn ( struct ib_device *ibdev, struct ib_queue_pair *qp, 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, void *req_private_data, size_t req_private_data_len,
struct ib_connection_operations *op ); struct ib_connection_operations *op );
extern void ib_destroy_conn ( struct ib_device *ibdev, extern void ib_destroy_conn ( struct ib_device *ibdev,

View File

@@ -14,7 +14,7 @@ FILE_LICENCE ( BSD2 );
extern int ib_cmrc_open ( struct interface *xfer, extern int ib_cmrc_open ( struct interface *xfer,
struct ib_device *ibdev, struct ib_device *ibdev,
struct ib_gid *dgid, union ib_gid *dgid,
struct ib_gid_half *service_id ); union ib_guid *service_id );
#endif /* _IPXE_IB_CMRC_H */ #endif /* _IPXE_IB_CMRC_H */

View File

@@ -75,9 +75,9 @@ struct ib_node_info {
uint8_t class_version; uint8_t class_version;
uint8_t node_type; uint8_t node_type;
uint8_t num_ports; uint8_t num_ports;
struct ib_gid_half sys_guid; union ib_guid sys_guid;
struct ib_gid_half node_guid; union ib_guid node_guid;
struct ib_gid_half port_guid; union ib_guid port_guid;
uint16_t partition_cap; uint16_t partition_cap;
uint16_t device_id; uint16_t device_id;
uint32_t revision; uint32_t revision;
@@ -221,8 +221,8 @@ struct ib_sa_hdr {
struct ib_path_record { struct ib_path_record {
uint32_t reserved0[2]; uint32_t reserved0[2];
struct ib_gid dgid; union ib_gid dgid;
struct ib_gid sgid; union ib_gid sgid;
uint16_t dlid; uint16_t dlid;
uint16_t slid; uint16_t slid;
uint32_t hop_limit__flow_label__raw_traffic; uint32_t hop_limit__flow_label__raw_traffic;
@@ -239,8 +239,8 @@ struct ib_path_record {
#define IB_SA_PATH_REC_SGID (1<<3) #define IB_SA_PATH_REC_SGID (1<<3)
struct ib_mc_member_record { struct ib_mc_member_record {
struct ib_gid mgid; union ib_gid mgid;
struct ib_gid port_gid; union ib_gid port_gid;
uint32_t qkey; uint32_t qkey;
uint16_t mlid; uint16_t mlid;
uint8_t mtu_selector__mtu; uint8_t mtu_selector__mtu;
@@ -320,9 +320,9 @@ struct ib_cm_path {
/** Remote port LID */ /** Remote port LID */
uint16_t remote_lid; uint16_t remote_lid;
/** Local port GID */ /** Local port GID */
struct ib_gid local_gid; union ib_gid local_gid;
/** Remote port GID */ /** Remote port GID */
struct ib_gid remote_gid; union ib_gid remote_gid;
/** Flow label and rate */ /** Flow label and rate */
uint32_t flow_label__rate; uint32_t flow_label__rate;
/** Traffic class */ /** Traffic class */
@@ -345,9 +345,9 @@ struct ib_cm_connect_request {
/** Reserved */ /** Reserved */
uint32_t reserved0[1]; uint32_t reserved0[1];
/** Service ID */ /** Service ID */
struct ib_gid_half service_id; union ib_guid service_id;
/** Local CA GUID */ /** Local CA GUID */
struct ib_gid_half local_ca; union ib_guid local_ca;
/** Reserved */ /** Reserved */
uint32_t reserved1[1]; uint32_t reserved1[1];
/** Local queue key */ /** Local queue key */
@@ -433,7 +433,7 @@ struct ib_cm_connect_reply {
/** RNR retry count, SRQ */ /** RNR retry count, SRQ */
uint8_t rnr_retry__srq; uint8_t rnr_retry__srq;
/** Local CA GUID */ /** Local CA GUID */
struct ib_gid_half local_ca; union ib_guid local_ca;
/** Private data */ /** Private data */
uint8_t private_data[196]; uint8_t private_data[196];
} __attribute__ (( packed )); } __attribute__ (( packed ));

View File

@@ -18,7 +18,7 @@ struct ib_mc_membership {
/** Queue pair */ /** Queue pair */
struct ib_queue_pair *qp; struct ib_queue_pair *qp;
/** Multicast GID */ /** Multicast GID */
struct ib_gid gid; union ib_gid gid;
/** Multicast group join transaction */ /** Multicast group join transaction */
struct ib_mad_transaction *madx; struct ib_mad_transaction *madx;
/** Handle join success/failure /** 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, extern int ib_mcast_join ( struct ib_device *ibdev, struct ib_queue_pair *qp,
struct ib_mc_membership *membership, struct ib_mc_membership *membership,
struct ib_gid *gid, union ib_gid *gid,
void ( * joined ) ( struct ib_device *ibdev, void ( * joined ) ( struct ib_device *ibdev,
struct ib_queue_pair *qp, struct ib_queue_pair *qp,
struct ib_mc_membership *memb, struct ib_mc_membership *memb,

View File

@@ -14,25 +14,38 @@ struct ib_queue_pair;
struct ib_address_vector; struct ib_address_vector;
struct io_buffer; struct io_buffer;
/** Half of an Infiniband Global Identifier */ /** An Infiniband Globally Unique Identifier */
struct ib_gid_half { union ib_guid {
union {
uint8_t bytes[8]; uint8_t bytes[8];
uint16_t words[4]; uint16_t words[4];
uint32_t dwords[2]; uint32_t dwords[2];
} u;
}; };
/** 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 */ /** An Infiniband Global Identifier */
struct ib_gid { union ib_gid {
union {
uint8_t bytes[16]; uint8_t bytes[16];
uint16_t words[8]; uint16_t words[8];
uint32_t dwords[4]; uint32_t dwords[4];
struct ib_gid_half half[2]; struct {
} u; 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 */ /** An Infiniband Local Route Header */
struct ib_local_route_header { struct ib_local_route_header {
/** Virtual lane and link version */ /** Virtual lane and link version */
@@ -83,9 +96,9 @@ struct ib_global_route_header {
/** Hop limit */ /** Hop limit */
uint8_t hoplmt; uint8_t hoplmt;
/** Source GID */ /** Source GID */
struct ib_gid sgid; union ib_gid sgid;
/** Destiniation GID */ /** Destiniation GID */
struct ib_gid dgid; union ib_gid dgid;
} __attribute__ (( packed )); } __attribute__ (( packed ));
#define IB_GRH_IPVER_IPv6 0x06 #define IB_GRH_IPVER_IPv6 0x06

View File

@@ -20,9 +20,9 @@ union ib_srp_initiator_port_id {
/** Infiniband version of port identifier */ /** Infiniband version of port identifier */
struct { struct {
/** Identifier extension */ /** Identifier extension */
struct ib_gid_half id_ext; union ib_guid id_ext;
/** IB channel adapter GUID */ /** IB channel adapter GUID */
struct ib_gid_half hca_guid; union ib_guid hca_guid;
} __attribute__ (( packed )) ib; } __attribute__ (( packed )) ib;
}; };
@@ -33,9 +33,9 @@ union ib_srp_target_port_id {
/** Infiniband version of port identifier */ /** Infiniband version of port identifier */
struct { struct {
/** Identifier extension */ /** Identifier extension */
struct ib_gid_half id_ext; union ib_guid id_ext;
/** I/O controller GUID */ /** I/O controller GUID */
struct ib_gid_half ioc_guid; union ib_guid ioc_guid;
} __attribute__ (( packed )) ib; } __attribute__ (( packed )) ib;
}; };
@@ -44,11 +44,11 @@ union ib_srp_target_port_id {
*/ */
struct sbft_ib_subtable { struct sbft_ib_subtable {
/** Source GID */ /** Source GID */
struct ib_gid sgid; union ib_gid sgid;
/** Destination GID */ /** Destination GID */
struct ib_gid dgid; union ib_gid dgid;
/** Service ID */ /** Service ID */
struct ib_gid_half service_id; union ib_guid service_id;
/** Partition key */ /** Partition key */
uint16_t pkey; uint16_t pkey;
/** Reserved */ /** Reserved */

View File

@@ -88,7 +88,7 @@ struct ib_address_vector {
/** GID is present */ /** GID is present */
unsigned int gid_present; unsigned int gid_present;
/** GID, if present */ /** GID, if present */
struct ib_gid gid; union ib_gid gid;
}; };
/** An Infiniband Work Queue */ /** An Infiniband Work Queue */
@@ -126,7 +126,7 @@ struct ib_multicast_gid {
/** List of multicast GIDs on this QP */ /** List of multicast GIDs on this QP */
struct list_head list; struct list_head list;
/** Multicast GID */ /** Multicast GID */
struct ib_gid gid; union ib_gid gid;
}; };
/** An Infiniband queue pair type */ /** An Infiniband queue pair type */
@@ -338,7 +338,7 @@ struct ib_device_operations {
*/ */
int ( * mcast_attach ) ( struct ib_device *ibdev, int ( * mcast_attach ) ( struct ib_device *ibdev,
struct ib_queue_pair *qp, struct ib_queue_pair *qp,
struct ib_gid *gid ); union ib_gid *gid );
/** Detach from multicast group /** Detach from multicast group
* *
* @v ibdev Infiniband device * @v ibdev Infiniband device
@@ -347,7 +347,7 @@ struct ib_device_operations {
*/ */
void ( * mcast_detach ) ( struct ib_device *ibdev, void ( * mcast_detach ) ( struct ib_device *ibdev,
struct ib_queue_pair *qp, struct ib_queue_pair *qp,
struct ib_gid *gid ); union ib_gid *gid );
/** Set port information /** Set port information
* *
* @v ibdev Infiniband device * @v ibdev Infiniband device
@@ -405,7 +405,7 @@ struct ib_device {
/** Link speed active */ /** Link speed active */
uint8_t link_speed_active; uint8_t link_speed_active;
/** Port GID */ /** Port GID */
struct ib_gid gid; union ib_gid gid;
/** Port LID */ /** Port LID */
uint16_t lid; uint16_t lid;
/** Subnet manager 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, extern struct ib_queue_pair * ib_find_qp_qpn ( struct ib_device *ibdev,
unsigned long qpn ); unsigned long qpn );
extern struct ib_queue_pair * ib_find_qp_mgid ( struct ib_device *ibdev, 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, extern struct ib_work_queue * ib_find_wq ( struct ib_completion_queue *cq,
unsigned long qpn, int is_send ); unsigned long qpn, int is_send );
extern int ib_post_send ( struct ib_device *ibdev, struct ib_queue_pair *qp, 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 void ib_close ( struct ib_device *ibdev );
extern int ib_link_rc ( 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, 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, 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, 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_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 int ib_set_pkey_table ( struct ib_device *ibdev, union ib_mad *mad );
extern struct ib_device * alloc_ibdev ( size_t priv_size ); extern struct ib_device * alloc_ibdev ( size_t priv_size );
extern int register_ibdev ( struct ib_device *ibdev ); extern int register_ibdev ( struct ib_device *ibdev );
extern void unregister_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 struct ib_device * last_opened_ibdev ( void );
extern void ib_link_state_changed ( struct ib_device *ibdev ); extern void ib_link_state_changed ( struct ib_device *ibdev );
extern void ib_poll_eq ( struct ib_device *ibdev ); extern void ib_poll_eq ( struct ib_device *ibdev );

View File

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

View File

@@ -341,7 +341,7 @@ struct ib_queue_pair * ib_find_qp_qpn ( struct ib_device *ibdev,
* @ret qp Queue pair, or NULL * @ret qp Queue pair, or NULL
*/ */
struct ib_queue_pair * ib_find_qp_mgid ( struct ib_device *ibdev, 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_queue_pair *qp;
struct ib_multicast_gid *mgid; struct ib_multicast_gid *mgid;
@@ -703,7 +703,7 @@ void ib_close ( struct ib_device *ibdev ) {
* the multicast group on the subnet. * the multicast group on the subnet.
*/ */
int ib_mcast_attach ( struct ib_device *ibdev, struct ib_queue_pair *qp, 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; struct ib_multicast_gid *mgid;
int rc; int rc;
@@ -737,7 +737,7 @@ int ib_mcast_attach ( struct ib_device *ibdev, struct ib_queue_pair *qp,
* @v gid Multicast GID * @v gid Multicast GID
*/ */
void ib_mcast_detach ( struct ib_device *ibdev, struct ib_queue_pair *qp, 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; struct ib_multicast_gid *mgid;
/* Remove from hardware multicast GID list */ /* 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 hca_guid HCA GUID
* @ret num_ports Number of ports * @ret num_ports Number of ports
*/ */
int ib_get_hca_info ( struct ib_device *ibdev, int ib_get_hca_info ( struct ib_device *ibdev, union ib_guid *hca_guid ) {
struct ib_gid_half *hca_guid ) {
struct ib_device *tmp; struct ib_device *tmp;
int num_ports = 0; int num_ports = 0;
@@ -779,7 +778,7 @@ int ib_get_hca_info ( struct ib_device *ibdev,
if ( tmp->dev != ibdev->dev ) if ( tmp->dev != ibdev->dev )
continue; continue;
if ( num_ports == 0 ) { if ( num_ports == 0 ) {
memcpy ( hca_guid, &tmp->gid.u.half[1], memcpy ( hca_guid, &tmp->gid.s.guid,
sizeof ( *hca_guid ) ); sizeof ( *hca_guid ) );
} }
num_ports++; num_ports++;
@@ -969,7 +968,7 @@ void unregister_ibdev ( struct ib_device *ibdev ) {
* @v gid GID * @v gid GID
* @ret ibdev Infiniband device, or NULL * @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; struct ib_device *ibdev;
for_each_ibdev ( ibdev ) { for_each_ibdev ( ibdev ) {

View File

@@ -432,7 +432,7 @@ static struct ib_path_operations ib_cm_path_op = {
*/ */
struct ib_connection * struct ib_connection *
ib_create_conn ( struct ib_device *ibdev, struct ib_queue_pair *qp, 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, void *private_data, size_t private_data_len,
struct ib_connection_operations *op ) { struct ib_connection_operations *op ) {
struct ib_connection *conn; 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", DBGC ( conn, "CM %p created for IBDEV %p QPN %lx\n",
conn, ibdev, qp->qpn ); conn, ibdev, qp->qpn );
DBGC ( conn, "CM %p connecting to %08x:%08x:%08x:%08x %08x:%08x\n", DBGC ( conn, "CM %p connecting to " IB_GID_FMT " " IB_GUID_FMT "\n",
conn, ntohl ( dgid->u.dwords[0] ), ntohl ( dgid->u.dwords[1] ), conn, IB_GID_ARGS ( dgid ), IB_GUID_ARGS ( service_id ) );
ntohl ( dgid->u.dwords[2] ), ntohl ( dgid->u.dwords[3] ),
ntohl ( service_id->u.dwords[0] ),
ntohl ( service_id->u.dwords[1] ) );
return conn; return conn;

View File

@@ -80,9 +80,9 @@ struct ib_cmrc_connection {
/** Connection */ /** Connection */
struct ib_connection *conn; struct ib_connection *conn;
/** Destination GID */ /** Destination GID */
struct ib_gid dgid; union ib_gid dgid;
/** Service ID */ /** Service ID */
struct ib_gid_half service_id; union ib_guid service_id;
/** QP is connected */ /** QP is connected */
int connected; int connected;
/** Shutdown process */ /** Shutdown process */
@@ -357,7 +357,7 @@ static struct interface_descriptor ib_cmrc_xfer_desc =
* @ret rc Returns status code * @ret rc Returns status code
*/ */
int ib_cmrc_open ( struct interface *xfer, struct ib_device *ibdev, 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; struct ib_cmrc_connection *cmrc;
int rc; int rc;

View File

@@ -41,7 +41,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
* @v join Join (rather than leave) group * @v join Join (rather than leave) group
* @v mad MAD to fill in * @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 ) { int join, union ib_mad *mad ) {
struct ib_mad_sa *sa = &mad->sa; 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_address_vector *av __unused ) {
struct ib_mc_membership *membership = ib_madx_get_ownerdata ( madx ); struct ib_mc_membership *membership = ib_madx_get_ownerdata ( madx );
struct ib_queue_pair *qp = membership->qp; 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 = struct ib_mc_member_record *mc_member_record =
&mad->sa.sa_data.mc_member_record; &mad->sa.sa_data.mc_member_record;
int joined; int joined;
@@ -97,11 +97,9 @@ static void ib_mcast_complete ( struct ib_device *ibdev,
/* Extract values from MAD */ /* Extract values from MAD */
joined = ( mad->hdr.method == IB_MGMT_METHOD_GET_RESP ); joined = ( mad->hdr.method == IB_MGMT_METHOD_GET_RESP );
qkey = ntohl ( mc_member_record->qkey ); 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" ), ibdev, qp->qpn, ( joined ? "joined" : "left" ),
ntohl ( gid->u.dwords[0] ), ntohl ( gid->u.dwords[1] ), IB_GID_ARGS ( gid ), qkey );
ntohl ( gid->u.dwords[2] ), ntohl ( gid->u.dwords[3] ),
qkey );
/* Set queue key */ /* Set queue key */
qp->qkey = qkey; qp->qkey = qkey;
@@ -136,7 +134,7 @@ static struct ib_mad_transaction_operations ib_mcast_op = {
* @ret rc Return status code * @ret rc Return status code
*/ */
int ib_mcast_join ( struct ib_device *ibdev, struct ib_queue_pair *qp, 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, void ( * complete ) ( struct ib_device *ibdev,
struct ib_queue_pair *qp, struct ib_queue_pair *qp,
struct ib_mc_membership *membership, 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; union ib_mad mad;
int rc; int rc;
DBGC ( ibdev, "IBDEV %p QPN %lx joining %08x:%08x:%08x:%08x\n", DBGC ( ibdev, "IBDEV %p QPN %lx joining " IB_GID_FMT "\n",
ibdev, qp->qpn, ntohl ( gid->u.dwords[0] ), ibdev, qp->qpn, IB_GID_ARGS ( gid ) );
ntohl ( gid->u.dwords[1] ), ntohl ( gid->u.dwords[2] ),
ntohl ( gid->u.dwords[3] ) );
/* Initialise structure */ /* Initialise structure */
membership->qp = qp; 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, void ib_mcast_leave ( struct ib_device *ibdev, struct ib_queue_pair *qp,
struct ib_mc_membership *membership ) { struct ib_mc_membership *membership ) {
struct ib_gid *gid = &membership->gid; union ib_gid *gid = &membership->gid;
union ib_mad mad; union ib_mad mad;
int rc; int rc;
DBGC ( ibdev, "IBDEV %p QPN %lx leaving %08x:%08x:%08x:%08x\n", DBGC ( ibdev, "IBDEV %p QPN %lx leaving " IB_GID_FMT "\n",
ibdev, qp->qpn, ntohl ( gid->u.dwords[0] ), ibdev, qp->qpn, IB_GID_ARGS ( gid ) );
ntohl ( gid->u.dwords[1] ), ntohl ( gid->u.dwords[2] ),
ntohl ( gid->u.dwords[3] ) );
/* Detach from multicast GID */ /* Detach from multicast GID */
ib_mcast_detach ( ibdev, qp, &membership->gid ); ib_mcast_detach ( ibdev, qp, &membership->gid );

View File

@@ -215,11 +215,8 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
if ( IB_LID_MULTICAST ( lid ) && grh ) { if ( IB_LID_MULTICAST ( lid ) && grh ) {
if ( ! ( *qp = ib_find_qp_mgid ( ibdev, &grh->dgid ))){ if ( ! ( *qp = ib_find_qp_mgid ( ibdev, &grh->dgid ))){
DBGC ( ibdev, "IBDEV %p RX for unknown MGID " DBGC ( ibdev, "IBDEV %p RX for unknown MGID "
"%08x:%08x:%08x:%08x\n", ibdev, IB_GID_FMT "\n",
ntohl ( grh->dgid.u.dwords[0] ), ibdev, IB_GID_ARGS ( &grh->dgid ) );
ntohl ( grh->dgid.u.dwords[1] ),
ntohl ( grh->dgid.u.dwords[2] ),
ntohl ( grh->dgid.u.dwords[3] ) );
return -ENODEV; return -ENODEV;
} }
} else { } else {

View File

@@ -49,18 +49,16 @@ static void ib_path_complete ( struct ib_device *ibdev,
int rc, union ib_mad *mad, int rc, union ib_mad *mad,
struct ib_address_vector *av __unused ) { struct ib_address_vector *av __unused ) {
struct ib_path *path = ib_madx_get_ownerdata ( madx ); 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; struct ib_path_record *pathrec = &mad->sa.sa_data.path_record;
/* Report failures */ /* Report failures */
if ( ( rc == 0 ) && ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) )) if ( ( rc == 0 ) && ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ))
rc = -ENETUNREACH; rc = -ENETUNREACH;
if ( rc != 0 ) { if ( rc != 0 ) {
DBGC ( ibdev, "IBDEV %p path lookup for %08x:%08x:%08x:%08x " DBGC ( ibdev, "IBDEV %p path lookup for " IB_GID_FMT
"failed: %s\n", ibdev, htonl ( dgid->u.dwords[0] ), " failed: %s\n",
htonl ( dgid->u.dwords[1] ), ibdev, IB_GID_ARGS ( dgid ), strerror ( rc ) );
htonl ( dgid->u.dwords[2] ),
htonl ( dgid->u.dwords[3] ), strerror ( rc ) );
goto out; goto out;
} }
@@ -68,10 +66,8 @@ static void ib_path_complete ( struct ib_device *ibdev,
path->av.lid = ntohs ( pathrec->dlid ); path->av.lid = ntohs ( pathrec->dlid );
path->av.sl = ( pathrec->reserved__sl & 0x0f ); path->av.sl = ( pathrec->reserved__sl & 0x0f );
path->av.rate = ( pathrec->rate_selector__rate & 0x3f ); path->av.rate = ( pathrec->rate_selector__rate & 0x3f );
DBGC ( ibdev, "IBDEV %p path to %08x:%08x:%08x:%08x is %04x sl %d " DBGC ( ibdev, "IBDEV %p path to " IB_GID_FMT " is %04x sl %d rate "
"rate %d\n", ibdev, htonl ( dgid->u.dwords[0] ), "%d\n", ibdev, IB_GID_ARGS ( dgid ), path->av.lid, path->av.sl,
htonl ( dgid->u.dwords[1] ), htonl ( dgid->u.dwords[2] ),
htonl ( dgid->u.dwords[3] ), path->av.lid, path->av.sl,
path->av.rate ); path->av.rate );
out: out:
@@ -179,7 +175,7 @@ static unsigned int ib_path_cache_idx;
* @ret path Path cache entry, or NULL * @ret path Path cache entry, or NULL
*/ */
static struct ib_cached_path * 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; struct ib_cached_path *cached;
unsigned int i; unsigned int i;
@@ -240,14 +236,14 @@ static struct ib_path_operations ib_cached_path_op = {
* cache similar to ARP. * cache similar to ARP.
*/ */
int ib_resolve_path ( struct ib_device *ibdev, struct ib_address_vector *av ) { 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; struct ib_cached_path *cached;
unsigned int cache_idx; unsigned int cache_idx;
/* Sanity check */ /* Sanity check */
if ( ! av->gid_present ) { if ( ! av->gid_present ) {
DBGC ( ibdev, "IBDEV %p attempt to look up path " DBGC ( ibdev, "IBDEV %p attempt to look up path without GID\n",
"without GID\n", ibdev ); ibdev );
return -EINVAL; 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->lid = cached->path->av.lid;
av->rate = cached->path->av.rate; av->rate = cached->path->av.rate;
av->sl = cached->path->av.sl; av->sl = cached->path->av.sl;
DBGC2 ( ibdev, "IBDEV %p cache hit for %08x:%08x:%08x:%08x\n", DBGC2 ( ibdev, "IBDEV %p cache hit for " IB_GID_FMT "\n",
ibdev, htonl ( gid->u.dwords[0] ), ibdev, IB_GID_ARGS ( gid ) );
htonl ( gid->u.dwords[1] ), htonl ( gid->u.dwords[2] ),
htonl ( gid->u.dwords[3] ) );
return 0; return 0;
} }
DBGC ( ibdev, "IBDEV %p cache miss for %08x:%08x:%08x:%08x%s\n", DBGC ( ibdev, "IBDEV %p cache miss for " IB_GID_FMT "%s\n", ibdev,
ibdev, htonl ( gid->u.dwords[0] ), htonl ( gid->u.dwords[1] ), IB_GID_ARGS ( gid ), ( cached ? " (in progress)" : "" ) );
htonl ( gid->u.dwords[2] ), htonl ( gid->u.dwords[3] ),
( cached ? " (in progress)" : "" ) );
/* If lookup is already in progress, do nothing */ /* If lookup is already in progress, do nothing */
if ( cached ) if ( cached )

View File

@@ -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 ); node_info->num_ports = ib_get_hca_info ( ibdev, &node_info->sys_guid );
memcpy ( &node_info->node_guid, &node_info->sys_guid, memcpy ( &node_info->node_guid, &node_info->sys_guid,
sizeof ( node_info->node_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 ) ); sizeof ( node_info->port_guid ) );
node_info->partition_cap = htons ( 1 ); node_info->partition_cap = htons ( 1 );
node_info->local_port_num = ibdev->port; 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, union ib_mad *mad,
struct ib_address_vector *av ) { struct ib_address_vector *av ) {
struct ib_node_desc *node_desc = &mad->smp.smp_data.node_desc; 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 ) ]; char hostname[ sizeof ( node_desc->node_string ) ];
int hostname_len; int hostname_len;
int rc; 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 ), snprintf ( node_desc->node_string, sizeof ( node_desc->node_string ),
"iPXE %s%s%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x (%s)", "iPXE %s%s%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x (%s)",
hostname, ( ( hostname_len >= 0 ) ? " " : "" ), hostname, ( ( hostname_len >= 0 ) ? " " : "" ),
guid.u.bytes[0], guid.u.bytes[1], guid.u.bytes[2], guid.bytes[0], guid.bytes[1], guid.bytes[2], guid.bytes[3],
guid.u.bytes[3], guid.u.bytes[4], guid.u.bytes[5], guid.bytes[4], guid.bytes[5], guid.bytes[6], guid.bytes[7],
guid.u.bytes[6], guid.u.bytes[7], ibdev->dev->name ); ibdev->dev->name );
/* Send GetResponse */ /* Send GetResponse */
mad->hdr.method = IB_MGMT_METHOD_GET_RESP; 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 */ /* Fill in information */
memset ( guid_info, 0, sizeof ( *guid_info ) ); 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] ) ); sizeof ( guid_info->guid[0] ) );
/* Send GetResponse */ /* Send GetResponse */
@@ -160,8 +160,8 @@ static int ib_sma_set_port_info ( struct ib_device *ibdev,
int rc; int rc;
/* Set parameters */ /* Set parameters */
memcpy ( &ibdev->gid.u.half[0], port_info->gid_prefix, memcpy ( &ibdev->gid.s.prefix, port_info->gid_prefix,
sizeof ( ibdev->gid.u.half[0] ) ); sizeof ( ibdev->gid.s.prefix ) );
ibdev->lid = ntohs ( port_info->lid ); ibdev->lid = ntohs ( port_info->lid );
ibdev->sm_lid = ntohs ( port_info->mastersm_lid ); ibdev->sm_lid = ntohs ( port_info->mastersm_lid );
if ( ( link_width_enabled = port_info->link_width_enabled ) ) 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 */ /* Fill in information */
memset ( port_info, 0, sizeof ( *port_info ) ); 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 ) ); sizeof ( port_info->gid_prefix ) );
port_info->lid = ntohs ( ibdev->lid ); port_info->lid = ntohs ( ibdev->lid );
port_info->mastersm_lid = ntohs ( ibdev->sm_lid ); port_info->mastersm_lid = ntohs ( ibdev->sm_lid );

View File

@@ -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 ) if ( ( rc = ib_smc_get_port_info ( ibdev, local_mad, &mad ) ) != 0 )
return rc; return rc;
memcpy ( &ibdev->gid.u.half[0], port_info->gid_prefix, memcpy ( &ibdev->gid.s.prefix, port_info->gid_prefix,
sizeof ( ibdev->gid.u.half[0] ) ); sizeof ( ibdev->gid.s.prefix ) );
ibdev->lid = ntohs ( port_info->lid ); ibdev->lid = ntohs ( port_info->lid );
ibdev->sm_lid = ntohs ( port_info->mastersm_lid ); ibdev->sm_lid = ntohs ( port_info->mastersm_lid );
ibdev->link_width_enabled = port_info->link_width_enabled; 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 */ /* GUID info gives us the second half of the port GID */
if ( ( rc = ib_smc_get_guid_info ( ibdev, local_mad, &mad ) ) != 0 ) if ( ( rc = ib_smc_get_guid_info ( ibdev, local_mad, &mad ) ) != 0 )
return rc; return rc;
memcpy ( &ibdev->gid.u.half[1], guid_info->guid[0], memcpy ( &ibdev->gid.s.guid, guid_info->guid[0],
sizeof ( ibdev->gid.u.half[1] ) ); sizeof ( ibdev->gid.s.guid ) );
/* Get partition key */ /* Get partition key */
if ( ( rc = ib_smc_get_pkey_table ( ibdev, local_mad, &mad ) ) != 0 ) if ( ( rc = ib_smc_get_pkey_table ( ibdev, local_mad, &mad ) ) != 0 )
return rc; return rc;
ibdev->pkey = ntohs ( pkey_table->pkey[0] ); ibdev->pkey = ntohs ( pkey_table->pkey[0] );
DBGC ( ibdev, "IBDEV %p port GID is %08x:%08x:%08x:%08x\n", ibdev, DBGC ( ibdev, "IBDEV %p port GID is " IB_GID_FMT "\n",
htonl ( ibdev->gid.u.dwords[0] ), ibdev, IB_GID_ARGS ( &ibdev->gid ) );
htonl ( ibdev->gid.u.dwords[1] ),
htonl ( ibdev->gid.u.dwords[2] ),
htonl ( ibdev->gid.u.dwords[3] ) );
return 0; return 0;
} }

View File

@@ -81,9 +81,9 @@ struct ib_srp_device {
struct ib_device *ibdev; struct ib_device *ibdev;
/** Destination GID (for boot firmware table) */ /** Destination GID (for boot firmware table) */
struct ib_gid dgid; union ib_gid dgid;
/** Service ID (for boot firmware table) */ /** 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 * @ret rc Return status code
*/ */
static int ib_srp_open ( struct interface *block, struct ib_device *ibdev, 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 *initiator,
union srp_port_id *target, struct scsi_lun *lun ) { union srp_port_id *target, struct scsi_lun *lun ) {
struct ib_srp_device *ib_srp; 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->srp, &ib_srp_srp_desc, &ib_srp->refcnt );
intf_init ( &ib_srp->cmrc, &ib_srp_cmrc_desc, &ib_srp->refcnt ); intf_init ( &ib_srp->cmrc, &ib_srp_cmrc_desc, &ib_srp->refcnt );
ib_srp->ibdev = ibdev_get ( ibdev ); ib_srp->ibdev = ibdev_get ( ibdev );
DBGC ( ib_srp, "IBSRP %p created for %08x%08x%08x%08x:%08x%08x\n", DBGC ( ib_srp, "IBSRP %p for " IB_GID_FMT " " IB_GUID_FMT "\n",
ib_srp, ntohl ( dgid->u.dwords[0] ), ib_srp, IB_GID_ARGS ( dgid ), IB_GUID_ARGS ( service_id ) );
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] ) );
/* Preserve parameters required for boot firmware table */ /* Preserve parameters required for boot firmware table */
memcpy ( &ib_srp->dgid, dgid, sizeof ( ib_srp->dgid ) ); memcpy ( &ib_srp->dgid, dgid, sizeof ( ib_srp->dgid ) );
@@ -256,15 +253,15 @@ enum ib_srp_parse_flags {
/** IB SRP root path parameters */ /** IB SRP root path parameters */
struct ib_srp_root_path { struct ib_srp_root_path {
/** Source GID */ /** Source GID */
struct ib_gid sgid; union ib_gid sgid;
/** Initiator port ID */ /** Initiator port ID */
union ib_srp_initiator_port_id initiator; union ib_srp_initiator_port_id initiator;
/** Destination GID */ /** Destination GID */
struct ib_gid dgid; union ib_gid dgid;
/** Partition key */ /** Partition key */
uint16_t pkey; uint16_t pkey;
/** Service ID */ /** Service ID */
struct ib_gid_half service_id; union ib_guid service_id;
/** SCSI LUN */ /** SCSI LUN */
struct scsi_lun lun; struct scsi_lun lun;
/** Target port ID */ /** Target port ID */
@@ -337,7 +334,7 @@ static int ib_srp_parse_sgid ( const char *rp_comp,
if ( ( ibdev = last_opened_ibdev() ) != NULL ) if ( ( ibdev = last_opened_ibdev() ) != NULL )
memcpy ( &rp->sgid, &ibdev->gid, sizeof ( rp->sgid ) ); 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 ) | ( sizeof ( rp->sgid ) |
IB_SRP_PARSE_OPTIONAL ) ); 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 ) { struct ib_srp_root_path *rp ) {
union ib_srp_initiator_port_id *port_id = &rp->initiator; 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 ) | ( sizeof ( port_id->ib.id_ext ) |
IB_SRP_PARSE_OPTIONAL ) ); 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; union ib_srp_initiator_port_id *port_id = &rp->initiator;
/* Default to the GUID portion of the source GID */ /* 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 ) ); 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 ) | ( sizeof ( port_id->ib.hca_guid ) |
IB_SRP_PARSE_OPTIONAL ) ); 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, static int ib_srp_parse_dgid ( const char *rp_comp,
struct ib_srp_root_path *rp ) { 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 ) | ( sizeof ( rp->dgid ) |
IB_SRP_PARSE_REQUIRED ) ); 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, static int ib_srp_parse_service_id ( const char *rp_comp,
struct ib_srp_root_path *rp ) { 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 ) | ( sizeof ( rp->service_id ) |
IB_SRP_PARSE_REQUIRED ) ); 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 ) { struct ib_srp_root_path *rp ) {
union ib_srp_target_port_id *port_id = &rp->target; 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 ) | ( sizeof ( port_id->ib.id_ext ) |
IB_SRP_PARSE_REQUIRED ) ); 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 ) { struct ib_srp_root_path *rp ) {
union ib_srp_target_port_id *port_id = &rp->target; 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 ) | ( sizeof ( port_id->ib.ioc_guid ) |
IB_SRP_PARSE_REQUIRED ) ); IB_SRP_PARSE_REQUIRED ) );
} }