[ofa-general] [PATCH 1/4] opensm: cleanup SM related _rcv_t objects

Sasha Khapyorsky sashak at voltaire.com
Thu Jan 3 02:01:12 PST 2008


This removes SM related dummy *_rcv_t objects and eliminates some data
duplications. Instead osm_sm_t is used.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/include/opensm/osm_inform.h |    1 -
 opensm/include/opensm/osm_sm.h     |   43 +-----
 opensm/opensm/osm_inform.c         |    2 -
 opensm/opensm/osm_lin_fwd_rcv.c    |   59 ++-------
 opensm/opensm/osm_mcast_fwd_rcv.c  |   63 ++-------
 opensm/opensm/osm_node_desc_rcv.c  |   70 ++-------
 opensm/opensm/osm_node_info_rcv.c  |  276 +++++++++++++++---------------------
 opensm/opensm/osm_pkey_rcv.c       |   75 ++--------
 opensm/opensm/osm_port_info_rcv.c  |  201 ++++++++++----------------
 opensm/opensm/osm_slvl_map_rcv.c   |   75 ++--------
 opensm/opensm/osm_sm.c             |  120 ++++------------
 opensm/opensm/osm_sminfo_rcv.c     |  255 +++++++++++++--------------------
 opensm/opensm/osm_sw_info_rcv.c    |  185 ++++++++++---------------
 opensm/opensm/osm_trap_rcv.c       |  184 +++++++++----------------
 opensm/opensm/osm_vl_arb_rcv.c     |   76 ++--------
 15 files changed, 546 insertions(+), 1139 deletions(-)

diff --git a/opensm/include/opensm/osm_inform.h b/opensm/include/opensm/osm_inform.h
index 91c0c64..0ec6a1b 100644
--- a/opensm/include/opensm/osm_inform.h
+++ b/opensm/include/opensm/osm_inform.h
@@ -58,7 +58,6 @@
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_sa_informinfo.h>
-#include <opensm/osm_trap_rcv.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 a676cd6..f68d59e 100644
--- a/opensm/include/opensm/osm_sm.h
+++ b/opensm/include/opensm/osm_sm.h
@@ -53,6 +53,7 @@
 #include <complib/cl_event.h>
 #include <complib/cl_thread.h>
 #include <complib/cl_dispatcher.h>
+#include <complib/cl_event_wheel.h>
 #include <vendor/osm_vendor.h>
 #include <opensm/osm_stats.h>
 #include <opensm/osm_subnet.h>
@@ -61,24 +62,13 @@
 #include <opensm/osm_req.h>
 #include <opensm/osm_resp.h>
 #include <opensm/osm_log.h>
-#include <opensm/osm_node_info_rcv.h>
-#include <opensm/osm_port_info_rcv.h>
-#include <opensm/osm_sw_info_rcv.h>
-#include <opensm/osm_node_desc_rcv.h>
 #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_lin_fwd_rcv.h>
-#include <opensm/osm_mcast_fwd_rcv.h>
 #include <opensm/osm_sweep_fail_ctrl.h>
-#include <opensm/osm_sminfo_rcv.h>
-#include <opensm/osm_trap_rcv.h>
 #include <opensm/osm_sm_state_mgr.h>
-#include <opensm/osm_slvl_map_rcv.h>
-#include <opensm/osm_vl_arb_rcv.h>
-#include <opensm/osm_pkey_rcv.h>
 #include <opensm/osm_port.h>
 #include <opensm/osm_mcast_mgr.h>
 #include <opensm/osm_db.h>
@@ -130,6 +120,7 @@ typedef struct osm_sm {
 	cl_event_t signal_event;
 	cl_event_t subnet_up_event;
 	cl_timer_t sweep_timer;
+	cl_event_wheel_t trap_aging_tracker;
 	cl_thread_t sweeper;
 	osm_subn_t *p_subn;
 	osm_db_t *p_db;
@@ -144,26 +135,15 @@ typedef struct osm_sm {
 	cl_qlist_t mgrp_list;
 	osm_req_t req;
 	osm_resp_t resp;
-	osm_ni_rcv_t ni_rcv;
-	osm_pi_rcv_t pi_rcv;
-	osm_nd_rcv_t nd_rcv;
 	osm_sm_mad_ctrl_t mad_ctrl;
-	osm_si_rcv_t si_rcv;
 	osm_lid_mgr_t lid_mgr;
 	osm_ucast_mgr_t ucast_mgr;
 	osm_link_mgr_t link_mgr;
 	osm_state_mgr_t state_mgr;
 	osm_drop_mgr_t drop_mgr;
-	osm_lft_rcv_t lft_rcv;
-	osm_mft_rcv_t mft_rcv;
 	osm_sweep_fail_ctrl_t sweep_fail_ctrl;
-	osm_sminfo_rcv_t sm_info_rcv;
-	osm_trap_rcv_t trap_rcv;
 	osm_sm_state_mgr_t sm_state_mgr;
 	osm_mcast_mgr_t mcast_mgr;
-	osm_slvl_rcv_t slvl_rcv;
-	osm_vla_rcv_t vla_rcv;
-	osm_pkey_rcv_t pkey_rcv;
 	cl_disp_reg_handle_t ni_disp_h;
 	cl_disp_reg_handle_t pi_disp_h;
 	cl_disp_reg_handle_t nd_disp_h;
@@ -181,8 +161,8 @@ typedef struct osm_sm {
 *	p_subn
 *		Pointer to the Subnet object for this subnet.
 *
-*  p_db
-*     Pointer to the database (persistency) object
+*	p_db
+*		Pointer to the database (persistency) object
 *
 *	p_vendor
 *		Pointer to the vendor specific interfaces object.
@@ -202,21 +182,6 @@ typedef struct osm_sm {
 *	resp
 *		MAD attribute responder.
 *
-*	nd_rcv_ctrl
-*		Node Description Receive Controller.
-*
-*	ni_rcv_ctrl
-*		Node Info Receive Controller.
-*
-*	pi_rcv_ctrl
-*		Port Info Receive Controller.
-*
-*	si_rcv_ctrl
-*		Switch Info Receive Controller.
-*
-*	nd_rcv_ctrl
-*		Node Description Receive Controller.
-*
 *	mad_ctrl
 *		MAD Controller.
 *
diff --git a/opensm/opensm/osm_inform.c b/opensm/opensm/osm_inform.c
index 69eaaef..e488e3b 100644
--- a/opensm/opensm/osm_inform.c
+++ b/opensm/opensm/osm_inform.c
@@ -50,11 +50,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <complib/cl_debug.h>
-#include <complib/cl_timer.h>
 #include <opensm/osm_sa_informinfo.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_inform.h>
-#include <opensm/osm_trap_rcv.h>
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_sa.h>
diff --git a/opensm/opensm/osm_lin_fwd_rcv.c b/opensm/opensm/osm_lin_fwd_rcv.c
index efc0b1b..7d9d1af 100644
--- a/opensm/opensm/osm_lin_fwd_rcv.c
+++ b/opensm/opensm/osm_lin_fwd_rcv.c
@@ -51,53 +51,14 @@
 
 #include <string.h>
 #include <complib/cl_debug.h>
-#include <opensm/osm_lin_fwd_rcv.h>
 #include <opensm/osm_switch.h>
-
-/**********************************************************************
- **********************************************************************/
-void osm_lft_rcv_construct(IN osm_lft_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_lft_rcv_destroy(IN osm_lft_rcv_t * const p_rcv)
-{
-	CL_ASSERT(p_rcv);
-
-	OSM_LOG_ENTER(p_rcv->p_log, osm_lft_rcv_destroy);
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_lft_rcv_init(IN osm_lft_rcv_t * const p_rcv,
-		 IN osm_subn_t * const p_subn,
-		 IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
-{
-	ib_api_status_t status = IB_SUCCESS;
-
-	OSM_LOG_ENTER(p_log, osm_lft_rcv_init);
-
-	osm_lft_rcv_construct(p_rcv);
-
-	p_rcv->p_log = p_log;
-	p_rcv->p_subn = p_subn;
-	p_rcv->p_lock = p_lock;
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-	return (status);
-}
+#include <opensm/osm_sm.h>
 
 /**********************************************************************
  **********************************************************************/
 void osm_lft_rcv_process(IN void *context, IN void *data)
 {
-	osm_lft_rcv_t *p_rcv = context;
+	osm_sm_t *sm = context;
 	osm_madw_t *p_madw = data;
 	ib_smp_t *p_smp;
 	uint32_t block_num;
@@ -107,9 +68,9 @@ void osm_lft_rcv_process(IN void *context, IN void *data)
 	ib_net64_t node_guid;
 	ib_api_status_t status;
 
-	CL_ASSERT(p_rcv);
+	CL_ASSERT(sm);
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_lft_rcv_process);
+	OSM_LOG_ENTER(sm->p_log, osm_lft_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -123,18 +84,18 @@ void osm_lft_rcv_process(IN void *context, IN void *data)
 	p_lft_context = osm_madw_get_lft_context_ptr(p_madw);
 	node_guid = p_lft_context->node_guid;
 
-	CL_PLOCK_EXCL_ACQUIRE(p_rcv->p_lock);
-	p_sw = osm_get_switch_by_guid(p_rcv->p_subn, node_guid);
+	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
+	p_sw = osm_get_switch_by_guid(sm->p_subn, node_guid);
 
 	if (!p_sw) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"osm_lft_rcv_process: ERR 0401: "
 			"LFT received for nonexistent node "
 			"0x%" PRIx64 "\n", cl_ntoh64(node_guid));
 	} else {
 		status = osm_switch_set_ft_block(p_sw, p_block, block_num);
 		if (status != IB_SUCCESS) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"osm_lft_rcv_process: ERR 0402: "
 				"Setting forwarding table block failed (%s)"
 				"\n\t\t\t\tSwitch 0x%" PRIx64 "\n",
@@ -142,6 +103,6 @@ void osm_lft_rcv_process(IN void *context, IN void *data)
 		}
 	}
 
-	CL_PLOCK_RELEASE(p_rcv->p_lock);
-	OSM_LOG_EXIT(p_rcv->p_log);
+	CL_PLOCK_RELEASE(sm->p_lock);
+	OSM_LOG_EXIT(sm->p_log);
 }
diff --git a/opensm/opensm/osm_mcast_fwd_rcv.c b/opensm/opensm/osm_mcast_fwd_rcv.c
index aa497b5..3233def 100644
--- a/opensm/opensm/osm_mcast_fwd_rcv.c
+++ b/opensm/opensm/osm_mcast_fwd_rcv.c
@@ -54,56 +54,17 @@
 #include <complib/cl_qmap.h>
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
-#include <opensm/osm_mcast_fwd_rcv.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_switch.h>
 #include <opensm/osm_subnet.h>
-
-/**********************************************************************
- **********************************************************************/
-void osm_mft_rcv_construct(IN osm_mft_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_mft_rcv_destroy(IN osm_mft_rcv_t * const p_rcv)
-{
-	CL_ASSERT(p_rcv);
-
-	OSM_LOG_ENTER(p_rcv->p_log, osm_mft_rcv_destroy);
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_mft_rcv_init(IN osm_mft_rcv_t * const p_rcv,
-		 IN osm_subn_t * const p_subn,
-		 IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
-{
-	ib_api_status_t status = IB_SUCCESS;
-
-	OSM_LOG_ENTER(p_log, osm_mft_rcv_init);
-
-	osm_mft_rcv_construct(p_rcv);
-
-	p_rcv->p_log = p_log;
-	p_rcv->p_subn = p_subn;
-	p_rcv->p_lock = p_lock;
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-	return (status);
-}
+#include <opensm/osm_sm.h>
 
 /**********************************************************************
  **********************************************************************/
 void osm_mft_rcv_process(IN void *context, IN void *data)
 {
-	osm_mft_rcv_t *p_rcv = context;
+	osm_sm_t *sm = context;
 	osm_madw_t *p_madw = data;
 	ib_smp_t *p_smp;
 	uint32_t block_num;
@@ -114,9 +75,9 @@ void osm_mft_rcv_process(IN void *context, IN void *data)
 	ib_net64_t node_guid;
 	ib_api_status_t status;
 
-	CL_ASSERT(p_rcv);
+	CL_ASSERT(sm);
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_mft_rcv_process);
+	OSM_LOG_ENTER(sm->p_log, osm_mft_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -133,8 +94,8 @@ void osm_mft_rcv_process(IN void *context, IN void *data)
 	p_mft_context = osm_madw_get_mft_context_ptr(p_madw);
 	node_guid = p_mft_context->node_guid;
 
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
-		osm_log(p_rcv->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_mft_rcv_process: "
 			"Setting MFT block %u, position %u, "
 			"Switch 0x%016" PRIx64 ", TID 0x%" PRIx64 "\n",
@@ -142,11 +103,11 @@ void osm_mft_rcv_process(IN void *context, IN void *data)
 			cl_ntoh64(p_smp->trans_id));
 	}
 
-	CL_PLOCK_EXCL_ACQUIRE(p_rcv->p_lock);
-	p_sw = osm_get_switch_by_guid(p_rcv->p_subn, node_guid);
+	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
+	p_sw = osm_get_switch_by_guid(sm->p_subn, node_guid);
 
 	if (!p_sw) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"osm_mft_rcv_process: ERR 0801: "
 			"MFT received for nonexistent node "
 			"0x%016" PRIx64 "\n", cl_ntoh64(node_guid));
@@ -155,7 +116,7 @@ void osm_mft_rcv_process(IN void *context, IN void *data)
 						  (uint16_t) block_num,
 						  position);
 		if (status != IB_SUCCESS) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"osm_mft_rcv_process: ERR 0802: "
 				"Setting MFT block failed (%s)"
 				"\n\t\t\t\tSwitch 0x%016" PRIx64
@@ -165,6 +126,6 @@ void osm_mft_rcv_process(IN void *context, IN void *data)
 		}
 	}
 
-	CL_PLOCK_RELEASE(p_rcv->p_lock);
-	OSM_LOG_EXIT(p_rcv->p_log);
+	CL_PLOCK_RELEASE(sm->p_lock);
+	OSM_LOG_EXIT(sm->p_log);
 }
diff --git a/opensm/opensm/osm_node_desc_rcv.c b/opensm/opensm/osm_node_desc_rcv.c
index 788905b..6c9c8ea 100644
--- a/opensm/opensm/osm_node_desc_rcv.c
+++ b/opensm/opensm/osm_node_desc_rcv.c
@@ -54,7 +54,6 @@
 #include <complib/cl_qmap.h>
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
-#include <opensm/osm_node_desc_rcv.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_node.h>
@@ -64,21 +63,21 @@
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_nd_rcv_process_nd(IN const osm_nd_rcv_t * const p_rcv,
+__osm_nd_rcv_process_nd(IN osm_sm_t * sm,
 			IN osm_node_t * const p_node,
 			IN const ib_node_desc_t * const p_nd)
 {
 	char *tmp_desc;
 	char print_desc[IB_NODE_DESCRIPTION_SIZE + 1];
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_nd_rcv_process_nd);
+	OSM_LOG_ENTER(sm->p_log, __osm_nd_rcv_process_nd);
 
 	memcpy(&p_node->node_desc.description, p_nd, sizeof(*p_nd));
 
 	/* also set up a printable version */
 	memcpy(print_desc, p_nd, sizeof(*p_nd));
 	print_desc[IB_NODE_DESCRIPTION_SIZE] = '\0';
-	tmp_desc = remap_node_name(p_rcv->p_subn->p_osm->node_name_map,
+	tmp_desc = remap_node_name(sm->p_subn->p_osm->node_name_map,
 			cl_ntoh64(osm_node_get_node_guid(p_node)),
 			print_desc);
 
@@ -87,70 +86,31 @@ __osm_nd_rcv_process_nd(IN const osm_nd_rcv_t * const p_rcv,
 		free(p_node->print_desc);
 	p_node->print_desc = tmp_desc;
 
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_VERBOSE)) {
-		osm_log(p_rcv->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_nd_rcv_process_nd: "
 			"Node 0x%" PRIx64 "\n\t\t\t\tDescription = %s\n",
 			cl_ntoh64(osm_node_get_node_guid(p_node)),
 			p_node->print_desc);
 	}
 
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_nd_rcv_construct(IN osm_nd_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_nd_rcv_destroy(IN osm_nd_rcv_t * const p_rcv)
-{
-	CL_ASSERT(p_rcv);
-
-	OSM_LOG_ENTER(p_rcv->p_log, osm_nd_rcv_destroy);
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_nd_rcv_init(IN osm_nd_rcv_t * const p_rcv,
-		IN osm_subn_t * const p_subn,
-		IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
-{
-	ib_api_status_t status = IB_SUCCESS;
-
-	OSM_LOG_ENTER(p_log, osm_nd_rcv_init);
-
-	osm_nd_rcv_construct(p_rcv);
-
-	p_rcv->p_log = p_log;
-	p_rcv->p_subn = p_subn;
-	p_rcv->p_lock = p_lock;
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-	return (status);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 void osm_nd_rcv_process(IN void *context, IN void *data)
 {
-	osm_nd_rcv_t *p_rcv = context;
+	osm_sm_t *sm = context;
 	osm_madw_t *p_madw = data;
 	ib_node_desc_t *p_nd;
 	ib_smp_t *p_smp;
 	osm_node_t *p_node;
 	ib_net64_t node_guid;
 
-	CL_ASSERT(p_rcv);
+	CL_ASSERT(sm);
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_nd_rcv_process);
+	OSM_LOG_ENTER(sm->p_log, osm_nd_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -162,17 +122,17 @@ void osm_nd_rcv_process(IN void *context, IN void *data)
 	 */
 
 	node_guid = osm_madw_get_nd_context_ptr(p_madw)->node_guid;
-	CL_PLOCK_EXCL_ACQUIRE(p_rcv->p_lock);
-	p_node = osm_get_node_by_guid(p_rcv->p_subn, node_guid);
+	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
+	p_node = osm_get_node_by_guid(sm->p_subn, node_guid);
 	if (!p_node) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"osm_nd_rcv_process: ERR 0B01: "
 			"NodeDescription received for nonexistent node "
 			"0x%" PRIx64 "\n", cl_ntoh64(node_guid));
 	} else {
-		__osm_nd_rcv_process_nd(p_rcv, p_node, p_nd);
+		__osm_nd_rcv_process_nd(sm, p_node, p_nd);
 	}
 
-	CL_PLOCK_RELEASE(p_rcv->p_lock);
-	OSM_LOG_EXIT(p_rcv->p_log);
+	CL_PLOCK_RELEASE(sm->p_lock);
+	OSM_LOG_EXIT(sm->p_log);
 }
diff --git a/opensm/opensm/osm_node_info_rcv.c b/opensm/opensm/osm_node_info_rcv.c
index 4571a0f..b84788a 100644
--- a/opensm/opensm/osm_node_info_rcv.c
+++ b/opensm/opensm/osm_node_info_rcv.c
@@ -55,7 +55,6 @@
 #include <complib/cl_qmap.h>
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
-#include <opensm/osm_node_info_rcv.h>
 #include <opensm/osm_req.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
@@ -68,7 +67,7 @@
 #include <opensm/osm_opensm.h>
 
 static void
-report_duplicated_guid(IN const osm_ni_rcv_t * const p_rcv,
+report_duplicated_guid(IN osm_sm_t * sm,
 		       osm_physp_t * p_physp,
 		       osm_node_t * p_neighbor_node, const uint8_t port_num)
 {
@@ -78,7 +77,7 @@ report_duplicated_guid(IN const osm_ni_rcv_t * const p_rcv,
 	p_old = p_physp->p_remote_physp;
 	p_new = osm_node_get_physp_ptr(p_neighbor_node, port_num);
 
-	osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+	osm_log(sm->p_log, OSM_LOG_ERROR,
 		"report_duplicated_guid: ERR 0D01: "
 		"Found duplicated node.\n"
 		"Node 0x%" PRIx64 " port %u is reachable from remote node "
@@ -89,18 +88,18 @@ report_duplicated_guid(IN const osm_ni_rcv_t * const p_rcv,
 		cl_ntoh64(p_old->p_node->node_info.node_guid), p_old->port_num,
 		cl_ntoh64(p_new->p_node->node_info.node_guid), p_new->port_num);
 
-	osm_dump_dr_path(p_rcv->p_log, osm_physp_get_dr_path_ptr(p_physp),
+	osm_dump_dr_path(sm->p_log, osm_physp_get_dr_path_ptr(p_physp),
 			 OSM_LOG_ERROR);
 
 	path = *osm_physp_get_dr_path_ptr(p_new);
 	osm_dr_path_extend(&path, port_num);
-	osm_dump_dr_path(p_rcv->p_log, &path, OSM_LOG_ERROR);
+	osm_dump_dr_path(sm->p_log, &path, OSM_LOG_ERROR);
 
-	osm_log(p_rcv->p_log, OSM_LOG_SYS,
+	osm_log(sm->p_log, OSM_LOG_SYS,
 		"FATAL: duplicated guids or 12x lane reversal\n");
 }
 
-static void requery_dup_node_info(IN const osm_ni_rcv_t * const p_rcv,
+static void requery_dup_node_info(IN osm_sm_t * sm,
 				  osm_physp_t * p_physp, unsigned count)
 {
 	osm_madw_context_t context;
@@ -117,13 +116,13 @@ static void requery_dup_node_info(IN const osm_ni_rcv_t * const p_rcv,
 	context.ni_context.dup_port_num = p_physp->port_num;
 	context.ni_context.dup_count = count;
 
-	status = osm_req_get(p_rcv->p_gen_req,
+	status = osm_req_get(&sm->req,
 			     &path,
 			     IB_MAD_ATTR_NODE_INFO,
 			     0, CL_DISP_MSGID_NONE, &context);
 
 	if (status != IB_SUCCESS)
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"requery_dup_node_info: ERR 0D02: "
 			"Failure initiating NodeInfo request (%s)\n",
 			ib_get_err_str(status));
@@ -133,7 +132,7 @@ static void requery_dup_node_info(IN const osm_ni_rcv_t * const p_rcv,
  The plock must be held before calling this function.
 **********************************************************************/
 static void
-__osm_ni_rcv_set_links(IN const osm_ni_rcv_t * const p_rcv,
+__osm_ni_rcv_set_links(IN osm_sm_t * sm,
 		       osm_node_t * p_node,
 		       const uint8_t port_num,
 		       const osm_ni_context_t * const p_ni_context)
@@ -141,7 +140,7 @@ __osm_ni_rcv_set_links(IN const osm_ni_rcv_t * const p_rcv,
 	osm_node_t *p_neighbor_node;
 	osm_physp_t *p_physp;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_ni_rcv_set_links);
+	OSM_LOG_ENTER(sm->p_log, __osm_ni_rcv_set_links);
 
 	/*
 	   A special case exists in which the node we're trying to
@@ -149,17 +148,17 @@ __osm_ni_rcv_set_links(IN const osm_ni_rcv_t * const p_rcv,
 	   the ni_context will be zero.
 	 */
 	if (p_ni_context->node_guid == 0) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sm->p_log, OSM_LOG_DEBUG,
 			"__osm_ni_rcv_set_links: "
 			"Nothing to link for our own node 0x%" PRIx64 "\n",
 			cl_ntoh64(osm_node_get_node_guid(p_node)));
 		goto _exit;
 	}
 
-	p_neighbor_node = osm_get_node_by_guid(p_rcv->p_subn,
+	p_neighbor_node = osm_get_node_by_guid(sm->p_subn,
 					       p_ni_context->node_guid);
 	if (!p_neighbor_node) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_ni_rcv_set_links: ERR 0D10: "
 			"Unexpected removal of neighbor node "
 			"0x%" PRIx64 "\n", cl_ntoh64(p_ni_context->node_guid));
@@ -181,13 +180,13 @@ __osm_ni_rcv_set_links(IN const osm_ni_rcv_t * const p_rcv,
 
 	if (osm_node_link_exists(p_node, port_num,
 				 p_neighbor_node, p_ni_context->port_num)) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sm->p_log, OSM_LOG_DEBUG,
 			"__osm_ni_rcv_set_links: " "Link already exists\n");
 		goto _exit;
 	}
 
 	if (osm_node_has_any_link(p_node, port_num) &&
-	    p_rcv->p_subn->force_immediate_heavy_sweep == FALSE &&
+	    sm->p_subn->force_immediate_heavy_sweep == FALSE &&
 	    (!p_ni_context->dup_count ||
 	     (p_ni_context->dup_node_guid == osm_node_get_node_guid(p_node) &&
 	      p_ni_context->dup_port_num == port_num))) {
@@ -208,15 +207,15 @@ __osm_ni_rcv_set_links(IN const osm_ni_rcv_t * const p_rcv,
 		 */
 		p_physp = osm_node_get_physp_ptr(p_node, port_num);
 		if (p_ni_context->dup_count > 5) {
-			report_duplicated_guid(p_rcv, p_physp,
+			report_duplicated_guid(sm, p_physp,
 					       p_neighbor_node,
 					       p_ni_context->port_num);
-			p_rcv->p_subn->force_immediate_heavy_sweep = TRUE;
+			sm->p_subn->force_immediate_heavy_sweep = TRUE;
 		} else if (p_node->sw)
-			requery_dup_node_info(p_rcv, p_physp->p_remote_physp,
+			requery_dup_node_info(sm, p_physp->p_remote_physp,
 					      p_ni_context->dup_count + 1);
 		else
-			requery_dup_node_info(p_rcv, p_physp,
+			requery_dup_node_info(sm, p_physp,
 					      p_ni_context->dup_count + 1);
 	}
 
@@ -228,19 +227,19 @@ __osm_ni_rcv_set_links(IN const osm_ni_rcv_t * const p_rcv,
 	 */
 	if ((osm_node_get_node_guid(p_node) == p_ni_context->node_guid) &&
 	    (port_num == p_ni_context->port_num) &&
-	    port_num != 0 && cl_qmap_count(&p_rcv->p_subn->sw_guid_tbl) == 0) {
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+	    port_num != 0 && cl_qmap_count(&sm->p_subn->sw_guid_tbl) == 0) {
+		osm_log(sm->p_log, OSM_LOG_VERBOSE,
 			"__osm_ni_rcv_set_links: "
 			"Duplicate GUID found by link from a port to itself:"
 			"node 0x%" PRIx64 ", port number 0x%X\n",
 			cl_ntoh64(osm_node_get_node_guid(p_node)), port_num);
 		p_physp = osm_node_get_physp_ptr(p_node, port_num);
-		osm_dump_dr_path(p_rcv->p_log,
+		osm_dump_dr_path(sm->p_log,
 				 osm_physp_get_dr_path_ptr(p_physp),
 				 OSM_LOG_VERBOSE);
 
-		if (p_rcv->p_subn->opt.exit_on_fatal == TRUE) {
-			osm_log(p_rcv->p_log, OSM_LOG_SYS,
+		if (sm->p_subn->opt.exit_on_fatal == TRUE) {
+			osm_log(sm->p_log, OSM_LOG_SYS,
 				"Errors on subnet. Duplicate GUID found "
 				"by link from a port to itself. "
 				"See verbose opensm.log for more details\n");
@@ -248,8 +247,8 @@ __osm_ni_rcv_set_links(IN const osm_ni_rcv_t * const p_rcv,
 		}
 	}
 
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
-		osm_log(p_rcv->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_ni_rcv_set_links: "
 			"Creating new link between: "
 			"\n\t\t\t\tnode 0x%" PRIx64 ", "
@@ -265,14 +264,14 @@ __osm_ni_rcv_set_links(IN const osm_ni_rcv_t * const p_rcv,
 		      p_ni_context->port_num);
 
       _exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
 static void
-__osm_ni_rcv_process_new_node(IN const osm_ni_rcv_t * const p_rcv,
+__osm_ni_rcv_process_new_node(IN osm_sm_t * sm,
 			      IN osm_node_t * const p_node,
 			      IN const osm_madw_t * const p_madw)
 {
@@ -283,7 +282,7 @@ __osm_ni_rcv_process_new_node(IN const osm_ni_rcv_t * const p_rcv,
 	ib_smp_t *p_smp;
 	uint8_t port_num;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_ni_rcv_process_new_node);
+	OSM_LOG_ENTER(sm->p_log, __osm_ni_rcv_process_new_node);
 
 	CL_ASSERT(p_node);
 	CL_ASSERT(p_madw);
@@ -314,24 +313,24 @@ __osm_ni_rcv_process_new_node(IN const osm_ni_rcv_t * const p_rcv,
 	context.pi_context.light_sweep = FALSE;
 	context.pi_context.active_transition = FALSE;
 
-	status = osm_req_get(p_rcv->p_gen_req,
+	status = osm_req_get(&sm->req,
 			     osm_physp_get_dr_path_ptr(p_physp),
 			     IB_MAD_ATTR_PORT_INFO,
 			     cl_hton32(port_num), CL_DISP_MSGID_NONE, &context);
 	if (status != IB_SUCCESS)
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_ni_rcv_process_new_node: ERR 0D02: "
 			"Failure initiating PortInfo request (%s)\n",
 			ib_get_err_str(status));
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
 static void
-__osm_ni_rcv_get_node_desc(IN const osm_ni_rcv_t * const p_rcv,
+__osm_ni_rcv_get_node_desc(IN osm_sm_t * sm,
 			   IN osm_node_t * const p_node,
 			   IN const osm_madw_t * const p_madw)
 {
@@ -342,7 +341,7 @@ __osm_ni_rcv_get_node_desc(IN const osm_ni_rcv_t * const p_rcv,
 	ib_smp_t *p_smp;
 	uint8_t port_num;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_ni_rcv_get_node_desc);
+	OSM_LOG_ENTER(sm->p_log, __osm_ni_rcv_get_node_desc);
 
 	CL_ASSERT(p_node);
 	CL_ASSERT(p_madw);
@@ -368,30 +367,30 @@ __osm_ni_rcv_get_node_desc(IN const osm_ni_rcv_t * const p_rcv,
 
 	context.nd_context.node_guid = osm_node_get_node_guid(p_node);
 
-	status = osm_req_get(p_rcv->p_gen_req,
+	status = osm_req_get(&sm->req,
 			     osm_physp_get_dr_path_ptr(p_physp),
 			     IB_MAD_ATTR_NODE_DESC,
 			     0, CL_DISP_MSGID_NONE, &context);
 	if (status != IB_SUCCESS)
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_ni_rcv_get_node_desc: ERR 0D03: "
 			"Failure initiating NodeDescription request (%s)\n",
 			ib_get_err_str(status));
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
 static void
-__osm_ni_rcv_process_new_ca_or_router(IN const osm_ni_rcv_t * const p_rcv,
+__osm_ni_rcv_process_new_ca_or_router(IN osm_sm_t * sm,
 				      IN osm_node_t * const p_node,
 				      IN const osm_madw_t * const p_madw)
 {
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_ni_rcv_process_new_ca_or_router);
+	OSM_LOG_ENTER(sm->p_log, __osm_ni_rcv_process_new_ca_or_router);
 
-	__osm_ni_rcv_process_new_node(p_rcv, p_node, p_madw);
+	__osm_ni_rcv_process_new_node(sm, p_node, p_madw);
 
 	/*
 	   A node guid of 0 is the corner case that indicates
@@ -399,16 +398,16 @@ __osm_ni_rcv_process_new_ca_or_router(IN const osm_ni_rcv_t * const p_rcv,
 	   object with the SM's own port guid.
 	 */
 	if (osm_madw_get_ni_context_ptr(p_madw)->node_guid == 0)
-		p_rcv->p_subn->sm_port_guid = p_node->node_info.port_guid;
+		sm->p_subn->sm_port_guid = p_node->node_info.port_guid;
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
 static void
-__osm_ni_rcv_process_existing_ca_or_router(IN const osm_ni_rcv_t * const p_rcv,
+__osm_ni_rcv_process_existing_ca_or_router(IN osm_sm_t * sm,
 					   IN osm_node_t * const p_node,
 					   IN const osm_madw_t * const p_madw)
 {
@@ -423,7 +422,7 @@ __osm_ni_rcv_process_existing_ca_or_router(IN const osm_ni_rcv_t * const p_rcv,
 	osm_dr_path_t *p_dr_path;
 	osm_bind_handle_t h_bind;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_ni_rcv_process_existing_ca_or_router);
+	OSM_LOG_ENTER(sm->p_log, __osm_ni_rcv_process_existing_ca_or_router);
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
 	p_ni = (ib_node_info_t *) ib_smp_get_payload_ptr(p_smp);
@@ -435,9 +434,9 @@ __osm_ni_rcv_process_existing_ca_or_router(IN const osm_ni_rcv_t * const p_rcv,
 	   previously undiscovered port.  If so, build the new
 	   port object.
 	 */
-	p_port = osm_get_port_by_guid(p_rcv->p_subn, p_ni->port_guid);
+	p_port = osm_get_port_by_guid(sm->p_subn, p_ni->port_guid);
 	if (!p_port) {
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sm->p_log, OSM_LOG_VERBOSE,
 			"__osm_ni_rcv_process_existing_ca_or_router: "
 			"Creating new port object with GUID 0x%" PRIx64 "\n",
 			cl_ntoh64(p_ni->port_guid));
@@ -446,7 +445,7 @@ __osm_ni_rcv_process_existing_ca_or_router(IN const osm_ni_rcv_t * const p_rcv,
 
 		p_port = osm_port_new(p_ni, p_node);
 		if (p_port == NULL) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"__osm_ni_rcv_process_existing_ca_or_router: ERR 0D04: "
 				"Unable to create new port object\n");
 			goto Exit;
@@ -456,7 +455,7 @@ __osm_ni_rcv_process_existing_ca_or_router(IN const osm_ni_rcv_t * const p_rcv,
 		   Add the new port object to the database.
 		 */
 		p_port_check =
-		    (osm_port_t *) cl_qmap_insert(&p_rcv->p_subn->port_guid_tbl,
+		    (osm_port_t *) cl_qmap_insert(&sm->p_subn->port_guid_tbl,
 						  p_ni->port_guid,
 						  &p_port->map_item);
 		if (p_port_check != p_port) {
@@ -464,7 +463,7 @@ __osm_ni_rcv_process_existing_ca_or_router(IN const osm_ni_rcv_t * const p_rcv,
 			   We should never be here!
 			   Somehow, this port GUID already exists in the table.
 			 */
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"__osm_ni_rcv_process_existing_ca_or_router: ERR 0D12: "
 				"Port 0x%" PRIx64 " already in the database!\n",
 				cl_ntoh64(p_ni->port_guid));
@@ -480,7 +479,7 @@ __osm_ni_rcv_process_existing_ca_or_router(IN const osm_ni_rcv_t * const p_rcv,
 		   then these ports may be new to us, but are not new on the subnet.
 		   If we are master, then the subnet as we know it is the updated one,
 		   and any new ports we encounter should cause trap 64. C14-72.1.1 */
-		if (p_rcv->p_subn->sm_state == IB_SMINFO_STATE_MASTER)
+		if (sm->p_subn->sm_state == IB_SMINFO_STATE_MASTER)
 			p_port->is_new = 1;
 
 		p_physp = osm_node_get_physp_ptr(p_node, port_num);
@@ -488,7 +487,7 @@ __osm_ni_rcv_process_existing_ca_or_router(IN const osm_ni_rcv_t * const p_rcv,
 		p_physp = osm_node_get_physp_ptr(p_node, port_num);
 
 		if (!osm_physp_is_valid(p_physp)) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"__osm_ni_rcv_process_existing_ca_or_router: ERR 0D19: "
 				"Invalid physical port. Aborting discovery\n");
 			goto Exit;
@@ -510,25 +509,25 @@ __osm_ni_rcv_process_existing_ca_or_router(IN const osm_ni_rcv_t * const p_rcv,
 	context.pi_context.update_master_sm_base_lid = FALSE;
 	context.pi_context.light_sweep = FALSE;
 
-	status = osm_req_get(p_rcv->p_gen_req,
+	status = osm_req_get(&sm->req,
 			     osm_physp_get_dr_path_ptr(p_physp),
 			     IB_MAD_ATTR_PORT_INFO,
 			     cl_hton32(port_num), CL_DISP_MSGID_NONE, &context);
 
 	if (status != IB_SUCCESS)
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_ni_rcv_process_existing_ca_or_router: ERR 0D13: "
 			"Failure initiating PortInfo request (%s)\n",
 			ib_get_err_str(status));
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_ni_rcv_process_switch(IN const osm_ni_rcv_t * const p_rcv,
+__osm_ni_rcv_process_switch(IN osm_sm_t * sm,
 			    IN osm_node_t * const p_node,
 			    IN const osm_madw_t * const p_madw)
 {
@@ -537,7 +536,7 @@ __osm_ni_rcv_process_switch(IN const osm_ni_rcv_t * const p_rcv,
 	osm_dr_path_t dr_path;
 	ib_smp_t *p_smp;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_ni_rcv_process_switch);
+	OSM_LOG_ENTER(sm->p_log, __osm_ni_rcv_process_switch);
 
 	CL_ASSERT(p_node);
 	CL_ASSERT(p_madw);
@@ -553,29 +552,29 @@ __osm_ni_rcv_process_switch(IN const osm_ni_rcv_t * const p_rcv,
 	context.si_context.light_sweep = FALSE;
 
 	/* Request a SwitchInfo attribute */
-	status = osm_req_get(p_rcv->p_gen_req,
+	status = osm_req_get(&sm->req,
 			     &dr_path,
 			     IB_MAD_ATTR_SWITCH_INFO,
 			     0, CL_DISP_MSGID_NONE, &context);
 	if (status != IB_SUCCESS)
 		/* continue despite error */
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_ni_rcv_process_switch: ERR 0D06: "
 			"Failure initiating SwitchInfo request (%s)\n",
 			ib_get_err_str(status));
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
 static void
-__osm_ni_rcv_process_existing_switch(IN const osm_ni_rcv_t * const p_rcv,
+__osm_ni_rcv_process_existing_switch(IN osm_sm_t * sm,
 				     IN osm_node_t * const p_node,
 				     IN const osm_madw_t * const p_madw)
 {
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_ni_rcv_process_existing_switch);
+	OSM_LOG_ENTER(sm->p_log, __osm_ni_rcv_process_existing_switch);
 
 	/*
 	   If this switch has already been probed during this sweep,
@@ -586,30 +585,30 @@ __osm_ni_rcv_process_existing_switch(IN const osm_ni_rcv_t * const p_rcv,
 	   to retry to probe the switch.
 	 */
 	if (p_node->discovery_count == 1)
-		__osm_ni_rcv_process_switch(p_rcv, p_node, p_madw);
+		__osm_ni_rcv_process_switch(sm, p_node, p_madw);
 	else if (!p_node->sw || p_node->sw->discovery_count == 0) {
 		/* we don't have the SwitchInfo - retry to get it */
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sm->p_log, OSM_LOG_DEBUG,
 			"__osm_ni_rcv_process_existing_switch: "
 			"Retry to get SwitchInfo on node GUID:0x%"
 			PRIx64 "\n", cl_ntoh64(osm_node_get_node_guid(p_node)));
-		__osm_ni_rcv_process_switch(p_rcv, p_node, p_madw);
+		__osm_ni_rcv_process_switch(sm, p_node, p_madw);
 	}
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
 static void
-__osm_ni_rcv_process_new_switch(IN const osm_ni_rcv_t * const p_rcv,
+__osm_ni_rcv_process_new_switch(IN osm_sm_t * sm,
 				IN osm_node_t * const p_node,
 				IN const osm_madw_t * const p_madw)
 {
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_ni_rcv_process_new_switch);
+	OSM_LOG_ENTER(sm->p_log, __osm_ni_rcv_process_new_switch);
 
-	__osm_ni_rcv_process_switch(p_rcv, p_node, p_madw);
+	__osm_ni_rcv_process_switch(sm, p_node, p_madw);
 
 	/*
 	   A node guid of 0 is the corner case that indicates
@@ -617,16 +616,16 @@ __osm_ni_rcv_process_new_switch(IN const osm_ni_rcv_t * const p_rcv,
 	   object with the SM's own port guid.
 	 */
 	if (osm_madw_get_ni_context_ptr(p_madw)->node_guid == 0)
-		p_rcv->p_subn->sm_port_guid = p_node->node_info.port_guid;
+		sm->p_subn->sm_port_guid = p_node->node_info.port_guid;
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
  The plock must NOT be held before calling this function.
 **********************************************************************/
 static void
-__osm_ni_rcv_process_new(IN const osm_ni_rcv_t * const p_rcv,
+__osm_ni_rcv_process_new(IN osm_sm_t * sm,
 			 IN const osm_madw_t * const p_madw)
 {
 	osm_node_t *p_node;
@@ -641,16 +640,16 @@ __osm_ni_rcv_process_new(IN const osm_ni_rcv_t * const p_rcv,
 	osm_ni_context_t *p_ni_context;
 	uint8_t port_num;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_ni_rcv_process_new);
+	OSM_LOG_ENTER(sm->p_log, __osm_ni_rcv_process_new);
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
 	p_ni = (ib_node_info_t *) ib_smp_get_payload_ptr(p_smp);
 	p_ni_context = osm_madw_get_ni_context_ptr(p_madw);
 	port_num = ib_node_info_get_local_port_num(p_ni);
 
-	osm_dump_smp_dr_path(p_rcv->p_log, p_smp, OSM_LOG_VERBOSE);
+	osm_dump_smp_dr_path(sm->p_log, p_smp, OSM_LOG_VERBOSE);
 
-	osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+	osm_log(sm->p_log, OSM_LOG_VERBOSE,
 		"__osm_ni_rcv_process_new: "
 		"Discovered new %s node,"
 		"\n\t\t\t\tGUID 0x%" PRIx64 ", TID 0x%" PRIx64 "\n",
@@ -659,7 +658,7 @@ __osm_ni_rcv_process_new(IN const osm_ni_rcv_t * const p_rcv,
 
 	p_node = osm_node_new(p_madw);
 	if (p_node == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_ni_rcv_process_new: ERR 0D07: "
 			"Unable to create new node object\n");
 		goto Exit;
@@ -671,7 +670,7 @@ __osm_ni_rcv_process_new(IN const osm_ni_rcv_t * const p_rcv,
 	 */
 	p_port = osm_port_new(p_ni, p_node);
 	if (p_port == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_ni_rcv_process_new: ERR 0D14: "
 			"Unable to create new port object\n");
 		osm_node_delete(&p_node);
@@ -682,22 +681,22 @@ __osm_ni_rcv_process_new(IN const osm_ni_rcv_t * const p_rcv,
 	   Add the new port object to the database.
 	 */
 	p_port_check =
-	    (osm_port_t *) cl_qmap_insert(&p_rcv->p_subn->port_guid_tbl,
+	    (osm_port_t *) cl_qmap_insert(&sm->p_subn->port_guid_tbl,
 					  p_ni->port_guid, &p_port->map_item);
 	if (p_port_check != p_port) {
 		/*
 		   We should never be here!
 		   Somehow, this port GUID already exists in the table.
 		 */
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_ni_rcv_process_new: ERR 0D15: "
 			"Duplicate Port GUID 0x%" PRIx64
 			"! Found by the two directed routes:\n",
 			cl_ntoh64(p_ni->port_guid));
-		osm_dump_dr_path(p_rcv->p_log,
+		osm_dump_dr_path(sm->p_log,
 				 osm_physp_get_dr_path_ptr(p_port->p_physp),
 				 OSM_LOG_ERROR);
-		osm_dump_dr_path(p_rcv->p_log,
+		osm_dump_dr_path(sm->p_log,
 				 osm_physp_get_dr_path_ptr(p_port_check->
 							   p_physp),
 				 OSM_LOG_ERROR);
@@ -713,24 +712,24 @@ __osm_ni_rcv_process_new(IN const osm_ni_rcv_t * const p_rcv,
 	   then these ports may be new to us, but are not new on the subnet.
 	   If we are master, then the subnet as we know it is the updated one,
 	   and any new ports we encounter should cause trap 64. C14-72.1.1 */
-	if (p_rcv->p_subn->sm_state == IB_SMINFO_STATE_MASTER)
+	if (sm->p_subn->sm_state == IB_SMINFO_STATE_MASTER)
 		p_port->is_new = 1;
 
 	/* If there were RouterInfo or other router attribute,
 	   this would be elsewhere */
 	if (p_ni->node_type == IB_NODE_TYPE_ROUTER) {
 		if ((p_rtr = osm_router_new(p_port)) == NULL)
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"__osm_ni_rcv_process_new: ERR 0D1A: "
 				"Unable to create new router object\n");
 		else {
-			p_rtr_guid_tbl = &p_rcv->p_subn->rtr_guid_tbl;
+			p_rtr_guid_tbl = &sm->p_subn->rtr_guid_tbl;
 			p_rtr_check =
 			    (osm_router_t *) cl_qmap_insert(p_rtr_guid_tbl,
 							    p_ni->port_guid,
 							    &p_rtr->map_item);
 			if (p_rtr_check != p_rtr)
-				osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				osm_log(sm->p_log, OSM_LOG_ERROR,
 					"__osm_ni_rcv_process_new: ERR 0D1B: "
 					"Unable to add port GUID:0x%016" PRIx64
 					" to router table\n",
@@ -739,7 +738,7 @@ __osm_ni_rcv_process_new(IN const osm_ni_rcv_t * const p_rcv,
 	}
 
 	p_node_check =
-	    (osm_node_t *) cl_qmap_insert(&p_rcv->p_subn->node_guid_tbl,
+	    (osm_node_t *) cl_qmap_insert(&sm->p_subn->node_guid_tbl,
 					  p_ni->node_guid, &p_node->map_item);
 	if (p_node_check != p_node) {
 		/*
@@ -748,30 +747,30 @@ __osm_ni_rcv_process_new(IN const osm_ni_rcv_t * const p_rcv,
 		   We can simply clean-up, since the other thread will
 		   see this processing through to completion.
 		 */
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sm->p_log, OSM_LOG_VERBOSE,
 			"__osm_ni_rcv_process_new: "
 			"Discovery race detected at node 0x%" PRIx64 "\n",
 			cl_ntoh64(p_ni->node_guid));
 		osm_node_delete(&p_node);
 		p_node = p_node_check;
-		__osm_ni_rcv_set_links(p_rcv, p_node, port_num, p_ni_context);
+		__osm_ni_rcv_set_links(sm, p_node, port_num, p_ni_context);
 		goto Exit;
 	} else
-		__osm_ni_rcv_set_links(p_rcv, p_node, port_num, p_ni_context);
+		__osm_ni_rcv_set_links(sm, p_node, port_num, p_ni_context);
 
 	p_node->discovery_count++;
-	__osm_ni_rcv_get_node_desc(p_rcv, p_node, p_madw);
+	__osm_ni_rcv_get_node_desc(sm, p_node, p_madw);
 
 	switch (p_ni->node_type) {
 	case IB_NODE_TYPE_CA:
 	case IB_NODE_TYPE_ROUTER:
-		__osm_ni_rcv_process_new_ca_or_router(p_rcv, p_node, p_madw);
+		__osm_ni_rcv_process_new_ca_or_router(sm, p_node, p_madw);
 		break;
 	case IB_NODE_TYPE_SWITCH:
-		__osm_ni_rcv_process_new_switch(p_rcv, p_node, p_madw);
+		__osm_ni_rcv_process_new_switch(sm, p_node, p_madw);
 		break;
 	default:
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_ni_rcv_process_new: ERR 0D16: "
 			"Unknown node type %u with GUID 0x%" PRIx64 "\n",
 			p_ni->node_type, cl_ntoh64(p_ni->node_guid));
@@ -779,14 +778,14 @@ __osm_ni_rcv_process_new(IN const osm_ni_rcv_t * const p_rcv,
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
 static void
-__osm_ni_rcv_process_existing(IN const osm_ni_rcv_t * const p_rcv,
+__osm_ni_rcv_process_existing(IN osm_sm_t * sm,
 			      IN osm_node_t * const p_node,
 			      IN const osm_madw_t * const p_madw)
 {
@@ -795,15 +794,15 @@ __osm_ni_rcv_process_existing(IN const osm_ni_rcv_t * const p_rcv,
 	osm_ni_context_t *p_ni_context;
 	uint8_t port_num;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_ni_rcv_process_existing);
+	OSM_LOG_ENTER(sm->p_log, __osm_ni_rcv_process_existing);
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
 	p_ni = (ib_node_info_t *) ib_smp_get_payload_ptr(p_smp);
 	p_ni_context = osm_madw_get_ni_context_ptr(p_madw);
 	port_num = ib_node_info_get_local_port_num(p_ni);
 
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_VERBOSE))
-		osm_log(p_rcv->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_ni_rcv_process_existing: "
 			"Rediscovered %s node 0x%" PRIx64
 			" TID 0x%" PRIx64 ", discovered %u times already\n",
@@ -820,82 +819,41 @@ __osm_ni_rcv_process_existing(IN const osm_ni_rcv_t * const p_rcv,
 	switch (p_ni->node_type) {
 	case IB_NODE_TYPE_CA:
 	case IB_NODE_TYPE_ROUTER:
-		__osm_ni_rcv_process_existing_ca_or_router(p_rcv, p_node,
+		__osm_ni_rcv_process_existing_ca_or_router(sm, p_node,
 							   p_madw);
 		break;
 
 	case IB_NODE_TYPE_SWITCH:
-		__osm_ni_rcv_process_existing_switch(p_rcv, p_node, p_madw);
+		__osm_ni_rcv_process_existing_switch(sm, p_node, p_madw);
 		break;
 
 	default:
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_ni_rcv_process_existing: ERR 0D09: "
 			"Unknown node type %u with GUID 0x%" PRIx64 "\n",
 			p_ni->node_type, cl_ntoh64(p_ni->node_guid));
 		break;
 	}
 
-	__osm_ni_rcv_set_links(p_rcv, p_node, port_num, p_ni_context);
+	__osm_ni_rcv_set_links(sm, p_node, port_num, p_ni_context);
 
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_ni_rcv_construct(IN osm_ni_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_ni_rcv_destroy(IN osm_ni_rcv_t * const p_rcv)
-{
-	CL_ASSERT(p_rcv);
-
-	OSM_LOG_ENTER(p_rcv->p_log, osm_ni_rcv_destroy);
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_ni_rcv_init(IN osm_ni_rcv_t * const p_rcv,
-		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)
-{
-	ib_api_status_t status = IB_SUCCESS;
-
-	OSM_LOG_ENTER(p_log, osm_ni_rcv_init);
-
-	osm_ni_rcv_construct(p_rcv);
-
-	p_rcv->p_log = p_log;
-	p_rcv->p_subn = p_subn;
-	p_rcv->p_lock = p_lock;
-	p_rcv->p_gen_req = p_req;
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-	return (status);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 void osm_ni_rcv_process(IN void *context, IN void *data)
 {
-	osm_ni_rcv_t *p_rcv = context;
+	osm_sm_t *sm = context;
 	osm_madw_t *p_madw = data;
 	ib_node_info_t *p_ni;
 	ib_smp_t *p_smp;
 	osm_node_t *p_node;
 	boolean_t process_new_flag = FALSE;
 
-	CL_ASSERT(p_rcv);
+	CL_ASSERT(sm);
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_ni_rcv_process);
+	OSM_LOG_ENTER(sm->p_log, osm_ni_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -905,18 +863,18 @@ void osm_ni_rcv_process(IN void *context, IN void *data)
 	CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_NODE_INFO);
 
 	if (p_ni->node_guid == 0) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"osm_ni_rcv_process: ERR 0D16: "
 			"Got Zero Node GUID! Found on the directed route:\n");
-		osm_dump_smp_dr_path(p_rcv->p_log, p_smp, OSM_LOG_ERROR);
+		osm_dump_smp_dr_path(sm->p_log, p_smp, OSM_LOG_ERROR);
 		goto Exit;
 	}
 
 	if (p_ni->port_guid == 0) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"osm_ni_rcv_process: ERR 0D17: "
 			"Got Zero Port GUID! Found on the directed route:\n");
-		osm_dump_smp_dr_path(p_rcv->p_log, p_smp, OSM_LOG_ERROR);
+		osm_dump_smp_dr_path(sm->p_log, p_smp, OSM_LOG_ERROR);
 		goto Exit;
 	}
 
@@ -926,27 +884,27 @@ void osm_ni_rcv_process(IN void *context, IN void *data)
 	   During processing of this node, hold the shared lock.
 	 */
 
-	CL_PLOCK_EXCL_ACQUIRE(p_rcv->p_lock);
-	p_node = osm_get_node_by_guid(p_rcv->p_subn, p_ni->node_guid);
+	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
+	p_node = osm_get_node_by_guid(sm->p_subn, p_ni->node_guid);
 
-	osm_dump_node_info(p_rcv->p_log, p_ni, OSM_LOG_DEBUG);
+	osm_dump_node_info(sm->p_log, p_ni, OSM_LOG_DEBUG);
 
 	if (!p_node) {
-		__osm_ni_rcv_process_new(p_rcv, p_madw);
+		__osm_ni_rcv_process_new(sm, p_madw);
 		process_new_flag = TRUE;
 	} else
-		__osm_ni_rcv_process_existing(p_rcv, p_node, p_madw);
+		__osm_ni_rcv_process_existing(sm, p_node, p_madw);
 
-	CL_PLOCK_RELEASE(p_rcv->p_lock);
+	CL_PLOCK_RELEASE(sm->p_lock);
 
 	/*
 	 * If we processed a new node - need to signal to the SM that
 	 * change detected.
 	 */
 	if (process_new_flag)
-		osm_sm_signal(&p_rcv->p_subn->p_osm->sm,
+		osm_sm_signal(&sm->p_subn->p_osm->sm,
 			      OSM_SIGNAL_CHANGE_DETECTED);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
diff --git a/opensm/opensm/osm_pkey_rcv.c b/opensm/opensm/osm_pkey_rcv.c
index d045fa2..c510ab5 100644
--- a/opensm/opensm/osm_pkey_rcv.c
+++ b/opensm/opensm/osm_pkey_rcv.c
@@ -39,61 +39,14 @@
 
 #include <string.h>
 #include <iba/ib_types.h>
-#include <complib/cl_qmap.h>
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
-#include <opensm/osm_pkey_rcv.h>
-#include <opensm/osm_node_info_rcv.h>
-#include <opensm/osm_req.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_subnet.h>
-#include <opensm/osm_mad_pool.h>
-#include <opensm/osm_msgdef.h>
 #include <opensm/osm_helper.h>
-#include <vendor/osm_vendor_api.h>
-
-/**********************************************************************
- **********************************************************************/
-void osm_pkey_rcv_construct(IN osm_pkey_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_pkey_rcv_destroy(IN osm_pkey_rcv_t * const p_rcv)
-{
-	CL_ASSERT(p_rcv);
-
-	OSM_LOG_ENTER(p_rcv->p_log, osm_pkey_rcv_destroy);
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_pkey_rcv_init(IN osm_pkey_rcv_t * const p_rcv,
-		  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)
-{
-	ib_api_status_t status = IB_SUCCESS;
-
-	OSM_LOG_ENTER(p_log, osm_pkey_rcv_init);
-
-	osm_pkey_rcv_construct(p_rcv);
-
-	p_rcv->p_log = p_log;
-	p_rcv->p_subn = p_subn;
-	p_rcv->p_lock = p_lock;
-	p_rcv->p_req = p_req;
-
-	OSM_LOG_EXIT(p_log);
-	return (status);
-}
+#include <opensm/osm_sm.h>
 
 /**********************************************************************
  **********************************************************************/
@@ -102,7 +55,7 @@ osm_pkey_rcv_init(IN osm_pkey_rcv_t * const p_rcv,
  */
 void osm_pkey_rcv_process(IN void *context, IN void *data)
 {
-	osm_pkey_rcv_t *p_rcv = context;
+	osm_sm_t *sm = context;
 	osm_madw_t *p_madw = data;
 	ib_pkey_table_t *p_pkey_tbl;
 	ib_smp_t *p_smp;
@@ -115,9 +68,9 @@ void osm_pkey_rcv_process(IN void *context, IN void *data)
 	uint8_t port_num;
 	uint16_t block_num;
 
-	CL_ASSERT(p_rcv);
+	CL_ASSERT(sm);
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_pkey_rcv_process);
+	OSM_LOG_ENTER(sm->p_log, osm_pkey_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -131,10 +84,10 @@ void osm_pkey_rcv_process(IN void *context, IN void *data)
 
 	CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_P_KEY_TABLE);
 
-	cl_plock_excl_acquire(p_rcv->p_lock);
-	p_port = osm_get_port_by_guid(p_rcv->p_subn, port_guid);
+	cl_plock_excl_acquire(sm->p_lock);
+	p_port = osm_get_port_by_guid(sm->p_subn, port_guid);
 	if (!p_port) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"osm_pkey_rcv_process: ERR 4806: "
 			"No port object for port with GUID 0x%" PRIx64
 			"\n\t\t\t\tfor parent node GUID 0x%" PRIx64
@@ -163,8 +116,8 @@ void osm_pkey_rcv_process(IN void *context, IN void *data)
 	   We do not mind if this is a result of a set or get - all we want is to
 	   update the subnet.
 	 */
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_VERBOSE)) {
-		osm_log(p_rcv->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_pkey_rcv_process: "
 			"Got GetResp(PKey) block:%u port_num %u with GUID 0x%"
 			PRIx64 " for parent node GUID 0x%" PRIx64 ", TID 0x%"
@@ -177,21 +130,21 @@ void osm_pkey_rcv_process(IN void *context, IN void *data)
 	   If so, ignore it.
 	 */
 	if (!osm_physp_is_valid(p_physp)) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"osm_pkey_rcv_process: ERR 4807: "
 			"Got invalid port number 0x%X\n", port_num);
 		goto Exit;
 	}
 
-	osm_dump_pkey_block(p_rcv->p_log,
+	osm_dump_pkey_block(sm->p_log,
 			    port_guid, block_num,
 			    port_num, p_pkey_tbl, OSM_LOG_DEBUG);
 
-	osm_physp_set_pkey_tbl(p_rcv->p_log, p_rcv->p_subn,
+	osm_physp_set_pkey_tbl(sm->p_log, sm->p_subn,
 			       p_physp, p_pkey_tbl, block_num);
 
       Exit:
-	cl_plock_release(p_rcv->p_lock);
+	cl_plock_release(sm->p_lock);
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
diff --git a/opensm/opensm/osm_port_info_rcv.c b/opensm/opensm/osm_port_info_rcv.c
index 1987e2c..3775665 100644
--- a/opensm/opensm/osm_port_info_rcv.c
+++ b/opensm/opensm/osm_port_info_rcv.c
@@ -54,8 +54,7 @@
 #include <complib/cl_qmap.h>
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
-#include <opensm/osm_port_info_rcv.h>
-#include <opensm/osm_node_info_rcv.h>
+#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_req.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
@@ -64,7 +63,6 @@
 #include <opensm/osm_mad_pool.h>
 #include <opensm/osm_msgdef.h>
 #include <opensm/osm_helper.h>
-#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_remote_sm.h>
 #include <opensm/osm_opensm.h>
@@ -72,16 +70,16 @@
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_pi_rcv_set_sm(IN const osm_pi_rcv_t * const p_rcv,
+__osm_pi_rcv_set_sm(IN osm_sm_t * sm,
 		    IN osm_physp_t * const p_physp)
 {
 	osm_bind_handle_t h_bind;
 	osm_dr_path_t *p_dr_path;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_pi_rcv_set_sm);
+	OSM_LOG_ENTER(sm->p_log, __osm_pi_rcv_set_sm);
 
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
-		osm_log(p_rcv->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_pi_rcv_set_sm: "
 			"Setting IS_SM bit in port attributes\n");
 
@@ -93,7 +91,7 @@ __osm_pi_rcv_set_sm(IN const osm_pi_rcv_t * const p_rcv,
 	 */
 	osm_vendor_set_sm(h_bind, TRUE);
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
@@ -114,7 +112,7 @@ static void pi_rcv_check_and_fix_lid(osm_log_t *log, ib_port_info_t * const pi,
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_pi_rcv_process_endport(IN const osm_pi_rcv_t * const p_rcv,
+__osm_pi_rcv_process_endport(IN osm_sm_t * sm,
 			     IN osm_physp_t * const p_physp,
 			     IN const ib_port_info_t * const p_pi)
 {
@@ -125,7 +123,7 @@ __osm_pi_rcv_process_endport(IN const osm_pi_rcv_t * const p_rcv,
 	cl_qmap_t *p_sm_tbl;
 	osm_remote_sm_t *p_sm;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_pi_rcv_process_endport);
+	OSM_LOG_ENTER(sm->p_log, __osm_pi_rcv_process_endport);
 
 	port_guid = osm_physp_get_port_guid(p_physp);
 
@@ -133,25 +131,25 @@ __osm_pi_rcv_process_endport(IN const osm_pi_rcv_t * const p_rcv,
 	if (osm_physp_get_port_num(p_physp) != 0) {
 		/* track the minimal endport MTU and rate */
 		mtu = ib_port_info_get_mtu_cap(p_pi);
-		if (mtu < p_rcv->p_subn->min_ca_mtu) {
-			osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		if (mtu < sm->p_subn->min_ca_mtu) {
+			osm_log(sm->p_log, OSM_LOG_VERBOSE,
 				"__osm_pi_rcv_process_endport: "
 				"Setting endport minimal MTU to:%u defined by port:0x%"
 				PRIx64 "\n", mtu, cl_ntoh64(port_guid));
-			p_rcv->p_subn->min_ca_mtu = mtu;
+			sm->p_subn->min_ca_mtu = mtu;
 		}
 
 		rate = ib_port_info_compute_rate(p_pi);
-		if (rate < p_rcv->p_subn->min_ca_rate) {
-			osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		if (rate < sm->p_subn->min_ca_rate) {
+			osm_log(sm->p_log, OSM_LOG_VERBOSE,
 				"__osm_pi_rcv_process_endport: "
 				"Setting endport minimal rate to:%u defined by port:0x%"
 				PRIx64 "\n", rate, cl_ntoh64(port_guid));
-			p_rcv->p_subn->min_ca_rate = rate;
+			sm->p_subn->min_ca_rate = rate;
 		}
 	}
 
-	if (port_guid == p_rcv->p_subn->sm_port_guid) {
+	if (port_guid == sm->p_subn->sm_port_guid) {
 		/*
 		   We received the PortInfo for our own port.
 		 */
@@ -159,28 +157,28 @@ __osm_pi_rcv_process_endport(IN const osm_pi_rcv_t * const p_rcv,
 			/*
 			   Set the IS_SM bit to indicate our port hosts an SM.
 			 */
-			__osm_pi_rcv_set_sm(p_rcv, p_physp);
+			__osm_pi_rcv_set_sm(sm, p_physp);
 	} else {
 		/*
 		   Before querying the SM - we want to make sure we clean its state, so
 		   if the querying fails we recognize that this SM is not active.
 		 */
-		p_sm_tbl = &p_rcv->p_subn->sm_guid_tbl;
+		p_sm_tbl = &sm->p_subn->sm_guid_tbl;
 		p_sm = (osm_remote_sm_t *) cl_qmap_get(p_sm_tbl, port_guid);
 		if (p_sm != (osm_remote_sm_t *) cl_qmap_end(p_sm_tbl))
 			/* clean it up */
 			p_sm->smi.pri_state = 0xF0 & p_sm->smi.pri_state;
 
 		if (p_pi->capability_mask & IB_PORT_CAP_IS_SM) {
-			if (p_rcv->p_subn->opt.ignore_other_sm)
-				osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			if (sm->p_subn->opt.ignore_other_sm)
+				osm_log(sm->p_log, OSM_LOG_VERBOSE,
 					"__osm_pi_rcv_process_endport: "
 					"Ignoring SM on port 0x%" PRIx64 "\n",
 					cl_ntoh64(port_guid));
 			else {
 				if (osm_log_is_active
-				    (p_rcv->p_log, OSM_LOG_VERBOSE))
-					osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+				    (sm->p_log, OSM_LOG_VERBOSE))
+					osm_log(sm->p_log, OSM_LOG_VERBOSE,
 						"__osm_pi_rcv_process_endport: "
 						"Detected another SM. Requesting SMInfo"
 						"\n\t\t\t\tPort 0x%" PRIx64
@@ -193,7 +191,7 @@ __osm_pi_rcv_process_endport(IN const osm_pi_rcv_t * const p_rcv,
 				memset(&context, 0, sizeof(context));
 				context.smi_context.set_method = FALSE;
 				context.smi_context.port_guid = port_guid;
-				status = osm_req_get(p_rcv->p_req,
+				status = osm_req_get(&sm->req,
 						     osm_physp_get_dr_path_ptr
 						     (p_physp),
 						     IB_MAD_ATTR_SM_INFO, 0,
@@ -201,7 +199,7 @@ __osm_pi_rcv_process_endport(IN const osm_pi_rcv_t * const p_rcv,
 						     &context);
 
 				if (status != IB_SUCCESS)
-					osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+					osm_log(sm->p_log, OSM_LOG_ERROR,
 						"__osm_pi_rcv_process_endport: ERR 0F05: "
 						"Failure requesting SMInfo (%s)\n",
 						ib_get_err_str(status));
@@ -209,14 +207,14 @@ __osm_pi_rcv_process_endport(IN const osm_pi_rcv_t * const p_rcv,
 		}
 	}
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
 static void
-__osm_pi_rcv_process_switch_port(IN const osm_pi_rcv_t * const p_rcv,
+__osm_pi_rcv_process_switch_port(IN osm_sm_t * sm,
 				 IN osm_node_t * const p_node,
 				 IN osm_physp_t * const p_physp,
 				 IN ib_port_info_t * const p_pi)
@@ -229,7 +227,7 @@ __osm_pi_rcv_process_switch_port(IN const osm_pi_rcv_t * const p_rcv,
 	uint8_t remote_port_num;
 	osm_dr_path_t path;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_pi_rcv_process_switch_port);
+	OSM_LOG_ENTER(sm->p_log, __osm_pi_rcv_process_switch_port);
 
 	/*
 	   Check the state of the physical port.
@@ -240,7 +238,7 @@ __osm_pi_rcv_process_switch_port(IN const osm_pi_rcv_t * const p_rcv,
 	/* if in_sweep_hop_0 is TRUE, then this means the SM is on the switch,
 	   and we got switchInfo of our local switch. Do not continue
 	   probing through the switch. */
-	if (port_num != 0 && p_rcv->p_subn->in_sweep_hop_0 == FALSE) {
+	if (port_num != 0 && sm->p_subn->in_sweep_hop_0 == FALSE) {
 		switch (ib_port_info_get_port_state(p_pi)) {
 		case IB_LINK_DOWN:
 			p_remote_physp = osm_physp_get_remote(p_physp);
@@ -251,7 +249,7 @@ __osm_pi_rcv_process_switch_port(IN const osm_pi_rcv_t * const p_rcv,
 				remote_port_num =
 				    osm_physp_get_port_num(p_remote_physp);
 
-				osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+				osm_log(sm->p_log, OSM_LOG_VERBOSE,
 					"__osm_pi_rcv_process_switch_port: "
 					"Unlinking local node 0x%" PRIx64
 					", port 0x%X"
@@ -297,7 +295,7 @@ __osm_pi_rcv_process_switch_port(IN const osm_pi_rcv_t * const p_rcv,
 				context.ni_context.port_num =
 				    osm_physp_get_port_num(p_physp);
 
-				status = osm_req_get(p_rcv->p_req,
+				status = osm_req_get(&sm->req,
 						     &path,
 						     IB_MAD_ATTR_NODE_INFO,
 						     0,
@@ -305,20 +303,20 @@ __osm_pi_rcv_process_switch_port(IN const osm_pi_rcv_t * const p_rcv,
 						     &context);
 
 				if (status != IB_SUCCESS)
-					osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+					osm_log(sm->p_log, OSM_LOG_ERROR,
 						"__osm_pi_rcv_process_switch_port: ERR 0F02: "
 						"Failure initiating NodeInfo request (%s)\n",
 						ib_get_err_str(status));
 			} else
-			    if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
-				osm_log(p_rcv->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_pi_rcv_process_switch_port: "
 					"Skipping SMP responder port 0x%X\n",
 					p_pi->local_port_num);
 			break;
 
 		default:
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"__osm_pi_rcv_process_switch_port: ERR 0F03: "
 				"Unknown link state = %u, port = 0x%X\n",
 				ib_port_info_get_port_state(p_pi),
@@ -331,7 +329,7 @@ __osm_pi_rcv_process_switch_port(IN const osm_pi_rcv_t * const p_rcv,
 		p_node->sw->need_update = 0;
 
 	if (port_num == 0)
-		pi_rcv_check_and_fix_lid(p_rcv->p_log, p_pi, p_physp);
+		pi_rcv_check_and_fix_lid(sm->p_log, p_pi, p_physp);
 
 	/*
 	   Update the PortInfo attribute.
@@ -344,31 +342,31 @@ __osm_pi_rcv_process_switch_port(IN const osm_pi_rcv_t * const p_rcv,
 		    !ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info))
 			/* PortState is not used on BSP0 but just in case it is DOWN */
 			p_physp->port_info = *p_pi;
-		__osm_pi_rcv_process_endport(p_rcv, p_physp, p_pi);
+		__osm_pi_rcv_process_endport(sm, p_physp, p_pi);
 	}
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_pi_rcv_process_ca_or_router_port(IN const osm_pi_rcv_t * const p_rcv,
+__osm_pi_rcv_process_ca_or_router_port(IN osm_sm_t * sm,
 				       IN osm_node_t * const p_node,
 				       IN osm_physp_t * const p_physp,
 				       IN ib_port_info_t * const p_pi)
 {
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_pi_rcv_process_ca_or_router_port);
+	OSM_LOG_ENTER(sm->p_log, __osm_pi_rcv_process_ca_or_router_port);
 
 	UNUSED_PARAM(p_node);
 
-	pi_rcv_check_and_fix_lid(p_rcv->p_log, p_pi, p_physp);
+	pi_rcv_check_and_fix_lid(sm->p_log, p_pi, p_physp);
 
 	osm_physp_set_port_info(p_physp, p_pi);
 
-	__osm_pi_rcv_process_endport(p_rcv, p_physp, p_pi);
+	__osm_pi_rcv_process_endport(sm, p_physp, p_pi);
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 #define IBM_VENDOR_ID  (0x5076)
@@ -450,62 +448,21 @@ static void get_pkey_table(IN osm_log_t * p_log,
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_pi_rcv_get_pkey_slvl_vla_tables(IN const osm_pi_rcv_t * const p_rcv,
+__osm_pi_rcv_get_pkey_slvl_vla_tables(IN osm_sm_t * sm,
 				      IN osm_node_t * const p_node,
 				      IN osm_physp_t * const p_physp)
 {
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_pi_rcv_get_pkey_slvl_vla_tables);
-
-	get_pkey_table(p_rcv->p_log, p_rcv->p_req, p_rcv->p_subn,
-		       p_node, p_physp);
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_pi_rcv_construct(IN osm_pi_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_pi_rcv_destroy(IN osm_pi_rcv_t * const p_rcv)
-{
-	OSM_LOG_ENTER(p_rcv->p_log, osm_pi_rcv_destroy);
-
-	CL_ASSERT(p_rcv);
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_pi_rcv_init(IN osm_pi_rcv_t * const p_rcv,
-		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)
-{
-	ib_api_status_t status = IB_SUCCESS;
-	OSM_LOG_ENTER(p_log, osm_pi_rcv_init);
+	OSM_LOG_ENTER(sm->p_log, __osm_pi_rcv_get_pkey_slvl_vla_tables);
 
-	osm_pi_rcv_construct(p_rcv);
+	get_pkey_table(sm->p_log, &sm->req, sm->p_subn, p_node, p_physp);
 
-	p_rcv->p_log = p_log;
-	p_rcv->p_subn = p_subn;
-	p_rcv->p_lock = p_lock;
-	p_rcv->p_req = p_req;
-
-	OSM_LOG_EXIT(p_log);
-	return (status);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
-void
-osm_pi_rcv_process_set(IN const osm_pi_rcv_t * const p_rcv,
-		       IN osm_node_t * const p_node,
+static void
+osm_pi_rcv_process_set(IN osm_sm_t * sm, IN osm_node_t * const p_node,
 		       IN const uint8_t port_num, IN osm_madw_t * const p_madw)
 {
 	osm_physp_t *p_physp;
@@ -515,7 +472,7 @@ osm_pi_rcv_process_set(IN const osm_pi_rcv_t * const p_rcv,
 	osm_pi_context_t *p_context;
 	osm_log_level_t level;
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_pi_rcv_process_set);
+	OSM_LOG_ENTER(sm->p_log, osm_pi_rcv_process_set);
 
 	p_context = osm_madw_get_pi_context_ptr(p_madw);
 
@@ -535,24 +492,24 @@ osm_pi_rcv_process_set(IN const osm_pi_rcv_t * const p_rcv,
 		if (p_context->active_transition &&
 		    (cl_ntoh16(p_smp->status) & 0x7fff) == 0x1c) {
 			level = OSM_LOG_INFO;
-			osm_log(p_rcv->p_log, OSM_LOG_INFO,
+			osm_log(sm->p_log, OSM_LOG_INFO,
 				"osm_pi_rcv_process_set: "
 				"Received error status 0x%x for SetResp() during ACTIVE transition\n",
 				cl_ntoh16(p_smp->status) & 0x7fff);
 			/* Should there be a subsequent Get to validate that port is ACTIVE ? */
 		} else {
 			level = OSM_LOG_ERROR;
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"osm_pi_rcv_process_set: ERR 0F10: "
 				"Received error status for SetResp()\n");
 		}
-		osm_dump_port_info(p_rcv->p_log,
+		osm_dump_port_info(sm->p_log,
 				   osm_node_get_node_guid(p_node),
 				   port_guid, port_num, p_pi, level);
 	}
 
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
-		osm_log(p_rcv->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_pi_rcv_process_set: "
 			"Received logical SetResp() for GUID 0x%" PRIx64
 			", port num 0x%X"
@@ -565,14 +522,14 @@ osm_pi_rcv_process_set(IN const osm_pi_rcv_t * const p_rcv,
 
 	osm_physp_set_port_info(p_physp, p_pi);
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 void osm_pi_rcv_process(IN void *context, IN void *data)
 {
-	osm_pi_rcv_t *p_rcv = context;
+	osm_sm_t *sm = context;
 	osm_madw_t *p_madw = data;
 	ib_port_info_t *p_pi;
 	ib_smp_t *p_smp;
@@ -585,9 +542,9 @@ void osm_pi_rcv_process(IN void *context, IN void *data)
 	ib_net64_t node_guid;
 	uint8_t port_num;
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_pi_rcv_process);
+	OSM_LOG_ENTER(sm->p_log, osm_pi_rcv_process);
 
-	CL_ASSERT(p_rcv);
+	CL_ASSERT(sm);
 	CL_ASSERT(p_madw);
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
@@ -601,13 +558,13 @@ void osm_pi_rcv_process(IN void *context, IN void *data)
 	port_guid = p_context->port_guid;
 	node_guid = p_context->node_guid;
 
-	osm_dump_port_info(p_rcv->p_log,
+	osm_dump_port_info(sm->p_log,
 			   node_guid, port_guid, port_num, p_pi, OSM_LOG_DEBUG);
 
 	/* On receipt of client reregister, clear the reregister bit so
 	   reregistering won't be sent again and again */
 	if (ib_port_info_get_client_rereg(p_pi)) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sm->p_log, OSM_LOG_DEBUG,
 			"osm_pi_rcv_process: "
 			"Client reregister received on response\n");
 		ib_port_info_set_client_rereg(p_pi, 0);
@@ -620,22 +577,22 @@ void osm_pi_rcv_process(IN void *context, IN void *data)
 	   do anything with the response - just flag that we need a heavy sweep
 	 */
 	if (p_context->light_sweep == TRUE) {
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sm->p_log, OSM_LOG_VERBOSE,
 			"osm_pi_rcv_process: "
 			"Got light sweep response from remote port of parent node "
 			"GUID 0x%" PRIx64 " port 0x%016" PRIx64
 			", Commencing heavy sweep\n",
 			cl_ntoh64(node_guid), cl_ntoh64(port_guid));
-		osm_sm_signal(&p_rcv->p_subn->p_osm->sm,
+		osm_sm_signal(&sm->p_subn->p_osm->sm,
 			      OSM_SIGNAL_CHANGE_DETECTED);
 		goto Exit;
 	}
 
-	CL_PLOCK_EXCL_ACQUIRE(p_rcv->p_lock);
-	p_port = osm_get_port_by_guid(p_rcv->p_subn, port_guid);
+	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
+	p_port = osm_get_port_by_guid(sm->p_subn, port_guid);
 	if (!p_port) {
-		CL_PLOCK_RELEASE(p_rcv->p_lock);
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		CL_PLOCK_RELEASE(sm->p_lock);
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"osm_pi_rcv_process: ERR 0F06: "
 			"No port object for port with GUID 0x%" PRIx64
 			"\n\t\t\t\tfor parent node GUID 0x%" PRIx64
@@ -660,7 +617,7 @@ void osm_pi_rcv_process(IN void *context, IN void *data)
 	   boolean around to determine if we were doing Get() or Set().
 	 */
 	if (p_context->set_method)
-		osm_pi_rcv_process_set(p_rcv, p_node, port_num, p_madw);
+		osm_pi_rcv_process_set(sm, p_node, port_num, p_madw);
 	else {
 		p_port->discovery_count++;
 
@@ -668,8 +625,8 @@ void osm_pi_rcv_process(IN void *context, IN void *data)
 		   This PortInfo arrived because we did a Get() method,
 		   most likely due to a subnet sweep in progress.
 		 */
-		if (osm_log_is_active(p_rcv->p_log, OSM_LOG_VERBOSE))
-			osm_log(p_rcv->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_pi_rcv_process: "
 				"Discovered port num 0x%X with GUID 0x%" PRIx64
 				" for parent node GUID 0x%" PRIx64
@@ -687,8 +644,8 @@ void osm_pi_rcv_process(IN void *context, IN void *data)
 		   continue processing as normal.
 		 */
 		if (!osm_physp_is_valid(p_physp)) {
-			if (osm_log_is_active(p_rcv->p_log, OSM_LOG_VERBOSE))
-				osm_log(p_rcv->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_pi_rcv_process: "
 					"Initializing port number 0x%X\n",
 					port_num);
@@ -718,13 +675,13 @@ void osm_pi_rcv_process(IN void *context, IN void *data)
 		   in the subnet.
 		 */
 		if (p_context->update_master_sm_base_lid == TRUE) {
-			osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			osm_log(sm->p_log, OSM_LOG_VERBOSE,
 				"osm_pi_rcv_process: "
 				"update_master_sm is TRUE. "
 				"Updating master_sm_base_lid to:%u\n",
 				p_pi->master_sm_base_lid);
 
-			p_rcv->p_subn->master_sm_base_lid =
+			sm->p_subn->master_sm_base_lid =
 			    p_pi->master_sm_base_lid;
 		}
 
@@ -737,16 +694,16 @@ void osm_pi_rcv_process(IN void *context, IN void *data)
 		switch (osm_node_get_type(p_node)) {
 		case IB_NODE_TYPE_CA:
 		case IB_NODE_TYPE_ROUTER:
-			__osm_pi_rcv_process_ca_or_router_port(p_rcv,
+			__osm_pi_rcv_process_ca_or_router_port(sm,
 							       p_node, p_physp,
 							       p_pi);
 			break;
 		case IB_NODE_TYPE_SWITCH:
-			__osm_pi_rcv_process_switch_port(p_rcv,
+			__osm_pi_rcv_process_switch_port(sm,
 							 p_node, p_physp, p_pi);
 			break;
 		default:
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"osm_pi_rcv_process: ERR 0F07: "
 				"Unknown node type %u with GUID 0x%" PRIx64
 				"\n", osm_node_get_type(p_node),
@@ -757,17 +714,17 @@ void osm_pi_rcv_process(IN void *context, IN void *data)
 		/*
 		   Get the tables on the physp.
 		 */
-		if (p_physp->need_update || p_rcv->p_subn->need_update)
-			__osm_pi_rcv_get_pkey_slvl_vla_tables(p_rcv, p_node,
+		if (p_physp->need_update || sm->p_subn->need_update)
+			__osm_pi_rcv_get_pkey_slvl_vla_tables(sm, p_node,
 							      p_physp);
 
 	}
 
-	CL_PLOCK_RELEASE(p_rcv->p_lock);
+	CL_PLOCK_RELEASE(sm->p_lock);
 
       Exit:
 	/*
 	   Release the lock before jumping here!!
 	 */
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
diff --git a/opensm/opensm/osm_slvl_map_rcv.c b/opensm/opensm/osm_slvl_map_rcv.c
index e3942fb..3f9c88a 100644
--- a/opensm/opensm/osm_slvl_map_rcv.c
+++ b/opensm/opensm/osm_slvl_map_rcv.c
@@ -51,61 +51,14 @@
 
 #include <string.h>
 #include <iba/ib_types.h>
-#include <complib/cl_qmap.h>
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
-#include <opensm/osm_slvl_map_rcv.h>
-#include <opensm/osm_node_info_rcv.h>
-#include <opensm/osm_req.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_subnet.h>
-#include <opensm/osm_mad_pool.h>
-#include <opensm/osm_msgdef.h>
 #include <opensm/osm_helper.h>
-#include <vendor/osm_vendor_api.h>
-
-/**********************************************************************
- **********************************************************************/
-void osm_slvl_rcv_construct(IN osm_slvl_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_slvl_rcv_destroy(IN osm_slvl_rcv_t * const p_rcv)
-{
-	CL_ASSERT(p_rcv);
-
-	OSM_LOG_ENTER(p_rcv->p_log, osm_slvl_rcv_destroy);
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_slvl_rcv_init(IN osm_slvl_rcv_t * const p_rcv,
-		  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)
-{
-	ib_api_status_t status = IB_SUCCESS;
-
-	OSM_LOG_ENTER(p_log, osm_slvl_rcv_init);
-
-	osm_slvl_rcv_construct(p_rcv);
-
-	p_rcv->p_log = p_log;
-	p_rcv->p_subn = p_subn;
-	p_rcv->p_lock = p_lock;
-	p_rcv->p_req = p_req;
-
-	OSM_LOG_EXIT(p_log);
-	return (status);
-}
+#include <opensm/osm_sm.h>
 
 /**********************************************************************
  **********************************************************************/
@@ -114,7 +67,7 @@ osm_slvl_rcv_init(IN osm_slvl_rcv_t * const p_rcv,
  */
 void osm_slvl_rcv_process(IN void *context, IN void *p_data)
 {
-	osm_slvl_rcv_t *p_rcv = context;
+	osm_sm_t *sm = context;
 	osm_madw_t *p_madw = p_data;
 	ib_slvl_table_t *p_slvl_tbl;
 	ib_smp_t *p_smp;
@@ -126,9 +79,9 @@ void osm_slvl_rcv_process(IN void *context, IN void *p_data)
 	ib_net64_t node_guid;
 	uint8_t out_port_num, in_port_num;
 
-	CL_ASSERT(p_rcv);
+	CL_ASSERT(sm);
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_slvl_rcv_process);
+	OSM_LOG_ENTER(sm->p_log, osm_slvl_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -141,12 +94,12 @@ void osm_slvl_rcv_process(IN void *context, IN void *p_data)
 
 	CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_SLVL_TABLE);
 
-	cl_plock_excl_acquire(p_rcv->p_lock);
-	p_port = osm_get_port_by_guid(p_rcv->p_subn, port_guid);
+	cl_plock_excl_acquire(sm->p_lock);
+	p_port = osm_get_port_by_guid(sm->p_subn, port_guid);
 
 	if (!p_port) {
-		cl_plock_release(p_rcv->p_lock);
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		cl_plock_release(sm->p_lock);
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"osm_slvl_rcv_process: ERR 2C06: "
 			"No port object for port with GUID 0x%" PRIx64
 			"\n\t\t\t\tfor parent node GUID 0x%" PRIx64
@@ -178,8 +131,8 @@ void osm_slvl_rcv_process(IN void *context, IN void *p_data)
 	   We do not mind if this is a result of a set or get - all we want is to update
 	   the subnet.
 	 */
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_VERBOSE)) {
-		osm_log(p_rcv->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_slvl_rcv_process: "
 			"Got SLtoVL get response in_port_num %u out_port_num %u with GUID 0x%"
 			PRIx64 " for parent node GUID 0x%" PRIx64 ", TID 0x%"
@@ -193,20 +146,20 @@ void osm_slvl_rcv_process(IN void *context, IN void *p_data)
 	   If so, Ignore it.
 	 */
 	if (!osm_physp_is_valid(p_physp)) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"osm_slvl_rcv_process: "
 			"Got invalid port number 0x%X\n", out_port_num);
 		goto Exit;
 	}
 
-	osm_dump_slvl_map_table(p_rcv->p_log,
+	osm_dump_slvl_map_table(sm->p_log,
 				port_guid, in_port_num,
 				out_port_num, p_slvl_tbl, OSM_LOG_DEBUG);
 
 	osm_physp_set_slvl_tbl(p_physp, p_slvl_tbl, in_port_num);
 
       Exit:
-	cl_plock_release(p_rcv->p_lock);
+	cl_plock_release(sm->p_lock);
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
diff --git a/opensm/opensm/osm_sm.c b/opensm/opensm/osm_sm.c
index b295a77..b60a615 100644
--- a/opensm/opensm/osm_sm.c
+++ b/opensm/opensm/osm_sm.c
@@ -68,6 +68,18 @@
 
 #define  OSM_SM_INITIAL_TID_VALUE 0x1233
 
+extern void osm_lft_rcv_process(IN void *context, IN void *data);
+extern void osm_mft_rcv_process(IN void *context, IN void *data);
+extern void osm_nd_rcv_process(IN void *context, IN void *data);
+extern void osm_ni_rcv_process(IN void *context, IN void *data);
+extern void osm_pkey_rcv_process(IN void *context, IN void *data);
+extern void osm_pi_rcv_process(IN void *context, IN void *data);
+extern void osm_slvl_rcv_process(IN void *context, IN void *p_data);
+extern void osm_sminfo_rcv_process(IN void *context, IN void *data);
+extern void osm_si_rcv_process(IN void *context, IN void *data);
+extern void osm_trap_rcv_process(IN void *context, IN void *data);
+extern void osm_vla_rcv_process(IN void *context, IN void *data);
+
 /**********************************************************************
  **********************************************************************/
 static void osm_sm_process(osm_sm_t * sm, osm_signal_t signal)
@@ -143,29 +155,19 @@ void osm_sm_construct(IN osm_sm_t * const p_sm)
 	cl_spinlock_construct(&p_sm->signal_lock);
 	cl_event_construct(&p_sm->signal_event);
 	cl_event_construct(&p_sm->subnet_up_event);
+	cl_event_wheel_construct(&p_sm->trap_aging_tracker);
 	cl_thread_construct(&p_sm->sweeper);
 	cl_spinlock_construct(&p_sm->mgrp_lock);
 	osm_req_construct(&p_sm->req);
 	osm_resp_construct(&p_sm->resp);
-	osm_ni_rcv_construct(&p_sm->ni_rcv);
-	osm_pi_rcv_construct(&p_sm->pi_rcv);
-	osm_nd_rcv_construct(&p_sm->nd_rcv);
 	osm_sm_mad_ctrl_construct(&p_sm->mad_ctrl);
-	osm_si_rcv_construct(&p_sm->si_rcv);
 	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_state_mgr_construct(&p_sm->state_mgr);
 	osm_drop_mgr_construct(&p_sm->drop_mgr);
-	osm_lft_rcv_construct(&p_sm->lft_rcv);
-	osm_mft_rcv_construct(&p_sm->mft_rcv);
 	osm_sweep_fail_ctrl_construct(&p_sm->sweep_fail_ctrl);
-	osm_sminfo_rcv_construct(&p_sm->sm_info_rcv);
-	osm_trap_rcv_construct(&p_sm->trap_rcv);
 	osm_sm_state_mgr_construct(&p_sm->sm_state_mgr);
-	osm_slvl_rcv_construct(&p_sm->slvl_rcv);
-	osm_vla_rcv_construct(&p_sm->vla_rcv);
-	osm_pkey_rcv_construct(&p_sm->pkey_rcv);
 	osm_mcast_mgr_construct(&p_sm->mcast_mgr);
 }
 
@@ -222,26 +224,16 @@ void osm_sm_shutdown(IN osm_sm_t * const p_sm)
 void osm_sm_destroy(IN osm_sm_t * const p_sm)
 {
 	OSM_LOG_ENTER(p_sm->p_log, osm_sm_destroy);
-	osm_trap_rcv_destroy(&p_sm->trap_rcv);
-	osm_sminfo_rcv_destroy(&p_sm->sm_info_rcv);
 	osm_req_destroy(&p_sm->req);
 	osm_resp_destroy(&p_sm->resp);
-	osm_ni_rcv_destroy(&p_sm->ni_rcv);
-	osm_pi_rcv_destroy(&p_sm->pi_rcv);
-	osm_si_rcv_destroy(&p_sm->si_rcv);
-	osm_nd_rcv_destroy(&p_sm->nd_rcv);
 	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_lft_rcv_destroy(&p_sm->lft_rcv);
-	osm_mft_rcv_destroy(&p_sm->mft_rcv);
-	osm_slvl_rcv_destroy(&p_sm->slvl_rcv);
-	osm_vla_rcv_destroy(&p_sm->vla_rcv);
-	osm_pkey_rcv_destroy(&p_sm->pkey_rcv);
 	osm_state_mgr_destroy(&p_sm->state_mgr);
 	osm_sm_state_mgr_destroy(&p_sm->sm_state_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_event_destroy(&p_sm->signal_event);
 	cl_event_destroy(&p_sm->subnet_up_event);
@@ -319,24 +311,7 @@ osm_sm_init(IN osm_sm_t * const p_sm,
 	if (status != IB_SUCCESS)
 		goto Exit;
 
-	status = osm_ni_rcv_init(&p_sm->ni_rcv,
-				 &p_sm->req, p_subn, p_log, p_lock);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-	status = osm_pi_rcv_init(&p_sm->pi_rcv,
-				 &p_sm->req, p_subn, p_log, p_lock);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-	status = osm_si_rcv_init(&p_sm->si_rcv,
-				 p_sm->p_subn,
-				 p_sm->p_log, &p_sm->req, p_sm->p_lock);
-
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-	status = osm_nd_rcv_init(&p_sm->nd_rcv, p_subn, p_log, p_lock);
+	status = cl_event_wheel_init(&p_sm->trap_aging_tracker);
 	if (status != IB_SUCCESS)
 		goto Exit;
 
@@ -381,32 +356,11 @@ osm_sm_init(IN osm_sm_t * const p_sm,
 	if (status != IB_SUCCESS)
 		goto Exit;
 
-	status = osm_lft_rcv_init(&p_sm->lft_rcv, p_subn, p_log, p_lock);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-	status = osm_mft_rcv_init(&p_sm->mft_rcv, p_subn, p_log, p_lock);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
 	status = osm_sweep_fail_ctrl_init(&p_sm->sweep_fail_ctrl,
 					  p_log, p_sm, p_disp);
 	if (status != IB_SUCCESS)
 		goto Exit;
 
-	status = osm_sminfo_rcv_init(&p_sm->sm_info_rcv,
-				     p_subn,
-				     p_stats,
-				     &p_sm->resp,
-				     p_log, &p_sm->sm_state_mgr, p_lock);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-	status = osm_trap_rcv_init(&p_sm->trap_rcv,
-				   p_subn, p_stats, &p_sm->resp, p_log, p_lock);
-	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);
 	if (status != IB_SUCCESS)
@@ -417,80 +371,58 @@ osm_sm_init(IN osm_sm_t * const p_sm,
 	if (status != IB_SUCCESS)
 		goto Exit;
 
-	status = osm_slvl_rcv_init(&p_sm->slvl_rcv,
-				   &p_sm->req, p_subn, p_log, p_lock);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-	status = osm_vla_rcv_init(&p_sm->vla_rcv,
-				  &p_sm->req, p_subn, p_log, p_lock);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-	status = osm_pkey_rcv_init(&p_sm->pkey_rcv,
-				   &p_sm->req, p_subn, p_log, p_lock);
-	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->ni_rcv);
+					   osm_ni_rcv_process, p_sm);
 	if (p_sm->ni_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sm->pi_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_PORT_INFO,
-					   osm_pi_rcv_process, &p_sm->pi_rcv);
+					   osm_pi_rcv_process, p_sm);
 	if (p_sm->pi_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sm->si_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_SWITCH_INFO,
-					   osm_si_rcv_process, &p_sm->si_rcv);
+					   osm_si_rcv_process, p_sm);
 	if (p_sm->si_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sm->nd_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_NODE_DESC,
-					   osm_nd_rcv_process, &p_sm->nd_rcv);
+					   osm_nd_rcv_process, p_sm);
 	if (p_sm->nd_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sm->lft_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_LFT,
-					    osm_lft_rcv_process,
-					    &p_sm->lft_rcv);
+					    osm_lft_rcv_process, p_sm);
 	if (p_sm->lft_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sm->mft_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_MFT,
-					    osm_mft_rcv_process,
-					    &p_sm->mft_rcv);
+					    osm_mft_rcv_process, p_sm);
 	if (p_sm->mft_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sm->sm_info_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_SM_INFO,
-						osm_sminfo_rcv_process,
-						&p_sm->sm_info_rcv);
+						osm_sminfo_rcv_process, p_sm);
 	if (p_sm->sm_info_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sm->trap_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_NOTICE,
-					     osm_trap_rcv_process,
-					     &p_sm->trap_rcv);
+					     osm_trap_rcv_process, p_sm);
 	if (p_sm->trap_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sm->slvl_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_SLVL,
-					     osm_slvl_rcv_process,
-					     &p_sm->slvl_rcv);
+					     osm_slvl_rcv_process, p_sm);
 	if (p_sm->slvl_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sm->vla_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_VL_ARB,
-					    osm_vla_rcv_process,
-					    &p_sm->vla_rcv);
+					    osm_vla_rcv_process, p_sm);
 	if (p_sm->vla_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sm->pkey_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_PKEY,
-					     osm_pkey_rcv_process,
-					     &p_sm->pkey_rcv);
+					     osm_pkey_rcv_process, p_sm);
 	if (p_sm->pkey_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
diff --git a/opensm/opensm/osm_sminfo_rcv.c b/opensm/opensm/osm_sminfo_rcv.c
index 2367941..b150edd 100644
--- a/opensm/opensm/osm_sminfo_rcv.c
+++ b/opensm/opensm/osm_sminfo_rcv.c
@@ -55,7 +55,6 @@
 #include <complib/cl_qmap.h>
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
-#include <opensm/osm_sminfo_rcv.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_node.h>
@@ -65,73 +64,27 @@
 #include <opensm/osm_opensm.h>
 
 /**********************************************************************
- **********************************************************************/
-void osm_sminfo_rcv_construct(IN osm_sminfo_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_sminfo_rcv_destroy(IN osm_sminfo_rcv_t * const p_rcv)
-{
-	CL_ASSERT(p_rcv);
-
-	OSM_LOG_ENTER(p_rcv->p_log, osm_sminfo_rcv_destroy);
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_sminfo_rcv_init(IN osm_sminfo_rcv_t * const p_rcv,
-		    IN osm_subn_t * const p_subn,
-		    IN osm_stats_t * const p_stats,
-		    IN osm_resp_t * const p_resp,
-		    IN osm_log_t * const p_log,
-		    IN osm_sm_state_mgr_t * const p_sm_state_mgr,
-		    IN cl_plock_t * const p_lock)
-{
-	ib_api_status_t status = IB_SUCCESS;
-
-	OSM_LOG_ENTER(p_log, osm_sminfo_rcv_init);
-
-	osm_sminfo_rcv_construct(p_rcv);
-
-	p_rcv->p_log = p_log;
-	p_rcv->p_subn = p_subn;
-	p_rcv->p_lock = p_lock;
-	p_rcv->p_stats = p_stats;
-	p_rcv->p_resp = p_resp;
-	p_rcv->p_sm_state_mgr = p_sm_state_mgr;
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-	return (status);
-}
-
-/**********************************************************************
  Return TRUE if the remote sm given (by ib_sm_info_t) is higher,
  return FALSE otherwise.
  By higher - we mean: SM with higher priority or with same priority
  and lower GUID.
 **********************************************************************/
 static inline boolean_t
-__osm_sminfo_rcv_remote_sm_is_higher(IN const osm_sminfo_rcv_t * p_rcv,
+__osm_sminfo_rcv_remote_sm_is_higher(IN osm_sm_t * sm,
 				     IN const ib_sm_info_t * p_remote_sm)
 {
 
 	return (osm_sm_is_greater_than(ib_sminfo_get_priority(p_remote_sm),
 				       p_remote_sm->guid,
-				       p_rcv->p_subn->opt.sm_priority,
-				       p_rcv->p_subn->sm_port_guid));
+				       sm->p_subn->opt.sm_priority,
+				       sm->p_subn->sm_port_guid));
 
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sminfo_rcv_process_get_request(IN const osm_sminfo_rcv_t * const p_rcv,
+__osm_sminfo_rcv_process_get_request(IN osm_sm_t * sm,
 				     IN const osm_madw_t * const p_madw)
 {
 	uint8_t payload[IB_SMP_DATA_SIZE];
@@ -140,7 +93,7 @@ __osm_sminfo_rcv_process_get_request(IN const osm_sminfo_rcv_t * const p_rcv,
 	ib_api_status_t status;
 	ib_sm_info_t *p_remote_smi;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_sminfo_rcv_process_get_request);
+	OSM_LOG_ENTER(sm->p_log, __osm_sminfo_rcv_process_get_request);
 
 	CL_ASSERT(p_madw);
 
@@ -153,31 +106,31 @@ __osm_sminfo_rcv_process_get_request(IN const osm_sminfo_rcv_t * const p_rcv,
 
 	CL_ASSERT(p_smp->method == IB_MAD_METHOD_GET);
 
-	p_smi->guid = p_rcv->p_subn->sm_port_guid;
-	p_smi->act_count = cl_hton32(p_rcv->p_stats->qp0_mads_sent);
-	p_smi->pri_state = (uint8_t) (p_rcv->p_subn->sm_state |
-				      p_rcv->p_subn->opt.sm_priority << 4);
+	p_smi->guid = sm->p_subn->sm_port_guid;
+	p_smi->act_count = cl_hton32(sm->p_subn->p_osm->stats.qp0_mads_sent);
+	p_smi->pri_state = (uint8_t) (sm->p_subn->sm_state |
+				      sm->p_subn->opt.sm_priority << 4);
 	/*
 	   p.840 line 20 - Return 0 for the SM key unless we authenticate the
 	   requester as the master SM.
 	 */
 	p_remote_smi = ib_smp_get_payload_ptr(osm_madw_get_smp_ptr(p_madw));
 	if (ib_sminfo_get_state(p_remote_smi) == IB_SMINFO_STATE_MASTER) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sm->p_log, OSM_LOG_DEBUG,
 			"__osm_sminfo_rcv_process_get_request: "
 			"Responding to master SM with real sm_key\n");
-		p_smi->sm_key = p_rcv->p_subn->opt.sm_key;
+		p_smi->sm_key = sm->p_subn->opt.sm_key;
 	} else {
 		/* The requester is not authenticated as master - set sm_key to zero. */
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sm->p_log, OSM_LOG_DEBUG,
 			"__osm_sminfo_rcv_process_get_request: "
 			"Responding to SM not master with zero sm_key\n");
 		p_smi->sm_key = 0;
 	}
 
-	status = osm_resp_send(p_rcv->p_resp, p_madw, 0, payload);
+	status = osm_resp_send(&sm->resp, p_madw, 0, payload);
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_sminfo_rcv_process_get_request: ERR 2F02: "
 			"Error sending response (%s)\n",
 			ib_get_err_str(status));
@@ -185,7 +138,7 @@ __osm_sminfo_rcv_process_get_request(IN const osm_sminfo_rcv_t * const p_rcv,
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
@@ -222,18 +175,18 @@ __osm_sminfo_rcv_check_set_req_legality(IN const ib_smp_t * const p_smp)
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sminfo_rcv_process_set_request(IN const osm_sminfo_rcv_t * const p_rcv,
+__osm_sminfo_rcv_process_set_request(IN osm_sm_t * sm,
 				     IN const osm_madw_t * const p_madw)
 {
 	uint8_t payload[IB_SMP_DATA_SIZE];
 	ib_smp_t *p_smp;
 	ib_sm_info_t *p_smi = (ib_sm_info_t *) payload;
-	ib_sm_info_t *p_rcv_smi;
+	ib_sm_info_t *sm_smi;
 	ib_api_status_t status;
 	osm_sm_signal_t sm_signal;
 	ib_sm_info_t *p_remote_smi;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_sminfo_rcv_process_set_request);
+	OSM_LOG_ENTER(sm->p_log, __osm_sminfo_rcv_process_set_request);
 
 	CL_ASSERT(p_madw);
 
@@ -243,36 +196,36 @@ __osm_sminfo_rcv_process_set_request(IN const osm_sminfo_rcv_t * const p_rcv,
 	memset(payload, 0, sizeof(payload));
 
 	/* get the lock */
-	CL_PLOCK_EXCL_ACQUIRE(p_rcv->p_lock);
+	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
-	p_rcv_smi = ib_smp_get_payload_ptr(p_smp);
+	sm_smi = ib_smp_get_payload_ptr(p_smp);
 
 	if (p_smp->method != IB_MAD_METHOD_SET) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_sminfo_rcv_process_set_request: ERR 2F03: "
 			"Unsupported method 0x%X\n", p_smp->method);
-		CL_PLOCK_RELEASE(p_rcv->p_lock);
+		CL_PLOCK_RELEASE(sm->p_lock);
 		goto Exit;
 	}
 
-	p_smi->guid = p_rcv->p_subn->sm_port_guid;
-	p_smi->act_count = cl_hton32(p_rcv->p_stats->qp0_mads_sent);
-	p_smi->pri_state = (uint8_t) (p_rcv->p_subn->sm_state |
-				      p_rcv->p_subn->opt.sm_priority << 4);
+	p_smi->guid = sm->p_subn->sm_port_guid;
+	p_smi->act_count = cl_hton32(sm->p_subn->p_osm->stats.qp0_mads_sent);
+	p_smi->pri_state = (uint8_t) (sm->p_subn->sm_state |
+				      sm->p_subn->opt.sm_priority << 4);
 	/*
 	   p.840 line 20 - Return 0 for the SM key unless we authenticate the
 	   requester as the master SM.
 	 */
 	p_remote_smi = ib_smp_get_payload_ptr(osm_madw_get_smp_ptr(p_madw));
 	if (ib_sminfo_get_state(p_remote_smi) == IB_SMINFO_STATE_MASTER) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sm->p_log, OSM_LOG_DEBUG,
 			"__osm_sminfo_rcv_process_set_request: "
 			"Responding to master SM with real sm_key\n");
-		p_smi->sm_key = p_rcv->p_subn->opt.sm_key;
+		p_smi->sm_key = sm->p_subn->opt.sm_key;
 	} else {
 		/* The requester is not authenticated as master - set sm_key to zero. */
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sm->p_log, OSM_LOG_DEBUG,
 			"__osm_sminfo_rcv_process_set_request: "
 			"Responding to SM not master with zero sm_key\n");
 		p_smi->sm_key = 0;
@@ -281,20 +234,20 @@ __osm_sminfo_rcv_process_set_request(IN const osm_sminfo_rcv_t * const p_rcv,
 	/* Check the legality of the packet */
 	status = __osm_sminfo_rcv_check_set_req_legality(p_smp);
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_sminfo_rcv_process_set_request: ERR 2F04: "
 			"Check legality failed. AttributeModifier:0x%X RemoteState:%s\n",
 			p_smp->attr_mod,
 			osm_get_sm_mgr_state_str(ib_sminfo_get_state
-						 (p_rcv_smi)));
+						 (sm_smi)));
 		/* send a response with error code */
-		status = osm_resp_send(p_rcv->p_resp, p_madw, 7, payload);
+		status = osm_resp_send(&sm->resp, p_madw, 7, payload);
 		if (status != IB_SUCCESS)
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"__osm_sminfo_rcv_process_set_request: ERR 2F05: "
 				"Error sending response (%s)\n",
 				ib_get_err_str(status));
-		CL_PLOCK_RELEASE(p_rcv->p_lock);
+		CL_PLOCK_RELEASE(sm->p_lock);
 		goto Exit;
 	}
 
@@ -320,38 +273,38 @@ __osm_sminfo_rcv_process_set_request(IN const osm_sminfo_rcv_t * const p_rcv,
 		   This code shouldn't be reached - checked in the
 		   check legality
 		 */
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_sminfo_rcv_process_set_request: ERR 2F06: "
 			"THIS CODE SHOULD NOT BE REACHED!!\n");
-		CL_PLOCK_RELEASE(p_rcv->p_lock);
+		CL_PLOCK_RELEASE(sm->p_lock);
 		goto Exit;
 	}
 
 	/* check legality of the needed transition in the SM state machine */
-	status = osm_sm_state_mgr_check_legality(p_rcv->p_sm_state_mgr,
+	status = osm_sm_state_mgr_check_legality(&sm->sm_state_mgr,
 						 sm_signal);
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_sminfo_rcv_process_set_request: ERR 2F07: "
 			"Failed check of legality of needed SM transition. AttributeModifier:0x%X RemoteState:%s\n",
 			p_smp->attr_mod,
 			osm_get_sm_mgr_state_str(ib_sminfo_get_state
-						 (p_rcv_smi)));
+						 (sm_smi)));
 		/* send a response with error code */
-		status = osm_resp_send(p_rcv->p_resp, p_madw, 7, payload);
+		status = osm_resp_send(&sm->resp, p_madw, 7, payload);
 		if (status != IB_SUCCESS)
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"__osm_sminfo_rcv_process_set_request: ERR 2F08: "
 				"Error sending response (%s)\n",
 				ib_get_err_str(status));
-		CL_PLOCK_RELEASE(p_rcv->p_lock);
+		CL_PLOCK_RELEASE(sm->p_lock);
 		goto Exit;
 	}
 
 	/* the SubnSet(SMInfo) command is ok. Send a response. */
-	status = osm_resp_send(p_rcv->p_resp, p_madw, 0, payload);
+	status = osm_resp_send(&sm->resp, p_madw, 0, payload);
 	if (status != IB_SUCCESS)
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_sminfo_rcv_process_set_request: ERR 2F09: "
 			"Error sending response (%s)\n",
 			ib_get_err_str(status));
@@ -362,26 +315,26 @@ __osm_sminfo_rcv_process_set_request(IN const osm_sminfo_rcv_t * const p_rcv,
 	/* p_sm_state_mgr in the master_guid variable - the guid of the */
 	/* current master. */
 	if (p_smp->attr_mod == IB_SMINFO_ATTR_MOD_STANDBY) {
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sm->p_log, OSM_LOG_VERBOSE,
 			"__osm_sminfo_rcv_process_set_request: "
 			"Received a STANDBY signal. Updating "
 			"sm_state_mgr master_guid: 0x%016" PRIx64 "\n",
-			cl_ntoh64(p_rcv_smi->guid));
-		p_rcv->p_sm_state_mgr->master_guid = p_rcv_smi->guid;
+			cl_ntoh64(sm_smi->guid));
+		sm->sm_state_mgr.master_guid = sm_smi->guid;
 	}
 
 	/* call osm_sm_state_mgr_process with the received signal. */
-	CL_PLOCK_RELEASE(p_rcv->p_lock);
-	status = osm_sm_state_mgr_process(p_rcv->p_sm_state_mgr, sm_signal);
+	CL_PLOCK_RELEASE(sm->p_lock);
+	status = osm_sm_state_mgr_process(&sm->sm_state_mgr, sm_signal);
 
 	if (status != IB_SUCCESS)
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_sminfo_rcv_process_set_request: ERR 2F10: "
 			"Error in SM state transition (%s)\n",
 			ib_get_err_str(status));
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
@@ -389,18 +342,18 @@ __osm_sminfo_rcv_process_set_request(IN const osm_sminfo_rcv_t * const p_rcv,
  * If return OSM_SIGNAL_NONE - do not call osm_sm_signal.
  **********************************************************************/
 static osm_signal_t
-__osm_sminfo_rcv_process_get_sm(IN const osm_sminfo_rcv_t * const p_rcv,
+__osm_sminfo_rcv_process_get_sm(IN osm_sm_t * sm,
 				IN const osm_remote_sm_t * const p_sm)
 {
 	const ib_sm_info_t *p_smi;
 	osm_signal_t ret_val = OSM_SIGNAL_NONE;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_sminfo_rcv_process_get_sm);
+	OSM_LOG_ENTER(sm->p_log, __osm_sminfo_rcv_process_get_sm);
 
 	p_smi = &p_sm->smi;
 
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_VERBOSE))
-		osm_log(p_rcv->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_sminfo_rcv_process_get_sm: "
 			"Detected SM 0x%016" PRIx64 " in state %u\n",
 			cl_ntoh64(p_smi->guid), ib_sminfo_get_state(p_smi));
@@ -408,7 +361,7 @@ __osm_sminfo_rcv_process_get_sm(IN const osm_sminfo_rcv_t * const p_rcv,
 	/*
 	   Check the state of this SM vs. our own.
 	 */
-	switch (p_rcv->p_subn->sm_state) {
+	switch (sm->p_subn->sm_state) {
 	case IB_SMINFO_STATE_NOTACTIVE:
 		break;
 
@@ -419,27 +372,27 @@ __osm_sminfo_rcv_process_get_sm(IN const osm_sminfo_rcv_t * const p_rcv,
 		case IB_SMINFO_STATE_MASTER:
 			ret_val = OSM_SIGNAL_MASTER_OR_HIGHER_SM_DETECTED;
 			/* save on the p_sm_state_mgr the guid of the current master. */
-			osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			osm_log(sm->p_log, OSM_LOG_VERBOSE,
 				"__osm_sminfo_rcv_process_get_sm: "
 				"Found master SM. Updating sm_state_mgr master_guid: 0x%016"
 				PRIx64 "\n", cl_ntoh64(p_sm->p_port->guid));
-			p_rcv->p_sm_state_mgr->master_guid = p_sm->p_port->guid;
+			sm->sm_state_mgr.master_guid = p_sm->p_port->guid;
 			break;
 		case IB_SMINFO_STATE_DISCOVERING:
 		case IB_SMINFO_STATE_STANDBY:
-			if (__osm_sminfo_rcv_remote_sm_is_higher(p_rcv, p_smi)
+			if (__osm_sminfo_rcv_remote_sm_is_higher(sm, p_smi)
 			    == TRUE) {
 				/* the remote is a higher sm - need to stop sweeping */
 				ret_val =
 				    OSM_SIGNAL_MASTER_OR_HIGHER_SM_DETECTED;
-				/* save on the p_sm_state_mgr the guid of the higher SM we found - */
+				/* save on the sm_state_mgr the guid of the higher SM we found - */
 				/* we will poll it - as long as it lives - we should be in Standby. */
-				osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+				osm_log(sm->p_log, OSM_LOG_VERBOSE,
 					"__osm_sminfo_rcv_process_get_sm: "
 					"Found higher SM. Updating sm_state_mgr master_guid:"
 					" 0x%016" PRIx64 "\n",
 					cl_ntoh64(p_sm->p_port->guid));
-				p_rcv->p_sm_state_mgr->master_guid =
+				sm->sm_state_mgr.master_guid =
 				    p_sm->p_port->guid;
 			}
 			break;
@@ -455,22 +408,20 @@ __osm_sminfo_rcv_process_get_sm(IN const osm_sminfo_rcv_t * const p_rcv,
 		case IB_SMINFO_STATE_MASTER:
 			/* This means the master is alive */
 			/* Signal that to the SM state mgr */
-			osm_sm_state_mgr_signal_master_is_alive(p_rcv->
-								p_sm_state_mgr);
+			osm_sm_state_mgr_signal_master_is_alive(&sm->sm_state_mgr);
 			break;
 		case IB_SMINFO_STATE_STANDBY:
 			/* This should be the response from the sm we are polling. */
 			/* If it is - then signal master is alive */
-			if (p_rcv->p_sm_state_mgr->master_guid ==
-			    p_sm->p_port->guid) {
+			if (sm->sm_state_mgr.master_guid == p_sm->p_port->guid) {
 				/* Make sure that it is an SM with higher priority than us.
 				   If we started polling it when it was master, and it moved
 				   to standby - then it might be with a lower priority than
 				   us - and then we don't want to continue polling it. */
 				if (__osm_sminfo_rcv_remote_sm_is_higher
-				    (p_rcv, p_smi) == TRUE)
+				    (sm, p_smi) == TRUE)
 					osm_sm_state_mgr_signal_master_is_alive
-					    (p_rcv->p_sm_state_mgr);
+					    (&sm->sm_state_mgr);
 			}
 			break;
 		default:
@@ -485,9 +436,9 @@ __osm_sminfo_rcv_process_get_sm(IN const osm_sminfo_rcv_t * const p_rcv,
 			/* If this is a response due to our polling, this means that we are
 			   waiting for a handover from this SM, and it is still alive -
 			   signal that. */
-			if (p_rcv->p_sm_state_mgr->p_polling_sm != NULL) {
-				osm_sm_state_mgr_signal_master_is_alive(p_rcv->
-									p_sm_state_mgr);
+			if (sm->sm_state_mgr.p_polling_sm != NULL) {
+				osm_sm_state_mgr_signal_master_is_alive(&sm->
+									sm_state_mgr);
 			} else {
 				/* This is a response we got while sweeping the subnet.
 				   We will handle a case of handover needed later on, when the sweep
@@ -504,14 +455,14 @@ __osm_sminfo_rcv_process_get_sm(IN const osm_sminfo_rcv_t * const p_rcv,
 		break;
 	}
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 	return ret_val;
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sminfo_rcv_process_get_response(IN const osm_sminfo_rcv_t * const p_rcv,
+__osm_sminfo_rcv_process_get_response(IN osm_sm_t * sm,
 				      IN const osm_madw_t * const p_madw)
 {
 	const ib_smp_t *p_smp;
@@ -522,34 +473,34 @@ __osm_sminfo_rcv_process_get_response(IN const osm_sminfo_rcv_t * const p_rcv,
 	osm_remote_sm_t *p_sm;
 	osm_signal_t process_get_sm_ret_val = OSM_SIGNAL_NONE;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_sminfo_rcv_process_get_response);
+	OSM_LOG_ENTER(sm->p_log, __osm_sminfo_rcv_process_get_response);
 
 	CL_ASSERT(p_madw);
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
 
 	if (p_smp->method != IB_MAD_METHOD_GET_RESP) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_sminfo_rcv_process_get_response: ERR 2F11: "
 			"Unsupported method 0x%X\n", p_smp->method);
 		goto Exit;
 	}
 
 	p_smi = ib_smp_get_payload_ptr(p_smp);
-	p_sm_tbl = &p_rcv->p_subn->sm_guid_tbl;
+	p_sm_tbl = &sm->p_subn->sm_guid_tbl;
 	port_guid = p_smi->guid;
 
-	osm_dump_sm_info(p_rcv->p_log, p_smi, OSM_LOG_DEBUG);
+	osm_dump_sm_info(sm->p_log, p_smi, OSM_LOG_DEBUG);
 
 	/*
 	   Check that the sm_key of the found SM is the same as ours,
 	   or is zero. If not - OpenSM cannot continue with configuration!. */
-	if (p_smi->sm_key != 0 && p_smi->sm_key != p_rcv->p_subn->opt.sm_key) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+	if (p_smi->sm_key != 0 && p_smi->sm_key != sm->p_subn->opt.sm_key) {
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_sminfo_rcv_process_get_response: ERR 2F18: "
 			"Got SM with sm_key that doesn't match our "
 			"local key. Exiting\n");
-		osm_log(p_rcv->p_log, OSM_LOG_SYS,
+		osm_log(sm->p_log, OSM_LOG_SYS,
 			"Found remote SM with non-matching sm_key. Exiting\n");
 		osm_exit_flag = TRUE;
 		goto Exit;
@@ -558,18 +509,18 @@ __osm_sminfo_rcv_process_get_response(IN const osm_sminfo_rcv_t * const p_rcv,
 	/*
 	   Determine if we already have another SM object for this SM.
 	 */
-	CL_PLOCK_EXCL_ACQUIRE(p_rcv->p_lock);
+	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
 
-	p_port = osm_get_port_by_guid(p_rcv->p_subn, port_guid);
+	p_port = osm_get_port_by_guid(sm->p_subn, port_guid);
 	if (!p_port) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_sminfo_rcv_process_get_response: ERR 2F12: "
 			"No port object for this SM\n");
 		goto _unlock_and_exit;
 	}
 
 	if (osm_port_get_guid(p_port) != p_smi->guid) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_sminfo_rcv_process_get_response: ERR 2F13: "
 			"Bogus SM port GUID"
 			"\n\t\t\t\tExpected 0x%016" PRIx64
@@ -579,8 +530,8 @@ __osm_sminfo_rcv_process_get_response(IN const osm_sminfo_rcv_t * const p_rcv,
 		goto _unlock_and_exit;
 	}
 
-	if (port_guid == p_rcv->p_subn->sm_port_guid) {
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+	if (port_guid == sm->p_subn->sm_port_guid) {
+		osm_log(sm->p_log, OSM_LOG_VERBOSE,
 			"__osm_sminfo_rcv_process_get_response: "
 			"Self query response received - SM port 0x%016" PRIx64
 			"\n", cl_ntoh64(port_guid));
@@ -591,7 +542,7 @@ __osm_sminfo_rcv_process_get_response(IN const osm_sminfo_rcv_t * const p_rcv,
 	if (p_sm == (osm_remote_sm_t *) cl_qmap_end(p_sm_tbl)) {
 		p_sm = malloc(sizeof(*p_sm));
 		if (p_sm == NULL) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"__osm_sminfo_rcv_process_get_response: ERR 2F14: "
 				"Unable to allocate SM object\n");
 			goto _unlock_and_exit;
@@ -607,49 +558,49 @@ __osm_sminfo_rcv_process_get_response(IN const osm_sminfo_rcv_t * const p_rcv,
 		 */
 		p_sm->smi = *p_smi;
 
-	process_get_sm_ret_val = __osm_sminfo_rcv_process_get_sm(p_rcv, p_sm);
+	process_get_sm_ret_val = __osm_sminfo_rcv_process_get_sm(sm, p_sm);
 
       _unlock_and_exit:
-	CL_PLOCK_RELEASE(p_rcv->p_lock);
+	CL_PLOCK_RELEASE(sm->p_lock);
 
 	/* If process_get_sm_ret_val != OSM_SIGNAL_NONE then we have to signal
 	 * to the SM with that signal. */
 	if (process_get_sm_ret_val != OSM_SIGNAL_NONE)
-		osm_sm_signal(&p_rcv->p_subn->p_osm->sm,
+		osm_sm_signal(&sm->p_subn->p_osm->sm,
 			      process_get_sm_ret_val);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sminfo_rcv_process_set_response(IN const osm_sminfo_rcv_t * const p_rcv,
+__osm_sminfo_rcv_process_set_response(IN osm_sm_t * sm,
 				      IN const osm_madw_t * const p_madw)
 {
 	const ib_smp_t *p_smp;
 	const ib_sm_info_t *p_smi;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_sminfo_rcv_process_set_response);
+	OSM_LOG_ENTER(sm->p_log, __osm_sminfo_rcv_process_set_response);
 
 	CL_ASSERT(p_madw);
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
 
 	if (p_smp->method != IB_MAD_METHOD_GET_RESP) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_sminfo_rcv_process_set_response: ERR 2F16: "
 			"Unsupported method 0x%X\n", p_smp->method);
 		goto Exit;
 	}
 
 	p_smi = ib_smp_get_payload_ptr(p_smp);
-	osm_dump_sm_info(p_rcv->p_log, p_smi, OSM_LOG_DEBUG);
+	osm_dump_sm_info(sm->p_log, p_smi, OSM_LOG_DEBUG);
 
 	/* Check the AttributeModifier */
 	if (p_smp->attr_mod != IB_SMINFO_ATTR_MOD_HANDOVER) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_sminfo_rcv_process_set_response: ERR 2F17: "
 			"Unsupported attribute modifier 0x%X\n",
 			p_smp->attr_mod);
@@ -662,19 +613,19 @@ __osm_sminfo_rcv_process_set_response(IN const osm_sminfo_rcv_t * const p_rcv,
 	 */
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 void osm_sminfo_rcv_process(IN void *context, IN void *data)
 {
-	osm_sminfo_rcv_t *p_rcv = context;
+	osm_sm_t *sm = context;
 	osm_madw_t *p_madw = data;
 	ib_smp_t *p_smp;
 	osm_smi_context_t *p_smi_context;
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_sminfo_rcv_process);
+	OSM_LOG_ENTER(sm->p_log, osm_sminfo_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -696,7 +647,7 @@ void osm_sminfo_rcv_process(IN void *context, IN void *data)
 		   moving issue.
 		 */
 		if (p_smi_context->port_guid != p_smi->guid) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"osm_sminfo_rcv_process: ERR 2F19: "
 				"Unexpected SM port GUID in response"
 				"\n\t\t\t\tExpected 0x%016" PRIx64
@@ -708,18 +659,18 @@ void osm_sminfo_rcv_process(IN void *context, IN void *data)
 
 		if (p_smi_context->set_method == FALSE)
 			/* this is a response to a Get method */
-			__osm_sminfo_rcv_process_get_response(p_rcv, p_madw);
+			__osm_sminfo_rcv_process_get_response(sm, p_madw);
 		else
 			/* this is a response to a Set method */
-			__osm_sminfo_rcv_process_set_response(p_rcv, p_madw);
+			__osm_sminfo_rcv_process_set_response(sm, p_madw);
 	} else if (p_smp->method == IB_MAD_METHOD_GET)
 		/* This is a request */
 		/* This is a SubnGet request */
-		__osm_sminfo_rcv_process_get_request(p_rcv, p_madw);
+		__osm_sminfo_rcv_process_get_request(sm, p_madw);
 	else
 		/* This should be a SubnSet request */
-		__osm_sminfo_rcv_process_set_request(p_rcv, p_madw);
+		__osm_sminfo_rcv_process_set_request(sm, p_madw);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
diff --git a/opensm/opensm/osm_sw_info_rcv.c b/opensm/opensm/osm_sw_info_rcv.c
index 55c43e6..d9bd21b 100644
--- a/opensm/opensm/osm_sw_info_rcv.c
+++ b/opensm/opensm/osm_sw_info_rcv.c
@@ -54,7 +54,6 @@
 #include <complib/cl_qmap.h>
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
-#include <opensm/osm_sw_info_rcv.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_switch.h>
 #include <opensm/osm_subnet.h>
@@ -65,7 +64,7 @@
  The plock must be held before calling this function.
 **********************************************************************/
 static void
-__osm_si_rcv_get_port_info(IN const osm_si_rcv_t * const p_rcv,
+__osm_si_rcv_get_port_info(IN osm_sm_t * sm,
 			   IN osm_switch_t * const p_sw,
 			   IN const osm_madw_t * const p_madw)
 {
@@ -78,7 +77,7 @@ __osm_si_rcv_get_port_info(IN const osm_si_rcv_t * const p_rcv,
 	const ib_smp_t *p_smp;
 	ib_api_status_t status = IB_SUCCESS;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_si_rcv_get_port_info);
+	OSM_LOG_ENTER(sm->p_log, __osm_si_rcv_get_port_info);
 
 	CL_ASSERT(p_sw);
 
@@ -112,21 +111,21 @@ __osm_si_rcv_get_port_info(IN const osm_si_rcv_t * const p_rcv,
 			 p_smp->hop_count, p_smp->initial_path);
 
 	for (port_num = 0; port_num < num_ports; port_num++) {
-		status = osm_req_get(p_rcv->p_req,
+		status = osm_req_get(&sm->req,
 				     &dr_path,
 				     IB_MAD_ATTR_PORT_INFO,
 				     cl_hton32(port_num),
 				     CL_DISP_MSGID_NONE, &context);
 		if (status != IB_SUCCESS) {
 			/* continue the loop despite the error */
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"__osm_si_rcv_get_port_info: ERR 3602: "
 				"Failure initiating PortInfo request (%s)\n",
 				ib_get_err_str(status));
 		}
 	}
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 #if 0
@@ -134,7 +133,7 @@ __osm_si_rcv_get_port_info(IN const osm_si_rcv_t * const p_rcv,
  The plock must be held before calling this function.
 **********************************************************************/
 static void
-__osm_si_rcv_get_fwd_tbl(IN const osm_si_rcv_t * const p_rcv,
+__osm_si_rcv_get_fwd_tbl(IN osm_sm_t * sm,
 			 IN osm_switch_t * const p_sw)
 {
 	osm_madw_context_t context;
@@ -145,7 +144,7 @@ __osm_si_rcv_get_fwd_tbl(IN const osm_si_rcv_t * const p_rcv,
 	uint32_t max_block_id_ho;
 	ib_api_status_t status = IB_SUCCESS;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_si_rcv_get_fwd_tbl);
+	OSM_LOG_ENTER(sm->p_log, __osm_si_rcv_get_fwd_tbl);
 
 	CL_ASSERT(p_sw);
 
@@ -165,34 +164,34 @@ __osm_si_rcv_get_fwd_tbl(IN const osm_si_rcv_t * const p_rcv,
 	p_dr_path = osm_physp_get_dr_path_ptr(p_physp);
 
 	for (block_id_ho = 0; block_id_ho <= max_block_id_ho; block_id_ho++) {
-		if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
-			osm_log(p_rcv->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_si_rcv_get_fwd_tbl: "
 				"Retrieving FT block %u\n", block_id_ho);
 		}
 
-		status = osm_req_get(p_rcv->p_req,
+		status = osm_req_get(&sm->req,
 				     p_dr_path,
 				     IB_MAD_ATTR_LIN_FWD_TBL,
 				     cl_hton32(block_id_ho),
 				     CL_DISP_MSGID_NONE, &context);
 		if (status != IB_SUCCESS) {
 			/* continue the loop despite the error */
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"__osm_si_rcv_get_fwd_tbl: ERR 3603: "
 				"Failure initiating PortInfo request (%s)\n",
 				ib_get_err_str(status));
 		}
 	}
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
  The plock must be held before calling this function.
 **********************************************************************/
 static void
-__osm_si_rcv_get_mcast_fwd_tbl(IN const osm_si_rcv_t * const p_rcv,
+__osm_si_rcv_get_mcast_fwd_tbl(IN osm_sm_t * sm,
 			       IN osm_switch_t * const p_sw)
 {
 	osm_madw_context_t context;
@@ -207,7 +206,7 @@ __osm_si_rcv_get_mcast_fwd_tbl(IN const osm_si_rcv_t * const p_rcv,
 	uint32_t attr_mod_ho;
 	ib_api_status_t status = IB_SUCCESS;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_si_rcv_get_mcast_fwd_tbl);
+	OSM_LOG_ENTER(sm->p_log, __osm_si_rcv_get_mcast_fwd_tbl);
 
 	CL_ASSERT(p_sw);
 
@@ -216,7 +215,7 @@ __osm_si_rcv_get_mcast_fwd_tbl(IN const osm_si_rcv_t * const p_rcv,
 	CL_ASSERT(osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH);
 
 	if (osm_switch_get_mcast_fwd_tbl_size(p_sw) == 0) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sm->p_log, OSM_LOG_DEBUG,
 			"__osm_si_rcv_get_mcast_fwd_tbl: "
 			"Multicast not supported by switch 0x%016" PRIx64 "\n",
 			cl_ntoh64(osm_node_get_node_guid(p_node)));
@@ -234,7 +233,7 @@ __osm_si_rcv_get_mcast_fwd_tbl(IN const osm_si_rcv_t * const p_rcv,
 	max_block_id_ho = osm_mcast_tbl_get_max_block(p_tbl);
 
 	if (max_block_id_ho > IB_MCAST_MAX_BLOCK_ID) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_si_rcv_get_mcast_fwd_tbl: ERR 3609: "
 			"Out-of-range mcast block size = %u on switch 0x%016"
 			PRIx64 "\n", max_block_id_ho,
@@ -246,7 +245,7 @@ __osm_si_rcv_get_mcast_fwd_tbl(IN const osm_si_rcv_t * const p_rcv,
 
 	CL_ASSERT(max_position <= IB_MCAST_POSITION_MAX);
 
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sm->p_log, OSM_LOG_DEBUG,
 		"__osm_si_rcv_get_mcast_fwd_tbl: "
 		"Max MFT block = %u, Max position = %u\n", max_block_id_ho,
 		max_position);
@@ -254,15 +253,15 @@ __osm_si_rcv_get_mcast_fwd_tbl(IN const osm_si_rcv_t * const p_rcv,
 	p_dr_path = osm_physp_get_dr_path_ptr(p_physp);
 
 	for (block_id_ho = 0; block_id_ho <= max_block_id_ho; block_id_ho++) {
-		if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
-			osm_log(p_rcv->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_si_rcv_get_mcast_fwd_tbl: "
 				"Retrieving MFT block %u\n", block_id_ho);
 		}
 
 		for (position = 0; position <= max_position; position++) {
-			if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
-				osm_log(p_rcv->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_si_rcv_get_mcast_fwd_tbl: "
 					"Retrieving MFT position %u\n",
 					position);
@@ -271,13 +270,13 @@ __osm_si_rcv_get_mcast_fwd_tbl(IN const osm_si_rcv_t * const p_rcv,
 			attr_mod_ho =
 			    block_id_ho | position << IB_MCAST_POSITION_SHIFT;
 			status =
-			    osm_req_get(p_rcv->p_req, p_dr_path,
+			    osm_req_get(&sm->req, p_dr_path,
 					IB_MAD_ATTR_MCAST_FWD_TBL,
 					cl_hton32(attr_mod_ho),
 					CL_DISP_MSGID_NONE, &context);
 			if (status != IB_SUCCESS) {
 				/* continue the loop despite the error */
-				osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				osm_log(sm->p_log, OSM_LOG_ERROR,
 					"__osm_si_rcv_get_mcast_fwd_tbl: ERR 3607: "
 					"Failure initiating PortInfo request (%s)\n",
 					ib_get_err_str(status));
@@ -286,7 +285,7 @@ __osm_si_rcv_get_mcast_fwd_tbl(IN const osm_si_rcv_t * const p_rcv,
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 #endif
 
@@ -294,7 +293,7 @@ __osm_si_rcv_get_mcast_fwd_tbl(IN const osm_si_rcv_t * const p_rcv,
    Lock must be held on entry to this function.
 **********************************************************************/
 static void
-__osm_si_rcv_process_new(IN const osm_si_rcv_t * const p_rcv,
+__osm_si_rcv_process_new(IN osm_sm_t * sm,
 			 IN osm_node_t * const p_node,
 			 IN const osm_madw_t * const p_madw)
 {
@@ -304,18 +303,18 @@ __osm_si_rcv_process_new(IN const osm_si_rcv_t * const p_rcv,
 	ib_smp_t *p_smp;
 	cl_qmap_t *p_sw_guid_tbl;
 
-	CL_ASSERT(p_rcv);
+	CL_ASSERT(sm);
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_si_rcv_process_new);
+	OSM_LOG_ENTER(sm->p_log, __osm_si_rcv_process_new);
 
 	CL_ASSERT(p_madw);
 
-	p_sw_guid_tbl = &p_rcv->p_subn->sw_guid_tbl;
+	p_sw_guid_tbl = &sm->p_subn->sw_guid_tbl;
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
 	p_si = (ib_switch_info_t *) ib_smp_get_payload_ptr(p_smp);
 
-	osm_dump_switch_info(p_rcv->p_log, p_si, OSM_LOG_DEBUG);
+	osm_dump_switch_info(sm->p_log, p_si, OSM_LOG_DEBUG);
 
 	/*
 	   Allocate a new switch object for this switch,
@@ -323,30 +322,30 @@ __osm_si_rcv_process_new(IN const osm_si_rcv_t * const p_rcv,
 	 */
 	p_sw = osm_switch_new(p_node, p_madw);
 	if (p_sw == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_si_rcv_process_new: ERR 3608: "
 			"Unable to allocate new switch object\n");
 		goto Exit;
 	}
 
 	/* set subnet max mlid to the minimum MulticastFDBCap of all switches */
-	if (p_sw->mcast_tbl.max_mlid_ho < p_rcv->p_subn->max_multicast_lid_ho) {
-		p_rcv->p_subn->max_multicast_lid_ho =
+	if (p_sw->mcast_tbl.max_mlid_ho < sm->p_subn->max_multicast_lid_ho) {
+		sm->p_subn->max_multicast_lid_ho =
 		    p_sw->mcast_tbl.max_mlid_ho;
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sm->p_log, OSM_LOG_VERBOSE,
 			"__osm_si_rcv_process_new: "
 			"Subnet max multicast lid is 0x%X\n",
-			p_rcv->p_subn->max_multicast_lid_ho);
+			sm->p_subn->max_multicast_lid_ho);
 	}
 
 	/* set subnet max unicast lid to the minimum LinearFDBCap of all switches */
-	if (p_sw->fwd_tbl.p_lin_tbl->size < p_rcv->p_subn->max_unicast_lid_ho) {
-		p_rcv->p_subn->max_unicast_lid_ho =
+	if (p_sw->fwd_tbl.p_lin_tbl->size < sm->p_subn->max_unicast_lid_ho) {
+		sm->p_subn->max_unicast_lid_ho =
 		    p_sw->fwd_tbl.p_lin_tbl->size;
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sm->p_log, OSM_LOG_VERBOSE,
 			"__osm_si_rcv_process_new: "
 			"Subnet max unicast lid is 0x%X\n",
-			p_rcv->p_subn->max_unicast_lid_ho);
+			sm->p_subn->max_unicast_lid_ho);
 	}
 
 	p_check = (osm_switch_t *) cl_qmap_insert(p_sw_guid_tbl,
@@ -357,7 +356,7 @@ __osm_si_rcv_process_new(IN const osm_si_rcv_t * const p_rcv,
 		/*
 		   This shouldn't happen since we hold the lock!
 		 */
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_si_rcv_process_new: ERR 3605: "
 			"Unable to add new switch object to database\n");
 		osm_switch_delete(&p_sw);
@@ -376,7 +375,7 @@ __osm_si_rcv_process_new(IN const osm_si_rcv_t * const p_rcv,
 	/*
 	   Get the PortInfo attribute for every port.
 	 */
-	__osm_si_rcv_get_port_info(p_rcv, p_sw, p_madw);
+	__osm_si_rcv_get_port_info(sm, p_sw, p_madw);
 
 	/*
 	   Don't bother retrieving the current unicast and multicast tables
@@ -390,13 +389,13 @@ __osm_si_rcv_process_new(IN const osm_si_rcv_t * const p_rcv,
 	   The code to retrieve the tables was fully debugged.
 	 */
 #if 0
-	__osm_si_rcv_get_fwd_tbl(p_rcv, p_sw);
-	if (!p_rcv->p_subn->opt.disable_multicast)
-		__osm_si_rcv_get_mcast_fwd_tbl(p_rcv, p_sw);
+	__osm_si_rcv_get_fwd_tbl(sm, p_sw);
+	if (!sm->p_subn->opt.disable_multicast)
+		__osm_si_rcv_get_mcast_fwd_tbl(sm, p_sw);
 #endif
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
@@ -405,7 +404,7 @@ __osm_si_rcv_process_new(IN const osm_si_rcv_t * const p_rcv,
    this can not be done internally as the event needs the lock...
 **********************************************************************/
 static boolean_t
-__osm_si_rcv_process_existing(IN const osm_si_rcv_t * const p_rcv,
+__osm_si_rcv_process_existing(IN osm_sm_t * sm,
 			      IN osm_node_t * const p_node,
 			      IN const osm_madw_t * const p_madw)
 {
@@ -415,7 +414,7 @@ __osm_si_rcv_process_existing(IN const osm_si_rcv_t * const p_rcv,
 	ib_smp_t *p_smp;
 	boolean_t is_change_detected = FALSE;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_si_rcv_process_existing);
+	OSM_LOG_ENTER(sm->p_log, __osm_si_rcv_process_existing);
 
 	CL_ASSERT(p_madw);
 
@@ -424,16 +423,16 @@ __osm_si_rcv_process_existing(IN const osm_si_rcv_t * const p_rcv,
 	p_si_context = osm_madw_get_si_context_ptr(p_madw);
 
 	if (p_si_context->set_method) {
-		if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
-			osm_log(p_rcv->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_si_rcv_process_existing: "
 				"Received logical SetResp()\n");
 		}
 
 		osm_switch_set_switch_info(p_sw, p_si);
 	} else {
-		if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
-			osm_log(p_rcv->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_si_rcv_process_existing: "
 				"Received logical GetResp()\n");
 		}
@@ -449,7 +448,7 @@ __osm_si_rcv_process_existing(IN const osm_si_rcv_t * const p_rcv,
 			/* If the mad was returned with an error -
 			   signal a change to the state manager. */
 			if (ib_smp_get_status(p_smp) != 0) {
-				osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+				osm_log(sm->p_log, OSM_LOG_VERBOSE,
 					"__osm_si_rcv_process_existing: "
 					"GetResp() received with error in light sweep. "
 					"Commencing heavy sweep\n");
@@ -461,7 +460,7 @@ __osm_si_rcv_process_existing(IN const osm_si_rcv_t * const p_rcv,
 				   a light sweep.
 				 */
 				if (ib_switch_info_get_state_change(p_si)) {
-					osm_dump_switch_info(p_rcv->p_log, p_si,
+					osm_dump_switch_info(sm->p_log, p_si,
 							     OSM_LOG_DEBUG);
 					is_change_detected = TRUE;
 				}
@@ -472,16 +471,16 @@ __osm_si_rcv_process_existing(IN const osm_si_rcv_t * const p_rcv,
 			   of the state change bit.
 			 */
 			p_sw->discovery_count++;
-			osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			osm_log(sm->p_log, OSM_LOG_VERBOSE,
 				"__osm_si_rcv_process_existing: "
 				"discovery_count is:%u\n",
 				p_sw->discovery_count);
 
 			/* If this is the first discovery - then get the port_info */
 			if (p_sw->discovery_count == 1)
-				__osm_si_rcv_get_port_info(p_rcv, p_sw, p_madw);
+				__osm_si_rcv_get_port_info(sm, p_sw, p_madw);
 			else {
-				osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+				osm_log(sm->p_log, OSM_LOG_DEBUG,
 					"__osm_si_rcv_process_existing: "
 					"Not discovering again through switch:0x%"
 					PRIx64 "\n",
@@ -490,55 +489,15 @@ __osm_si_rcv_process_existing(IN const osm_si_rcv_t * const p_rcv,
 		}
 	}
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 	return is_change_detected;
 }
 
 /**********************************************************************
  **********************************************************************/
-void osm_si_rcv_construct(IN osm_si_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_si_rcv_destroy(IN osm_si_rcv_t * const p_rcv)
-{
-	CL_ASSERT(p_rcv);
-
-	OSM_LOG_ENTER(p_rcv->p_log, osm_si_rcv_destroy);
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_si_rcv_init(IN osm_si_rcv_t * const p_rcv,
-		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 status = IB_SUCCESS;
-	OSM_LOG_ENTER(p_log, osm_si_rcv_init);
-
-	osm_si_rcv_construct(p_rcv);
-
-	p_rcv->p_log = p_log;
-	p_rcv->p_subn = p_subn;
-	p_rcv->p_lock = p_lock;
-	p_rcv->p_req = p_req;
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-	return (status);
-}
-
-/**********************************************************************
- **********************************************************************/
 void osm_si_rcv_process(IN void *context, IN void *data)
 {
-	osm_si_rcv_t *p_rcv = context;
+	osm_sm_t *sm = context;
 	osm_madw_t *p_madw = data;
 	ib_switch_info_t *p_si;
 	ib_smp_t *p_smp;
@@ -546,9 +505,9 @@ void osm_si_rcv_process(IN void *context, IN void *data)
 	ib_net64_t node_guid;
 	osm_si_context_t *p_context;
 
-	CL_ASSERT(p_rcv);
+	CL_ASSERT(sm);
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_si_rcv_process);
+	OSM_LOG_ENTER(sm->p_log, osm_si_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -563,19 +522,19 @@ void osm_si_rcv_process(IN void *context, IN void *data)
 
 	node_guid = p_context->node_guid;
 
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
-		osm_log(p_rcv->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_si_rcv_process: "
 			"Switch GUID 0x%016" PRIx64
 			", TID 0x%" PRIx64 "\n",
 			cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id));
 	}
 
-	CL_PLOCK_EXCL_ACQUIRE(p_rcv->p_lock);
+	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
 
-	p_node = osm_get_node_by_guid(p_rcv->p_subn, node_guid);
+	p_node = osm_get_node_by_guid(sm->p_subn, node_guid);
 	if (!p_node) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"osm_si_rcv_process: ERR 3606: "
 			"SwitchInfo received for nonexistent node "
 			"with GUID 0x%" PRIx64 "\n", cl_ntoh64(node_guid));
@@ -585,7 +544,7 @@ void osm_si_rcv_process(IN void *context, IN void *data)
 		   Hack for bad value in Mellanox switch
 		 */
 		if (cl_ntoh16(p_si->lin_top) > IB_LID_UCAST_END_HO) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"osm_si_rcv_process: ERR 3610: "
 				"\n\t\t\t\tBad LinearFDBTop value = 0x%X "
 				"on switch 0x%" PRIx64
@@ -600,25 +559,25 @@ void osm_si_rcv_process(IN void *context, IN void *data)
 		   Acquire the switch object for this switch.
 		 */
 		if (!p_node->sw) {
-			__osm_si_rcv_process_new(p_rcv, p_node, p_madw);
+			__osm_si_rcv_process_new(sm, p_node, p_madw);
 			/*
 			   A new switch was found during the sweep so we need
 			   to ignore the current LFT settings.
 			 */
-			p_rcv->p_subn->ignore_existing_lfts = TRUE;
+			sm->p_subn->ignore_existing_lfts = TRUE;
 		} else {
 			/* we might get back a request for signaling change was detected */
 			if (__osm_si_rcv_process_existing
-			    (p_rcv, p_node, p_madw)) {
-				CL_PLOCK_RELEASE(p_rcv->p_lock);
-				osm_sm_signal(&p_rcv->p_subn->p_osm->sm,
+			    (sm, p_node, p_madw)) {
+				CL_PLOCK_RELEASE(sm->p_lock);
+				osm_sm_signal(&sm->p_subn->p_osm->sm,
 					      OSM_SIGNAL_CHANGE_DETECTED);
 				goto Exit;
 			}
 		}
 	}
 
-	CL_PLOCK_RELEASE(p_rcv->p_lock);
+	CL_PLOCK_RELEASE(sm->p_lock);
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
diff --git a/opensm/opensm/osm_trap_rcv.c b/opensm/opensm/osm_trap_rcv.c
index ae11323..196bca2 100644
--- a/opensm/opensm/osm_trap_rcv.c
+++ b/opensm/opensm/osm_trap_rcv.c
@@ -53,7 +53,6 @@
 #include <iba/ib_types.h>
 #include <complib/cl_qmap.h>
 #include <complib/cl_debug.h>
-#include <opensm/osm_trap_rcv.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_node.h>
@@ -91,10 +90,10 @@ typedef struct _osm_trap_aging_tracker_context {
 
 /**********************************************************************
  **********************************************************************/
-static osm_physp_t *__get_physp_by_lid_and_num(IN osm_trap_rcv_t * const p_rcv,
+static osm_physp_t *__get_physp_by_lid_and_num(IN osm_sm_t * sm,
 					       IN uint16_t lid, IN uint8_t num)
 {
-	cl_ptr_vector_t *p_vec = &(p_rcv->p_subn->port_lid_tbl);
+	cl_ptr_vector_t *p_vec = &(sm->p_subn->port_lid_tbl);
 	osm_port_t *p_port;
 	osm_physp_t *p_physp;
 
@@ -119,12 +118,12 @@ uint64_t
 osm_trap_rcv_aging_tracker_callback(IN uint64_t key,
 				    IN uint32_t num_regs, IN void *context)
 {
-	osm_trap_rcv_t *p_rcv = (osm_trap_rcv_t *) context;
+	osm_sm_t *sm = context;
 	uint16_t lid;
 	uint8_t port_num;
 	osm_physp_t *p_physp;
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_trap_rcv_aging_tracker_callback);
+	OSM_LOG_ENTER(sm->p_log, osm_trap_rcv_aging_tracker_callback);
 
 	if (osm_exit_flag)
 		/* We got an exit flag - do nothing */
@@ -133,16 +132,16 @@ osm_trap_rcv_aging_tracker_callback(IN uint64_t key,
 	lid = cl_ntoh16((uint16_t) ((key & 0x0000FFFF00000000ULL) >> 32));
 	port_num = (uint8_t) ((key & 0x00FF000000000000ULL) >> 48);
 
-	p_physp = __get_physp_by_lid_and_num(p_rcv, lid, port_num);
+	p_physp = __get_physp_by_lid_and_num(sm, lid, port_num);
 	if (!p_physp)
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sm->p_log, OSM_LOG_VERBOSE,
 			"osm_trap_rcv_aging_tracker_callback: "
 			"Cannot find port num:0x%X with lid:%u\n",
 			port_num, lid);
 	/* make sure the physp is still valid */
 	/* If the health port was false - set it to true */
 	else if (osm_physp_is_valid(p_physp) && !osm_physp_is_healthy(p_physp)) {
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sm->p_log, OSM_LOG_VERBOSE,
 			"osm_trap_rcv_aging_tracker_callback: "
 			"Clearing health bit of port num:%u with lid:%u\n",
 			port_num, lid);
@@ -151,7 +150,7 @@ osm_trap_rcv_aging_tracker_callback(IN uint64_t key,
 		osm_physp_set_health(p_physp, TRUE);
 	}
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 
 	/* We want to remove the event from the tracker - so
 	   need to return zero. */
@@ -159,59 +158,6 @@ osm_trap_rcv_aging_tracker_callback(IN uint64_t key,
 }
 
 /**********************************************************************
- **********************************************************************/
-void osm_trap_rcv_construct(IN osm_trap_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-	cl_event_wheel_construct(&p_rcv->trap_aging_tracker);
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_trap_rcv_destroy(IN osm_trap_rcv_t * const p_rcv)
-{
-	CL_ASSERT(p_rcv);
-
-	OSM_LOG_ENTER(p_rcv->p_log, osm_trap_rcv_destroy);
-
-	cl_event_wheel_destroy(&p_rcv->trap_aging_tracker);
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_trap_rcv_init(IN osm_trap_rcv_t * const p_rcv,
-		  IN osm_subn_t * const p_subn,
-		  IN osm_stats_t * const p_stats,
-		  IN osm_resp_t * const p_resp,
-		  IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
-{
-	ib_api_status_t status = IB_SUCCESS;
-
-	OSM_LOG_ENTER(p_log, osm_trap_rcv_init);
-
-	osm_trap_rcv_construct(p_rcv);
-
-	p_rcv->p_log = p_log;
-	p_rcv->p_subn = p_subn;
-	p_rcv->p_lock = p_lock;
-	p_rcv->p_stats = p_stats;
-	p_rcv->p_resp = p_resp;
-
-	if (cl_event_wheel_init(&p_rcv->trap_aging_tracker)) {
-		osm_log(p_log, OSM_LOG_ERROR,
-			"osm_trap_rcv_init: ERR 3800: "
-			"Failed to initialize cl_event_wheel\n");
-		status = IB_NOT_DONE;
-	}
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-	return (status);
-}
-
-/**********************************************************************
  * CRC calculation for notice identification
  **********************************************************************/
 
@@ -297,7 +243,7 @@ static int __print_num_received(IN uint32_t num_received)
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
+__osm_trap_rcv_process_request(IN osm_sm_t * sm,
 			       IN const osm_madw_t * const p_madw)
 {
 	uint8_t payload[sizeof(ib_mad_notice_attr_t)];
@@ -317,7 +263,7 @@ __osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
 	uint64_t event_wheel_timeout = OSM_DEFAULT_TRAP_SUPRESSION_TIMEOUT;
 	boolean_t run_heavy_sweep = FALSE;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_trap_rcv_process_request);
+	OSM_LOG_ENTER(sm->p_log, __osm_trap_rcv_process_request);
 
 	CL_ASSERT(p_madw);
 
@@ -343,7 +289,7 @@ __osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
 	p_smp = osm_madw_get_smp_ptr(p_madw);
 
 	if (p_smp->method != IB_MAD_METHOD_TRAP) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_trap_rcv_process_request: ERR 3801: "
 			"Unsupported method 0x%X\n", p_smp->method);
 		goto Exit;
@@ -369,19 +315,19 @@ __osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
 			/* Check if the sm_base_lid is 0. If yes - this means that
 			   the local lid wasn't configured yet. Don't send a response
 			   to the trap. */
-			if (p_rcv->p_subn->sm_base_lid == 0) {
-				osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			if (sm->p_subn->sm_base_lid == 0) {
+				osm_log(sm->p_log, OSM_LOG_DEBUG,
 					"__osm_trap_rcv_process_request: "
 					"Received SLID=0 Trap with local LID=0. Ignoring MAD\n");
 				goto Exit;
 			}
-			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			osm_log(sm->p_log, OSM_LOG_DEBUG,
 				"__osm_trap_rcv_process_request: "
 				"Received SLID=0 Trap. Using local LID:0x%04X instead\n",
-				cl_ntoh16(p_rcv->p_subn->sm_base_lid)
+				cl_ntoh16(sm->p_subn->sm_base_lid)
 			    );
 			tmp_madw.mad_addr.addr_type.smi.source_lid =
-			    p_rcv->p_subn->sm_base_lid;
+			    sm->p_subn->sm_base_lid;
 		}
 
 		source_lid = tmp_madw.mad_addr.addr_type.smi.source_lid;
@@ -393,7 +339,7 @@ __osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
 				CL_HTON16(130))
 			    || (p_ntci->g_or_v.generic.trap_num ==
 				CL_HTON16(131)))
-				osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				osm_log(sm->p_log, OSM_LOG_ERROR,
 					"__osm_trap_rcv_process_request: "
 					"Received Generic Notice type:0x%02X num:%u Producer:%u (%s) "
 					"from LID:0x%04X Port %d TID:0x%016"
@@ -409,7 +355,7 @@ __osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
 					port_num, cl_ntoh64(p_smp->trans_id)
 				    );
 			else
-				osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				osm_log(sm->p_log, OSM_LOG_ERROR,
 					"__osm_trap_rcv_process_request: "
 					"Received Generic Notice type:0x%02X num:%u Producer:%u (%s) "
 					"from LID:0x%04X TID:0x%016" PRIx64
@@ -424,7 +370,7 @@ __osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
 					cl_ntoh64(p_smp->trans_id)
 				    );
 		} else
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"__osm_trap_rcv_process_request: "
 				"Received Vendor Notice type:0x%02X vend:0x%06X dev:%u "
 				"from LID:0x%04X TID:0x%016" PRIx64 "\n",
@@ -436,20 +382,20 @@ __osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
 			    );
 	}
 
-	osm_dump_notice(p_rcv->p_log, p_ntci, OSM_LOG_VERBOSE);
+	osm_dump_notice(sm->p_log, p_ntci, OSM_LOG_VERBOSE);
 
-	p_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-					    p_rcv->p_subn, &tmp_madw.mad_addr);
+	p_physp = osm_get_physp_by_mad_addr(sm->p_log,
+					    sm->p_subn, &tmp_madw.mad_addr);
 	if (p_physp)
 		p_smp->m_key = p_physp->port_info.m_key;
 	else
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_trap_rcv_process_request: ERR 3809: "
 			"Failed to find source physical port for trap\n");
 
-	status = osm_resp_send(p_rcv->p_resp, &tmp_madw, 0, payload);
+	status = osm_resp_send(&sm->resp, &tmp_madw, 0, payload);
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_trap_rcv_process_request: ERR 3802: "
 			"Error sending response (%s)\n",
 			ib_get_err_str(status));
@@ -488,13 +434,13 @@ __osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
 
 		/* try to find it in the aging tracker */
 		num_received =
-		    cl_event_wheel_num_regs(&p_rcv->trap_aging_tracker,
+		    cl_event_wheel_num_regs(&sm->trap_aging_tracker,
 					    trap_key);
 
 		/* Now we know how many times it provided this trap */
 		if (num_received > 10) {
 			if (__print_num_received(num_received))
-				osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				osm_log(sm->p_log, OSM_LOG_ERROR,
 					"__osm_trap_rcv_process_request: ERR 3804: "
 					"Received trap %u times consecutively\n",
 					num_received);
@@ -504,7 +450,7 @@ __osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
 			 */
 			if (physp_change_trap == TRUE) {
 				/* get the port */
-				p_physp = __get_physp_by_lid_and_num(p_rcv,
+				p_physp = __get_physp_by_lid_and_num(sm,
 								     cl_ntoh16
 								     (p_ntci->
 								      data_details.
@@ -513,7 +459,7 @@ __osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
 								     port_num);
 
 				if (!p_physp)
-					osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+					osm_log(sm->p_log, OSM_LOG_ERROR,
 						"__osm_trap_rcv_process_request: ERR 3805: "
 						"Failed to find physical port by lid:0x%02X num:%u\n",
 						cl_ntoh16(p_ntci->data_details.
@@ -523,7 +469,7 @@ __osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
 				else {
 					/* When babbling port policy option is enabled and
 					   Threshold for disabling a "babbling" port is exceeded */
-					if (p_rcv->p_subn->opt.
+					if (sm->p_subn->opt.
 					    babbling_port_policy
 					    && num_received >= 250) {
 						uint8_t
@@ -536,7 +482,7 @@ __osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
 						/* If trap 131, might want to disable peer port if available */
 						/* but peer port has been observed not to respond to SM requests */
 
-						osm_log(p_rcv->p_log,
+						osm_log(sm->p_log,
 							OSM_LOG_ERROR,
 							"__osm_trap_rcv_process_request: ERR 3810: "
 							" Disabling physical port lid:0x%02X num:%u\n",
@@ -577,7 +523,7 @@ __osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
 						    active_transition = FALSE;
 
 						status =
-						    osm_req_set(&p_rcv->p_subn->
+						    osm_req_set(&sm->p_subn->
 								p_osm->sm.req,
 								osm_physp_get_dr_path_ptr
 								(p_physp),
@@ -593,13 +539,13 @@ __osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
 						if (status == IB_SUCCESS)
 							goto Exit;
 
-						osm_log(p_rcv->p_log,
+						osm_log(sm->p_log,
 							OSM_LOG_ERROR,
 							"__osm_trap_rcv_process_request: ERR 3811: "
 							"Request to set PortInfo failed\n");
 					}
 
-					osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+					osm_log(sm->p_log, OSM_LOG_VERBOSE,
 						"__osm_trap_rcv_process_request: "
 						"Marking unhealthy physical port by lid:0x%02X num:%u\n",
 						cl_ntoh16(p_ntci->data_details.
@@ -631,18 +577,18 @@ __osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
 		/* If physp_change_trap is TRUE - then use a callback to unset the
 		   healthy bit. If not - no need to use a callback. */
 		if (physp_change_trap == TRUE)
-			cl_event_wheel_reg(&p_rcv->trap_aging_tracker, trap_key, cl_get_time_stamp() + event_wheel_timeout, osm_trap_rcv_aging_tracker_callback,	/* no callback */
-					   p_rcv	/* no context */
+			cl_event_wheel_reg(&sm->trap_aging_tracker, trap_key, cl_get_time_stamp() + event_wheel_timeout, osm_trap_rcv_aging_tracker_callback,	/* no callback */
+					   sm	/* no context */
 			    );
 		else
-			cl_event_wheel_reg(&p_rcv->trap_aging_tracker, trap_key, cl_get_time_stamp() + event_wheel_timeout, NULL,	/* no callback */
+			cl_event_wheel_reg(&sm->trap_aging_tracker, trap_key, cl_get_time_stamp() + event_wheel_timeout, NULL,	/* no callback */
 					   NULL	/* no context */
 			    );
 
 		/* If was already registered do nothing more */
 		if (num_received > 10 && run_heavy_sweep == FALSE) {
 			if (__print_num_received(num_received))
-				osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+				osm_log(sm->p_log, OSM_LOG_VERBOSE,
 					"__osm_trap_rcv_process_request: "
 					"Continuously received this trap %u times. Ignoring\n",
 					num_received);
@@ -651,7 +597,7 @@ __osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
 	}
 
 	/* do a sweep if we received a trap */
-	if (p_rcv->p_subn->opt.sweep_on_trap) {
+	if (sm->p_subn->opt.sweep_on_trap) {
 		/* if this is trap number 128 or run_heavy_sweep is TRUE - update the
 		   force_single_heavy_sweep flag of the subnet.
 		   Sweep also on traps 144/145 - these traps signal a change of a certain
@@ -663,15 +609,15 @@ __osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
 		     (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 144) ||
 		     (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 145) ||
 		     run_heavy_sweep)) {
-			osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			osm_log(sm->p_log, OSM_LOG_VERBOSE,
 				"__osm_trap_rcv_process_request: "
 				"Forcing immediate heavy sweep. "
 				"Received trap:%u\n",
 				cl_ntoh16(p_ntci->g_or_v.generic.trap_num));
 
-			p_rcv->p_subn->force_immediate_heavy_sweep = TRUE;
+			sm->p_subn->force_immediate_heavy_sweep = TRUE;
 		}
-		osm_sm_signal(&p_rcv->p_subn->p_osm->sm, OSM_SIGNAL_SWEEP);
+		osm_sm_signal(&sm->p_subn->p_osm->sm, OSM_SIGNAL_SWEEP);
 	}
 
 	/* If we reached here due to trap 129/130/131 - do not need to do
@@ -685,7 +631,7 @@ __osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
 	   accordingly. See IBA 1.2 p.739 or IBA 1.1 p.653 for details. */
 	if (is_gsi) {
 		if (!tmp_madw.mad_addr.addr_type.gsi.global_route) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sm->p_log, OSM_LOG_ERROR,
 				"__osm_trap_rcv_process_request: ERR 3806: "
 				"Received gsi trap with global_route FALSE. "
 				"Cannot update issuer_gid!\n");
@@ -696,14 +642,14 @@ __osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
 		       sizeof(ib_gid_t));
 	} else {
 		/* Need to use the IssuerLID */
-		p_tbl = &p_rcv->p_subn->port_lid_tbl;
+		p_tbl = &sm->p_subn->port_lid_tbl;
 
 		CL_ASSERT(cl_ptr_vector_get_size(p_tbl) < 0x10000);
 
 		if ((uint16_t) cl_ptr_vector_get_size(p_tbl) <=
 		    cl_ntoh16(source_lid)) {
 			/*  the source lid is out of range */
-			osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			osm_log(sm->p_log, OSM_LOG_VERBOSE,
 				"__osm_trap_rcv_process_request: "
 				"source lid is out of range:0x%X\n",
 				cl_ntoh16(source_lid));
@@ -713,7 +659,7 @@ __osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
 		p_port = cl_ptr_vector_get(p_tbl, cl_ntoh16(source_lid));
 		if (p_port == 0) {
 			/* We have the lid - but no corresponding port */
-			osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			osm_log(sm->p_log, OSM_LOG_VERBOSE,
 				"__osm_trap_rcv_process_request: "
 				"Cannot find port corresponding to lid:0x%X\n",
 				cl_ntoh16(source_lid));
@@ -722,16 +668,16 @@ __osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
 		}
 
 		p_ntci->issuer_gid.unicast.prefix =
-		    p_rcv->p_subn->opt.subnet_prefix;
+		    sm->p_subn->opt.subnet_prefix;
 		p_ntci->issuer_gid.unicast.interface_id = p_port->guid;
 	}
 
 	/* we need a lock here as the InformInfo DB must be stable */
-	CL_PLOCK_ACQUIRE(p_rcv->p_lock);
-	status = osm_report_notice(p_rcv->p_log, p_rcv->p_subn, p_ntci);
-	CL_PLOCK_RELEASE(p_rcv->p_lock);
+	CL_PLOCK_ACQUIRE(sm->p_lock);
+	status = osm_report_notice(sm->p_log, sm->p_subn, p_ntci);
+	CL_PLOCK_RELEASE(sm->p_lock);
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"__osm_trap_rcv_process_request: ERR 3803: "
 			"Error sending trap reports (%s)\n",
 			ib_get_err_str(status));
@@ -739,7 +685,7 @@ __osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 #if 0
@@ -747,18 +693,18 @@ __osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
  CURRENTLY WE ARE NOT CREATING TRAPS - SO THIS CALL IS AN ERROR
 **********************************************************************/
 static void
-__osm_trap_rcv_process_sm(IN const osm_trap_rcv_t * const p_rcv,
+__osm_trap_rcv_process_sm(IN osm_sm_t * sm,
 			  IN const osm_remote_sm_t * const p_sm)
 {
 	/* const ib_sm_info_t*        p_smi; */
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_trap_rcv_process_sm);
+	OSM_LOG_ENTER(sm->p_log, __osm_trap_rcv_process_sm);
 
-	osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+	osm_log(sm->p_log, OSM_LOG_ERROR,
 		"__osm_trap_rcv_process_sm: ERR 3807: "
 		"This function is not supported yet\n");
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 #endif
 
@@ -766,28 +712,28 @@ __osm_trap_rcv_process_sm(IN const osm_trap_rcv_t * const p_rcv,
  CURRENTLY WE ARE NOT CREATING TRAPS - SO THIS CALL IN AN ERROR
 **********************************************************************/
 static void
-__osm_trap_rcv_process_response(IN const osm_trap_rcv_t * const p_rcv,
+__osm_trap_rcv_process_response(IN osm_sm_t * sm,
 				IN const osm_madw_t * const p_madw)
 {
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_trap_rcv_process_response);
+	OSM_LOG_ENTER(sm->p_log, __osm_trap_rcv_process_response);
 
-	osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+	osm_log(sm->p_log, OSM_LOG_ERROR,
 		"__osm_trap_rcv_process_response: ERR 3808: "
 		"This function is not supported yet\n");
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 void osm_trap_rcv_process(IN void *context, IN void *data)
 {
-	osm_trap_rcv_t *p_rcv = context;
+	osm_sm_t *sm = context;
 	osm_madw_t *p_madw = data;
 	ib_smp_t *p_smp;
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_trap_rcv_process);
+	OSM_LOG_ENTER(sm->p_log, osm_trap_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -799,9 +745,9 @@ void osm_trap_rcv_process(IN void *context, IN void *data)
 	   SM's Trap.
 	 */
 	if (ib_smp_is_response(p_smp))
-		__osm_trap_rcv_process_response(p_rcv, p_madw);
+		__osm_trap_rcv_process_response(sm, p_madw);
 	else
-		__osm_trap_rcv_process_request(p_rcv, p_madw);
+		__osm_trap_rcv_process_request(sm, p_madw);
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
diff --git a/opensm/opensm/osm_vl_arb_rcv.c b/opensm/opensm/osm_vl_arb_rcv.c
index 78f15d6..23b081a 100644
--- a/opensm/opensm/osm_vl_arb_rcv.c
+++ b/opensm/opensm/osm_vl_arb_rcv.c
@@ -51,61 +51,15 @@
 
 #include <string.h>
 #include <iba/ib_types.h>
-#include <complib/cl_qmap.h>
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
-#include <opensm/osm_vl_arb_rcv.h>
-#include <opensm/osm_node_info_rcv.h>
 #include <opensm/osm_req.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_subnet.h>
-#include <opensm/osm_mad_pool.h>
-#include <opensm/osm_msgdef.h>
 #include <opensm/osm_helper.h>
-#include <vendor/osm_vendor_api.h>
-
-/**********************************************************************
- **********************************************************************/
-void osm_vla_rcv_construct(IN osm_vla_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_vla_rcv_destroy(IN osm_vla_rcv_t * const p_rcv)
-{
-	CL_ASSERT(p_rcv);
-
-	OSM_LOG_ENTER(p_rcv->p_log, osm_vla_rcv_destroy);
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_vla_rcv_init(IN osm_vla_rcv_t * const p_rcv,
-		 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)
-{
-	ib_api_status_t status = IB_SUCCESS;
-
-	OSM_LOG_ENTER(p_log, osm_vla_rcv_init);
-
-	osm_vla_rcv_construct(p_rcv);
-
-	p_rcv->p_log = p_log;
-	p_rcv->p_subn = p_subn;
-	p_rcv->p_lock = p_lock;
-	p_rcv->p_req = p_req;
-
-	OSM_LOG_EXIT(p_log);
-	return (status);
-}
+#include <opensm/osm_sm.h>
 
 /**********************************************************************
  **********************************************************************/
@@ -114,7 +68,7 @@ osm_vla_rcv_init(IN osm_vla_rcv_t * const p_rcv,
  */
 void osm_vla_rcv_process(IN void *context, IN void *data)
 {
-	osm_vla_rcv_t *p_rcv = context;
+	osm_sm_t *sm = context;
 	osm_madw_t *p_madw = data;
 	ib_vl_arb_table_t *p_vla_tbl;
 	ib_smp_t *p_smp;
@@ -126,9 +80,9 @@ void osm_vla_rcv_process(IN void *context, IN void *data)
 	ib_net64_t node_guid;
 	uint8_t port_num, block_num;
 
-	CL_ASSERT(p_rcv);
+	CL_ASSERT(sm);
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_vla_rcv_process);
+	OSM_LOG_ENTER(sm->p_log, osm_vla_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -142,11 +96,11 @@ void osm_vla_rcv_process(IN void *context, IN void *data)
 
 	CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_VL_ARBITRATION);
 
-	cl_plock_excl_acquire(p_rcv->p_lock);
-	p_port = osm_get_port_by_guid(p_rcv->p_subn, port_guid);
+	cl_plock_excl_acquire(sm->p_lock);
+	p_port = osm_get_port_by_guid(sm->p_subn, port_guid);
 	if (!p_port) {
-		cl_plock_release(p_rcv->p_lock);
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		cl_plock_release(sm->p_lock);
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"osm_vla_rcv_process: ERR 3F06: "
 			"No port object for port with GUID 0x%" PRIx64
 			"\n\t\t\t\tfor parent node GUID 0x%" PRIx64
@@ -175,8 +129,8 @@ void osm_vla_rcv_process(IN void *context, IN void *data)
 	   We do not mind if this is a result of a set or get - all we want is to update
 	   the subnet.
 	 */
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_VERBOSE)) {
-		osm_log(p_rcv->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_vla_rcv_process: "
 			"Got GetResp(VLArb) block:%u port_num %u with GUID 0x%"
 			PRIx64 " for parent node GUID 0x%" PRIx64 ", TID 0x%"
@@ -189,18 +143,18 @@ void osm_vla_rcv_process(IN void *context, IN void *data)
 	   If so, Ignore it.
 	 */
 	if (!osm_physp_is_valid(p_physp)) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"osm_vla_rcv_process: "
 			"Got invalid port number 0x%X\n", port_num);
 		goto Exit;
 	}
 
-	osm_dump_vl_arb_table(p_rcv->p_log,
+	osm_dump_vl_arb_table(sm->p_log,
 			      port_guid, block_num,
 			      port_num, p_vla_tbl, OSM_LOG_DEBUG);
 
 	if ((block_num < 1) || (block_num > 4)) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sm->p_log, OSM_LOG_ERROR,
 			"osm_vla_rcv_process: "
 			"Got invalid block number 0x%X\n", block_num);
 		goto Exit;
@@ -208,7 +162,7 @@ void osm_vla_rcv_process(IN void *context, IN void *data)
 	osm_physp_set_vla_tbl(p_physp, p_vla_tbl, block_num);
 
       Exit:
-	cl_plock_release(p_rcv->p_lock);
+	cl_plock_release(sm->p_lock);
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sm->p_log);
 }
-- 
1.5.3.4.206.g58ba4




More information about the general mailing list