[openib-general] [PATCH] ibnetdiscover: Indicate SP0 type

Hal Rosenstock halr at voltaire.com
Fri Jun 9 08:01:44 PDT 2006


ibnetdiscover: Indicate SP0 type

Signed-off-by: Hal Rosenstock <halr at voltaire.com>

Index: diags/src/ibnetdiscover.c
===================================================================
--- diags/src/ibnetdiscover.c	(revision 7842)
+++ diags/src/ibnetdiscover.c	(working copy)
@@ -126,7 +126,9 @@ int
 get_node(Node *node, Port *port, ib_portid_t *portid)
 {
 	char portinfo[64];
+	char switchinfo[32];
 	void *pi = portinfo, *ni = node->nodeinfo, *nd = node->nodedesc;
+	void *si = switchinfo;
 
 	if (!smp_query(ni, portid, IB_ATTR_NODE_INFO, 0, timeout))
 		return -1;
@@ -160,6 +162,12 @@ get_node(Node *node, Port *port, ib_port
 	node->smalid = port->lid;
 	node->smalmc = port->lmc;
 
+        if (!smp_query(si, portid, IB_ATTR_SWITCH_INFO, 0, timeout))
+                node->smaenhsp0 = 0;	/* assume base SP0 */
+	else {
+        	mad_decode_field(si, IB_SW_ENHANCED_PORT0_F, &node->smaenhsp0);
+	}
+
 	DEBUG("portid %s: got switch node %Lx '%s'",
 	      portid2str(portid), node->nodeguid, nd);
 	return 1;
@@ -531,9 +539,11 @@ out_switch(Node *node, int group)
 		}
 	}
 
-	fprintf(f, "\nSwitch\t%d %s\t\t# %s port 0 lid %d lmc %d\n",
+	fprintf(f, "\nSwitch\t%d %s\t\t# %s %s port 0 lid %d lmc %d\n",
 		node->numports, node_name(node),
-		clean_nodedesc(node->nodedesc), node->smalid, node->smalmc);
+		clean_nodedesc(node->nodedesc),
+		node->smaenhsp0 ? "enhanced" : "base",
+		node->smalid, node->smalmc);
 }
 
 void
Index: diags/include/ibnetdiscover.h
===================================================================
--- diags/include/ibnetdiscover.h	(revision 7842)
+++ diags/include/ibnetdiscover.h	(working copy)
@@ -83,6 +83,7 @@ struct Node {
 	int localport;
 	int smalid;
 	int smalmc;
+	int smaenhsp0;
 	uint32_t devid;
 	uint32_t vendid;
 	uint64_t sysimgguid;







More information about the general mailing list