From: sleybo Date: Mon, 1 May 2006 15:31:11 +0000 (+0000) Subject: [MTHCA,TOOLS] - mthca report PSID in ca_attr . X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=c303062747be6473a0934af8380cc4e6e97c7d11;p=~shefty%2Frdma-win.git [MTHCA,TOOLS] - mthca report PSID in ca_attr . - vstat report PSID field git-svn-id: svn://openib.tc.cornell.edu/gen1@332 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- diff --git a/trunk/hw/mthca/kernel/hca_verbs.c b/trunk/hw/mthca/kernel/hca_verbs.c index e47a49d9..366232f2 100644 --- a/trunk/hw/mthca/kernel/hca_verbs.c +++ b/trunk/hw/mthca/kernel/hca_verbs.c @@ -170,8 +170,8 @@ mlnx_query_ca ( num_pkeys = 0; required_size = PTR_ALIGN(sizeof(ib_ca_attr_t)) + PTR_ALIGN(sizeof(uint32_t) * num_page_sizes) + - PTR_ALIGN(sizeof(ib_port_attr_t) * num_ports); - + PTR_ALIGN(sizeof(ib_port_attr_t) * num_ports)+ + PTR_ALIGN(MTHCA_BOARD_ID_LEN); // get port properties for (port_num = 0; port_num <= end_port(ib_dev) - start_port(ib_dev); ++port_num) { // request @@ -223,7 +223,11 @@ mlnx_query_ca ( size = PTR_ALIGN(sizeof(uint16_t) * hca_ports[port_num].pkey_tbl_len); last_p += size; } - + + //copy vendor specific data + cl_memcpy(last_p, props.board_id, MTHCA_BOARD_ID_LEN); + last_p += PTR_ALIGN(MTHCA_BOARD_ID_LEN); + // Separate the loops to ensure that table pointers are always setup for (port_num = 0; port_num < num_ports; port_num++) { diff --git a/trunk/hw/mthca/kernel/ib_verbs.h b/trunk/hw/mthca/kernel/ib_verbs.h index ef4df023..0ba30ccf 100644 --- a/trunk/hw/mthca/kernel/ib_verbs.h +++ b/trunk/hw/mthca/kernel/ib_verbs.h @@ -84,6 +84,7 @@ struct ib_device_attr { u64 page_size_cap; u32 vendor_id; u32 vendor_part_id; + u8 board_id[16]; u32 hw_ver; int max_qp; int max_qp_wr; diff --git a/trunk/hw/mthca/kernel/mthca_provider.c b/trunk/hw/mthca/kernel/mthca_provider.c index 2d204626..01c9fe40 100644 --- a/trunk/hw/mthca/kernel/mthca_provider.c +++ b/trunk/hw/mthca/kernel/mthca_provider.c @@ -97,7 +97,7 @@ props->vendor_part_id = cl_ntoh16(*(__be16 *) (out_mad->data + 30)); props->hw_ver = cl_ntoh32(*(__be32 *) (out_mad->data + 32)); memcpy(&props->sys_image_guid, out_mad->data + 4, 8); - + memcpy(&props->board_id, mdev->board_id, MTHCA_BOARD_ID_LEN); props->max_mr_size = ~0ull; props->page_size_cap = mdev->limits.page_size_cap; props->max_qp = mdev->limits.num_qps - mdev->limits.reserved_qps; diff --git a/trunk/inc/mthca/mthca_vc.h b/trunk/inc/mthca/mthca_vc.h index 9a757582..91d95e32 100644 --- a/trunk/inc/mthca/mthca_vc.h +++ b/trunk/inc/mthca/mthca_vc.h @@ -27,7 +27,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * - * $Id: hca_verbs.c 148 2005-07-12 07:48:46Z sleybo $ + * $Id: mthca_vc.c 148 2005-07-12 07:48:46Z sleybo $ */ #ifndef MTHCA_VC_H @@ -49,4 +49,14 @@ struct _map_crspace { #define FW_OPEN_IF 0xe7 #define FW_CLOSE_IF 0x7e + +/* Defines for get data for vendor specific */ +#define MTHCA_BOARD_ID_LEN 64 + +inline char* mthca_get_board_id(ib_ca_attr_t *ca_attr) +{ + return (char*)(ca_attr)+(ca_attr->size - MTHCA_BOARD_ID_LEN); +} + + #endif diff --git a/trunk/tools/vstat/user/vstat_main.c b/trunk/tools/vstat/user/vstat_main.c index f6f780ef..1d0eaf8c 100644 --- a/trunk/tools/vstat/user/vstat_main.c +++ b/trunk/tools/vstat/user/vstat_main.c @@ -42,6 +42,7 @@ #ifndef WIN32 #include #endif +#include #define VEND_ID_MELLNOX 0x02c9 @@ -93,16 +94,16 @@ void printPortGID(ib_net64_t subnetPrefix, ib_net64_t portGuid){ void printPortLinkState(int portState){ //TODO: check that these are all the options and that they are correct switch(portState){ case 1: - printf("\t\tport_state=PORT_DOWN\n"); + printf("\t\tport_state=PORT_DOWN (%d)\n",portState); break; case 2: - printf("\t\tport_state=PORT_INITIALIZE\n"); + printf("\t\tport_state=PORT_INITIALIZE (%d)\n",portState); break; case 4: - printf("\t\tport_state=PORT_ACTIVE\n"); + printf("\t\tport_state=PORT_ACTIVE (%d)\n",portState); break; default: - printf("\t\tport_state=UNKNOWN\n"); + printf("\t\tport_state=UNKNOWN (%d)\n",portState); } } @@ -111,22 +112,22 @@ void printPortLinkState(int portState){ //TODO: check that these are all the opt void printPortMTU(int mtu){ //TODO: check that these are all the options and that they are correct switch(mtu){ case 1: - printf("\t\tmax_mtu=256\n"); + printf("\t\tmax_mtu=256 (%d)\n",mtu); break; case 2: - printf("\t\tmax_mtu=512\n"); + printf("\t\tmax_mtu=512 (%d)\n",mtu); break; case 3: - printf("\t\tmax_mtu=1024\n"); + printf("\t\tmax_mtu=1024 (%d)\n",mtu); break; case 4: - printf("\t\tmax_mtu=2048\n"); + printf("\t\tmax_mtu=2048 (%d)\n",mtu); break; case 5: - printf("\t\tmax_mtu=4096\n"); + printf("\t\tmax_mtu=4096 (%d)\n",mtu); break; default: - printf("\t\tmax_mtu=UNKNOWN\n"); + printf("\t\tmax_mtu=UNKNOWN (%d)\n",mtu); } } @@ -169,10 +170,11 @@ void vstat_print_ca_attr(int idx, ib_ca_attr_t* ca_attr, BOOLEAN fullPrint){ (uint16_t )(ca_attr->fw_ver>>32), (uint16_t)(ca_attr->fw_ver>>16), (uint16_t )(ca_attr->fw_ver)); + printf("\tPSID=%s\n",mthca_get_board_id(ca_attr)); }else{ printf("\tfw_ver=0x%I64x\n",ca_attr->fw_ver); } - printf("\tPSID=NA\n"); + if(fullPrint){ printf("\tnum_phys_ports = %d\n",ca_attr->num_ports); printf("\tmax_num_qp = 0x%x (Maximum Number of QPs supported)\n", ca_attr->max_qps);