[ofa-general] [PATCH] opensm: unify SM managers initializers

Sasha Khapyorsky sashak at voltaire.com
Sun Jan 6 07:49:19 PST 2008


This unifies SM managers initializers, now instead of bunch of parameters
only reference to SM object is passed to the initializers.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---

This patch is for master only yet.

 opensm/include/opensm/osm_drop_mgr.h        |   31 ++++-------
 opensm/include/opensm/osm_lid_mgr.h         |   27 +++-------
 opensm/include/opensm/osm_link_mgr.h        |   23 +++-----
 opensm/include/opensm/osm_mcast_mgr.h       |   23 +++-----
 opensm/include/opensm/osm_sm_state_mgr.h    |   22 ++++----
 opensm/include/opensm/osm_state_mgr.h       |   74 ++++----------------------
 opensm/include/opensm/osm_sweep_fail_ctrl.h |   24 +--------
 opensm/include/opensm/osm_ucast_mgr.h       |   23 +++-----
 opensm/opensm/osm_drop_mgr.c                |   17 +++---
 opensm/opensm/osm_lid_mgr.c                 |   28 ++++-------
 opensm/opensm/osm_link_mgr.c                |   21 +++-----
 opensm/opensm/osm_mcast_mgr.c               |   21 +++-----
 opensm/opensm/osm_sm.c                      |   40 +++------------
 opensm/opensm/osm_sm_state_mgr.c            |   21 +++----
 opensm/opensm/osm_state_mgr.c               |   57 ++++++--------------
 opensm/opensm/osm_sweep_fail_ctrl.c         |   18 +++----
 opensm/opensm/osm_ucast_mgr.c               |   21 +++-----
 17 files changed, 150 insertions(+), 341 deletions(-)

diff --git a/opensm/include/opensm/osm_drop_mgr.h b/opensm/include/opensm/osm_drop_mgr.h
index 0f929e0..c9d881c 100644
--- a/opensm/include/opensm/osm_drop_mgr.h
+++ b/opensm/include/opensm/osm_drop_mgr.h
@@ -81,6 +81,7 @@ BEGIN_C_DECLS
 *	Steve King, Intel
 *
 *********/
+struct osm_sm;
 /****s* OpenSM: Drop Manager/osm_drop_mgr_t
 * NAME
 *	osm_drop_mgr_t
@@ -94,6 +95,7 @@ BEGIN_C_DECLS
 * SYNOPSIS
 */
 typedef struct _osm_drop_mgr {
+	struct osm_sm *sm;
 	osm_subn_t *p_subn;
 	osm_log_t *p_log;
 	osm_req_t *p_req;
@@ -102,6 +104,9 @@ typedef struct _osm_drop_mgr {
 } osm_drop_mgr_t;
 /*
 * FIELDS
+*	sm
+*		Pointer to the SM object.
+*
 *	p_subn
 *		Pointer to the Subnet object for this subnet.
 *
@@ -188,38 +193,24 @@ void osm_drop_mgr_destroy(IN osm_drop_mgr_t * const p_mgr);
 *
 * SYNOPSIS
 */
-ib_api_status_t osm_drop_mgr_init(IN osm_drop_mgr_t * const p_mgr,
-				  IN osm_subn_t * const p_subn,
-				  IN osm_log_t * const p_log,
-				  IN osm_req_t * const p_req,
-				  IN cl_plock_t * const p_lock);
+ib_api_status_t
+osm_drop_mgr_init(IN osm_drop_mgr_t * const p_mgr, struct osm_sm * sm);
 /*
 * PARAMETERS
 *	p_mgr
 *		[in] Pointer to an osm_drop_mgr_t object to initialize.
 *
-*	p_subn
-*		[in] Pointer to the Subnet object for this subnet.
-*
-*	p_log
-*		[in] Pointer to the log object.
-*
-*	p_req
-*		[in] Pointer to an osm_req_t object.
-*
-*	p_lock
-*		[in] Pointer to the OpenSM serializing lock.
+*	sm
+*		[in] Pointer to the SM object.
 *
 * RETURN VALUES
-*	IB_SUCCESS if the Drop Manager object was initialized
-*	successfully.
+*	IB_SUCCESS if the Drop Manager object was initialized successfully.
 *
 * NOTES
 *	Allows calling other Drop Manager methods.
 *
 * SEE ALSO
-*	Drop Manager object, osm_drop_mgr_construct,
-*	osm_drop_mgr_destroy
+*	Drop Manager object, osm_drop_mgr_construct, osm_drop_mgr_destroy
 *********/
 
 /****f* OpenSM: Drop Manager/osm_drop_mgr_process
diff --git a/opensm/include/opensm/osm_lid_mgr.h b/opensm/include/opensm/osm_lid_mgr.h
index 9a7d0e3..d76cf56 100644
--- a/opensm/include/opensm/osm_lid_mgr.h
+++ b/opensm/include/opensm/osm_lid_mgr.h
@@ -83,6 +83,7 @@ BEGIN_C_DECLS
 *	Steve King, Intel
 *
 *********/
+struct osm_sm;
 /****s* OpenSM: LID Manager/osm_lid_mgr_t
 * NAME
 *	osm_lid_mgr_t
@@ -96,6 +97,7 @@ BEGIN_C_DECLS
 * SYNOPSIS
 */
 typedef struct _osm_lid_mgr {
+	struct osm_sm *sm;
 	osm_subn_t *p_subn;
 	osm_db_t *p_db;
 	osm_req_t *p_req;
@@ -108,6 +110,9 @@ typedef struct _osm_lid_mgr {
 } osm_lid_mgr_t;
 /*
 * FIELDS
+*	sm
+*		Pointer to the SM object.
+*
 *	p_subn
 *		Pointer to the Subnet object for this subnet.
 *
@@ -214,30 +219,14 @@ void osm_lid_mgr_destroy(IN osm_lid_mgr_t * const p_mgr);
 * SYNOPSIS
 */
 ib_api_status_t
-osm_lid_mgr_init(IN osm_lid_mgr_t * const p_mgr,
-		 IN osm_req_t * const p_req,
-		 IN osm_subn_t * const p_subn,
-		 IN osm_db_t * const p_db,
-		 IN osm_log_t * const p_log, IN cl_plock_t * const p_lock);
+osm_lid_mgr_init(IN osm_lid_mgr_t * const p_mgr, IN struct osm_sm * sm);
 /*
 * PARAMETERS
 *	p_mgr
 *		[in] Pointer to an osm_lid_mgr_t object to initialize.
 *
-*	p_req
-*		[in] Pointer to the attribute Requester object.
-*
-*	p_subn
-*		[in] Pointer to the Subnet object for this subnet.
-*
-*	p_db
-*		[in] Pointer to the database object.
-*
-*	p_log
-*		[in] Pointer to the log object.
-*
-*	p_lock
-*		[in] Pointer to the OpenSM serializing lock.
+*	sm
+*		[in] Pointer to the SM object for this subnet.
 *
 * RETURN VALUES
 *	CL_SUCCESS if the LID Manager object was initialized
diff --git a/opensm/include/opensm/osm_link_mgr.h b/opensm/include/opensm/osm_link_mgr.h
index 11a7352..c9cd796 100644
--- a/opensm/include/opensm/osm_link_mgr.h
+++ b/opensm/include/opensm/osm_link_mgr.h
@@ -81,6 +81,7 @@ BEGIN_C_DECLS
 *	Steve King, Intel
 *
 *********/
+struct osm_sm;
 /****s* OpenSM: Link Manager/osm_link_mgr_t
 * NAME
 *	osm_link_mgr_t
@@ -94,6 +95,7 @@ BEGIN_C_DECLS
 * SYNOPSIS
 */
 typedef struct _osm_link_mgr {
+	struct osm_sm *sm;
 	osm_subn_t *p_subn;
 	osm_req_t *p_req;
 	osm_log_t *p_log;
@@ -101,6 +103,9 @@ typedef struct _osm_link_mgr {
 } osm_link_mgr_t;
 /*
 * FIELDS
+*	sm
+*		Pointer to the SM object.
+*
 *	p_subn
 *		Pointer to the Subnet object for this subnet.
 *
@@ -188,26 +193,14 @@ void osm_link_mgr_destroy(IN osm_link_mgr_t * const p_mgr);
 * SYNOPSIS
 */
 ib_api_status_t
-osm_link_mgr_init(IN osm_link_mgr_t * const p_mgr,
-		  IN osm_req_t * const p_req,
-		  IN osm_subn_t * const p_subn,
-		  IN osm_log_t * const p_log, IN cl_plock_t * const p_lock);
+osm_link_mgr_init(IN osm_link_mgr_t * const p_mgr, IN struct osm_sm * sm);
 /*
 * PARAMETERS
 *	p_mgr
 *		[in] Pointer to an osm_link_mgr_t object to initialize.
 *
-*	p_req
-*		[in] Pointer to the attribute Requester object.
-*
-*	p_subn
-*		[in] Pointer to the Subnet object for this subnet.
-*
-*	p_log
-*		[in] Pointer to the log object.
-*
-*	p_lock
-*		[in] Pointer to the OpenSM serializing lock.
+*	sm
+*		[in] Pointer to the SM object.
 *
 * RETURN VALUES
 *	IB_SUCCESS if the Link Manager object was initialized
diff --git a/opensm/include/opensm/osm_mcast_mgr.h b/opensm/include/opensm/osm_mcast_mgr.h
index 47b67ed..08e4b7a 100644
--- a/opensm/include/opensm/osm_mcast_mgr.h
+++ b/opensm/include/opensm/osm_mcast_mgr.h
@@ -83,6 +83,7 @@ BEGIN_C_DECLS
 *	Steve King, Intel
 *
 *********/
+struct osm_sm;
 /****s* OpenSM: Multicast Manager/osm_mcast_mgr_t
 * NAME
 *	osm_mcast_mgr_t
@@ -96,6 +97,7 @@ BEGIN_C_DECLS
 * SYNOPSIS
 */
 typedef struct _osm_mcast_mgr {
+	struct osm_sm *sm;
 	osm_subn_t *p_subn;
 	osm_req_t *p_req;
 	osm_log_t *p_log;
@@ -103,6 +105,9 @@ typedef struct _osm_mcast_mgr {
 } osm_mcast_mgr_t;
 /*
 * FIELDS
+*	sm
+*		Pointer to the SM object.
+*
 *	p_subn
 *		Pointer to the Subnet object for this subnet.
 *
@@ -190,26 +195,14 @@ void osm_mcast_mgr_destroy(IN osm_mcast_mgr_t * const p_mgr);
 * SYNOPSIS
 */
 ib_api_status_t
-osm_mcast_mgr_init(IN osm_mcast_mgr_t * const p_mgr,
-		   IN osm_req_t * const p_req,
-		   IN osm_subn_t * const p_subn,
-		   IN osm_log_t * const p_log, IN cl_plock_t * const p_lock);
+osm_mcast_mgr_init(IN osm_mcast_mgr_t * const p_mgr, struct osm_sm * sm);
 /*
 * PARAMETERS
 *	p_mgr
 *		[in] Pointer to an osm_mcast_mgr_t object to initialize.
 *
-*	p_req
-*		[in] Pointer to the attribute Requester object.
-*
-*	p_subn
-*		[in] Pointer to the Subnet object for this subnet.
-*
-*	p_log
-*		[in] Pointer to the log object.
-*
-*	p_lock
-*		[in] Pointer to the OpenSM serializing lock.
+*	sm
+*		[in] Pointer to the SM object.
 *
 * RETURN VALUES
 *	IB_SUCCESS if the Multicast Manager object was initialized
diff --git a/opensm/include/opensm/osm_sm_state_mgr.h b/opensm/include/opensm/osm_sm_state_mgr.h
index b8ee174..db05e2f 100644
--- a/opensm/include/opensm/osm_sm_state_mgr.h
+++ b/opensm/include/opensm/osm_sm_state_mgr.h
@@ -87,6 +87,7 @@ BEGIN_C_DECLS
 *	Yael Kalka, Mellanox
 *
 *********/
+struct osm_sm;
 /****s* OpenSM: SM State Manager/osm_sm_state_mgr_t
 * NAME
 *	osm_sm_state_mgr_t
@@ -100,6 +101,7 @@ BEGIN_C_DECLS
 * SYNOPSIS
 */
 typedef struct _osm_sm_state_mgr {
+	struct osm_sm *sm;
 	cl_spinlock_t state_lock;
 	cl_timer_t polling_timer;
 	uint32_t retry_number;
@@ -112,6 +114,9 @@ typedef struct _osm_sm_state_mgr {
 
 /*
 * FIELDS
+*	sm
+*		Pointer to the SM object.
+*
 *	state_lock
 *		Spinlock guarding the state and processes.
 *
@@ -164,8 +169,8 @@ void osm_sm_state_mgr_construct(IN osm_sm_state_mgr_t * const p_sm_mgr);
 * NOTES
 *	Allows osm_sm_state_mgr_destroy
 *
-*	Calling osm_sm_state_mgr_construct is a prerequisite to calling any other
-*	method except osm_sm_state_mgr_init.
+*	Calling osm_sm_state_mgr_construct is a prerequisite to calling any
+*	other method except osm_sm_state_mgr_init.
 *
 * SEE ALSO
 *	SM State Manager object, osm_sm_state_mgr_init,
@@ -215,21 +220,14 @@ void osm_sm_state_mgr_destroy(IN osm_sm_state_mgr_t * const p_sm_mgr);
 */
 ib_api_status_t
 osm_sm_state_mgr_init(IN osm_sm_state_mgr_t * const p_sm_mgr,
-		      IN osm_subn_t * const p_subn,
-		      IN osm_req_t * const p_req, IN osm_log_t * const p_log);
+		      struct osm_sm * sm);
 /*
 * PARAMETERS
 *	p_sm_mgr
 *		[in] Pointer to an osm_sm_state_mgr_t object to initialize.
 *
-*	p_subn
-*		[in] Pointer to the Subnet object for this subnet.
-*
-*	p_req
-*		[in] Pointer to an osm_req_t object.
-*
-*	p_log
-*		[in] Pointer to the log object.
+*	sm
+*		[in] Pointer to the SM object.
 *
 * RETURN VALUES
 *	IB_SUCCESS if the SM State Manager object was initialized
diff --git a/opensm/include/opensm/osm_state_mgr.h b/opensm/include/opensm/osm_state_mgr.h
index f51593a..968f233 100644
--- a/opensm/include/opensm/osm_state_mgr.h
+++ b/opensm/include/opensm/osm_state_mgr.h
@@ -85,6 +85,7 @@ BEGIN_C_DECLS
 *	Steve King, Intel
 *
 *********/
+struct osm_sm;
 /****s* OpenSM: State Manager/osm_state_mgr_t
 * NAME
 *	osm_state_mgr_t
@@ -98,6 +99,7 @@ BEGIN_C_DECLS
 * SYNOPSIS
 */
 typedef struct _osm_state_mgr {
+	struct osm_sm *sm;
 	osm_subn_t *p_subn;
 	osm_log_t *p_log;
 	osm_lid_mgr_t *p_lid_mgr;
@@ -115,6 +117,9 @@ typedef struct _osm_state_mgr {
 } osm_state_mgr_t;
 /*
 * FIELDS
+*	sm
+*		Pointer to the SM object.
+*
 *	p_subn
 *		Pointer to the Subnet object for this subnet.
 *
@@ -139,11 +144,11 @@ typedef struct _osm_state_mgr {
 *	p_req
 *		Pointer to the Requester object sending SMPs.
 *
-*  p_stats
-*     Pointer to the OpenSM statistics block.
+*	p_stats
+*		Pointer to the OpenSM statistics block.
 *
-*  p_sm_state_mgr
-*     Pointer to the SM state mgr object.
+*	p_sm_state_mgr
+*		Pointer to the SM state mgr object.
 *
 *	p_mad_ctrl
 *		Pointer to the SM's MAD Controller object.
@@ -157,15 +162,6 @@ typedef struct _osm_state_mgr {
 *	state
 *		State of the SM.
 *
-*  state_step_mode
-*     Controls the mode of progressing to next stage:
-*     OSM_STATE_STEP_CONTINUOUS - normal automatic progress mode
-*     OSM_STATE_STEP_TAKE_ONE - do one step and stop
-*     OSM_STATE_STEP_BREAK  - stop before taking next step
-*
-*  next_stage_signal
-*     Stores the signal to be provided when running the next stage.
-*
 * SEE ALSO
 *	State Manager object
 *********/
@@ -241,60 +237,14 @@ void osm_state_mgr_destroy(IN osm_state_mgr_t * const p_mgr);
 * SYNOPSIS
 */
 ib_api_status_t
-osm_state_mgr_init(IN osm_state_mgr_t * const p_mgr,
-		   IN osm_subn_t * const p_subn,
-		   IN osm_lid_mgr_t * const p_lid_mgr,
-		   IN osm_ucast_mgr_t * const p_ucast_mgr,
-		   IN osm_mcast_mgr_t * const p_mcast_mgr,
-		   IN osm_link_mgr_t * const p_link_mgr,
-		   IN osm_drop_mgr_t * const p_drop_mgr,
-		   IN osm_req_t * const p_req,
-		   IN osm_stats_t * const p_stats,
-		   IN struct _osm_sm_state_mgr *const p_sm_state_mgr,
-		   IN const osm_sm_mad_ctrl_t * const p_mad_ctrl,
-		   IN cl_plock_t * const p_lock,
-		   IN cl_event_t * const p_subnet_up_event,
-		   IN osm_log_t * const p_log);
+osm_state_mgr_init(IN osm_state_mgr_t * const p_mgr, struct osm_sm * sm);
 /*
 * PARAMETERS
 *	p_mgr
 *		[in] Pointer to an osm_state_mgr_t object to initialize.
 *
-*	p_subn
-*		[in] Pointer to the Subnet object for this subnet.
-*
-*	p_lid_mgr
-*		[in] Pointer to the LID Manager object.
-*
-*	p_ucast_mgr
-*		[in] Pointer to the Unicast Manager object.
-*
-*	p_mcast_mgr
-*		[in] Pointer to the Multicast Manager object.
-*
-*	p_link_mgr
-*		[in] Pointer to the Link Manager object.
-*
-*	p_drop_mgr
-*		[in] Pointer to the Drop Manager object.
-*
-*	p_req
-*		[in] Pointer to the Request Controller object.
-*
-*  p_stats
-*     [in] Pointer to the OpenSM statistics block.
-*
-*  p_sm_state_mgr
-*     [in] Pointer to the SM state mgr object.
-*
-*	p_mad_ctrl
-*		[in] Pointer to the SM's mad controller.
-*
-*	p_subnet_up_event
-*		[in] Pointer to the event to set if/when the subnet comes up.
-*
-*	p_log
-*		[in] Pointer to the log object.
+*	sm
+*		[in] Pointer to the SM object.
 *
 * RETURN VALUES
 *	IB_SUCCESS if the State Manager object was initialized
diff --git a/opensm/include/opensm/osm_sweep_fail_ctrl.h b/opensm/include/opensm/osm_sweep_fail_ctrl.h
index 2fca6eb..28ae7a6 100644
--- a/opensm/include/opensm/osm_sweep_fail_ctrl.h
+++ b/opensm/include/opensm/osm_sweep_fail_ctrl.h
@@ -96,22 +96,13 @@ struct osm_sm;
 */
 typedef struct _osm_sweep_fail_ctrl {
 	struct osm_sm *sm;
-	osm_log_t *p_log;
-	cl_dispatcher_t *p_disp;
 	cl_disp_reg_handle_t h_disp;
-
 } osm_sweep_fail_ctrl_t;
 /*
 * FIELDS
 *	sm
 *		Pointer to the sm object.
 *
-*	p_log
-*		Pointer to the log object.
-*
-*	p_disp
-*		Pointer to the Dispatcher.
-*
 *	h_disp
 *		Handle returned from dispatcher registration.
 *
@@ -193,25 +184,14 @@ void osm_sweep_fail_ctrl_destroy(IN osm_sweep_fail_ctrl_t * const p_ctrl);
 */
 ib_api_status_t
 osm_sweep_fail_ctrl_init(IN osm_sweep_fail_ctrl_t * const p_ctrl,
-			 IN osm_log_t * const p_log,
-			 IN struct osm_sm * const sm,
-			 IN cl_dispatcher_t * const p_disp);
+			 IN struct osm_sm * sm);
 /*
 * PARAMETERS
 *	p_ctrl
 *		[in] Pointer to an osm_sweep_fail_ctrl_t object to initialize.
 *
-*	p_rcv
-*		[in] Pointer to an osm_sweep_fail_t object.
-*
-*	p_log
-*		[in] Pointer to the log object.
-*
 *	sm
-*		[in] Pointer to the sm object.
-*
-*	p_disp
-*		[in] Pointer to the OpenSM central Dispatcher.
+*		[in] Pointer to the SM object.
 *
 * RETURN VALUES
 *	CL_SUCCESS if the Sweep Fail Controller object was initialized
diff --git a/opensm/include/opensm/osm_ucast_mgr.h b/opensm/include/opensm/osm_ucast_mgr.h
index 88d8cca..1868eae 100644
--- a/opensm/include/opensm/osm_ucast_mgr.h
+++ b/opensm/include/opensm/osm_ucast_mgr.h
@@ -83,6 +83,7 @@ BEGIN_C_DECLS
 *	Steve King, Intel
 *
 *********/
+struct osm_sm;
 /****s* OpenSM: Unicast Manager/osm_ucast_mgr_t
 * NAME
 *	osm_ucast_mgr_t
@@ -96,6 +97,7 @@ BEGIN_C_DECLS
 * SYNOPSIS
 */
 typedef struct _osm_ucast_mgr {
+	struct osm_sm *sm;
 	osm_subn_t *p_subn;
 	osm_req_t *p_req;
 	osm_log_t *p_log;
@@ -107,6 +109,9 @@ typedef struct _osm_ucast_mgr {
 } osm_ucast_mgr_t;
 /*
 * FIELDS
+*	sm
+*		Pointer to the SM object.
+*
 *	p_subn
 *		Pointer to the Subnet object for this subnet.
 *
@@ -210,26 +215,14 @@ void osm_ucast_mgr_destroy(IN osm_ucast_mgr_t * const p_mgr);
 * SYNOPSIS
 */
 ib_api_status_t
-osm_ucast_mgr_init(IN osm_ucast_mgr_t * const p_mgr,
-		   IN osm_req_t * const p_req,
-		   IN osm_subn_t * const p_subn,
-		   IN osm_log_t * const p_log, IN cl_plock_t * const p_lock);
+osm_ucast_mgr_init(IN osm_ucast_mgr_t * const p_mgr, IN struct osm_sm * sm);
 /*
 * PARAMETERS
 *	p_mgr
 *		[in] Pointer to an osm_ucast_mgr_t object to initialize.
 *
-*	p_req
-*		[in] Pointer to the attribute Requester object.
-*
-*	p_subn
-*		[in] Pointer to the Subnet object for this subnet.
-*
-*	p_log
-*		[in] Pointer to the log object.
-*
-*	p_lock
-*		[in] Pointer to the OpenSM serializing lock.
+*	sm
+*		[in] Pointer to the SM object.
 *
 * RETURN VALUES
 *	IB_SUCCESS if the Unicast Manager object was initialized
diff --git a/opensm/opensm/osm_drop_mgr.c b/opensm/opensm/osm_drop_mgr.c
index 7ace399..202b33c 100644
--- a/opensm/opensm/osm_drop_mgr.c
+++ b/opensm/opensm/osm_drop_mgr.c
@@ -57,6 +57,7 @@
 #include <complib/cl_debug.h>
 #include <complib/cl_ptr_vector.h>
 #include <opensm/osm_drop_mgr.h>
+#include <opensm/osm_sm.h>
 #include <opensm/osm_router.h>
 #include <opensm/osm_switch.h>
 #include <opensm/osm_node.h>
@@ -88,21 +89,19 @@ void osm_drop_mgr_destroy(IN osm_drop_mgr_t * const p_mgr)
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_drop_mgr_init(IN osm_drop_mgr_t * const p_mgr,
-		  IN osm_subn_t * const p_subn,
-		  IN osm_log_t * const p_log,
-		  IN osm_req_t * const p_req, IN cl_plock_t * const p_lock)
+osm_drop_mgr_init(IN osm_drop_mgr_t * const p_mgr, IN osm_sm_t * sm)
 {
 	ib_api_status_t status = IB_SUCCESS;
 
-	OSM_LOG_ENTER(p_log, osm_drop_mgr_init);
+	OSM_LOG_ENTER(sm->p_log, osm_drop_mgr_init);
 
 	osm_drop_mgr_construct(p_mgr);
 
-	p_mgr->p_log = p_log;
-	p_mgr->p_subn = p_subn;
-	p_mgr->p_lock = p_lock;
-	p_mgr->p_req = p_req;
+	p_mgr->sm = sm;
+	p_mgr->p_log = sm->p_log;
+	p_mgr->p_subn = sm->p_subn;
+	p_mgr->p_lock = sm->p_lock;
+	p_mgr->p_req = &sm->req;
 
 	OSM_LOG_EXIT(p_mgr->p_log);
 	return (status);
diff --git a/opensm/opensm/osm_lid_mgr.c b/opensm/opensm/osm_lid_mgr.c
index 30e5713..3194f42 100644
--- a/opensm/opensm/osm_lid_mgr.c
+++ b/opensm/opensm/osm_lid_mgr.c
@@ -91,6 +91,7 @@
 #include <complib/cl_qmap.h>
 #include <complib/cl_debug.h>
 #include <opensm/osm_lid_mgr.h>
+#include <opensm/osm_sm.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_switch.h>
@@ -98,7 +99,6 @@
 #include <opensm/osm_msgdef.h>
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_db_pack.h>
-#include <stdlib.h>
 
 /**********************************************************************
   lid range item of qlist
@@ -241,28 +241,20 @@ static void __osm_lid_mgr_validate_db(IN osm_lid_mgr_t * p_mgr)
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_lid_mgr_init(IN osm_lid_mgr_t * const p_mgr,
-		 IN osm_req_t * const p_req,
-		 IN osm_subn_t * const p_subn,
-		 IN osm_db_t * const p_db,
-		 IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
+osm_lid_mgr_init(IN osm_lid_mgr_t * const p_mgr, IN osm_sm_t *sm)
 {
 	ib_api_status_t status = IB_SUCCESS;
 
-	OSM_LOG_ENTER(p_log, osm_lid_mgr_init);
-
-	CL_ASSERT(p_req);
-	CL_ASSERT(p_subn);
-	CL_ASSERT(p_lock);
-	CL_ASSERT(p_db);
+	OSM_LOG_ENTER(sm->p_log, osm_lid_mgr_init);
 
 	osm_lid_mgr_construct(p_mgr);
 
-	p_mgr->p_log = p_log;
-	p_mgr->p_subn = p_subn;
-	p_mgr->p_db = p_db;
-	p_mgr->p_lock = p_lock;
-	p_mgr->p_req = p_req;
+	p_mgr->sm = sm;
+	p_mgr->p_log = sm->p_log;
+	p_mgr->p_subn = sm->p_subn;
+	p_mgr->p_db = sm->p_db;
+	p_mgr->p_lock = sm->p_lock;
+	p_mgr->p_req = &sm->req;
 
 	/* we initialize and restore the db domain of guid to lid map */
 	p_mgr->p_g2l = osm_db_domain_init(p_mgr->p_db, "/guid2lid");
@@ -280,7 +272,7 @@ osm_lid_mgr_init(IN osm_lid_mgr_t * const p_mgr,
 	/* we use the stored guid to lid table if not forced to reassign */
 	if (!p_mgr->p_subn->opt.reassign_lids) {
 		if (osm_db_restore(p_mgr->p_g2l)) {
-			if (p_subn->opt.exit_on_fatal) {
+			if (p_mgr->p_subn->opt.exit_on_fatal) {
 				osm_log(p_mgr->p_log, OSM_LOG_SYS,
 					"FATAL: Error restoring Guid-to-Lid persistent database\n");
 				status = IB_ERROR;
diff --git a/opensm/opensm/osm_link_mgr.c b/opensm/opensm/osm_link_mgr.c
index b96b741..d5e0956 100644
--- a/opensm/opensm/osm_link_mgr.c
+++ b/opensm/opensm/osm_link_mgr.c
@@ -52,6 +52,7 @@
 #include <iba/ib_types.h>
 #include <complib/cl_debug.h>
 #include <opensm/osm_link_mgr.h>
+#include <opensm/osm_sm.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_switch.h>
 #include <opensm/osm_helper.h>
@@ -76,25 +77,19 @@ void osm_link_mgr_destroy(IN osm_link_mgr_t * const p_mgr)
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_link_mgr_init(IN osm_link_mgr_t * const p_mgr,
-		  IN osm_req_t * const p_req,
-		  IN osm_subn_t * const p_subn,
-		  IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
+osm_link_mgr_init(IN osm_link_mgr_t * const p_mgr, IN osm_sm_t * sm)
 {
 	ib_api_status_t status = IB_SUCCESS;
 
-	OSM_LOG_ENTER(p_log, osm_link_mgr_init);
-
-	CL_ASSERT(p_req);
-	CL_ASSERT(p_subn);
-	CL_ASSERT(p_lock);
+	OSM_LOG_ENTER(sm->p_log, osm_link_mgr_init);
 
 	osm_link_mgr_construct(p_mgr);
 
-	p_mgr->p_log = p_log;
-	p_mgr->p_subn = p_subn;
-	p_mgr->p_lock = p_lock;
-	p_mgr->p_req = p_req;
+	p_mgr->sm = sm;
+	p_mgr->p_log = sm->p_log;
+	p_mgr->p_subn = sm->p_subn;
+	p_mgr->p_lock = sm->p_lock;
+	p_mgr->p_req = &sm->req;
 
 	OSM_LOG_EXIT(p_mgr->p_log);
 	return (status);
diff --git a/opensm/opensm/osm_mcast_mgr.c b/opensm/opensm/osm_mcast_mgr.c
index f51a45a..3bdbd31 100644
--- a/opensm/opensm/osm_mcast_mgr.c
+++ b/opensm/opensm/osm_mcast_mgr.c
@@ -54,6 +54,7 @@
 #include <complib/cl_debug.h>
 #include <opensm/osm_opensm.h>
 #include <opensm/osm_mcast_mgr.h>
+#include <opensm/osm_sm.h>
 #include <opensm/osm_multicast.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_switch.h>
@@ -374,25 +375,19 @@ void osm_mcast_mgr_destroy(IN osm_mcast_mgr_t * const p_mgr)
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_mcast_mgr_init(IN osm_mcast_mgr_t * const p_mgr,
-		   IN osm_req_t * const p_req,
-		   IN osm_subn_t * const p_subn,
-		   IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
+osm_mcast_mgr_init(IN osm_mcast_mgr_t * const p_mgr, IN osm_sm_t * sm)
 {
 	ib_api_status_t status = IB_SUCCESS;
 
-	OSM_LOG_ENTER(p_log, osm_mcast_mgr_init);
-
-	CL_ASSERT(p_req);
-	CL_ASSERT(p_subn);
-	CL_ASSERT(p_lock);
+	OSM_LOG_ENTER(sm->p_log, osm_mcast_mgr_init);
 
 	osm_mcast_mgr_construct(p_mgr);
 
-	p_mgr->p_log = p_log;
-	p_mgr->p_subn = p_subn;
-	p_mgr->p_lock = p_lock;
-	p_mgr->p_req = p_req;
+	p_mgr->sm = sm;
+	p_mgr->p_log = sm->p_log;
+	p_mgr->p_subn = sm->p_subn;
+	p_mgr->p_lock = sm->p_lock;
+	p_mgr->p_req = &sm->req;
 
 	OSM_LOG_EXIT(p_mgr->p_log);
 	return (status);
diff --git a/opensm/opensm/osm_sm.c b/opensm/opensm/osm_sm.c
index b60a615..af8c569 100644
--- a/opensm/opensm/osm_sm.c
+++ b/opensm/opensm/osm_sm.c
@@ -315,59 +315,35 @@ osm_sm_init(IN osm_sm_t * const p_sm,
 	if (status != IB_SUCCESS)
 		goto Exit;
 
-	status = osm_lid_mgr_init(&p_sm->lid_mgr,
-				  &p_sm->req,
-				  p_sm->p_subn,
-				  p_sm->p_db, p_sm->p_log, p_sm->p_lock);
+	status = osm_lid_mgr_init(&p_sm->lid_mgr, p_sm);
 	if (status != IB_SUCCESS)
 		goto Exit;
 
-	status = osm_ucast_mgr_init(&p_sm->ucast_mgr,
-				    &p_sm->req,
-				    p_sm->p_subn, p_sm->p_log, p_sm->p_lock);
+	status = osm_ucast_mgr_init(&p_sm->ucast_mgr, p_sm);
 	if (status != IB_SUCCESS)
 		goto Exit;
 
-	status = osm_link_mgr_init(&p_sm->link_mgr,
-				   &p_sm->req,
-				   p_sm->p_subn, p_sm->p_log, p_sm->p_lock);
+	status = osm_link_mgr_init(&p_sm->link_mgr, p_sm);
 	if (status != IB_SUCCESS)
 		goto Exit;
 
-	status = osm_state_mgr_init(&p_sm->state_mgr,
-				    p_sm->p_subn,
-				    &p_sm->lid_mgr,
-				    &p_sm->ucast_mgr,
-				    &p_sm->mcast_mgr,
-				    &p_sm->link_mgr,
-				    &p_sm->drop_mgr,
-				    &p_sm->req,
-				    p_stats,
-				    &p_sm->sm_state_mgr,
-				    &p_sm->mad_ctrl,
-				    p_sm->p_lock,
-				    &p_sm->subnet_up_event, p_sm->p_log);
+	status = osm_state_mgr_init(&p_sm->state_mgr, p_sm);
 	if (status != IB_SUCCESS)
 		goto Exit;
 
-	status = osm_drop_mgr_init(&p_sm->drop_mgr,
-				   p_sm->p_subn,
-				   p_sm->p_log, &p_sm->req, p_sm->p_lock);
+	status = osm_drop_mgr_init(&p_sm->drop_mgr, p_sm);
 	if (status != IB_SUCCESS)
 		goto Exit;
 
-	status = osm_sweep_fail_ctrl_init(&p_sm->sweep_fail_ctrl,
-					  p_log, p_sm, p_disp);
+	status = osm_sweep_fail_ctrl_init(&p_sm->sweep_fail_ctrl, p_sm);
 	if (status != IB_SUCCESS)
 		goto Exit;
 
-	status = osm_sm_state_mgr_init(&p_sm->sm_state_mgr,
-				       p_sm->p_subn, &p_sm->req, p_sm->p_log);
+	status = osm_sm_state_mgr_init(&p_sm->sm_state_mgr, p_sm);
 	if (status != IB_SUCCESS)
 		goto Exit;
 
-	status = osm_mcast_mgr_init(&p_sm->mcast_mgr,
-				    &p_sm->req, p_subn, p_log, p_lock);
+	status = osm_mcast_mgr_init(&p_sm->mcast_mgr, p_sm);
 	if (status != IB_SUCCESS)
 		goto Exit;
 
diff --git a/opensm/opensm/osm_sm_state_mgr.c b/opensm/opensm/osm_sm_state_mgr.c
index c42611c..52aa199 100644
--- a/opensm/opensm/osm_sm_state_mgr.c
+++ b/opensm/opensm/osm_sm_state_mgr.c
@@ -49,10 +49,11 @@
 #endif				/* HAVE_CONFIG_H */
 
 #include <string.h>
+#include <time.h>
 #include <iba/ib_types.h>
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
-#include <time.h>
+#include <opensm/osm_sm.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_switch.h>
 #include <opensm/osm_log.h>
@@ -392,24 +393,20 @@ void osm_sm_state_mgr_destroy(IN osm_sm_state_mgr_t * const p_sm_mgr)
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_sm_state_mgr_init(IN osm_sm_state_mgr_t * const p_sm_mgr,
-		      IN osm_subn_t * const p_subn,
-		      IN osm_req_t * const p_req, IN osm_log_t * const p_log)
+osm_sm_state_mgr_init(IN osm_sm_state_mgr_t * const p_sm_mgr, IN osm_sm_t * sm)
 {
 	cl_status_t status;
 
-	OSM_LOG_ENTER(p_log, osm_sm_state_mgr_init);
-
-	CL_ASSERT(p_subn);
-	CL_ASSERT(p_req);
+	OSM_LOG_ENTER(sm->p_log, osm_sm_state_mgr_init);
 
 	osm_sm_state_mgr_construct(p_sm_mgr);
 
-	p_sm_mgr->p_log = p_log;
-	p_sm_mgr->p_req = p_req;
-	p_sm_mgr->p_subn = p_subn;
+	p_sm_mgr->sm = sm;
+	p_sm_mgr->p_log = sm->p_log;
+	p_sm_mgr->p_req = &sm->req;
+	p_sm_mgr->p_subn = sm->p_subn;
 
-	if (p_subn->opt.sm_inactive) {
+	if (p_sm_mgr->p_subn->opt.sm_inactive) {
 		/* init the state of the SM to not active */
 		p_sm_mgr->p_subn->sm_state = IB_SMINFO_STATE_NOTACTIVE;
 		__osm_sm_state_mgr_notactive_msg(p_sm_mgr);
diff --git a/opensm/opensm/osm_state_mgr.c b/opensm/opensm/osm_state_mgr.c
index 4b7235f..5c196e3 100644
--- a/opensm/opensm/osm_state_mgr.c
+++ b/opensm/opensm/osm_state_mgr.c
@@ -55,6 +55,7 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <opensm/osm_state_mgr.h>
+#include <opensm/osm_sm.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_switch.h>
 #include <opensm/osm_log.h>
@@ -93,51 +94,27 @@ void osm_state_mgr_destroy(IN osm_state_mgr_t * const p_mgr)
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_state_mgr_init(IN osm_state_mgr_t * const p_mgr,
-		   IN osm_subn_t * const p_subn,
-		   IN osm_lid_mgr_t * const p_lid_mgr,
-		   IN osm_ucast_mgr_t * const p_ucast_mgr,
-		   IN osm_mcast_mgr_t * const p_mcast_mgr,
-		   IN osm_link_mgr_t * const p_link_mgr,
-		   IN osm_drop_mgr_t * const p_drop_mgr,
-		   IN osm_req_t * const p_req,
-		   IN osm_stats_t * const p_stats,
-		   IN osm_sm_state_mgr_t * const p_sm_state_mgr,
-		   IN const osm_sm_mad_ctrl_t * const p_mad_ctrl,
-		   IN cl_plock_t * const p_lock,
-		   IN cl_event_t * const p_subnet_up_event,
-		   IN osm_log_t * const p_log)
+osm_state_mgr_init(IN osm_state_mgr_t * const p_mgr, IN osm_sm_t * sm)
 {
-	OSM_LOG_ENTER(p_log, osm_state_mgr_init);
-
-	CL_ASSERT(p_subn);
-	CL_ASSERT(p_lid_mgr);
-	CL_ASSERT(p_ucast_mgr);
-	CL_ASSERT(p_mcast_mgr);
-	CL_ASSERT(p_link_mgr);
-	CL_ASSERT(p_drop_mgr);
-	CL_ASSERT(p_req);
-	CL_ASSERT(p_stats);
-	CL_ASSERT(p_sm_state_mgr);
-	CL_ASSERT(p_mad_ctrl);
-	CL_ASSERT(p_lock);
+	OSM_LOG_ENTER(sm->p_log, osm_state_mgr_init);
 
 	osm_state_mgr_construct(p_mgr);
 
-	p_mgr->p_log = p_log;
-	p_mgr->p_subn = p_subn;
-	p_mgr->p_lid_mgr = p_lid_mgr;
-	p_mgr->p_ucast_mgr = p_ucast_mgr;
-	p_mgr->p_mcast_mgr = p_mcast_mgr;
-	p_mgr->p_link_mgr = p_link_mgr;
-	p_mgr->p_drop_mgr = p_drop_mgr;
-	p_mgr->p_mad_ctrl = p_mad_ctrl;
-	p_mgr->p_req = p_req;
-	p_mgr->p_stats = p_stats;
-	p_mgr->p_sm_state_mgr = p_sm_state_mgr;
+	p_mgr->sm = sm;
+	p_mgr->p_log = sm->p_log;
+	p_mgr->p_subn = sm->p_subn;
+	p_mgr->p_lid_mgr = &sm->lid_mgr;
+	p_mgr->p_ucast_mgr = &sm->ucast_mgr;
+	p_mgr->p_mcast_mgr = &sm->mcast_mgr;
+	p_mgr->p_link_mgr = &sm->link_mgr;
+	p_mgr->p_drop_mgr = &sm->drop_mgr;
+	p_mgr->p_mad_ctrl = &sm->mad_ctrl;
+	p_mgr->p_req = &sm->req;
+	p_mgr->p_stats = &sm->p_subn->p_osm->stats;
+	p_mgr->p_sm_state_mgr = &sm->sm_state_mgr;
 	p_mgr->state = OSM_SM_STATE_IDLE;
-	p_mgr->p_lock = p_lock;
-	p_mgr->p_subnet_up_event = p_subnet_up_event;
+	p_mgr->p_lock = sm->p_lock;
+	p_mgr->p_subnet_up_event = &sm->subnet_up_event;
 
 	OSM_LOG_EXIT(p_mgr->p_log);
 	return IB_SUCCESS;
diff --git a/opensm/opensm/osm_sweep_fail_ctrl.c b/opensm/opensm/osm_sweep_fail_ctrl.c
index b46573d..92b3165 100644
--- a/opensm/opensm/osm_sweep_fail_ctrl.c
+++ b/opensm/opensm/osm_sweep_fail_ctrl.c
@@ -59,7 +59,7 @@ static void __osm_sweep_fail_ctrl_disp_callback(IN void *context,
 {
 	osm_sweep_fail_ctrl_t *const p_ctrl = (osm_sweep_fail_ctrl_t *) context;
 
-	OSM_LOG_ENTER(p_ctrl->p_log, __osm_sweep_fail_ctrl_disp_callback);
+	OSM_LOG_ENTER(p_ctrl->sm->p_log, __osm_sweep_fail_ctrl_disp_callback);
 
 	UNUSED_PARAM(p_data);
 	/*
@@ -67,7 +67,7 @@ static void __osm_sweep_fail_ctrl_disp_callback(IN void *context,
 	 */
 	osm_sm_signal(p_ctrl->sm, OSM_SIGNAL_LIGHT_SWEEP_FAIL);
 
-	OSM_LOG_EXIT(p_ctrl->p_log);
+	OSM_LOG_EXIT(p_ctrl->sm->p_log);
 }
 
 /**********************************************************************
@@ -90,26 +90,22 @@ void osm_sweep_fail_ctrl_destroy(IN osm_sweep_fail_ctrl_t * const p_ctrl)
  **********************************************************************/
 ib_api_status_t
 osm_sweep_fail_ctrl_init(IN osm_sweep_fail_ctrl_t * const p_ctrl,
-			 IN osm_log_t * const p_log,
-			 IN osm_sm_t * const sm,
-			 IN cl_dispatcher_t * const p_disp)
+			 IN osm_sm_t * const sm)
 {
 	ib_api_status_t status = IB_SUCCESS;
 
-	OSM_LOG_ENTER(p_log, osm_sweep_fail_ctrl_init);
+	OSM_LOG_ENTER(sm->p_log, osm_sweep_fail_ctrl_init);
 
 	osm_sweep_fail_ctrl_construct(p_ctrl);
-	p_ctrl->p_log = p_log;
-	p_ctrl->p_disp = p_disp;
 	p_ctrl->sm = sm;
 
-	p_ctrl->h_disp = cl_disp_register(p_disp,
+	p_ctrl->h_disp = cl_disp_register(sm->p_disp,
 					  OSM_MSG_LIGHT_SWEEP_FAIL,
 					  __osm_sweep_fail_ctrl_disp_callback,
 					  p_ctrl);
 
 	if (p_ctrl->h_disp == CL_DISP_INVALID_HANDLE) {
-		osm_log(p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"osm_sweep_fail_ctrl_init: ERR 3501: "
 			"Dispatcher registration failed\n");
 		status = IB_INSUFFICIENT_RESOURCES;
@@ -117,6 +113,6 @@ osm_sweep_fail_ctrl_init(IN osm_sweep_fail_ctrl_t * const p_ctrl,
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_log);
+	OSM_LOG_EXIT(sm->p_log);
 	return (status);
 }
diff --git a/opensm/opensm/osm_ucast_mgr.c b/opensm/opensm/osm_ucast_mgr.c
index 1841219..d7c045e 100644
--- a/opensm/opensm/osm_ucast_mgr.c
+++ b/opensm/opensm/osm_ucast_mgr.c
@@ -55,6 +55,7 @@
 #include <complib/cl_qmap.h>
 #include <complib/cl_debug.h>
 #include <opensm/osm_ucast_mgr.h>
+#include <opensm/osm_sm.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_switch.h>
@@ -86,25 +87,19 @@ void osm_ucast_mgr_destroy(IN osm_ucast_mgr_t * const p_mgr)
 /**********************************************************************
  **********************************************************************/
 ib_api_status_t
-osm_ucast_mgr_init(IN osm_ucast_mgr_t * const p_mgr,
-		   IN osm_req_t * const p_req,
-		   IN osm_subn_t * const p_subn,
-		   IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
+osm_ucast_mgr_init(IN osm_ucast_mgr_t * const p_mgr, IN osm_sm_t * sm)
 {
 	ib_api_status_t status = IB_SUCCESS;
 
-	OSM_LOG_ENTER(p_log, osm_ucast_mgr_init);
-
-	CL_ASSERT(p_req);
-	CL_ASSERT(p_subn);
-	CL_ASSERT(p_lock);
+	OSM_LOG_ENTER(sm->p_log, osm_ucast_mgr_init);
 
 	osm_ucast_mgr_construct(p_mgr);
 
-	p_mgr->p_log = p_log;
-	p_mgr->p_subn = p_subn;
-	p_mgr->p_lock = p_lock;
-	p_mgr->p_req = p_req;
+	p_mgr->sm = sm;
+	p_mgr->p_log = sm->p_log;
+	p_mgr->p_subn = sm->p_subn;
+	p_mgr->p_lock = sm->p_lock;
+	p_mgr->p_req = &sm->req;
 
 	p_mgr->lft_buf = malloc(IB_LID_UCAST_END_HO + 1);
 	if (!p_mgr->lft_buf)
-- 
1.5.3.4.206.g58ba4




More information about the general mailing list