[ofa-general] [PATCH] opensm: remove redundant moving_to_master flag

Sasha Khapyorsky sashak at voltaire.com
Tue Feb 12 09:38:35 PST 2008


As currently used this flag just duplicates first_time_master_sweep flag.
Replace its usage.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/include/opensm/osm_subnet.h |    6 ------
 opensm/opensm/osm_console.c        |    2 --
 opensm/opensm/osm_sm_state_mgr.c   |   10 ++--------
 opensm/opensm/osm_state_mgr.c      |   19 +++++--------------
 4 files changed, 7 insertions(+), 30 deletions(-)

diff --git a/opensm/include/opensm/osm_subnet.h b/opensm/include/opensm/osm_subnet.h
index b5f2b6d..967c067 100644
--- a/opensm/include/opensm/osm_subnet.h
+++ b/opensm/include/opensm/osm_subnet.h
@@ -561,7 +561,6 @@ typedef struct _osm_subn {
 	boolean_t subnet_initialization_error;
 	boolean_t force_heavy_sweep;
 	boolean_t in_sweep_hop_0;
-	boolean_t moved_to_master_state;
 	boolean_t first_time_master_sweep;
 	boolean_t coming_out_of_standby;
 	unsigned need_update;
@@ -665,11 +664,6 @@ typedef struct _osm_subn {
 *     switch info we need to signal somehow not to continue
 *     the sweeping.
 *
-*  moved_to_master_state
-*     Used for the writing of "SUBNET UP" into /var/log/messages.
-*     Will be TRUE when the SM switches to Master state, and returned
-*     to FALSE once the sunbet is up.
-*
 *  first_time_master_sweep
 *     This flag is used for the PortInfo setting. On the first sweep as master
 *     (meaning after moving from Standby|Discovering state), the SM must send
diff --git a/opensm/opensm/osm_console.c b/opensm/opensm/osm_console.c
index 4597bde..7075817 100644
--- a/opensm/opensm/osm_console.c
+++ b/opensm/opensm/osm_console.c
@@ -335,13 +335,11 @@ static void print_status(osm_opensm_t * p_osm, FILE * out)
 			"   Ignore existing lfts           : %d\n"
 			"   Subnet Init errors             : %d\n"
 			"   In sweep hop 0                 : %d\n"
-			"   Moved to master state          : %d\n"
 			"   First time master sweep        : %d\n"
 			"   Coming out of standby          : %d\n",
 			p_osm->subn.ignore_existing_lfts,
 			p_osm->subn.subnet_initialization_error,
 			p_osm->subn.in_sweep_hop_0,
-			p_osm->subn.moved_to_master_state,
 			p_osm->subn.first_time_master_sweep,
 			p_osm->subn.coming_out_of_standby);
 		fprintf(out, "\n");
diff --git a/opensm/opensm/osm_sm_state_mgr.c b/opensm/opensm/osm_sm_state_mgr.c
index 9c1c1f3..eff9f19 100644
--- a/opensm/opensm/osm_sm_state_mgr.c
+++ b/opensm/opensm/osm_sm_state_mgr.c
@@ -334,11 +334,8 @@ ib_api_status_t osm_sm_state_mgr_process(osm_sm_t *sm,
 			/*
 			 * Update the state of the SM to MASTER
 			 */
-			/* Turn on the moved_to_master_state flag */
-			sm->p_subn->moved_to_master_state = TRUE;
 			/* Turn on the first_time_master_sweep flag */
-			if (sm->p_subn->first_time_master_sweep == FALSE)
-				sm->p_subn->first_time_master_sweep = TRUE;
+			sm->p_subn->first_time_master_sweep = TRUE;
 			sm->p_subn->sm_state = IB_SMINFO_STATE_MASTER;
 			osm_report_sm_state(sm);
 			/*
@@ -406,11 +403,8 @@ ib_api_status_t osm_sm_state_mgr_process(osm_sm_t *sm,
 			 * Update the state to MASTER, and start sweeping
 			 * OPTIONAL: send ACKNOWLEDGE
 			 */
-			/* Turn on the moved_to_master_state flag */
-			sm->p_subn->moved_to_master_state = TRUE;
 			/* Turn on the first_time_master_sweep flag */
-			if (sm->p_subn->first_time_master_sweep == FALSE)
-				sm->p_subn->first_time_master_sweep = TRUE;
+			sm->p_subn->first_time_master_sweep = TRUE;
 			/* Turn on the force_heavy_sweep - we want a
 			 * heavy sweep to occur on the first sweep of this SM. */
 			sm->p_subn->force_heavy_sweep = TRUE;
diff --git a/opensm/opensm/osm_state_mgr.c b/opensm/opensm/osm_state_mgr.c
index 2f3c366..7234053 100644
--- a/opensm/opensm/osm_state_mgr.c
+++ b/opensm/opensm/osm_state_mgr.c
@@ -77,15 +77,10 @@ static void __osm_state_mgr_up_msg(IN const osm_sm_t *sm)
 	/*
 	 * This message should be written only once - when the
 	 * SM moves to Master state and the subnet is up for
-	 * the first time. The change of state is marked with
-	 * the subnet flag moved_to_master_state
+	 * the first time.
 	 */
-	if (sm->p_subn->moved_to_master_state == TRUE) {
-		osm_log(sm->p_log, OSM_LOG_SYS, "SUBNET UP\n");	/* Format Waived */
-		/* clear the signal */
-		sm->p_subn->moved_to_master_state = FALSE;
-	} else
-		osm_log(sm->p_log, OSM_LOG_INFO, "SUBNET UP\n");	/* Format Waived */
+	osm_log(sm->p_log, sm->p_subn->first_time_master_sweep ?
+		OSM_LOG_SYS : OSM_LOG_INFO, "SUBNET UP\n");
 
 	osm_log_msg_box(sm->p_log, OSM_LOG_VERBOSE, __FUNCTION__,
 			sm->p_subn->opt.sweep_interval ?
@@ -1257,14 +1252,10 @@ _repeat_discovery:
 		osm_log_msg_box(sm->p_log, OSM_LOG_ERROR, __FUNCTION__,
 				"ERRORS DURING INITIALIZATION");
 	} else {
-		/* The subnet is up correctly - set the first_time_master_sweep
-		 * flag (if it is on) to FALSE. */
-		if (sm->p_subn->first_time_master_sweep == TRUE)
-			sm->p_subn->first_time_master_sweep = FALSE;
-			sm->p_subn->need_update = 0;
-
+		sm->p_subn->need_update = 0;
 		osm_dump_all(sm->p_subn->p_osm);
 		__osm_state_mgr_up_msg(sm);
+		sm->p_subn->first_time_master_sweep = FALSE;
 
 		if (osm_log_is_active(sm->p_log, OSM_LOG_VERBOSE))
 			osm_sa_db_file_dump(sm->p_subn->p_osm);
-- 
1.5.4.rc5




More information about the general mailing list