[openib-general] [PATCH 3/5] opensm: routing engine improvements

Sasha Khapyorsky sashak at voltaire.com
Sun Nov 26 14:30:02 PST 2006


This prevents lid matrix rebuilding with up/down algorithm when it is
not required (a.e. when root nodes are specified by user), consolidates
routing engine methods and simplifies default LFT creation flow.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 osm/include/opensm/osm_opensm.h    |    7 ---
 osm/include/opensm/osm_switch.h    |   11 +----
 osm/include/opensm/osm_ucast_mgr.h |   25 +++++++++
 osm/opensm/osm_switch.c            |    5 +-
 osm/opensm/osm_ucast_mgr.c         |   95 +++++++++---------------------------
 osm/opensm/osm_ucast_updn.c        |    3 +-
 6 files changed, 53 insertions(+), 93 deletions(-)

diff --git a/osm/include/opensm/osm_opensm.h b/osm/include/opensm/osm_opensm.h
index 80e4ad7..7179708 100644
--- a/osm/include/opensm/osm_opensm.h
+++ b/osm/include/opensm/osm_opensm.h
@@ -106,7 +106,6 @@ struct osm_routing_engine {
 	void *context;
 	int (*build_lid_matrices)(void *context);
 	int (*ucast_build_fwd_tables)(void *context);
-	int (*ucast_fdb_assign)(void *context);
 	void (*delete)(void *context);
 };
 /*
@@ -124,12 +123,6 @@ struct osm_routing_engine {
 *	ucast_build_fwd_tables
 *		The callback for unicast forwarding table generation.
 *
-*	ucast_fdb_assign
-*		The same as above, but pretty integrated with default
-*		routing flow. Look at osm_ucast_mgr_process() and
-*		osm_ucast_updn.c for details. In future may be merged
-*		with ucast_build_fwd_tables() callback.
-*
 *	delete
 *		The delete method, may be used for routing engine
 *		internals cleanup.
diff --git a/osm/include/opensm/osm_switch.h b/osm/include/opensm/osm_switch.h
index daba8ea..b846229 100644
--- a/osm/include/opensm/osm_switch.h
+++ b/osm/include/opensm/osm_switch.h
@@ -1078,8 +1078,7 @@ osm_switch_recommend_path(
 	IN OUT uint64_t *remote_sys_guids,
 	IN OUT uint16_t *p_num_used_sys,
 	IN OUT uint64_t *remote_node_guids,
-	IN OUT uint16_t *p_num_used_nodes,
-	IN boolean_t      ui_ucast_fdb_assign_func_defined
+	IN OUT uint16_t *p_num_used_nodes
  );
 /*
 * PARAMETERS
@@ -1111,14 +1110,6 @@ osm_switch_recommend_path(
 *		[in out] The number of remote nodes used for routing to
 *		the port.
 *
-*	ui_ucast_fdb_assign_func_defined
-*		[in] If TRUE - this means that there is a ui ucast_fdb_assign
-*		table function defined (in pfn_ui_ucast_fdb_assign in subnet
-*		opts). This means that all current entries in the fdbs will
-*		be used.
-* 		If FALSE - such function isn't defined. Do the minimum hop
-* 		checks before accepting the current fdbs.
-*
 * RETURN VALUE
 *	Returns the recommended port on which to route this LID.
 *
diff --git a/osm/include/opensm/osm_ucast_mgr.h b/osm/include/opensm/osm_ucast_mgr.h
index 6429036..d322ccc 100644
--- a/osm/include/opensm/osm_ucast_mgr.h
+++ b/osm/include/opensm/osm_ucast_mgr.h
@@ -234,6 +234,31 @@ osm_ucast_mgr_init(
 *	osm_ucast_mgr_destroy
 *********/
 
+/****f* OpenSM: Unicast Manager/osm_ucast_mgr_build_lid_matrices
+* NAME
+*	osm_ucast_mgr_build_lid_matrices
+*
+* DESCRIPTION
+*	Build switches's lid matrices.
+*
+* SYNOPSIS
+*/
+void
+osm_ucast_mgr_build_lid_matrices(
+	IN osm_ucast_mgr_t* const p_mgr );
+/*
+* PARAMETERS
+*	p_mgr
+*		[in] Pointer to an osm_ucast_mgr_t object.
+*
+* NOTES
+*	This function processes the subnet, configuring switches'
+*	min hops tables (aka lid matrices).
+*
+* SEE ALSO
+*	Unicast Manager
+*********/
+
 /****f* OpenSM: Unicast Manager/osm_ucast_mgr_process
 * NAME
 *	osm_ucast_mgr_process
diff --git a/osm/opensm/osm_switch.c b/osm/opensm/osm_switch.c
index 0a99d76..2a9a7ac 100644
--- a/osm/opensm/osm_switch.c
+++ b/osm/opensm/osm_switch.c
@@ -232,8 +232,7 @@ osm_switch_recommend_path(
   IN OUT uint64_t *remote_sys_guids,
   IN OUT uint16_t *p_num_used_sys,
   IN OUT uint64_t *remote_node_guids,
-  IN OUT uint16_t *p_num_used_nodes,
-  IN boolean_t      ui_ucast_fdb_assign_func_defined
+  IN OUT uint16_t *p_num_used_nodes
   )
 {
   /*
@@ -317,7 +316,7 @@ osm_switch_recommend_path(
            in the forwarding tables that he wants to be overridden by the
            minimum hop function. 
         */
-        if ( hops == least_hops || ui_ucast_fdb_assign_func_defined )
+        if ( hops == least_hops )
         {
           return( port_num );
         }
diff --git a/osm/opensm/osm_ucast_mgr.c b/osm/opensm/osm_ucast_mgr.c
index ee04f0e..7bac313 100644
--- a/osm/opensm/osm_ucast_mgr.c
+++ b/osm/opensm/osm_ucast_mgr.c
@@ -249,7 +249,6 @@ __osm_ucast_mgr_dump_ucast_routes(
   uint8_t                  best_port;
   uint16_t                 max_lid_ho;
   uint16_t                 lid_ho;
-  boolean_t                ui_ucast_fdb_assign_func_defined;
   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;
@@ -300,14 +299,9 @@ __osm_ucast_mgr_dump_ucast_routes(
       fprintf( file, "yes" );
     else
     {
-      if (p_mgr->p_subn->p_osm->routing_engine.ucast_fdb_assign)
-        ui_ucast_fdb_assign_func_defined = TRUE;
-      else
-        ui_ucast_fdb_assign_func_defined = FALSE;
       best_port = osm_switch_recommend_path(
         p_sw, lid_ho, TRUE,
-        NULL, NULL, NULL, NULL, /* No LMC Optimization */
-        ui_ucast_fdb_assign_func_defined );
+        NULL, NULL, NULL, NULL); /* No LMC Optimization */
       fprintf( file, "No %u hop path possible via port %u!",
                best_hops, best_port );
     }
@@ -712,9 +706,8 @@ __osm_ucast_mgr_process_port(
   uint16_t max_lid_ho;
   uint16_t lid_ho;
   uint8_t port;
-  boolean_t ignore_existing, is_ignored_by_port_prof;
+  boolean_t is_ignored_by_port_prof;
   ib_net64_t node_guid;
-  boolean_t  ui_ucast_fdb_assign_func_defined;
   /*
     The following are temporary structures that will aid
     in providing better routing in LMC > 0 situations
@@ -780,21 +773,6 @@ __osm_ucast_mgr_process_port(
 
   node_guid = osm_node_get_node_guid(osm_switch_get_node_ptr( p_sw ) );
 
-  /* Flag to mark whether or not a ui ucast fdb assign function was given */
-  if (p_mgr->p_subn->p_osm->routing_engine.ucast_fdb_assign)
-    ui_ucast_fdb_assign_func_defined = TRUE;
-  else
-    ui_ucast_fdb_assign_func_defined = FALSE;
-
-  /*
-    If the user requested a complete subnet reconfiguration,
-    then ignore existing paths when choosing paths now.
-    Note that if there is a ui ucast fdb assign function - then
-    ignore_existing should be false.
-  */
-  ignore_existing = p_mgr->p_subn->ignore_existing_lfts &&
-    (!ui_ucast_fdb_assign_func_defined);
-
   /*
     The lid matrix contains the number of hops to each
     lid from each port.  From this information we determine
@@ -805,14 +783,14 @@ __osm_ucast_mgr_process_port(
   {
     /* Use the enhanced algorithm only for LMC > 0 */
     if (lids_per_port > 1)
-      port = osm_switch_recommend_path( p_sw, lid_ho, ignore_existing,
+      port = osm_switch_recommend_path( p_sw, lid_ho,
+                                        p_mgr->p_subn->ignore_existing_lfts,
                                         remote_sys_guids, &num_used_sys,
-                                        remote_node_guids, &num_used_nodes,
-                                        ui_ucast_fdb_assign_func_defined );
+                                        remote_node_guids, &num_used_nodes );
     else
-      port = osm_switch_recommend_path( p_sw, lid_ho, ignore_existing,
-                                        NULL, NULL, NULL, NULL,
-                                        ui_ucast_fdb_assign_func_defined );
+      port = osm_switch_recommend_path( p_sw, lid_ho,
+                                        p_mgr->p_subn->ignore_existing_lfts,
+                                        NULL, NULL, NULL, NULL );
 
     /*
       There might be no path to the target
@@ -824,7 +802,7 @@ __osm_ucast_mgr_process_port(
 
       /* Up/Down routing can cause unreachable routes between some 
          switches so we do not report that as an error in that case */
-      if (!p_mgr->p_subn->p_osm->routing_engine.ucast_fdb_assign)
+      if (!p_mgr->p_subn->p_osm->routing_engine.build_lid_matrices)
       {
         osm_log( p_mgr->p_log, OSM_LOG_ERROR,
                  "__osm_ucast_mgr_process_port: ERR 3A08: "
@@ -1135,8 +1113,8 @@ __osm_ucast_mgr_process_neighbors(
 
 /**********************************************************************
  **********************************************************************/
-static void
-ucast_mgr_build_lid_matrices(
+void
+osm_ucast_mgr_build_lid_matrices(
   IN osm_ucast_mgr_t* const p_mgr )
 {
   uint32_t i;
@@ -1146,7 +1124,7 @@ ucast_mgr_build_lid_matrices(
   p_sw_guid_tbl = &p_mgr->p_subn->sw_guid_tbl;
 
   osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
-           "ucast_mgr_build_lid_matrices: "
+           "osm_ucast_mgr_build_lid_matrices: "
            "Starting switches Min Hop Table Assignment\n" );
   
   /*
@@ -1202,7 +1180,7 @@ ucast_mgr_build_lid_matrices(
                           __osm_ucast_mgr_process_neighbors, p_mgr );
     }
     osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-             "ucast_mgr_build_lid_matrices: "
+             "osm_ucast_mgr_build_lid_matrices: "
              "Min-hop propagated in %d steps\n", i );
   }
 }
@@ -1232,7 +1210,16 @@ osm_ucast_mgr_process(
 
   if (!p_routing_eng->build_lid_matrices ||
       p_routing_eng->build_lid_matrices(p_routing_eng->context) != 0)
-    ucast_mgr_build_lid_matrices(p_mgr);
+    osm_ucast_mgr_build_lid_matrices(p_mgr);
+
+  osm_log( p_mgr->p_log, OSM_LOG_INFO,
+           "osm_ucast_mgr_process: "
+           "Min Hop Tables configured on all switches\n" );
+
+  /*
+    Now that the lid matrices have been built, we can
+    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)
@@ -1242,42 +1229,6 @@ osm_ucast_mgr_process(
   } /* fallback on the regular path in case of failures */
   else
   {
-  /*
-    This is the place where we can load pre-defined routes
-    into the switches fwd_tbl structures.
-
-    Later code will use these values if not configured for
-    reassignment.
-  */
-    if (p_routing_eng->ucast_fdb_assign)
-    {
-      if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
-      {
-        osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-                 "osm_ucast_mgr_process: "
-                 "Invoking \'%s\' function ucast_fdb_assign\n",
-                 p_routing_eng->name );
-      }
-
-      p_routing_eng->ucast_fdb_assign(p_routing_eng->context);
-
-    }
-    else
-    {
-      osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-               "osm_ucast_mgr_process: "
-               "UI pfn was not invoked\n" );
-    }
-
-    osm_log( p_mgr->p_log, OSM_LOG_INFO,
-             "osm_ucast_mgr_process: "
-             "Min Hop Tables configured on all switches\n" );
-
-    /*
-      Now that the lid matrices have been built, we can
-      build and download the switch forwarding tables.
-    */
-
     cl_qmap_apply_func( p_sw_guid_tbl,
                         __osm_ucast_mgr_process_tbl, p_mgr );
   }
diff --git a/osm/opensm/osm_ucast_updn.c b/osm/opensm/osm_ucast_updn.c
index 4b227c9..0bc359b 100644
--- a/osm/opensm/osm_ucast_updn.c
+++ b/osm/opensm/osm_ucast_updn.c
@@ -997,6 +997,7 @@ __osm_updn_call(
   /* First auto detect root nodes - if required */
   if ( p_updn->auto_detect_root_nodes )
   {
+    osm_ucast_mgr_build_lid_matrices(&p_updn->p_osm->sm.ucast_mgr);
     /*    printf ("-V- b4 osm_updn_find_root_nodes_by_min_hop\n"); */
     __osm_updn_find_root_nodes_by_min_hop( p_updn );
   }
@@ -1284,7 +1285,7 @@ osm_ucast_updn_setup(
 		return -1;
 	p_osm->routing_engine.context = p_updn;
 	p_osm->routing_engine.delete = __osm_updn_delete;
-	p_osm->routing_engine.ucast_fdb_assign = __osm_updn_call;
+	p_osm->routing_engine.build_lid_matrices = __osm_updn_call;
 
 	if (updn_init(p_updn, p_osm) != IB_SUCCESS)
 		return -1;
-- 
1.4.4





More information about the general mailing list