[ofa-general] [PATCH] opensm: kill drop_mgr, link_mgr and mcast_mgr SM sub-objects

Sasha Khapyorsky sashak at voltaire.com
Tue Feb 12 09:41:43 PST 2008


Remove dummy drop_mgr, link_mgr and mcast_mgr SM sub-objects.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/include/opensm/osm_sa.h |    1 +
 opensm/include/opensm/osm_sm.h |    6 -
 opensm/opensm/osm_drop_mgr.c   |  196 +++++++++--------------
 opensm/opensm/osm_link_mgr.c   |  127 +++++----------
 opensm/opensm/osm_mcast_mgr.c  |  344 ++++++++++++++++++----------------------
 opensm/opensm/osm_perfmgr.c    |    4 +-
 opensm/opensm/osm_sm.c         |   19 ---
 opensm/opensm/osm_state_mgr.c  |   21 ++-
 8 files changed, 290 insertions(+), 428 deletions(-)

diff --git a/opensm/include/opensm/osm_sa.h b/opensm/include/opensm/osm_sa.h
index c97cea6..a150695 100644
--- a/opensm/include/opensm/osm_sa.h
+++ b/opensm/include/opensm/osm_sa.h
@@ -61,6 +61,7 @@
 #include <opensm/osm_log.h>
 #include <opensm/osm_sa_mad_ctrl.h>
 #include <opensm/osm_sm.h>
+#include <opensm/osm_multicast.h>
 
 #ifdef __cplusplus
 #  define BEGIN_C_DECLS extern "C" {
diff --git a/opensm/include/opensm/osm_sm.h b/opensm/include/opensm/osm_sm.h
index e77222d..f4339e4 100644
--- a/opensm/include/opensm/osm_sm.h
+++ b/opensm/include/opensm/osm_sm.h
@@ -63,11 +63,8 @@
 #include <opensm/osm_sm_mad_ctrl.h>
 #include <opensm/osm_lid_mgr.h>
 #include <opensm/osm_ucast_mgr.h>
-#include <opensm/osm_link_mgr.h>
-#include <opensm/osm_drop_mgr.h>
 #include <opensm/osm_sweep_fail_ctrl.h>
 #include <opensm/osm_port.h>
-#include <opensm/osm_mcast_mgr.h>
 #include <opensm/osm_db.h>
 #include <opensm/osm_remote_sm.h>
 
@@ -139,10 +136,7 @@ typedef struct osm_sm {
 	osm_sm_mad_ctrl_t mad_ctrl;
 	osm_lid_mgr_t lid_mgr;
 	osm_ucast_mgr_t ucast_mgr;
-	osm_link_mgr_t link_mgr;
-	osm_drop_mgr_t drop_mgr;
 	osm_sweep_fail_ctrl_t sweep_fail_ctrl;
-	osm_mcast_mgr_t mcast_mgr;
 	cl_disp_reg_handle_t ni_disp_h;
 	cl_disp_reg_handle_t pi_disp_h;
 	cl_disp_reg_handle_t nd_disp_h;
diff --git a/opensm/opensm/osm_drop_mgr.c b/opensm/opensm/osm_drop_mgr.c
index 40534ab..8b0a36e 100644
--- a/opensm/opensm/osm_drop_mgr.c
+++ b/opensm/opensm/osm_drop_mgr.c
@@ -56,7 +56,6 @@
 #include <complib/cl_passivelock.h>
 #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>
@@ -69,56 +68,17 @@
 
 /**********************************************************************
  **********************************************************************/
-void osm_drop_mgr_construct(IN osm_drop_mgr_t * const p_mgr)
-{
-	CL_ASSERT(p_mgr);
-	memset(p_mgr, 0, sizeof(*p_mgr));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_drop_mgr_destroy(IN osm_drop_mgr_t * const p_mgr)
-{
-	CL_ASSERT(p_mgr);
-
-	OSM_LOG_ENTER(p_mgr->p_log, osm_drop_mgr_destroy);
-
-	OSM_LOG_EXIT(p_mgr->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-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(sm->p_log, osm_drop_mgr_init);
-
-	osm_drop_mgr_construct(p_mgr);
-
-	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;
-
-	OSM_LOG_EXIT(p_mgr->p_log);
-	return (status);
-}
-
-/**********************************************************************
- **********************************************************************/
 static void
-__osm_drop_mgr_remove_router(IN const osm_drop_mgr_t * const p_mgr,
+__osm_drop_mgr_remove_router(osm_sm_t *sm,
 			     IN const ib_net64_t portguid)
 {
 	osm_router_t *p_rtr;
 	cl_qmap_t *p_rtr_guid_tbl;
 
-	p_rtr_guid_tbl = &p_mgr->p_subn->rtr_guid_tbl;
+	p_rtr_guid_tbl = &sm->p_subn->rtr_guid_tbl;
 	p_rtr = (osm_router_t *) cl_qmap_remove(p_rtr_guid_tbl, portguid);
 	if (p_rtr != (osm_router_t *) cl_qmap_end(p_rtr_guid_tbl)) {
-		osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+		osm_log(sm->p_log, OSM_LOG_VERBOSE,
 			"__osm_drop_mgr_remove_router: "
 			"Cleaned router for port guid 0x%016" PRIx64 "\n",
 			cl_ntoh64(portguid));
@@ -129,7 +89,7 @@ __osm_drop_mgr_remove_router(IN const osm_drop_mgr_t * const p_mgr,
 /**********************************************************************
  **********************************************************************/
 static void
-drop_mgr_clean_physp(IN const osm_drop_mgr_t * const p_mgr,
+drop_mgr_clean_physp(osm_sm_t *sm,
 		     IN osm_physp_t * p_physp)
 {
 	osm_physp_t *p_remote_physp;
@@ -137,7 +97,7 @@ drop_mgr_clean_physp(IN const osm_drop_mgr_t * const p_mgr,
 
 	p_remote_physp = osm_physp_get_remote(p_physp);
 	if (p_remote_physp) {
-		p_remote_port = osm_get_port_by_guid(p_mgr->p_subn,
+		p_remote_port = osm_get_port_by_guid(sm->p_subn,
 						     p_remote_physp->port_guid);
 
 		if (p_remote_port) {
@@ -149,14 +109,14 @@ drop_mgr_clean_physp(IN const osm_drop_mgr_t * const p_mgr,
 			if (p_remote_port->discovery_count &&
 			    osm_physp_get_port_state(p_remote_physp) ==
 			    IB_LINK_ACTIVE) {
-				osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+				osm_log(sm->p_log, OSM_LOG_VERBOSE,
 					"drop_mgr_clean_physp: "
 					"Forcing new heavy sweep. Remote "
 					"port 0x%016" PRIx64 " port num: 0x%X "
 					"was recognized in ACTIVE state\n",
 					cl_ntoh64(p_remote_physp->port_guid),
 					p_remote_physp->port_num);
-				p_mgr->p_subn->force_heavy_sweep = TRUE;
+				sm->p_subn->force_heavy_sweep = TRUE;
 			}
 
 			/* If the remote node is ca or router - need to remove the remote port,
@@ -164,7 +124,7 @@ drop_mgr_clean_physp(IN const osm_drop_mgr_t * const p_mgr,
 			   discovery count of the remote port. */
 			if (!p_remote_physp->p_node->sw) {
 				p_remote_port->discovery_count = 0;
-				osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+				osm_log(sm->p_log, OSM_LOG_DEBUG,
 					"drop_mgr_clean_physp: Resetting discovery count of node: "
 					"0x%016" PRIx64 " port num:0x%X\n",
 					cl_ntoh64(osm_node_get_node_guid
@@ -173,7 +133,7 @@ drop_mgr_clean_physp(IN const osm_drop_mgr_t * const p_mgr,
 			}
 		}
 
-		osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+		osm_log(sm->p_log, OSM_LOG_VERBOSE,
 			"drop_mgr_clean_physp: "
 			"Unlinking local node 0x%016" PRIx64 ", port 0x%X"
 			"\n\t\t\t\tand remote node 0x%016" PRIx64
@@ -188,7 +148,7 @@ drop_mgr_clean_physp(IN const osm_drop_mgr_t * const p_mgr,
 
 	}
 
-	osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+	osm_log(sm->p_log, OSM_LOG_DEBUG,
 		"drop_mgr_clean_physp: Clearing node 0x%016" PRIx64
 		" physical port number 0x%X\n",
 		cl_ntoh64(osm_node_get_node_guid(p_physp->p_node)),
@@ -200,7 +160,7 @@ drop_mgr_clean_physp(IN const osm_drop_mgr_t * const p_mgr,
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_drop_mgr_remove_port(IN const osm_drop_mgr_t * const p_mgr,
+__osm_drop_mgr_remove_port(osm_sm_t *sm,
 			   IN osm_port_t * p_port)
 {
 	ib_net64_t port_guid;
@@ -218,58 +178,58 @@ __osm_drop_mgr_remove_port(IN const osm_drop_mgr_t * const p_mgr,
 	ib_mad_notice_attr_t notice;
 	ib_api_status_t status;
 
-	OSM_LOG_ENTER(p_mgr->p_log, __osm_drop_mgr_remove_port);
+	OSM_LOG_ENTER(sm->p_log, __osm_drop_mgr_remove_port);
 
 	port_guid = osm_port_get_guid(p_port);
-	osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+	osm_log(sm->p_log, OSM_LOG_VERBOSE,
 		"__osm_drop_mgr_remove_port: "
 		"Unreachable port 0x%016" PRIx64 "\n", cl_ntoh64(port_guid));
 
 	p_port_check =
-	    (osm_port_t *) cl_qmap_remove(&p_mgr->p_subn->port_guid_tbl,
+	    (osm_port_t *) cl_qmap_remove(&sm->p_subn->port_guid_tbl,
 					  port_guid);
 	if (p_port_check != p_port) {
-		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_drop_mgr_remove_port: ERR 0101: "
 			"Port 0x%016" PRIx64 " not in guid table\n",
 			cl_ntoh64(port_guid));
 		goto Exit;
 	}
 
-	p_sm_guid_tbl = &p_mgr->p_subn->sm_guid_tbl;
+	p_sm_guid_tbl = &sm->p_subn->sm_guid_tbl;
 	p_sm = (osm_remote_sm_t *) cl_qmap_remove(p_sm_guid_tbl, port_guid);
 	if (p_sm != (osm_remote_sm_t *) cl_qmap_end(p_sm_guid_tbl)) {
 		/* need to remove this item */
-		osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+		osm_log(sm->p_log, OSM_LOG_VERBOSE,
 			"__osm_drop_mgr_remove_port: "
 			"Cleaned SM for port guid\n");
 
 		free(p_sm);
 	}
 
-	__osm_drop_mgr_remove_router(p_mgr, port_guid);
+	__osm_drop_mgr_remove_router(sm, port_guid);
 
 	osm_port_get_lid_range_ho(p_port, &min_lid_ho, &max_lid_ho);
 
-	osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+	osm_log(sm->p_log, OSM_LOG_VERBOSE,
 		"__osm_drop_mgr_remove_port: "
 		"Clearing abandoned LID range [0x%X,0x%X]\n",
 		min_lid_ho, max_lid_ho);
 
-	p_port_lid_tbl = &p_mgr->p_subn->port_lid_tbl;
+	p_port_lid_tbl = &sm->p_subn->port_lid_tbl;
 	for (lid_ho = min_lid_ho; lid_ho <= max_lid_ho; lid_ho++)
 		cl_ptr_vector_set(p_port_lid_tbl, lid_ho, NULL);
 
-	drop_mgr_clean_physp(p_mgr, p_port->p_physp);
+	drop_mgr_clean_physp(sm, p_port->p_physp);
 
 	p_mcm = (osm_mcm_info_t *) cl_qlist_remove_head(&p_port->mcm_list);
 	while (p_mcm != (osm_mcm_info_t *) cl_qlist_end(&p_port->mcm_list)) {
 		p_mgrp =
-		    (osm_mgrp_t *) cl_qmap_get(&p_mgr->p_subn->mgrp_mlid_tbl,
+		    (osm_mgrp_t *) cl_qmap_get(&sm->p_subn->mgrp_mlid_tbl,
 					       p_mcm->mlid);
 		if (p_mgrp !=
-		    (osm_mgrp_t *) cl_qmap_end(&p_mgr->p_subn->mgrp_mlid_tbl)) {
-			osm_mgrp_remove_port(p_mgr->p_subn, p_mgr->p_log,
+		    (osm_mgrp_t *) cl_qmap_end(&sm->p_subn->mgrp_mlid_tbl)) {
+			osm_mgrp_remove_port(sm->p_subn, sm->p_log,
 					     p_mgrp, p_port->guid);
 			osm_mcm_info_delete((osm_mcm_info_t *) p_mcm);
 		}
@@ -290,30 +250,30 @@ __osm_drop_mgr_remove_port(IN const osm_drop_mgr_t * const p_mgr,
 	/* endport ceases to be reachable */
 	notice.g_or_v.generic.trap_num = CL_HTON16(65);
 	/* The sm_base_lid is saved in network order already. */
-	notice.issuer_lid = p_mgr->p_subn->sm_base_lid;
+	notice.issuer_lid = sm->p_subn->sm_base_lid;
 	/* following C14-72.1.2 and table 119 p725 */
 	/* we need to provide the GID */
-	port_gid.unicast.prefix = p_mgr->p_subn->opt.subnet_prefix;
+	port_gid.unicast.prefix = sm->p_subn->opt.subnet_prefix;
 	port_gid.unicast.interface_id = port_guid;
 	memcpy(&(notice.data_details.ntc_64_67.gid),
 	       &(port_gid), sizeof(ib_gid_t));
 
 	/* According to page 653 - the issuer gid in this case of trap
 	   is the SM gid, since the SM is the initiator of this trap. */
-	notice.issuer_gid.unicast.prefix = p_mgr->p_subn->opt.subnet_prefix;
-	notice.issuer_gid.unicast.interface_id = p_mgr->p_subn->sm_port_guid;
+	notice.issuer_gid.unicast.prefix = sm->p_subn->opt.subnet_prefix;
+	notice.issuer_gid.unicast.interface_id = sm->p_subn->sm_port_guid;
 
-	status = osm_report_notice(p_mgr->p_log, p_mgr->p_subn, &notice);
+	status = osm_report_notice(sm->p_log, sm->p_subn, &notice);
 	if (status != IB_SUCCESS) {
-		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_drop_mgr_remove_port: ERR 0103: "
 			"Error sending trap reports (%s)\n",
 			ib_get_err_str(status));
 		goto Exit;
 	}
 
-	if (osm_log_is_active(p_mgr->p_log, OSM_LOG_INFO)) {
-		osm_log(p_mgr->p_log, OSM_LOG_INFO,
+	if (osm_log_is_active(sm->p_log, OSM_LOG_INFO)) {
+		osm_log(sm->p_log, OSM_LOG_INFO,
 			"__osm_drop_mgr_remove_port: "
 			"Removed port with GUID:0x%016" PRIx64
 			" LID range [0x%X,0x%X] of node:%s\n",
@@ -323,27 +283,27 @@ __osm_drop_mgr_remove_port(IN const osm_drop_mgr_t * const p_mgr,
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_mgr->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_drop_mgr_remove_switch(IN const osm_drop_mgr_t * const p_mgr,
+__osm_drop_mgr_remove_switch(osm_sm_t *sm,
 			     IN osm_node_t * p_node)
 {
 	osm_switch_t *p_sw;
 	cl_qmap_t *p_sw_guid_tbl;
 	ib_net64_t node_guid;
 
-	OSM_LOG_ENTER(p_mgr->p_log, __osm_drop_mgr_remove_switch);
+	OSM_LOG_ENTER(sm->p_log, __osm_drop_mgr_remove_switch);
 
 	node_guid = osm_node_get_node_guid(p_node);
-	p_sw_guid_tbl = &p_mgr->p_subn->sw_guid_tbl;
+	p_sw_guid_tbl = &sm->p_subn->sw_guid_tbl;
 
 	p_sw = (osm_switch_t *) cl_qmap_remove(p_sw_guid_tbl, node_guid);
 	if (p_sw == (osm_switch_t *) cl_qmap_end(p_sw_guid_tbl)) {
-		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_drop_mgr_remove_switch: ERR 0102: "
 			"Node 0x%016" PRIx64 " not in switch table\n",
 			cl_ntoh64(osm_node_get_node_guid(p_node)));
@@ -352,13 +312,13 @@ __osm_drop_mgr_remove_switch(IN const osm_drop_mgr_t * const p_mgr,
 		osm_switch_delete(&p_sw);
 	}
 
-	OSM_LOG_EXIT(p_mgr->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static boolean_t
-__osm_drop_mgr_process_node(IN const osm_drop_mgr_t * const p_mgr,
+__osm_drop_mgr_process_node(osm_sm_t *sm,
 			    IN osm_node_t * p_node)
 {
 	osm_physp_t *p_physp;
@@ -369,9 +329,9 @@ __osm_drop_mgr_process_node(IN const osm_drop_mgr_t * const p_mgr,
 	ib_net64_t port_guid;
 	boolean_t return_val = FALSE;
 
-	OSM_LOG_ENTER(p_mgr->p_log, __osm_drop_mgr_process_node);
+	OSM_LOG_ENTER(sm->p_log, __osm_drop_mgr_process_node);
 
-	osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+	osm_log(sm->p_log, OSM_LOG_VERBOSE,
 		"__osm_drop_mgr_process_node: "
 		"Unreachable node 0x%016" PRIx64 "\n",
 		cl_ntoh64(osm_node_get_node_guid(p_node)));
@@ -386,25 +346,25 @@ __osm_drop_mgr_process_node(IN const osm_drop_mgr_t * const p_mgr,
 		if (p_physp) {
 			port_guid = osm_physp_get_port_guid(p_physp);
 
-			p_port = osm_get_port_by_guid(p_mgr->p_subn, port_guid);
+			p_port = osm_get_port_by_guid(sm->p_subn, port_guid);
 
 			if (p_port)
-				__osm_drop_mgr_remove_port(p_mgr, p_port);
+				__osm_drop_mgr_remove_port(sm, p_port);
 			else
-				drop_mgr_clean_physp(p_mgr, p_physp);
+				drop_mgr_clean_physp(sm, p_physp);
 		}
 	}
 
 	return_val = TRUE;
 
 	if (p_node->sw)
-		__osm_drop_mgr_remove_switch(p_mgr, p_node);
+		__osm_drop_mgr_remove_switch(sm, p_node);
 
 	p_node_check =
-	    (osm_node_t *) cl_qmap_remove(&p_mgr->p_subn->node_guid_tbl,
+	    (osm_node_t *) cl_qmap_remove(&sm->p_subn->node_guid_tbl,
 					  osm_node_get_node_guid(p_node));
 	if (p_node_check != p_node) {
-		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_drop_mgr_process_node: ERR 0105: "
 			"Node 0x%016" PRIx64 " not in guid table\n",
 			cl_ntoh64(osm_node_get_node_guid(p_node)));
@@ -413,14 +373,14 @@ __osm_drop_mgr_process_node(IN const osm_drop_mgr_t * const p_mgr,
 	/* free memory allocated to node */
 	osm_node_delete(&p_node);
 
-	OSM_LOG_EXIT(p_mgr->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 	return (return_val);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_drop_mgr_check_node(IN const osm_drop_mgr_t * const p_mgr,
+__osm_drop_mgr_check_node(osm_sm_t *sm,
 			  IN osm_node_t * p_node)
 {
 	ib_net64_t node_guid;
@@ -428,12 +388,12 @@ __osm_drop_mgr_check_node(IN const osm_drop_mgr_t * const p_mgr,
 	osm_port_t *p_port;
 	ib_net64_t port_guid;
 
-	OSM_LOG_ENTER(p_mgr->p_log, __osm_drop_mgr_check_node);
+	OSM_LOG_ENTER(sm->p_log, __osm_drop_mgr_check_node);
 
 	node_guid = osm_node_get_node_guid(p_node);
 
 	if (osm_node_get_type(p_node) != IB_NODE_TYPE_SWITCH) {
-		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_drop_mgr_check_node: ERR 0107: "
 			"Node 0x%016" PRIx64 " is not a switch node\n",
 			cl_ntoh64(node_guid));
@@ -443,59 +403,59 @@ __osm_drop_mgr_check_node(IN const osm_drop_mgr_t * const p_mgr,
 	/* Make sure we have a switch object for this node */
 	if (!p_node->sw) {
 		/* We do not have switch info for this node */
-		osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+		osm_log(sm->p_log, OSM_LOG_VERBOSE,
 			"__osm_drop_mgr_check_node: "
 			"Node 0x%016" PRIx64 " no switch in table\n",
 			cl_ntoh64(node_guid));
 
-		__osm_drop_mgr_process_node(p_mgr, p_node);
+		__osm_drop_mgr_process_node(sm, p_node);
 		goto Exit;
 	}
 
 	/* Make sure we have a port object for port zero */
 	p_physp = osm_node_get_physp_ptr(p_node, 0);
 	if (!p_physp) {
-		osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+		osm_log(sm->p_log, OSM_LOG_VERBOSE,
 			"__osm_drop_mgr_check_node: "
 			"Node 0x%016" PRIx64 " no valid physical port 0\n",
 			cl_ntoh64(node_guid));
 
-		__osm_drop_mgr_process_node(p_mgr, p_node);
+		__osm_drop_mgr_process_node(sm, p_node);
 		goto Exit;
 	}
 
 	port_guid = osm_physp_get_port_guid(p_physp);
 
-	p_port = osm_get_port_by_guid(p_mgr->p_subn, port_guid);
+	p_port = osm_get_port_by_guid(sm->p_subn, port_guid);
 
 	if (!p_port) {
-		osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+		osm_log(sm->p_log, OSM_LOG_VERBOSE,
 			"__osm_drop_mgr_check_node: "
 			"Node 0x%016" PRIx64 " has no port object\n",
 			cl_ntoh64(node_guid));
 
-		__osm_drop_mgr_process_node(p_mgr, p_node);
+		__osm_drop_mgr_process_node(sm, p_node);
 		goto Exit;
 	}
 
 	if (p_port->discovery_count == 0) {
-		osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+		osm_log(sm->p_log, OSM_LOG_VERBOSE,
 			"__osm_drop_mgr_check_node: "
 			"Node 0x%016" PRIx64 " port has discovery count zero\n",
 			cl_ntoh64(node_guid));
 
-		__osm_drop_mgr_process_node(p_mgr, p_node);
+		__osm_drop_mgr_process_node(sm, p_node);
 		goto Exit;
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_mgr->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 	return;
 }
 
 /**********************************************************************
  **********************************************************************/
-void osm_drop_mgr_process(IN const osm_drop_mgr_t * const p_mgr)
+void osm_drop_mgr_process(osm_sm_t *sm)
 {
 	cl_qmap_t *p_node_guid_tbl;
 	cl_qmap_t *p_port_guid_tbl;
@@ -506,14 +466,14 @@ void osm_drop_mgr_process(IN const osm_drop_mgr_t * const p_mgr)
 	ib_net64_t port_guid;
 	ib_net64_t node_guid;
 
-	CL_ASSERT(p_mgr);
+	CL_ASSERT(sm);
 
-	OSM_LOG_ENTER(p_mgr->p_log, osm_drop_mgr_process);
+	OSM_LOG_ENTER(sm->p_log, osm_drop_mgr_process);
 
-	p_node_guid_tbl = &p_mgr->p_subn->node_guid_tbl;
-	p_port_guid_tbl = &p_mgr->p_subn->port_guid_tbl;
+	p_node_guid_tbl = &sm->p_subn->node_guid_tbl;
+	p_port_guid_tbl = &sm->p_subn->port_guid_tbl;
 
-	CL_PLOCK_EXCL_ACQUIRE(p_mgr->p_lock);
+	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
 
 	p_next_node = (osm_node_t *) cl_qmap_head(p_node_guid_tbl);
 	while (p_next_node != (osm_node_t *) cl_qmap_end(p_node_guid_tbl)) {
@@ -524,9 +484,9 @@ void osm_drop_mgr_process(IN const osm_drop_mgr_t * const p_mgr)
 		CL_ASSERT(cl_qmap_key(&p_node->map_item) ==
 			  osm_node_get_node_guid(p_node));
 
-		if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
+		if (osm_log_is_active(sm->p_log, OSM_LOG_DEBUG)) {
 			node_guid = osm_node_get_node_guid(p_node);
-			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+			osm_log(sm->p_log, OSM_LOG_DEBUG,
 				"osm_drop_mgr_process: "
 				"Checking node 0x%016" PRIx64 "\n",
 				cl_ntoh64(node_guid));
@@ -538,7 +498,7 @@ void osm_drop_mgr_process(IN const osm_drop_mgr_t * const p_mgr)
 		   should therefore be removed from the subnet object.
 		 */
 		if (p_node->discovery_count == 0)
-			__osm_drop_mgr_process_node(p_mgr, p_node);
+			__osm_drop_mgr_process_node(sm, p_node);
 	}
 
 	/*
@@ -554,9 +514,9 @@ void osm_drop_mgr_process(IN const osm_drop_mgr_t * const p_mgr)
 		p_next_node =
 		    (osm_node_t *) cl_qmap_next(&p_next_node->map_item);
 
-		if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
+		if (osm_log_is_active(sm->p_log, OSM_LOG_DEBUG)) {
 			node_guid = osm_node_get_node_guid(p_node);
-			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+			osm_log(sm->p_log, OSM_LOG_DEBUG,
 				"osm_drop_mgr_process: "
 				"Checking full discovery of node 0x%016" PRIx64
 				"\n", cl_ntoh64(node_guid));
@@ -566,7 +526,7 @@ void osm_drop_mgr_process(IN const osm_drop_mgr_t * const p_mgr)
 			continue;
 
 		/* We are handling a switch node */
-		__osm_drop_mgr_check_node(p_mgr, p_node);
+		__osm_drop_mgr_check_node(sm, p_node);
 	}
 
 	p_next_port = (osm_port_t *) cl_qmap_head(p_port_guid_tbl);
@@ -578,9 +538,9 @@ void osm_drop_mgr_process(IN const osm_drop_mgr_t * const p_mgr)
 		CL_ASSERT(cl_qmap_key(&p_port->map_item) ==
 			  osm_port_get_guid(p_port));
 
-		if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
+		if (osm_log_is_active(sm->p_log, OSM_LOG_DEBUG)) {
 			port_guid = osm_port_get_guid(p_port);
-			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+			osm_log(sm->p_log, OSM_LOG_DEBUG,
 				"osm_drop_mgr_process: "
 				"Checking port 0x%016" PRIx64 "\n",
 				cl_ntoh64(port_guid));
@@ -590,9 +550,9 @@ void osm_drop_mgr_process(IN const osm_drop_mgr_t * const p_mgr)
 		   If the port is unreachable, remove it from the guid table.
 		 */
 		if (p_port->discovery_count == 0)
-			__osm_drop_mgr_remove_port(p_mgr, p_port);
+			__osm_drop_mgr_remove_port(sm, p_port);
 	}
 
-	CL_PLOCK_RELEASE(p_mgr->p_lock);
-	OSM_LOG_EXIT(p_mgr->p_log);
+	CL_PLOCK_RELEASE(sm->p_lock);
+	OSM_LOG_EXIT(sm->p_log);
 }
diff --git a/opensm/opensm/osm_link_mgr.c b/opensm/opensm/osm_link_mgr.c
index 19cb27d..723d9f6 100644
--- a/opensm/opensm/osm_link_mgr.c
+++ b/opensm/opensm/osm_link_mgr.c
@@ -51,7 +51,6 @@
 #include <string.h>
 #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>
@@ -60,44 +59,8 @@
 
 /**********************************************************************
  **********************************************************************/
-void osm_link_mgr_construct(IN osm_link_mgr_t * const p_mgr)
-{
-	memset(p_mgr, 0, sizeof(*p_mgr));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_link_mgr_destroy(IN osm_link_mgr_t * const p_mgr)
-{
-	OSM_LOG_ENTER(p_mgr->p_log, osm_link_mgr_destroy);
-
-	OSM_LOG_EXIT(p_mgr->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-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(sm->p_log, osm_link_mgr_init);
-
-	osm_link_mgr_construct(p_mgr);
-
-	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;
-
-	OSM_LOG_EXIT(p_mgr->p_log);
-	return (status);
-}
-
-/**********************************************************************
- **********************************************************************/
 static boolean_t
-__osm_link_mgr_set_physp_pi(IN osm_link_mgr_t * const p_mgr,
+__osm_link_mgr_set_physp_pi(osm_sm_t *sm,
 			    IN osm_physp_t * const p_physp,
 			    IN uint8_t const port_state)
 {
@@ -114,7 +77,7 @@ __osm_link_mgr_set_physp_pi(IN osm_link_mgr_t * const p_mgr,
 	boolean_t send_set = FALSE;
 	osm_physp_t *p_remote_physp;
 
-	OSM_LOG_ENTER(p_mgr->p_log, __osm_link_mgr_set_physp_pi);
+	OSM_LOG_ENTER(sm->p_log, __osm_link_mgr_set_physp_pi);
 
 	p_node = osm_physp_get_node_ptr(p_physp);
 
@@ -127,7 +90,7 @@ __osm_link_mgr_set_physp_pi(IN osm_link_mgr_t * const p_mgr,
 		   For base port 0 the following parameters are not valid (p822, table 145).
 		 */
 		if (!p_node->sw) {
-			osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"__osm_link_mgr_set_physp_pi: ERR 4201: "
 				"Cannot find switch by guid: 0x%" PRIx64 "\n",
 				cl_ntoh64(p_node->node_info.node_guid));
@@ -138,8 +101,8 @@ __osm_link_mgr_set_physp_pi(IN osm_link_mgr_t * const p_mgr,
 		    == FALSE) {
 			/* This means the switch doesn't support enhanced port 0.
 			   Can skip it. */
-			if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG))
-				osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+			if (osm_log_is_active(sm->p_log, OSM_LOG_DEBUG))
+				osm_log(sm->p_log, OSM_LOG_DEBUG,
 					"__osm_link_mgr_set_physp_pi: "
 					"Skipping port 0, GUID 0x%016" PRIx64
 					"\n",
@@ -184,12 +147,12 @@ __osm_link_mgr_set_physp_pi(IN osm_link_mgr_t * const p_mgr,
 		/* The following fields are relevant only for CA port, router, or Enh. SP0 */
 		if (osm_node_get_type(p_node) != IB_NODE_TYPE_SWITCH ||
 		    port_num == 0) {
-			p_pi->m_key = p_mgr->p_subn->opt.m_key;
+			p_pi->m_key = sm->p_subn->opt.m_key;
 			if (memcmp(&p_pi->m_key, &p_old_pi->m_key,
 				   sizeof(p_pi->m_key)))
 				send_set = TRUE;
 
-			p_pi->subnet_prefix = p_mgr->p_subn->opt.subnet_prefix;
+			p_pi->subnet_prefix = sm->p_subn->opt.subnet_prefix;
 			if (memcmp(&p_pi->subnet_prefix,
 				   &p_old_pi->subnet_prefix,
 				   sizeof(p_pi->subnet_prefix)))
@@ -201,24 +164,24 @@ __osm_link_mgr_set_physp_pi(IN osm_link_mgr_t * const p_mgr,
 				send_set = TRUE;
 
 			/* we are initializing the ports with our local sm_base_lid */
-			p_pi->master_sm_base_lid = p_mgr->p_subn->sm_base_lid;
+			p_pi->master_sm_base_lid = sm->p_subn->sm_base_lid;
 			if (memcmp(&p_pi->master_sm_base_lid,
 				   &p_old_pi->master_sm_base_lid,
 				   sizeof(p_pi->master_sm_base_lid)))
 				send_set = TRUE;
 
 			p_pi->m_key_lease_period =
-			    p_mgr->p_subn->opt.m_key_lease_period;
+			    sm->p_subn->opt.m_key_lease_period;
 			if (memcmp(&p_pi->m_key_lease_period,
 				   &p_old_pi->m_key_lease_period,
 				   sizeof(p_pi->m_key_lease_period)))
 				send_set = TRUE;
 
 			if (esp0 == FALSE)
-				p_pi->mkey_lmc = p_mgr->p_subn->opt.lmc;
+				p_pi->mkey_lmc = sm->p_subn->opt.lmc;
 			else {
-				if (p_mgr->p_subn->opt.lmc_esp0)
-					p_pi->mkey_lmc = p_mgr->p_subn->opt.lmc;
+				if (sm->p_subn->opt.lmc_esp0)
+					p_pi->mkey_lmc = sm->p_subn->opt.lmc;
 				else
 					p_pi->mkey_lmc = 0;
 			}
@@ -227,7 +190,7 @@ __osm_link_mgr_set_physp_pi(IN osm_link_mgr_t * const p_mgr,
 				send_set = TRUE;
 
 			ib_port_info_set_timeout(p_pi,
-						 p_mgr->p_subn->opt.
+						 sm->p_subn->opt.
 						 subnet_timeout);
 			if (ib_port_info_get_timeout(p_pi) !=
 			    ib_port_info_get_timeout(p_old_pi))
@@ -242,7 +205,7 @@ __osm_link_mgr_set_physp_pi(IN osm_link_mgr_t * const p_mgr,
 			if (osm_node_get_type(osm_physp_get_node_ptr(p_physp))
 			    == IB_NODE_TYPE_ROUTER) {
 				ib_port_info_set_hoq_lifetime(p_pi,
-							      p_mgr->p_subn->
+							      sm->p_subn->
 							      opt.
 							      leaf_head_of_queue_lifetime);
 			} else
@@ -254,23 +217,23 @@ __osm_link_mgr_set_physp_pi(IN osm_link_mgr_t * const p_mgr,
 				    (osm_physp_get_node_ptr(p_remote_physp)) !=
 				    IB_NODE_TYPE_SWITCH) {
 					ib_port_info_set_hoq_lifetime(p_pi,
-								      p_mgr->
+								      sm->
 								      p_subn->
 								      opt.
 								      leaf_head_of_queue_lifetime);
 					ib_port_info_set_vl_stall_count(p_pi,
-									p_mgr->
+									sm->
 									p_subn->
 									opt.
 									leaf_vl_stall_count);
 				} else {
 					ib_port_info_set_hoq_lifetime(p_pi,
-								      p_mgr->
+								      sm->
 								      p_subn->
 								      opt.
 								      head_of_queue_lifetime);
 					ib_port_info_set_vl_stall_count(p_pi,
-									p_mgr->
+									sm->
 									p_subn->
 									opt.
 									vl_stall_count);
@@ -284,9 +247,9 @@ __osm_link_mgr_set_physp_pi(IN osm_link_mgr_t * const p_mgr,
 		}
 
 		ib_port_info_set_phy_and_overrun_err_thd(p_pi,
-							 p_mgr->p_subn->opt.
+							 sm->p_subn->opt.
 							 local_phy_errors_threshold,
-							 p_mgr->p_subn->opt.
+							 sm->p_subn->opt.
 							 overrun_errors_threshold);
 		if (memcmp(&p_pi->error_threshold, &p_old_pi->error_threshold,
 			   sizeof(p_pi->error_threshold)))
@@ -302,12 +265,12 @@ __osm_link_mgr_set_physp_pi(IN osm_link_mgr_t * const p_mgr,
 			   sizeof(p_pi->link_width_enabled)))
 			send_set = TRUE;
 
-		if (p_mgr->p_subn->opt.force_link_speed &&
-		    (p_mgr->p_subn->opt.force_link_speed != 15 ||
+		if (sm->p_subn->opt.force_link_speed &&
+		    (sm->p_subn->opt.force_link_speed != 15 ||
 		     ib_port_info_get_link_speed_enabled(p_pi) !=
 		     ib_port_info_get_link_speed_sup(p_pi))) {
 			ib_port_info_set_link_speed_enabled(p_pi,
-							    p_mgr->p_subn->opt.
+							    sm->p_subn->opt.
 							    force_link_speed);
 			if (memcmp(&p_pi->link_speed, &p_old_pi->link_speed,
 				   sizeof(p_pi->link_speed)))
@@ -316,9 +279,9 @@ __osm_link_mgr_set_physp_pi(IN osm_link_mgr_t * const p_mgr,
 
 		/* calc new op_vls and mtu */
 		op_vls =
-		    osm_physp_calc_link_op_vls(p_mgr->p_log, p_mgr->p_subn,
+		    osm_physp_calc_link_op_vls(sm->p_log, sm->p_subn,
 					       p_physp);
-		mtu = osm_physp_calc_link_mtu(p_mgr->p_log, p_physp);
+		mtu = osm_physp_calc_link_mtu(sm->p_log, p_physp);
 
 		ib_port_info_set_neighbor_mtu(p_pi, mtu);
 		if (ib_port_info_get_neighbor_mtu(p_pi) !=
@@ -331,7 +294,7 @@ __osm_link_mgr_set_physp_pi(IN osm_link_mgr_t * const p_mgr,
 			send_set = TRUE;
 
 		/* provide the vl_high_limit from the qos mgr */
-		if (p_mgr->p_subn->opt.qos &&
+		if (sm->p_subn->opt.qos &&
 		    p_physp->vl_high_limit != p_old_pi->vl_high_limit) {
 			send_set = TRUE;
 			p_pi->vl_high_limit = p_physp->vl_high_limit;
@@ -362,27 +325,25 @@ __osm_link_mgr_set_physp_pi(IN osm_link_mgr_t * const p_mgr,
 	   PortInfoSet to every port.
 	 */
 	if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH && port_num
-	    && p_mgr->p_subn->first_time_master_sweep == TRUE)
+	    && sm->p_subn->first_time_master_sweep == TRUE)
 		send_set = TRUE;
 
 	if (send_set)
-		status = osm_req_set(p_mgr->sm,
-				     osm_physp_get_dr_path_ptr(p_physp),
-				     payload,
-				     sizeof(payload),
+		status = osm_req_set(sm, osm_physp_get_dr_path_ptr(p_physp),
+				     payload, sizeof(payload),
 				     IB_MAD_ATTR_PORT_INFO,
 				     cl_hton32(port_num),
 				     CL_DISP_MSGID_NONE, &context);
 
       Exit:
-	OSM_LOG_EXIT(p_mgr->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 	return send_set;
 }
 
 /**********************************************************************
  **********************************************************************/
 static osm_signal_t
-__osm_link_mgr_process_node(IN osm_link_mgr_t * const p_mgr,
+__osm_link_mgr_process_node(osm_sm_t *sm,
 			    IN osm_node_t * const p_node,
 			    IN const uint8_t link_state)
 {
@@ -392,10 +353,10 @@ __osm_link_mgr_process_node(IN osm_link_mgr_t * const p_mgr,
 	uint8_t current_state;
 	osm_signal_t signal = OSM_SIGNAL_DONE;
 
-	OSM_LOG_ENTER(p_mgr->p_log, __osm_link_mgr_process_node);
+	OSM_LOG_ENTER(sm->p_log, __osm_link_mgr_process_node);
 
-	if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG))
-		osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+	if (osm_log_is_active(sm->p_log, OSM_LOG_DEBUG))
+		osm_log(sm->p_log, OSM_LOG_DEBUG,
 			"__osm_link_mgr_process_node: "
 			"Node 0x%" PRIx64 " going to %s\n",
 			cl_ntoh64(osm_node_get_node_guid(p_node)),
@@ -428,46 +389,46 @@ __osm_link_mgr_process_node(IN osm_link_mgr_t * const p_mgr,
 		 */
 		if (link_state != IB_LINK_NO_CHANGE &&
 		    link_state <= current_state)
-			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+			osm_log(sm->p_log, OSM_LOG_DEBUG,
 				"__osm_link_mgr_process_node: "
 				"Physical port 0x%X already %s. Skipping\n",
 				p_physp->port_num,
 				ib_get_port_state_str(current_state));
-		else if (__osm_link_mgr_set_physp_pi(p_mgr, p_physp,
+		else if (__osm_link_mgr_set_physp_pi(sm, p_physp,
 						     link_state))
 			signal = OSM_SIGNAL_DONE_PENDING;
 	}
 
-	OSM_LOG_EXIT(p_mgr->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 	return (signal);
 }
 
 /**********************************************************************
  **********************************************************************/
 osm_signal_t
-osm_link_mgr_process(IN osm_link_mgr_t * const p_mgr,
+osm_link_mgr_process(osm_sm_t *sm,
 		     IN const uint8_t link_state)
 {
 	cl_qmap_t *p_node_guid_tbl;
 	osm_node_t *p_node;
 	osm_signal_t signal = OSM_SIGNAL_DONE;
 
-	OSM_LOG_ENTER(p_mgr->p_log, osm_link_mgr_process);
+	OSM_LOG_ENTER(sm->p_log, osm_link_mgr_process);
 
-	p_node_guid_tbl = &p_mgr->p_subn->node_guid_tbl;
+	p_node_guid_tbl = &sm->p_subn->node_guid_tbl;
 
-	CL_PLOCK_EXCL_ACQUIRE(p_mgr->p_lock);
+	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
 
 	for (p_node = (osm_node_t *) cl_qmap_head(p_node_guid_tbl);
 	     p_node != (osm_node_t *) cl_qmap_end(p_node_guid_tbl);
 	     p_node = (osm_node_t *) cl_qmap_next(&p_node->map_item)) {
-		if (__osm_link_mgr_process_node(p_mgr, p_node, link_state) ==
+		if (__osm_link_mgr_process_node(sm, p_node, link_state) ==
 		    OSM_SIGNAL_DONE_PENDING)
 			signal = OSM_SIGNAL_DONE_PENDING;
 	}
 
-	CL_PLOCK_RELEASE(p_mgr->p_lock);
+	CL_PLOCK_RELEASE(sm->p_lock);
 
-	OSM_LOG_EXIT(p_mgr->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 	return (signal);
 }
diff --git a/opensm/opensm/osm_mcast_mgr.c b/opensm/opensm/osm_mcast_mgr.c
index ca42a9f..44312a0 100644
--- a/opensm/opensm/osm_mcast_mgr.c
+++ b/opensm/opensm/osm_mcast_mgr.c
@@ -53,7 +53,6 @@
 #include <iba/ib_types.h>
 #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>
@@ -121,23 +120,23 @@ static void __osm_mcast_mgr_purge_tree_node(IN osm_mtree_node_t * p_mtn)
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_mcast_mgr_purge_tree(IN osm_mcast_mgr_t * const p_mgr,
+__osm_mcast_mgr_purge_tree(osm_sm_t *sm,
 			   IN osm_mgrp_t * const p_mgrp)
 {
-	OSM_LOG_ENTER(p_mgr->p_log, __osm_mcast_mgr_purge_tree);
+	OSM_LOG_ENTER(sm->p_log, __osm_mcast_mgr_purge_tree);
 
 	if (p_mgrp->p_root)
 		__osm_mcast_mgr_purge_tree_node(p_mgrp->p_root);
 
 	p_mgrp->p_root = NULL;
 
-	OSM_LOG_EXIT(p_mgr->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static float
-osm_mcast_mgr_compute_avg_hops(osm_mcast_mgr_t * const p_mgr,
+osm_mcast_mgr_compute_avg_hops(osm_sm_t *sm,
 			       const osm_mgrp_t * const p_mgrp,
 			       const osm_switch_t * const p_sw)
 {
@@ -148,7 +147,7 @@ osm_mcast_mgr_compute_avg_hops(osm_mcast_mgr_t * const p_mgr,
 	const osm_mcm_port_t *p_mcm_port;
 	const cl_qmap_t *p_mcm_tbl;
 
-	OSM_LOG_ENTER(p_mgr->p_log, osm_mcast_mgr_compute_avg_hops);
+	OSM_LOG_ENTER(sm->p_log, osm_mcast_mgr_compute_avg_hops);
 
 	p_mcm_tbl = &p_mgrp->mcm_port_tbl;
 
@@ -164,12 +163,12 @@ osm_mcast_mgr_compute_avg_hops(osm_mcast_mgr_t * const p_mgr,
 		   Acquire the port object for this port guid, then create
 		   the new worker object to build the list.
 		 */
-		p_port = osm_get_port_by_guid(p_mgr->p_subn,
+		p_port = osm_get_port_by_guid(sm->p_subn,
 					      ib_gid_get_guid(&p_mcm_port->
 							      port_gid));
 
 		if (!p_port) {
-			osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"osm_mcast_mgr_compute_avg_hops: ERR 0A18: "
 				"No port object for port 0x%016" PRIx64 "\n",
 				cl_ntoh64(ib_gid_get_guid
@@ -189,7 +188,7 @@ osm_mcast_mgr_compute_avg_hops(osm_mcast_mgr_t * const p_mgr,
 	if (num_ports != 0)
 		avg_hops = (float)(hops / num_ports);
 
-	OSM_LOG_EXIT(p_mgr->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 	return (avg_hops);
 }
 
@@ -198,7 +197,7 @@ osm_mcast_mgr_compute_avg_hops(osm_mcast_mgr_t * const p_mgr,
  of the group HCAs
  **********************************************************************/
 static float
-osm_mcast_mgr_compute_max_hops(osm_mcast_mgr_t * const p_mgr,
+osm_mcast_mgr_compute_max_hops(osm_sm_t *sm,
 			       const osm_mgrp_t * const p_mgrp,
 			       const osm_switch_t * const p_sw)
 {
@@ -208,7 +207,7 @@ osm_mcast_mgr_compute_max_hops(osm_mcast_mgr_t * const p_mgr,
 	const osm_mcm_port_t *p_mcm_port;
 	const cl_qmap_t *p_mcm_tbl;
 
-	OSM_LOG_ENTER(p_mgr->p_log, osm_mcast_mgr_compute_max_hops);
+	OSM_LOG_ENTER(sm->p_log, osm_mcast_mgr_compute_max_hops);
 
 	p_mcm_tbl = &p_mgrp->mcm_port_tbl;
 
@@ -224,12 +223,12 @@ osm_mcast_mgr_compute_max_hops(osm_mcast_mgr_t * const p_mgr,
 		   Acquire the port object for this port guid, then create
 		   the new worker object to build the list.
 		 */
-		p_port = osm_get_port_by_guid(p_mgr->p_subn,
+		p_port = osm_get_port_by_guid(sm->p_subn,
 					      ib_gid_get_guid(&p_mcm_port->
 							      port_gid));
 
 		if (!p_port) {
-			osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"osm_mcast_mgr_compute_max_hops: ERR 0A1A: "
 				"No port object for port 0x%016" PRIx64 "\n",
 				cl_ntoh64(ib_gid_get_guid
@@ -249,7 +248,7 @@ osm_mcast_mgr_compute_max_hops(osm_mcast_mgr_t * const p_mgr,
 		max_hops = 10001;	/* see later - we use it to realize no hops */
 	}
 
-	OSM_LOG_EXIT(p_mgr->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 	return (float)(max_hops);
 }
 
@@ -259,8 +258,7 @@ osm_mcast_mgr_compute_max_hops(osm_mcast_mgr_t * const p_mgr,
    a switch with the lowest average hop count to the members
    of the multicast group.
 **********************************************************************/
-static osm_switch_t *__osm_mcast_mgr_find_optimal_switch(osm_mcast_mgr_t *
-							 const p_mgr,
+static osm_switch_t *__osm_mcast_mgr_find_optimal_switch(osm_sm_t *sm,
 							 const osm_mgrp_t *
 							 const p_mgrp)
 {
@@ -276,9 +274,9 @@ static osm_switch_t *__osm_mcast_mgr_find_optimal_switch(osm_mcast_mgr_t *
 	boolean_t use_avg_hops = FALSE;	/* use max hops for root */
 #endif
 
-	OSM_LOG_ENTER(p_mgr->p_log, __osm_mcast_mgr_find_optimal_switch);
+	OSM_LOG_ENTER(sm->p_log, __osm_mcast_mgr_find_optimal_switch);
 
-	p_sw_tbl = &p_mgr->p_subn->sw_guid_tbl;
+	p_sw_tbl = &sm->p_subn->sw_guid_tbl;
 
 	CL_ASSERT(!osm_mgrp_is_empty(p_mgrp));
 
@@ -290,15 +288,15 @@ static osm_switch_t *__osm_mcast_mgr_find_optimal_switch(osm_mcast_mgr_t *
 
 		if (use_avg_hops)
 			hops =
-			    osm_mcast_mgr_compute_avg_hops(p_mgr, p_mgrp, p_sw);
+			    osm_mcast_mgr_compute_avg_hops(sm, p_mgrp, p_sw);
 		else
 			hops =
-			    osm_mcast_mgr_compute_max_hops(p_mgr, p_mgrp, p_sw);
+			    osm_mcast_mgr_compute_max_hops(sm, p_mgrp, p_sw);
 
-		if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
+		if (osm_log_is_active(sm->p_log, OSM_LOG_DEBUG)) {
 			sw_guid_ho =
 			    cl_ntoh64(osm_node_get_node_guid(p_sw->p_node));
-			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+			osm_log(sm->p_log, OSM_LOG_DEBUG,
 				"__osm_mcast_mgr_find_optimal_switch: "
 				"Switch 0x%016" PRIx64 ", hops = %f\n",
 				sw_guid_ho, hops);
@@ -310,37 +308,36 @@ static osm_switch_t *__osm_mcast_mgr_find_optimal_switch(osm_mcast_mgr_t *
 		}
 	}
 
-	if (osm_log_is_active(p_mgr->p_log, OSM_LOG_VERBOSE)) {
+	if (osm_log_is_active(sm->p_log, OSM_LOG_VERBOSE)) {
 		if (p_best_sw) {
 			sw_guid_ho =
 			    cl_ntoh64(osm_node_get_node_guid
 				      (p_best_sw->p_node));
-			osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+			osm_log(sm->p_log, OSM_LOG_VERBOSE,
 				"__osm_mcast_mgr_find_optimal_switch: "
 				"Best switch is 0x%" PRIx64 ", hops = %f\n",
 				sw_guid_ho, best_hops);
 		} else {
-			osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+			osm_log(sm->p_log, OSM_LOG_VERBOSE,
 				"__osm_mcast_mgr_find_optimal_switch: "
 				"No multicast capable switches detected\n");
 		}
 	}
 
-	OSM_LOG_EXIT(p_mgr->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 	return ((osm_switch_t *) p_best_sw);
 }
 
 /**********************************************************************
    This function returns the existing or optimal root swtich for the tree.
 **********************************************************************/
-static osm_switch_t *__osm_mcast_mgr_find_root_switch(osm_mcast_mgr_t *
-						      const p_mgr,
+static osm_switch_t *__osm_mcast_mgr_find_root_switch(osm_sm_t *sm,
 						      const osm_mgrp_t *
 						      const p_mgrp)
 {
 	const osm_switch_t *p_sw = NULL;
 
-	OSM_LOG_ENTER(p_mgr->p_log, __osm_mcast_mgr_find_root_switch);
+	OSM_LOG_ENTER(sm->p_log, __osm_mcast_mgr_find_root_switch);
 
 	/*
 	   We always look for the best multicast tree root switch.
@@ -348,54 +345,16 @@ static osm_switch_t *__osm_mcast_mgr_find_root_switch(osm_mcast_mgr_t *
 	   the root will be always on the first switch attached to it.
 	   - Very bad ...
 	 */
-	p_sw = __osm_mcast_mgr_find_optimal_switch(p_mgr, p_mgrp);
+	p_sw = __osm_mcast_mgr_find_optimal_switch(sm, p_mgrp);
 
-	OSM_LOG_EXIT(p_mgr->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 	return ((osm_switch_t *) p_sw);
 }
 
 /**********************************************************************
  **********************************************************************/
-void osm_mcast_mgr_construct(IN osm_mcast_mgr_t * const p_mgr)
-{
-	memset(p_mgr, 0, sizeof(*p_mgr));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_mcast_mgr_destroy(IN osm_mcast_mgr_t * const p_mgr)
-{
-	CL_ASSERT(p_mgr);
-
-	OSM_LOG_ENTER(p_mgr->p_log, osm_mcast_mgr_destroy);
-
-	OSM_LOG_EXIT(p_mgr->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-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(sm->p_log, osm_mcast_mgr_init);
-
-	osm_mcast_mgr_construct(p_mgr);
-
-	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;
-
-	OSM_LOG_EXIT(p_mgr->p_log);
-	return (status);
-}
-
-/**********************************************************************
- **********************************************************************/
 static osm_signal_t
-__osm_mcast_mgr_set_tbl(IN osm_mcast_mgr_t * const p_mgr,
+__osm_mcast_mgr_set_tbl(osm_sm_t *sm,
 			IN osm_switch_t * const p_sw)
 {
 	osm_node_t *p_node;
@@ -410,9 +369,9 @@ __osm_mcast_mgr_set_tbl(IN osm_mcast_mgr_t * const p_mgr,
 	ib_net16_t block[IB_MCAST_BLOCK_SIZE];
 	osm_signal_t signal = OSM_SIGNAL_DONE;
 
-	CL_ASSERT(p_mgr);
+	CL_ASSERT(sm);
 
-	OSM_LOG_ENTER(p_mgr->p_log, __osm_mcast_mgr_set_tbl);
+	OSM_LOG_ENTER(sm->p_log, __osm_mcast_mgr_set_tbl);
 
 	CL_ASSERT(p_sw);
 
@@ -438,22 +397,21 @@ __osm_mcast_mgr_set_tbl(IN osm_mcast_mgr_t * const p_mgr,
 
 	while (osm_mcast_tbl_get_block(p_tbl, block_num,
 				       (uint8_t) position, block)) {
-		if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
-			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+		if (osm_log_is_active(sm->p_log, OSM_LOG_DEBUG)) {
+			osm_log(sm->p_log, OSM_LOG_DEBUG,
 				"__osm_mcast_mgr_set_tbl: "
 				"Writing MFT block 0x%X\n", block_id_ho);
 		}
 
 		block_id_ho = block_num + (position << 28);
 
-		status = osm_req_set(p_mgr->sm, p_path, (void *)block,
-				     sizeof(block),
+		status = osm_req_set(sm, p_path, (void *)block, sizeof(block),
 				     IB_MAD_ATTR_MCAST_FWD_TBL,
 				     cl_hton32(block_id_ho),
 				     CL_DISP_MSGID_NONE, &mad_context);
 
 		if (status != IB_SUCCESS) {
-			osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"__osm_mcast_mgr_set_tbl: ERR 0A02: "
 				"Sending multicast fwd. tbl. block failed (%s)\n",
 				ib_get_err_str(status));
@@ -467,7 +425,7 @@ __osm_mcast_mgr_set_tbl(IN osm_mcast_mgr_t * const p_mgr,
 		}
 	}
 
-	OSM_LOG_EXIT(p_mgr->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 	return (signal);
 }
 
@@ -477,7 +435,7 @@ __osm_mcast_mgr_set_tbl(IN osm_mcast_mgr_t * const p_mgr,
   contains the group members that must be routed from this switch.
 **********************************************************************/
 static void
-__osm_mcast_mgr_subdivide(osm_mcast_mgr_t * const p_mgr,
+__osm_mcast_mgr_subdivide(osm_sm_t *sm,
 			  osm_mgrp_t * const p_mgrp,
 			  osm_switch_t * const p_sw,
 			  cl_qlist_t * const p_list,
@@ -489,7 +447,7 @@ __osm_mcast_mgr_subdivide(osm_mcast_mgr_t * const p_mgr,
 	boolean_t ignore_existing;
 	osm_mcast_work_obj_t *p_wobj;
 
-	OSM_LOG_ENTER(p_mgr->p_log, __osm_mcast_mgr_subdivide);
+	OSM_LOG_ENTER(sm->p_log, __osm_mcast_mgr_subdivide);
 
 	mlid_ho = cl_ntoh16(osm_mgrp_get_mlid(p_mgrp));
 
@@ -519,7 +477,7 @@ __osm_mcast_mgr_subdivide(osm_mcast_mgr_t * const p_mgr,
 			 */
 			uint64_t node_guid_ho =
 			    cl_ntoh64(osm_node_get_node_guid(p_sw->p_node));
-			osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"__osm_mcast_mgr_subdivide: ERR 0A03: "
 				"Error routing MLID 0x%X through switch 0x%"
 				PRIx64 "\n"
@@ -535,7 +493,7 @@ __osm_mcast_mgr_subdivide(osm_mcast_mgr_t * const p_mgr,
 		if (port_num > array_size) {
 			uint64_t node_guid_ho =
 			    cl_ntoh64(osm_node_get_node_guid(p_sw->p_node));
-			osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"__osm_mcast_mgr_subdivide: ERR 0A04: "
 				"Error routing MLID 0x%X through switch 0x%"
 				PRIx64 "\n"
@@ -554,29 +512,29 @@ __osm_mcast_mgr_subdivide(osm_mcast_mgr_t * const p_mgr,
 		cl_qlist_insert_tail(&list_array[port_num], &p_wobj->list_item);
 	}
 
-	OSM_LOG_EXIT(p_mgr->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_mcast_mgr_purge_list(osm_mcast_mgr_t * const p_mgr,
+__osm_mcast_mgr_purge_list(osm_sm_t *sm,
 			   cl_qlist_t * const p_list)
 {
 	osm_mcast_work_obj_t *p_wobj;
 
-	OSM_LOG_ENTER(p_mgr->p_log, __osm_mcast_mgr_purge_list);
+	OSM_LOG_ENTER(sm->p_log, __osm_mcast_mgr_purge_list);
 
 	while ((p_wobj = (osm_mcast_work_obj_t *) cl_qlist_remove_head(p_list))
 	       != (osm_mcast_work_obj_t *) cl_qlist_end(p_list)) {
-		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_mcast_mgr_purge_list: ERR 0A06: "
 			"Unable to route for port 0x%" PRIx64 "\n",
 			osm_port_get_guid(p_wobj->p_port));
 		__osm_mcast_work_obj_delete(p_wobj);
 	}
 
-	OSM_LOG_EXIT(p_mgr->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
@@ -586,7 +544,7 @@ __osm_mcast_mgr_purge_list(osm_mcast_mgr_t * const p_mgr,
 
   The function returns the newly created mtree node element.
 **********************************************************************/
-static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_mcast_mgr_t * const p_mgr,
+static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_sm_t *sm,
 						osm_mgrp_t * const p_mgrp,
 						osm_switch_t * const p_sw,
 						cl_qlist_t * const p_list,
@@ -606,7 +564,7 @@ static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_mcast_mgr_t * const p_mgr,
 	uint16_t mlid_ho;
 	osm_mcast_tbl_t *p_tbl;
 
-	OSM_LOG_ENTER(p_mgr->p_log, __osm_mcast_mgr_branch);
+	OSM_LOG_ENTER(sm->p_log, __osm_mcast_mgr_branch);
 
 	CL_ASSERT(p_sw);
 	CL_ASSERT(p_list);
@@ -616,8 +574,8 @@ static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_mcast_mgr_t * const p_mgr,
 	node_guid_ho = cl_ntoh64(node_guid);
 	mlid_ho = cl_ntoh16(osm_mgrp_get_mlid(p_mgrp));
 
-	if (osm_log_is_active(p_mgr->p_log, OSM_LOG_VERBOSE)) {
-		osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+	if (osm_log_is_active(sm->p_log, OSM_LOG_VERBOSE)) {
+		osm_log(sm->p_log, OSM_LOG_VERBOSE,
 			"__osm_mcast_mgr_branch: "
 			"Routing MLID 0x%X through switch 0x%" PRIx64
 			", %u nodes at depth %u\n",
@@ -637,7 +595,7 @@ static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_mcast_mgr_t * const p_mgr,
 		/*
 		   This switch doesn't do multicast.  Clean-up.
 		 */
-		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_mcast_mgr_branch: ERR 0A14: "
 			"Switch 0x%" PRIx64 " does not support multicast\n",
 			node_guid_ho);
@@ -645,7 +603,7 @@ static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_mcast_mgr_t * const p_mgr,
 		/*
 		   Deallocate all the work objects on this branch of the tree.
 		 */
-		__osm_mcast_mgr_purge_list(p_mgr, p_list);
+		__osm_mcast_mgr_purge_list(sm, p_list);
 		goto Exit;
 	}
 
@@ -655,14 +613,14 @@ static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_mcast_mgr_t * const p_mgr,
 		   We are unable to continue routing down this
 		   leg of the tree.  Clean-up.
 		 */
-		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_mcast_mgr_branch: ERR 0A15: "
 			"Insufficient memory to build multicast tree\n");
 
 		/*
 		   Deallocate all the work objects on this branch of the tree.
 		 */
-		__osm_mcast_mgr_purge_list(p_mgr, p_list);
+		__osm_mcast_mgr_purge_list(sm, p_list);
 		goto Exit;
 	}
 
@@ -677,10 +635,10 @@ static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_mcast_mgr_t * const p_mgr,
 	 */
 	list_array = malloc(sizeof(cl_qlist_t) * max_children);
 	if (list_array == NULL) {
-		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_mcast_mgr_branch: ERR 0A16: "
 			"Unable to allocate list array\n");
-		__osm_mcast_mgr_purge_list(p_mgr, p_list);
+		__osm_mcast_mgr_purge_list(sm, p_list);
 		goto Exit;
 	}
 
@@ -689,7 +647,7 @@ static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_mcast_mgr_t * const p_mgr,
 	for (i = 0; i < max_children; i++)
 		cl_qlist_init(&list_array[i]);
 
-	__osm_mcast_mgr_subdivide(p_mgr, p_mgrp, p_sw, p_list, list_array,
+	__osm_mcast_mgr_subdivide(sm, p_mgrp, p_sw, p_list, list_array,
 				  max_children);
 
 	p_tbl = osm_switch_get_mcast_tbl_ptr(p_sw);
@@ -699,8 +657,8 @@ static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_mcast_mgr_t * const p_mgr,
 	   we're at the root of the spanning tree.
 	 */
 	if (depth > 1) {
-		if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
-			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+		if (osm_log_is_active(sm->p_log, OSM_LOG_DEBUG)) {
+			osm_log(sm->p_log, OSM_LOG_DEBUG,
 				"__osm_mcast_mgr_branch: "
 				"Adding upstream port 0x%X\n", upstream_port);
 		}
@@ -736,8 +694,8 @@ static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_mcast_mgr_t * const p_mgr,
 		if (count == 0)
 			continue;	/* No routes down this port. */
 
-		if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
-			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+		if (osm_log_is_active(sm->p_log, OSM_LOG_DEBUG)) {
+			osm_log(sm->p_log, OSM_LOG_DEBUG,
 				"__osm_mcast_mgr_branch: "
 				"Routing %zu destinations via switch port 0x%X\n",
 				count, i);
@@ -773,7 +731,7 @@ static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_mcast_mgr_t * const p_mgr,
 			CL_ASSERT(p_remote_physp);
 
 			p_mtn->child_array[i] =
-			    __osm_mcast_mgr_branch(p_mgr, p_mgrp,
+			    __osm_mcast_mgr_branch(sm, p_mgrp,
 						   p_remote_node->sw,
 						   p_port_list, depth,
 						   osm_physp_get_port_num
@@ -792,8 +750,8 @@ static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_mcast_mgr_t * const p_mgr,
 
 			CL_ASSERT(cl_is_qlist_empty(p_port_list));
 
-			if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
-				osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+			if (osm_log_is_active(sm->p_log, OSM_LOG_DEBUG)) {
+				osm_log(sm->p_log, OSM_LOG_DEBUG,
 					"__osm_mcast_mgr_branch: "
 					"Found leaf for port 0x%016" PRIx64
 					" on switch port 0x%X\n",
@@ -807,14 +765,14 @@ static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_mcast_mgr_t * const p_mgr,
 
 	free(list_array);
 Exit:
-	OSM_LOG_EXIT(p_mgr->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 	return (p_mtn);
 }
 
 /**********************************************************************
  **********************************************************************/
 static ib_api_status_t
-__osm_mcast_mgr_build_spanning_tree(osm_mcast_mgr_t * const p_mgr,
+__osm_mcast_mgr_build_spanning_tree(osm_sm_t *sm,
 				    osm_mgrp_t * const p_mgrp)
 {
 	const cl_qmap_t *p_mcm_tbl;
@@ -828,7 +786,7 @@ __osm_mcast_mgr_build_spanning_tree(osm_mcast_mgr_t * const p_mgr,
 	uint8_t max_depth = 0;
 	uint32_t count;
 
-	OSM_LOG_ENTER(p_mgr->p_log, __osm_mcast_mgr_build_spanning_tree);
+	OSM_LOG_ENTER(sm->p_log, __osm_mcast_mgr_build_spanning_tree);
 
 	cl_qlist_init(&port_list);
 
@@ -838,13 +796,13 @@ __osm_mcast_mgr_build_spanning_tree(osm_mcast_mgr_t * const p_mgr,
 	   on multicast forwarding table information if the user wants to
 	   preserve existing multicast routes.
 	 */
-	__osm_mcast_mgr_purge_tree(p_mgr, p_mgrp);
+	__osm_mcast_mgr_purge_tree(sm, p_mgrp);
 
 	p_mcm_tbl = &p_mgrp->mcm_port_tbl;
 	num_ports = cl_qmap_count(p_mcm_tbl);
 	if (num_ports == 0) {
-		if (osm_log_is_active(p_mgr->p_log, OSM_LOG_VERBOSE)) {
-			osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+		if (osm_log_is_active(sm->p_log, OSM_LOG_VERBOSE)) {
+			osm_log(sm->p_log, OSM_LOG_VERBOSE,
 				"__osm_mcast_mgr_build_spanning_tree: "
 				"MLID 0x%X has no members - nothing to do\n",
 				cl_ntoh16(osm_mgrp_get_mlid(p_mgrp)));
@@ -868,9 +826,9 @@ __osm_mcast_mgr_build_spanning_tree(osm_mcast_mgr_t * const p_mgr,
 	   Locate the switch around which to create the spanning
 	   tree for this multicast group.
 	 */
-	p_sw = __osm_mcast_mgr_find_root_switch(p_mgr, p_mgrp);
+	p_sw = __osm_mcast_mgr_find_root_switch(sm, p_mgrp);
 	if (p_sw == NULL) {
-		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_mcast_mgr_build_spanning_tree: ERR 0A08: "
 			"Unable to locate a suitable switch for group 0x%X\n",
 			cl_ntoh16(osm_mgrp_get_mlid(p_mgrp)));
@@ -889,11 +847,11 @@ __osm_mcast_mgr_build_spanning_tree(osm_mcast_mgr_t * const p_mgr,
 		   Acquire the port object for this port guid, then create
 		   the new worker object to build the list.
 		 */
-		p_port = osm_get_port_by_guid(p_mgr->p_subn,
+		p_port = osm_get_port_by_guid(sm->p_subn,
 					      ib_gid_get_guid(&p_mcm_port->
 							      port_gid));
 		if (!p_port) {
-			osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"__osm_mcast_mgr_build_spanning_tree: ERR 0A09: "
 				"No port object for port 0x%016" PRIx64 "\n",
 				cl_ntoh64(ib_gid_get_guid
@@ -903,7 +861,7 @@ __osm_mcast_mgr_build_spanning_tree(osm_mcast_mgr_t * const p_mgr,
 
 		p_wobj = __osm_mcast_work_obj_new(p_port);
 		if (p_wobj == NULL) {
-			osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"__osm_mcast_mgr_build_spanning_tree: ERR 0A10: "
 				"Insufficient memory to route port 0x%016"
 				PRIx64 "\n",
@@ -915,16 +873,16 @@ __osm_mcast_mgr_build_spanning_tree(osm_mcast_mgr_t * const p_mgr,
 	}
 
 	count = cl_qlist_count(&port_list);
-	p_mgrp->p_root = __osm_mcast_mgr_branch(p_mgr, p_mgrp, p_sw,
+	p_mgrp->p_root = __osm_mcast_mgr_branch(sm, p_mgrp, p_sw,
 						&port_list, 0, 0, &max_depth);
 
-	osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+	osm_log(sm->p_log, OSM_LOG_VERBOSE,
 		"__osm_mcast_mgr_build_spanning_tree: "
 		"Configured MLID 0x%X for %u ports, max tree depth = %u\n",
 		cl_ntoh16(osm_mgrp_get_mlid(p_mgrp)), count, max_depth);
 
 Exit:
-	OSM_LOG_EXIT(p_mgr->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 	return (status);
 }
 
@@ -933,7 +891,7 @@ Exit:
 /**********************************************************************
  **********************************************************************/
 void
-osm_mcast_mgr_set_table(IN osm_mcast_mgr_t * const p_mgr,
+osm_mcast_mgr_set_table(osm_sm_t *sm,
 			IN const osm_mgrp_t * const p_mgrp,
 			IN const osm_mtree_node_t * const p_mtn)
 {
@@ -944,15 +902,15 @@ osm_mcast_mgr_set_table(IN osm_mcast_mgr_t * const p_mgr,
 	osm_mcast_tbl_t *p_tbl;
 	osm_switch_t *p_sw;
 
-	OSM_LOG_ENTER(p_mgr->p_log, osm_mcast_mgr_set_table);
+	OSM_LOG_ENTER(sm->p_log, osm_mcast_mgr_set_table);
 
 	mlid_ho = cl_ntoh16(osm_mgrp_get_mlid(p_mgrp));
 	p_sw = osm_mtree_node_get_switch_ptr(p_mtn);
 
 	CL_ASSERT(p_sw);
 
-	if (osm_log_is_active(p_mgr->p_log, OSM_LOG_VERBOSE)) {
-		osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+	if (osm_log_is_active(sm->p_log, OSM_LOG_VERBOSE)) {
+		osm_log(sm->p_log, OSM_LOG_VERBOSE,
 			"osm_mcast_mgr_set_table: "
 			"Configuring MLID 0x%X on switch 0x%" PRIx64 "\n",
 			mlid_ho, osm_node_get_node_guid(p_sw->p_node));
@@ -977,27 +935,27 @@ osm_mcast_mgr_set_table(IN osm_mcast_mgr_t * const p_mgr,
 		osm_mcast_tbl_set(p_tbl, mlid_ho, i);
 	}
 
-	OSM_LOG_EXIT(p_mgr->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 #endif
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_mcast_mgr_clear(IN osm_mcast_mgr_t * const p_mgr,
+__osm_mcast_mgr_clear(osm_sm_t *sm,
 		      IN osm_mgrp_t * const p_mgrp)
 {
 	osm_switch_t *p_sw;
 	cl_qmap_t *p_sw_tbl;
 	osm_mcast_tbl_t *p_mcast_tbl;
 
-	OSM_LOG_ENTER(p_mgr->p_log, __osm_mcast_mgr_clear);
+	OSM_LOG_ENTER(sm->p_log, __osm_mcast_mgr_clear);
 
 	/*
 	   Walk the switches and clear the routing entries for
 	   this MLID.
 	 */
-	p_sw_tbl = &p_mgr->p_subn->sw_guid_tbl;
+	p_sw_tbl = &sm->p_subn->sw_guid_tbl;
 	p_sw = (osm_switch_t *) cl_qmap_head(p_sw_tbl);
 	while (p_sw != (osm_switch_t *) cl_qmap_end(p_sw_tbl)) {
 		p_mcast_tbl = osm_switch_get_mcast_tbl_ptr(p_sw);
@@ -1005,7 +963,7 @@ __osm_mcast_mgr_clear(IN osm_mcast_mgr_t * const p_mgr,
 		p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item);
 	}
 
-	OSM_LOG_EXIT(p_mgr->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 #if 0
@@ -1014,7 +972,7 @@ __osm_mcast_mgr_clear(IN osm_mcast_mgr_t * const p_mgr,
    Lock must be held on entry.
 **********************************************************************/
 ib_api_status_t
-osm_mcast_mgr_process_single(IN osm_mcast_mgr_t * const p_mgr,
+osm_mcast_mgr_process_single(osm_sm_t *sm,
 			     IN ib_net16_t const mlid,
 			     IN ib_net64_t const port_guid,
 			     IN uint8_t const join_state)
@@ -1029,15 +987,15 @@ osm_mcast_mgr_process_single(IN osm_mcast_mgr_t * const p_mgr,
 	osm_mcast_tbl_t *p_mcast_tbl;
 	ib_api_status_t status = IB_SUCCESS;
 
-	OSM_LOG_ENTER(p_mgr->p_log, osm_mcast_mgr_process_single);
+	OSM_LOG_ENTER(sm->p_log, osm_mcast_mgr_process_single);
 
 	CL_ASSERT(mlid);
 	CL_ASSERT(port_guid);
 
 	mlid_ho = cl_ntoh16(mlid);
 
-	if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
-		osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+	if (osm_log_is_active(sm->p_log, OSM_LOG_DEBUG)) {
+		osm_log(sm->p_log, OSM_LOG_DEBUG,
 			"osm_mcast_mgr_process_single: "
 			"Attempting to add port 0x%" PRIx64 " to MLID 0x%X, "
 			"\n\t\t\t\tjoin state = 0x%X\n",
@@ -1047,9 +1005,9 @@ osm_mcast_mgr_process_single(IN osm_mcast_mgr_t * const p_mgr,
 	/*
 	   Acquire the Port object.
 	 */
-	p_port = osm_get_port_by_guid(p_mgr->p_subn, port_guid);
+	p_port = osm_get_port_by_guid(sm->p_subn, port_guid);
 	if (!p_port) {
-		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"osm_mcast_mgr_process_single: ERR 0A01: "
 			"Unable to acquire port object for 0x%" PRIx64 "\n",
 			cl_ntoh64(port_guid));
@@ -1059,7 +1017,7 @@ osm_mcast_mgr_process_single(IN osm_mcast_mgr_t * const p_mgr,
 
 	p_physp = p_port->p_physp;
 	if (p_physp == NULL) {
-		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"osm_mcast_mgr_process_single: ERR 0A05: "
 			"Unable to acquire phsyical port object for 0x%" PRIx64
 			"\n", cl_ntoh64(port_guid));
@@ -1069,7 +1027,7 @@ osm_mcast_mgr_process_single(IN osm_mcast_mgr_t * const p_mgr,
 
 	p_remote_physp = osm_physp_get_remote(p_physp);
 	if (p_remote_physp == NULL) {
-		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"osm_mcast_mgr_process_single: ERR 0A11: "
 			"Unable to acquire remote phsyical port object "
 			"for 0x%" PRIx64 "\n", cl_ntoh64(port_guid));
@@ -1084,7 +1042,7 @@ osm_mcast_mgr_process_single(IN osm_mcast_mgr_t * const p_mgr,
 	sw_guid = osm_node_get_node_guid(p_remote_node);
 
 	if (osm_node_get_type(p_remote_node) != IB_NODE_TYPE_SWITCH) {
-		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"osm_mcast_mgr_process_single: ERR 0A22: "
 			"Remote node not a switch node 0x%" PRIx64 "\n",
 			cl_ntoh64(sw_guid));
@@ -1093,7 +1051,7 @@ osm_mcast_mgr_process_single(IN osm_mcast_mgr_t * const p_mgr,
 	}
 
 	if (!p_remote_node->sw) {
-		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"osm_mcast_mgr_process_single: ERR 0A12: "
 			"No switch object 0x%" PRIx64 "\n", cl_ntoh64(sw_guid));
 		status = IB_ERROR;
@@ -1121,14 +1079,14 @@ osm_mcast_mgr_process_single(IN osm_mcast_mgr_t * const p_mgr,
 		} else {
 			if (join_state & IB_JOIN_STATE_SEND_ONLY) {
 				if (osm_log_is_active
-				    (p_mgr->p_log, OSM_LOG_DEBUG)) {
-					osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+				    (sm->p_log, OSM_LOG_DEBUG)) {
+					osm_log(sm->p_log, OSM_LOG_DEBUG,
 						"osm_mcast_mgr_process_single: "
 						"Success.  Nothing to do for send"
 						"only member\n");
 				}
 			} else {
-				osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+				osm_log(sm->p_log, OSM_LOG_ERROR,
 					"osm_mcast_mgr_process_single: ERR 0A13: "
 					"Unknown join state 0x%X\n",
 					join_state);
@@ -1137,15 +1095,15 @@ osm_mcast_mgr_process_single(IN osm_mcast_mgr_t * const p_mgr,
 			}
 		}
 	} else {
-		if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
-			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+		if (osm_log_is_active(sm->p_log, OSM_LOG_DEBUG)) {
+			osm_log(sm->p_log, OSM_LOG_DEBUG,
 				"osm_mcast_mgr_process_single: "
 				"Unable to add port\n");
 		}
 	}
 
 Exit:
-	OSM_LOG_EXIT(p_mgr->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 	return (status);
 }
 #endif
@@ -1154,7 +1112,7 @@ Exit:
    lock must already be held on entry
 **********************************************************************/
 static ib_api_status_t
-osm_mcast_mgr_process_tree(IN osm_mcast_mgr_t * const p_mgr,
+osm_mcast_mgr_process_tree(osm_sm_t *sm,
 			   IN osm_mgrp_t * const p_mgrp,
 			   IN osm_mcast_req_type_t req_type,
 			   ib_net64_t port_guid)
@@ -1163,12 +1121,12 @@ osm_mcast_mgr_process_tree(IN osm_mcast_mgr_t * const p_mgr,
 	ib_net16_t mlid;
 	boolean_t ui_mcast_fdb_assign_func_defined;
 
-	OSM_LOG_ENTER(p_mgr->p_log, osm_mcast_mgr_process_tree);
+	OSM_LOG_ENTER(sm->p_log, osm_mcast_mgr_process_tree);
 
 	mlid = osm_mgrp_get_mlid(p_mgrp);
 
-	if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
-		osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+	if (osm_log_is_active(sm->p_log, OSM_LOG_DEBUG)) {
+		osm_log(sm->p_log, OSM_LOG_DEBUG,
 			"osm_mcast_mgr_process_tree: "
 			"Processing multicast group 0x%X\n", cl_ntoh16(mlid));
 	}
@@ -1176,16 +1134,16 @@ osm_mcast_mgr_process_tree(IN osm_mcast_mgr_t * const p_mgr,
 	/*
 	   If there are no switches in the subnet, then we have nothing to do.
 	 */
-	if (cl_qmap_count(&p_mgr->p_subn->sw_guid_tbl) == 0) {
-		if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
-			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+	if (cl_qmap_count(&sm->p_subn->sw_guid_tbl) == 0) {
+		if (osm_log_is_active(sm->p_log, OSM_LOG_DEBUG)) {
+			osm_log(sm->p_log, OSM_LOG_DEBUG,
 				"osm_mcast_mgr_process_tree: "
 				"No switches in subnet. Nothing to do\n");
 		}
 		goto Exit;
 	}
 
-	if (p_mgr->p_subn->opt.pfn_ui_mcast_fdb_assign)
+	if (sm->p_subn->opt.pfn_ui_mcast_fdb_assign)
 		ui_mcast_fdb_assign_func_defined = TRUE;
 	else
 		ui_mcast_fdb_assign_func_defined = FALSE;
@@ -1201,34 +1159,34 @@ osm_mcast_mgr_process_tree(IN osm_mcast_mgr_t * const p_mgr,
 	 */
 	if (ui_mcast_fdb_assign_func_defined == FALSE ||
 	    req_type == OSM_MCAST_REQ_TYPE_CREATE)
-		__osm_mcast_mgr_clear(p_mgr, p_mgrp);
+		__osm_mcast_mgr_clear(sm, p_mgrp);
 
 	/* If a UI function is defined, then we will call it here.
 	   If not - the use the regular build spanning tree function */
 	if (ui_mcast_fdb_assign_func_defined == FALSE) {
-		status = __osm_mcast_mgr_build_spanning_tree(p_mgr, p_mgrp);
+		status = __osm_mcast_mgr_build_spanning_tree(sm, p_mgrp);
 		if (status != IB_SUCCESS) {
-			osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"osm_mcast_mgr_process_tree: ERR 0A17: "
 				"Unable to create spanning tree (%s)\n",
 				ib_get_err_str(status));
 			goto Exit;
 		}
 	} else {
-		if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
-			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+		if (osm_log_is_active(sm->p_log, OSM_LOG_DEBUG)) {
+			osm_log(sm->p_log, OSM_LOG_DEBUG,
 				"osm_mcast_mgr_process_tree: "
 				"Invoking UI function pfn_ui_mcast_fdb_assign\n");
 		}
 
-		p_mgr->p_subn->opt.pfn_ui_mcast_fdb_assign(p_mgr->p_subn->opt.
+		sm->p_subn->opt.pfn_ui_mcast_fdb_assign(sm->p_subn->opt.
 							   ui_mcast_fdb_assign_ctx,
 							   mlid, req_type,
 							   port_guid);
 	}
 
 Exit:
-	OSM_LOG_EXIT(p_mgr->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 	return (status);
 }
 
@@ -1237,18 +1195,18 @@ Exit:
  NOTE : The lock should be held externally!
  **********************************************************************/
 static ib_api_status_t
-mcast_mgr_process_mgrp(IN osm_mcast_mgr_t * const p_mgr,
+mcast_mgr_process_mgrp(osm_sm_t *sm,
 		       IN osm_mgrp_t * const p_mgrp,
 		       IN osm_mcast_req_type_t req_type,
 		       IN ib_net64_t port_guid)
 {
 	ib_api_status_t status;
 
-	OSM_LOG_ENTER(p_mgr->p_log, osm_mcast_mgr_process_mgrp);
+	OSM_LOG_ENTER(sm->p_log, osm_mcast_mgr_process_mgrp);
 
-	status = osm_mcast_mgr_process_tree(p_mgr, p_mgrp, req_type, port_guid);
+	status = osm_mcast_mgr_process_tree(sm, p_mgrp, req_type, port_guid);
 	if (status != IB_SUCCESS) {
-		osm_log(p_mgr->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"mcast_mgr_process_mgrp: ERR 0A19: "
 			"Unable to create spanning tree (%s)\n",
 			ib_get_err_str(status));
@@ -1260,48 +1218,48 @@ mcast_mgr_process_mgrp(IN osm_mcast_mgr_t * const p_mgr,
 	 * Not a well known group
 	 */
 	if (cl_qmap_count(&p_mgrp->mcm_port_tbl) == 0 && !p_mgrp->well_known) {
-		osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+		osm_log(sm->p_log, OSM_LOG_DEBUG,
 			"mcast_mgr_process_mgrp: "
 			"Destroying mgrp with lid:0x%X\n",
 			cl_ntoh16(p_mgrp->mlid));
 		/* Send a Report to any InformInfo registered for
 		   Trap 67 : MCGroup delete */
-		osm_mgrp_send_delete_notice(p_mgr->p_subn, p_mgr->p_log,
+		osm_mgrp_send_delete_notice(sm->p_subn, sm->p_log,
 					    p_mgrp);
-		cl_qmap_remove_item(&p_mgr->p_subn->mgrp_mlid_tbl,
+		cl_qmap_remove_item(&sm->p_subn->mgrp_mlid_tbl,
 				    (cl_map_item_t *) p_mgrp);
 		osm_mgrp_delete(p_mgrp);
 	}
 
 Exit:
-	OSM_LOG_EXIT(p_mgr->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 	return status;
 }
 
 /**********************************************************************
  **********************************************************************/
-osm_signal_t osm_mcast_mgr_process(IN osm_mcast_mgr_t * const p_mgr)
+osm_signal_t osm_mcast_mgr_process(osm_sm_t *sm)
 {
 	osm_signal_t signal;
 	osm_switch_t *p_sw;
 	cl_qmap_t *p_sw_tbl;
 	cl_qmap_t *p_mcast_tbl;
-	cl_qlist_t *p_list = &p_mgr->p_subn->p_osm->sm.mgrp_list;
+	cl_qlist_t *p_list = &sm->mgrp_list;
 	osm_mgrp_t *p_mgrp;
 	osm_mgrp_t *p_next_mgrp;
 	boolean_t pending_transactions = FALSE;
 
-	OSM_LOG_ENTER(p_mgr->p_log, osm_mcast_mgr_process);
+	OSM_LOG_ENTER(sm->p_log, osm_mcast_mgr_process);
 
-	p_sw_tbl = &p_mgr->p_subn->sw_guid_tbl;
-	p_mcast_tbl = &p_mgr->p_subn->mgrp_mlid_tbl;
+	p_sw_tbl = &sm->p_subn->sw_guid_tbl;
+	p_mcast_tbl = &sm->p_subn->mgrp_mlid_tbl;
 	/*
 	   While holding the lock, iterate over all the established
 	   multicast groups, servicing each in turn.
 
 	   Then, download the multicast tables to the switches.
 	 */
-	CL_PLOCK_EXCL_ACQUIRE(p_mgr->p_lock);
+	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
 
 	p_mgrp = (osm_mgrp_t *) cl_qmap_head(p_mcast_tbl);
 	while (p_mgrp != (osm_mgrp_t *) cl_qmap_end(p_mcast_tbl)) {
@@ -1309,7 +1267,7 @@ osm_signal_t osm_mcast_mgr_process(IN osm_mcast_mgr_t * const p_mgr)
 		   of the subnet. Not due to a specific multicast request.
 		   So the request type is subnet_change and the port guid is 0. */
 		p_next_mgrp = (osm_mgrp_t *) cl_qmap_next(&p_mgrp->map_item);
-		mcast_mgr_process_mgrp(p_mgr, p_mgrp,
+		mcast_mgr_process_mgrp(sm, p_mgrp,
 				       OSM_MCAST_REQ_TYPE_SUBNET_CHANGE, 0);
 		p_mgrp = p_next_mgrp;
 	}
@@ -1319,7 +1277,7 @@ osm_signal_t osm_mcast_mgr_process(IN osm_mcast_mgr_t * const p_mgr)
 	 */
 	p_sw = (osm_switch_t *) cl_qmap_head(p_sw_tbl);
 	while (p_sw != (osm_switch_t *) cl_qmap_end(p_sw_tbl)) {
-		signal = __osm_mcast_mgr_set_tbl(p_mgr, p_sw);
+		signal = __osm_mcast_mgr_set_tbl(sm, p_sw);
 		if (signal == OSM_SIGNAL_DONE_PENDING)
 			pending_transactions = TRUE;
 		p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item);
@@ -1330,9 +1288,9 @@ osm_signal_t osm_mcast_mgr_process(IN osm_mcast_mgr_t * const p_mgr)
 		free(p);
 	}
 
-	CL_PLOCK_RELEASE(p_mgr->p_lock);
+	CL_PLOCK_RELEASE(sm->p_lock);
 
-	OSM_LOG_EXIT(p_mgr->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 
 	if (pending_transactions == TRUE)
 		return (OSM_SIGNAL_DONE_PENDING);
@@ -1343,13 +1301,13 @@ osm_signal_t osm_mcast_mgr_process(IN osm_mcast_mgr_t * const p_mgr)
 /**********************************************************************
  **********************************************************************/
 static
-osm_mgrp_t *__get_mgrp_by_mlid(IN osm_mcast_mgr_t * const p_mgr,
+osm_mgrp_t *__get_mgrp_by_mlid(osm_sm_t *sm,
 			       IN ib_net16_t const mlid)
 {
 	cl_map_item_t *map_item;
 
-	map_item = cl_qmap_get(&p_mgr->p_subn->mgrp_mlid_tbl, mlid);
-	if (map_item == cl_qmap_end(&p_mgr->p_subn->mgrp_mlid_tbl)) {
+	map_item = cl_qmap_get(&sm->p_subn->mgrp_mlid_tbl, mlid);
+	if (map_item == cl_qmap_end(&sm->p_subn->mgrp_mlid_tbl)) {
 		return NULL;
 	}
 	return (osm_mgrp_t *) map_item;
@@ -1359,9 +1317,9 @@ osm_mgrp_t *__get_mgrp_by_mlid(IN osm_mcast_mgr_t * const p_mgr,
   This is the function that is invoked during idle time to handle the
   process request for mcast groups where join/leave/delete was required.
  **********************************************************************/
-osm_signal_t osm_mcast_mgr_process_mgroups(osm_mcast_mgr_t * p_mgr)
+osm_signal_t osm_mcast_mgr_process_mgroups(osm_sm_t *sm)
 {
-	cl_qlist_t *p_list = &p_mgr->p_subn->p_osm->sm.mgrp_list;
+	cl_qlist_t *p_list = &sm->mgrp_list;
 	osm_switch_t *p_sw;
 	cl_qmap_t *p_sw_tbl;
 	osm_mgrp_t *p_mgrp;
@@ -1371,10 +1329,10 @@ osm_signal_t osm_mcast_mgr_process_mgroups(osm_mcast_mgr_t * p_mgr)
 	osm_mcast_req_type_t req_type;
 	ib_net64_t port_guid;
 
-	OSM_LOG_ENTER(p_mgr->p_log, osm_mcast_mgr_process_mgroups);
+	OSM_LOG_ENTER(sm->p_log, osm_mcast_mgr_process_mgroups);
 
 	/* we need a lock to make sure the p_mgrp is not change other ways */
-	CL_PLOCK_EXCL_ACQUIRE(p_mgr->p_lock);
+	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
 
 	while (!cl_is_qlist_empty(p_list)) {
 		ctx = (osm_mcast_mgr_ctxt_t *) cl_qlist_remove_head(p_list);
@@ -1389,7 +1347,7 @@ osm_signal_t osm_mcast_mgr_process_mgroups(osm_mcast_mgr_t * p_mgr)
 
 		/* since we delayed the execution we prefer to pass the
 		   mlid as the mgrp identifier and then find it or abort */
-		p_mgrp = __get_mgrp_by_mlid(p_mgr, mlid);
+		p_mgrp = __get_mgrp_by_mlid(sm, mlid);
 		if (!p_mgrp)
 			continue;
 
@@ -1397,35 +1355,35 @@ osm_signal_t osm_mcast_mgr_process_mgroups(osm_mcast_mgr_t * p_mgr)
 		 * we processed the group we can skip doing anything
 		 */
 		if (p_mgrp->last_change_id == p_mgrp->last_tree_id) {
-			osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+			osm_log(sm->p_log, OSM_LOG_DEBUG,
 				"osm_mcast_mgr_process_mgroups: "
 				"Skip processing mgrp with lid:0x%X change id:%u\n",
 				cl_ntoh16(mlid), p_mgrp->last_change_id);
 			continue;
 		}
 
-		osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
+		osm_log(sm->p_log, OSM_LOG_DEBUG,
 			"osm_mcast_mgr_process_mgroups: "
 			"Processing mgrp with lid:0x%X change id:%u\n",
 			cl_ntoh16(mlid), p_mgrp->last_change_id);
-		mcast_mgr_process_mgrp(p_mgr, p_mgrp, req_type, port_guid);
+		mcast_mgr_process_mgrp(sm, p_mgrp, req_type, port_guid);
 	}
 
 	/*
 	   Walk the switches and download the tables for each.
 	 */
-	p_sw_tbl = &p_mgr->p_subn->sw_guid_tbl;
+	p_sw_tbl = &sm->p_subn->sw_guid_tbl;
 	p_sw = (osm_switch_t *) cl_qmap_head(p_sw_tbl);
 	while (p_sw != (osm_switch_t *) cl_qmap_end(p_sw_tbl)) {
-		ret = __osm_mcast_mgr_set_tbl(p_mgr, p_sw);
+		ret = __osm_mcast_mgr_set_tbl(sm, p_sw);
 		if (ret == OSM_SIGNAL_DONE_PENDING)
 			signal = ret;
 		p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item);
 	}
 
-	osm_dump_mcast_routes(p_mgr->p_subn->p_osm);
+	osm_dump_mcast_routes(sm->p_subn->p_osm);
 
-	CL_PLOCK_RELEASE(p_mgr->p_lock);
-	OSM_LOG_EXIT(p_mgr->p_log);
+	CL_PLOCK_RELEASE(sm->p_lock);
+	OSM_LOG_EXIT(sm->p_log);
 	return signal;
 }
diff --git a/opensm/opensm/osm_perfmgr.c b/opensm/opensm/osm_perfmgr.c
index 2b0d6f0..8375396 100644
--- a/opensm/opensm/osm_perfmgr.c
+++ b/opensm/opensm/osm_perfmgr.c
@@ -561,6 +561,8 @@ __osm_perfmgr_query_counters(cl_map_item_t * const p_map_item, void *context)
  * Discovery stuff.
  * Basically this code should not be here, but merged with main OpenSM
  **********************************************************************/
+extern void osm_drop_mgr_process(IN osm_sm_t *sm);
+
 static int sweep_hop_1(osm_sm_t * sm)
 {
 	ib_api_status_t status = IB_SUCCESS;
@@ -772,7 +774,7 @@ static int perfmgr_discovery(osm_opensm_t * osm)
 		goto _exit;
 
 _drop:
-	osm_drop_mgr_process(&osm->sm.drop_mgr);
+	osm_drop_mgr_process(&osm->sm);
 
 _exit:
 	return ret;
diff --git a/opensm/opensm/osm_sm.c b/opensm/opensm/osm_sm.c
index bdbb2e6..b576c26 100644
--- a/opensm/opensm/osm_sm.c
+++ b/opensm/opensm/osm_sm.c
@@ -61,7 +61,6 @@
 #include <opensm/osm_log.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_msgdef.h>
-#include <opensm/osm_mcast_mgr.h>
 #include <opensm/osm_mcm_info.h>
 #include <opensm/osm_perfmgr.h>
 #include <opensm/osm_opensm.h>
@@ -169,10 +168,7 @@ void osm_sm_construct(IN osm_sm_t * const p_sm)
 	osm_sm_mad_ctrl_construct(&p_sm->mad_ctrl);
 	osm_lid_mgr_construct(&p_sm->lid_mgr);
 	osm_ucast_mgr_construct(&p_sm->ucast_mgr);
-	osm_link_mgr_construct(&p_sm->link_mgr);
-	osm_drop_mgr_construct(&p_sm->drop_mgr);
 	osm_sweep_fail_ctrl_construct(&p_sm->sweep_fail_ctrl);
-	osm_mcast_mgr_construct(&p_sm->mcast_mgr);
 }
 
 /**********************************************************************
@@ -231,9 +227,6 @@ void osm_sm_destroy(IN osm_sm_t * const p_sm)
 	OSM_LOG_ENTER(p_sm->p_log, osm_sm_destroy);
 	osm_lid_mgr_destroy(&p_sm->lid_mgr);
 	osm_ucast_mgr_destroy(&p_sm->ucast_mgr);
-	osm_link_mgr_destroy(&p_sm->link_mgr);
-	osm_drop_mgr_destroy(&p_sm->drop_mgr);
-	osm_mcast_mgr_destroy(&p_sm->mcast_mgr);
 	cl_event_wheel_destroy(&p_sm->trap_aging_tracker);
 	cl_timer_destroy(&p_sm->sweep_timer);
 	cl_timer_destroy(&p_sm->polling_timer);
@@ -325,22 +318,10 @@ osm_sm_init(IN osm_sm_t * const p_sm,
 	if (status != IB_SUCCESS)
 		goto Exit;
 
-	status = osm_link_mgr_init(&p_sm->link_mgr, p_sm);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-	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_sm);
 	if (status != IB_SUCCESS)
 		goto Exit;
 
-	status = osm_mcast_mgr_init(&p_sm->mcast_mgr, p_sm);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
 	p_sm->ni_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_NODE_INFO,
 					   osm_ni_rcv_process, p_sm);
 	if (p_sm->ni_disp_h == CL_DISP_INVALID_HANDLE)
diff --git a/opensm/opensm/osm_state_mgr.c b/opensm/opensm/osm_state_mgr.c
index 7234053..516327e 100644
--- a/opensm/opensm/osm_state_mgr.c
+++ b/opensm/opensm/osm_state_mgr.c
@@ -68,7 +68,12 @@
 #include <opensm/osm_inform.h>
 #include <opensm/osm_opensm.h>
 
-osm_signal_t osm_qos_setup(IN osm_opensm_t * p_osm);
+extern void osm_drop_mgr_process(IN osm_sm_t *sm);
+extern osm_signal_t osm_qos_setup(IN osm_opensm_t * p_osm);
+extern osm_signal_t osm_pkey_mgr_process(IN osm_opensm_t * p_osm);
+extern osm_signal_t osm_mcast_mgr_process(IN osm_sm_t *sm);
+extern osm_signal_t osm_mcast_mgr_process_mgroups(IN osm_sm_t *sm);
+extern osm_signal_t osm_link_mgr_process(IN osm_sm_t *sm, IN uint8_t state);
 
 /**********************************************************************
  **********************************************************************/
@@ -1078,7 +1083,7 @@ _repeat_discovery:
 				"SM PORT DOWN");
 
 		/* Run the drop manager - we want to clear all records */
-		osm_drop_mgr_process(&sm->drop_mgr);
+		osm_drop_mgr_process(sm);
 
 		/* Move to DISCOVERING state */
 		osm_sm_state_mgr_process(sm, OSM_SM_SIGNAL_DISCOVER);
@@ -1144,7 +1149,7 @@ _repeat_discovery:
 	}
 
 	/* Need to continue with lid assignment */
-	osm_drop_mgr_process(&sm->drop_mgr);
+	osm_drop_mgr_process(sm);
 
 	/*
 	 * If we are not MASTER already - this means that we are
@@ -1206,7 +1211,7 @@ _repeat_discovery:
 			"SWITCHES CONFIGURED FOR UNICAST");
 
 	if (!sm->p_subn->opt.disable_multicast) {
-		osm_mcast_mgr_process(&sm->mcast_mgr);
+		osm_mcast_mgr_process(sm);
 		if (wait_for_pending_transactions(&sm->p_subn->p_osm->stats))
 			return;
 		osm_log_msg_box(sm->p_log, OSM_LOG_VERBOSE, __FUNCTION__,
@@ -1221,21 +1226,21 @@ _repeat_discovery:
 	 * other parameters provided by the Set(PortInfo) Packet.
 	 */
 
-	osm_link_mgr_process(&sm->link_mgr, IB_LINK_NO_CHANGE);
+	osm_link_mgr_process(sm, IB_LINK_NO_CHANGE);
 	if (wait_for_pending_transactions(&sm->p_subn->p_osm->stats))
 		return;
 
 	osm_log_msg_box(sm->p_log, OSM_LOG_VERBOSE, __FUNCTION__,
 			"LINKS PORTS CONFIGURED - SET LINKS TO ARMED STATE");
 
-	osm_link_mgr_process(&sm->link_mgr, IB_LINK_ARMED);
+	osm_link_mgr_process(sm, IB_LINK_ARMED);
 	if (wait_for_pending_transactions(&sm->p_subn->p_osm->stats))
 		return;
 
 	osm_log_msg_box(sm->p_log, OSM_LOG_VERBOSE, __FUNCTION__,
 			"LINKS ARMED - SET LINKS TO ACTIVE STATE");
 
-	osm_link_mgr_process(&sm->link_mgr, IB_LINK_ACTIVE);
+	osm_link_mgr_process(sm, IB_LINK_ACTIVE);
 	if (wait_for_pending_transactions(&sm->p_subn->p_osm->stats))
 		return;
 
@@ -1277,7 +1282,7 @@ static void do_process_mgrp_queue(osm_sm_t * sm)
 {
 	if (sm->p_subn->sm_state != IB_SMINFO_STATE_MASTER)
 		return;
-	osm_mcast_mgr_process_mgroups(&sm->mcast_mgr);
+	osm_mcast_mgr_process_mgroups(sm);
 	wait_for_pending_transactions(&sm->p_subn->p_osm->stats);
 }
 
-- 
1.5.4.rc5




More information about the general mailing list