}
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,
}
/** 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 },
};
/**
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;
*/
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;
*/
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;
}
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,
*/
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;
*/
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;
*/
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;
*/
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;
* @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 ) {
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 */
struct i2c_device eeprom;
/** Base GUID */
- struct ib_gid_half guid;
+ union ib_guid guid;
/** Infiniband devices */
struct ib_device *ibdev[QIB7322_MAX_PORTS];
};
*/
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;
*/
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;
*/
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 ) {
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 );
}
/** 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" */
* @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 ) );
}
/**
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;
}
* @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;
}
/** 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 );
};
*/
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 );
}
}
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,
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 */
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,
/** 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;
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,
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 */
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;
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;
#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;
/** 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 */
/** 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 */
/** 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 ));
/** 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
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,
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 */
/** 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
/** 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;
};
/** 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;
};
*/
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 */
/** GID is present */
unsigned int gid_present;
/** GID, if present */
- struct ib_gid gid;
+ union ib_gid gid;
};
/** An Infiniband Work Queue */
/** 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 */
*/
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
*/
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
/** 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 */
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,
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 );
*/
uint32_t flags__qpn;
/** Port GID */
- struct ib_gid gid;
+ union ib_gid gid;
} __attribute__ (( packed ));
/** IPoIB link-layer header length */
* @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;
* 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;
* @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 */
* @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;
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++;
* @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 ) {
*/
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;
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;
/** 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 */
* @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;
* @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;
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;
/* 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;
* @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,
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;
*/
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 );
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 {
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;
}
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:
* @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;
* 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;
}
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 )
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;
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;
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;
/* 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 */
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 ) )
/* 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 );
*/
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;
/* 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;
}
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;
};
/**
* @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;
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 ) );
/** 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 */
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 ) );
}
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 ) );
}
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 ) );
}
*/
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 ) );
}
*/
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 ) );
}
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 ) );
}
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 ) );
}