[TOOLS] change the port GUID format
authorsleybo <sleybo@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 10 Jul 2006 15:32:59 +0000 (15:32 +0000)
committersleybo <sleybo@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 10 Jul 2006 15:32:59 +0000 (15:32 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@416 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

tools/vstat/user/vstat_main.c

index 3d0d783..b6662da 100644 (file)
 \r
 \r
 void print64bit(ib_net64_t u64, BOOLEAN hexFormat){\r
-       ib_net64_t mask = 255;\r
-       ib_net64_t tmp;\r
+       ib_net64_t mask = (1<<16)-1;\r
+       ib_net16_t tmp;\r
        int i;\r
-       for(i=0;i<8;i++){\r
-               tmp = (short)(u64>>(i*8)) & mask;\r
+       for(i=0;i<4;i++){\r
+               tmp = (uint16_t)((u64>>(i*16))& mask);\r
                if(hexFormat){\r
-                       printf("%02x", tmp);\r
-                       if(i<7){\r
+                       printf("%04x",cl_hton16(tmp));\r
+                       if(i<3){\r
                                printf(":");\r
                        }\r
                }else{\r
-                       if(tmp<100){\r
-                               printf("%02d", tmp);\r
+                       \r
+                       if((tmp>>8)<100){\r
+                               printf("%02d", tmp>>8);\r
                        }else{\r
-                               printf("%03d", tmp);\r
+                               printf("%03d", tmp>>8);\r
                        }\r
-                       if(i<7){\r
-                               printf(".");\r
+                       printf(".");\r
+                       if((tmp&(mask<<8)) <100){\r
+                               printf("%02d", tmp&(mask<<8));\r
+                       }else{\r
+                               printf("%03d", tmp&(mask<<8));\r
                        }\r
+                       \r
                }\r
        }\r
 }      \r
@@ -79,14 +84,14 @@ void print64bit(ib_net64_t u64, BOOLEAN hexFormat){
 void printGUID(ib_net64_t guid){\r
        printf("\tnode_guid=");\r
        print64bit(guid, TRUE);\r
-       printf("        (Node GUID for this hca)\n");\r
+       printf("\n");\r
 }\r
 \r
 void printPortGID(ib_net64_t subnetPrefix, ib_net64_t portGuid){\r
-       printf("\t\tGID[  0]= ");\r
-       print64bit(subnetPrefix, FALSE);\r
-       printf(".");\r
-       print64bit(portGuid, FALSE);\r
+       printf("\t\tGID[0]=");\r
+       print64bit(subnetPrefix, TRUE);\r
+       printf(":");\r
+       print64bit(portGuid, TRUE);\r
        printf("\n");\r
 }\r
 \r
@@ -174,7 +179,7 @@ void vstat_print_ca_attr(int idx,  ib_ca_attr_t* ca_attr, BOOLEAN fullPrint){
        }else{\r
                printf("\tfw_ver=0x%I64x\n",ca_attr->fw_ver);\r
        }\r
-\r
+       printGUID(ca_attr->ca_guid);\r
        if(fullPrint){\r
                printf("\tnum_phys_ports = %d\n",ca_attr->num_ports);\r
                printf("\tmax_num_qp = 0x%x             (Maximum Number of QPs supported)\n", ca_attr->max_qps);\r
@@ -191,7 +196,7 @@ void vstat_print_ca_attr(int idx,  ib_ca_attr_t* ca_attr, BOOLEAN fullPrint){
                printf("\tmax_mr_size = 0x%x    (Largest contigous block of memory region in bytes)\n", ca_attr->init_region_size);\r
                printf("\tmax_pd_num = 0x%x             (Maximum number of protection domains supported)\n", ca_attr->max_pds);\r
                printf("\tpage_size_cap = 0x%x          (Largest page size supported by this HCA)\n",ca_attr->p_page_size[ca_attr->num_page_sizes-1]);\r
-               printGUID(ca_attr->ca_guid);\r
+\r
                printf("\tlocal_ca_ack_delay = 0x%x             (Log2 4.096usec Max. RX to ACK or NAK delay)\n", ca_attr->local_ack_delay);\r
                printf("\tmax_qp_ous_rd_atom = 0x%x             (Maximum number of oust. RDMA read/atomic as target)\n",ca_attr->max_qp_resp_res);\r
                printf("\tmax_ee_ous_rd_atom = 0                (EE Maximum number of outs. RDMA read/atomic as target)\n");\r
@@ -208,8 +213,8 @@ void vstat_print_ca_attr(int idx,  ib_ca_attr_t* ca_attr, BOOLEAN fullPrint){
                printf("\tmax_mcast_grp_num = 0x%x      (Maximum Number of multicast groups)\n", ca_attr->max_mcast_grps);\r
                printf("\tmax_mcast_qp_attach_num = 0x%x        (Maximum number of QP per multicast group)\n", ca_attr->max_qps_per_mcast_grp);\r
                printf("\tmax_ah_num = 0x%x             (Maximum number of address handles)\n", ca_attr->max_addr_handles);\r
-               printf("\tmax_num_fmr = 0x%x                    (Maximum number FMRs)\n", ca_attr->max_fmr);\r
-               printf("\tmax_num_map_per_fmr = 0x%x            (Maximum number of (re)maps per FMR before an unmap operation in required)\n", ca_attr->max_map_per_fmr);\r
+               printf("\tmax_num_fmr = 0x%x            (Maximum number FMRs)\n", ca_attr->max_fmr);\r
+               printf("\tmax_num_map_per_fmr = 0x%x    (Maximum number of (re)maps per FMR before an unmap operation in required)\n", ca_attr->max_map_per_fmr);\r
        }else{\r
                printf("\tnum_phys_ports=%d\n",         ca_attr->num_ports);\r
        }\r