[MTHCA,TOOLS] - mthca report PSID in ca_attr .
authorsleybo <sleybo@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 1 May 2006 15:31:11 +0000 (15:31 +0000)
committersleybo <sleybo@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 1 May 2006 15:31:11 +0000 (15:31 +0000)
- vstat report PSID field

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

hw/mthca/kernel/hca_verbs.c
hw/mthca/kernel/ib_verbs.h
hw/mthca/kernel/mthca_provider.c
inc/mthca/mthca_vc.h
tools/vstat/user/vstat_main.c

index e47a49d..366232f 100644 (file)
@@ -170,8 +170,8 @@ mlnx_query_ca (
        num_pkeys = 0;\r
        required_size = PTR_ALIGN(sizeof(ib_ca_attr_t)) +\r
                PTR_ALIGN(sizeof(uint32_t) * num_page_sizes) +\r
-               PTR_ALIGN(sizeof(ib_port_attr_t) * num_ports);\r
-\r
+               PTR_ALIGN(sizeof(ib_port_attr_t) * num_ports)+\r
+               PTR_ALIGN(MTHCA_BOARD_ID_LEN);\r
        // get port properties\r
        for (port_num = 0; port_num <= end_port(ib_dev) - start_port(ib_dev); ++port_num) {\r
                // request\r
@@ -223,7 +223,11 @@ mlnx_query_ca (
                size = PTR_ALIGN(sizeof(uint16_t) * hca_ports[port_num].pkey_tbl_len);\r
                last_p += size;\r
        }\r
-\r
+       \r
+       //copy vendor specific data\r
+       cl_memcpy(last_p, props.board_id, MTHCA_BOARD_ID_LEN);\r
+       last_p += PTR_ALIGN(MTHCA_BOARD_ID_LEN);\r
+       \r
        // Separate the loops to ensure that table pointers are always setup\r
        for (port_num = 0; port_num < num_ports; port_num++) {\r
 \r
index ef4df02..0ba30cc 100644 (file)
@@ -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;
index 2d20462..01c9fe4 100644 (file)
@@ -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;
index 9a75758..91d95e3 100644 (file)
@@ -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
index f6f780e..1d0eaf8 100644 (file)
@@ -42,6 +42,7 @@
 #ifndef WIN32\r
 #include <complib/cl_device.h>\r
 #endif\r
+#include <mthca/mthca_vc.h>\r
 \r
 \r
 #define VEND_ID_MELLNOX        0x02c9\r
@@ -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\r
        switch(portState){\r
                case 1:\r
-                       printf("\t\tport_state=PORT_DOWN\n");\r
+                       printf("\t\tport_state=PORT_DOWN (%d)\n",portState);\r
                        break;\r
                case 2:\r
-                       printf("\t\tport_state=PORT_INITIALIZE\n");\r
+                       printf("\t\tport_state=PORT_INITIALIZE (%d)\n",portState);\r
                        break;\r
                case 4:\r
-                       printf("\t\tport_state=PORT_ACTIVE\n");\r
+                       printf("\t\tport_state=PORT_ACTIVE (%d)\n",portState);\r
                        break;\r
                default:\r
-                       printf("\t\tport_state=UNKNOWN\n"); \r
+                       printf("\t\tport_state=UNKNOWN (%d)\n",portState); \r
        }\r
 }\r
 \r
@@ -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\r
        switch(mtu){\r
                case 1:\r
-                       printf("\t\tmax_mtu=256\n");\r
+                       printf("\t\tmax_mtu=256 (%d)\n",mtu);\r
                        break;\r
                case 2:\r
-                       printf("\t\tmax_mtu=512\n");\r
+                       printf("\t\tmax_mtu=512 (%d)\n",mtu);\r
                        break;\r
                case 3:\r
-                       printf("\t\tmax_mtu=1024\n");\r
+                       printf("\t\tmax_mtu=1024 (%d)\n",mtu);\r
                        break;\r
                case 4:\r
-                       printf("\t\tmax_mtu=2048\n");\r
+                       printf("\t\tmax_mtu=2048 (%d)\n",mtu);\r
                        break;\r
                case 5:\r
-                       printf("\t\tmax_mtu=4096\n");\r
+                       printf("\t\tmax_mtu=4096 (%d)\n",mtu);\r
                        break;\r
                default:\r
-                       printf("\t\tmax_mtu=UNKNOWN\n"); \r
+                       printf("\t\tmax_mtu=UNKNOWN (%d)\n",mtu); \r
        }\r
 }\r
 \r
@@ -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),\r
                (uint16_t)(ca_attr->fw_ver>>16),\r
                (uint16_t )(ca_attr->fw_ver));\r
+               printf("\tPSID=%s\n",mthca_get_board_id(ca_attr));\r
        }else{\r
                printf("\tfw_ver=0x%I64x\n",ca_attr->fw_ver);\r
        }\r
-       printf("\tPSID=NA\n");\r
+\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