[ofa-general] [PATCH] osm: fat-tree optimization - creating internal nodes

Yevgeny Kliteynik kliteyn at dev.mellanox.co.il
Mon May 14 05:30:51 PDT 2007


Hi Hal,

A small optimization to creation of fat-tree internal data structures.
Using the pointers from osm_node to osm_switch that Sasha has added
a while ago, it is enough to scan the OSM node_guid table only once
to create all the fat-tree internal nodes.

Please apply to master only.

-- Yevgeny

Signed-off-by:  Yevgeny Kliteynik <kliteyn at dev.mellanox.co.il>
---
 osm/opensm/osm_ucast_ftree.c |   51 +++++------------------------------------
 1 files changed, 7 insertions(+), 44 deletions(-)

diff --git a/osm/opensm/osm_ucast_ftree.c b/osm/opensm/osm_ucast_ftree.c
index ca51484..3bad2fc 100644
--- a/osm/opensm/osm_ucast_ftree.c
+++ b/osm/opensm/osm_ucast_ftree.c
@@ -2365,36 +2365,13 @@ __osm_ftree_fabric_route_to_switches(
  ***************************************************/
 
 static int 
-__osm_ftree_fabric_populate_switches(
-   IN  ftree_fabric_t * p_ftree)
-{
-   osm_switch_t * p_osm_sw;
-   osm_switch_t * p_next_osm_sw;
-
-   OSM_LOG_ENTER(&p_ftree->p_osm->log, __osm_ftree_fabric_populate_switches);
-
-   p_next_osm_sw = (osm_switch_t *)cl_qmap_head(&p_ftree->p_osm->subn.sw_guid_tbl);
-   while( p_next_osm_sw != (osm_switch_t *)cl_qmap_end(&p_ftree->p_osm->subn.sw_guid_tbl) )
-   {
-      p_osm_sw = p_next_osm_sw;
-      p_next_osm_sw = (osm_switch_t *)cl_qmap_next(&p_osm_sw->map_item );
-      __osm_ftree_fabric_add_sw(p_ftree,p_osm_sw);
-   }
-   OSM_LOG_EXIT(&p_ftree->p_osm->log);
-   return 0;
-} /* __osm_ftree_fabric_populate_switches() */
-
-/***************************************************
- ***************************************************/
-
-static int 
-__osm_ftree_fabric_populate_hcas(
+__osm_ftree_fabric_populate_nodes(
    IN  ftree_fabric_t * p_ftree)
 {
    osm_node_t   * p_osm_node;
    osm_node_t   * p_next_osm_node;
 
-   OSM_LOG_ENTER(&p_ftree->p_osm->log, __osm_ftree_fabric_populate_hcas);
+   OSM_LOG_ENTER(&p_ftree->p_osm->log, __osm_ftree_fabric_populate_nodes);
 
    p_next_osm_node = (osm_node_t *)cl_qmap_head(&p_ftree->p_osm->subn.node_guid_tbl);
    while( p_next_osm_node != (osm_node_t *)cl_qmap_end(&p_ftree->p_osm->subn.node_guid_tbl) )
@@ -2409,11 +2386,11 @@ __osm_ftree_fabric_populate_hcas(
          case IB_NODE_TYPE_ROUTER:
             break;
          case IB_NODE_TYPE_SWITCH:
-            /* all the switches added separately */
+            __osm_ftree_fabric_add_sw(p_ftree,p_osm_node->sw);
             break;
          default:
             osm_log(&p_ftree->p_osm->log, OSM_LOG_ERROR,
-                    "__osm_ftree_fabric_populate_hcas: ERR AB0E: "
+                    "__osm_ftree_fabric_populate_nodes: ERR AB0E: "
                     "Node GUID 0x%016" PRIx64 " - Unknown node type: %s\n",
                     cl_ntoh64(osm_node_get_node_guid(p_osm_node)),
                     ib_get_node_type_str(osm_node_get_type(p_osm_node)));
@@ -2424,7 +2401,7 @@ __osm_ftree_fabric_populate_hcas(
 
    OSM_LOG_EXIT(&p_ftree->p_osm->log);
    return 0;
-} /* __osm_ftree_fabric_populate_hcas() */
+} /* __osm_ftree_fabric_populate_nodes() */
 
 /***************************************************
  ***************************************************/
@@ -2962,22 +2939,8 @@ __osm_ftree_construct_fabric(
 
    osm_log(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
            "__osm_ftree_construct_fabric: "
-           "Populating FatTree switch table\n");
-   /* ToDo: now that the pointer from node to switch exists,  
-      no need to fill the switch table in a separate loop */
-   if (__osm_ftree_fabric_populate_switches(p_ftree) != 0)
-   {
-      osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS,
-              "Fabric topology is not fat-tree - "
-              "falling back to default routing\n");
-      status = -1;
-      goto Exit;
-   }
-
-   osm_log(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
-           "__osm_ftree_construct_fabric: "
-           "Populating FatTree HCA table\n");
-   if (__osm_ftree_fabric_populate_hcas(p_ftree) != 0)
+           "Populating FatTree Switch and HCA tables\n");
+   if (__osm_ftree_fabric_populate_nodes(p_ftree) != 0)
    {
       osm_log(&p_ftree->p_osm->log, OSM_LOG_SYS,
               "Fabric topology is not fat-tree - "
-- 
1.4.4.1.GIT





More information about the general mailing list