Skip to contentSkip to conversation

infiniband-diags: fix printing of extended speeds when port is down

PATCH New Ira Weiny 1 participant 1 message Dec 2, 2011 InfiniBand

lore
Share & tools
lore

Ira Weiny

author
#0 lore raw

PATCH 1/1 infiniband-diags: fix printing of extended speeds when port is down

---
 src/iblinkinfo.c    |   20 ++++++++++----------
 src/ibqueryerrors.c |   18 +++++++++---------
 2 files changed, 19 insertions(+), 19 deletions(-)
src/iblinkinfo.c +10 -10
index 00c7bc0..0a652ba 100644
@@ -153,17 +153,17 @@ void print_port(ibnd_node_t * node, ibnd_port_t * port, char *out_prefix)
 	/* C14-24.2.1 states that a down port allows for invalid data to be
 	 * returned for all PortInfo components except PortState and
 	 * PortPhysicalState */
-	if (!espeed) {
-		if (fdr10)
-			sprintf(speed, "10.0 Gbps (FDR10)");
-		else
-			mad_dump_val(IB_PORT_LINK_SPEED_ACTIVE_F, speed,
-				     64, &ispeed);
-	} else
-		mad_dump_val(IB_PORT_LINK_SPEED_EXT_ACTIVE_F, speed,
-			     64, &espeed);
-
 	if (istate != IB_LINK_DOWN) {
+		if (!espeed) {
+			if (fdr10)
+				sprintf(speed, "10.0 Gbps (FDR10)");
+			else
+				mad_dump_val(IB_PORT_LINK_SPEED_ACTIVE_F, speed,
+					     64, &ispeed);
+		} else
+			mad_dump_val(IB_PORT_LINK_SPEED_EXT_ACTIVE_F, speed,
+				     64, &espeed);
+
 		n = snprintf(link_str, 256, "(%3s %18s %6s/%8s)",
 		     mad_dump_val(IB_PORT_LINK_WIDTH_ACTIVE_F, width, 64,
 				  &iwidth),
src/ibqueryerrors.c +9 -9
index e070baf..eded6a8 100644
@@ -203,17 +203,17 @@ static void print_port_config(char *node_name, ibnd_node_t * node, int portnum)
 	/* C14-24.2.1 states that a down port allows for invalid data to be
 	 * returned for all PortInfo components except PortState and
 	 * PortPhysicalState */
-	if (!espeed) {
-		if (fdr10)
-			sprintf(speed, "10.0 Gbps (FDR10)");
-		else
-			mad_dump_val(IB_PORT_LINK_SPEED_ACTIVE_F, speed,
-				     64, &ispeed);
-	} else
-		mad_dump_val(IB_PORT_LINK_SPEED_EXT_ACTIVE_F, speed,
+	if (istate != IB_LINK_DOWN) {
+		if (!espeed) {
+			if (fdr10)
+				sprintf(speed, "10.0 Gbps (FDR10)");
+			else
+				mad_dump_val(IB_PORT_LINK_SPEED_ACTIVE_F, speed,
+					     64, &ispeed);
+		} else
+			mad_dump_val(IB_PORT_LINK_SPEED_EXT_ACTIVE_F, speed,
 			     64, &espeed);
 
-	if (istate != IB_LINK_DOWN) {
 		snprintf(link_str, 256, "(%3s %18s %6s/%8s)",
 			 mad_dump_val(IB_PORT_LINK_WIDTH_ACTIVE_F, width, 64, &iwidth),
 			 speed,
Signature · 6 lines
1.7.1

--
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