[ofa-general] [PATCH] osm: cosmetics in ftree - added get_guid functions for switch and hca

Yevgeny Kliteynik kliteyn at dev.mellanox.co.il
Wed Jun 20 00:42:59 PDT 2007


Hi Hal,

Cosmetic code changes in fat-tree:
added get_guid_ho and get_guid_no functions for switches and hca's

-- Yevgeny

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

diff --git a/opensm/opensm/osm_ucast_ftree.c b/opensm/opensm/osm_ucast_ftree.c
index 1ead199..1ae8b29 100644
--- a/opensm/opensm/osm_ucast_ftree.c
+++ b/opensm/opensm/osm_ucast_ftree.c
@@ -640,6 +640,26 @@ __osm_ftree_sw_destroy(

  /***************************************************/

+static uint64_t
+__osm_ftree_sw_get_guid_no(
+   IN  ftree_sw_t * p_sw)
+{
+   if (!p_sw)
+      return 0;
+   return osm_node_get_node_guid(p_sw->p_osm_sw->p_node);
+}
+
+/***************************************************/
+
+static uint64_t
+__osm_ftree_sw_get_guid_ho(
+   IN  ftree_sw_t * p_sw)
+{
+   return cl_ntoh64(__osm_ftree_sw_get_guid_no(p_sw));
+}
+
+/***************************************************/
+
  static void
  __osm_ftree_sw_dump(
     IN  ftree_fabric_t * p_ftree,
@@ -657,7 +677,7 @@ __osm_ftree_sw_dump(
             "__osm_ftree_sw_dump: "
             "Switch index: %s, GUID: 0x%016" PRIx64 ", Ports: %u DOWN, %u UP\n",
            __osm_ftree_tuple_to_str(p_sw->tuple),
-          cl_ntoh64(osm_node_get_node_guid(p_sw->p_osm_sw->p_node)),
+          __osm_ftree_sw_get_guid_ho(p_sw),
            p_sw->down_port_groups_num,
            p_sw->up_port_groups_num);

@@ -835,6 +855,26 @@ __osm_ftree_hca_destroy(

  /***************************************************/

+static uint64_t
+__osm_ftree_hca_get_guid_no(
+   IN  ftree_hca_t * p_hca)
+{
+   if (!p_hca)
+      return 0;
+   return osm_node_get_node_guid(p_hca->p_osm_node);
+}
+
+/***************************************************/
+
+static uint64_t
+__osm_ftree_hca_get_guid_ho(
+   IN  ftree_hca_t * p_hca)
+{
+   return cl_ntoh64(__osm_ftree_hca_get_guid_no(p_hca));
+}
+
+/***************************************************/
+
  static void
  __osm_ftree_hca_dump(
     IN  ftree_fabric_t * p_ftree,
@@ -851,7 +891,7 @@ __osm_ftree_hca_dump(
     osm_log(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
             "__osm_ftree_hca_dump: "
             "CA GUID: 0x%016" PRIx64 ", Ports: %u UP\n",
-          cl_ntoh64(osm_node_get_node_guid(p_hca->p_osm_node)),
+          __osm_ftree_hca_get_guid_ho(p_hca),
            p_hca->up_port_groups_num);

     for( i = 0; i < p_hca->up_port_groups_num; i++ )
@@ -1214,7 +1254,7 @@ __osm_ftree_fabric_dump_general_info(
                 osm_log(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
                         "__osm_ftree_fabric_dump_general_info: "
                         "      GUID: 0x%016" PRIx64 ", LID: 0x%x, Index %s\n",
-                       cl_ntoh64(osm_node_get_node_guid(p_sw->p_osm_sw->p_node)),
+                       __osm_ftree_sw_get_guid_ho(p_sw),
                         cl_ntoh16(p_sw->base_lid),
                         __osm_ftree_tuple_to_str(p_sw->tuple));
        }
@@ -1227,8 +1267,7 @@ __osm_ftree_fabric_dump_general_info(
              osm_log(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
                      "__osm_ftree_fabric_dump_general_info: "
                      "      GUID: 0x%016" PRIx64 ", LID: 0x%x, Index %s\n",
-                    cl_ntoh64(osm_node_get_node_guid(
-                              p_ftree->leaf_switches[i]->p_osm_sw->p_node)),
+                    __osm_ftree_sw_get_guid_ho(p_ftree->leaf_switches[i]),
                      cl_ntoh16(p_ftree->leaf_switches[i]->base_lid),
                      __osm_ftree_tuple_to_str(p_ftree->leaf_switches[i]->tuple));
        }
@@ -1442,7 +1481,7 @@ __osm_ftree_fabric_make_indexing(
             p_sw->rank,
             __osm_ftree_tuple_to_str(p_sw->tuple),
             cl_ntoh16(p_sw->base_lid),
-           cl_ntoh64(osm_node_get_node_guid(p_sw->p_osm_sw->p_node)));
+           __osm_ftree_sw_get_guid_ho(p_sw));

     /*
      * Now run BFS and assign indexes to all switches
@@ -1617,11 +1656,11 @@ __osm_ftree_fabric_validate_topology(
                      "ERR AB09: Different number of upward port groups on switches:\n"
                      "       GUID 0x%016" PRIx64 ", LID 0x%x, Index %s - %u groups\n"
                      "       GUID 0x%016" PRIx64 ", LID 0x%x, Index %s - %u groups\n",
-                    cl_ntoh64(osm_node_get_node_guid(reference_sw_arr[p_sw->rank]->p_osm_sw->p_node)),
+                    __osm_ftree_sw_get_guid_ho(reference_sw_arr[p_sw->rank]),
                      cl_ntoh16(reference_sw_arr[p_sw->rank]->base_lid),
                      __osm_ftree_tuple_to_str(reference_sw_arr[p_sw->rank]->tuple),
                      reference_sw_arr[p_sw->rank]->up_port_groups_num,
-                    cl_ntoh64(osm_node_get_node_guid(p_sw->p_osm_sw->p_node)),
+                    __osm_ftree_sw_get_guid_ho(p_sw),
                      cl_ntoh16(p_sw->base_lid),
                      __osm_ftree_tuple_to_str(p_sw->tuple),
                      p_sw->up_port_groups_num);
@@ -1638,11 +1677,11 @@ __osm_ftree_fabric_validate_topology(
                      "ERR AB0A: Different number of downward port groups on switches:\n"
                      "       GUID 0x%016" PRIx64 ", LID 0x%x, Index %s - %u port groups\n"
                      "       GUID 0x%016" PRIx64 ", LID 0x%x, Index %s - %u port groups\n",
-                    cl_ntoh64(osm_node_get_node_guid(reference_sw_arr[p_sw->rank]->p_osm_sw->p_node)),
+                    __osm_ftree_sw_get_guid_ho(reference_sw_arr[p_sw->rank]),
                      cl_ntoh16(reference_sw_arr[p_sw->rank]->base_lid),
                      __osm_ftree_tuple_to_str(reference_sw_arr[p_sw->rank]->tuple),
                      reference_sw_arr[p_sw->rank]->down_port_groups_num,
-                    cl_ntoh64(osm_node_get_node_guid(p_sw->p_osm_sw->p_node)),
+                    __osm_ftree_sw_get_guid_ho(p_sw),
                      cl_ntoh16(p_sw->base_lid),
                      __osm_ftree_tuple_to_str(p_sw->tuple),
                      p_sw->down_port_groups_num);
@@ -1663,11 +1702,11 @@ __osm_ftree_fabric_validate_topology(
                             "ERR AB0B: Different number of ports in an upward port group on switches:\n"
                             "       GUID 0x%016" PRIx64 ", LID 0x%x, Index %s - %u ports\n"
                             "       GUID 0x%016" PRIx64 ", LID 0x%x, Index %s - %u ports\n",
-                           cl_ntoh64(osm_node_get_node_guid(reference_sw_arr[p_sw->rank]->p_osm_sw->p_node)),
+                           __osm_ftree_sw_get_guid_ho(reference_sw_arr[p_sw->rank]),
                             cl_ntoh16(reference_sw_arr[p_sw->rank]->base_lid),
                             __osm_ftree_tuple_to_str(reference_sw_arr[p_sw->rank]->tuple),
                             cl_ptr_vector_get_size(&p_ref_group->ports),
-                           cl_ntoh64(osm_node_get_node_guid(p_sw->p_osm_sw->p_node)),
+                           __osm_ftree_sw_get_guid_ho(p_sw),
                             cl_ntoh16(p_sw->base_lid),
                             __osm_ftree_tuple_to_str(p_sw->tuple),
                             cl_ptr_vector_get_size(&p_group->ports));
@@ -1691,11 +1730,11 @@ __osm_ftree_fabric_validate_topology(
                             "ERR AB0C: Different number of ports in an downward port group on switches:\n"
                             "       GUID 0x%016" PRIx64 ", LID 0x%x, Index %s - %u ports\n"
                             "       GUID 0x%016" PRIx64 ", LID 0x%x, Index %s - %u ports\n",
-                           cl_ntoh64(osm_node_get_node_guid(reference_sw_arr[p_sw->rank]->p_osm_sw->p_node)),
+                           __osm_ftree_sw_get_guid_ho(reference_sw_arr[p_sw->rank]),
                             cl_ntoh16(reference_sw_arr[p_sw->rank]->base_lid),
                             __osm_ftree_tuple_to_str(reference_sw_arr[p_sw->rank]->tuple),
                             cl_ptr_vector_get_size(&p_ref_group->ports),
-                           cl_ntoh64(osm_node_get_node_guid(p_sw->p_osm_sw->p_node)),
+                           __osm_ftree_sw_get_guid_ho(p_sw),
                             cl_ntoh16(p_sw->base_lid),
                             __osm_ftree_tuple_to_str(p_sw->tuple),
                             cl_ptr_vector_get_size(&p_group->ports));
@@ -2508,7 +2547,7 @@ __osm_ftree_rank_leaf_switches(
                      "__osm_ftree_rank_leaf_switches: ERR AB0F: "
                      "CA conected directly to another CA: "
                      "0x%016" PRIx64 " <---> 0x%016" PRIx64 "\n",
-                    cl_ntoh64(osm_node_get_node_guid(p_hca->p_osm_node)),
+                    __osm_ftree_hca_get_guid_ho(p_hca),
                      cl_ntoh64(osm_node_get_node_guid(p_remote_osm_node)));
              res = -1;
              goto Exit;
@@ -2548,8 +2587,8 @@ __osm_ftree_rank_leaf_switches(
                "                                            - CA guid    : 0x%016" PRIx64 "\n"
                "                                            - Switch guid: 0x%016" PRIx64 "\n"
                "                                            - Switch LID : 0x%x\n",
-              cl_ntoh64(osm_node_get_node_guid(p_hca->p_osm_node)),
-              cl_ntoh64(osm_node_get_node_guid(p_sw->p_osm_sw->p_node)),
+              __osm_ftree_hca_get_guid_ho(p_hca),
+              __osm_ftree_sw_get_guid_ho(p_sw),
                cl_ntoh16(p_sw->base_lid));
        cl_list_insert_tail(p_ranking_bfs_list,
                            &__osm_ftree_sw_tbl_element_create(p_sw)->map_item);
@@ -2740,10 +2779,10 @@ __osm_ftree_fabric_construct_sw_ports(
                         "       GUID 0x%016" PRIx64 ", LID 0x%x, rank %u\n",
                         p_sw->rank,
                         p_remote_sw->rank,
-                       cl_ntoh64(osm_node_get_node_guid(p_sw->p_osm_sw->p_node)),
+                       __osm_ftree_sw_get_guid_ho(p_sw),
                         cl_ntoh16(p_sw->base_lid),
                         p_sw->rank,
-                       cl_ntoh64(osm_node_get_node_guid(p_remote_sw->p_osm_sw->p_node)),
+                       __osm_ftree_sw_get_guid_ho(p_remote_sw),
                         cl_ntoh16(p_remote_sw->base_lid),
                         p_remote_sw->rank);
                 res = -1;
-- 
1.5.1.4





More information about the general mailing list