This patch fixes the wrong rate calculation within ibstat tool.
Signed-off by: Irena Kruchkovsky (irena@mellanox.co.il)
CR: XaleX

Index: D:/Windows/MLNX_VPI/tools/infiniband-diags/src/ibstat.c
===================================================================
--- D:/Windows/MLNX_VPI/tools/infiniband-diags/src/ibstat.c	(revision 5005)
+++ D:/Windows/MLNX_VPI/tools/infiniband-diags/src/ibstat.c	(revision 6168)
@@ -117,7 +117,7 @@
 	printf("%sPhysical state: %s\n", pre,
 	       (unsigned)port->state <=
 	       7 ? port_phy_state_str[port->phys_state] : "???");
-	printf("%sRate: %d\n", pre, port->rate);
+	printf("%sRate: %d Gbps\n", pre, port->rate);
 	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 5765)
+++ 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) {
