[ofa-general] [PATCH] opensm: cleanup discovery count functions

Sasha Khapyorsky sashak at voltaire.com
Thu May 31 13:47:05 PDT 2007


This removes discovery count functions for osm_port_t and osm_node_t
and makes discovery_count handling similar to osm_switch_t.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/include/opensm/osm_node.h  |   89 ------------------------------------
 opensm/include/opensm/osm_port.h  |   90 -------------------------------------
 opensm/opensm/osm_drop_mgr.c      |   10 ++--
 opensm/opensm/osm_node_info_rcv.c |    8 ++--
 opensm/opensm/osm_port_info_rcv.c |    2 +-
 opensm/opensm/osm_state_mgr.c     |    4 +-
 6 files changed, 12 insertions(+), 191 deletions(-)

diff --git a/opensm/include/opensm/osm_node.h b/opensm/include/opensm/osm_node.h
index a841de7..b2d03a2 100644
--- a/opensm/include/opensm/osm_node.h
+++ b/opensm/include/opensm/osm_node.h
@@ -591,95 +591,6 @@ osm_node_init_physp(
 *	Node object, Physical Port object.
 *********/
 
-/****f* OpenSM: Node/osm_node_discovery_count_get
-* NAME
-*	osm_node_discovery_count_get
-*
-* DESCRIPTION
-*	Returns a pointer to the physical port object at the
-*	specified local port number.
-*
-* SYNOPSIS
-*/
-static inline uint32_t
-osm_node_discovery_count_get(
-	IN const osm_node_t* const p_node )
-{
-	return( p_node->discovery_count );
-}
-/*
-* PARAMETERS
-*	p_node
-*		[in] Pointer to an osm_node_t object.
-*
-* RETURN VALUES
-*	Returns the discovery count for this node.
-*
-* NOTES
-*
-* SEE ALSO
-*	Node object
-*********/
-
-/****f* OpenSM: Node/osm_node_discovery_count_reset
-* NAME
-*	osm_node_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_node_discovery_count_reset(
-	IN osm_node_t* const p_node )
-{
-	p_node->discovery_count = 0;
-}
-/*
-* PARAMETERS
-*	p_node
-*		[in] Pointer to an osm_node_t object.
-*
-* RETURN VALUES
-*	None.
-*
-* NOTES
-*
-* SEE ALSO
-*	Node object
-*********/
-
-/****f* OpenSM: Node/osm_node_discovery_count_inc
-* NAME
-*	osm_node_discovery_count_inc
-*
-* DESCRIPTION
-*	Increments the discovery count for this node.
-*
-* SYNOPSIS
-*/
-static inline void
-osm_node_discovery_count_inc(
-	IN osm_node_t* const p_node )
-{
-	p_node->discovery_count++;
-}
-/*
-* PARAMETERS
-*	p_node
-*		[in] Pointer to an osm_node_t object.
-*
-* RETURN VALUES
-*	None.
-*
-* NOTES
-*
-* SEE ALSO
-*	Node object
-*********/
-
 /****f* OpenSM: Node/osm_node_get_node_guid
 * NAME
 *	osm_node_get_node_guid
diff --git a/opensm/include/opensm/osm_port.h b/opensm/include/opensm/osm_port.h
index df9065e..54ebcfc 100644
--- a/opensm/include/opensm/osm_port.h
+++ b/opensm/include/opensm/osm_port.h
@@ -1556,96 +1556,6 @@ osm_port_add_new_physp(
 *	Port
 *********/
 
-/****f* OpenSM: Port/osm_port_discovery_count_reset
-* NAME
-*	osm_port_discovery_count_reset
-*
-* DESCRIPTION
-*	Resets the discovery count for this Port to zero.
-*	This operation should be performed at the start of a sweep.
-*
-* SYNOPSIS
-*/
-static inline void
-osm_port_discovery_count_reset(
-	IN osm_port_t* const p_port )
-{
-	p_port->discovery_count = 0;
-}
-/*
-* PARAMETERS
-*	p_port
-*		[in] Pointer to an osm_port_t object.
-*
-* RETURN VALUES
-*	None.
-*
-* NOTES
-*
-* SEE ALSO
-*	Port object
-*********/
-
-/****f* OpenSM: Port/osm_port_discovery_count_get
-* NAME
-*	osm_port_discovery_count_get
-*
-* DESCRIPTION
-*	Returns the number of times this port has been discovered
-*	since the last time the discovery count was reset.
-*
-* SYNOPSIS
-*/
-static inline uint32_t
-osm_port_discovery_count_get(
-	IN const osm_port_t* const p_port )
-{
-	return( p_port->discovery_count );
-}
-/*
-* PARAMETERS
-*	p_port
-*		[in] Pointer to an osm_port_t object.
-*
-* RETURN VALUES
-*	Returns the number of times this port has been discovered
-*	since the last time the discovery count was reset.
-*
-* NOTES
-*
-* SEE ALSO
-*	Port object
-*********/
-
-/****f* OpenSM: Port/osm_port_discovery_count_inc
-* NAME
-*	osm_port_discovery_count_inc
-*
-* DESCRIPTION
-*	Increments the discovery count for this Port.
-*
-* SYNOPSIS
-*/
-static inline void
-osm_port_discovery_count_inc(
-	IN osm_port_t* const p_port )
-{
-	p_port->discovery_count++;
-}
-/*
-* PARAMETERS
-*	p_port
-*		[in] Pointer to an osm_port_t object.
-*
-* RETURN VALUES
-*	None.
-*
-* NOTES
-*
-* SEE ALSO
-*	Port object
-*********/
-
 /****f* OpenSM: Port/osm_port_add_mgrp
 * NAME
 *	osm_port_add_mgrp
diff --git a/opensm/opensm/osm_drop_mgr.c b/opensm/opensm/osm_drop_mgr.c
index 7689728..9d91b6b 100644
--- a/opensm/opensm/osm_drop_mgr.c
+++ b/opensm/opensm/osm_drop_mgr.c
@@ -161,7 +161,7 @@ drop_mgr_clean_physp(
          the remote port was recognized, and its state is ACTIVE.
          If this is just a "hiccup" - force a heavy sweep in the next sweep.
          We don't want to lose that part of the subnet. */
-      if (osm_port_discovery_count_get( p_remote_port ) &&
+      if (p_remote_port->discovery_count &&
           osm_physp_get_port_state( p_remote_physp ) == IB_LINK_ACTIVE )
       {
         osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
@@ -179,7 +179,7 @@ drop_mgr_clean_physp(
          discovery count of the remote port. */
       if ( !p_remote_physp->p_node->sw )
       {
-        osm_port_discovery_count_reset( p_remote_port );
+        p_remote_port->discovery_count = 0;
         osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
                  "drop_mgr_clean_physp: Resetting discovery count of node: "
                  "0x%016" PRIx64 " port num:0x%X\n",
@@ -534,7 +534,7 @@ __osm_drop_mgr_check_node(
     goto Exit;
   }
 
-  if ( osm_port_discovery_count_get( p_port ) == 0 )
+  if ( p_port->discovery_count == 0 )
   {
     osm_log( p_mgr->p_log, OSM_LOG_VERBOSE,
              "__osm_drop_mgr_check_node: "
@@ -601,7 +601,7 @@ osm_drop_mgr_process(
       If not, it is unreachable in the current subnet, and
       should therefore be removed from the subnet object.
     */
-    if( osm_node_discovery_count_get( p_node ) == 0 )
+    if( p_node->discovery_count == 0 )
       __osm_drop_mgr_process_node( p_mgr, p_node );
   }
 
@@ -655,7 +655,7 @@ osm_drop_mgr_process(
     /*
       If the port is unreachable, remove it from the guid table.
     */
-    if( osm_port_discovery_count_get( p_port ) == 0 )
+    if( p_port->discovery_count == 0 )
       __osm_drop_mgr_remove_port( p_mgr, p_port );
   }
 
diff --git a/opensm/opensm/osm_node_info_rcv.c b/opensm/opensm/osm_node_info_rcv.c
index 2486ffb..1eca625 100644
--- a/opensm/opensm/osm_node_info_rcv.c
+++ b/opensm/opensm/osm_node_info_rcv.c
@@ -641,7 +641,7 @@ __osm_ni_rcv_process_existing_switch(
     if the SwitchInfo mad didn't reach the SM) then we want
     to retry to probe the switch.
   */
-  if( osm_node_discovery_count_get( p_node ) == 1 )
+  if( p_node->discovery_count == 1 )
     __osm_ni_rcv_process_switch( p_rcv, p_node, p_madw );
   else
   {
@@ -862,7 +862,7 @@ __osm_ni_rcv_process_new(
   else
     __osm_ni_rcv_set_links( p_rcv, p_node, port_num, p_ni_context );
 
-  osm_node_discovery_count_inc( p_node );
+  p_node->discovery_count++;
   __osm_ni_rcv_get_node_desc( p_rcv, p_node, p_madw );
 
   switch( p_ni->node_type )
@@ -916,14 +916,14 @@ __osm_ni_rcv_process_existing(
              ib_get_node_type_str(p_ni->node_type),
              cl_ntoh64( p_ni->node_guid ),
              cl_ntoh64( p_smp->trans_id ),
-             osm_node_discovery_count_get( p_node ) );
+             p_node->discovery_count );
   }
 
   /*
     If we haven't already encountered this existing node
     on this particular sweep, then process further.
   */
-  osm_node_discovery_count_inc( p_node );
+  p_node->discovery_count++;
 
   switch( p_ni->node_type )
   {
diff --git a/opensm/opensm/osm_port_info_rcv.c b/opensm/opensm/osm_port_info_rcv.c
index a53044f..7b241d6 100644
--- a/opensm/opensm/osm_port_info_rcv.c
+++ b/opensm/opensm/osm_port_info_rcv.c
@@ -724,7 +724,7 @@ osm_pi_rcv_process(
   }
   else
   {
-    osm_port_discovery_count_inc( p_port );
+    p_port->discovery_count++;
 
     /*
       This PortInfo arrived because we did a Get() method,
diff --git a/opensm/opensm/osm_state_mgr.c b/opensm/opensm/osm_state_mgr.c
index 73980b8..a9aef36 100644
--- a/opensm/opensm/osm_state_mgr.c
+++ b/opensm/opensm/osm_state_mgr.c
@@ -524,7 +524,7 @@ __osm_state_mgr_reset_node_count(
                cl_ntoh64( osm_node_get_node_guid( p_node ) ) );
    }
 
-   osm_node_discovery_count_reset( p_node );
+   p_node->discovery_count = 0;
 }
 
 /**********************************************************************
@@ -545,7 +545,7 @@ __osm_state_mgr_reset_port_count(
                cl_ntoh64( osm_port_get_guid( p_port ) ) );
    }
 
-   osm_port_discovery_count_reset( p_port );
+   p_port->discovery_count = 0;
 }
 
 /**********************************************************************
-- 
1.5.2.171.gf509




More information about the general mailing list