[ofa-general] [PATCH] opensm: detect fast switch reset and force LFT update

Sasha Khapyorsky sashak at voltaire.com
Tue Jul 24 11:36:42 PDT 2007


Here we are trying to detect "fast" (so that OpenSM doesn't not detect
down state in sweep period) switch reset by validating PortState of all
ports (for <= INIT). If detected p_sw->need_update flag still remain
"on". In this case this switch forwarding tables will be updated
unconditionally.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/include/opensm/osm_switch.h |    5 +++++
 opensm/opensm/osm_port_info_rcv.c  |    3 +++
 opensm/opensm/osm_state_mgr.c      |    1 +
 opensm/opensm/osm_switch.c         |    1 +
 opensm/opensm/osm_ucast_mgr.c      |    3 ++-
 5 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/opensm/include/opensm/osm_switch.h b/opensm/include/opensm/osm_switch.h
index 5b2b19e..9364d2c 100644
--- a/opensm/include/opensm/osm_switch.h
+++ b/opensm/include/opensm/osm_switch.h
@@ -112,6 +112,7 @@ typedef struct _osm_switch
 	osm_fwd_tbl_t				fwd_tbl;
 	osm_mcast_tbl_t				mcast_tbl;
 	uint32_t				discovery_count;
+	unsigned				need_update;
 	void					*priv;
 } osm_switch_t;
 /*
@@ -152,6 +153,10 @@ typedef struct _osm_switch
 *		during the current fabric sweep.  This number is reset
 *		to zero at the start of a sweep.
 *
+*	need_update
+*		When set indicates that switch was probably reset, so
+*		fwd tables and rest cached data should be flushed
+*
 * SEE ALSO
 *	Switch object
 *********/
diff --git a/opensm/opensm/osm_port_info_rcv.c b/opensm/opensm/osm_port_info_rcv.c
index adece65..6fe2d1d 100644
--- a/opensm/opensm/osm_port_info_rcv.c
+++ b/opensm/opensm/osm_port_info_rcv.c
@@ -337,6 +337,9 @@ __osm_pi_rcv_process_switch_port(
     }
   }
 
+  if (ib_port_info_get_port_state(p_pi) > IB_LINK_INIT && p_node->sw)
+    p_node->sw->need_update = 0;
+
   /*
     Update the PortInfo attribute.
   */
diff --git a/opensm/opensm/osm_state_mgr.c b/opensm/opensm/osm_state_mgr.c
index 0181c0f..7efbe2a 100644
--- a/opensm/opensm/osm_state_mgr.c
+++ b/opensm/opensm/osm_state_mgr.c
@@ -565,6 +565,7 @@ __osm_state_mgr_reset_switch_count(
    }
 
    p_sw->discovery_count = 0;
+   p_sw->need_update = 1;
 }
 
 /**********************************************************************
diff --git a/opensm/opensm/osm_switch.c b/opensm/opensm/osm_switch.c
index a5a6fb7..2e170fc 100644
--- a/opensm/opensm/osm_switch.c
+++ b/opensm/opensm/osm_switch.c
@@ -104,6 +104,7 @@ osm_switch_init(
   p_sw->p_node = p_node;
   p_sw->switch_info = *p_si;
   p_sw->num_ports = num_ports;
+  p_sw->need_update = 1;
 
   status = osm_fwd_tbl_init( &p_sw->fwd_tbl, p_si );
   if( status != IB_SUCCESS )
diff --git a/opensm/opensm/osm_ucast_mgr.c b/opensm/opensm/osm_ucast_mgr.c
index b44a3ba..a8fc649 100644
--- a/opensm/opensm/osm_ucast_mgr.c
+++ b/opensm/opensm/osm_ucast_mgr.c
@@ -811,7 +811,8 @@ osm_ucast_mgr_set_fwd_table(
        osm_switch_get_fwd_tbl_block( p_sw, block_id_ho, block ) ;
        block_id_ho++ )
   {
-    if (!memcmp(block, p_mgr->lft_buf + block_id_ho * 64, 64))
+    if (!p_sw->need_update &&
+        !memcmp(block, p_mgr->lft_buf + block_id_ho * 64, 64))
       continue;
 
     if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
-- 
1.5.3.rc2.29.gc4640f




More information about the general mailing list