[HW, VSTAT] Added more attributes to query CA: RESIZE_MAX_WR, CHANGE_PHYSICAL_PORT...
[mirror/winof/.git] / tools / vstat / user / vstat_main.c
index d170965..a901450 100644 (file)
@@ -119,6 +119,34 @@ void printPortLinkState(int portState){ //TODO: check that these are all the opt
        }\r
 }\r
 \r
+void printPortPhysState(uint8_t physState){ \r
+       switch(physState){\r
+               case 1:\r
+                       printf("\t\tport_phys_state=SLEEP (%d)\n",physState);\r
+                       break;\r
+               case 2:\r
+                       printf("\t\tport_phys_state=POLLING (%d)\n",physState);\r
+                       break;\r
+               case 3:\r
+                       printf("\t\tport_phys_state=DISABLED (%d)\n",physState);\r
+                       break;\r
+               case 4:\r
+                       printf("\t\tport_phys_state=CFG_TRAINING (%d)\n",physState);\r
+                       break;\r
+               case 5:\r
+                       printf("\t\tport_phys_state=LINK_UP (%d)\n",physState);\r
+                       break;\r
+               case 6:\r
+                       printf("\t\tport_phys_state=LINK_ERROR_RECOVERY (%d)\n",physState);\r
+                       break;\r
+               case 7:\r
+                       printf("\t\tport_phys_state=PHY_TEST (%d)\n",physState);\r
+                       break;\r
+               default:\r
+                       printf("\t\tport_phys_state=UNKNOWN (%d)\n",physState); \r
+       }\r
+}\r
+\r
 void printPortRate(int speed, int width, int portState){ \r
        if (portState == 1){ /* In case the port is in Down state */\r
                printf("\t\tlink_speed=NA\n");\r
@@ -126,14 +154,13 @@ void printPortRate(int speed, int width, int portState){
        }else{  \r
                switch(speed){\r
                        case 1:\r
-                               printf("\t\tlink_speed=2.5Gbps (%d)\n",speed);\r
+                               printf("\t\tlink_speed=2.5 Gbps (%d)\n",speed);\r
                                break;\r
                        case 2:\r
-                               printf("\t\tlink_speed=5Gbps (%d)\n",speed);\r
+                               printf("\t\tlink_speed=5.0 Gbps (%d)\n",speed);\r
                                break;\r
-                       \r
                        case 4:\r
-                               printf("\t\tlink_speed=10Gbps (%d)\n",speed);\r
+                               printf("\t\tlink_speed=10.0 Gbps (%d)\n",speed);\r
                                break;\r
                        default:\r
                                printf("\t\tlink_speed=UNKNOWN (%d)\n",speed); \r
@@ -141,16 +168,16 @@ void printPortRate(int speed, int width, int portState){
 \r
                switch (width){\r
                        case 1:\r
-                               printf("\t\tlink_width=1x (%d) \n\t\trate=%d\n",width,1*speed);\r
+                               printf("\t\tlink_width=1x (%f) \n\t\trate=%d Gbps\n",width,2.5*speed);\r
                                break;\r
                        case 2:\r
-                               printf("\t\tlink_width=4x (%d) \n\t\trate=%d\n",width,10*speed);\r
+                               printf("\t\tlink_width=4x (%d) \n\t\trate=%d Gbps\n",width,10*speed);\r
                                break;\r
                        case 4:\r
-                               printf("\t\tlink_width=8x (%d) \n\t\trate=%d\n",width,20*speed);\r
+                               printf("\t\tlink_width=8x (%d) \n\t\trate=%d Gbps\n",width,20*speed);\r
                                break;\r
                        case 8:\r
-                               printf("\t\tlink_width=12x (%d) \n\t\trate=%d\n",width,30*speed);\r
+                               printf("\t\tlink_width=12x (%d) \n\t\trate=%d Gbps\n",width,30*speed);\r
                                break;\r
                        default:\r
                                printf("\t\tlink_width=UNKNOWN (%d)\n",width);\r
@@ -210,10 +237,29 @@ void printPortCaps(ib_port_cap_t *ibal_port_cap_p)
        PRINT_CAP(pkey_nvram, PKEY_NVRAM);\r
        printf("\n");\r
 }\r
+\r
+void printPortActiveSpeed(uint8_t speed){ \r
+       switch(speed){\r
+               case 1:\r
+                       printf("\t\tactive_speed=2.5 Gbps (%d)\n",speed);\r
+                       break;\r
+               case 2:\r
+                       printf("\t\tactive_speed=5.0 Gbps (%d)\n",speed);\r
+                       break;\r
+               case 4:\r
+                       printf("\t\tactive_speed=10.0 Gbps (%d)\n",speed);\r
+                       break;\r
+               default:\r
+                       printf("\t\tactive_speed=UNKNOWN (%d)\n",speed); \r
+       }\r
+}\r
+\r
 void printPortInfo(ib_port_attr_t* portPtr, ib_port_info_t portInfo, BOOLEAN fullPrint){\r
        printf("\t\tport=%d\n", portPtr->port_num);\r
        printPortLinkState(portPtr->link_state);\r
        printPortRate(portInfo.link_speed>>4,portInfo.link_width_active, portPtr->link_state);\r
+       printPortPhysState(portPtr->phys_state);\r
+       printPortActiveSpeed(portPtr->active_speed);\r
        printf("\t\tsm_lid=0x%04x\n", cl_ntoh16(portPtr->sm_lid));\r
        printf("\t\tport_lid=0x%04x\n", cl_ntoh16(portPtr->lid));\r
        printf("\t\tport_lmc=0x%x\n", portPtr->lmc);\r
@@ -234,7 +280,6 @@ void printPortInfo(ib_port_attr_t* portPtr, ib_port_info_t portInfo, BOOLEAN ful
        printf("\n");\r
 }\r
 \r
-\r
 void print_uplink_info(ib_ca_attr_t* ca_attr)\r
 {\r
        uplink_info_t*p_uplink_info = mthca_get_uplink_info(ca_attr);\r
@@ -331,6 +376,12 @@ void vstat_print_ca_attr(int idx,  ib_ca_attr_t* ca_attr, ib_port_info_t* vstat_
                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("\tmodify_wr_depth = %d          (Capabilities: change QP depth during a modify QP)\n", !!ca_attr->modify_wr_depth);\r
+               printf("\tmodify_srq_depth = %d                 (Capabilities: change SRQ depth - Not supported by driver!)\n", !!ca_attr->modify_srq_depth);\r
+               printf("\tchange_primary_port = %d              (Capabilities: change primary port for a QP during a SQD->RTS transition)\n", !!ca_attr->change_primary_port);\r
+               printf("\tav_port_check = %d            (Capabilities: check port number in address handles)\n", !!ca_attr->av_port_check);\r
+               printf("\tinit_type_support = %d                (Capabilities: set init_type)\n", !!ca_attr->init_type_support);\r
+               printf("\tshutdown_port = %d            (Capabilities: shutdown port support)\n", !!ca_attr->shutdown_port_capability);\r
        }else{\r
                printf("\tnum_phys_ports=%d\n",         ca_attr->num_ports);\r
        }\r