move some_hop_count_set out of osm_ucast_mgr_t into minhop routing
engine.  Unlike the is_dor flag, this one wasn't routing necessary,
but made things easier for later.

Al

-- 
Albert Chu
[EMAIL PROTECTED]
925-422-5311
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory
>From 750c48a59394cf310a828679bcc94da051a92f80 Mon Sep 17 00:00:00 2001
From: Albert Chu <[EMAIL PROTECTED]>
Date: Fri, 12 Sep 2008 14:19:17 -0700
Subject: [PATCH] move some_hop_count_set from osm_ucast_mgr to minhop routing


Signed-off-by: Albert Chu <[EMAIL PROTECTED]>
---
 opensm/include/opensm/osm_ucast_mgr.h |    6 -----
 opensm/opensm/osm_ucast_minhop.c      |   37 +++++++++++++++++++++++++--------
 2 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/opensm/include/opensm/osm_ucast_mgr.h b/opensm/include/opensm/osm_ucast_mgr.h
index ad7c36e..234b965 100644
--- a/opensm/include/opensm/osm_ucast_mgr.h
+++ b/opensm/include/opensm/osm_ucast_mgr.h
@@ -97,7 +97,6 @@ typedef struct osm_ucast_mgr {
 	osm_log_t *p_log;
 	cl_plock_t *p_lock;
 	boolean_t any_change;
-	boolean_t some_hop_count_set;
 	uint8_t *lft_buf;
 } osm_ucast_mgr_t;
 /*
@@ -119,11 +118,6 @@ typedef struct osm_ucast_mgr {
 *		set to TRUE by osm_ucast_mgr_set_fwd_table() if any mad
 *		was sent.
 *
-*	some_hop_count_set
-*		Initialized to FALSE at the beginning of each the min hop
-*		tables calculation iteration cycle, set to TRUE to indicate
-*		that some hop count changes were done.
-*
 *	lft_buf
 *		LFT buffer - used during LFT calculation/setup.
 *
diff --git a/opensm/opensm/osm_ucast_minhop.c b/opensm/opensm/osm_ucast_minhop.c
index 9b0fd74..0122f98 100644
--- a/opensm/opensm/osm_ucast_minhop.c
+++ b/opensm/opensm/osm_ucast_minhop.c
@@ -54,6 +54,16 @@
 #include <opensm/osm_msgdef.h>
 #include <opensm/osm_opensm.h>
 
+struct osm_minhop_build_lid_matrices_data {
+	osm_ucast_mgr_t *p_mgr;
+	/* some_hop_count_set
+	 * Initialized to FALSE at the beginning of each the min hop
+	 * tables calculation iteration cycle, set to TRUE to indicate
+	 * that some hop count changes were done.
+	 */
+	boolean_t some_hop_count_set;
+};
+
 struct osm_minhop_build_fwd_tables_data {
 	osm_ucast_mgr_t *p_mgr;
 	cl_qlist_t port_order_list;
@@ -98,7 +108,8 @@ __osm_ucast_minhop_process_neighbor(IN osm_ucast_mgr_t * const p_mgr,
 				    IN osm_switch_t * const p_this_sw,
 				    IN osm_switch_t * const p_remote_sw,
 				    IN const uint8_t port_num,
-				    IN const uint8_t remote_port_num)
+				    IN const uint8_t remote_port_num,
+				    IN struct osm_minhop_build_lid_matrices_data *p_minhop_lid_data)
 {
 	osm_switch_t *p_sw, *p_next_sw;
 	uint16_t lid_ho;
@@ -133,7 +144,7 @@ __osm_ucast_minhop_process_neighbor(IN osm_ucast_mgr_t * const p_mgr,
 					PRIx64 "\n", lid_ho,
 					cl_ntoh64(osm_node_get_node_guid
 						  (p_this_sw->p_node)));
-			p_mgr->some_hop_count_set = TRUE;
+			p_minhop_lid_data->some_hop_count_set = TRUE;
 		}
 	}
 
@@ -386,7 +397,8 @@ __osm_ucast_minhop_process_neighbors(IN cl_map_item_t * const p_map_item,
 				     IN void *context)
 {
 	osm_switch_t *const p_sw = (osm_switch_t *) p_map_item;
-	osm_ucast_mgr_t *const p_mgr = (osm_ucast_mgr_t *) context;
+	struct osm_minhop_build_lid_matrices_data *p_minhop_lid_data;
+	osm_ucast_mgr_t * p_mgr;
 	osm_node_t *p_node;
 	osm_node_t *p_remote_node;
 	uint32_t port_num;
@@ -394,6 +406,9 @@ __osm_ucast_minhop_process_neighbors(IN cl_map_item_t * const p_map_item,
 	uint32_t num_ports;
 	osm_physp_t *p_physp;
 
+	p_minhop_lid_data = context;
+	p_mgr = p_minhop_lid_data->p_mgr;
+
 	OSM_LOG_ENTER(p_mgr->p_log);
 
 	p_node = p_sw->p_node;
@@ -426,8 +441,8 @@ __osm_ucast_minhop_process_neighbors(IN cl_map_item_t * const p_map_item,
 			__osm_ucast_minhop_process_neighbor(p_mgr, p_sw,
 							    p_remote_node->sw,
 							    (uint8_t) port_num,
-							    remote_port_num);
-
+							    remote_port_num,
+							    p_minhop_lid_data);
 		}
 	}
 
@@ -441,12 +456,16 @@ int osm_ucast_minhop_build_lid_matrices(IN osm_ucast_mgr_t * const p_mgr)
 	uint32_t i;
 	uint32_t iteration_max;
 	cl_qmap_t *p_sw_guid_tbl;
+	struct osm_minhop_build_lid_matrices_data minhop_lid_data;
 
 	p_sw_guid_tbl = &p_mgr->p_subn->sw_guid_tbl;
 
 	OSM_LOG(p_mgr->p_log, OSM_LOG_VERBOSE,
 		"Starting switches' Min Hop Table Assignment\n");
 
+	memset(&minhop_lid_data, '\0', sizeof(struct osm_minhop_build_lid_matrices_data));
+	minhop_lid_data.p_mgr = p_mgr;
+
 	/*
 	   Set the switch matrices for each switch's own port 0 LID(s)
 	   then set the lid matrices for the each switch's leaf nodes.
@@ -488,13 +507,13 @@ int osm_ucast_minhop_build_lid_matrices(IN osm_ucast_mgr_t * const p_mgr)
 		   if non of the switches was set will exit the
 		   while loop
 		 */
-		p_mgr->some_hop_count_set = TRUE;
-		for (i = 0; (i < iteration_max) && p_mgr->some_hop_count_set;
+		minhop_lid_data.some_hop_count_set = TRUE;
+		for (i = 0; (i < iteration_max) && minhop_lid_data.some_hop_count_set;
 		     i++) {
-			p_mgr->some_hop_count_set = FALSE;
+			minhop_lid_data.some_hop_count_set = FALSE;
 			cl_qmap_apply_func(p_sw_guid_tbl,
 					   __osm_ucast_minhop_process_neighbors,
-					   p_mgr);
+					   &minhop_lid_data);
 		}
 		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 			"Min-hop propagated in %d steps\n", i);
-- 
1.5.4.5

_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to