move port_order_list 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 12e932dadb2e883358a2e6354b9554e5372b9af6 Mon Sep 17 00:00:00 2001
From: Albert Chu <[EMAIL PROTECTED]>
Date: Fri, 12 Sep 2008 14:19:17 -0700
Subject: [PATCH] move port_order_list from osm_ucast_mgr into minhop routing


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

diff --git a/opensm/include/opensm/osm_ucast_mgr.h b/opensm/include/opensm/osm_ucast_mgr.h
index ac4fe27..ad7c36e 100644
--- a/opensm/include/opensm/osm_ucast_mgr.h
+++ b/opensm/include/opensm/osm_ucast_mgr.h
@@ -96,7 +96,6 @@ typedef struct osm_ucast_mgr {
 	osm_subn_t *p_subn;
 	osm_log_t *p_log;
 	cl_plock_t *p_lock;
-	cl_qlist_t port_order_list;
 	boolean_t any_change;
 	boolean_t some_hop_count_set;
 	uint8_t *lft_buf;
@@ -115,9 +114,6 @@ typedef struct osm_ucast_mgr {
 *	p_lock
 *		Pointer to the serializing lock.
 *
-*	port_order_list
-*		List of ports ordered for routing.
-*
 *	any_change
 *		Initialized to FALSE at the beginning of the algorithm,
 *		set to TRUE by osm_ucast_mgr_set_fwd_table() if any mad
diff --git a/opensm/opensm/osm_ucast_minhop.c b/opensm/opensm/osm_ucast_minhop.c
index 7e40437..9b0fd74 100644
--- a/opensm/opensm/osm_ucast_minhop.c
+++ b/opensm/opensm/osm_ucast_minhop.c
@@ -56,6 +56,7 @@
 
 struct osm_minhop_build_fwd_tables_data {
 	osm_ucast_mgr_t *p_mgr;
+	cl_qlist_t port_order_list;
 	boolean_t dor;
 };
 
@@ -357,7 +358,7 @@ __osm_ucast_minhop_process_tbl(IN cl_map_item_t * const p_map_item,
 	 */
 	lids_per_port = 1 << p_mgr->p_subn->opt.lmc;
 	for (i = 0; i < lids_per_port; i++) {
-		cl_qlist_t *list = &p_mgr->port_order_list;
+		cl_qlist_t *list = &p_minhop_fwd_data->port_order_list;
 		cl_list_item_t *item;
 		for (item = cl_qlist_head(list); item != cl_qlist_end(list);
 		     item = cl_qlist_next(item)) {
@@ -507,8 +508,13 @@ int osm_ucast_minhop_build_lid_matrices(IN osm_ucast_mgr_t * const p_mgr)
 
 static int add_guid_to_order_list(void *ctx, uint64_t guid, char *p)
 {
-	osm_ucast_mgr_t *m = ctx;
-	osm_port_t *port = osm_get_port_by_guid(m->p_subn, cl_hton64(guid));
+	struct osm_minhop_build_fwd_tables_data *p_minhop_fwd_data;
+	osm_ucast_mgr_t *m;
+	osm_port_t *port;
+
+	p_minhop_fwd_data = ctx;
+	m = p_minhop_fwd_data->p_mgr;
+	port = osm_get_port_by_guid(m->p_subn, cl_hton64(guid));
 
 	if (!port) {
 		OSM_LOG(m->p_log, OSM_LOG_DEBUG,
@@ -523,7 +529,7 @@ static int add_guid_to_order_list(void *ctx, uint64_t guid, char *p)
 		return 0;
 	}
 
-	cl_qlist_insert_tail(&m->port_order_list, &port->list_item);
+	cl_qlist_insert_tail(&p_minhop_fwd_data->port_order_list, &port->list_item);
 	port->flag = 1;
 
 	return 0;
@@ -532,10 +538,11 @@ static int add_guid_to_order_list(void *ctx, uint64_t guid, char *p)
 static void add_port_to_order_list(cl_map_item_t * const p_map_item, void *ctx)
 {
 	osm_port_t *port = (osm_port_t *)p_map_item;
-	osm_ucast_mgr_t *m = ctx;
+	struct osm_minhop_build_fwd_tables_data *p_minhop_fwd_data = ctx;
 
 	if (!port->flag)
-		cl_qlist_insert_tail(&m->port_order_list, &port->list_item);
+		cl_qlist_insert_tail(&p_minhop_fwd_data->port_order_list, 
+				     &port->list_item);
 	else
 		port->flag = 0;
 }
@@ -587,7 +594,12 @@ int osm_ucast_minhop_and_dor_build_fwd_tables(osm_ucast_mgr_t * const p_mgr,
 {
 	struct osm_minhop_build_fwd_tables_data minhop_fwd_data;
 
-	cl_qlist_init(&p_mgr->port_order_list);
+	memset(&minhop_fwd_data, 
+	       '\0', 
+	       sizeof(struct osm_minhop_build_fwd_tables_data));
+	cl_qlist_init(&minhop_fwd_data.port_order_list);
+	minhop_fwd_data.p_mgr = p_mgr;
+	minhop_fwd_data.dor = dor;
 
 	if (p_mgr->p_subn->opt.guid_routing_order_file) {
 		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
@@ -595,7 +607,8 @@ int osm_ucast_minhop_and_dor_build_fwd_tables(osm_ucast_mgr_t * const p_mgr,
 			p_mgr->p_subn->opt.guid_routing_order_file);
 
 		if (parse_node_map(p_mgr->p_subn->opt.guid_routing_order_file,
-				   add_guid_to_order_list, p_mgr))
+				   add_guid_to_order_list, 
+				   &minhop_fwd_data))
 			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR : "
 				"cannot parse guid routing order file \'%s\'\n",
 				p_mgr->p_subn->opt.guid_routing_order_file);
@@ -613,16 +626,14 @@ int osm_ucast_minhop_and_dor_build_fwd_tables(osm_ucast_mgr_t * const p_mgr,
 	}
 
 	cl_qmap_apply_func(&p_mgr->p_subn->port_guid_tbl,
-			   add_port_to_order_list, p_mgr);
-
-	minhop_fwd_data.p_mgr = p_mgr;
-	minhop_fwd_data.dor = dor;
+			   add_port_to_order_list,
+			   &minhop_fwd_data);
 
 	cl_qmap_apply_func(&p_mgr->p_subn->sw_guid_tbl,
 			   __osm_ucast_minhop_process_tbl,
 			   &minhop_fwd_data);
 
-	cl_qlist_remove_all(&p_mgr->port_order_list);
+	cl_qlist_remove_all(&minhop_fwd_data.port_order_list);
 
 	return 0;
 }
-- 
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