[ofw] [Patch] [UMAD][Tools]

Irena Kruchkovsky irena at mellanox.co.il
Tue Jul 13 07:53:07 PDT 2010


This patch fixes the wrong rate calculation within ibstat tool.
Signed-off by: Irena Kruchkovsky (irena at mellanox.co.il)
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) {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20100713/ceb66d51/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ibstat.patch
Type: application/octet-stream
Size: 1854 bytes
Desc: ibstat.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20100713/ceb66d51/attachment.obj>


More information about the ofw mailing list