[openib-general] [PATCH 3/5] opensm: lid matrix dump

Sasha Khapyorsky sashak at voltaire.com
Thu Oct 19 13:35:23 PDT 2006


This adds dumping switches lid matrices to the file
'opensm-lid-matrix.dump'. Like other routing related dumps this code
will be activated when OSM_LOG_ROUTING logging flag is set.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 osm/opensm/osm_ucast_mgr.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/osm/opensm/osm_ucast_mgr.c b/osm/opensm/osm_ucast_mgr.c
index b4880ad..8f4bfba 100644
--- a/osm/opensm/osm_ucast_mgr.c
+++ b/osm/opensm/osm_ucast_mgr.c
@@ -350,8 +350,40 @@ __osm_ucast_mgr_dump_ucast_routes(
 
 /**********************************************************************
  **********************************************************************/
+static void
+ucast_mgr_dump_lid_matrix(cl_map_item_t *p_map_item, void *cxt)
+{
+	osm_switch_t* p_sw = (osm_switch_t *)p_map_item;
+	osm_ucast_mgr_t* p_mgr = ((struct ucast_mgr_dump_context *)cxt)->p_mgr;
+	FILE *file = ((struct ucast_mgr_dump_context *)cxt)->file;
+	osm_node_t *p_node = osm_switch_get_node_ptr(p_sw);
+	unsigned max_lid = osm_switch_get_max_lid_ho(p_sw);
+	unsigned max_port = osm_switch_get_num_ports(p_sw);
+	uint16_t lid;
+	uint8_t port;
+
+	fprintf(file, "Switch: guid 0x%016" PRIx64 "\n",
+		cl_ntoh64(osm_node_get_node_guid(p_node)));
+	for (lid = 1; lid <= max_lid; lid++) {
+		osm_port_t *p_port;
+		fprintf(file, "0x%04x:", lid);
+		for (port = 0 ; port < max_port ; port++)
+			fprintf(file, " %02x",
+				osm_switch_get_hop_count(p_sw, lid, port));
+		p_port = cl_ptr_vector_get(&p_mgr->p_subn->port_lid_tbl, lid);
+		if (p_port)
+			fprintf(file, " # portguid 0x%" PRIx64,
+				cl_ntoh64(osm_port_get_guid(p_port)));
+		fprintf(file, "\n");
+	}
+}
+
+/**********************************************************************
+ **********************************************************************/
 static void __osm_ucast_mgr_dump_tables(osm_ucast_mgr_t *p_mgr)
 {
+  ucast_mgr_dump_to_file(p_mgr, "opensm-lid-matrix.dump",
+                         ucast_mgr_dump_lid_matrix);
   if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
     ucast_mgr_dump(p_mgr, NULL, __osm_ucast_mgr_dump_path_distribution);;
   ucast_mgr_dump_to_file(p_mgr, "osm.fdbs", __osm_ucast_mgr_dump_ucast_routes);
-- 
1.4.3.g7768





More information about the general mailing list