[openib-general] [PATCH] opensm: remove some unneeded osm_switch functions

Sasha Khapyorsky sashak at voltaire.com
Sun Feb 25 15:47:05 PST 2007


Following introduced simplification this patch removes single field
access functions from osm_switch.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 osm/include/opensm/osm_switch.h |  176 ---------------------------------------
 osm/opensm/osm_mcast_mgr.c      |   27 ++----
 osm/opensm/osm_mtree.c          |    4 +-
 osm/opensm/osm_node_info_rcv.c  |    2 +-
 osm/opensm/osm_state_mgr.c      |    4 +-
 osm/opensm/osm_sw_info_rcv.c    |   14 ++--
 osm/opensm/osm_switch.c         |    6 +-
 osm/opensm/osm_ucast_file.c     |   11 +--
 osm/opensm/osm_ucast_ftree.c    |   41 +++++-----
 osm/opensm/osm_ucast_lash.c     |    4 +-
 osm/opensm/osm_ucast_mgr.c      |   34 ++++----
 osm/opensm/osm_ucast_updn.c     |    8 +-
 12 files changed, 72 insertions(+), 259 deletions(-)

diff --git a/osm/include/opensm/osm_switch.h b/osm/include/opensm/osm_switch.h
index 19381f8..4e0d46d 100644
--- a/osm/include/opensm/osm_switch.h
+++ b/osm/include/opensm/osm_switch.h
@@ -623,93 +623,6 @@ osm_switch_get_max_block_id_in_use(
 *	Switch object
 *********/
 
-/****f* OpenSM: Switch/osm_switch_get_node_ptr
-* NAME
-*	osm_switch_get_node_ptr
-*
-* DESCRIPTION
-*	Returns a pointer to the Node object for this switch.
-*
-* SYNOPSIS
-*/
-static inline osm_node_t*
-osm_switch_get_node_ptr(
-	IN const osm_switch_t* const p_sw )
-{
-	return( p_sw->p_node );
-}
-/*
-* PARAMETERS
-*	p_sw
-*		[in] Pointer to an osm_switch_t object.
-*
-* RETURN VALUES
-*	Returns a pointer to the Node object for this switch.
-*	
-* NOTES
-*
-* SEE ALSO
-*	Switch object
-*********/
-
-/****f* OpenSM: Switch/osm_switch_get_max_lid_ho
-* NAME
-*	osm_switch_get_max_lid_ho
-*
-* DESCRIPTION
-*	Returns the maximum LID (host order) value contained
-*	in the switch routing tables.
-*
-* SYNOPSIS
-*/
-static inline uint16_t
-osm_switch_get_max_lid_ho(
-	IN const osm_switch_t* const p_sw )
-{
-	return p_sw->max_lid_ho;
-}
-/*
-* PARAMETERS
-*	p_sw
-*		[in] Pointer to a switch object.
-*
-* RETURN VALUES
-*	Returns the maximum LID (host order) value contained
-*	in the switch routing tables.
-*
-* NOTES
-*
-* SEE ALSO
-*********/
-
-/****f* OpenSM: Switch/osm_switch_get_num_ports
-* NAME
-*	osm_switch_get_num_ports
-*
-* DESCRIPTION
-*	Returns the number of ports in this switch.
-*
-* SYNOPSIS
-*/
-static inline uint8_t
-osm_switch_get_num_ports(
-	IN const osm_switch_t* const p_sw )
-{
-	return p_sw->num_ports;
-}
-/*
-* PARAMETERS
-*	p_sw
-*		[in] Pointer to an osm_switch_t object.
-*
-* RETURN VALUES
-*	Returns the number of ports in this switch.
-*
-* NOTES
-*
-* SEE ALSO
-*********/
-
 /****f* OpenSM: Switch/osm_switch_get_fwd_tbl_block
 * NAME
 *	osm_switch_get_fwd_tbl_block
@@ -1330,95 +1243,6 @@ osm_switch_is_in_mcast_tree(
 * SEE ALSO
 *********/
 
-/****f* OpenSM: Node/osm_switch_discovery_count_get
-* NAME
-*	osm_switch_discovery_count_get
-*
-* DESCRIPTION
-*	Returns a pointer to the physical port object at the
-*	specified local port number.
-*
-* SYNOPSIS
-*/
-static inline uint32_t
-osm_switch_discovery_count_get(
-	IN const osm_switch_t* const p_switch )
-{
-	return( p_switch->discovery_count );
-}
-/*
-* PARAMETERS
-*	p_switch
-*		[in] Pointer to an osm_switch_t object.
-*
-* RETURN VALUES
-*	Returns the discovery count for this node.
-*
-* NOTES
-*
-* SEE ALSO
-*	Node object
-*********/
-
-/****f* OpenSM: Node/osm_switch_discovery_count_reset
-* NAME
-*	osm_switch_discovery_count_reset
-*
-* DESCRIPTION
-*	Resets the discovery count for this node to zero.
-*	This operation should be performed at the start of a sweep.
-*
-* SYNOPSIS
-*/
-static inline void
-osm_switch_discovery_count_reset(
-	IN osm_switch_t* const p_switch )
-{
-	p_switch->discovery_count = 0;
-}
-/*
-* PARAMETERS
-*	p_switch
-*		[in] Pointer to an osm_switch_t object.
-*
-* RETURN VALUES
-*	None.
-*
-* NOTES
-*
-* SEE ALSO
-*	Node object
-*********/
-
-/****f* OpenSM: Node/osm_switch_discovery_count_inc
-* NAME
-*	osm_switch_discovery_count_inc
-*
-* DESCRIPTION
-*	Increments the discovery count for this node.
-*
-* SYNOPSIS
-*/
-static inline void
-osm_switch_discovery_count_inc(
-	IN osm_switch_t* const p_switch )
-{
-	p_switch->discovery_count++;
-}
-/*
-* PARAMETERS
-*	p_switch
-*		[in] Pointer to an osm_switch_t object.
-*
-* RETURN VALUES
-*	None.
-*
-* NOTES
-*
-* SEE ALSO
-*	Node object
-*********/
-
 END_C_DECLS
 
 #endif /* _OSM_SWITCH_H_ */
diff --git a/osm/opensm/osm_mcast_mgr.c b/osm/opensm/osm_mcast_mgr.c
index a5ad024..cf8ae7d 100644
--- a/osm/opensm/osm_mcast_mgr.c
+++ b/osm/opensm/osm_mcast_mgr.c
@@ -319,9 +319,7 @@ __osm_mcast_mgr_find_optimal_switch(
 
     if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
     {
-      sw_guid_ho = cl_ntoh64( osm_node_get_node_guid(
-                                osm_switch_get_node_ptr( p_sw ) ) );
-
+      sw_guid_ho = cl_ntoh64( osm_node_get_node_guid(p_sw->p_node) );
       osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
                "__osm_mcast_mgr_find_optimal_switch: "
                "Switch 0x%016" PRIx64 ", hops = %f\n",
@@ -339,9 +337,7 @@ __osm_mcast_mgr_find_optimal_switch(
   {
     if( p_best_sw )
     {
-      sw_guid_ho = cl_ntoh64( osm_node_get_node_guid(
-                                osm_switch_get_node_ptr( p_best_sw ) ) );
-
+      sw_guid_ho = cl_ntoh64( osm_node_get_node_guid(p_best_sw->p_node) );
       osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
                "__osm_mcast_mgr_find_optimal_switch: "
                "Best switch is 0x%" PRIx64 ", hops = %f\n",
@@ -459,7 +455,7 @@ __osm_mcast_mgr_set_tbl(
 
   CL_ASSERT( p_sw );
 
-  p_node = osm_switch_get_node_ptr( p_sw );
+  p_node = p_sw->p_node;
 
   CL_ASSERT( p_node );
 
@@ -571,9 +567,7 @@ __osm_mcast_mgr_subdivide(
         multicast and the multicast tree must branch at this
         switch.
       */
-      uint64_t node_guid_ho = cl_ntoh64( osm_node_get_node_guid(
-                                           osm_switch_get_node_ptr( p_sw ) ) );
-
+      uint64_t node_guid_ho = cl_ntoh64( osm_node_get_node_guid(p_sw->p_node) );
       osm_log( p_mgr->p_log, OSM_LOG_ERROR,
                "__osm_mcast_mgr_subdivide: ERR 0A03: "
                "Error routing MLID 0x%X through switch 0x%" PRIx64 "\n"
@@ -587,9 +581,7 @@ __osm_mcast_mgr_subdivide(
 
     if( port_num > array_size )
     {
-      uint64_t node_guid_ho = cl_ntoh64( osm_node_get_node_guid(
-                                           osm_switch_get_node_ptr( p_sw ) ) );
-
+      uint64_t node_guid_ho = cl_ntoh64( osm_node_get_node_guid(p_sw->p_node) );
       osm_log( p_mgr->p_log, OSM_LOG_ERROR,
                "__osm_mcast_mgr_subdivide: ERR 0A04: "
                "Error routing MLID 0x%X through switch 0x%" PRIx64 "\n"
@@ -669,7 +661,7 @@ __osm_mcast_mgr_branch(
   CL_ASSERT( p_list );
   CL_ASSERT( p_max_depth );
 
-  node_guid = osm_node_get_node_guid(  osm_switch_get_node_ptr( p_sw ) );
+  node_guid = osm_node_get_node_guid( p_sw->p_node );
   node_guid_ho = cl_ntoh64( node_guid );
   mlid_ho = cl_ntoh16( osm_mgrp_get_mlid( p_mgrp ) );
 
@@ -823,7 +815,7 @@ __osm_mcast_mgr_branch(
          needed to add the port to the table */
       continue;
 
-    p_node = osm_switch_get_node_ptr( p_sw );
+    p_node = p_sw->p_node;
     p_remote_node = osm_node_get_remote_node( p_node, i, NULL );
 
     if( osm_node_get_type( p_remote_node ) == IB_NODE_TYPE_SWITCH )
@@ -1033,8 +1025,7 @@ osm_mcast_mgr_set_table(
     osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
              "osm_mcast_mgr_set_table: "
              "Configuring MLID 0x%X on switch 0x%" PRIx64 "\n",
-             mlid_ho, osm_node_get_node_guid(
-               osm_switch_get_node_ptr( p_sw ) ) );
+             mlid_ho, osm_node_get_node_guid(p_sw->p_node) );
   }
 
   /*
@@ -1389,7 +1380,7 @@ mcast_mgr_dump_sw_routes(
   if( !osm_log_is_active( p_mgr->p_log, OSM_LOG_ROUTING ) )
     goto Exit;
 
-  p_node = osm_switch_get_node_ptr( p_sw );
+  p_node = p_sw->p_node;
 
   p_tbl = osm_switch_get_mcast_tbl_ptr( p_sw );
 
diff --git a/osm/opensm/osm_mtree.c b/osm/opensm/osm_mtree.c
index a98df2f..14bfa36 100644
--- a/osm/opensm/osm_mtree.c
+++ b/osm/opensm/osm_mtree.c
@@ -68,7 +68,7 @@ osm_mtree_node_init(
   osm_mtree_node_construct( p_mtn );
 
   p_mtn->p_sw = (osm_switch_t*)p_sw;
-  p_mtn->max_children = osm_switch_get_num_ports( p_sw );
+  p_mtn->max_children = p_sw->num_ports;
 
   for( i = 0; i < p_mtn->max_children; i++ )
     p_mtn->child_array[i] = NULL;
@@ -83,7 +83,7 @@ osm_mtree_node_new(
   osm_mtree_node_t *p_mtn;
 
   p_mtn = malloc( sizeof(osm_mtree_node_t) +
-                  sizeof(void*) * (osm_switch_get_num_ports( p_sw ) - 1) );
+                  sizeof(void*) * (p_sw->num_ports - 1) );
 
   if( p_mtn != NULL )
     osm_mtree_node_init( p_mtn, p_sw );
diff --git a/osm/opensm/osm_node_info_rcv.c b/osm/opensm/osm_node_info_rcv.c
index 5cbd3b7..3053df5 100644
--- a/osm/opensm/osm_node_info_rcv.c
+++ b/osm/opensm/osm_node_info_rcv.c
@@ -657,7 +657,7 @@ __osm_ni_rcv_process_existing_switch(
   else
   {
     /* Make sure we have SwitchInfo on this node */
-    if( !p_node->sw || osm_switch_discovery_count_get( p_node->sw ) == 0 )
+    if( !p_node->sw || p_node->sw->discovery_count == 0 )
     {
       /* we don't have the SwitchInfo - retry to get it */
       osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
diff --git a/osm/opensm/osm_state_mgr.c b/osm/opensm/osm_state_mgr.c
index 2905857..61de8d2 100644
--- a/osm/opensm/osm_state_mgr.c
+++ b/osm/opensm/osm_state_mgr.c
@@ -566,7 +566,7 @@ __osm_state_mgr_reset_switch_count(
                cl_ntoh64( osm_node_get_node_guid( p_sw->p_node ) ) );
    }
 
-   osm_switch_discovery_count_reset( p_sw );
+   p_sw->discovery_count = 0;
 }
 
 /**********************************************************************
@@ -585,7 +585,7 @@ __osm_state_mgr_get_sw_info(
 
    OSM_LOG_ENTER( p_mgr->p_log, __osm_state_mgr_get_sw_info );
 
-   p_node = osm_switch_get_node_ptr( p_sw );
+   p_node = p_sw->p_node;
    p_dr_path = osm_node_get_any_dr_path_ptr( p_node );
 
    memset( &context, 0, sizeof( context ) );
diff --git a/osm/opensm/osm_sw_info_rcv.c b/osm/opensm/osm_sw_info_rcv.c
index fe3fe9f..013a724 100644
--- a/osm/opensm/osm_sw_info_rcv.c
+++ b/osm/opensm/osm_sw_info_rcv.c
@@ -82,7 +82,7 @@ __osm_si_rcv_get_port_info(
 
   CL_ASSERT( p_sw );
 
-  p_node = osm_switch_get_node_ptr( p_sw );
+  p_node = p_sw->p_node;
   p_smp = osm_madw_get_smp_ptr( p_madw );
 
   CL_ASSERT( osm_node_get_type( p_node ) == IB_NODE_TYPE_SWITCH );
@@ -154,7 +154,7 @@ __osm_si_rcv_get_fwd_tbl(
 
   CL_ASSERT( p_sw );
 
-  p_node = osm_switch_get_node_ptr( p_sw );
+  p_node = p_sw->p_node;
 
   CL_ASSERT( osm_node_get_type( p_node ) == IB_NODE_TYPE_SWITCH );
 
@@ -223,7 +223,7 @@ __osm_si_rcv_get_mcast_fwd_tbl(
 
   CL_ASSERT( p_sw );
 
-  p_node = osm_switch_get_node_ptr( p_sw );
+  p_node = p_sw->p_node;
 
   CL_ASSERT( osm_node_get_type( p_node ) == IB_NODE_TYPE_SWITCH );
 
@@ -393,7 +393,7 @@ __osm_si_rcv_process_new(
     info we just received.
   */
   osm_switch_set_switch_info( p_sw, p_si );
-  osm_switch_discovery_count_inc( p_sw );
+  p_sw->discovery_count++;
 
   /*
     Get the PortInfo attribute for every port.
@@ -505,14 +505,14 @@ __osm_si_rcv_process_existing(
         This is a heavy sweep.  Get information regardless
         of the state change bit.
       */
-      osm_switch_discovery_count_inc( p_sw );
+      p_sw->discovery_count++;
       osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
                "__osm_si_rcv_process_existing: "
                "discovery_count is:%u\n",
-               osm_switch_discovery_count_get( p_sw ) );
+               p_sw->discovery_count );
 
       /* If this is the first discovery - then get the port_info */
-      if ( osm_switch_discovery_count_get( p_sw ) == 1 )
+      if ( p_sw->discovery_count == 1 )
         __osm_si_rcv_get_port_info( p_rcv, p_sw, p_madw );
       else
       {
diff --git a/osm/opensm/osm_switch.c b/osm/opensm/osm_switch.c
index 7c57398..6db8add 100644
--- a/osm/opensm/osm_switch.c
+++ b/osm/opensm/osm_switch.c
@@ -195,7 +195,7 @@ osm_switch_get_fwd_tbl_block(
   CL_ASSERT( p_block );
 
   p_tbl = osm_switch_get_fwd_tbl_ptr( p_sw );
-  max_lid_ho = osm_switch_get_max_lid_ho( p_sw );
+  max_lid_ho = p_sw->max_lid_ho;
   lids_per_block = osm_fwd_tbl_get_lids_per_block( &p_sw->fwd_tbl );
   base_lid_ho = (uint16_t)(block_id * lids_per_block);
 
@@ -278,7 +278,7 @@ osm_switch_recommend_path(
 
   CL_ASSERT( lid_ho > 0 );
 
-  num_ports = osm_switch_get_num_ports( p_sw );
+  num_ports = p_sw->num_ports;
 
   least_hops = osm_switch_get_least_hops( p_sw, lid_ho );
   if ( least_hops == OSM_NO_PATH )
@@ -532,7 +532,7 @@ osm_switch_recommend_mcast_path(
   CL_ASSERT( lid_ho > 0 );
   CL_ASSERT( mlid_ho >= IB_LID_MCAST_START_HO );
 
-  num_ports = osm_switch_get_num_ports( p_sw );
+  num_ports = p_sw->num_ports;
 
   /*
     If the user wants us to ignore existing multicast routes,
diff --git a/osm/opensm/osm_ucast_file.c b/osm/opensm/osm_ucast_file.c
index a623a26..4de4c02 100644
--- a/osm/opensm/osm_ucast_file.c
+++ b/osm/opensm/osm_ucast_file.c
@@ -93,8 +93,8 @@ static void add_path(osm_opensm_t * p_osm,
 		osm_log(&p_osm->log, OSM_LOG_VERBOSE,
 			"add_path: LID collision is detected on switch "
 			"0x016%" PRIx64 ", will overwrite LID 0x%x entry\n",
-			cl_ntoh64(osm_node_get_node_guid
-				  (osm_switch_get_node_ptr(p_sw))), new_lid);
+			cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)),
+			new_lid);
 	}
 
 	p_osm->sm.ucast_mgr.lft_buf[new_lid] = port_num;
@@ -106,8 +106,7 @@ static void add_path(osm_opensm_t * p_osm,
 		"add_path: route 0x%04x(was 0x%04x) %u 0x%016" PRIx64
 		" is added to switch 0x%016" PRIx64 "\n",
 		new_lid, lid, port_num, cl_ntoh64(port_guid),
-		cl_ntoh64(osm_node_get_node_guid
-			  (osm_switch_get_node_ptr(p_sw))));
+		cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)));
 }
 
 static void add_lid_hops(osm_opensm_t *p_osm, osm_switch_t *p_sw,
@@ -118,8 +117,8 @@ static void add_lid_hops(osm_opensm_t *p_osm, osm_switch_t *p_sw,
 	uint8_t i;
 
 	new_lid = guid ? remap_lid(p_osm, lid, guid) : lid;
-	if (len > osm_switch_get_num_ports(p_sw))
-		len = osm_switch_get_num_ports(p_sw);
+	if (len > p_sw->num_ports)
+		len = p_sw->num_ports;
 
 	for (i = 0 ; i < len ; i++)
 		osm_switch_set_hops(p_sw, lid, i, hops[i]);
diff --git a/osm/opensm/osm_ucast_ftree.c b/osm/opensm/osm_ucast_ftree.c
index 61db1d7..ac8302b 100644
--- a/osm/opensm/osm_ucast_ftree.c
+++ b/osm/opensm/osm_ucast_ftree.c
@@ -579,7 +579,7 @@ __osm_ftree_sw_create(
    uint8_t ports_num;
 
    /* make sure that the switch has ports */
-   if (osm_switch_get_num_ports(p_osm_sw) == 1)
+   if (p_osm_sw->num_ports == 1)
       return NULL;
 
    p_sw = (ftree_sw_t *)malloc(sizeof(ftree_sw_t));
@@ -591,9 +591,9 @@ __osm_ftree_sw_create(
    p_sw->rank = 0xFF;
    __osm_ftree_tuple_init(p_sw->tuple);
 
-   p_sw->base_lid = osm_node_get_base_lid(osm_switch_get_node_ptr(p_sw->p_osm_sw),0);
+   p_sw->base_lid = osm_node_get_base_lid(p_sw->p_osm_sw->p_node,0);
 
-   ports_num = osm_node_get_num_physp(osm_switch_get_node_ptr(p_sw->p_osm_sw));
+   ports_num = osm_node_get_num_physp(p_sw->p_osm_sw->p_node);
    p_sw->down_port_groups = 
       (ftree_port_group_t **) malloc(ports_num * sizeof(ftree_port_group_t *));
    p_sw->up_port_groups = 
@@ -657,7 +657,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(osm_switch_get_node_ptr(p_sw->p_osm_sw))), 
+          cl_ntoh64(osm_node_get_node_guid(p_sw->p_osm_sw->p_node)),
           p_sw->down_port_groups_num, 
           p_sw->up_port_groups_num);
 
@@ -1214,7 +1214,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(osm_switch_get_node_ptr(p_sw->p_osm_sw))),
+                       cl_ntoh64(osm_node_get_node_guid(p_sw->p_osm_sw->p_node)),
                        cl_ntoh16(p_sw->base_lid),
                        __osm_ftree_tuple_to_str(p_sw->tuple));
       }
@@ -1228,8 +1228,7 @@ __osm_ftree_fabric_dump_general_info(
                     "__osm_ftree_fabric_dump_general_info: "
                     "      GUID: 0x%016" PRIx64 ", LID: 0x%x, Index %s\n",
                     cl_ntoh64(osm_node_get_node_guid(
-                                 osm_switch_get_node_ptr(
-                                    p_ftree->leaf_switches[i]->p_osm_sw))),
+                              p_ftree->leaf_switches[i]->p_osm_sw->p_node)),
                     cl_ntoh16(p_ftree->leaf_switches[i]->base_lid),
                     __osm_ftree_tuple_to_str(p_ftree->leaf_switches[i]->tuple));
       }
@@ -1443,7 +1442,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(osm_switch_get_node_ptr(p_sw->p_osm_sw))));
+           cl_ntoh64(osm_node_get_node_guid(p_sw->p_osm_sw->p_node)));
 
    /* 
     * Now run BFS and assign indexes to all switches
@@ -1617,11 +1616,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(osm_switch_get_node_ptr(reference_sw_arr[p_sw->rank]->p_osm_sw))),
+                    cl_ntoh64(osm_node_get_node_guid(reference_sw_arr[p_sw->rank]->p_osm_sw->p_node)),
                     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(osm_switch_get_node_ptr(p_sw->p_osm_sw))),
+                    cl_ntoh64(osm_node_get_node_guid(p_sw->p_osm_sw->p_node)),
                     cl_ntoh16(p_sw->base_lid),
                     __osm_ftree_tuple_to_str(p_sw->tuple),
                     p_sw->up_port_groups_num);
@@ -1638,11 +1637,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(osm_switch_get_node_ptr(reference_sw_arr[p_sw->rank]->p_osm_sw))),
+                    cl_ntoh64(osm_node_get_node_guid(reference_sw_arr[p_sw->rank]->p_osm_sw->p_node)),
                     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(osm_switch_get_node_ptr(p_sw->p_osm_sw))),
+                    cl_ntoh64(osm_node_get_node_guid(p_sw->p_osm_sw->p_node)),
                     cl_ntoh16(p_sw->base_lid),
                     __osm_ftree_tuple_to_str(p_sw->tuple),
                     p_sw->down_port_groups_num);
@@ -1663,11 +1662,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(osm_switch_get_node_ptr(reference_sw_arr[p_sw->rank]->p_osm_sw))),
+                           cl_ntoh64(osm_node_get_node_guid(reference_sw_arr[p_sw->rank]->p_osm_sw->p_node)),
                            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(osm_switch_get_node_ptr(p_sw->p_osm_sw))),
+                           cl_ntoh64(osm_node_get_node_guid(p_sw->p_osm_sw->p_node)),
                            cl_ntoh16(p_sw->base_lid),
                            __osm_ftree_tuple_to_str(p_sw->tuple),
                            cl_ptr_vector_get_size(&p_group->ports));
@@ -1691,11 +1690,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(osm_switch_get_node_ptr(reference_sw_arr[p_sw->rank]->p_osm_sw))),
+                           cl_ntoh64(osm_node_get_node_guid(reference_sw_arr[p_sw->rank]->p_osm_sw->p_node)),
                            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(osm_switch_get_node_ptr(p_sw->p_osm_sw))),
+                           cl_ntoh64(osm_node_get_node_guid(p_sw->p_osm_sw->p_node)),
                            cl_ntoh16(p_sw->base_lid),
                            __osm_ftree_tuple_to_str(p_sw->tuple),
                            cl_ptr_vector_get_size(&p_group->ports));
@@ -2439,7 +2438,7 @@ __osm_ftree_rank_from_switch(
       p_sw = p_sw_tbl_element->p_sw;
       __osm_ftree_sw_tbl_element_destroy(p_sw_tbl_element);
 
-      p_node = osm_switch_get_node_ptr(p_sw->p_osm_sw);
+      p_node = p_sw->p_osm_sw->p_node;
 
       /* note: skipping port 0 on switches */
       for (i = 1; i < osm_node_get_num_physp(p_node); i++)
@@ -2550,7 +2549,7 @@ __osm_ftree_rank_switches_from_hca(
               "                                            - 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(osm_switch_get_node_ptr(p_sw->p_osm_sw))),
+              cl_ntoh64(osm_node_get_node_guid(p_sw->p_osm_sw->p_node)),
               cl_ntoh16(p_sw->base_lid));
       __osm_ftree_rank_from_switch(p_ftree, p_sw);
    }
@@ -2672,7 +2671,7 @@ __osm_ftree_fabric_construct_sw_ports(
 {
    ftree_hca_t       * p_remote_hca;
    ftree_sw_t        * p_remote_sw;
-   osm_node_t        * p_node = osm_switch_get_node_ptr(p_sw->p_osm_sw);
+   osm_node_t        * p_node = p_sw->p_osm_sw->p_node;
    osm_node_t        * p_remote_node;
    ib_net16_t          remote_base_lid;
    uint8_t             remote_node_type;
@@ -2740,10 +2739,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(osm_switch_get_node_ptr(p_sw->p_osm_sw))),
+                       cl_ntoh64(osm_node_get_node_guid(p_sw->p_osm_sw->p_node)),
                        cl_ntoh16(p_sw->base_lid),
                        p_sw->rank,
-                       cl_ntoh64(osm_node_get_node_guid(osm_switch_get_node_ptr(p_remote_sw->p_osm_sw))),
+                       cl_ntoh64(osm_node_get_node_guid(p_remote_sw->p_osm_sw->p_node)),
                        cl_ntoh16(p_remote_sw->base_lid),
                        p_remote_sw->rank);
                res = -1;
diff --git a/osm/opensm/osm_ucast_lash.c b/osm/opensm/osm_ucast_lash.c
index f7ce5cd..2ce334a 100644
--- a/osm/opensm/osm_ucast_lash.c
+++ b/osm/opensm/osm_ucast_lash.c
@@ -1172,7 +1172,7 @@ static void populate_fwd_tbls(lash_t *p_lash)
       p_sw = p_next_sw;
       p_next_sw = (osm_switch_t*)cl_qmap_next( &p_sw->map_item );
 
-      max_lid_ho = osm_switch_get_max_lid_ho(p_sw);
+      max_lid_ho = p_sw->max_lid_ho;
       current_guid = p_sw->p_node->node_info.port_guid;
       sw = p_sw->priv;
 
@@ -1223,7 +1223,7 @@ static void print_fwd_table(IN const osm_switch_t *p_sw)
   uint16_t max_lid_ho, lid_ho;
   uint64_t switch_guid = osm_lash_get_switch_guid(p_sw);
 
-  max_lid_ho = osm_switch_get_max_lid_ho(p_sw);
+  max_lid_ho = p_sw->max_lid_ho;
   printf("FWDTBL: 0x%016" PRIx64 " max LID 0x%04X\n", cl_ntoh64(switch_guid), max_lid_ho);
 
   // starting at 1, not 0. Assuming no LID with an ID of 0
diff --git a/osm/opensm/osm_ucast_mgr.c b/osm/opensm/osm_ucast_mgr.c
index 93cafae..15dda55 100644
--- a/osm/opensm/osm_ucast_mgr.c
+++ b/osm/opensm/osm_ucast_mgr.c
@@ -190,8 +190,8 @@ __osm_ucast_mgr_dump_path_distribution(
 
   OSM_LOG_ENTER( p_mgr->p_log, __osm_ucast_mgr_dump_path_distribution );
 
-  p_node = osm_switch_get_node_ptr( p_sw );
-  num_ports = osm_switch_get_num_ports( p_sw );
+  p_node = p_sw->p_node;
+  num_ports = p_sw->num_ports;
 
   osm_log_printf( p_mgr->p_log, OSM_LOG_DEBUG,
                   "__osm_ucast_mgr_dump_path_distribution: "
@@ -260,9 +260,9 @@ __osm_ucast_mgr_dump_ucast_routes(
 
   OSM_LOG_ENTER( p_mgr->p_log, __osm_ucast_mgr_dump_ucast_routes );
 
-  p_node = osm_switch_get_node_ptr( p_sw );
+  p_node = p_sw->p_node;
 
-  max_lid_ho = osm_switch_get_max_lid_ho( p_sw );
+  max_lid_ho = p_sw->max_lid_ho;
 
   fprintf( file, "__osm_ucast_mgr_dump_ucast_routes: "
            "Switch 0x%016" PRIx64 "\n"
@@ -325,9 +325,9 @@ 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);
+	osm_node_t *p_node = p_sw->p_node;
+	unsigned max_lid = p_sw->max_lid_ho;
+	unsigned max_port = p_sw->num_ports;
 	uint16_t lid;
 	uint8_t port;
 
@@ -356,9 +356,9 @@ ucast_mgr_dump_lfts(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);
+	osm_node_t *p_node = p_sw->p_node;
+	unsigned max_lid = p_sw->max_lid_ho;
+	unsigned max_port = p_sw->num_ports;
 	uint16_t lid;
 	uint8_t port;
 
@@ -496,8 +496,8 @@ __osm_ucast_mgr_process_neighbor(
   CL_ASSERT( port_num );
   CL_ASSERT( remote_port_num );
 
-  p_node = osm_switch_get_node_ptr( p_sw );
-  p_remote_node = osm_switch_get_node_ptr( p_remote_sw );
+  p_node = p_sw->p_node;
+  p_remote_node = p_remote_sw->p_node;
 
   CL_ASSERT( p_node );
   CL_ASSERT( p_remote_node );
@@ -519,7 +519,7 @@ __osm_ucast_mgr_process_neighbor(
   /*
     Iterate through all the LIDs in the neighbor switch.
   */
-  max_lid_ho = osm_switch_get_max_lid_ho( p_remote_sw );
+  max_lid_ho = p_remote_sw->max_lid_ho;
 
   hops = OSM_NO_PATH;
   for( lid_ho = 1; lid_ho <= max_lid_ho; lid_ho++ )
@@ -773,7 +773,7 @@ __osm_ucast_mgr_process_port(
   */
   CL_ASSERT( max_lid_ho < osm_switch_get_fwd_tbl_size( p_sw ) );
 
-  node_guid = osm_node_get_node_guid(osm_switch_get_node_ptr( p_sw ) );
+  node_guid = osm_node_get_node_guid( p_sw->p_node );
 
   /*
     The lid matrix contains the number of hops to each
@@ -887,7 +887,7 @@ osm_ucast_mgr_set_fwd_table(
 
   CL_ASSERT( p_sw );
 
-  p_node = osm_switch_get_node_ptr( p_sw );
+  p_node = p_sw->p_node;
 
   CL_ASSERT( p_node );
 
@@ -899,7 +899,7 @@ osm_ucast_mgr_set_fwd_table(
     Set the top of the unicast forwarding table.
   */
   si = p_sw->switch_info;
-  lin_top = cl_hton16( osm_switch_get_max_lid_ho( p_sw ) );
+  lin_top = cl_hton16( p_sw->max_lid_ho );
   if (lin_top != si.lin_top)
   {
     set_swinfo_require = TRUE;
@@ -927,7 +927,7 @@ osm_ucast_mgr_set_fwd_table(
       osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
                "osm_ucast_mgr_set_fwd_table: "
                "Setting switch FT top to LID 0x%X\n",
-               osm_switch_get_max_lid_ho( p_sw ) );
+               p_sw->max_lid_ho );
     }
     
     context.si_context.light_sweep = FALSE;
diff --git a/osm/opensm/osm_ucast_updn.c b/osm/opensm/osm_ucast_updn.c
index 950bcb4..05b7347 100644
--- a/osm/opensm/osm_ucast_updn.c
+++ b/osm/opensm/osm_ucast_updn.c
@@ -267,7 +267,7 @@ __updn_bfs_by_node(
              "Visiting port GUID 0x%" PRIx64 "\n",
              cl_ntoh64(current_guid) );
     /* Go over all ports of the switch and find unvisited remote nodes */
-    for ( pn = 0; pn < osm_switch_get_num_ports(u->sw); pn++ )
+    for ( pn = 1; pn < u->sw->num_ports; pn++ )
     {
       osm_node_t *p_remote_node;
       struct updn_node *rem_u;
@@ -549,7 +549,7 @@ updn_subn_rank(
     u = (struct updn_node *)cl_qlist_remove_head(&list);
     /* Go over all remote nodes and rank them (if not already visited) */
     p_sw = u->sw;
-    num_ports = osm_switch_get_num_ports(p_sw);
+    num_ports = p_sw->num_ports;
     osm_log( p_log, OSM_LOG_DEBUG,
              "updn_subn_rank: "
              "Handling switch GUID 0x%" PRIx64 "\n",
@@ -743,7 +743,7 @@ expand_lid_matrices_for_lmc(
     {
       p_sw = (osm_switch_t *)p_next_sw;
       p_next_sw = cl_qmap_next(p_next_sw);
-      num_ports = osm_switch_get_num_ports(p_sw);
+      num_ports = p_sw->num_ports;
       for (port = 0; port < num_ports; port++) {
         hops = osm_switch_get_hop_count(p_sw, min_lid, port);
         for (lid = min_lid + 1 ; lid <= max_lid; lid++)
@@ -973,7 +973,7 @@ __osm_updn_find_root_nodes_by_min_hop(
 
     /* Clear Min Hop Table && FWD Tbls - This should caused opensm to
        rebuild it's FWD tables, post setting Min Hop Tables */
-    max_lid_ho = osm_switch_get_max_lid_ho(p_sw);
+    max_lid_ho = p_sw->max_lid_ho;
     /* Get base lid of switch by retrieving port 0 lid of node pointer */
     self_lid_ho = cl_ntoh16( osm_node_get_base_lid( p_sw->p_node, 0 ) );
     osm_log( &p_osm->log, OSM_LOG_DEBUG,
-- 
1.5.0.1.26.gf5a92





More information about the general mailing list