]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[infiniband] Match GID/GUID terminology as used in the IBA
authorMichael Brown <mcb30@ipxe.org>
Wed, 15 Sep 2010 18:25:05 +0000 (19:25 +0100)
committerMichael Brown <mcb30@ipxe.org>
Wed, 15 Sep 2010 18:25:05 +0000 (19:25 +0100)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
22 files changed:
src/drivers/infiniband/arbel.c
src/drivers/infiniband/hermon.c
src/drivers/infiniband/linda.c
src/drivers/infiniband/qib7322.c
src/drivers/net/ipoib.c
src/include/ipxe/ib_cm.h
src/include/ipxe/ib_cmrc.h
src/include/ipxe/ib_mad.h
src/include/ipxe/ib_mcast.h
src/include/ipxe/ib_packet.h
src/include/ipxe/ib_srp.h
src/include/ipxe/infiniband.h
src/include/ipxe/ipoib.h
src/net/infiniband.c
src/net/infiniband/ib_cm.c
src/net/infiniband/ib_cmrc.c
src/net/infiniband/ib_mcast.c
src/net/infiniband/ib_packet.c
src/net/infiniband/ib_pathrec.c
src/net/infiniband/ib_sma.c
src/net/infiniband/ib_smc.c
src/net/infiniband/ib_srp.c

index 5937c5249aa6825f7ac5eb07d2fe7fb5b83f7c0a..129ec574ee3d7a811d3b2b886a3ed4258e7f84fb 100644 (file)
@@ -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;
index f074386ffdd52a59e5d5582ddf07d8a6aef32c6b..8b5c2487c67197ebedbf07cf1a5484b52d1bd2dd 100644 (file)
@@ -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;
index 83d473c7fff25208451280987c80d37d9aab72ef..12a09a04710d19d4146ce7d45d1c707127d954e4 100644 (file)
@@ -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 */
index e8b41a47c6ff3f455f77323776a7b918df9ab7cf..b1902cfa98249231da54b1cc434ec7f82496d04b 100644 (file)
@@ -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 );
        }
 
index 82d7ca9994823c36e010529b42d31df30def76f3..52ac5f03a473f909e9b8470a9193502811a78f7c 100644 (file)
@@ -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,
index 136e4943b7c890413407bdd498b8c0e25e3ed58a..7d08cd9b131ad8d09fdfeb9c45a1058b6573df56 100644 (file)
@@ -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,
index 4f2eae69e9bbcee9c8d52b7f92b178e9acedc3e6..47ad27fa6ddece98caab40910bea324bd405a4c6 100644 (file)
@@ -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 */
index 23c2657caab45ad0345cf5405287f7faa57d9108..b8694833e91f44c7a423cbfec9afdc42b856761c 100644 (file)
@@ -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 ));
index 86d5709082ad348d32e268d0f9062d734be6b8cd..a5c22a03efb9c6a18ab033cac838d5beaced9693 100644 (file)
@@ -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,
index 09042957bb7aef7d60f4579c68418c84e70f6eb9..4bd335764725b5bd8c34963b7ce1db7f412f13ff 100644 (file)
@@ -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
index 902bef562381469b911487424417ee6b5634e4de..ad407b0cfffbf4f5b21fc6eeca23b0843af5fccf 100644 (file)
@@ -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 */
index edcce371ccec6d2218421cfd94bdd1128a875cfc..aa67dd4aba2904daf2aece94527fc1f3f04d60e5 100644 (file)
@@ -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 );
index 6a3fd607a0d79926c4f9f56e0fdb2df9fefb3838..e8f12dc5d06e382f5133a58a6310d2b038c6c255 100644 (file)
@@ -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 */
index 76fce3bd9e25f17327643060bc196200d4b94761..d7cbf697ad1205ba2f7dec3bab34dc8c37e7b119 100644 (file)
@@ -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 ) {
index cac0a983eba676ed3a229f95e58ccd050f296ac7..bbba5727e3484deb6dd43ad0656fef009dc9ee0b 100644 (file)
@@ -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;
 
index f596c36dce13af5908fe48a6188b73eca9235be9..011ff3e0625e6cefb15e7ce9985053063598600b 100644 (file)
@@ -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;
 
index 9eff1899e188394499086397731cabccb5cd0645..0f03b54ac94b4261642bf70307242b1748bd209a 100644 (file)
@@ -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 );
index 943f39571273c3cbb19723a740fa91995f29096c..d58e0ad4b08a764043c6a96b1f90bde724fd62fc 100644 (file)
@@ -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 {
index e1fa530683ef7c44322d9b33e2a0f3094b0ab405..7b9146547f9bbcda383b5c4a5b6f044547d4860d 100644 (file)
@@ -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 )
index b8327355f797d6954a24c84696b11afb548547ea..45a1e44698b6100b1b5b8283f610c5de5ece22f6 100644 (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 );
        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 );
index 7d5963594ab4cbfb4eef13eec7d057da046bb5db..5eef8255a1b88c0ea01fa073b2f82f1054293aab 100644 (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 )
                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;
 }
index 41416a202cb98831e30ce789f1066ca541962bb8..7b2b2b4ea27e68b0354e5ffa2bacc0c0013fbc17 100644 (file)
@@ -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 ) );
 }