From 357c02c83c6093e6bf5f32b264d18d6122767bbf Mon Sep 17 00:00:00 2001 From: tzachid Date: Sun, 4 May 2008 11:28:15 +0000 Subject: [PATCH] [HW, VSTAT] Added more attributes to query CA: RESIZE_MAX_WR, CHANGE_PHYSICAL_PORT, AH_PORT_CHECKING, SHUTDOWN_PORT, INIT_TYPE, SRQ_RESIZE and port ones: MaxMtu, ActiveSpeed, PhysicalState (winib #2383) git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1126 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- hw/mthca/kernel/hca_data.c | 2 + inc/iba/ib_types.h | 2 + tools/vstat/user/vstat_main.c | 69 ++++++++++++++++++++++++++++++----- 3 files changed, 64 insertions(+), 9 deletions(-) diff --git a/hw/mthca/kernel/hca_data.c b/hw/mthca/kernel/hca_data.c index 5805306e..fb413538 100644 --- a/hw/mthca/kernel/hca_data.c +++ b/hw/mthca/kernel/hca_data.c @@ -322,6 +322,8 @@ mlnx_conv_hca_cap( ibal_port_p->qkey_ctr = (uint16_t)mthca_port_p->qkey_viol_cntr; ibal_port_p->max_msg_size = mthca_port_p->max_msg_sz; ibal_port_p->mtu = (uint8_t)mthca_port_p->max_mtu; + ibal_port_p->active_speed = mthca_port_p->active_speed; + ibal_port_p->phys_state = mthca_port_p->phys_state; ibal_port_p->subnet_timeout = mthca_port_p->subnet_timeout; // ibal_port_p->local_ack_timeout = 3; // TBD: currently ~32 usec diff --git a/inc/iba/ib_types.h b/inc/iba/ib_types.h index f5c7e322..8a2dc315 100644 --- a/inc/iba/ib_types.h +++ b/inc/iba/ib_types.h @@ -9170,6 +9170,8 @@ typedef struct _ib_port_attr * timeout = 4.096 microseconds * 2^subnet_timeout */ uint8_t subnet_timeout; + uint8_t active_speed; + uint8_t phys_state; ib_port_cap_t cap; uint16_t pkey_ctr; diff --git a/tools/vstat/user/vstat_main.c b/tools/vstat/user/vstat_main.c index d170965a..a901450a 100644 --- a/tools/vstat/user/vstat_main.c +++ b/tools/vstat/user/vstat_main.c @@ -119,6 +119,34 @@ void printPortLinkState(int portState){ //TODO: check that these are all the opt } } +void printPortPhysState(uint8_t physState){ + switch(physState){ + case 1: + printf("\t\tport_phys_state=SLEEP (%d)\n",physState); + break; + case 2: + printf("\t\tport_phys_state=POLLING (%d)\n",physState); + break; + case 3: + printf("\t\tport_phys_state=DISABLED (%d)\n",physState); + break; + case 4: + printf("\t\tport_phys_state=CFG_TRAINING (%d)\n",physState); + break; + case 5: + printf("\t\tport_phys_state=LINK_UP (%d)\n",physState); + break; + case 6: + printf("\t\tport_phys_state=LINK_ERROR_RECOVERY (%d)\n",physState); + break; + case 7: + printf("\t\tport_phys_state=PHY_TEST (%d)\n",physState); + break; + default: + printf("\t\tport_phys_state=UNKNOWN (%d)\n",physState); + } +} + void printPortRate(int speed, int width, int portState){ if (portState == 1){ /* In case the port is in Down state */ printf("\t\tlink_speed=NA\n"); @@ -126,14 +154,13 @@ void printPortRate(int speed, int width, int portState){ }else{ switch(speed){ case 1: - printf("\t\tlink_speed=2.5Gbps (%d)\n",speed); + printf("\t\tlink_speed=2.5 Gbps (%d)\n",speed); break; case 2: - printf("\t\tlink_speed=5Gbps (%d)\n",speed); + printf("\t\tlink_speed=5.0 Gbps (%d)\n",speed); break; - case 4: - printf("\t\tlink_speed=10Gbps (%d)\n",speed); + printf("\t\tlink_speed=10.0 Gbps (%d)\n",speed); break; default: printf("\t\tlink_speed=UNKNOWN (%d)\n",speed); @@ -141,16 +168,16 @@ void printPortRate(int speed, int width, int portState){ switch (width){ case 1: - printf("\t\tlink_width=1x (%d) \n\t\trate=%d\n",width,1*speed); + printf("\t\tlink_width=1x (%f) \n\t\trate=%d Gbps\n",width,2.5*speed); break; case 2: - printf("\t\tlink_width=4x (%d) \n\t\trate=%d\n",width,10*speed); + printf("\t\tlink_width=4x (%d) \n\t\trate=%d Gbps\n",width,10*speed); break; case 4: - printf("\t\tlink_width=8x (%d) \n\t\trate=%d\n",width,20*speed); + printf("\t\tlink_width=8x (%d) \n\t\trate=%d Gbps\n",width,20*speed); break; case 8: - printf("\t\tlink_width=12x (%d) \n\t\trate=%d\n",width,30*speed); + printf("\t\tlink_width=12x (%d) \n\t\trate=%d Gbps\n",width,30*speed); break; default: printf("\t\tlink_width=UNKNOWN (%d)\n",width); @@ -210,10 +237,29 @@ void printPortCaps(ib_port_cap_t *ibal_port_cap_p) PRINT_CAP(pkey_nvram, PKEY_NVRAM); printf("\n"); } + +void printPortActiveSpeed(uint8_t speed){ + switch(speed){ + case 1: + printf("\t\tactive_speed=2.5 Gbps (%d)\n",speed); + break; + case 2: + printf("\t\tactive_speed=5.0 Gbps (%d)\n",speed); + break; + case 4: + printf("\t\tactive_speed=10.0 Gbps (%d)\n",speed); + break; + default: + printf("\t\tactive_speed=UNKNOWN (%d)\n",speed); + } +} + void printPortInfo(ib_port_attr_t* portPtr, ib_port_info_t portInfo, BOOLEAN fullPrint){ printf("\t\tport=%d\n", portPtr->port_num); printPortLinkState(portPtr->link_state); printPortRate(portInfo.link_speed>>4,portInfo.link_width_active, portPtr->link_state); + printPortPhysState(portPtr->phys_state); + printPortActiveSpeed(portPtr->active_speed); printf("\t\tsm_lid=0x%04x\n", cl_ntoh16(portPtr->sm_lid)); printf("\t\tport_lid=0x%04x\n", cl_ntoh16(portPtr->lid)); printf("\t\tport_lmc=0x%x\n", portPtr->lmc); @@ -234,7 +280,6 @@ void printPortInfo(ib_port_attr_t* portPtr, ib_port_info_t portInfo, BOOLEAN ful printf("\n"); } - void print_uplink_info(ib_ca_attr_t* ca_attr) { uplink_info_t*p_uplink_info = mthca_get_uplink_info(ca_attr); @@ -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); printf("\tmax_num_fmr = 0x%x (Maximum number FMRs)\n", ca_attr->max_fmr); 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); + printf("\tmodify_wr_depth = %d (Capabilities: change QP depth during a modify QP)\n", !!ca_attr->modify_wr_depth); + printf("\tmodify_srq_depth = %d (Capabilities: change SRQ depth - Not supported by driver!)\n", !!ca_attr->modify_srq_depth); + printf("\tchange_primary_port = %d (Capabilities: change primary port for a QP during a SQD->RTS transition)\n", !!ca_attr->change_primary_port); + printf("\tav_port_check = %d (Capabilities: check port number in address handles)\n", !!ca_attr->av_port_check); + printf("\tinit_type_support = %d (Capabilities: set init_type)\n", !!ca_attr->init_type_support); + printf("\tshutdown_port = %d (Capabilities: shutdown port support)\n", !!ca_attr->shutdown_port_capability); }else{ printf("\tnum_phys_ports=%d\n", ca_attr->num_ports); } -- 2.17.1