This patch fixes the wrong rate calculation within ibstat tool.
Signed-off by: Irena Kruchkovsky ([email protected])
CR: Alexander Naslednikov (xalex at mellanox.co.il)

Index: D:/Windows/MLNX_VPI/tools/infiniband-diags/src/ibstat.c
===================================================================
--- D:/Windows/MLNX_VPI/tools/infiniband-diags/src/ibstat.c  (revision 6077)
+++ D:/Windows/MLNX_VPI/tools/infiniband-diags/src/ibstat.c               
(revision 6092)
@@ -117,7 +117,15 @@
                printf("%sPhysical state: %s\n", pre,
                       (unsigned)port->state <=
                       7 ? port_phy_state_str[port->phys_state] : "???");
-              printf("%sRate: %d\n", pre, port->rate);
+             if (port->rate != 0)
+             {
+                             printf("%sRate: %d Gbps\n", pre, port->rate);
+             }
+             else
+             {
+                             printf("%sRate: N\\A\n", pre);
+             }
+
                printf("%sBase lid: %d\n", pre, port->base_lid);
                printf("%sLMC: %d\n", pre, port->lmc);
                printf("%sSM lid: %d\n", pre, port->sm_lid);
Index: D:/Windows/MLNX_VPI/ulp/libibumad/src/umad.cpp
===================================================================
--- D:/Windows/MLNX_VPI/ulp/libibumad/src/umad.cpp            (revision 6077)
+++ D:/Windows/MLNX_VPI/ulp/libibumad/src/umad.cpp         (revision 6092)
@@ -141,9 +141,25 @@
                port->sm_sl = attr.sm_sl;
                port->state = attr.state;
                port->phys_state = attr.phys_state;
-              port->rate = attr.active_speed;
                port->capmask = attr.port_cap_flags;

+             switch (attr.active_width){
+                             case 1:
+                                             port->rate = (unsigned) 
(2.5*attr.active_speed);
+                                             break;
+                             case 2:
+                                             port->rate = 
10*attr.active_speed; //2.5*4
+                                             break;
+                             case 4:
+                                             port->rate = 
20*attr.active_speed; //2.5*8
+                                             break;
+                             case 8:
+                                             port->rate = 
30*attr.active_speed; //2.5*12
+                                             break;
+                             default:
+                                             port->rate = 0;
+             }
+
                // Assume GID 0 contains port GUID and gid prefix
                ret = ibv_query_gid(context, (uint8_t) port->portnum, 0, &gid);
                if (ret != 0) {

Attachment: ibstat.patch
Description: ibstat.patch

_______________________________________________
ofw mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw

Reply via email to