Skip to contentSkip to conversation

infiniband-diags: Add FDR10 support to ibnetdiscover and libibnetdisc

PATCH Applied Hal Rosenstock 1 participant 1 message Aug 31, 2011 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH v2 5/6 infiniband-diags: Add FDR10 support to ibnetdiscover and libibnetdisc

---
Changes since v1:
Rebased to latest master

 libibnetdisc/include/infiniband/ibnetdisc.h |    2 +-
 libibnetdisc/src/ibnetdisc.c                |  148 ++++++++++++++++++++++++++-
 libibnetdisc/src/query_smp.c                |   10 ++
 src/ibnetdiscover.c                         |   21 +++-
 4 files changed, 172 insertions(+), 9 deletions(-)
libibnetdisc/include/infiniband/ibnetdisc.h +1 -1
index 0cad93f..59c5606 100644
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2008 Lawrence Livermore National Lab.  All rights reserved.
- * Copyright (c) 2010 Mellanox Technologies LTD.  All rights reserved.
+ * Copyright (c) 2010-2011 Mellanox Technologies LTD.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
libibnetdisc/src/ibnetdisc.c +146 -2

185 lines not on this page · raw message

libibnetdisc/src/query_smp.c +10 -0
index 5fb3e18..f4beb39 100644
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2010 Lawrence Livermore National Laboratory
+ * Copyright (c) 2011 Mellanox Technologies LTD.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -40,6 +41,9 @@
 #include <infiniband/umad.h>
 #include "internal.h"
 
+extern int mlnx_ext_port_info_err(smp_engine_t * engine, ibnd_smp_t * smp,
+				  uint8_t * mad, void *cb_data);
+
 static void queue_smp(smp_engine_t * engine, ibnd_smp_t * smp)
 {
 	smp->qnext = NULL;
@@ -190,10 +194,16 @@ static int process_one_recv(smp_engine_t * engine)
 		IBND_ERROR("umad (%s Attr 0x%x:%u) bad status %d; %s\n",
 			   portid2str(&smp->path), smp->rpc.attr.id,
 			   smp->rpc.attr.mod, status, strerror(status));
+		if (smp->rpc.attr.id == IB_ATTR_MLNX_EXT_PORT_INFO)
+			rc = mlnx_ext_port_info_err(engine, smp, mad,
+						    smp->cb_data);
 	} else if ((status = mad_get_field(mad, 0, IB_DRSMP_STATUS_F))) {
 		IBND_ERROR("mad (%s Attr 0x%x:%u) bad status 0x%x\n",
 			   portid2str(&smp->path), smp->rpc.attr.id,
 			   smp->rpc.attr.mod, status);
+		if (smp->rpc.attr.id == IB_ATTR_MLNX_EXT_PORT_INFO)
+			rc = mlnx_ext_port_info_err(engine, smp, mad,
+						    smp->cb_data);
 	} else
 		rc = smp->cb(engine, smp, mad, smp->cb_data);
 
src/ibnetdiscover.c +15 -6
index 0966217..ed41e0d 100644
@@ -100,11 +100,14 @@ char *dump_linkspeed_compat(uint32_t speed)
 	return ("???");
 }
 
-char *dump_linkspeedext_compat(uint32_t espeed, uint32_t speed)
+char *dump_linkspeedext_compat(uint32_t espeed, uint32_t speed, uint32_t fdr10)
 {
 	switch (espeed) {
 	case 0:
-		return dump_linkspeed_compat(speed);
+		if (fdr10 & FDR10)
+			return ("FDR10");
+		else
+			return dump_linkspeed_compat(speed);
 		break;
 	case 1:
 		return ("FDR");
@@ -358,6 +361,8 @@ void out_switch_port(ibnd_port_t * port, int group, char *out_prefix)
 					IB_PORT_LINK_WIDTH_ACTIVE_F);
 	uint32_t ispeed = mad_get_field(port->info, 0,
 					IB_PORT_LINK_SPEED_ACTIVE_F);
+	uint32_t fdr10 = mad_get_field(port->ext_info, 0,
+				       IB_MLNX_EXT_PORT_LINK_SPEED_ACTIVE_F);
 	uint32_t cap_mask, espeed;
 
 	DEBUG("port %p:%d remoteport %p\n", port, port->portnum,
@@ -393,7 +398,7 @@ void out_switch_port(ibnd_port_t * port, int group, char *out_prefix)
 		dump_linkwidth_compat(iwidth),
 		(ispeed != 4 && !espeed) ?
 			dump_linkspeed_compat(ispeed) :
-			dump_linkspeedext_compat(espeed, ispeed));
+			dump_linkspeedext_compat(espeed, ispeed, fdr10));
 
 	if (full_info)
 		fprintf(f, " s=%d w=%d", ispeed, iwidth);
@@ -415,6 +420,8 @@ void out_ca_port(ibnd_port_t * port, int group, char *out_prefix)
 					IB_PORT_LINK_WIDTH_ACTIVE_F);
 	uint32_t ispeed = mad_get_field(port->info, 0,
 					IB_PORT_LINK_SPEED_ACTIVE_F);
+	uint32_t fdr10 = mad_get_field(port->ext_info, 0,
+				       IB_MLNX_EXT_PORT_LINK_SPEED_ACTIVE_F);
 	uint32_t cap_mask, espeed;
 
 	fprintf(f, "%s[%d]", out_prefix ? out_prefix : "", port->portnum);
@@ -447,7 +454,7 @@ void out_ca_port(ibnd_port_t * port, int group, char *out_prefix)
 		dump_linkwidth_compat(iwidth),
 		(ispeed != 4 && !espeed) ?
 			dump_linkspeed_compat(ispeed) :
-			dump_linkspeedext_compat(espeed, ispeed));
+			dump_linkspeedext_compat(espeed, ispeed, fdr10));
 
 	if (full_info)
 		fprintf(f, " s=%d w=%d", ispeed, iwidth);
@@ -671,7 +678,7 @@ void dump_ports_report(ibnd_node_t * node, void *user_data)
 	/* for each port */
 	for (p = node->numports, port = node->ports[p]; p > 0;
 	     port = node->ports[--p]) {
-		uint32_t iwidth, ispeed, espeed, cap_mask;
+		uint32_t iwidth, ispeed, fdr10, espeed, cap_mask;
 		uint8_t *info;
 		if (port == NULL)
 			continue;
@@ -689,6 +696,8 @@ void dump_ports_report(ibnd_node_t * node, void *user_data)
 					       IB_PORT_LINK_SPEED_EXT_ACTIVE_F);
 		else
 			espeed = 0;
+		fdr10 = mad_get_field(port->ext_info, 0,
+				      IB_MLNX_EXT_PORT_LINK_SPEED_ACTIVE_F);
 		nodename = remap_node_name(node_name_map,
 					   port->node->guid,
 					   port->node->nodedesc);
@@ -700,7 +709,7 @@ void dump_ports_report(ibnd_node_t * node, void *user_data)
 			dump_linkwidth_compat(iwidth),
 			(ispeed != 4 && !espeed) ?
 				dump_linkspeed_compat(ispeed) :
-				dump_linkspeedext_compat(espeed, ispeed));
+				dump_linkspeedext_compat(espeed, ispeed, fdr10));
 		if (port->remoteport) {
 			rem_nodename = remap_node_name(node_name_map,
 					      port->remoteport->node->guid,
Signature · 6 lines
1.5.3

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