[openib-general] [PATCH] osm: added an option for providing dump function per routing engine

Yevgeny Kliteynik kliteyn at dev.mellanox.co.il
Tue Dec 19 11:37:29 PST 2006


Hi Hal

As you suggested, added an option for providing dump 
function per routing engine.

Signed-off-by: Yevgeny Kliteynik <kliteyn at dev.mellanox.co.il>
---
 osm/include/opensm/osm_opensm.h |    4 ++++
 osm/opensm/osm_ucast_mgr.c      |   23 ++++++++++++++---------
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/osm/include/opensm/osm_opensm.h b/osm/include/opensm/osm_opensm.h
index 653c8ec..16fef37 100644
--- a/osm/include/opensm/osm_opensm.h
+++ b/osm/include/opensm/osm_opensm.h
@@ -104,6 +104,7 @@ struct osm_routing_engine {
 	void *context;
 	int (*build_lid_matrices)(void *context);
 	int (*ucast_build_fwd_tables)(void *context);
+	void (*ucast_dump_tables)(void *context);
 	void (*delete)(void *context);
 };
 /*
@@ -121,6 +122,9 @@ struct osm_routing_engine {
 *	ucast_build_fwd_tables
 *		The callback for unicast forwarding table generation.
 *
+*	ucast_dump_tables
+*		The callback for dumping unicast routing tables.
+*
 *	delete
 *		The delete method, may be used for routing engine
 *		internals cleanup.
diff --git a/osm/opensm/osm_ucast_mgr.c b/osm/opensm/osm_ucast_mgr.c
index e051c66..fcf6f72 100644
--- a/osm/opensm/osm_ucast_mgr.c
+++ b/osm/opensm/osm_ucast_mgr.c
@@ -149,7 +149,7 @@ ucast_mgr_dump(osm_ucast_mgr_t *p_mgr, F
 	cl_qmap_apply_func(&p_mgr->p_subn->sw_guid_tbl, func, &dump_context);
 }
 
-static void
+void
 ucast_mgr_dump_to_file(osm_ucast_mgr_t *p_mgr, const char *file_name,
 		       void (*func)(cl_map_item_t *, void *))
 {
@@ -350,7 +350,7 @@ ucast_mgr_dump_lid_matrix(cl_map_item_t
 
 /**********************************************************************
  **********************************************************************/
-static void
+void
 ucast_mgr_dump_lfts(cl_map_item_t *p_map_item, void *cxt)
 {
 	osm_switch_t* p_sw = (osm_switch_t *)p_map_item;
@@ -1226,6 +1226,7 @@ osm_ucast_mgr_process(
   struct osm_routing_engine *p_routing_eng;
   osm_signal_t signal = OSM_SIGNAL_DONE;
   cl_qmap_t *p_sw_guid_tbl;
+  boolean_t default_routing = TRUE;
 
   OSM_LOG_ENTER( p_mgr->p_log, osm_ucast_mgr_process );
 
@@ -1256,16 +1257,20 @@ osm_ucast_mgr_process(
     build and download the switch forwarding tables.
   */
 
-  if (!p_routing_eng->ucast_build_fwd_tables ||
-      p_routing_eng->ucast_build_fwd_tables(p_routing_eng->context) != 0)
-  {
-    cl_qmap_apply_func( p_sw_guid_tbl,
-                        __osm_ucast_mgr_process_tbl, p_mgr );
-  }
+  if ( p_routing_eng->ucast_build_fwd_tables && 
+       (p_routing_eng->ucast_build_fwd_tables(p_routing_eng->context) == 0) )
+     default_routing = FALSE;
+  else
+     cl_qmap_apply_func( p_sw_guid_tbl, __osm_ucast_mgr_process_tbl, p_mgr );
 
   /* dump fdb into file: */
   if ( osm_log_is_active( p_mgr->p_log, OSM_LOG_ROUTING ) )
-    __osm_ucast_mgr_dump_tables( p_mgr );
+  {
+     if ( !default_routing && p_routing_eng->ucast_dump_tables )
+        p_routing_eng->ucast_dump_tables(p_routing_eng->context);
+     else
+        __osm_ucast_mgr_dump_tables( p_mgr );
+  }
 
   if (p_mgr->any_change)
   {
-- 
1.4.4.1.GIT

 




More information about the general mailing list