Skip to contentSkip to conversation

ib/ipoib: Modified rate computation

PATCH In review Marcel Apfelbaum 1 participant 2 messages Oct 3, 2011 – Oct 4, 2011 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 2/5 ib/ipoib: Modified rate computation

Modified the way that speed rate is computed because of the new IBA extended speeds that are no longer multiple of 2.5 Gbps.

---
 drivers/infiniband/ulp/ipoib/ipoib_fs.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib_fs.c +4 -3
@@ -198,6 +198,7 @@ static int ipoib_path_seq_show(struct se
 	char gid_buf[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"];
 	struct ipoib_path path;
 	int rate;
+	int rate_rounded;
 
 	if (!iter)
 		return 0;
@@ -212,7 +213,7 @@ static int ipoib_path_seq_show(struct se
 		   gid_buf, path.pathrec.dlid ? "yes" : "no");
 
 	if (path.pathrec.dlid) {
-		rate = ib_rate_to_mult(path.pathrec.rate) * 25;
+		rate = ib_rate_to_int(path.pathrec.rate, &rate_rounded);
 
 		seq_printf(file,
 			   "  DLID:     0x%04x\n"
@@ -220,8 +221,8 @@ static int ipoib_path_seq_show(struct se
 			   "  rate: %*d%s Gb/sec\n",
 			   be16_to_cpu(path.pathrec.dlid),
 			   path.pathrec.sl,
-			   10 - ((rate % 10) ? 2 : 0),
-			   rate / 10, rate % 10 ? ".5" : "");
+			   10 - (rate_rounded ? 2 : 0),
+			   rate, rate_rounded ? ".5" : "");
 	}
 
 	seq_putc(file, '\n');

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 201110031755.19978.marcela-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org

#2 lore raw

Changes from v1
- Use ib_rate_to_mbps instead of ib_rate_to_int
- Modified the call to seq_printf

Modified the way that speed rate is computed because of the new IBA extended speeds that are no longer multiple of 2.5 Gbps.

---
 drivers/infiniband/ulp/ipoib/ipoib_fs.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib_fs.c +3 -4
@@ -212,16 +212,15 @@ static int ipoib_path_seq_show(struct se
 		   gid_buf, path.pathrec.dlid ? "yes" : "no");
 
 	if (path.pathrec.dlid) {
-		rate = ib_rate_to_mult(path.pathrec.rate) * 25;
+		rate = ib_rate_to_mbps(path.pathrec.rate);
 
 		seq_printf(file,
 			   "  DLID:     0x%04x\n"
 			   "  SL: %12d\n"
-			   "  rate: %*d%s Gb/sec\n",
+			   "  rate: %8d.%d Gb/sec\n",
 			   be16_to_cpu(path.pathrec.dlid),
 			   path.pathrec.sl,
-			   10 - ((rate % 10) ? 2 : 0),
-			   rate / 10, rate % 10 ? ".5" : "");
+			   rate / 1000, rate % 1000);
 	}
 
 	seq_putc(file, '\n');

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html