pass a struct osm_routing_engine to all routing engine setup
functions to prepare for routing chaining.

Al

-- 
Albert Chu
[EMAIL PROTECTED]
925-422-5311
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory
>From 9f0654b5bc1c9e6a45a4d7a306fe7af4b4b4204a Mon Sep 17 00:00:00 2001
From: Albert Chu <[EMAIL PROTECTED]>
Date: Fri, 12 Sep 2008 14:22:34 -0700
Subject: [PATCH] pass osm_routing_engine to routing setup functions


Signed-off-by: Albert Chu <[EMAIL PROTECTED]>
---
 opensm/include/opensm/osm_ucast_dor.h    |    6 +++++-
 opensm/include/opensm/osm_ucast_file.h   |    6 +++++-
 opensm/include/opensm/osm_ucast_ftree.h  |    6 +++++-
 opensm/include/opensm/osm_ucast_lash.h   |    6 +++++-
 opensm/include/opensm/osm_ucast_minhop.h |    6 +++++-
 opensm/include/opensm/osm_ucast_updn.h   |    6 +++++-
 opensm/opensm/osm_opensm.c               |    9 +++++----
 opensm/opensm/osm_ucast_dor.c            |    9 +++++----
 opensm/opensm/osm_ucast_file.c           |    9 +++++----
 opensm/opensm/osm_ucast_ftree.c          |   11 ++++++-----
 opensm/opensm/osm_ucast_lash.c           |   11 ++++++-----
 opensm/opensm/osm_ucast_minhop.c         |    9 +++++----
 opensm/opensm/osm_ucast_updn.c           |   11 ++++++-----
 13 files changed, 68 insertions(+), 37 deletions(-)

diff --git a/opensm/include/opensm/osm_ucast_dor.h b/opensm/include/opensm/osm_ucast_dor.h
index 598163c..03d112b 100644
--- a/opensm/include/opensm/osm_ucast_dor.h
+++ b/opensm/include/opensm/osm_ucast_dor.h
@@ -58,9 +58,13 @@ BEGIN_C_DECLS
 *
 * SYNOPSIS
 */
-int osm_ucast_dor_setup(IN osm_opensm_t * p_osm);
+int osm_ucast_dor_setup(IN struct osm_routing_engine *routing_engine,
+			IN osm_opensm_t * p_osm);
 /*
 * PARAMETERS
+*	routing_engine
+*		[in] Pointer to a routing engine struct.
+*
 *	p_mgr
 *		[in] Pointer to an osm_opensm_t object.
 *
diff --git a/opensm/include/opensm/osm_ucast_file.h b/opensm/include/opensm/osm_ucast_file.h
index ccc02a7..10003dd 100644
--- a/opensm/include/opensm/osm_ucast_file.h
+++ b/opensm/include/opensm/osm_ucast_file.h
@@ -58,9 +58,13 @@ BEGIN_C_DECLS
 *
 * SYNOPSIS
 */
-int osm_ucast_file_setup(IN osm_opensm_t * p_osm);
+int osm_ucast_file_setup(IN struct osm_routing_engine *routing_engine,
+			 IN osm_opensm_t * p_osm);
 /*
 * PARAMETERS
+*	routing_engine
+*		[in] Pointer to a routing engine struct.
+*
 *	p_mgr
 *		[in] Pointer to an osm_opensm_t object.
 *
diff --git a/opensm/include/opensm/osm_ucast_ftree.h b/opensm/include/opensm/osm_ucast_ftree.h
index b2cf0e5..7c6ab3a 100644
--- a/opensm/include/opensm/osm_ucast_ftree.h
+++ b/opensm/include/opensm/osm_ucast_ftree.h
@@ -58,9 +58,13 @@ BEGIN_C_DECLS
 *
 * SYNOPSIS
 */
-int osm_ucast_ftree_setup(IN osm_opensm_t * p_osm);
+int osm_ucast_ftree_setup(IN struct osm_routing_engine *routing_engine,
+			  IN osm_opensm_t * p_osm);
 /*
 * PARAMETERS
+*	routing_engine
+*		[in] Pointer to a routing engine struct.
+*
 *	p_mgr
 *		[in] Pointer to an osm_opensm_t object.
 *
diff --git a/opensm/include/opensm/osm_ucast_lash.h b/opensm/include/opensm/osm_ucast_lash.h
index 93adbf0..5af58fa 100644
--- a/opensm/include/opensm/osm_ucast_lash.h
+++ b/opensm/include/opensm/osm_ucast_lash.h
@@ -58,9 +58,13 @@ BEGIN_C_DECLS
 *
 * SYNOPSIS
 */
-int osm_ucast_lash_setup(IN osm_opensm_t * p_osm);
+int osm_ucast_lash_setup(IN struct osm_routing_engine *routing_engine,
+			 IN osm_opensm_t * p_osm);
 /*
 * PARAMETERS
+*	routing_engine
+*		[in] Pointer to a routing engine struct.
+*
 *	p_mgr
 *		[in] Pointer to an osm_opensm_t object.
 *
diff --git a/opensm/include/opensm/osm_ucast_minhop.h b/opensm/include/opensm/osm_ucast_minhop.h
index ca0f98b..68136ba 100644
--- a/opensm/include/opensm/osm_ucast_minhop.h
+++ b/opensm/include/opensm/osm_ucast_minhop.h
@@ -169,9 +169,13 @@ void osm_ucast_minhop_no_failure_build_fwd_tables(IN osm_opensm_t * const p_osm)
 *
 * SYNOPSIS
 */
-int osm_ucast_minhop_setup(IN osm_opensm_t * p_osm);
+int osm_ucast_minhop_setup(IN struct osm_routing_engine *routing_engine,
+			   IN osm_opensm_t * p_osm);
 /*
 * PARAMETERS
+*	routing_engine
+*		[in] Pointer to a routing engine struct.
+*
 *	p_osm
 *		[in] Pointer to an osm_opensm_t object.
 *
diff --git a/opensm/include/opensm/osm_ucast_updn.h b/opensm/include/opensm/osm_ucast_updn.h
index cd537a0..52b1a96 100644
--- a/opensm/include/opensm/osm_ucast_updn.h
+++ b/opensm/include/opensm/osm_ucast_updn.h
@@ -58,9 +58,13 @@ BEGIN_C_DECLS
 *
 * SYNOPSIS
 */
-int osm_ucast_updn_setup(IN osm_opensm_t * p_osm);
+int osm_ucast_updn_setup(IN struct osm_routing_engine *routing_engine,
+			 IN osm_opensm_t * p_osm);
 /*
 * PARAMETERS
+*	routing_engine
+*		[in] Pointer to a routing engine struct
+*
 *	p_mgr
 *		[in] Pointer to an osm_opensm_t object.
 *
diff --git a/opensm/opensm/osm_opensm.c b/opensm/opensm/osm_opensm.c
index 6b64fca..48e75f5 100644
--- a/opensm/opensm/osm_opensm.c
+++ b/opensm/opensm/osm_opensm.c
@@ -67,7 +67,8 @@
 
 struct routing_engine_module {
 	const char *name;
-	int (*setup) (osm_opensm_t * p_osm);
+	int (*setup) (struct osm_routing_engine *routing_engine,
+		      osm_opensm_t * p_osm);
 };
 
 const static struct routing_engine_module routing_modules[] = {
@@ -139,14 +140,14 @@ static void setup_routing_engine(osm_opensm_t * p_osm, const char *name)
 	const struct routing_engine_module *r;
 
 	if (!name) {
-		osm_ucast_minhop_setup(p_osm);
+		osm_ucast_minhop_setup(&p_osm->routing_engine, p_osm);
 		return;
 	}
 
 	for (r = routing_modules; r->name && *r->name; r++) {
 		if (!strcmp(r->name, name)) {
 			p_osm->routing_engine.name = r->name;
-			if (r->setup(p_osm)) {
+			if (r->setup(&p_osm->routing_engine, p_osm)) {
 				OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,
 					"setup of routing"
 					" engine \'%s\' failed\n", name);
@@ -163,7 +164,7 @@ static void setup_routing_engine(osm_opensm_t * p_osm, const char *name)
 		"cannot find or setup routing engine"
 		" \'%s\'. Minhop will be used instead\n",
 		name);
-	osm_ucast_minhop_setup(p_osm);
+	osm_ucast_minhop_setup(&p_osm->routing_engine, p_osm);
 }
 
 /**********************************************************************
diff --git a/opensm/opensm/osm_ucast_dor.c b/opensm/opensm/osm_ucast_dor.c
index 79d2697..70d3473 100644
--- a/opensm/opensm/osm_ucast_dor.c
+++ b/opensm/opensm/osm_ucast_dor.c
@@ -47,10 +47,11 @@ int osm_ucast_dor_build_fwd_tables(void *context)
         return osm_ucast_minhop_and_dor_build_fwd_tables(p_osm, TRUE, TRUE, TRUE);
 }
 
-int osm_ucast_dor_setup(osm_opensm_t * p_osm)
+int osm_ucast_dor_setup(struct osm_routing_engine *routing_engine,
+			osm_opensm_t * p_osm)
 {
-	p_osm->routing_engine.context = (void *)p_osm;
-	p_osm->routing_engine.build_lid_matrices = osm_ucast_minhop_build_lid_matrices;
-	p_osm->routing_engine.ucast_build_fwd_tables = osm_ucast_dor_build_fwd_tables;
+	routing_engine->context = (void *)p_osm;
+	routing_engine->build_lid_matrices = osm_ucast_minhop_build_lid_matrices;
+	routing_engine->ucast_build_fwd_tables = osm_ucast_dor_build_fwd_tables;
 	return 0;
 }
diff --git a/opensm/opensm/osm_ucast_file.c b/opensm/opensm/osm_ucast_file.c
index 7a6bb91..0076afa 100644
--- a/opensm/opensm/osm_ucast_file.c
+++ b/opensm/opensm/osm_ucast_file.c
@@ -400,10 +400,11 @@ static int do_lid_matrix_file_load(void *context)
 	return 0;
 }
 
-int osm_ucast_file_setup(osm_opensm_t * p_osm)
+int osm_ucast_file_setup(struct osm_routing_engine *routing_engine,
+			 osm_opensm_t * p_osm)
 {
-	p_osm->routing_engine.context = (void *)p_osm;
-	p_osm->routing_engine.build_lid_matrices = do_lid_matrix_file_load;
-	p_osm->routing_engine.ucast_build_fwd_tables = do_ucast_file_load;
+	routing_engine->context = (void *)p_osm;
+	routing_engine->build_lid_matrices = do_lid_matrix_file_load;
+	routing_engine->ucast_build_fwd_tables = do_ucast_file_load;
 	return 0;
 }
diff --git a/opensm/opensm/osm_ucast_ftree.c b/opensm/opensm/osm_ucast_ftree.c
index 1d3233c..83da01c 100644
--- a/opensm/opensm/osm_ucast_ftree.c
+++ b/opensm/opensm/osm_ucast_ftree.c
@@ -3726,7 +3726,8 @@ static void __osm_ftree_delete(IN void *context)
 /***************************************************
  ***************************************************/
 
-int osm_ucast_ftree_setup(osm_opensm_t * p_osm)
+int osm_ucast_ftree_setup(struct osm_routing_engine *routing_engine,
+			  osm_opensm_t * p_osm)
 {
 	ftree_fabric_t *p_ftree = __osm_ftree_fabric_create();
 	if (!p_ftree)
@@ -3734,10 +3735,10 @@ int osm_ucast_ftree_setup(osm_opensm_t * p_osm)
 
 	p_ftree->p_osm = p_osm;
 
-	p_osm->routing_engine.context = (void *)p_ftree;
-	p_osm->routing_engine.build_lid_matrices = __osm_ftree_construct_fabric;
-	p_osm->routing_engine.ucast_build_fwd_tables = __osm_ftree_do_routing;
-	p_osm->routing_engine.delete = __osm_ftree_delete;
+	routing_engine->context = (void *)p_ftree;
+	routing_engine->build_lid_matrices = __osm_ftree_construct_fabric;
+	routing_engine->ucast_build_fwd_tables = __osm_ftree_do_routing;
+	routing_engine->delete = __osm_ftree_delete;
 	return 0;
 }
 
diff --git a/opensm/opensm/osm_ucast_lash.c b/opensm/opensm/osm_ucast_lash.c
index 052b900..c73b399 100644
--- a/opensm/opensm/osm_ucast_lash.c
+++ b/opensm/opensm/osm_ucast_lash.c
@@ -1367,16 +1367,17 @@ static int osm_ucast_lash_build_lid_matrices(void *context)
 	osm_ucast_minhop_build_lid_matrices(p_lash->p_osm);
 }
 
-int osm_ucast_lash_setup(osm_opensm_t * p_osm)
+int osm_ucast_lash_setup(struct osm_routing_engine *routing_engine,
+			 osm_opensm_t * p_osm)
 {
 	lash_t *p_lash = lash_create(p_osm);
 	if (!p_lash)
 		return -1;
 
-	p_osm->routing_engine.context = p_lash;
-	p_osm->routing_engine.build_lid_matrices = osm_ucast_lash_build_lid_matrices;
-	p_osm->routing_engine.ucast_build_fwd_tables = lash_process;
-	p_osm->routing_engine.delete = lash_delete;
+	routing_engine->context = p_lash;
+	routing_engine->build_lid_matrices = osm_ucast_lash_build_lid_matrices;
+	routing_engine->ucast_build_fwd_tables = lash_process;
+	routing_engine->delete = lash_delete;
 
 	return 0;
 }
diff --git a/opensm/opensm/osm_ucast_minhop.c b/opensm/opensm/osm_ucast_minhop.c
index 490eabd..aaafc9f 100644
--- a/opensm/opensm/osm_ucast_minhop.c
+++ b/opensm/opensm/osm_ucast_minhop.c
@@ -676,10 +676,11 @@ void osm_ucast_minhop_no_failure_build_fwd_tables(IN osm_opensm_t * const p_osm)
 	osm_ucast_minhop_and_dor_build_fwd_tables(p_osm, TRUE, FALSE, FALSE);
 }
 
-int osm_ucast_minhop_setup(osm_opensm_t * p_osm)
+int osm_ucast_minhop_setup(struct osm_routing_engine *routing_engine,
+			   osm_opensm_t * p_osm)
 {
-	p_osm->routing_engine.context = (void *)p_osm;
-	p_osm->routing_engine.build_lid_matrices = osm_ucast_minhop_build_lid_matrices;
-	p_osm->routing_engine.ucast_build_fwd_tables = osm_ucast_minhop_build_fwd_tables;
+	routing_engine->context = (void *)p_osm;
+	routing_engine->build_lid_matrices = osm_ucast_minhop_build_lid_matrices;
+	routing_engine->ucast_build_fwd_tables = osm_ucast_minhop_build_fwd_tables;
 	return 0;
 }
diff --git a/opensm/opensm/osm_ucast_updn.c b/opensm/opensm/osm_ucast_updn.c
index b9fe57d..046995a 100644
--- a/opensm/opensm/osm_ucast_updn.c
+++ b/opensm/opensm/osm_ucast_updn.c
@@ -682,7 +682,8 @@ static int osm_ucast_updn_build_fwd_tables(void *context)
 							 FALSE);
 }
 
-int osm_ucast_updn_setup(osm_opensm_t * p_osm)
+int osm_ucast_updn_setup(struct osm_routing_engine *routing_engine,
+			 osm_opensm_t * p_osm)
 {
 	updn_t *p_updn;
 
@@ -693,10 +694,10 @@ int osm_ucast_updn_setup(osm_opensm_t * p_osm)
 
 	p_updn->p_osm = p_osm;
 
-	p_osm->routing_engine.context = p_updn;
-	p_osm->routing_engine.delete = __osm_updn_delete;
-	p_osm->routing_engine.build_lid_matrices = __osm_updn_call;
-	p_osm->routing_engine.ucast_build_fwd_tables = osm_ucast_updn_build_fwd_tables;
+	routing_engine->context = p_updn;
+	routing_engine->delete = __osm_updn_delete;
+	routing_engine->build_lid_matrices = __osm_updn_call;
+	routing_engine->ucast_build_fwd_tables = osm_ucast_updn_build_fwd_tables;
 
 	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