[ofa-general] [PATCH] opensm/PerfMgr: A few more esp0 changes

Hal Rosenstock hnrose at comcast.net
Fri Mar 6 07:25:54 PST 2009


Also, some cosmetic changes

Signed-off-by: Hal Rosenstock <hal.rosenstock at gmail.com>

---
diff --git a/opensm/opensm/osm_perfmgr.c b/opensm/opensm/osm_perfmgr.c
index c5c4572..4a6f65c 100644
--- a/opensm/opensm/osm_perfmgr.c
+++ b/opensm/opensm/osm_perfmgr.c
@@ -469,14 +469,13 @@ static void
 __osm_perfmgr_query_counters(cl_map_item_t * const p_map_item, void *context)
 {
 	ib_api_status_t status = IB_SUCCESS;
-	uint8_t port = 0, startport = 1;
 	osm_perfmgr_t *pm = (osm_perfmgr_t *) context;
 	osm_node_t *node = NULL;
 	__monitored_node_t *mon_node = (__monitored_node_t *) p_map_item;
 	osm_madw_context_t mad_context;
-	uint8_t num_ports = 0;
 	uint64_t node_guid = 0;
 	ib_net32_t remote_qp;
+	uint8_t port, num_ports = 0;
 
 	OSM_LOG_ENTER(pm->log);
 
@@ -505,12 +504,8 @@ __osm_perfmgr_query_counters(cl_map_item_t * const p_map_item, void *context)
 		goto Exit;
 	}
 
-	/* check for switch enhanced port 0 */
-	if (mon_node->esp0)
-		startport = 0;
-
 	/* issue the query for each port */
-	for (port = startport; port < num_ports; port++) {
+	for (port = (mon_node->esp0) ? 0 : 1; port < num_ports; port++) {
 		ib_net16_t lid;
 
 		if (!osm_node_get_physp_ptr(node, port))
diff --git a/opensm/opensm/osm_perfmgr_db.c b/opensm/opensm/osm_perfmgr_db.c
index 78580a6..b0b2e4a 100644
--- a/opensm/opensm/osm_perfmgr_db.c
+++ b/opensm/opensm/osm_perfmgr_db.c
@@ -367,7 +367,7 @@ debug_dump_dc_reading(perfmgr_db_t * db, uint64_t guid, uint8_t port_num,
 {
 	osm_log_t *log = db->perfmgr->log;
 	if (!osm_log_is_active(log, OSM_LOG_DEBUG))
-		return;		/* optimize this a big */
+		return;
 
 	osm_log(log, OSM_LOG_DEBUG,
 		"xd %" PRIu64 " <-- %" PRIu64 " (%" PRIu64 ")\n",
@@ -565,8 +565,9 @@ static void __dump_node_mr(_db_node_t * node, FILE * fp)
 		"rcv_pkts",
 		"unicast_xmit_pkts",
 		"unicast_rcv_pkts",
-		"multicast_xmit_pkts", "multicast_rcv_pkts");
-	for (i = 1; i < node->num_ports; i++) {
+		"multicast_xmit_pkts",
+		"multicast_rcv_pkts");
+	for (i = (node->esp0) ? 0 : 1; i < node->num_ports; i++) {
 		char *since = ctime(&node->ports[i].last_reset);
 		since[strlen(since) - 1] = '\0';	/* remove \n */
 
@@ -609,7 +610,7 @@ static void __dump_node_hr(_db_node_t * node, FILE * fp)
 	int i = 0;
 
 	fprintf(fp, "\n");
-	for (i = 1; i < node->num_ports; i++) {
+	for (i = (node->esp0) ? 0 : 1; i < node->num_ports; i++) {
 		char *since = ctime(&node->ports[i].last_reset);
 		since[strlen(since) - 1] = '\0';	/* remove \n */
 
@@ -719,7 +720,7 @@ done:
 void
 perfmgr_db_print_by_guid(perfmgr_db_t * db, uint64_t nodeguid, FILE *fp)
 {
-	cl_map_item_t *node = NULL;
+	cl_map_item_t *node;
 
 	cl_plock_acquire(&db->lock);
 
@@ -727,7 +728,7 @@ perfmgr_db_print_by_guid(perfmgr_db_t * db, uint64_t nodeguid, FILE *fp)
 	if (node != cl_qmap_end(&db->pc_data))
 		__dump_node_hr((_db_node_t *)node, fp);
 	else
-		fprintf(fp, "Node %"PRIx64" not found...\n", nodeguid);
+		fprintf(fp, "Node 0x%" PRIx64 " not found...\n", nodeguid);
 
 	cl_plock_release(&db->lock);
 }



More information about the general mailing list