[VSTAT] 1. feature: added '-h' flag;
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 14 Aug 2006 18:22:23 +0000 (18:22 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 14 Aug 2006 18:22:23 +0000 (18:22 +0000)
2. added a print of warning while in "livefish" mode
3. output formatting improvements

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@452 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

tools/vstat/user/vstat_main.c

index 2026d80..80d9c08 100644 (file)
@@ -203,8 +203,11 @@ void print_uplink_info(ib_ca_attr_t* ca_attr)
 \r
 void vstat_print_ca_attr(int idx,  ib_ca_attr_t* ca_attr, BOOLEAN fullPrint){\r
        int i;\r
-       \r
-       printf("\n\thca_idx=%d\n",idx);\r
+\r
+       printf("\n\thca_idx=%d\n", idx);\r
+       if (ca_attr->dev_id & 1)\r
+               printf("\tATTENTION! \n\t    The device is in 'Flash Recovery' mode, probably due to an incorrect firmware."\r
+                       "\n\t    Use firmware tools to solve the problem.\n",idx);\r
        printf("\tpci_location={BUS=NA,DEV/FUNC=NA}\n");\r
        print_uplink_info(ca_attr);\r
        printf("\tvendor_id=0x%04x\n", ca_attr->vend_id);\r
@@ -237,8 +240,8 @@ void vstat_print_ca_attr(int idx,  ib_ca_attr_t* ca_attr, BOOLEAN fullPrint){
                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
 \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("\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
                printf("\tmax_res_rd_atom = 0x%x                (Max. Num. of resources used for RDMA read/atomic as target)\n",ca_attr->max_resp_res);\r
                printf("\tmax_qp_init_rd_atom = 0x%x    (Max. Num. of outs. RDMA read/atomic as initiator)\n",ca_attr->max_qp_init_depth);\r
@@ -299,20 +302,20 @@ void vstat_get_counters(ib_ca_handle_t h_ca,uint8_t port_num)
        \r
        port_counters = (ib_port_counters_t*)(((ib_gmp_t*)mad_out)->data);\r
 \r
-       printf("\nport counters for port %d\n",port_num);\r
-       printf("\tlink_error_recovery_counter\t0x%x \n",port_counters->link_error_recovery_counter);\r
-       printf("\tlink_down_counter\t0x%x \n",port_counters->link_down_counter);\r
-       printf("\tport_rcv_errors\t\t0x%x \n",CL_NTOH16(port_counters->port_rcv_errors));\r
-       printf("\tport_rcv_remote_physical_errors\t0x%x \n",CL_NTOH16(port_counters->port_rcv_remote_physical_errors));\r
-       printf("\tport_rcv_switch_relay_errors\t0x%x \n",CL_NTOH16(port_counters->port_rcv_switch_relay_errors));\r
-       printf("\tport_xmit_discard\t\t0x%x \n",CL_NTOH16(port_counters->port_xmit_discard));\r
-       printf("\tport_xmit_constraint_errors\t0x%x \n",port_counters->port_xmit_constraint_errors);\r
-       printf("\tport_rcv_constraint_errors\t0x%x \n",port_counters->port_rcv_constraint_errors);\r
-       printf("\tvl15_dropped\t\t\t0x%x \n",CL_NTOH16(port_counters->vl15_dropped));\r
-       printf("\tport_rcv_data\t\t\t0x%x \n",CL_NTOH32(port_counters->port_rcv_data));\r
-       printf("\tport_xmit_data\t\t\t0x%x \n",CL_NTOH32(port_counters->port_xmit_data));\r
-       printf("\tport_rcv_pkts\t\t\t0x%x \n",CL_NTOH32(port_counters->port_rcv_pkts));\r
-       printf("\tport_xmit_pkts\t\t\t0x%x \n\n",CL_NTOH32(port_counters->port_xmit_pkts));\r
+       printf("\n\tport counters for port %d\n",port_num);\r
+       printf("\t\tlink_error_recovery_counter\t0x%x \n",port_counters->link_error_recovery_counter);\r
+       printf("\t\tlink_down_counter\t\t0x%x \n",port_counters->link_down_counter);\r
+       printf("\t\tport_rcv_errors\t\t\t0x%x \n",CL_NTOH16(port_counters->port_rcv_errors));\r
+       printf("\t\tport_rcv_remote_physical_errors\t0x%x \n",CL_NTOH16(port_counters->port_rcv_remote_physical_errors));\r
+       printf("\t\tport_rcv_switch_relay_errors\t0x%x \n",CL_NTOH16(port_counters->port_rcv_switch_relay_errors));\r
+       printf("\t\tport_xmit_discard\t\t0x%x \n",CL_NTOH16(port_counters->port_xmit_discard));\r
+       printf("\t\tport_xmit_constraint_errors\t0x%x \n",port_counters->port_xmit_constraint_errors);\r
+       printf("\t\tport_rcv_constraint_errors\t0x%x \n",port_counters->port_rcv_constraint_errors);\r
+       printf("\t\tvl15_dropped\t\t\t0x%x \n",CL_NTOH16(port_counters->vl15_dropped));\r
+       printf("\t\tport_rcv_data\t\t\t0x%x \n",CL_NTOH32(port_counters->port_rcv_data));\r
+       printf("\t\tport_xmit_data\t\t\t0x%x \n",CL_NTOH32(port_counters->port_xmit_data));\r
+       printf("\t\tport_rcv_pkts\t\t\t0x%x \n",CL_NTOH32(port_counters->port_rcv_pkts));\r
+       printf("\t\tport_xmit_pkts\t\t\t0x%x \n\n",CL_NTOH32(port_counters->port_xmit_pkts));\r
        \r
 }\r
 \r
@@ -489,7 +492,12 @@ Cleanup1:
        return ret_status;\r
 }\r
 \r
-\r
+void vstat_help()\r
+{\r
+       printf("\n\tUsage: vstat [-v] [-c]\n");\r
+       printf("\t\t -v - verbose mode\n");\r
+       printf("\t\t -c - HCA error/statistic counters\n");\r
+}\r
 \r
 int32_t __cdecl\r
 main(\r
@@ -499,12 +507,17 @@ main(
        ib_api_status_t ib_status;\r
        BOOLEAN fullPrint = FALSE;\r
        BOOLEAN getCounters = FALSE;\r
+       BOOLEAN showHelp = FALSE;\r
        if(argc>1){\r
                int i = 2;\r
                while(i<=argc){\r
                        if(!_stricmp(argv[i-1], "-v")){\r
                                fullPrint = TRUE;\r
                                i+=1;\r
+                       }else if(!_stricmp(argv[i-1], "-h") || \r
+                               !_stricmp(argv[i-1], "-help")){\r
+                               showHelp = TRUE;\r
+                               i+=1;\r
                        }else if(!_stricmp(argv[i-1], "-c")){\r
                                getCounters = TRUE;\r
                                i+=1;\r
@@ -513,7 +526,10 @@ main(
                        }\r
                }\r
        }\r
-       ib_status = vstat_ca_attr(FALSE, fullPrint,getCounters);\r
+       if (showHelp)\r
+               vstat_help();\r
+       else\r
+               ib_status = vstat_ca_attr(FALSE, fullPrint,getCounters);\r
 \r
        return 0;\r
 }\r