[ofa-general] [PATCH 3/4] opensm: cleanup SA related osm_*_rcv_t objects

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


This removes SA related dummy *_rcv_t objects, eliminates data
duplications, simplifies flows, etc.. Instead of original objects a
reference to osm_sa_t is used.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/include/opensm/osm_inform.h             |    8 +-
 opensm/include/opensm/osm_qos_policy.h         |    4 +-
 opensm/include/opensm/osm_sa.h                 |  136 +++---
 opensm/include/opensm/osm_sa_class_port_info.h |    1 -
 opensm/include/opensm/osm_sa_mad_ctrl.h        |   17 +-
 opensm/include/opensm/osm_sa_mcmember_record.h |   50 ---
 opensm/include/opensm/osm_sa_response.h        |   36 --
 opensm/include/opensm/osm_sa_service_record.h  |    2 -
 opensm/opensm/osm_inform.c                     |   13 +-
 opensm/opensm/osm_prtn.c                       |    8 +-
 opensm/opensm/osm_sa.c                         |  225 +++--------
 opensm/opensm/osm_sa_class_port_info.c         |   82 +---
 opensm/opensm/osm_sa_guidinfo_record.c         |  133 ++----
 opensm/opensm/osm_sa_informinfo.c              |  254 +++++-------
 opensm/opensm/osm_sa_lft_record.c              |  127 ++----
 opensm/opensm/osm_sa_link_record.c             |  168 +++-----
 opensm/opensm/osm_sa_mad_ctrl.c                |    8 +-
 opensm/opensm/osm_sa_mcmember_record.c         |  539 +++++++++++-------------
 opensm/opensm/osm_sa_mft_record.c              |  127 ++----
 opensm/opensm/osm_sa_multipath_record.c        |  306 ++++++--------
 opensm/opensm/osm_sa_node_record.c             |  137 +++----
 opensm/opensm/osm_sa_path_record.c             |  386 ++++++++----------
 opensm/opensm/osm_sa_pkey_record.c             |  149 +++----
 opensm/opensm/osm_sa_portinfo_record.c         |  157 +++-----
 opensm/opensm/osm_sa_response.c                |   62 +---
 opensm/opensm/osm_sa_service_record.c          |  271 +++++-------
 opensm/opensm/osm_sa_slvl_record.c             |  131 ++----
 opensm/opensm/osm_sa_sminfo_record.c           |  192 ++++------
 opensm/opensm/osm_sa_sw_info_record.c          |  174 +++-----
 opensm/opensm/osm_sa_vlarb_record.c            |  167 +++-----
 30 files changed, 1566 insertions(+), 2504 deletions(-)

diff --git a/opensm/include/opensm/osm_inform.h b/opensm/include/opensm/osm_inform.h
index 0ec6a1b..5da513e 100644
--- a/opensm/include/opensm/osm_inform.h
+++ b/opensm/include/opensm/osm_inform.h
@@ -57,7 +57,7 @@
 #include <opensm/osm_subnet.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
-#include <opensm/osm_sa_informinfo.h>
+#include <opensm/osm_sa.h>
 
 #ifdef __cplusplus
 #  define BEGIN_C_DECLS extern "C" {
@@ -102,7 +102,7 @@ BEGIN_C_DECLS
 typedef struct _osm_infr_t {
 	cl_list_item_t list_item;
 	osm_bind_handle_t h_bind;
-	osm_infr_rcv_t *p_infr_rcv;
+	osm_sa_t *sa;
 	osm_mad_addr_t report_addr;
 	ib_inform_info_record_t inform_record;
 } osm_infr_t;
@@ -114,8 +114,8 @@ typedef struct _osm_infr_t {
 *	h_bind
 *		A handle of lower level mad srvc
 *
-*	p_infr_rcv
-*		The receiver of inform_info's
+*	sa
+*		A pointer to osm_sa object
 *
 *	report_addr
 *		Report address
diff --git a/opensm/include/opensm/osm_qos_policy.h b/opensm/include/opensm/osm_qos_policy.h
index d61c269..82b6258 100644
--- a/opensm/include/opensm/osm_qos_policy.h
+++ b/opensm/include/opensm/osm_qos_policy.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2007 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -52,8 +52,6 @@
 #include <opensm/st.h>
 #include <opensm/osm_port.h>
 #include <opensm/osm_partition.h>
-#include <opensm/osm_sa_path_record.h>
-#include <opensm/osm_sa_multipath_record.h>
 
 #define YYSTYPE char *
 #define OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH  128
diff --git a/opensm/include/opensm/osm_sa.h b/opensm/include/opensm/osm_sa.h
index a945833..82ca1dc 100644
--- a/opensm/include/opensm/osm_sa.h
+++ b/opensm/include/opensm/osm_sa.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2007 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -58,26 +58,9 @@
 #include <opensm/osm_subnet.h>
 #include <vendor/osm_vendor.h>
 #include <opensm/osm_mad_pool.h>
-#include <opensm/osm_sa_response.h>
 #include <opensm/osm_log.h>
-#include <opensm/osm_sa_node_record.h>
-#include <opensm/osm_sa_portinfo_record.h>
-#include <opensm/osm_sa_guidinfo_record.h>
-#include <opensm/osm_sa_link_record.h>
-#include <opensm/osm_sa_path_record.h>
-#include <opensm/osm_sa_multipath_record.h>
-#include <opensm/osm_sa_sminfo_record.h>
 #include <opensm/osm_sa_mad_ctrl.h>
-#include <opensm/osm_sa_mcmember_record.h>
-#include <opensm/osm_sa_service_record.h>
-#include <opensm/osm_sa_class_port_info.h>
-#include <opensm/osm_sa_informinfo.h>
-#include <opensm/osm_sa_slvl_record.h>
-#include <opensm/osm_sa_vlarb_record.h>
-#include <opensm/osm_sa_pkey_record.h>
-#include <opensm/osm_sa_lft_record.h>
-#include <opensm/osm_sa_sw_info_record.h>
-#include <opensm/osm_sa_mft_record.h>
+#include <opensm/osm_sm.h>
 
 #ifdef __cplusplus
 #  define BEGIN_C_DECLS extern "C" {
@@ -136,6 +119,7 @@ typedef enum _osm_sa_state {
 */
 typedef struct _osm_sa {
 	osm_sa_state_t state;
+	osm_sm_t *sm;
 	osm_subn_t *p_subn;
 	osm_vendor_t *p_vendor;
 	osm_log_t *p_log;
@@ -144,41 +128,8 @@ typedef struct _osm_sa {
 	cl_plock_t *p_lock;
 	atomic32_t sa_trans_id;
 	osm_sa_mad_ctrl_t mad_ctrl;
-	osm_sa_resp_t resp;
-	osm_cpi_rcv_t cpi_rcv;
-	osm_nr_rcv_t nr_rcv;
-	osm_pir_rcv_t pir_rcv;
-	osm_gir_rcv_t gir_rcv;
-	osm_lr_rcv_t lr_rcv;
-	osm_pr_rcv_t pr_rcv;
-	osm_smir_rcv_t smir_rcv;
-	osm_mcmr_recv_t mcmr_rcv;
-	osm_sr_rcv_t sr_rcv;
-#if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)
-	osm_mpr_rcv_t mpr_rcv;
-#endif
-
-	/* InformInfo Receiver */
-	osm_infr_rcv_t infr_rcv;
-
-	/* VL Arbitrartion Query */
-	osm_vlarb_rec_rcv_t vlarb_rec_rcv;
-
-	/* SLtoVL Map Query */
-	osm_slvl_rec_rcv_t slvl_rec_rcv;
-
-	/* P_Key table Query */
-	osm_pkey_rec_rcv_t pkey_rec_rcv;
-
-	/* LinearForwardingTable Query */
-	osm_lftr_rcv_t lftr_rcv;
-
-	/* SwitchInfo Query */
-	osm_sir_rcv_t sir_rcv;
-
-	/* MulticastForwardingTable Query */
-	osm_mftr_rcv_t mftr_rcv;
 
+	cl_timer_t sr_timer;
 	cl_disp_reg_handle_t cpi_disp_h;
 	cl_disp_reg_handle_t nr_disp_h;
 	cl_disp_reg_handle_t pir_disp_h;
@@ -205,6 +156,9 @@ typedef struct _osm_sa {
 *	state
 *		State of this SA object
 *
+*	sm
+*		Pointer to the Subnet Manager object.
+*
 *	p_subn
 *		Pointer to the Subnet object for this subnet.
 *
@@ -229,19 +183,6 @@ typedef struct _osm_sa {
 *	mad_ctrl
 *		Mad Controller
 *
-*	resp
-*		Response object
-*
-*	nr
-*
-*	pir_rcv
-*
-*	lr
-*
-*	pr
-*
-*	smir
-*
 * SEE ALSO
 *	SM object
 *********/
@@ -424,6 +365,38 @@ osm_sa_vendor_send(IN osm_bind_handle_t h_bind,
 		   IN boolean_t const resp_expected,
 		   IN osm_subn_t * const p_subn);
 
+/****f* IBA Base: Types/osm_sa_send_error
+* NAME
+*	osm_sa_send_error
+*
+* DESCRIPTION
+*	Sends a generic SA response with the specified error status.
+*	The payload is simply replicated from the request MAD.
+*
+* SYNOPSIS
+*/
+void
+osm_sa_send_error(IN osm_sa_t * sa,
+		  IN const osm_madw_t * const p_madw,
+		  IN const ib_net16_t sa_status);
+/*
+* PARAMETERS
+*	sa
+*		[in] Pointer to an osm_sa_t object.
+*
+*	p_madw
+*		[in] Original MAD to which the response must be sent.
+*
+*	sa_status
+*		[in] Status to send in the response.
+*
+* RETURN VALUES
+*	None.
+*
+* SEE ALSO
+*	SA object
+*********/
+
 struct _osm_opensm_t;
 /****f* OpenSM: SA/osm_sa_db_file_dump
 * NAME
@@ -465,5 +438,36 @@ int osm_sa_db_file_load(struct _osm_opensm_t *p_osm);
 *
 *********/
 
+/****f* OpenSM: MC Member Record Receiver/osm_mcmr_rcv_find_or_create_new_mgrp
+* NAME
+*	osm_mcmr_rcv_find_or_create_new_mgrp
+*
+* DESCRIPTION
+*	Create new Multicast group
+*
+* SYNOPSIS
+*/
+
+ib_api_status_t
+osm_mcmr_rcv_find_or_create_new_mgrp(IN osm_sa_t * sa,
+				     IN uint64_t comp_mask,
+				     IN ib_member_rec_t *
+				     const p_recvd_mcmember_rec,
+				     OUT osm_mgrp_t ** pp_mgrp);
+/*
+* PARAMETERS
+*	p_sa
+*		[in] Pointer to an osm_sa_t object.
+*	p_recvd_mcmember_rec
+*		[in] Received Multicast member record
+*
+*	pp_mgrp
+*		[out] pointer the osm_mgrp_t object
+*
+* RETURN VALUES
+*	IB_SUCCESS, IB_ERROR
+*
+*********/
+
 END_C_DECLS
 #endif				/* _OSM_SA_H_ */
diff --git a/opensm/include/opensm/osm_sa_class_port_info.h b/opensm/include/opensm/osm_sa_class_port_info.h
index 6e4c069..52b3c9e 100644
--- a/opensm/include/opensm/osm_sa_class_port_info.h
+++ b/opensm/include/opensm/osm_sa_class_port_info.h
@@ -51,7 +51,6 @@
 #include <complib/cl_passivelock.h>
 #include <opensm/osm_base.h>
 #include <opensm/osm_madw.h>
-#include <opensm/osm_sa_response.h>
 #include <opensm/osm_subnet.h>
 #include <opensm/osm_port.h>
 #include <opensm/osm_log.h>
diff --git a/opensm/include/opensm/osm_sa_mad_ctrl.h b/opensm/include/opensm/osm_sa_mad_ctrl.h
index bd7751e..a51c0b6 100644
--- a/opensm/include/opensm/osm_sa_mad_ctrl.h
+++ b/opensm/include/opensm/osm_sa_mad_ctrl.h
@@ -55,7 +55,6 @@
 #include <opensm/osm_madw.h>
 #include <opensm/osm_mad_pool.h>
 #include <opensm/osm_log.h>
-#include <opensm/osm_sa_response.h>
 
 #ifdef __cplusplus
 #  define BEGIN_C_DECLS extern "C" {
@@ -83,6 +82,8 @@ BEGIN_C_DECLS
 *	Ranjit Pandit, Intel
 *
 *********/
+
+struct _osm_sa;
 /****s* OpenSM: SA MAD Controller/osm_sa_mad_ctrl_t
 * NAME
 *	osm_sa_mad_ctrl_t
@@ -96,6 +97,7 @@ BEGIN_C_DECLS
 * SYNOPSIS
 */
 typedef struct _osm_sa_mad_ctrl {
+	struct _osm_sa *sa;
 	osm_log_t *p_log;
 	osm_mad_pool_t *p_mad_pool;
 	osm_vendor_t *p_vendor;
@@ -104,10 +106,12 @@ typedef struct _osm_sa_mad_ctrl {
 	cl_disp_reg_handle_t h_disp;
 	osm_stats_t *p_stats;
 	osm_subn_t *p_subn;
-	osm_sa_resp_t *p_resp;
 } osm_sa_mad_ctrl_t;
 /*
 * FIELDS
+*	sa
+*		Pointer to the SA object.
+*
 *	p_log
 *		Pointer to the log object.
 *
@@ -129,9 +133,6 @@ typedef struct _osm_sa_mad_ctrl {
 *	p_stats
 *		Pointer to the OpenSM statistics block.
 *
-*  p_resp
-*     Pointer to the SA response manager
-*
 * SEE ALSO
 *	SA MAD Controller object
 *	SA MADr object
@@ -209,7 +210,7 @@ void osm_sa_mad_ctrl_destroy(IN osm_sa_mad_ctrl_t * const p_ctrl);
 * SYNOPSIS
 */
 ib_api_status_t osm_sa_mad_ctrl_init(IN osm_sa_mad_ctrl_t * const p_ctrl,
-				     IN osm_sa_resp_t * const p_resp,
+				     IN struct _osm_sa * sa,
 				     IN osm_mad_pool_t * const p_mad_pool,
 				     IN osm_vendor_t * const p_vendor,
 				     IN osm_subn_t * const p_subn,
@@ -221,8 +222,8 @@ ib_api_status_t osm_sa_mad_ctrl_init(IN osm_sa_mad_ctrl_t * const p_ctrl,
 *	p_ctrl
 *		[in] Pointer to an osm_sa_mad_ctrl_t object to initialize.
 *
-*  p_resp
-*     [in] Pointer to the response SA manager object
+*	sa
+*		[in] Pointer to the SA object.
 *
 *	p_mad_pool
 *		[in] Pointer to the MAD pool.
diff --git a/opensm/include/opensm/osm_sa_mcmember_record.h b/opensm/include/opensm/osm_sa_mcmember_record.h
index 8540a89..09db580 100644
--- a/opensm/include/opensm/osm_sa_mcmember_record.h
+++ b/opensm/include/opensm/osm_sa_mcmember_record.h
@@ -103,7 +103,6 @@ typedef struct _osm_mcmr {
 	osm_mad_pool_t *p_mad_pool;
 	osm_log_t *p_log;
 	cl_plock_t *p_lock;
-	uint16_t mlid_ho;
 } osm_mcmr_recv_t;
 
 /*
@@ -302,54 +301,5 @@ osm_mcmr_rcv_create_new_mgrp(IN osm_mcmr_recv_t * const p_mcmr,
 *
 *********/
 
-/****f* OpenSM: MC Member Record Receiver/osm_mcmr_rcv_find_or_create_new_mgrp
-* NAME
-*	osm_mcmr_rcv_find_or_create_new_mgrp
-*
-* DESCRIPTION
-*	Create new Multicast group
-*
-* SYNOPSIS
-*/
-
-ib_api_status_t
-osm_mcmr_rcv_find_or_create_new_mgrp(IN osm_mcmr_recv_t * const p_mcmr,
-				     IN uint64_t comp_mask,
-				     IN ib_member_rec_t *
-				     const p_recvd_mcmember_rec,
-				     OUT osm_mgrp_t ** pp_mgrp);
-/*
-* PARAMETERS
-*	p_mcmr
-*		[in] Pointer to an osm_mcmr_recv_t object.
-*	p_recvd_mcmember_rec
-*		[in] Received Multicast member record
-*
-*	pp_mgrp
-*		[out] pointer the osm_mgrp_t object
-*
-* RETURN VALUES
-*	IB_SUCCESS, IB_ERROR
-*
-* NOTES
-*
-*
-* SEE ALSO
-*
-*********/
-
-#define JOIN_MC_COMP_MASK	(IB_MCR_COMPMASK_MGID |		\
-							IB_MCR_COMPMASK_PORT_GID |	\
-							IB_MCR_COMPMASK_JOIN_STATE)
-
-#define REQUIRED_MC_CREATE_COMP_MASK	(IB_MCR_COMPMASK_MGID		| \
-										IB_MCR_COMPMASK_PORT_GID	| \
-										IB_MCR_COMPMASK_JOIN_STATE	| \
-										IB_MCR_COMPMASK_QKEY		| \
-										IB_MCR_COMPMASK_TCLASS		| \
-										IB_MCR_COMPMASK_PKEY		| \
-										IB_MCR_COMPMASK_FLOW		| \
-										IB_MCR_COMPMASK_SL)
-
 END_C_DECLS
 #endif				/* _OSM_MCMR_H_ */
diff --git a/opensm/include/opensm/osm_sa_response.h b/opensm/include/opensm/osm_sa_response.h
index 8e2c15e..53c4f95 100644
--- a/opensm/include/opensm/osm_sa_response.h
+++ b/opensm/include/opensm/osm_sa_response.h
@@ -208,41 +208,5 @@ osm_sa_resp_init(IN osm_sa_resp_t * const p_resp,
 *	osm_sa_resp_destroy
 *********/
 
-/****f* IBA Base: Types/osm_sa_send_error
-* NAME
-*	osm_sa_send_error
-*
-* DESCRIPTION
-*	Sends a generic SA response with the specified error status.
-*	The payload is simply replicated from the request MAD.
-*
-* SYNOPSIS
-*/
-void
-osm_sa_send_error(IN osm_sa_resp_t * const p_resp,
-		  IN const osm_madw_t * const p_madw,
-		  IN const ib_net16_t sa_status);
-/*
-* PARAMETERS
-*	p_resp
-*		[in] Pointer to an osm_sa_resp_t object.
-*
-*	p_madw
-*		[in] Original MAD to which the response must be sent.
-*
-*	sa_status
-*		[in] Status to send in the response.
-*
-* RETURN VALUES
-*	None.
-*
-* NOTES
-*	Allows calling other SA Response methods.
-*
-* SEE ALSO
-*	SA Response object, osm_sa_resp_construct,
-*	osm_sa_resp_destroy
-*********/
-
 END_C_DECLS
 #endif				/* _OSM_SA_RESP_H_ */
diff --git a/opensm/include/opensm/osm_sa_service_record.h b/opensm/include/opensm/osm_sa_service_record.h
index 43859e0..63bcc46 100644
--- a/opensm/include/opensm/osm_sa_service_record.h
+++ b/opensm/include/opensm/osm_sa_service_record.h
@@ -50,7 +50,6 @@
 #define _OSM_SR_H_
 
 #include <complib/cl_passivelock.h>
-#include <complib/cl_timer.h>
 #include <opensm/osm_base.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_sa_response.h>
@@ -102,7 +101,6 @@ typedef struct _osm_sr_rcv {
 	osm_mad_pool_t *p_mad_pool;
 	osm_log_t *p_log;
 	cl_plock_t *p_lock;
-	cl_timer_t sr_timer;
 } osm_sr_rcv_t;
 /*
 * FIELDS
diff --git a/opensm/opensm/osm_inform.c b/opensm/opensm/osm_inform.c
index e488e3b..151b1dc 100644
--- a/opensm/opensm/osm_inform.c
+++ b/opensm/opensm/osm_inform.c
@@ -50,7 +50,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <complib/cl_debug.h>
-#include <opensm/osm_sa_informinfo.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_inform.h>
 #include <vendor/osm_vendor_api.h>
@@ -115,7 +114,7 @@ __match_inf_rec(IN const cl_list_item_t * const p_list_item, IN void *context)
 {
 	osm_infr_t *p_infr_rec = (osm_infr_t *) context;
 	osm_infr_t *p_infr = (osm_infr_t *) p_list_item;
-	osm_log_t *p_log = p_infr_rec->p_infr_rcv->p_log;
+	osm_log_t *p_log = p_infr_rec->sa->p_log;
 	cl_status_t status = CL_NOT_FOUND;
 	ib_gid_t all_zero_gid;
 
@@ -339,7 +338,7 @@ static ib_api_status_t __osm_send_report(IN osm_infr_t * p_infr_rec,	/* the info
 	ib_sa_mad_t *p_sa_mad;
 	static atomic32_t trap_fwd_trans_id = 0x02DAB000;
 	ib_api_status_t status;
-	osm_log_t *p_log = p_infr_rec->p_infr_rcv->p_log;
+	osm_log_t *p_log = p_infr_rec->sa->p_log;
 
 	OSM_LOG_ENTER(p_log, __osm_send_report);
 
@@ -354,7 +353,7 @@ static ib_api_status_t __osm_send_report(IN osm_infr_t * p_infr_rec,	/* the info
 		cl_ntoh16(p_infr_rec->report_addr.dest_lid), trap_fwd_trans_id);
 
 	/* get the MAD to send */
-	p_report_madw = osm_mad_pool_get(p_infr_rec->p_infr_rcv->p_mad_pool,
+	p_report_madw = osm_mad_pool_get(p_infr_rec->sa->p_mad_pool,
 					 p_infr_rec->h_bind,
 					 MAD_BLOCK_SIZE,
 					 &(p_infr_rec->report_addr));
@@ -387,7 +386,7 @@ static ib_api_status_t __osm_send_report(IN osm_infr_t * p_infr_rec,	/* the info
 
 	/* The TRUE is for: response is expected */
 	status = osm_sa_vendor_send(p_report_madw->h_bind, p_report_madw, TRUE,
-				    p_infr_rec->p_infr_rcv->p_subn);
+				    p_infr_rec->sa->p_subn);
 	if (status != IB_SUCCESS) {
 		osm_log(p_log, OSM_LOG_ERROR,
 			"__osm_send_report: ERR 0204: "
@@ -416,8 +415,8 @@ __match_notice_to_inf_rec(IN cl_list_item_t * const p_list_item,
 	osm_infr_t *p_infr_rec = (osm_infr_t *) p_list_item;
 	ib_inform_info_t *p_ii = &(p_infr_rec->inform_record.inform_info);
 	cl_status_t status = CL_NOT_FOUND;
-	osm_log_t *p_log = p_infr_rec->p_infr_rcv->p_log;
-	osm_subn_t *p_subn = p_infr_rec->p_infr_rcv->p_subn;
+	osm_log_t *p_log = p_infr_rec->sa->p_log;
+	osm_subn_t *p_subn = p_infr_rec->sa->p_subn;
 	ib_gid_t source_gid;
 	osm_port_t *p_src_port;
 	osm_port_t *p_dest_port;
diff --git a/opensm/opensm/osm_prtn.c b/opensm/opensm/osm_prtn.c
index f0168fc..15a9c2a 100644
--- a/opensm/opensm/osm_prtn.c
+++ b/opensm/opensm/osm_prtn.c
@@ -224,8 +224,7 @@ ib_api_status_t osm_prtn_add_mcgroup(osm_log_t * p_log,
 	/* don't update rate, mtu */
 	comp_mask = IB_MCR_COMPMASK_MTU | IB_MCR_COMPMASK_MTU_SEL |
 	    IB_MCR_COMPMASK_RATE | IB_MCR_COMPMASK_RATE_SEL;
-	status = osm_mcmr_rcv_find_or_create_new_mgrp(&p_sa->mcmr_rcv,
-						      comp_mask, &mc_rec,
+	status = osm_mcmr_rcv_find_or_create_new_mgrp(p_sa, comp_mask, &mc_rec,
 						      &p_mgrp);
 	if (!p_mgrp || status != IB_SUCCESS)
 		osm_log(p_log, OSM_LOG_ERROR,
@@ -243,9 +242,8 @@ ib_api_status_t osm_prtn_add_mcgroup(osm_log_t * p_log,
 	mc_rec.scope_state = ib_member_set_scope_state(scope, IB_MC_REC_STATE_FULL_MEMBER);
 	ib_mgid_set_scope(&mc_rec.mgid, scope);
 
-	status =
-	    osm_mcmr_rcv_find_or_create_new_mgrp(&p_sa->mcmr_rcv, comp_mask,
-						 &mc_rec, &p_mgrp);
+	status = osm_mcmr_rcv_find_or_create_new_mgrp(p_sa, comp_mask, &mc_rec,
+						      &p_mgrp);
 	if (p_mgrp)
 		p_mgrp->well_known = TRUE;
 
diff --git a/opensm/opensm/osm_sa.c b/opensm/opensm/osm_sa.c
index 248f20d..740fef5 100644
--- a/opensm/opensm/osm_sa.c
+++ b/opensm/opensm/osm_sa.c
@@ -59,7 +59,6 @@
 #include <complib/cl_debug.h>
 #include <iba/ib_types.h>
 #include <opensm/osm_sa.h>
-#include <opensm/osm_sa_response.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_subnet.h>
@@ -73,6 +72,26 @@
 
 #define  OSM_SA_INITIAL_TID_VALUE 0xabc
 
+extern void osm_cpi_rcv_process(IN void *context, IN void *data);
+extern void osm_gir_rcv_process(IN void *context, IN void *data);
+extern void osm_infr_rcv_process(IN void *context, IN void *data);
+extern void osm_infir_rcv_process(IN void *context, IN void *data);
+extern void osm_lftr_rcv_process(IN void *context, IN void *data);
+extern void osm_lr_rcv_process(IN void *context, IN void *data);
+extern void osm_mcmr_rcv_process(IN void *context, IN void *data);
+extern void osm_mftr_rcv_process(IN void *context, IN void *data);
+extern void osm_mpr_rcv_process(IN void *context, IN void *data);
+extern void osm_nr_rcv_process(IN void *context, IN void *data);
+extern void osm_pr_rcv_process(IN void *context, IN void *data);
+extern void osm_pkey_rec_rcv_process(IN void *context, IN void *data);
+extern void osm_pir_rcv_process(IN void *context, IN void *data);
+extern void osm_sr_rcv_process(IN void *context, IN void *data);
+extern void osm_slvl_rec_rcv_process(IN void *context, IN void *data);
+extern void osm_smir_rcv_process(IN void *context, IN void *data);
+extern void osm_sir_rcv_process(IN void *context, IN void *data);
+extern void osm_vlarb_rec_rcv_process(IN void *context, IN void *data);
+extern void osm_sr_rcv_lease_cb(IN void *context);
+
 /**********************************************************************
  **********************************************************************/
 void osm_sa_construct(IN osm_sa_t * const p_sa)
@@ -81,25 +100,7 @@ void osm_sa_construct(IN osm_sa_t * const p_sa)
 	p_sa->state = OSM_SA_STATE_INIT;
 	p_sa->sa_trans_id = OSM_SA_INITIAL_TID_VALUE;
 
-	osm_sa_resp_construct(&p_sa->resp);
-	osm_nr_rcv_construct(&p_sa->nr_rcv);
-	osm_pir_rcv_construct(&p_sa->pir_rcv);
-	osm_gir_rcv_construct(&p_sa->gir_rcv);
-	osm_lr_rcv_construct(&p_sa->lr_rcv);
-	osm_pr_rcv_construct(&p_sa->pr_rcv);
-#if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)
-	osm_mpr_rcv_construct(&p_sa->mpr_rcv);
-#endif
-	osm_smir_rcv_construct(&p_sa->smir_rcv);
-	osm_mcmr_rcv_construct(&p_sa->mcmr_rcv);
-	osm_sr_rcv_construct(&p_sa->sr_rcv);
-	osm_infr_rcv_construct(&p_sa->infr_rcv);
-	osm_vlarb_rec_rcv_construct(&p_sa->vlarb_rec_rcv);
-	osm_slvl_rec_rcv_construct(&p_sa->slvl_rec_rcv);
-	osm_pkey_rec_rcv_construct(&p_sa->pkey_rec_rcv);
-	osm_lftr_rcv_construct(&p_sa->lftr_rcv);
-	osm_sir_rcv_construct(&p_sa->sir_rcv);
-	osm_mftr_rcv_construct(&p_sa->mftr_rcv);
+	cl_timer_construct(&p_sa->sr_timer);
 }
 
 /**********************************************************************
@@ -109,6 +110,8 @@ void osm_sa_shutdown(IN osm_sa_t * const p_sa)
 	ib_api_status_t status;
 	OSM_LOG_ENTER(p_sa->p_log, osm_sa_shutdown);
 
+	cl_timer_stop(&p_sa->sr_timer);
+
 	/* unbind from the mad service */
 	status = osm_sa_mad_ctrl_unbind(&p_sa->mad_ctrl);
 
@@ -145,25 +148,7 @@ void osm_sa_destroy(IN osm_sa_t * const p_sa)
 
 	p_sa->state = OSM_SA_STATE_INIT;
 
-	osm_nr_rcv_destroy(&p_sa->nr_rcv);
-	osm_pir_rcv_destroy(&p_sa->pir_rcv);
-	osm_gir_rcv_destroy(&p_sa->gir_rcv);
-	osm_lr_rcv_destroy(&p_sa->lr_rcv);
-	osm_pr_rcv_destroy(&p_sa->pr_rcv);
-#if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)
-	osm_mpr_rcv_destroy(&p_sa->mpr_rcv);
-#endif
-	osm_smir_rcv_destroy(&p_sa->smir_rcv);
-	osm_mcmr_rcv_destroy(&p_sa->mcmr_rcv);
-	osm_sr_rcv_destroy(&p_sa->sr_rcv);
-	osm_infr_rcv_destroy(&p_sa->infr_rcv);
-	osm_vlarb_rec_rcv_destroy(&p_sa->vlarb_rec_rcv);
-	osm_slvl_rec_rcv_destroy(&p_sa->slvl_rec_rcv);
-	osm_pkey_rec_rcv_destroy(&p_sa->pkey_rec_rcv);
-	osm_lftr_rcv_destroy(&p_sa->lftr_rcv);
-	osm_sir_rcv_destroy(&p_sa->sir_rcv);
-	osm_mftr_rcv_destroy(&p_sa->mftr_rcv);
-	osm_sa_resp_destroy(&p_sa->resp);
+	cl_timer_destroy(&p_sa->sr_timer);
 
 	OSM_LOG_EXIT(p_sa->p_log);
 }
@@ -184,6 +169,7 @@ osm_sa_init(IN osm_sm_t * const p_sm,
 
 	OSM_LOG_ENTER(p_log, osm_sa_init);
 
+	p_sa->sm = p_sm;
 	p_sa->p_subn = p_subn;
 	p_sa->p_vendor = p_vendor;
 	p_sa->p_mad_pool = p_mad_pool;
@@ -193,228 +179,113 @@ osm_sa_init(IN osm_sm_t * const p_sm,
 
 	p_sa->state = OSM_SA_STATE_READY;
 
-	status = osm_sa_resp_init(&p_sa->resp, p_sa->p_mad_pool, p_subn, p_log);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
 	status = osm_sa_mad_ctrl_init(&p_sa->mad_ctrl,
-				      &p_sa->resp,
+				      p_sa,
 				      p_sa->p_mad_pool,
 				      p_sa->p_vendor,
 				      p_subn, p_log, p_stats, p_disp);
 	if (status != IB_SUCCESS)
 		goto Exit;
 
-	status = osm_cpi_rcv_init(&p_sa->cpi_rcv,
-				  &p_sa->resp,
-				  p_sa->p_mad_pool, p_subn, p_log, p_lock);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-	status = osm_nr_rcv_init(&p_sa->nr_rcv,
-				 &p_sa->resp,
-				 p_sa->p_mad_pool, p_subn, p_log, p_lock);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-	status = osm_pir_rcv_init(&p_sa->pir_rcv,
-				  &p_sa->resp,
-				  p_sa->p_mad_pool, p_subn, p_log, p_lock);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-	status = osm_gir_rcv_init(&p_sa->gir_rcv,
-				  &p_sa->resp,
-				  p_sa->p_mad_pool, p_subn, p_log, p_lock);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-	status = osm_lr_rcv_init(&p_sa->lr_rcv,
-				 &p_sa->resp,
-				 p_sa->p_mad_pool, p_subn, p_log, p_lock);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-	status = osm_pr_rcv_init(&p_sa->pr_rcv,
-				 &p_sa->resp,
-				 p_sa->p_mad_pool, p_subn, p_log, p_lock);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-#if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)
-	status = osm_mpr_rcv_init(&p_sa->mpr_rcv,
-				  &p_sa->resp,
-				  p_sa->p_mad_pool, p_subn, p_log, p_lock);
-	if (status != IB_SUCCESS)
-		goto Exit;
-#endif
-
-	status = osm_smir_rcv_init(&p_sa->smir_rcv,
-				   &p_sa->resp,
-				   p_sa->p_mad_pool,
-				   p_subn, p_stats, p_log, p_lock);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-	status = osm_mcmr_rcv_init(p_sm,
-				   &p_sa->mcmr_rcv,
-				   &p_sa->resp,
-				   p_sa->p_mad_pool, p_subn, p_log, p_lock);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-	status = osm_sr_rcv_init(&p_sa->sr_rcv,
-				 &p_sa->resp,
-				 p_sa->p_mad_pool, p_subn, p_log, p_lock);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-	status = osm_infr_rcv_init(&p_sa->infr_rcv,
-				   &p_sa->resp,
-				   p_sa->p_mad_pool, p_subn, p_log, p_lock);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-	status = osm_vlarb_rec_rcv_init(&p_sa->vlarb_rec_rcv,
-					&p_sa->resp,
-					p_sa->p_mad_pool,
-					p_subn, p_log, p_lock);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-	status = osm_slvl_rec_rcv_init(&p_sa->slvl_rec_rcv,
-				       &p_sa->resp,
-				       p_sa->p_mad_pool, p_subn, p_log, p_lock);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-	status = osm_pkey_rec_rcv_init(&p_sa->pkey_rec_rcv,
-				       &p_sa->resp,
-				       p_sa->p_mad_pool, p_subn, p_log, p_lock);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-	status = osm_lftr_rcv_init(&p_sa->lftr_rcv,
-				   &p_sa->resp,
-				   p_sa->p_mad_pool, p_subn, p_log, p_lock);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-	status = osm_sir_rcv_init(&p_sa->sir_rcv,
-				  &p_sa->resp,
-				  p_sa->p_mad_pool, p_subn, p_log, p_lock);
-	if (status != IB_SUCCESS)
-		goto Exit;
-
-	status = osm_mftr_rcv_init(&p_sa->mftr_rcv,
-				   &p_sa->resp,
-				   p_sa->p_mad_pool, p_subn, p_log, p_lock);
+	status = cl_timer_init(&p_sa->sr_timer, osm_sr_rcv_lease_cb, p_sa);
 	if (status != IB_SUCCESS)
 		goto Exit;
 
 	p_sa->cpi_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_CLASS_PORT_INFO,
-					    osm_cpi_rcv_process,
-					    &p_sa->cpi_rcv);
+					    osm_cpi_rcv_process, p_sa);
 	if (p_sa->cpi_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sa->nr_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_NODE_RECORD,
-					   osm_nr_rcv_process, &p_sa->nr_rcv);
+					   osm_nr_rcv_process, p_sa);
 	if (p_sa->nr_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sa->pir_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_PORTINFO_RECORD,
-					    osm_pir_rcv_process,
-					    &p_sa->pir_rcv);
+					    osm_pir_rcv_process, p_sa);
 	if (p_sa->pir_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sa->gir_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_GUIDINFO_RECORD,
-					    osm_gir_rcv_process,
-					    &p_sa->gir_rcv);
+					    osm_gir_rcv_process, p_sa);
 	if (p_sa->gir_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sa->lr_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_LINK_RECORD,
-					   osm_lr_rcv_process, &p_sa->lr_rcv);
+					   osm_lr_rcv_process, p_sa);
 	if (p_sa->lr_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sa->pr_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_PATH_RECORD,
-					   osm_pr_rcv_process, &p_sa->pr_rcv);
+					   osm_pr_rcv_process, p_sa);
 	if (p_sa->pr_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 #if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)
 	p_sa->mpr_disp_h =
 	    cl_disp_register(p_disp, OSM_MSG_MAD_MULTIPATH_RECORD,
-			     osm_mpr_rcv_process, &p_sa->mpr_rcv);
+			     osm_mpr_rcv_process, p_sa);
 	if (p_sa->mpr_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 #endif
 
 	p_sa->smir_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_SMINFO_RECORD,
-					     osm_smir_rcv_process,
-					     &p_sa->smir_rcv);
+					     osm_smir_rcv_process, p_sa);
 	if (p_sa->smir_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sa->mcmr_disp_h =
 	    cl_disp_register(p_disp, OSM_MSG_MAD_MCMEMBER_RECORD,
-			     osm_mcmr_rcv_process, &p_sa->mcmr_rcv);
+			     osm_mcmr_rcv_process, p_sa);
 	if (p_sa->mcmr_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sa->sr_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_SERVICE_RECORD,
-					   osm_sr_rcv_process, &p_sa->sr_rcv);
+					   osm_sr_rcv_process, p_sa);
 	if (p_sa->sr_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sa->infr_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_INFORM_INFO,
-					     osm_infr_rcv_process,
-					     &p_sa->infr_rcv);
+					     osm_infr_rcv_process, p_sa);
 	if (p_sa->infr_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sa->infir_disp_h =
 	    cl_disp_register(p_disp, OSM_MSG_MAD_INFORM_INFO_RECORD,
-			     osm_infir_rcv_process, &p_sa->infr_rcv);
+			     osm_infir_rcv_process, p_sa);
 	if (p_sa->infir_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sa->vlarb_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_VL_ARB_RECORD,
-					      osm_vlarb_rec_rcv_process,
-					      &p_sa->vlarb_rec_rcv);
+					      osm_vlarb_rec_rcv_process, p_sa);
 	if (p_sa->vlarb_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sa->slvl_disp_h =
 	    cl_disp_register(p_disp, OSM_MSG_MAD_SLVL_TBL_RECORD,
-			     osm_slvl_rec_rcv_process, &p_sa->slvl_rec_rcv);
+			     osm_slvl_rec_rcv_process, p_sa);
 	if (p_sa->slvl_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sa->pkey_disp_h =
 	    cl_disp_register(p_disp, OSM_MSG_MAD_PKEY_TBL_RECORD,
-			     osm_pkey_rec_rcv_process, &p_sa->pkey_rec_rcv);
+			     osm_pkey_rec_rcv_process, p_sa);
 	if (p_sa->pkey_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sa->lft_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_LFT_RECORD,
-					    osm_lftr_rcv_process,
-					    &p_sa->lftr_rcv);
+					    osm_lftr_rcv_process, p_sa);
 	if (p_sa->lft_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sa->sir_disp_h =
 	    cl_disp_register(p_disp, OSM_MSG_MAD_SWITCH_INFO_RECORD,
-			     osm_sir_rcv_process, &p_sa->sir_rcv);
+			     osm_sir_rcv_process, p_sa);
 	if (p_sa->sir_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sa->mft_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_MFT_RECORD,
-					    osm_mftr_rcv_process,
-					    &p_sa->mftr_rcv);
+					    osm_mftr_rcv_process, p_sa);
 	if (p_sa->mft_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
@@ -711,7 +582,7 @@ static osm_mgrp_t *load_mcgroup(osm_opensm_t * p_osm, ib_net16_t mlid,
 
 	comp_mask = IB_MCR_COMPMASK_MTU | IB_MCR_COMPMASK_MTU_SEL
 	    | IB_MCR_COMPMASK_RATE | IB_MCR_COMPMASK_RATE_SEL;
-	if (osm_mcmr_rcv_find_or_create_new_mgrp(&p_osm->sa.mcmr_rcv,
+	if (osm_mcmr_rcv_find_or_create_new_mgrp(&p_osm->sa,
 						 comp_mask, p_mcm_rec,
 						 &p_mgrp) != IB_SUCCESS ||
 	    !p_mgrp || p_mgrp->mlid != mlid) {
@@ -761,7 +632,7 @@ static int load_svcr(osm_opensm_t * p_osm, ib_service_record_t * sr,
 	osm_svcr_insert_to_db(&p_osm->subn, &p_osm->log, p_svcr);
 
 	if (lease_period != 0xffffffff)
-		cl_timer_trim(&p_osm->sa.sr_rcv.sr_timer, 1000);
+		cl_timer_trim(&p_osm->sa.sr_timer, 1000);
 
       _out:
 	cl_plock_release(&p_osm->lock);
@@ -776,7 +647,7 @@ static int load_infr(osm_opensm_t * p_osm, ib_inform_info_record_t * iir,
 	int ret = 0;
 
 	infr.h_bind = p_osm->sa.mad_ctrl.h_bind;
-	infr.p_infr_rcv = &p_osm->sa.infr_rcv;
+	infr.sa = &p_osm->sa;
 	/* other possible way to restore mad_addr partially is
 	   to extract qpn from InformInfo and to find lid by gid */
 	infr.report_addr = *addr;
diff --git a/opensm/opensm/osm_sa_class_port_info.c b/opensm/opensm/osm_sa_class_port_info.c
index 8a49398..4f62761 100644
--- a/opensm/opensm/osm_sa_class_port_info.c
+++ b/opensm/opensm/osm_sa_class_port_info.c
@@ -55,8 +55,6 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
-#include <opensm/osm_sa_class_port_info.h>
-#include <vendor/osm_vendor.h>
 #include <vendor/osm_vendor_api.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_sa.h>
@@ -74,48 +72,8 @@ static uint32_t __msecs_to_rtv_table[MAX_MSECS_TO_RTV] = { 1, 2, 4, 8,
 
 /**********************************************************************
  **********************************************************************/
-void osm_cpi_rcv_construct(IN osm_cpi_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_cpi_rcv_destroy(IN osm_cpi_rcv_t * const p_rcv)
-{
-	OSM_LOG_ENTER(p_rcv->p_log, osm_cpi_rcv_destroy);
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_cpi_rcv_init(IN osm_cpi_rcv_t * const p_rcv,
-		 IN osm_sa_resp_t * const p_resp,
-		 IN osm_mad_pool_t * const p_mad_pool,
-		 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_cpi_rcv_init);
-
-	osm_cpi_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_resp = p_resp;
-	p_rcv->p_mad_pool = p_mad_pool;
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-	return (status);
-}
-
-/**********************************************************************
- **********************************************************************/
 static void
-__osm_cpi_rcv_respond(IN osm_cpi_rcv_t * const p_rcv,
+__osm_cpi_rcv_respond(IN osm_sa_t * sa,
 		      IN const osm_madw_t * const p_madw)
 {
 	osm_madw_t *p_resp_madw;
@@ -126,18 +84,18 @@ __osm_cpi_rcv_respond(IN osm_cpi_rcv_t * const p_rcv,
 	ib_gid_t zero_gid;
 	uint8_t rtv;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_cpi_rcv_respond);
+	OSM_LOG_ENTER(sa->p_log, __osm_cpi_rcv_respond);
 
 	memset(&zero_gid, 0, sizeof(ib_gid_t));
 
 	/*
 	   Get a MAD to reply. Address of Mad is in the received mad_wrapper
 	 */
-	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+	p_resp_madw = osm_mad_pool_get(sa->p_mad_pool,
 				       p_madw->h_bind,
 				       MAD_BLOCK_SIZE, &p_madw->mad_addr);
 	if (!p_resp_madw) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_cpi_rcv_respond: ERR 1408: "
 			"Unable to allocate MAD\n");
 		goto Exit;
@@ -159,12 +117,12 @@ __osm_cpi_rcv_respond(IN osm_cpi_rcv_t * const p_rcv,
 	p_resp_cpi->class_ver = 2;
 	/* Calculate encoded response time value */
 	/* transaction timeout is in msec */
-	if (p_rcv->p_subn->opt.transaction_timeout >
+	if (sa->p_subn->opt.transaction_timeout >
 	    __msecs_to_rtv_table[MAX_MSECS_TO_RTV])
 		rtv = MAX_MSECS_TO_RTV - 1;
 	else {
 		for (rtv = 0; rtv < MAX_MSECS_TO_RTV; rtv++) {
-			if (p_rcv->p_subn->opt.transaction_timeout <=
+			if (sa->p_subn->opt.transaction_timeout <=
 			    __msecs_to_rtv_table[rtv])
 				break;
 		}
@@ -209,28 +167,28 @@ __osm_cpi_rcv_respond(IN osm_cpi_rcv_t * const p_rcv,
 	p_resp_cpi->cap_mask = OSM_CAP_IS_SUBN_GET_SET_NOTICE_SUP |
 	    OSM_CAP_IS_PORT_INFO_CAPMASK_MATCH_SUPPORTED;
 #endif
-	if (p_rcv->p_subn->opt.qos)
+	if (sa->p_subn->opt.qos)
 		ib_class_set_cap_mask2(p_resp_cpi, OSM_CAP2_IS_QOS_SUPPORTED);
 
-	if (p_rcv->p_subn->opt.no_multicast_option != TRUE)
+	if (sa->p_subn->opt.no_multicast_option != TRUE)
 		p_resp_cpi->cap_mask |= OSM_CAP_IS_UD_MCAST_SUP;
 	p_resp_cpi->cap_mask = cl_hton16(p_resp_cpi->cap_mask);
 
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_FRAMES))
-		osm_dump_sa_mad(p_rcv->p_log, p_resp_sa_mad, OSM_LOG_FRAMES);
+	if (osm_log_is_active(sa->p_log, OSM_LOG_FRAMES))
+		osm_dump_sa_mad(sa->p_log, p_resp_sa_mad, OSM_LOG_FRAMES);
 
 	status = osm_sa_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE,
-				    p_rcv->p_subn);
+				    sa->p_subn);
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_cpi_rcv_respond: ERR 1409: "
 			"Unable to send MAD (%s)\n", ib_get_err_str(status));
-		/*  osm_mad_pool_put( p_rcv->p_mad_pool, p_resp_madw ); */
+		/*  osm_mad_pool_put( sa->p_mad_pool, p_resp_madw ); */
 		goto Exit;
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
@@ -238,11 +196,11 @@ __osm_cpi_rcv_respond(IN osm_cpi_rcv_t * const p_rcv,
  **********************************************************************/
 void osm_cpi_rcv_process(IN void *context, IN void *data)
 {
-	osm_cpi_rcv_t *p_rcv = context;
+	osm_sa_t *sa = context;
 	osm_madw_t *p_madw = data;
 	const ib_sa_mad_t *p_sa_mad;
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_cpi_rcv_process);
+	OSM_LOG_ENTER(sa->p_log, osm_cpi_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -250,11 +208,11 @@ void osm_cpi_rcv_process(IN void *context, IN void *data)
 
 	/* we only support GET */
 	if (p_sa_mad->method != IB_MAD_METHOD_GET) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_cpi_rcv_process: ERR 1403: "
 			"Unsupported Method (%s)\n",
 			ib_get_sa_method_str(p_sa_mad->method));
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_REQ_INVALID);
 		goto Exit;
 	}
@@ -265,8 +223,8 @@ void osm_cpi_rcv_process(IN void *context, IN void *data)
 	   CLASS PORT INFO does not really look on the SMDB - no lock required.
 	 */
 
-	__osm_cpi_rcv_respond(p_rcv, p_madw);
+	__osm_cpi_rcv_respond(sa, p_madw);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
diff --git a/opensm/opensm/osm_sa_guidinfo_record.c b/opensm/opensm/osm_sa_guidinfo_record.c
index a758888..a2c47bb 100644
--- a/opensm/opensm/osm_sa_guidinfo_record.c
+++ b/opensm/opensm/osm_sa_guidinfo_record.c
@@ -54,10 +54,9 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
-#include <opensm/osm_sa_guidinfo_record.h>
+#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_port.h>
 #include <opensm/osm_node.h>
-#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_sa.h>
@@ -71,52 +70,14 @@ typedef struct _osm_gir_search_ctxt {
 	const ib_guidinfo_record_t *p_rcvd_rec;
 	ib_net64_t comp_mask;
 	cl_qlist_t *p_list;
-	osm_gir_rcv_t *p_rcv;
+	osm_sa_t *sa;
 	const osm_physp_t *p_req_physp;
 } osm_gir_search_ctxt_t;
 
 /**********************************************************************
  **********************************************************************/
-void osm_gir_rcv_construct(IN osm_gir_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_gir_rcv_destroy(IN osm_gir_rcv_t * const p_rcv)
-{
-	OSM_LOG_ENTER(p_rcv->p_log, osm_gir_rcv_destroy);
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_gir_rcv_init(IN osm_gir_rcv_t * const p_rcv,
-		 IN osm_sa_resp_t * const p_resp,
-		 IN osm_mad_pool_t * const p_mad_pool,
-		 IN osm_subn_t * const p_subn,
-		 IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
-{
-	OSM_LOG_ENTER(p_log, osm_gir_rcv_init);
-
-	osm_gir_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_resp = p_resp;
-	p_rcv->p_mad_pool = p_mad_pool;
-
-	OSM_LOG_EXIT(p_log);
-	return IB_SUCCESS;
-}
-
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
-__osm_gir_rcv_new_gir(IN osm_gir_rcv_t * const p_rcv,
+__osm_gir_rcv_new_gir(IN osm_sa_t * sa,
 		      IN const osm_node_t * const p_node,
 		      IN cl_qlist_t * const p_list,
 		      IN ib_net64_t const match_port_guid,
@@ -127,19 +88,19 @@ __osm_gir_rcv_new_gir(IN osm_gir_rcv_t * const p_rcv,
 	osm_gir_item_t *p_rec_item;
 	ib_api_status_t status = IB_SUCCESS;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_gir_rcv_new_gir);
+	OSM_LOG_ENTER(sa->p_log, __osm_gir_rcv_new_gir);
 
 	p_rec_item = malloc(sizeof(*p_rec_item));
 	if (p_rec_item == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_gir_rcv_new_gir: ERR 5102: "
 			"rec_item alloc failed\n");
 		status = IB_INSUFFICIENT_RESOURCES;
 		goto Exit;
 	}
 
-	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(sa->p_log, OSM_LOG_DEBUG)) {
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_gir_rcv_new_gir: "
 			"New GUIDInfoRecord: lid 0x%X, block num %d\n",
 			cl_ntoh16(match_lid), block_num);
@@ -156,14 +117,14 @@ __osm_gir_rcv_new_gir(IN osm_gir_rcv_t * const p_rcv,
 	cl_qlist_insert_tail(p_list, &p_rec_item->list_item);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sa_gir_create_gir(IN osm_gir_rcv_t * const p_rcv,
+__osm_sa_gir_create_gir(IN osm_sa_t * sa,
 			IN const osm_node_t * const p_node,
 			IN cl_qlist_t * const p_list,
 			IN ib_net64_t const match_port_guid,
@@ -181,10 +142,10 @@ __osm_sa_gir_create_gir(IN osm_gir_rcv_t * const p_rcv,
 	ib_net64_t port_guid;
 	uint8_t block_num, start_block_num, end_block_num, num_blocks;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_gir_create_gir);
+	OSM_LOG_ENTER(sa->p_log, __osm_sa_gir_create_gir);
 
-	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(sa->p_log, OSM_LOG_DEBUG)) {
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_sa_gir_create_gir: "
 			"Looking for GUIDRecord with LID: 0x%X GUID:0x%016"
 			PRIx64 "\n", cl_ntoh16(match_lid),
@@ -209,7 +170,7 @@ __osm_sa_gir_create_gir(IN osm_gir_rcv_t * const p_rcv,
 
 		/* Check to see if the found p_physp and the requester physp
 		   share a pkey. If not, continue */
-		if (!osm_physp_share_pkey(p_rcv->p_log, p_physp, p_req_physp))
+		if (!osm_physp_share_pkey(sa->p_log, p_physp, p_req_physp))
 			continue;
 
 		port_guid = osm_physp_get_port_guid(p_physp);
@@ -248,8 +209,8 @@ __osm_sa_gir_create_gir(IN osm_gir_rcv_t * const p_rcv,
 			/*
 			   We validate that the lid belongs to this node.
 			 */
-			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(sa->p_log, OSM_LOG_DEBUG)) {
+				osm_log(sa->p_log, OSM_LOG_DEBUG,
 					"__osm_sa_gir_create_gir: "
 					"Comparing LID: 0x%X <= 0x%X <= 0x%X\n",
 					base_lid_ho, match_lid_ho, max_lid_ho);
@@ -262,13 +223,13 @@ __osm_sa_gir_create_gir(IN osm_gir_rcv_t * const p_rcv,
 
 		for (block_num = start_block_num; block_num <= end_block_num;
 		     block_num++)
-			__osm_gir_rcv_new_gir(p_rcv, p_node, p_list, port_guid,
+			__osm_gir_rcv_new_gir(sa, p_node, p_list, port_guid,
 					      cl_ntoh16(base_lid_ho), p_physp,
 					      block_num);
 
 	}
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
@@ -282,14 +243,14 @@ __osm_sa_gir_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
 	const osm_node_t *const p_node = (osm_node_t *) p_map_item;
 	const ib_guidinfo_record_t *const p_rcvd_rec = p_ctxt->p_rcvd_rec;
 	const osm_physp_t *const p_req_physp = p_ctxt->p_req_physp;
-	osm_gir_rcv_t *const p_rcv = p_ctxt->p_rcv;
+	osm_sa_t *sa = p_ctxt->sa;
 	const ib_guid_info_t *p_comp_gi;
 	ib_net64_t const comp_mask = p_ctxt->comp_mask;
 	ib_net64_t match_port_guid = 0;
 	ib_net16_t match_lid = 0;
 	uint8_t match_block_num = 255;
 
-	OSM_LOG_ENTER(p_ctxt->p_rcv->p_log, __osm_sa_gir_by_comp_mask_cb);
+	OSM_LOG_ENTER(p_ctxt->sa->p_log, __osm_sa_gir_by_comp_mask_cb);
 
 	if (comp_mask & IB_GIR_COMPMASK_LID)
 		match_lid = p_rcvd_rec->lid;
@@ -341,19 +302,19 @@ __osm_sa_gir_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
 			goto Exit;
 	}
 
-	__osm_sa_gir_create_gir(p_rcv, p_node, p_ctxt->p_list,
+	__osm_sa_gir_create_gir(sa, p_node, p_ctxt->p_list,
 				match_port_guid, match_lid, p_req_physp,
 				match_block_num);
 
       Exit:
-	OSM_LOG_EXIT(p_ctxt->p_rcv->p_log);
+	OSM_LOG_EXIT(p_ctxt->sa->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 void osm_gir_rcv_process(IN void *ctx, IN void *data)
 {
-	osm_gir_rcv_t *p_rcv = ctx;
+	osm_sa_t *sa = ctx;
 	osm_madw_t *p_madw = data;
 	const ib_sa_mad_t *p_rcvd_mad;
 	const ib_guidinfo_record_t *p_rcvd_rec;
@@ -371,9 +332,9 @@ void osm_gir_rcv_process(IN void *ctx, IN void *data)
 	ib_api_status_t status;
 	osm_physp_t *p_req_physp;
 
-	CL_ASSERT(p_rcv);
+	CL_ASSERT(sa);
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_gir_rcv_process);
+	OSM_LOG_ENTER(sa->p_log, osm_gir_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -386,29 +347,29 @@ void osm_gir_rcv_process(IN void *ctx, IN void *data)
 	/* we only support SubnAdmGet and SubnAdmGetTable methods */
 	if ((p_rcvd_mad->method != IB_MAD_METHOD_GET) &&
 	    (p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE)) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_gir_rcv_process: ERR 5105: "
 			"Unsupported Method (%s)\n",
 			ib_get_sa_method_str(p_rcvd_mad->method));
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
 	}
 
 	/* update the requester physical port. */
-	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-						p_rcv->p_subn,
+	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log,
+						sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
 	if (p_req_physp == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_gir_rcv_process: ERR 5104: "
 			"Cannot find requester physical port\n");
 		goto Exit;
 	}
 
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
-		osm_dump_guidinfo_record(p_rcv->p_log, p_rcvd_rec,
+	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
+		osm_dump_guidinfo_record(sa->p_log, p_rcvd_rec,
 					 OSM_LOG_DEBUG);
 
 	cl_qlist_init(&rec_list);
@@ -416,15 +377,15 @@ void osm_gir_rcv_process(IN void *ctx, IN void *data)
 	context.p_rcvd_rec = p_rcvd_rec;
 	context.p_list = &rec_list;
 	context.comp_mask = p_rcvd_mad->comp_mask;
-	context.p_rcv = p_rcv;
+	context.sa = sa;
 	context.p_req_physp = p_req_physp;
 
-	cl_plock_acquire(p_rcv->p_lock);
+	cl_plock_acquire(sa->p_lock);
 
-	cl_qmap_apply_func(&p_rcv->p_subn->node_guid_tbl,
+	cl_qmap_apply_func(&sa->p_subn->node_guid_tbl,
 			   __osm_sa_gir_by_comp_mask_cb, &context);
 
-	cl_plock_release(p_rcv->p_lock);
+	cl_plock_release(sa->p_lock);
 
 	num_rec = cl_qlist_count(&rec_list);
 
@@ -434,16 +395,16 @@ void osm_gir_rcv_process(IN void *ctx, IN void *data)
 	 */
 	if (p_rcvd_mad->method == IB_MAD_METHOD_GET) {
 		if (num_rec == 0) {
-			osm_sa_send_error(p_rcv->p_resp, p_madw,
+			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_NO_RECORDS);
 			goto Exit;
 		}
 		if (num_rec > 1) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_gir_rcv_process: ERR 5103: "
 				"Got more than one record for SubnAdmGet (%u)\n",
 				num_rec);
-			osm_sa_send_error(p_rcv->p_resp, p_madw,
+			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
 
 			/* need to set the mem free ... */
@@ -466,7 +427,7 @@ void osm_gir_rcv_process(IN void *ctx, IN void *data)
 	    (MAD_BLOCK_SIZE -
 	     IB_SA_MAD_HDR_SIZE) / sizeof(ib_guidinfo_record_t);
 	if (trim_num_rec < num_rec) {
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sa->p_log, OSM_LOG_VERBOSE,
 			"osm_gir_rcv_process: "
 			"Number of records:%u trimmed to:%u to fit in one MAD\n",
 			num_rec, trim_num_rec);
@@ -474,11 +435,11 @@ void osm_gir_rcv_process(IN void *ctx, IN void *data)
 	}
 #endif
 
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sa->p_log, OSM_LOG_DEBUG,
 		"osm_gir_rcv_process: " "Returning %u records\n", num_rec);
 
 	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0)) {
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RECORDS);
 		goto Exit;
 	}
@@ -486,13 +447,13 @@ void osm_gir_rcv_process(IN void *ctx, IN void *data)
 	/*
 	 * Get a MAD to reply. Address of Mad is in the received mad_wrapper
 	 */
-	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+	p_resp_madw = osm_mad_pool_get(sa->p_mad_pool,
 				       p_madw->h_bind,
 				       num_rec * sizeof(ib_guidinfo_record_t) +
 				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
 
 	if (!p_resp_madw) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_gir_rcv_process: ERR 5106: "
 			"osm_mad_pool_get failed\n");
 
@@ -502,7 +463,7 @@ void osm_gir_rcv_process(IN void *ctx, IN void *data)
 			free(p_rec_item);
 		}
 
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RESOURCES);
 		goto Exit;
 	}
@@ -553,9 +514,9 @@ void osm_gir_rcv_process(IN void *ctx, IN void *data)
 	CL_ASSERT(cl_is_qlist_empty(&rec_list));
 
 	status = osm_sa_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE,
-				    p_rcv->p_subn);
+				    sa->p_subn);
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_gir_rcv_process: ERR 5107: "
 			"osm_sa_vendor_send status = %s\n",
 			ib_get_err_str(status));
@@ -563,5 +524,5 @@ void osm_gir_rcv_process(IN void *ctx, IN void *data)
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
diff --git a/opensm/opensm/osm_sa_informinfo.c b/opensm/opensm/osm_sa_informinfo.c
index db58bc0..92a7fa1 100644
--- a/opensm/opensm/osm_sa_informinfo.c
+++ b/opensm/opensm/osm_sa_informinfo.c
@@ -55,12 +55,10 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
-#include <opensm/osm_sa_informinfo.h>
+#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_port.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_switch.h>
-#include <vendor/osm_vendor.h>
-#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_sa.h>
 #include <opensm/osm_inform.h>
@@ -77,51 +75,11 @@ typedef struct _osm_iir_search_ctxt {
 	cl_qlist_t *p_list;
 	ib_gid_t subscriber_gid;
 	ib_net16_t subscriber_enum;
-	osm_infr_rcv_t *p_rcv;
+	osm_sa_t *sa;
 	osm_physp_t *p_req_physp;
 } osm_iir_search_ctxt_t;
 
 /**********************************************************************
- **********************************************************************/
-void osm_infr_rcv_construct(IN osm_infr_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_infr_rcv_destroy(IN osm_infr_rcv_t * const p_rcv)
-{
-	CL_ASSERT(p_rcv);
-
-	OSM_LOG_ENTER(p_rcv->p_log, osm_infr_rcv_destroy);
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_infr_rcv_init(IN osm_infr_rcv_t * const p_rcv,
-		  IN osm_sa_resp_t * const p_resp,
-		  IN osm_mad_pool_t * const p_mad_pool,
-		  IN osm_subn_t * const p_subn,
-		  IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
-{
-	OSM_LOG_ENTER(p_log, osm_infr_rcv_init);
-
-	osm_infr_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_resp = p_resp;
-	p_rcv->p_mad_pool = p_mad_pool;
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-	return IB_SUCCESS;
-}
-
-/**********************************************************************
 o13-14.1.1: Except for Set(InformInfo) requests with Inform-
 Info:LIDRangeBegin=0xFFFF, managers that support event forwarding
 shall, upon receiving a Set(InformInfo), verify that the requester
@@ -129,7 +87,7 @@ originating the Set(InformInfo) and a Trap() source identified by Inform-
 can access each other - can use path record to verify that.
 **********************************************************************/
 static boolean_t
-__validate_ports_access_rights(IN osm_infr_rcv_t * const p_rcv,
+__validate_ports_access_rights(IN osm_sa_t * sa,
 			       IN osm_infr_t * p_infr_rec)
 {
 	boolean_t valid = TRUE;
@@ -143,11 +101,11 @@ __validate_ports_access_rights(IN osm_infr_rcv_t * const p_rcv,
 	const cl_ptr_vector_t *p_tbl;
 	ib_gid_t zero_gid;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __validate_ports_access_rights);
+	OSM_LOG_ENTER(sa->p_log, __validate_ports_access_rights);
 
 	/* get the requester physp from the request address */
-	p_requester_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-						      p_rcv->p_subn,
+	p_requester_physp = osm_get_physp_by_mad_addr(sa->p_log,
+						      sa->p_subn,
 						      &p_infr_rec->report_addr);
 
 	memset(&zero_gid, 0, sizeof(zero_gid));
@@ -158,10 +116,10 @@ __validate_ports_access_rights(IN osm_infr_rcv_t * const p_rcv,
 		    p_infr_rec->inform_record.inform_info.gid.unicast.
 		    interface_id;
 
-		p_port = osm_get_port_by_guid(p_rcv->p_subn, portguid);
+		p_port = osm_get_port_by_guid(sa->p_subn, portguid);
 
 		if (p_port == NULL) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__validate_ports_access_rights: ERR 4301: "
 				"Invalid port guid: 0x%016" PRIx64 "\n",
 				cl_ntoh64(portguid));
@@ -175,8 +133,8 @@ __validate_ports_access_rights(IN osm_infr_rcv_t * const p_rcv,
 		/* make sure that the requester and destination port can access each other
 		   according to the current partitioning. */
 		if (!osm_physp_share_pkey
-		    (p_rcv->p_log, p_physp, p_requester_physp)) {
-			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		    (sa->p_log, p_physp, p_requester_physp)) {
+			osm_log(sa->p_log, OSM_LOG_DEBUG,
 				"__validate_ports_access_rights: "
 				"port and requester don't share pkey\n");
 			valid = FALSE;
@@ -203,12 +161,12 @@ __validate_ports_access_rights(IN osm_infr_rcv_t * const p_rcv,
 		/* go over all defined lids within the range and make sure that the
 		   requester port can access them according to current partitioning. */
 		for (lid = lid_range_begin; lid <= lid_range_end; lid++) {
-			p_tbl = &p_rcv->p_subn->port_lid_tbl;
+			p_tbl = &sa->p_subn->port_lid_tbl;
 			if (cl_ptr_vector_get_size(p_tbl) > lid) {
 				p_port = cl_ptr_vector_get(p_tbl, lid);
 			} else {
 				/* lid requested is out of range */
-				osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				osm_log(sa->p_log, OSM_LOG_ERROR,
 					"__validate_ports_access_rights: ERR 4302: "
 					"Given LID (0x%X) is out of range:0x%X\n",
 					lid, cl_ptr_vector_get_size(p_tbl));
@@ -222,8 +180,8 @@ __validate_ports_access_rights(IN osm_infr_rcv_t * const p_rcv,
 			/* make sure that the requester and destination port can access
 			   each other according to the current partitioning. */
 			if (!osm_physp_share_pkey
-			    (p_rcv->p_log, p_physp, p_requester_physp)) {
-				osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			    (sa->p_log, p_physp, p_requester_physp)) {
+				osm_log(sa->p_log, OSM_LOG_DEBUG,
 					"__validate_ports_access_rights: "
 					"port and requester don't share pkey\n");
 				valid = FALSE;
@@ -233,27 +191,27 @@ __validate_ports_access_rights(IN osm_infr_rcv_t * const p_rcv,
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return valid;
 }
 
 /**********************************************************************
  **********************************************************************/
 static boolean_t
-__validate_infr(IN osm_infr_rcv_t * const p_rcv, IN osm_infr_t * p_infr_rec)
+__validate_infr(IN osm_sa_t * sa, IN osm_infr_t * p_infr_rec)
 {
 	boolean_t valid = TRUE;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __validate_infr);
+	OSM_LOG_ENTER(sa->p_log, __validate_infr);
 
-	valid = __validate_ports_access_rights(p_rcv, p_infr_rec);
+	valid = __validate_ports_access_rights(sa, p_infr_rec);
 	if (!valid) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__validate_infr: " "Invalid Access for InformInfo\n");
 		valid = FALSE;
 	}
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return valid;
 }
 
@@ -263,7 +221,7 @@ with an InformInfo attribute that is a copy of the data in the
 Set(InformInfo) request.
 **********************************************************************/
 static void
-__osm_infr_rcv_respond(IN osm_infr_rcv_t * const p_rcv,
+__osm_infr_rcv_respond(IN osm_sa_t * sa,
 		       IN const osm_madw_t * const p_madw)
 {
 	osm_madw_t *p_resp_madw;
@@ -272,10 +230,10 @@ __osm_infr_rcv_respond(IN osm_infr_rcv_t * const p_rcv,
 	ib_inform_info_t *p_resp_infr;
 	ib_api_status_t status;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_infr_rcv_respond);
+	OSM_LOG_ENTER(sa->p_log, __osm_infr_rcv_respond);
 
-	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(sa->p_log, OSM_LOG_DEBUG)) {
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_infr_rcv_respond: "
 			"Generating successful InformInfo response\n");
 	}
@@ -283,11 +241,11 @@ __osm_infr_rcv_respond(IN osm_infr_rcv_t * const p_rcv,
 	/*
 	   Get a MAD to reply. Address of Mad is in the received mad_wrapper
 	 */
-	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+	p_resp_madw = osm_mad_pool_get(sa->p_mad_pool,
 				       p_madw->h_bind,
 				       MAD_BLOCK_SIZE, &p_madw->mad_addr);
 	if (!p_resp_madw) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_infr_rcv_respond: ERR 4303: "
 			"Unable to allocate MAD\n");
 		goto Exit;
@@ -306,24 +264,24 @@ __osm_infr_rcv_respond(IN osm_infr_rcv_t * const p_rcv,
 	    (ib_inform_info_t *) ib_sa_mad_get_payload_ptr(p_resp_sa_mad);
 
 	status = osm_sa_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE,
-				    p_rcv->p_subn);
+				    sa->p_subn);
 
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_infr_rcv_respond: ERR 4304: "
 			"Unable to send MAD (%s)\n", ib_get_err_str(status));
-		/* osm_mad_pool_put( p_rcv->p_mad_pool, p_resp_madw ); */
+		/* osm_mad_pool_put( sa->p_mad_pool, p_resp_madw ); */
 		goto Exit;
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sa_inform_info_rec_by_comp_mask(IN osm_infr_rcv_t * const p_rcv,
+__osm_sa_inform_info_rec_by_comp_mask(IN osm_sa_t * sa,
 				      IN const osm_infr_t * const p_infr,
 				      osm_iir_search_ctxt_t * const p_ctxt)
 {
@@ -335,7 +293,7 @@ __osm_sa_inform_info_rec_by_comp_mask(IN osm_infr_rcv_t * const p_rcv,
 	const osm_physp_t *p_req_physp;
 	osm_iir_item_t *p_rec_item;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_inform_info_rec_by_comp_mask);
+	OSM_LOG_ENTER(sa->p_log, __osm_sa_inform_info_rec_by_comp_mask);
 
 	p_rcvd_rec = p_ctxt->p_rcvd_rec;
 	comp_mask = p_ctxt->comp_mask;
@@ -358,9 +316,9 @@ __osm_sa_inform_info_rec_by_comp_mask(IN osm_infr_rcv_t * const p_rcv,
 
 	/* Ensure pkey is shared before returning any records */
 	portguid = p_infr->inform_record.subscriber_gid.unicast.interface_id;
-	p_subscriber_port = osm_get_port_by_guid(p_rcv->p_subn, portguid);
+	p_subscriber_port = osm_get_port_by_guid(sa->p_subn, portguid);
 	if (p_subscriber_port == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_sa_inform_info_rec_by_comp_mask: ERR 430D: "
 			"Invalid subscriber port guid: 0x%016" PRIx64 "\n",
 			cl_ntoh64(portguid));
@@ -372,8 +330,8 @@ __osm_sa_inform_info_rec_by_comp_mask(IN osm_infr_rcv_t * const p_rcv,
 	/* make sure that the requester and subscriber port can access each other
 	   according to the current partitioning. */
 	if (!osm_physp_share_pkey
-	    (p_rcv->p_log, p_req_physp, p_subscriber_physp)) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	    (sa->p_log, p_req_physp, p_subscriber_physp)) {
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_sa_inform_info_rec_by_comp_mask: "
 			"requester and subscriber ports don't share pkey\n");
 		goto Exit;
@@ -381,7 +339,7 @@ __osm_sa_inform_info_rec_by_comp_mask(IN osm_infr_rcv_t * const p_rcv,
 
 	p_rec_item = malloc(sizeof(*p_rec_item));
 	if (p_rec_item == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_sa_inform_info_rec_by_comp_mask: ERR 430E: "
 			"rec_item alloc failed\n");
 		goto Exit;
@@ -392,7 +350,7 @@ __osm_sa_inform_info_rec_by_comp_mask(IN osm_infr_rcv_t * const p_rcv,
 	cl_qlist_insert_tail(p_ctxt->p_list, &p_rec_item->list_item);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
@@ -404,14 +362,14 @@ __osm_sa_inform_info_rec_by_comp_mask_cb(IN cl_list_item_t * const p_list_item,
 	const osm_infr_t *const p_infr = (osm_infr_t *) p_list_item;
 	osm_iir_search_ctxt_t *const p_ctxt = (osm_iir_search_ctxt_t *) context;
 
-	__osm_sa_inform_info_rec_by_comp_mask(p_ctxt->p_rcv, p_infr, p_ctxt);
+	__osm_sa_inform_info_rec_by_comp_mask(p_ctxt->sa, p_infr, p_ctxt);
 }
 
 /**********************************************************************
 Received a Get(InformInfoRecord) or GetTable(InformInfoRecord) MAD
 **********************************************************************/
 static void
-osm_infr_rcv_process_get_method(IN osm_infr_rcv_t * const p_rcv,
+osm_infr_rcv_process_get_method(IN osm_sa_t * sa,
 				IN const osm_madw_t * const p_madw)
 {
 	ib_sa_mad_t *p_rcvd_mad;
@@ -430,7 +388,7 @@ osm_infr_rcv_process_get_method(IN osm_infr_rcv_t * const p_rcv,
 	ib_api_status_t status = IB_SUCCESS;
 	osm_physp_t *p_req_physp;
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_infr_rcv_process_get_method);
+	OSM_LOG_ENTER(sa->p_log, osm_infr_rcv_process_get_method);
 
 	CL_ASSERT(p_madw);
 	p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);
@@ -438,19 +396,19 @@ osm_infr_rcv_process_get_method(IN osm_infr_rcv_t * const p_rcv,
 	    (ib_inform_info_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);
 
 	/* update the requester physical port. */
-	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-						p_rcv->p_subn,
+	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log,
+						sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
 	if (p_req_physp == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_infr_rcv_process_get_method: ERR 4309: "
 			"Cannot find requester physical port\n");
 		goto Exit;
 	}
 
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
-		osm_dump_inform_info_record(p_rcv->p_log, p_rcvd_rec,
+	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
+		osm_dump_inform_info_record(sa->p_log, p_rcvd_rec,
 					    OSM_LOG_DEBUG);
 
 	cl_qlist_init(&rec_list);
@@ -460,10 +418,10 @@ osm_infr_rcv_process_get_method(IN osm_infr_rcv_t * const p_rcv,
 	context.comp_mask = p_rcvd_mad->comp_mask;
 	context.subscriber_gid = p_rcvd_rec->subscriber_gid;
 	context.subscriber_enum = p_rcvd_rec->subscriber_enum;
-	context.p_rcv = p_rcv;
+	context.sa = sa;
 	context.p_req_physp = p_req_physp;
 
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sa->p_log, OSM_LOG_DEBUG,
 		"osm_infr_rcv_process_get_method: "
 		"Query Subscriber GID:0x%016" PRIx64 " : 0x%016" PRIx64
 		"(%02X) Enum:0x%X(%02X)\n",
@@ -473,12 +431,12 @@ osm_infr_rcv_process_get_method(IN osm_infr_rcv_t * const p_rcv,
 		cl_ntoh16(p_rcvd_rec->subscriber_enum),
 		(p_rcvd_mad->comp_mask & IB_IIR_COMPMASK_ENUM) != 0);
 
-	cl_plock_acquire(p_rcv->p_lock);
+	cl_plock_acquire(sa->p_lock);
 
-	cl_qlist_apply_func(&p_rcv->p_subn->sa_infr_list,
+	cl_qlist_apply_func(&sa->p_subn->sa_infr_list,
 			    __osm_sa_inform_info_rec_by_comp_mask_cb, &context);
 
-	cl_plock_release(p_rcv->p_lock);
+	cl_plock_release(sa->p_lock);
 
 	num_rec = cl_qlist_count(&rec_list);
 
@@ -488,16 +446,16 @@ osm_infr_rcv_process_get_method(IN osm_infr_rcv_t * const p_rcv,
 	 */
 	if (p_rcvd_mad->method == IB_MAD_METHOD_GET) {
 		if (num_rec == 0) {
-			osm_sa_send_error(p_rcv->p_resp, p_madw,
+			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_NO_RECORDS);
 			goto Exit;
 		}
 		if (num_rec > 1) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_infr_rcv_process_get_method: ERR 430A: "
 				"More than one record for SubnAdmGet (%u)\n",
 				num_rec);
-			osm_sa_send_error(p_rcv->p_resp, p_madw,
+			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
 
 			/* need to set the mem free ... */
@@ -521,7 +479,7 @@ osm_infr_rcv_process_get_method(IN osm_infr_rcv_t * const p_rcv,
 	    (MAD_BLOCK_SIZE -
 	     IB_SA_MAD_HDR_SIZE) / sizeof(ib_inform_info_record_t);
 	if (trim_num_rec < num_rec) {
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sa->p_log, OSM_LOG_VERBOSE,
 			"osm_infr_rcv_process_get_method: "
 			"Number of records:%u trimmed to:%u to fit in one MAD\n",
 			num_rec, trim_num_rec);
@@ -529,21 +487,21 @@ osm_infr_rcv_process_get_method(IN osm_infr_rcv_t * const p_rcv,
 	}
 #endif
 
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sa->p_log, OSM_LOG_DEBUG,
 		"osm_infr_rcv_process_get_method: "
 		"Returning %u records\n", num_rec);
 
 	/*
 	 * Get a MAD to reply. Address of Mad is in the received mad_wrapper
 	 */
-	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+	p_resp_madw = osm_mad_pool_get(sa->p_mad_pool,
 				       p_madw->h_bind,
 				       num_rec *
 				       sizeof(ib_inform_info_record_t) +
 				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
 
 	if (!p_resp_madw) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_infr_rcv_process_get_method: ERR 430B: "
 			"osm_mad_pool_get failed\n");
 
@@ -553,7 +511,7 @@ osm_infr_rcv_process_get_method(IN osm_infr_rcv_t * const p_rcv,
 			free(p_rec_item);
 		}
 
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RESOURCES);
 
 		goto Exit;
@@ -611,9 +569,9 @@ osm_infr_rcv_process_get_method(IN osm_infr_rcv_t * const p_rcv,
 	CL_ASSERT(cl_is_qlist_empty(&rec_list));
 
 	status = osm_sa_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE,
-				    p_rcv->p_subn);
+				    sa->p_subn);
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_infr_rcv_process_get_method: ERR 430C: "
 			"osm_sa_vendor_send status = %s\n",
 			ib_get_err_str(status));
@@ -621,14 +579,14 @@ osm_infr_rcv_process_get_method(IN osm_infr_rcv_t * const p_rcv,
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /*********************************************************************
 Received a Set(InformInfo) MAD
 **********************************************************************/
 static void
-osm_infr_rcv_process_set_method(IN osm_infr_rcv_t * const p_rcv,
+osm_infr_rcv_process_set_method(IN osm_sa_t * sa,
 				IN const osm_madw_t * const p_madw)
 {
 	ib_sa_mad_t *p_sa_mad;
@@ -639,7 +597,7 @@ osm_infr_rcv_process_set_method(IN osm_infr_rcv_t * const p_rcv,
 	uint8_t resp_time_val;
 	ib_api_status_t res;
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_infr_rcv_process_set_method);
+	OSM_LOG_ENTER(sa->p_log, osm_infr_rcv_process_set_method);
 
 	CL_ASSERT(p_madw);
 
@@ -648,13 +606,13 @@ osm_infr_rcv_process_set_method(IN osm_infr_rcv_t * const p_rcv,
 	    (ib_inform_info_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
 
 #if 0
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
-		osm_dump_inform_info(p_rcv->p_log, p_recvd_inform_info,
+	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
+		osm_dump_inform_info(sa->p_log, p_recvd_inform_info,
 				     OSM_LOG_DEBUG);
 #endif
 
 	/* Grab the lock */
-	cl_plock_excl_acquire(p_rcv->p_lock);
+	cl_plock_excl_acquire(sa->p_lock);
 
 	/* define the inform record */
 	inform_info_rec.inform_record.inform_info = *p_recvd_inform_info;
@@ -664,23 +622,23 @@ osm_infr_rcv_process_set_method(IN osm_infr_rcv_t * const p_rcv,
 
 	/* we will need to know the mad srvc to send back through */
 	inform_info_rec.h_bind = p_madw->h_bind;
-	inform_info_rec.p_infr_rcv = p_rcv;
+	inform_info_rec.sa = sa;
 
 	/* update the subscriber GID according to mad address */
-	res = osm_get_gid_by_mad_addr(p_rcv->p_log,
-				      p_rcv->p_subn,
+	res = osm_get_gid_by_mad_addr(sa->p_log,
+				      sa->p_subn,
 				      &p_madw->mad_addr,
 				      &inform_info_rec.inform_record.
 				      subscriber_gid);
 	if (res != IB_SUCCESS) {
-		cl_plock_release(p_rcv->p_lock);
+		cl_plock_release(sa->p_lock);
 
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_infr_rcv_process_set_method: ERR 4308 "
 			"Subscribe Request from unknown LID: 0x%04X\n",
 			cl_ntoh16(p_madw->mad_addr.dest_lid)
 		    );
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_REQ_INVALID);
 		goto Exit;
 	}
@@ -690,13 +648,13 @@ osm_infr_rcv_process_set_method(IN osm_infr_rcv_t * const p_rcv,
 
 	/* Subscribe values above 1 are undefined */
 	if (p_recvd_inform_info->subscribe > 1) {
-		cl_plock_release(p_rcv->p_lock);
+		cl_plock_release(sa->p_lock);
 
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_infr_rcv_process_set_method: ERR 4308 "
 			"Invalid subscribe: %d\n",
 			p_recvd_inform_info->subscribe);
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_REQ_INVALID);
 		goto Exit;
 	}
@@ -714,7 +672,7 @@ osm_infr_rcv_process_set_method(IN osm_infr_rcv_t * const p_rcv,
 				       inform_info_rec.report_addr.addr_type.
 				       gsi.remote_qp);
 
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"osm_infr_rcv_process_set_method: "
 			"Subscribe Request with QPN: 0x%06X\n",
 			cl_ntoh32(inform_info_rec.report_addr.addr_type.gsi.
@@ -725,7 +683,7 @@ osm_infr_rcv_process_set_method(IN osm_infr_rcv_t * const p_rcv,
 						 generic.qpn_resp_time_val,
 						 &qpn, &resp_time_val);
 
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"osm_infr_rcv_process_set_method: "
 			"UnSubscribe Request with QPN: 0x%06X\n", cl_ntoh32(qpn)
 		    );
@@ -733,21 +691,21 @@ osm_infr_rcv_process_set_method(IN osm_infr_rcv_t * const p_rcv,
 
 	/* If record exists with matching InformInfo */
 	p_infr =
-	    osm_infr_get_by_rec(p_rcv->p_subn, p_rcv->p_log, &inform_info_rec);
+	    osm_infr_get_by_rec(sa->p_subn, sa->p_log, &inform_info_rec);
 
 	/* check to see if the request was for subscribe */
 	if (p_recvd_inform_info->subscribe) {
 		/* validate the request for a new or update InformInfo */
-		if (__validate_infr(p_rcv, &inform_info_rec) != TRUE) {
-			cl_plock_release(p_rcv->p_lock);
+		if (__validate_infr(sa, &inform_info_rec) != TRUE) {
+			cl_plock_release(sa->p_lock);
 
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_infr_rcv_process_set_method: ERR 4305: "
 				"Failed to validate a new inform object\n");
 
 			/* o13-13.1.1: we need to set the subscribe bit to 0 */
 			p_recvd_inform_info->subscribe = 0;
-			osm_sa_send_error(p_rcv->p_resp, p_madw,
+			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_REQ_INVALID);
 			goto Exit;
 		}
@@ -757,21 +715,21 @@ osm_infr_rcv_process_set_method(IN osm_infr_rcv_t * const p_rcv,
 			/* Create the instance of the osm_infr_t object */
 			p_infr = osm_infr_new(&inform_info_rec);
 			if (p_infr == NULL) {
-				cl_plock_release(p_rcv->p_lock);
+				cl_plock_release(sa->p_lock);
 
-				osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				osm_log(sa->p_log, OSM_LOG_ERROR,
 					"osm_infr_rcv_process_set_method: ERR 4306: "
 					"Failed to create a new inform object\n");
 
 				/* o13-13.1.1: we need to set the subscribe bit to 0 */
 				p_recvd_inform_info->subscribe = 0;
-				osm_sa_send_error(p_rcv->p_resp, p_madw,
+				osm_sa_send_error(sa, p_madw,
 						  IB_SA_MAD_STATUS_NO_RESOURCES);
 				goto Exit;
 			}
 
 			/* Add this new osm_infr_t object to subnet object */
-			osm_infr_insert_to_db(p_rcv->p_subn, p_rcv->p_log,
+			osm_infr_insert_to_db(sa->p_subn, sa->p_log,
 					      p_infr);
 		} else {
 			/* Update the old instance of the osm_infr_t object */
@@ -780,43 +738,43 @@ osm_infr_rcv_process_set_method(IN osm_infr_rcv_t * const p_rcv,
 	} else {
 		/* We got an UnSubscribe request */
 		if (p_infr == NULL) {
-			cl_plock_release(p_rcv->p_lock);
+			cl_plock_release(sa->p_lock);
 
 			/* No Such Item - So Error */
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_infr_rcv_process_set_method: ERR 4307: "
 				"Failed to UnSubscribe to non existing inform object\n");
 
 			/* o13-13.1.1: we need to set the subscribe bit to 0 */
 			p_recvd_inform_info->subscribe = 0;
-			osm_sa_send_error(p_rcv->p_resp, p_madw,
+			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_REQ_INVALID);
 			goto Exit;
 		} else {
 			/* Delete this object from the subnet list of informs */
-			osm_infr_remove_from_db(p_rcv->p_subn, p_rcv->p_log,
+			osm_infr_remove_from_db(sa->p_subn, sa->p_log,
 						p_infr);
 		}
 	}
 
-	cl_plock_release(p_rcv->p_lock);
+	cl_plock_release(sa->p_lock);
 
 	/* send the success response */
-	__osm_infr_rcv_respond(p_rcv, p_madw);
+	__osm_infr_rcv_respond(sa, p_madw);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /*********************************************************************
 **********************************************************************/
 void osm_infr_rcv_process(IN void *context, IN void *data)
 {
-	osm_infr_rcv_t *p_rcv = context;
+	osm_sa_t *sa = context;
 	osm_madw_t *p_madw = data;
 	ib_sa_mad_t *p_sa_mad;
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_infr_rcv_process);
+	OSM_LOG_ENTER(sa->p_log, osm_infr_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -825,30 +783,30 @@ void osm_infr_rcv_process(IN void *context, IN void *data)
 	CL_ASSERT(p_sa_mad->attr_id == IB_MAD_ATTR_INFORM_INFO);
 
 	if (p_sa_mad->method != IB_MAD_METHOD_SET) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"osm_infr_rcv_process: "
 			"Unsupported Method (%s)\n",
 			ib_get_sa_method_str(p_sa_mad->method));
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
 	}
 
-	osm_infr_rcv_process_set_method(p_rcv, p_madw);
+	osm_infr_rcv_process_set_method(sa, p_madw);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /*********************************************************************
 **********************************************************************/
 void osm_infir_rcv_process(IN void *context, IN void *data)
 {
-	osm_infr_rcv_t *p_rcv = context;
+	osm_sa_t *sa = context;
 	osm_madw_t *p_madw = data;
 	ib_sa_mad_t *p_sa_mad;
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_infr_rcv_process);
+	OSM_LOG_ENTER(sa->p_log, osm_infr_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -858,17 +816,17 @@ void osm_infir_rcv_process(IN void *context, IN void *data)
 
 	if ((p_sa_mad->method != IB_MAD_METHOD_GET) &&
 	    (p_sa_mad->method != IB_MAD_METHOD_GETTABLE)) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"osm_infir_rcv_process: "
 			"Unsupported Method (%s)\n",
 			ib_get_sa_method_str(p_sa_mad->method));
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
 	}
 
-	osm_infr_rcv_process_get_method(p_rcv, p_madw);
+	osm_infr_rcv_process_get_method(sa, p_madw);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
diff --git a/opensm/opensm/osm_sa_lft_record.c b/opensm/opensm/osm_sa_lft_record.c
index 5f3f208..b6a86d5 100644
--- a/opensm/opensm/osm_sa_lft_record.c
+++ b/opensm/opensm/osm_sa_lft_record.c
@@ -53,9 +53,8 @@
 #include <iba/ib_types.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
-#include <opensm/osm_sa_lft_record.h>
-#include <opensm/osm_switch.h>
 #include <vendor/osm_vendor_api.h>
+#include <opensm/osm_switch.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_sa.h>
@@ -69,52 +68,14 @@ typedef struct _osm_lftr_search_ctxt {
 	const ib_lft_record_t *p_rcvd_rec;
 	ib_net64_t comp_mask;
 	cl_qlist_t *p_list;
-	osm_lftr_rcv_t *p_rcv;
+	osm_sa_t *sa;
 	const osm_physp_t *p_req_physp;
 } osm_lftr_search_ctxt_t;
 
 /**********************************************************************
  **********************************************************************/
-void osm_lftr_rcv_construct(IN osm_lftr_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_lftr_rcv_destroy(IN osm_lftr_rcv_t * const p_rcv)
-{
-	OSM_LOG_ENTER(p_rcv->p_log, osm_lftr_rcv_destroy);
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_lftr_rcv_init(IN osm_lftr_rcv_t * const p_rcv,
-		  IN osm_sa_resp_t * const p_resp,
-		  IN osm_mad_pool_t * const p_mad_pool,
-		  IN osm_subn_t * const p_subn,
-		  IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
-{
-	OSM_LOG_ENTER(p_log, osm_lftr_rcv_init);
-
-	osm_lftr_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_resp = p_resp;
-	p_rcv->p_mad_pool = p_mad_pool;
-
-	OSM_LOG_EXIT(p_log);
-	return IB_SUCCESS;
-}
-
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
-__osm_lftr_rcv_new_lftr(IN osm_lftr_rcv_t * const p_rcv,
+__osm_lftr_rcv_new_lftr(IN osm_sa_t * sa,
 			IN const osm_switch_t * const p_sw,
 			IN cl_qlist_t * const p_list,
 			IN ib_net16_t const lid, IN ib_net16_t const block)
@@ -122,19 +83,19 @@ __osm_lftr_rcv_new_lftr(IN osm_lftr_rcv_t * const p_rcv,
 	osm_lftr_item_t *p_rec_item;
 	ib_api_status_t status = IB_SUCCESS;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_lftr_rcv_new_lftr);
+	OSM_LOG_ENTER(sa->p_log, __osm_lftr_rcv_new_lftr);
 
 	p_rec_item = malloc(sizeof(*p_rec_item));
 	if (p_rec_item == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_lftr_rcv_new_lftr: ERR 4402: "
 			"rec_item alloc failed\n");
 		status = IB_INSUFFICIENT_RESOURCES;
 		goto Exit;
 	}
 
-	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(sa->p_log, OSM_LOG_DEBUG))
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_lftr_rcv_new_lftr: "
 			"New LinearForwardingTable: sw 0x%016" PRIx64
 			"\n\t\t\t\tblock 0x%02X lid 0x%02X\n",
@@ -154,28 +115,28 @@ __osm_lftr_rcv_new_lftr(IN osm_lftr_rcv_t * const p_rcv,
 	cl_qlist_insert_tail(p_list, &p_rec_item->list_item);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
-static osm_port_t *__osm_lftr_get_port_by_guid(IN osm_lftr_rcv_t * const p_rcv,
+static osm_port_t *__osm_lftr_get_port_by_guid(IN osm_sa_t * sa,
 					       IN uint64_t port_guid)
 {
 	osm_port_t *p_port;
 
-	CL_PLOCK_ACQUIRE(p_rcv->p_lock);
+	CL_PLOCK_ACQUIRE(sa->p_lock);
 
-	p_port = osm_get_port_by_guid(p_rcv->p_subn, port_guid);
+	p_port = osm_get_port_by_guid(sa->p_subn, port_guid);
 	if (!p_port) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_lftr_get_port_by_guid ERR 4404: "
 			"Invalid port GUID 0x%016" PRIx64 "\n", port_guid);
 		p_port = NULL;
 	}
 
-	CL_PLOCK_RELEASE(p_rcv->p_lock);
+	CL_PLOCK_RELEASE(sa->p_lock);
 	return p_port;
 }
 
@@ -189,7 +150,7 @@ __osm_lftr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
 	    (osm_lftr_search_ctxt_t *) context;
 	const osm_switch_t *const p_sw = (osm_switch_t *) p_map_item;
 	const ib_lft_record_t *const p_rcvd_rec = p_ctxt->p_rcvd_rec;
-	osm_lftr_rcv_t *const p_rcv = p_ctxt->p_rcv;
+	osm_sa_t *sa = p_ctxt->sa;
 	ib_net64_t const comp_mask = p_ctxt->comp_mask;
 	const osm_physp_t *const p_req_physp = p_ctxt->p_req_physp;
 	osm_port_t *p_port;
@@ -199,10 +160,10 @@ __osm_lftr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
 
 	/* In switches, the port guid is the node guid. */
 	p_port =
-	    __osm_lftr_get_port_by_guid(p_rcv,
+	    __osm_lftr_get_port_by_guid(sa,
 					p_sw->p_node->node_info.port_guid);
 	if (!p_port) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_lftr_rcv_by_comp_mask: ERR 4405: "
 			"Failed to find Port by Node Guid:0x%016" PRIx64
 			"\n", cl_ntoh64(p_sw->p_node->node_info.node_guid)
@@ -214,7 +175,7 @@ __osm_lftr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
 	   the same partition. */
 	p_physp = p_port->p_physp;
 	if (!p_physp) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_lftr_rcv_by_comp_mask: ERR 4406: "
 			"Failed to find default physical Port by Node Guid:0x%016"
 			PRIx64 "\n",
@@ -222,7 +183,7 @@ __osm_lftr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
 		    );
 		return;
 	}
-	if (!osm_physp_share_pkey(p_rcv->p_log, p_req_physp, p_physp))
+	if (!osm_physp_share_pkey(sa->p_log, p_req_physp, p_physp))
 		return;
 
 	/* get the port 0 of the switch */
@@ -230,7 +191,7 @@ __osm_lftr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
 
 	/* compare the lids - if required */
 	if (comp_mask & IB_LFTR_COMPMASK_LID) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_lftr_rcv_by_comp_mask: "
 			"Comparing lid:0x%02X to port lid range: 0x%02X .. 0x%02X\n",
 			cl_ntoh16(p_rcvd_rec->lid), min_lid_ho, max_lid_ho);
@@ -251,7 +212,7 @@ __osm_lftr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
 
 	/* so we can add these blocks one by one ... */
 	for (block = min_block; block <= max_block; block++)
-		__osm_lftr_rcv_new_lftr(p_rcv, p_sw, p_ctxt->p_list,
+		__osm_lftr_rcv_new_lftr(sa, p_sw, p_ctxt->p_list,
 					osm_port_get_base_lid(p_port),
 					cl_hton16(block));
 }
@@ -260,7 +221,7 @@ __osm_lftr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
  **********************************************************************/
 void osm_lftr_rcv_process(IN void *ctx, IN void *data)
 {
-	osm_lftr_rcv_t *p_rcv = ctx;
+	osm_sa_t *sa = ctx;
 	osm_madw_t *p_madw = data;
 	const ib_sa_mad_t *p_rcvd_mad;
 	const ib_lft_record_t *p_rcvd_rec;
@@ -278,9 +239,9 @@ void osm_lftr_rcv_process(IN void *ctx, IN void *data)
 	ib_api_status_t status = IB_SUCCESS;
 	osm_physp_t *p_req_physp;
 
-	CL_ASSERT(p_rcv);
+	CL_ASSERT(sa);
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_lftr_rcv_process);
+	OSM_LOG_ENTER(sa->p_log, osm_lftr_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -292,22 +253,22 @@ void osm_lftr_rcv_process(IN void *ctx, IN void *data)
 	/* we only support SubnAdmGet and SubnAdmGetTable methods */
 	if ((p_rcvd_mad->method != IB_MAD_METHOD_GET) &&
 	    (p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE)) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_lftr_rcv_process: ERR 4408: "
 			"Unsupported Method (%s)\n",
 			ib_get_sa_method_str(p_rcvd_mad->method));
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
 	}
 
 	/* update the requester physical port. */
-	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-						p_rcv->p_subn,
+	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log,
+						sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
 	if (p_req_physp == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_lftr_rcv_process: ERR 4407: "
 			"Cannot find requester physical port\n");
 		goto Exit;
@@ -318,16 +279,16 @@ void osm_lftr_rcv_process(IN void *ctx, IN void *data)
 	context.p_rcvd_rec = p_rcvd_rec;
 	context.p_list = &rec_list;
 	context.comp_mask = p_rcvd_mad->comp_mask;
-	context.p_rcv = p_rcv;
+	context.sa = sa;
 	context.p_req_physp = p_req_physp;
 
-	cl_plock_acquire(p_rcv->p_lock);
+	cl_plock_acquire(sa->p_lock);
 
 	/* Go over all switches */
-	cl_qmap_apply_func(&p_rcv->p_subn->sw_guid_tbl,
+	cl_qmap_apply_func(&sa->p_subn->sw_guid_tbl,
 			   __osm_lftr_rcv_by_comp_mask, &context);
 
-	cl_plock_release(p_rcv->p_lock);
+	cl_plock_release(sa->p_lock);
 
 	num_rec = cl_qlist_count(&rec_list);
 
@@ -337,16 +298,16 @@ void osm_lftr_rcv_process(IN void *ctx, IN void *data)
 	 */
 	if (p_rcvd_mad->method == IB_MAD_METHOD_GET) {
 		if (num_rec == 0) {
-			osm_sa_send_error(p_rcv->p_resp, p_madw,
+			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_NO_RECORDS);
 			goto Exit;
 		}
 		if (num_rec > 1) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_lftr_rcv_process: ERR 4409: "
 				"Got more than one record for SubnAdmGet (%u)\n",
 				num_rec);
-			osm_sa_send_error(p_rcv->p_resp, p_madw,
+			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
 
 			/* need to set the mem free ... */
@@ -369,7 +330,7 @@ void osm_lftr_rcv_process(IN void *ctx, IN void *data)
 	trim_num_rec =
 	    (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_lft_record_t);
 	if (trim_num_rec < num_rec) {
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sa->p_log, OSM_LOG_VERBOSE,
 			"osm_lftr_rcv_process: "
 			"Number of records:%u trimmed to:%u to fit in one MAD\n",
 			num_rec, trim_num_rec);
@@ -377,11 +338,11 @@ void osm_lftr_rcv_process(IN void *ctx, IN void *data)
 	}
 #endif
 
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sa->p_log, OSM_LOG_DEBUG,
 		"osm_lftr_rcv_process: " "Returning %u records\n", num_rec);
 
 	if ((p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) && (num_rec == 0)) {
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RECORDS);
 		goto Exit;
 	}
@@ -389,13 +350,13 @@ void osm_lftr_rcv_process(IN void *ctx, IN void *data)
 	/*
 	 * Get a MAD to reply. Address of Mad is in the received mad_wrapper
 	 */
-	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+	p_resp_madw = osm_mad_pool_get(sa->p_mad_pool,
 				       p_madw->h_bind,
 				       num_rec * sizeof(ib_lft_record_t) +
 				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
 
 	if (!p_resp_madw) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_lftr_rcv_process: ERR 4410: "
 			"osm_mad_pool_get failed\n");
 
@@ -405,7 +366,7 @@ void osm_lftr_rcv_process(IN void *ctx, IN void *data)
 			free(p_rec_item);
 		}
 
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RESOURCES);
 
 		goto Exit;
@@ -458,9 +419,9 @@ void osm_lftr_rcv_process(IN void *ctx, IN void *data)
 	CL_ASSERT(cl_is_qlist_empty(&rec_list));
 
 	status = osm_sa_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE,
-				    p_rcv->p_subn);
+				    sa->p_subn);
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_lftr_rcv_process: ERR 4411: "
 			"osm_sa_vendor_send status = %s\n",
 			ib_get_err_str(status));
@@ -468,5 +429,5 @@ void osm_lftr_rcv_process(IN void *ctx, IN void *data)
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
diff --git a/opensm/opensm/osm_sa_link_record.c b/opensm/opensm/osm_sa_link_record.c
index ba239be..1b833eb 100644
--- a/opensm/opensm/osm_sa_link_record.c
+++ b/opensm/opensm/osm_sa_link_record.c
@@ -53,10 +53,9 @@
 #include <iba/ib_types.h>
 #include <complib/cl_qmap.h>
 #include <complib/cl_debug.h>
-#include <opensm/osm_sa_link_record.h>
+#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_switch.h>
-#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_sa.h>
@@ -68,46 +67,8 @@ typedef struct _osm_lr_item {
 
 /**********************************************************************
  **********************************************************************/
-void osm_lr_rcv_construct(IN osm_lr_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_lr_rcv_destroy(IN osm_lr_rcv_t * const p_rcv)
-{
-	OSM_LOG_ENTER(p_rcv->p_log, osm_lr_rcv_destroy);
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_lr_rcv_init(IN osm_lr_rcv_t * const p_rcv,
-		IN osm_sa_resp_t * const p_resp,
-		IN osm_mad_pool_t * const p_mad_pool,
-		IN osm_subn_t * const p_subn,
-		IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
-{
-	OSM_LOG_ENTER(p_log, osm_lr_rcv_init);
-
-	osm_lr_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_resp = p_resp;
-	p_rcv->p_mad_pool = p_mad_pool;
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-	return IB_SUCCESS;
-}
-
-/**********************************************************************
- **********************************************************************/
 static void
-__osm_lr_rcv_build_physp_link(IN osm_lr_rcv_t * const p_rcv,
+__osm_lr_rcv_build_physp_link(IN osm_sa_t * sa,
 			      IN const ib_net16_t from_lid,
 			      IN const ib_net16_t to_lid,
 			      IN const uint8_t from_port,
@@ -117,7 +78,7 @@ __osm_lr_rcv_build_physp_link(IN osm_lr_rcv_t * const p_rcv,
 
 	p_lr_item = malloc(sizeof(*p_lr_item));
 	if (p_lr_item == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_lr_rcv_build_physp_link: ERR 1801: "
 			"Unable to acquire link record\n"
 			"\t\t\t\tFrom port 0x%u\n"
@@ -153,7 +114,7 @@ __get_base_lid(IN const osm_physp_t * p_physp, OUT ib_net16_t * p_base_lid)
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_lr_rcv_get_physp_link(IN osm_lr_rcv_t * const p_rcv,
+__osm_lr_rcv_get_physp_link(IN osm_sa_t * sa,
 			    IN const ib_link_record_t * const p_lr,
 			    IN const osm_physp_t * p_src_physp,
 			    IN const osm_physp_t * p_dest_physp,
@@ -167,7 +128,7 @@ __osm_lr_rcv_get_physp_link(IN osm_lr_rcv_t * const p_rcv,
 	ib_net16_t to_base_lid;
 	ib_net16_t lmc_mask;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_lr_rcv_get_physp_link);
+	OSM_LOG_ENTER(sa->p_log, __osm_lr_rcv_get_physp_link);
 
 	/*
 	   If only one end of the link is specified, determine
@@ -215,20 +176,20 @@ __osm_lr_rcv_get_physp_link(IN osm_lr_rcv_t * const p_rcv,
 
 	/* Check that the p_src_physp, p_dest_physp and p_req_physp
 	   all share a pkey (doesn't have to be the same p_key). */
-	if (!osm_physp_share_pkey(p_rcv->p_log, p_src_physp, p_dest_physp)) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	if (!osm_physp_share_pkey(sa->p_log, p_src_physp, p_dest_physp)) {
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_lr_rcv_get_physp_link: "
 			"Source and Dest PhysPorts do not share PKey\n");
 		goto Exit;
 	}
-	if (!osm_physp_share_pkey(p_rcv->p_log, p_src_physp, p_req_physp)) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	if (!osm_physp_share_pkey(sa->p_log, p_src_physp, p_req_physp)) {
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_lr_rcv_get_physp_link: "
 			"Source and Requester PhysPorts do not share PKey\n");
 		goto Exit;
 	}
-	if (!osm_physp_share_pkey(p_rcv->p_log, p_req_physp, p_dest_physp)) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	if (!osm_physp_share_pkey(sa->p_log, p_req_physp, p_dest_physp)) {
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_lr_rcv_get_physp_link: "
 			"Requester and Dest PhysPorts do not share PKey\n");
 		goto Exit;
@@ -248,7 +209,7 @@ __osm_lr_rcv_get_physp_link(IN osm_lr_rcv_t * const p_rcv,
 	__get_base_lid(p_src_physp, &from_base_lid);
 	__get_base_lid(p_dest_physp, &to_base_lid);
 
-	lmc_mask = ~((1 << p_rcv->p_subn->opt.lmc) - 1);
+	lmc_mask = ~((1 << sa->p_subn->opt.lmc) - 1);
 	lmc_mask = cl_hton16(lmc_mask);
 
 	if (comp_mask & IB_LR_COMPMASK_FROM_LID)
@@ -259,8 +220,8 @@ __osm_lr_rcv_get_physp_link(IN osm_lr_rcv_t * const p_rcv,
 		if (to_base_lid != (p_lr->to_lid & lmc_mask))
 			goto Exit;
 
-	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(sa->p_log, OSM_LOG_DEBUG))
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_lr_rcv_get_physp_link: "
 			"Acquiring link record\n"
 			"\t\t\t\tsrc port 0x%" PRIx64 " (port 0x%X)"
@@ -271,18 +232,17 @@ __osm_lr_rcv_get_physp_link(IN osm_lr_rcv_t * const p_rcv,
 			dest_port_num);
 
 
-	__osm_lr_rcv_build_physp_link(p_rcv, from_base_lid,
-				      to_base_lid, src_port_num,
-				      dest_port_num, p_list);
+	__osm_lr_rcv_build_physp_link(sa, from_base_lid, to_base_lid,
+				      src_port_num, dest_port_num, p_list);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_lr_rcv_get_port_links(IN osm_lr_rcv_t * const p_rcv,
+__osm_lr_rcv_get_port_links(IN osm_sa_t * sa,
 			    IN const ib_link_record_t * const p_lr,
 			    IN const osm_port_t * p_src_port,
 			    IN const osm_port_t * p_dest_port,
@@ -299,7 +259,7 @@ __osm_lr_rcv_get_port_links(IN osm_lr_rcv_t * const p_rcv,
 	uint8_t dest_num_ports;
 	uint8_t dest_port_num;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_lr_rcv_get_port_links);
+	OSM_LOG_ENTER(sa->p_log, __osm_lr_rcv_get_port_links);
 
 	if (p_src_port) {
 		if (p_dest_port) {
@@ -327,7 +287,7 @@ __osm_lr_rcv_get_port_links(IN osm_lr_rcv_t * const p_rcv,
 					if (osm_physp_is_valid(p_src_physp) &&
 					    osm_physp_is_valid(p_dest_physp))
 						__osm_lr_rcv_get_physp_link
-						    (p_rcv, p_lr, p_src_physp,
+						    (sa, p_lr, p_src_physp,
 						     p_dest_physp, comp_mask,
 						     p_list, p_req_physp);
 				}
@@ -348,7 +308,7 @@ __osm_lr_rcv_get_port_links(IN osm_lr_rcv_t * const p_rcv,
 								   port_num);
 					if (osm_physp_is_valid(p_src_physp))
 						__osm_lr_rcv_get_physp_link
-						    (p_rcv, p_lr, p_src_physp,
+						    (sa, p_lr, p_src_physp,
 						     NULL, comp_mask, p_list,
 						     p_req_physp);
 				}
@@ -363,7 +323,7 @@ __osm_lr_rcv_get_port_links(IN osm_lr_rcv_t * const p_rcv,
 								   port_num);
 					if (osm_physp_is_valid(p_src_physp))
 						__osm_lr_rcv_get_physp_link
-						    (p_rcv, p_lr, p_src_physp,
+						    (sa, p_lr, p_src_physp,
 						     NULL, comp_mask, p_list,
 						     p_req_physp);
 				}
@@ -386,7 +346,7 @@ __osm_lr_rcv_get_port_links(IN osm_lr_rcv_t * const p_rcv,
 								   port_num);
 					if (osm_physp_is_valid(p_dest_physp))
 						__osm_lr_rcv_get_physp_link
-						    (p_rcv, p_lr, NULL,
+						    (sa, p_lr, NULL,
 						     p_dest_physp, comp_mask,
 						     p_list, p_req_physp);
 				}
@@ -401,7 +361,7 @@ __osm_lr_rcv_get_port_links(IN osm_lr_rcv_t * const p_rcv,
 								   port_num);
 					if (osm_physp_is_valid(p_dest_physp))
 						__osm_lr_rcv_get_physp_link
-						    (p_rcv, p_lr, NULL,
+						    (sa, p_lr, NULL,
 						     p_dest_physp, comp_mask,
 						     p_list, p_req_physp);
 				}
@@ -410,7 +370,7 @@ __osm_lr_rcv_get_port_links(IN osm_lr_rcv_t * const p_rcv,
 			/*
 			   Process the world (recurse once back into this function).
 			 */
-			p_node_tbl = &p_rcv->p_subn->node_guid_tbl;
+			p_node_tbl = &sa->p_subn->node_guid_tbl;
 			p_node = (osm_node_t *)cl_qmap_head(p_node_tbl);
 
 			while (p_node != (osm_node_t *)cl_qmap_end(p_node_tbl)) {
@@ -422,9 +382,9 @@ __osm_lr_rcv_get_port_links(IN osm_lr_rcv_t * const p_rcv,
 				p_src_physp = osm_node_get_any_physp_ptr(p_node);
 				if (osm_physp_is_valid(p_src_physp)) {
 					p_src_port = (osm_port_t *)
-					    cl_qmap_get(&p_rcv->p_subn->port_guid_tbl,
+					    cl_qmap_get(&sa->p_subn->port_guid_tbl,
 					        osm_physp_get_port_guid(p_src_physp));
-					__osm_lr_rcv_get_port_links(p_rcv, p_lr,
+					__osm_lr_rcv_get_port_links(sa, p_lr,
 								    p_src_port, NULL,
 								    comp_mask, p_list,
 								    p_req_physp);
@@ -435,14 +395,14 @@ __osm_lr_rcv_get_port_links(IN osm_lr_rcv_t * const p_rcv,
 		}
 	}
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
  Returns the SA status to return to the client.
  **********************************************************************/
 static ib_net16_t
-__osm_lr_rcv_get_end_points(IN osm_lr_rcv_t * const p_rcv,
+__osm_lr_rcv_get_end_points(IN osm_sa_t * sa,
 			    IN const osm_madw_t * const p_madw,
 			    OUT const osm_port_t ** const pp_src_port,
 			    OUT const osm_port_t ** const pp_dest_port)
@@ -453,7 +413,7 @@ __osm_lr_rcv_get_end_points(IN osm_lr_rcv_t * const p_rcv,
 	ib_api_status_t status;
 	ib_net16_t sa_status = IB_SA_MAD_STATUS_SUCCESS;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_lr_rcv_get_end_points);
+	OSM_LOG_ENTER(sa->p_log, __osm_lr_rcv_get_end_points);
 
 	/*
 	   Determine what fields are valid and then get a pointer
@@ -467,7 +427,7 @@ __osm_lr_rcv_get_end_points(IN osm_lr_rcv_t * const p_rcv,
 	*pp_dest_port = NULL;
 
 	if (p_sa_mad->comp_mask & IB_LR_COMPMASK_FROM_LID) {
-		status = osm_get_port_by_base_lid(p_rcv->p_subn,
+		status = osm_get_port_by_base_lid(sa->p_subn,
 						  p_lr->from_lid, pp_src_port);
 
 		if ((status != IB_SUCCESS) || (*pp_src_port == NULL)) {
@@ -476,7 +436,7 @@ __osm_lr_rcv_get_end_points(IN osm_lr_rcv_t * const p_rcv,
 			   don't enter it as an error in our own log.
 			   Return an error response to the client.
 			 */
-			osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			osm_log(sa->p_log, OSM_LOG_VERBOSE,
 				"__osm_lr_rcv_get_end_points: "
 				"No source port with LID = 0x%X\n",
 				cl_ntoh16(p_lr->from_lid));
@@ -487,7 +447,7 @@ __osm_lr_rcv_get_end_points(IN osm_lr_rcv_t * const p_rcv,
 	}
 
 	if (p_sa_mad->comp_mask & IB_LR_COMPMASK_TO_LID) {
-		status = osm_get_port_by_base_lid(p_rcv->p_subn,
+		status = osm_get_port_by_base_lid(sa->p_subn,
 						  p_lr->to_lid, pp_dest_port);
 
 		if ((status != IB_SUCCESS) || (*pp_dest_port == NULL)) {
@@ -496,7 +456,7 @@ __osm_lr_rcv_get_end_points(IN osm_lr_rcv_t * const p_rcv,
 			   don't enter it as an error in our own log.
 			   Return an error response to the client.
 			 */
-			osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			osm_log(sa->p_log, OSM_LOG_VERBOSE,
 				"__osm_lr_rcv_get_end_points: "
 				"No dest port with LID = 0x%X\n",
 				cl_ntoh16(p_lr->to_lid));
@@ -507,14 +467,14 @@ __osm_lr_rcv_get_end_points(IN osm_lr_rcv_t * const p_rcv,
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return (sa_status);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_lr_rcv_respond(IN osm_lr_rcv_t * const p_rcv,
+__osm_lr_rcv_respond(IN osm_sa_t * sa,
 		     IN const osm_madw_t * const p_madw,
 		     IN cl_qlist_t * const p_list)
 {
@@ -530,7 +490,7 @@ __osm_lr_rcv_respond(IN osm_lr_rcv_t * const p_rcv,
 	osm_lr_item_t *p_lr_item;
 	const ib_sa_mad_t *p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_lr_rcv_respond);
+	OSM_LOG_ENTER(sa->p_log, __osm_lr_rcv_respond);
 
 	num_rec = cl_qlist_count(p_list);
 	/*
@@ -538,11 +498,11 @@ __osm_lr_rcv_respond(IN osm_lr_rcv_t * const p_rcv,
 	 * If we do a SubnAdmGet and got more than one record it is an error !
 	 */
 	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec > 1)) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_lr_rcv_respond: ERR 1806: "
 			"Got more than one record for SubnAdmGet (%zu)\n",
 			num_rec);
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
 
 		/* need to set the mem free ... */
@@ -559,7 +519,7 @@ __osm_lr_rcv_respond(IN osm_lr_rcv_t * const p_rcv,
 	trim_num_rec =
 	    (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_link_record_t);
 	if (trim_num_rec < num_rec) {
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sa->p_log, OSM_LOG_VERBOSE,
 			"__osm_lr_rcv_respond: "
 			"Number of records:%u trimmed to:%u to fit in one MAD\n",
 			num_rec, trim_num_rec);
@@ -567,8 +527,8 @@ __osm_lr_rcv_respond(IN osm_lr_rcv_t * const p_rcv,
 	}
 #endif
 
-	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(sa->p_log, OSM_LOG_DEBUG)) {
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_lr_rcv_respond: "
 			"Generating response with %zu records", num_rec);
 	}
@@ -576,12 +536,12 @@ __osm_lr_rcv_respond(IN osm_lr_rcv_t * const p_rcv,
 	/*
 	   Get a MAD to reply. Address of Mad is in the received mad_wrapper
 	 */
-	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+	p_resp_madw = osm_mad_pool_get(sa->p_mad_pool,
 				       p_madw->h_bind,
 				       num_rec * sizeof(ib_link_record_t) +
 				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
 	if (!p_resp_madw) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_lr_rcv_respond: ERR 1802: "
 			"Unable to allocate MAD\n");
 		/* Release the quick pool items */
@@ -648,24 +608,24 @@ __osm_lr_rcv_respond(IN osm_lr_rcv_t * const p_rcv,
 	}
 
 	status = osm_sa_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE,
-				    p_rcv->p_subn);
+				    sa->p_subn);
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_lr_rcv_respond: ERR 1803: "
 			"Unable to send MAD (%s)\n", ib_get_err_str(status));
-		/*       osm_mad_pool_put( p_rcv->p_mad_pool, p_resp_madw ); */
+		/*       osm_mad_pool_put( sa->p_mad_pool, p_resp_madw ); */
 		goto Exit;
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 void osm_lr_rcv_process(IN void *context, IN void *data)
 {
-	osm_lr_rcv_t *p_rcv = context;
+	osm_sa_t *sa = context;
 	osm_madw_t *p_madw = data;
 	const ib_link_record_t *p_lr;
 	const ib_sa_mad_t *p_sa_mad;
@@ -675,7 +635,7 @@ void osm_lr_rcv_process(IN void *context, IN void *data)
 	ib_net16_t sa_status;
 	osm_physp_t *p_req_physp;
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_lr_rcv_process);
+	OSM_LOG_ENTER(sa->p_log, osm_lr_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -687,29 +647,29 @@ void osm_lr_rcv_process(IN void *context, IN void *data)
 	/* we only support SubnAdmGet and SubnAdmGetTable methods */
 	if ((p_sa_mad->method != IB_MAD_METHOD_GET) &&
 	    (p_sa_mad->method != IB_MAD_METHOD_GETTABLE)) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_lr_rcv_process: ERR 1804: "
 			"Unsupported Method (%s)\n",
 			ib_get_sa_method_str(p_sa_mad->method));
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
 	}
 
 	/* update the requester physical port. */
-	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-						p_rcv->p_subn,
+	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log,
+						sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
 	if (p_req_physp == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_lr_rcv_process: ERR 1805: "
 			"Cannot find requester physical port\n");
 		goto Exit;
 	}
 
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
-		osm_dump_link_record(p_rcv->p_log, p_lr, OSM_LOG_DEBUG);
+	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
+		osm_dump_link_record(sa->p_log, p_lr, OSM_LOG_DEBUG);
 
 	cl_qlist_init(&lr_list);
 
@@ -717,28 +677,28 @@ void osm_lr_rcv_process(IN void *context, IN void *data)
 	   Most SA functions (including this one) are read-only on the
 	   subnet object, so we grab the lock non-exclusively.
 	 */
-	cl_plock_acquire(p_rcv->p_lock);
+	cl_plock_acquire(sa->p_lock);
 
-	sa_status = __osm_lr_rcv_get_end_points(p_rcv, p_madw,
+	sa_status = __osm_lr_rcv_get_end_points(sa, p_madw,
 						&p_src_port, &p_dest_port);
 
 	if (sa_status == IB_SA_MAD_STATUS_SUCCESS)
-		__osm_lr_rcv_get_port_links(p_rcv, p_lr, p_src_port,
+		__osm_lr_rcv_get_port_links(sa, p_lr, p_src_port,
 					    p_dest_port, p_sa_mad->comp_mask,
 					    &lr_list, p_req_physp);
 
-	cl_plock_release(p_rcv->p_lock);
+	cl_plock_release(sa->p_lock);
 
 	if ((cl_qlist_count(&lr_list) == 0) &&
 	    (p_sa_mad->method == IB_MAD_METHOD_GET)) {
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RECORDS);
 		goto Exit;
 	}
 
-	__osm_lr_rcv_respond(p_rcv, p_madw, &lr_list);
+	__osm_lr_rcv_respond(sa, p_madw, &lr_list);
 
       Exit:
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
diff --git a/opensm/opensm/osm_sa_mad_ctrl.c b/opensm/opensm/osm_sa_mad_ctrl.c
index b54193c..9a9b4c2 100644
--- a/opensm/opensm/osm_sa_mad_ctrl.c
+++ b/opensm/opensm/osm_sa_mad_ctrl.c
@@ -51,11 +51,11 @@
 #include <string.h>
 #include <complib/cl_debug.h>
 #include <iba/ib_types.h>
-#include <opensm/osm_sa_mad_ctrl.h>
 #include <vendor/osm_vendor_api.h>
+#include <opensm/osm_sa_mad_ctrl.h>
 #include <opensm/osm_msgdef.h>
 #include <opensm/osm_helper.h>
-#include <opensm/osm_sa_response.h>
+#include <opensm/osm_sa.h>
 
 /****f* opensm: SA/__osm_sa_mad_ctrl_disp_done_callback
  * NAME
@@ -506,7 +506,7 @@ void osm_sa_mad_ctrl_destroy(IN osm_sa_mad_ctrl_t * const p_ctrl)
  **********************************************************************/
 ib_api_status_t
 osm_sa_mad_ctrl_init(IN osm_sa_mad_ctrl_t * const p_ctrl,
-		     IN osm_sa_resp_t * const p_resp,
+		     IN osm_sa_t * sa,
 		     IN osm_mad_pool_t * const p_mad_pool,
 		     IN osm_vendor_t * const p_vendor,
 		     IN osm_subn_t * const p_subn,
@@ -520,13 +520,13 @@ osm_sa_mad_ctrl_init(IN osm_sa_mad_ctrl_t * const p_ctrl,
 
 	osm_sa_mad_ctrl_construct(p_ctrl);
 
+	p_ctrl->sa = sa;
 	p_ctrl->p_log = p_log;
 	p_ctrl->p_disp = p_disp;
 	p_ctrl->p_mad_pool = p_mad_pool;
 	p_ctrl->p_vendor = p_vendor;
 	p_ctrl->p_stats = p_stats;
 	p_ctrl->p_subn = p_subn;
-	p_ctrl->p_resp = p_resp;
 
 	p_ctrl->h_disp = cl_disp_register(p_disp,
 					  CL_DISP_MSGID_NONE, NULL, p_ctrl);
diff --git a/opensm/opensm/osm_sa_mcmember_record.c b/opensm/opensm/osm_sa_mcmember_record.c
index ddb1ca5..8eb97ad 100644
--- a/opensm/opensm/osm_sa_mcmember_record.c
+++ b/opensm/opensm/osm_sa_mcmember_record.c
@@ -56,20 +56,30 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
-#include <opensm/osm_sa_mcmember_record.h>
-#include <opensm/osm_sa_response.h>
+#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_subnet.h>
 #include <opensm/osm_mad_pool.h>
-#include <vendor/osm_vendor.h>
-#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_msgdef.h>
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_inform.h>
 #include <opensm/osm_sa.h>
 
+#define JOIN_MC_COMP_MASK (IB_MCR_COMPMASK_MGID | \
+				IB_MCR_COMPMASK_PORT_GID | \
+				IB_MCR_COMPMASK_JOIN_STATE)
+
+#define REQUIRED_MC_CREATE_COMP_MASK (IB_MCR_COMPMASK_MGID | \
+					IB_MCR_COMPMASK_PORT_GID | \
+					IB_MCR_COMPMASK_JOIN_STATE | \
+					IB_MCR_COMPMASK_QKEY | \
+					IB_MCR_COMPMASK_TCLASS | \
+					IB_MCR_COMPMASK_PKEY | \
+					IB_MCR_COMPMASK_FLOW | \
+					IB_MCR_COMPMASK_SL)
+
 typedef struct _osm_mcmr_item {
 	cl_list_item_t list_item;
 	ib_member_rec_t rec;
@@ -78,7 +88,7 @@ typedef struct _osm_mcmr_item {
 typedef struct osm_sa_mcmr_search_ctxt {
 	const ib_member_rec_t *p_mcmember_rec;
 	osm_mgrp_t *p_mgrp;
-	osm_mcmr_recv_t *p_rcv;
+	osm_sa_t *sa;
 	cl_qlist_t *p_list;	/* hold results */
 	ib_net64_t comp_mask;
 	const osm_physp_t *p_req_physp;
@@ -86,49 +96,6 @@ typedef struct osm_sa_mcmr_search_ctxt {
 } osm_sa_mcmr_search_ctxt_t;
 
 /**********************************************************************
- **********************************************************************/
-void osm_mcmr_rcv_construct(IN osm_mcmr_recv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_mcmr_rcv_destroy(IN osm_mcmr_recv_t * const p_rcv)
-{
-	CL_ASSERT(p_rcv);
-
-	OSM_LOG_ENTER(p_rcv->p_log, osm_mcmr_rcv_destroy);
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_mcmr_rcv_init(IN osm_sm_t * const p_sm,
-		  IN osm_mcmr_recv_t * const p_rcv,
-		  IN osm_sa_resp_t * const p_resp,
-		  IN osm_mad_pool_t * const p_mad_pool,
-		  IN osm_subn_t * const p_subn,
-		  IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
-{
-	OSM_LOG_ENTER(p_log, osm_mcmr_rcv_init);
-
-	osm_mcmr_rcv_construct(p_rcv);
-
-	p_rcv->p_log = p_log;
-	p_rcv->p_subn = p_subn;
-	p_rcv->p_sm = p_sm;
-	p_rcv->p_lock = p_lock;
-	p_rcv->p_resp = p_resp;
-	p_rcv->p_mad_pool = p_mad_pool;
-	p_rcv->mlid_ho = 0xC000;
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-	return IB_SUCCESS;
-}
-
-/**********************************************************************
  A search function that compares the given mgrp with the search context
  if there is a match by mgid the p_mgrp is copied to the search context
  p_mgrp component
@@ -145,10 +112,10 @@ __search_mgrp_by_mgid(IN cl_map_item_t * const p_map_item, IN void *context)
 	osm_sa_mcmr_search_ctxt_t *p_ctxt =
 	    (osm_sa_mcmr_search_ctxt_t *) context;
 	const ib_member_rec_t *p_recvd_mcmember_rec;
-	osm_mcmr_recv_t *p_rcv;
+	osm_sa_t *sa;
 
 	p_recvd_mcmember_rec = p_ctxt->p_mcmember_rec;
-	p_rcv = p_ctxt->p_rcv;
+	sa = p_ctxt->sa;
 
 	/* ignore groups marked for deletion */
 	if (p_mgrp->to_be_deleted)
@@ -161,7 +128,7 @@ __search_mgrp_by_mgid(IN cl_map_item_t * const p_map_item, IN void *context)
 		return;
 
 	if (p_ctxt->p_mgrp) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__search_mgrp_by_mgid: ERR 1B03: "
 			"Multiple MC groups for same MGID\n");
 		return;
@@ -174,13 +141,13 @@ __search_mgrp_by_mgid(IN cl_map_item_t * const p_map_item, IN void *context)
 /**********************************************************************
  Look for a MGRP in the mgrp_mlid_tbl by mlid
 **********************************************************************/
-static osm_mgrp_t *__get_mgrp_by_mlid(IN osm_mcmr_recv_t * const p_rcv,
+static osm_mgrp_t *__get_mgrp_by_mlid(IN osm_sa_t * sa,
 				      IN ib_net16_t const mlid)
 {
 	cl_map_item_t *map_item;
 
-	map_item = cl_qmap_get(&p_rcv->p_subn->mgrp_mlid_tbl, mlid);
-	if (map_item == cl_qmap_end(&p_rcv->p_subn->mgrp_mlid_tbl)) {
+	map_item = cl_qmap_get(&sa->p_subn->mgrp_mlid_tbl, mlid);
+	if (map_item == cl_qmap_end(&sa->p_subn->mgrp_mlid_tbl)) {
 		return NULL;
 	}
 	return (osm_mgrp_t *) map_item;
@@ -191,17 +158,17 @@ static osm_mgrp_t *__get_mgrp_by_mlid(IN osm_mcmr_recv_t * const p_rcv,
 Look for a MGRP in the mgrp_mlid_tbl by mgid
 ***********************************************************************/
 static ib_api_status_t
-__get_mgrp_by_mgid(IN osm_mcmr_recv_t * const p_rcv,
+__get_mgrp_by_mgid(IN osm_sa_t * sa,
 		   IN ib_member_rec_t * p_recvd_mcmember_rec,
 		   OUT osm_mgrp_t ** pp_mgrp)
 {
 	osm_sa_mcmr_search_ctxt_t mcmr_search_context;
 
 	mcmr_search_context.p_mcmember_rec = p_recvd_mcmember_rec;
-	mcmr_search_context.p_rcv = p_rcv;
+	mcmr_search_context.sa = sa;
 	mcmr_search_context.p_mgrp = NULL;
 
-	cl_qmap_apply_func(&p_rcv->p_subn->mgrp_mlid_tbl,
+	cl_qmap_apply_func(&sa->p_subn->mgrp_mlid_tbl,
 			   __search_mgrp_by_mgid, &mcmr_search_context);
 
 	if (mcmr_search_context.p_mgrp == NULL) {
@@ -236,9 +203,9 @@ Return an mlid to the pool of free mlids.
 But this implementation is not a pool - it simply scans through
 the MGRP database for unused mlids...
 *********************************************************************/
-static void __free_mlid(IN osm_mcmr_recv_t * const p_rcv, IN uint16_t mlid)
+static void __free_mlid(IN osm_sa_t * sa, IN uint16_t mlid)
 {
-	UNUSED_PARAM(p_rcv);
+	UNUSED_PARAM(sa);
 	UNUSED_PARAM(mlid);
 }
 
@@ -248,16 +215,16 @@ TODO: Implement a more scalable - O(1) solution based on pool of
 available mlids.
 **********************************************************************/
 static ib_net16_t
-__get_new_mlid(IN osm_mcmr_recv_t * const p_rcv, IN ib_net16_t requested_mlid)
+__get_new_mlid(IN osm_sa_t * sa, IN ib_net16_t requested_mlid)
 {
-	osm_subn_t *p_subn = p_rcv->p_subn;
+	osm_subn_t *p_subn = sa->p_subn;
 	osm_mgrp_t *p_mgrp;
 	uint8_t *used_mlids_array;
 	uint16_t idx;
 	uint16_t mlid;		/* the result */
 	uint16_t max_num_mlids;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __get_new_mlid);
+	OSM_LOG_ENTER(sa->p_log, __get_new_mlid);
 
 	if (requested_mlid && cl_ntoh16(requested_mlid) >= IB_LID_MCAST_START_HO
 	    && cl_ntoh16(requested_mlid) < p_subn->max_multicast_lid_ho
@@ -272,7 +239,7 @@ __get_new_mlid(IN osm_mcmr_recv_t * const p_rcv, IN ib_net16_t requested_mlid)
 	p_mgrp = (osm_mgrp_t *) cl_qmap_head(&p_subn->mgrp_mlid_tbl);
 	if (p_mgrp == (osm_mgrp_t *) cl_qmap_end(&p_subn->mgrp_mlid_tbl)) {
 		mlid = IB_LID_MCAST_START_HO;
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sa->p_log, OSM_LOG_VERBOSE,
 			"__get_new_mlid: "
 			"No multicast groups found using minimal mlid:0x%04X\n",
 			mlid);
@@ -280,7 +247,7 @@ __get_new_mlid(IN osm_mcmr_recv_t * const p_rcv, IN ib_net16_t requested_mlid)
 	}
 
 	max_num_mlids =
-	    p_rcv->p_subn->max_multicast_lid_ho - IB_LID_MCAST_START_HO;
+	    sa->p_subn->max_multicast_lid_ho - IB_LID_MCAST_START_HO;
 
 	/* track all used mlids in the array (by mlid index) */
 	used_mlids_array = (uint8_t *) malloc(sizeof(uint8_t) * max_num_mlids);
@@ -293,7 +260,7 @@ __get_new_mlid(IN osm_mcmr_recv_t * const p_rcv, IN ib_net16_t requested_mlid)
 	while (p_mgrp != (osm_mgrp_t *) cl_qmap_end(&p_subn->mgrp_mlid_tbl)) {
 		/* ignore mgrps marked for deletion */
 		if (p_mgrp->to_be_deleted == FALSE) {
-			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			osm_log(sa->p_log, OSM_LOG_DEBUG,
 				"__get_new_mlid: "
 				"Found mgrp with lid:0x%X MGID: 0x%016" PRIx64
 				" : " "0x%016" PRIx64 "\n",
@@ -305,8 +272,8 @@ __get_new_mlid(IN osm_mcmr_recv_t * const p_rcv, IN ib_net16_t requested_mlid)
 
 			/* Map in table */
 			if (cl_ntoh16(p_mgrp->mlid) >
-			    p_rcv->p_subn->max_multicast_lid_ho) {
-				osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			    sa->p_subn->max_multicast_lid_ho) {
+				osm_log(sa->p_log, OSM_LOG_ERROR,
 					"__get_new_mlid: ERR 1B27: "
 					"Found mgrp with mlid:0x%04X > max allowed mlid:0x%04X\n",
 					cl_ntoh16(p_mgrp->mlid),
@@ -326,11 +293,11 @@ __get_new_mlid(IN osm_mcmr_recv_t * const p_rcv, IN ib_net16_t requested_mlid)
 	/* did it go above the maximal mlid allowed */
 	if (idx < max_num_mlids) {
 		mlid = idx + IB_LID_MCAST_START_HO;
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sa->p_log, OSM_LOG_VERBOSE,
 			"__get_new_mlid: "
 			"Found available mlid:0x%04X at idx:%u\n", mlid, idx);
 	} else {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__get_new_mlid: ERR 1B23: "
 			"All available:%u mlids are taken\n", max_num_mlids);
 		mlid = 0;
@@ -339,7 +306,7 @@ __get_new_mlid(IN osm_mcmr_recv_t * const p_rcv, IN ib_net16_t requested_mlid)
 	free(used_mlids_array);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return cl_hton16(mlid);
 }
 
@@ -351,18 +318,18 @@ silently drop it. Since it was an intermediate group no need to
 re-route it.
 **********************************************************************/
 static void
-__cleanup_mgrp(IN osm_mcmr_recv_t * const p_rcv, IN ib_net16_t const mlid)
+__cleanup_mgrp(IN osm_sa_t * sa, IN ib_net16_t const mlid)
 {
 	osm_mgrp_t *p_mgrp;
 
-	p_mgrp = __get_mgrp_by_mlid(p_rcv, mlid);
+	p_mgrp = __get_mgrp_by_mlid(sa, mlid);
 	if (p_mgrp) {
 		/* Remove MGRP only if osm_mcm_port_t count is 0 and
 		 * Not a well known group
 		 */
 		if (cl_is_qmap_empty(&p_mgrp->mcm_port_tbl) &&
 		    (p_mgrp->well_known == FALSE)) {
-			cl_qmap_remove_item(&p_rcv->p_subn->mgrp_mlid_tbl,
+			cl_qmap_remove_item(&sa->p_subn->mgrp_mlid_tbl,
 					    (cl_map_item_t *) p_mgrp);
 			osm_mgrp_delete(p_mgrp);
 		}
@@ -374,7 +341,7 @@ Add a port to the group. Calculating its PROXY_JOIN by the Port and
 requester gids.
 **********************************************************************/
 static ib_api_status_t
-__add_new_mgrp_port(IN osm_mcmr_recv_t * p_rcv,
+__add_new_mgrp_port(IN osm_sa_t * sa,
 		    IN osm_mgrp_t * p_mgrp,
 		    IN ib_member_rec_t * p_recvd_mcmember_rec,
 		    IN osm_mad_addr_t * p_mad_addr,
@@ -386,11 +353,11 @@ __add_new_mgrp_port(IN osm_mcmr_recv_t * p_rcv,
 
 	/* set the proxy_join if the requester gid is not identical to the
 	   joined gid */
-	res = osm_get_gid_by_mad_addr(p_rcv->p_log,
-				      p_rcv->p_subn,
+	res = osm_get_gid_by_mad_addr(sa->p_log,
+				      sa->p_subn,
 				      p_mad_addr, &requester_gid);
 	if (res != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__add_new_mgrp_port: ERR 1B29: "
 			"Could not find GID for requester\n");
 
@@ -400,7 +367,7 @@ __add_new_mgrp_port(IN osm_mcmr_recv_t * p_rcv,
 	if (!memcmp(&p_recvd_mcmember_rec->port_gid, &requester_gid,
 		    sizeof(ib_gid_t))) {
 		proxy_join = FALSE;
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__add_new_mgrp_port: "
 			"Create new port with proxy_join FALSE\n");
 	} else {
@@ -408,7 +375,7 @@ __add_new_mgrp_port(IN osm_mcmr_recv_t * p_rcv,
 		   The check that the requester is in the same partition as
 		   the PortGID is done before - just need to update the proxy_join. */
 		proxy_join = TRUE;
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__add_new_mgrp_port: "
 			"Create new port with proxy_join TRUE\n");
 	}
@@ -418,7 +385,7 @@ __add_new_mgrp_port(IN osm_mcmr_recv_t * p_rcv,
 					  p_recvd_mcmember_rec->scope_state,
 					  proxy_join);
 	if (*pp_mcmr_port == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__add_new_mgrp_port: ERR 1B06: "
 			"osm_mgrp_add_port failed\n");
 
@@ -450,7 +417,7 @@ __check_create_comp_mask(ib_net64_t comp_mask,
 Generate the response MAD
 **********************************************************************/
 static void
-__osm_mcmr_rcv_respond(IN const osm_mcmr_recv_t * const p_rcv,
+__osm_mcmr_rcv_respond(IN osm_sa_t * sa,
 		       IN const osm_madw_t * const p_madw,
 		       IN ib_member_rec_t * p_mcmember_rec)
 {
@@ -459,12 +426,12 @@ __osm_mcmr_rcv_respond(IN const osm_mcmr_recv_t * const p_rcv,
 	ib_member_rec_t *p_resp_mcmember_rec;
 	ib_api_status_t status;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_mcmr_rcv_respond);
+	OSM_LOG_ENTER(sa->p_log, __osm_mcmr_rcv_respond);
 
 	/*
 	 *  Get a MAD to reply. Address of Mad is in the received mad_wrapper
 	 */
-	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+	p_resp_madw = osm_mad_pool_get(sa->p_mad_pool,
 				       p_madw->h_bind,
 				       sizeof(ib_member_rec_t) +
 				       IB_SA_MAD_HDR_SIZE,
@@ -506,17 +473,17 @@ __osm_mcmr_rcv_respond(IN const osm_mcmr_recv_t * const p_rcv,
 	p_resp_mcmember_rec->pkt_life |= 2 << 6;	/* exactly */
 
 	status = osm_sa_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE,
-				    p_rcv->p_subn);
+				    sa->p_subn);
 
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_mcmr_rcv_respond: ERR 1B07: "
 			"Unable to send MAD (%s) for TID <0x%" PRIx64 ">\n",
 			ib_get_err_str(status), p_resp_sa_mad->trans_id);
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return;
 }
 
@@ -666,7 +633,7 @@ __validate_port_caps(osm_log_t * const p_log,
  * part of the partition for that MCMemberRecord.
  **********************************************************************/
 static boolean_t
-__validate_modify(IN osm_mcmr_recv_t * const p_rcv,
+__validate_modify(IN osm_sa_t * sa,
 		  IN osm_mgrp_t * p_mgrp,
 		  IN osm_mad_addr_t * p_mad_addr,
 		  IN ib_member_rec_t * p_recvd_mcmember_rec,
@@ -683,7 +650,7 @@ __validate_modify(IN osm_mcmr_recv_t * const p_rcv,
 
 	/* o15-0.2.1: If this is a new port being added - nothing to check */
 	if (!osm_mgrp_is_port_present(p_mgrp, portguid, pp_mcm_port)) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__validate_modify: "
 			"This is a new port in the MC group\n");
 		return TRUE;
@@ -694,12 +661,12 @@ __validate_modify(IN osm_mcmr_recv_t * const p_rcv,
 	if ((*pp_mcm_port)->proxy_join == FALSE) {
 		/* The proxy_join is not set. Modifying can by done only
 		   if the requester GID == PortGID */
-		res = osm_get_gid_by_mad_addr(p_rcv->p_log,
-					      p_rcv->p_subn,
+		res = osm_get_gid_by_mad_addr(sa->p_log,
+					      sa->p_subn,
 					      p_mad_addr, &request_gid);
 
 		if (res != IB_SUCCESS) {
-			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			osm_log(sa->p_log, OSM_LOG_DEBUG,
 				"__validate_modify: "
 				"Could not find port for requested address\n");
 			return FALSE;
@@ -708,7 +675,7 @@ __validate_modify(IN osm_mcmr_recv_t * const p_rcv,
 		if (memcmp
 		    (&((*pp_mcm_port)->port_gid), &request_gid,
 		     sizeof(ib_gid_t))) {
-			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			osm_log(sa->p_log, OSM_LOG_DEBUG,
 				"__validate_modify: "
 				"No ProxyJoin but different ports: stored:0x%016"
 				PRIx64 " request:0x%016" PRIx64 "\n",
@@ -722,16 +689,16 @@ __validate_modify(IN osm_mcmr_recv_t * const p_rcv,
 	} else {
 		/* The proxy_join is set. Modification allowed only if the
 		   requester is part of the partition for this MCMemberRecord */
-		p_request_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-							    p_rcv->p_subn,
+		p_request_physp = osm_get_physp_by_mad_addr(sa->p_log,
+							    sa->p_subn,
 							    p_mad_addr);
 		if (p_request_physp == NULL)
 			return FALSE;
 
-		if (!osm_physp_has_pkey(p_rcv->p_log, p_mgrp->mcmember_rec.pkey,
+		if (!osm_physp_has_pkey(sa->p_log, p_mgrp->mcmember_rec.pkey,
 					p_request_physp)) {
 			/* the request port is not part of the partition for this mgrp */
-			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			osm_log(sa->p_log, OSM_LOG_DEBUG,
 				"__validate_modify: "
 				"ProxyJoin but port not in partition. stored:0x%016"
 				PRIx64 " request:0x%016" PRIx64 "\n",
@@ -769,7 +736,7 @@ __validate_modify(IN osm_mcmr_recv_t * const p_rcv,
  *   by the stored MCMemberRecord:P_Key.
  */
 static boolean_t
-__validate_delete(IN osm_mcmr_recv_t * const p_rcv,
+__validate_delete(IN osm_sa_t * sa,
 		  IN osm_mgrp_t * p_mgrp,
 		  IN osm_mad_addr_t * p_mad_addr,
 		  IN ib_member_rec_t * p_recvd_mcmember_rec,
@@ -783,7 +750,7 @@ __validate_delete(IN osm_mcmr_recv_t * const p_rcv,
 
 	/* 1 */
 	if (!osm_mgrp_is_port_present(p_mgrp, portguid, pp_mcm_port)) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__validate_delete: "
 			"Failed to find the port in the MC group\n");
 		return FALSE;
@@ -792,7 +759,7 @@ __validate_delete(IN osm_mcmr_recv_t * const p_rcv,
 	/* 2 */
 	if (!(p_recvd_mcmember_rec->scope_state & 0x0F &
 	      (*pp_mcm_port)->scope_state)) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__validate_delete: "
 			"Could not find any matching bits in the stored and requested JoinStates\n");
 		return FALSE;
@@ -802,7 +769,7 @@ __validate_delete(IN osm_mcmr_recv_t * const p_rcv,
 	if (((p_recvd_mcmember_rec->scope_state & 0x0F) |
 	     (0x0F & (*pp_mcm_port)->scope_state)) !=
 	    (0x0F & (*pp_mcm_port)->scope_state)) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__validate_delete: "
 			"Some bits in the request JoinState (0x%X) are not set in the stored port (0x%X)\n",
 			(p_recvd_mcmember_rec->scope_state & 0x0F),
@@ -813,9 +780,9 @@ __validate_delete(IN osm_mcmr_recv_t * const p_rcv,
 
 	/* 4 */
 	/* Validate according the the proxy_join (o15-0.1.2) */
-	if (__validate_modify(p_rcv, p_mgrp, p_mad_addr, p_recvd_mcmember_rec,
+	if (__validate_modify(sa, p_mgrp, p_mad_addr, p_recvd_mcmember_rec,
 			      pp_mcm_port) == FALSE) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__validate_delete: "
 			"proxy_join validation failure\n");
 		return FALSE;
@@ -866,17 +833,17 @@ __validate_delete(IN osm_mcmr_recv_t * const p_rcv,
  *    only source for this signature with link-local scope)
  */
 static ib_api_status_t
-__validate_requested_mgid(IN osm_mcmr_recv_t * const p_rcv,
+__validate_requested_mgid(IN osm_sa_t * sa,
 			  IN const ib_member_rec_t * p_mcm_rec)
 {
 	uint16_t signature;
 	boolean_t valid = TRUE;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __validate_requested_mgid);
+	OSM_LOG_ENTER(sa->p_log, __validate_requested_mgid);
 
 	/* 14-a: mcast GID must start with 0xFF */
 	if (p_mcm_rec->mgid.multicast.header[0] != 0xFF) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__validate_requested_mgid: ERR 1B01: "
 			"Wrong MGID Prefix 0x%02X must be 0xFF\n",
 			cl_ntoh16(p_mcm_rec->mgid.multicast.header[0])
@@ -889,7 +856,7 @@ __validate_requested_mgid(IN osm_mcmr_recv_t * const p_rcv,
 	memcpy(&signature, &(p_mcm_rec->mgid.multicast.raw_group_id),
 	       sizeof(signature));
 	signature = cl_ntoh16(signature);
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sa->p_log, OSM_LOG_DEBUG,
 		"__validate_requested_mgid:  "
 		"MGID Signed as 0x%04X\n", signature);
 
@@ -913,7 +880,7 @@ __validate_requested_mgid(IN osm_mcmr_recv_t * const p_rcv,
 	 *
 	 */
 	if (signature == 0x401B || signature == 0x601B) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__validate_requested_mgid:  "
 			"Skipping MGID Validation for IPoIB Signed (0x%04X) MGIDs\n",
 			signature);
@@ -922,7 +889,7 @@ __validate_requested_mgid(IN osm_mcmr_recv_t * const p_rcv,
 
 	/* 14-b: the 3 upper bits in the "flags" should be zero: */
 	if (p_mcm_rec->mgid.multicast.header[1] & 0xE0) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__validate_requested_mgid: ERR 1B28: "
 			"MGID uses Reserved Flags: flags=0x%X\n",
 			(p_mcm_rec->mgid.multicast.header[1] & 0xE0) >> 4);
@@ -935,7 +902,7 @@ __validate_requested_mgid(IN osm_mcmr_recv_t * const p_rcv,
 	if ((signature == 0xA01B) &&
 	    ((p_mcm_rec->mgid.multicast.header[1] & 0x0F) ==
 	     IB_MC_SCOPE_LINK_LOCAL)) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__validate_requested_mgid: ERR 1B24: "
 			"MGID uses 0xA01B signature but with link-local scope\n");
 		valid = FALSE;
@@ -950,7 +917,7 @@ __validate_requested_mgid(IN osm_mcmr_recv_t * const p_rcv,
 	 */
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return (valid);
 }
 
@@ -959,7 +926,7 @@ __validate_requested_mgid(IN osm_mcmr_recv_t * const p_rcv,
  Also set the default MTU and Rate if not provided by the user.
 **********************************************************************/
 static boolean_t
-__mgrp_request_is_realizable(IN osm_mcmr_recv_t * const p_rcv,
+__mgrp_request_is_realizable(IN osm_sa_t * sa,
 			     IN ib_net64_t comp_mask,
 			     IN ib_member_rec_t * p_mcm_rec,
 			     IN const osm_physp_t * const p_physp)
@@ -968,9 +935,9 @@ __mgrp_request_is_realizable(IN osm_mcmr_recv_t * const p_rcv,
 	uint8_t mtu_required, mtu, port_mtu;
 	uint8_t rate_sel = 2;	/* exactly */
 	uint8_t rate_required, rate, port_rate;
-	osm_log_t *p_log = p_rcv->p_log;
+	osm_log_t *p_log = sa->p_log;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __mgrp_request_is_realizable);
+	OSM_LOG_ENTER(sa->p_log, __mgrp_request_is_realizable);
 
 	/*
 	 * End of o15-0.2.3 specifies:
@@ -987,7 +954,7 @@ __mgrp_request_is_realizable(IN osm_mcmr_recv_t * const p_rcv,
 	if (!(comp_mask & IB_MCR_COMPMASK_MTU) ||
 	    !(comp_mask & IB_MCR_COMPMASK_MTU_SEL) ||
 	    (mtu_sel = (p_mcm_rec->mtu >> 6)) == 3)
-		mtu = port_mtu ? port_mtu : p_rcv->p_subn->min_ca_mtu;
+		mtu = port_mtu ? port_mtu : sa->p_subn->min_ca_mtu;
 	else {
 		mtu_required = (uint8_t) (p_mcm_rec->mtu & 0x3F);
 		mtu = mtu_required;
@@ -1003,8 +970,8 @@ __mgrp_request_is_realizable(IN osm_mcmr_recv_t * const p_rcv,
 			/* we provide the largest MTU possible if we can */
 			if (port_mtu)
 				mtu = port_mtu;
-			else if (mtu_required < p_rcv->p_subn->min_ca_mtu)
-				mtu = p_rcv->p_subn->min_ca_mtu;
+			else if (mtu_required < sa->p_subn->min_ca_mtu)
+				mtu = sa->p_subn->min_ca_mtu;
 			else
 				mtu++;
 			break;
@@ -1036,7 +1003,7 @@ __mgrp_request_is_realizable(IN osm_mcmr_recv_t * const p_rcv,
 	if (!(comp_mask & IB_MCR_COMPMASK_RATE)
 	    || !(comp_mask & IB_MCR_COMPMASK_RATE_SEL)
 	    || (rate_sel = (p_mcm_rec->rate >> 6)) == 3)
-		rate = port_rate ? port_rate : p_rcv->p_subn->min_ca_rate;
+		rate = port_rate ? port_rate : sa->p_subn->min_ca_rate;
 	else {
 		rate_required = (uint8_t) (p_mcm_rec->rate & 0x3F);
 		rate = rate_required;
@@ -1052,8 +1019,8 @@ __mgrp_request_is_realizable(IN osm_mcmr_recv_t * const p_rcv,
 			/* we provide the largest RATE possible if we can */
 			if (port_rate)
 				rate = port_rate;
-			else if (rate_required < p_rcv->p_subn->min_ca_rate)
-				rate = p_rcv->p_subn->min_ca_rate;
+			else if (rate_required < sa->p_subn->min_ca_rate)
+				rate = sa->p_subn->min_ca_rate;
 			else
 				rate++;
 			break;
@@ -1080,35 +1047,15 @@ __mgrp_request_is_realizable(IN osm_mcmr_recv_t * const p_rcv,
 	}
 	p_mcm_rec->rate = (rate_sel << 6) | rate;
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return TRUE;
 }
 
 /**********************************************************************
- Call this function to find or create a new mgrp.
-**********************************************************************/
-ib_api_status_t
-osm_mcmr_rcv_find_or_create_new_mgrp(IN osm_mcmr_recv_t * const p_rcv,
-				     IN ib_net64_t comp_mask,
-				     IN ib_member_rec_t *
-				     const p_recvd_mcmember_rec,
-				     OUT osm_mgrp_t ** pp_mgrp)
-{
-	ib_api_status_t status;
-
-	status = __get_mgrp_by_mgid(p_rcv, p_recvd_mcmember_rec, pp_mgrp);
-	if (status == IB_SUCCESS)
-		return status;
-	return osm_mcmr_rcv_create_new_mgrp(p_rcv, comp_mask,
-					    p_recvd_mcmember_rec, NULL,
-					    pp_mgrp);
-}
-
-/**********************************************************************
  Call this function to create a new mgrp.
 **********************************************************************/
 ib_api_status_t
-osm_mcmr_rcv_create_new_mgrp(IN osm_mcmr_recv_t * const p_rcv,
+osm_mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa,
 			     IN ib_net64_t comp_mask,
 			     IN const ib_member_rec_t *
 			     const p_recvd_mcmember_rec,
@@ -1123,7 +1070,7 @@ osm_mcmr_rcv_create_new_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 	ib_api_status_t status = IB_SUCCESS;
 	ib_member_rec_t mcm_rec = *p_recvd_mcmember_rec;	/* copy for modifications */
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_mcmr_rcv_create_new_mgrp);
+	OSM_LOG_ENTER(sa->p_log, osm_mcmr_rcv_create_new_mgrp);
 
 	/* but what if the given MGID was not 0 ? */
 	zero_mgid = 1;
@@ -1138,16 +1085,16 @@ osm_mcmr_rcv_create_new_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 	   we allocate a new mlid number before we might use it
 	   for MGID ...
 	 */
-	mlid = __get_new_mlid(p_rcv, mcm_rec.mlid);
+	mlid = __get_new_mlid(sa, mcm_rec.mlid);
 	if (mlid == 0) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_mcmr_rcv_create_new_mgrp: ERR 1B19: "
 			"__get_new_mlid failed\n");
 		status = IB_SA_MAD_STATUS_NO_RESOURCES;
 		goto Exit;
 	}
 
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sa->p_log, OSM_LOG_DEBUG,
 		"osm_mcmr_rcv_create_new_mgrp: "
 		"Obtained new mlid 0x%X\n", cl_ntoh16(mlid));
 
@@ -1172,12 +1119,12 @@ osm_mcmr_rcv_create_new_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 
 		/* HACK: use the SA port gid to make it globally unique */
 		memcpy((&p_mgid->raw[4]),
-		       &p_rcv->p_subn->opt.subnet_prefix, sizeof(uint64_t));
+		       &sa->p_subn->opt.subnet_prefix, sizeof(uint64_t));
 
 		/* HACK: how do we get a unique number - use the mlid twice */
 		memcpy(&p_mgid->raw[10], &mlid, sizeof(uint16_t));
 		memcpy(&p_mgid->raw[12], &mlid, sizeof(uint16_t));
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"osm_mcmr_rcv_create_new_mgrp: "
 			"Allocated new MGID:0x%016" PRIx64 " : "
 			"0x%016" PRIx64 "\n",
@@ -1185,24 +1132,24 @@ osm_mcmr_rcv_create_new_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 			cl_ntoh64(p_mgid->unicast.interface_id));
 	} else {
 		/* a specific MGID was requested so validate the resulting MGID */
-		valid = __validate_requested_mgid(p_rcv, &mcm_rec);
+		valid = __validate_requested_mgid(sa, &mcm_rec);
 		if (!valid) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_mcmr_rcv_create_new_mgrp: ERR 1B22: "
 				"Invalid requested MGID\n");
-			__free_mlid(p_rcv, mlid);
+			__free_mlid(sa, mlid);
 			status = IB_SA_MAD_STATUS_REQ_INVALID;
 			goto Exit;
 		}
 	}
 
 	/* check the requested parameters are realizable */
-	if (__mgrp_request_is_realizable(p_rcv, comp_mask, &mcm_rec, p_physp) ==
+	if (__mgrp_request_is_realizable(sa, comp_mask, &mcm_rec, p_physp) ==
 	    FALSE) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_mcmr_rcv_create_new_mgrp: ERR 1B26: "
 			"Requested MGRP parameters are not realizable\n");
-		__free_mlid(p_rcv, mlid);
+		__free_mlid(sa, mlid);
 		status = IB_SA_MAD_STATUS_REQ_INVALID;
 		goto Exit;
 	}
@@ -1210,10 +1157,10 @@ osm_mcmr_rcv_create_new_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 	/* create a new MC Group */
 	*pp_mgrp = osm_mgrp_new(mlid);
 	if (*pp_mgrp == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_mcmr_rcv_create_new_mgrp: ERR 1B08: "
 			"osm_mgrp_new failed\n");
-		__free_mlid(p_rcv, mlid);
+		__free_mlid(sa, mlid);
 		status = IB_SA_MAD_STATUS_NO_RESOURCES;
 		goto Exit;
 	}
@@ -1236,36 +1183,56 @@ osm_mcmr_rcv_create_new_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 	   one whose deletion was delayed for an idle time
 	   we need to deallocate it first */
 	p_prev_mgrp =
-	    (osm_mgrp_t *) cl_qmap_get(&p_rcv->p_subn->mgrp_mlid_tbl, mlid);
+	    (osm_mgrp_t *) cl_qmap_get(&sa->p_subn->mgrp_mlid_tbl, mlid);
 	if (p_prev_mgrp !=
-	    (osm_mgrp_t *) cl_qmap_end(&p_rcv->p_subn->mgrp_mlid_tbl)) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	    (osm_mgrp_t *) cl_qmap_end(&sa->p_subn->mgrp_mlid_tbl)) {
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"osm_mcmr_rcv_create_new_mgrp: "
 			"Found previous group for mlid:0x%04x - Need to destroy it\n",
 			cl_ntoh16(mlid));
-		cl_qmap_remove_item(&p_rcv->p_subn->mgrp_mlid_tbl,
+		cl_qmap_remove_item(&sa->p_subn->mgrp_mlid_tbl,
 				    (cl_map_item_t *) p_prev_mgrp);
 		osm_mgrp_delete(p_prev_mgrp);
 	}
 
-	cl_qmap_insert(&p_rcv->p_subn->mgrp_mlid_tbl,
+	cl_qmap_insert(&sa->p_subn->mgrp_mlid_tbl,
 		       mlid, &(*pp_mgrp)->map_item);
 
 	/* Send a Report to any InformInfo registerd for
 	   Trap 66: MCGroup create */
-	osm_mgrp_send_create_notice(p_rcv->p_subn, p_rcv->p_log, *pp_mgrp);
+	osm_mgrp_send_create_notice(sa->p_subn, sa->p_log, *pp_mgrp);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return status;
 
 }
 
+/**********************************************************************
+ Call this function to find or create a new mgrp.
+**********************************************************************/
+ib_api_status_t
+osm_mcmr_rcv_find_or_create_new_mgrp(IN osm_sa_t * sa,
+				     IN ib_net64_t comp_mask,
+				     IN ib_member_rec_t *
+				     const p_recvd_mcmember_rec,
+				     OUT osm_mgrp_t ** pp_mgrp)
+{
+	ib_api_status_t status;
+
+	status = __get_mgrp_by_mgid(sa, p_recvd_mcmember_rec, pp_mgrp);
+	if (status == IB_SUCCESS)
+		return status;
+	return osm_mcmr_rcv_create_new_mgrp(sa, comp_mask,
+					    p_recvd_mcmember_rec, NULL,
+					    pp_mgrp);
+}
+
 /*********************************************************************
 Process a request for leaving the group
 **********************************************************************/
 static void
-__osm_mcmr_rcv_leave_mgrp(IN osm_mcmr_recv_t * const p_rcv,
+__osm_mcmr_rcv_leave_mgrp(IN osm_sa_t * sa,
 			  IN const osm_madw_t * const p_madw)
 {
 	boolean_t valid;
@@ -1281,7 +1248,7 @@ __osm_mcmr_rcv_leave_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 	uint8_t port_join_state;
 	uint8_t new_join_state;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_mcmr_rcv_leave_mgrp);
+	OSM_LOG_ENTER(sa->p_log, __osm_mcmr_rcv_leave_mgrp);
 
 	p_mgrp = NULL;
 	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
@@ -1290,20 +1257,20 @@ __osm_mcmr_rcv_leave_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 
 	mcmember_rec = *p_recvd_mcmember_rec;
 
-	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(sa->p_log, OSM_LOG_DEBUG)) {
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_mcmr_rcv_leave_mgrp: Dump of record\n");
-		osm_dump_mc_record(p_rcv->p_log, &mcmember_rec, OSM_LOG_DEBUG);
+		osm_dump_mc_record(sa->p_log, &mcmember_rec, OSM_LOG_DEBUG);
 	}
 
-	CL_PLOCK_EXCL_ACQUIRE(p_rcv->p_lock);
-	status = __get_mgrp_by_mgid(p_rcv, p_recvd_mcmember_rec, &p_mgrp);
+	CL_PLOCK_EXCL_ACQUIRE(sa->p_lock);
+	status = __get_mgrp_by_mgid(sa, p_recvd_mcmember_rec, &p_mgrp);
 	if (status == IB_SUCCESS) {
 		mlid = p_mgrp->mlid;
 		portguid = p_recvd_mcmember_rec->port_gid.unicast.interface_id;
 
 		/* check validity of the delete request o15-0.1.14 */
-		valid = __validate_delete(p_rcv,
+		valid = __validate_delete(sa,
 					  p_mgrp,
 					  osm_madw_get_mad_addr_ptr(p_madw),
 					  p_recvd_mcmember_rec, &p_mcm_port);
@@ -1327,9 +1294,9 @@ __osm_mcmr_rcv_leave_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 				mcmember_rec.scope_state =
 				    p_mcm_port->scope_state;
 
-				CL_PLOCK_RELEASE(p_rcv->p_lock);
+				CL_PLOCK_RELEASE(sa->p_lock);
 
-				osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+				osm_log(sa->p_log, OSM_LOG_DEBUG,
 					"__osm_mcmr_rcv_leave_mgrp: "
 					"After update JoinState != 0. Updating from 0x%X to 0x%X\n",
 					port_join_state, new_join_state);
@@ -1339,20 +1306,20 @@ __osm_mcmr_rcv_leave_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 				    p_mcm_port->scope_state;
 
 				/* OK we can leave */
-				/* note: osm_sm_mcgrp_leave() will release p_rcv->p_lock */
+				/* note: osm_sm_mcgrp_leave() will release sa->p_lock */
 
 				status =
-				    osm_sm_mcgrp_leave(p_rcv->p_sm, mlid,
+				    osm_sm_mcgrp_leave(sa->sm, mlid,
 						       portguid);
 				if (status != IB_SUCCESS) {
-					osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+					osm_log(sa->p_log, OSM_LOG_ERROR,
 						"__osm_mcmr_rcv_leave_mgrp: ERR 1B09: "
 						"osm_sm_mcgrp_leave failed\n");
 				}
 			}
 		} else {
-			CL_PLOCK_RELEASE(p_rcv->p_lock);
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			CL_PLOCK_RELEASE(sa->p_lock);
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_mcmr_rcv_leave_mgrp: ERR 1B25: "
 				"Received an invalid delete request for "
 				"MGID: 0x%016" PRIx64 " : "
@@ -1368,24 +1335,24 @@ __osm_mcmr_rcv_leave_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 				cl_ntoh64(p_recvd_mcmember_rec->port_gid.
 					  unicast.interface_id));
 			sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
-			osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+			osm_sa_send_error(sa, p_madw, sa_status);
 			goto Exit;
 		}
 	} else {
-		CL_PLOCK_RELEASE(p_rcv->p_lock);
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		CL_PLOCK_RELEASE(sa->p_lock);
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_mcmr_rcv_leave_mgrp: "
 			"Failed since multicast group not present\n");
 		sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
-		osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+		osm_sa_send_error(sa, p_madw, sa_status);
 		goto Exit;
 	}
 
 	/* Send an SA response */
-	__osm_mcmr_rcv_respond(p_rcv, p_madw, &mcmember_rec);
+	__osm_mcmr_rcv_respond(sa, p_madw, &mcmember_rec);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return;
 }
 
@@ -1393,7 +1360,7 @@ __osm_mcmr_rcv_leave_mgrp(IN osm_mcmr_recv_t * const p_rcv,
  Handle a join (or create) request
 **********************************************************************/
 static void
-__osm_mcmr_rcv_join_mgrp(IN osm_mcmr_recv_t * const p_rcv,
+__osm_mcmr_rcv_join_mgrp(IN osm_sa_t * sa,
 			 IN const osm_madw_t * const p_madw)
 {
 	boolean_t valid;
@@ -1413,7 +1380,7 @@ __osm_mcmr_rcv_join_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 	osm_mcast_req_type_t req_type;
 	uint8_t join_state;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_mcmr_rcv_join_mgrp);
+	OSM_LOG_ENTER(sa->p_log, __osm_mcmr_rcv_join_mgrp);
 
 	p_mgrp = NULL;
 	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
@@ -1424,25 +1391,25 @@ __osm_mcmr_rcv_join_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 
 	mcmember_rec = *p_recvd_mcmember_rec;
 
-	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(sa->p_log, OSM_LOG_DEBUG)) {
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_mcmr_rcv_join_mgrp: "
 			"Dump of incoming record\n");
-		osm_dump_mc_record(p_rcv->p_log, &mcmember_rec, OSM_LOG_DEBUG);
+		osm_dump_mc_record(sa->p_log, &mcmember_rec, OSM_LOG_DEBUG);
 	}
 
-	CL_PLOCK_EXCL_ACQUIRE(p_rcv->p_lock);
+	CL_PLOCK_EXCL_ACQUIRE(sa->p_lock);
 
 	/* make sure the requested port guid is known to the SM */
-	p_port = osm_get_port_by_guid(p_rcv->p_subn, portguid);
+	p_port = osm_get_port_by_guid(sa->p_subn, portguid);
 	if (!p_port) {
-		CL_PLOCK_RELEASE(p_rcv->p_lock);
+		CL_PLOCK_RELEASE(sa->p_lock);
 
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_mcmr_rcv_join_mgrp: "
 			"Unknown port GUID 0x%016" PRIx64 "\n", portguid);
 		sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
-		osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+		osm_sa_send_error(sa, p_madw, sa_status);
 		goto Exit;
 	}
 
@@ -1450,22 +1417,22 @@ __osm_mcmr_rcv_join_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 	/* Check that the p_physp and the requester physp are in the same
 	   partition. */
 	p_request_physp =
-	    osm_get_physp_by_mad_addr(p_rcv->p_log,
-				      p_rcv->p_subn,
+	    osm_get_physp_by_mad_addr(sa->p_log,
+				      sa->p_subn,
 				      osm_madw_get_mad_addr_ptr(p_madw));
 	if (p_request_physp == NULL) {
-		CL_PLOCK_RELEASE(p_rcv->p_lock);
+		CL_PLOCK_RELEASE(sa->p_lock);
 		goto Exit;
 	}
 
-	if (!osm_physp_share_pkey(p_rcv->p_log, p_physp, p_request_physp)) {
-		CL_PLOCK_RELEASE(p_rcv->p_lock);
+	if (!osm_physp_share_pkey(sa->p_log, p_physp, p_request_physp)) {
+		CL_PLOCK_RELEASE(sa->p_lock);
 
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_mcmr_rcv_join_mgrp: "
 			"Port and requester don't share pkey\n");
 		sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
-		osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+		osm_sa_send_error(sa, p_madw, sa_status);
 		goto Exit;
 	}
 
@@ -1473,12 +1440,12 @@ __osm_mcmr_rcv_join_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 				  &join_state);
 
 	/* do we need to create a new group? */
-	status = __get_mgrp_by_mgid(p_rcv, p_recvd_mcmember_rec, &p_mgrp);
+	status = __get_mgrp_by_mgid(sa, p_recvd_mcmember_rec, &p_mgrp);
 	if ((status == IB_NOT_FOUND) || p_mgrp->to_be_deleted) {
 		/* check for JoinState.FullMember = 1 o15.0.1.9 */
 		if ((join_state & 0x01) != 0x01) {
-			CL_PLOCK_RELEASE(p_rcv->p_lock);
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			CL_PLOCK_RELEASE(sa->p_lock);
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_mcmr_rcv_join_mgrp: ERR 1B10: "
 				"Provided Join State != FullMember - required for create, "
 				"MGID: 0x%016" PRIx64 " : "
@@ -1490,7 +1457,7 @@ __osm_mcmr_rcv_join_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 					  interface_id), cl_ntoh64(portguid),
 				p_port->p_node->print_desc);
 			sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
-			osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+			osm_sa_send_error(sa, p_madw, sa_status);
 			goto Exit;
 		}
 
@@ -1498,24 +1465,24 @@ __osm_mcmr_rcv_join_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 		valid = __check_create_comp_mask(p_sa_mad->comp_mask,
 						 p_recvd_mcmember_rec);
 		if (valid) {
-			status = osm_mcmr_rcv_create_new_mgrp(p_rcv,
+			status = osm_mcmr_rcv_create_new_mgrp(sa,
 							      p_sa_mad->
 							      comp_mask,
 							      p_recvd_mcmember_rec,
 							      p_physp, &p_mgrp);
 			if (status != IB_SUCCESS) {
-				CL_PLOCK_RELEASE(p_rcv->p_lock);
+				CL_PLOCK_RELEASE(sa->p_lock);
 				sa_status = status;
-				osm_sa_send_error(p_rcv->p_resp, p_madw,
+				osm_sa_send_error(sa, p_madw,
 						  sa_status);
 				goto Exit;
 			}
 			/* copy the MGID to the result */
 			mcmember_rec.mgid = p_mgrp->mcmember_rec.mgid;
 		} else {
-			CL_PLOCK_RELEASE(p_rcv->p_lock);
+			CL_PLOCK_RELEASE(sa->p_lock);
 
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_mcmr_rcv_join_mgrp: ERR 1B11: "
 				"method = %s, "
 				"scope_state = 0x%x, "
@@ -1535,7 +1502,7 @@ __osm_mcmr_rcv_join_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 				p_port->p_node->print_desc);
 
 			sa_status = IB_SA_MAD_STATUS_INSUF_COMPS;
-			osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+			osm_sa_send_error(sa, p_madw, sa_status);
 			goto Exit;
 		}
 		is_new_group = 1;
@@ -1568,20 +1535,20 @@ __osm_mcmr_rcv_join_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 	 *
 	 * We need to check #3 and #5 here:
 	 */
-	valid = __validate_more_comp_fields(p_rcv->p_log,
+	valid = __validate_more_comp_fields(sa->p_log,
 					    p_mgrp,
 					    p_recvd_mcmember_rec,
 					    p_sa_mad->comp_mask)
-	    && __validate_port_caps(p_rcv->p_log, p_mgrp, p_physp)
+	    && __validate_port_caps(sa->p_log, p_mgrp, p_physp)
 	    && (join_state != 0);
 
 	if (!valid) {
 		/* since we might have created the new group we need to cleanup */
-		__cleanup_mgrp(p_rcv, mlid);
+		__cleanup_mgrp(sa, mlid);
 
-		CL_PLOCK_RELEASE(p_rcv->p_lock);
+		CL_PLOCK_RELEASE(sa->p_lock);
 
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_mcmr_rcv_join_mgrp: ERR 1B12: "
 			"__validate_more_comp_fields, __validate_port_caps, "
 			"or JoinState = 0 failed from port 0x%016" PRIx64
@@ -1589,7 +1556,7 @@ __osm_mcmr_rcv_join_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 			cl_ntoh64(portguid), p_port->p_node->print_desc);
 
 		sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
-		osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+		osm_sa_send_error(sa, p_madw, sa_status);
 		goto Exit;
 	}
 
@@ -1601,14 +1568,14 @@ __osm_mcmr_rcv_join_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 		 * o15-0.2.1 requires validation of the requesting port
 		 * in the case of modification:
 		 */
-		valid = __validate_modify(p_rcv,
+		valid = __validate_modify(sa,
 					  p_mgrp,
 					  osm_madw_get_mad_addr_ptr(p_madw),
 					  p_recvd_mcmember_rec, &p_mcmr_port);
 		if (!valid) {
-			CL_PLOCK_RELEASE(p_rcv->p_lock);
+			CL_PLOCK_RELEASE(sa->p_lock);
 
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_mcmr_rcv_join_mgrp: ERR 1B13: "
 				"__validate_modify failed from port 0x%016"
 				PRIx64 " (%s), "
@@ -1617,13 +1584,13 @@ __osm_mcmr_rcv_join_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 				p_port->p_node->print_desc);
 
 			sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
-			osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+			osm_sa_send_error(sa, p_madw, sa_status);
 			goto Exit;
 		}
 	}
 
 	/* create or update existing port (join-state will be updated) */
-	status = __add_new_mgrp_port(p_rcv,
+	status = __add_new_mgrp_port(sa,
 				     p_mgrp,
 				     p_recvd_mcmember_rec,
 				     osm_madw_get_mad_addr_ptr(p_madw),
@@ -1631,15 +1598,15 @@ __osm_mcmr_rcv_join_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 
 	if (status != IB_SUCCESS) {
 		/* we fail to add the port so we might need to delete the group */
-		__cleanup_mgrp(p_rcv, mlid);
+		__cleanup_mgrp(sa, mlid);
 
-		CL_PLOCK_RELEASE(p_rcv->p_lock);
+		CL_PLOCK_RELEASE(sa->p_lock);
 		if (status == IB_INVALID_PARAMETER)
 			sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
 		else
 			sa_status = IB_SA_MAD_STATUS_NO_RESOURCES;
 
-		osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+		osm_sa_send_error(sa, p_madw, sa_status);
 		goto Exit;
 	}
 
@@ -1650,48 +1617,48 @@ __osm_mcmr_rcv_join_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 	__copy_from_create_mc_rec(&mcmember_rec, &p_mgrp->mcmember_rec);
 
 	/* Release the lock as we don't need it. */
-	CL_PLOCK_RELEASE(p_rcv->p_lock);
+	CL_PLOCK_RELEASE(sa->p_lock);
 
 	/* do the actual routing (actually schedule the update) */
 	status =
-	    osm_sm_mcgrp_join(p_rcv->p_sm,
+	    osm_sm_mcgrp_join(sa->sm,
 			      mlid,
 			      p_recvd_mcmember_rec->port_gid.unicast.
 			      interface_id, req_type);
 
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_mcmr_rcv_join_mgrp: ERR 1B14: "
 			"osm_sm_mcgrp_join failed from port 0x%016" PRIx64
 			" (%s), " "sending IB_SA_MAD_STATUS_NO_RESOURCES\n",
 			cl_ntoh64(portguid), p_port->p_node->print_desc);
 
-		CL_PLOCK_EXCL_ACQUIRE(p_rcv->p_lock);
+		CL_PLOCK_EXCL_ACQUIRE(sa->p_lock);
 
 		/* the request for routing failed so we need to remove the port */
-		p_mgrp = __get_mgrp_by_mlid(p_rcv, mlid);
+		p_mgrp = __get_mgrp_by_mlid(sa, mlid);
 		if (p_mgrp != NULL) {
-			osm_mgrp_remove_port(p_rcv->p_subn,
-					     p_rcv->p_log,
+			osm_mgrp_remove_port(sa->p_subn,
+					     sa->p_log,
 					     p_mgrp,
 					     p_recvd_mcmember_rec->port_gid.
 					     unicast.interface_id);
-			__cleanup_mgrp(p_rcv, mlid);
+			__cleanup_mgrp(sa, mlid);
 		}
-		CL_PLOCK_RELEASE(p_rcv->p_lock);
+		CL_PLOCK_RELEASE(sa->p_lock);
 		sa_status = IB_SA_MAD_STATUS_NO_RESOURCES;
-		osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+		osm_sa_send_error(sa, p_madw, sa_status);
 		goto Exit;
 
 	}
 	/* failed to route */
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
-		osm_dump_mc_record(p_rcv->p_log, &mcmember_rec, OSM_LOG_DEBUG);
+	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
+		osm_dump_mc_record(sa->p_log, &mcmember_rec, OSM_LOG_DEBUG);
 
-	__osm_mcmr_rcv_respond(p_rcv, p_madw, &mcmember_rec);
+	__osm_mcmr_rcv_respond(sa, p_madw, &mcmember_rec);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return;
 }
 
@@ -1699,18 +1666,18 @@ __osm_mcmr_rcv_join_mgrp(IN osm_mcmr_recv_t * const p_rcv,
  Add a patched multicast group to the results list
 **********************************************************************/
 static ib_api_status_t
-__osm_mcmr_rcv_new_mcmr(IN osm_mcmr_recv_t * const p_rcv,
+__osm_mcmr_rcv_new_mcmr(IN osm_sa_t * sa,
 			IN const ib_member_rec_t * p_rcvd_rec,
 			IN cl_qlist_t * const p_list)
 {
 	osm_mcmr_item_t *p_rec_item;
 	ib_api_status_t status = IB_SUCCESS;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_mcmr_rcv_new_mcmr);
+	OSM_LOG_ENTER(sa->p_log, __osm_mcmr_rcv_new_mcmr);
 
 	p_rec_item = malloc(sizeof(*p_rec_item));
 	if (p_rec_item == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_mcmr_rcv_new_mcmr: ERR 1B15: "
 			"rec_item alloc failed\n");
 		status = IB_INSUFFICIENT_RESOURCES;
@@ -1725,7 +1692,7 @@ __osm_mcmr_rcv_new_mcmr(IN osm_mcmr_recv_t * const p_rcv,
 	cl_qlist_insert_tail(p_list, &p_rec_item->list_item);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return (status);
 }
 
@@ -1739,7 +1706,7 @@ __osm_sa_mcm_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
 	const osm_mgrp_t *const p_mgrp = (osm_mgrp_t *) p_map_item;
 	osm_sa_mcmr_search_ctxt_t *const p_ctxt =
 	    (osm_sa_mcmr_search_ctxt_t *) context;
-	osm_mcmr_recv_t *const p_rcv = p_ctxt->p_rcv;
+	osm_sa_t *sa = p_ctxt->sa;
 	const ib_member_rec_t *p_rcvd_rec = p_ctxt->p_mcmember_rec;
 	const osm_physp_t *p_req_physp = p_ctxt->p_req_physp;
 
@@ -1755,15 +1722,15 @@ __osm_sa_mcm_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
 	ib_gid_t port_gid;
 	boolean_t proxy_join = FALSE;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_mcm_by_comp_mask_cb);
+	OSM_LOG_ENTER(sa->p_log, __osm_sa_mcm_by_comp_mask_cb);
 
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sa->p_log, OSM_LOG_DEBUG,
 		"__osm_sa_mcm_by_comp_mask_cb: "
 		"Checking mlid:0x%X\n", cl_ntoh16(p_mgrp->mlid));
 
 	/* the group might be marked for deletion */
 	if (p_mgrp->to_be_deleted) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_sa_mcm_by_comp_mask_cb: "
 			"Group mlid:0x%X is marked to be deleted\n",
 			cl_ntoh16(p_mgrp->mlid));
@@ -1783,7 +1750,7 @@ __osm_sa_mcm_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
 
 	/* if the requester physical port doesn't have the pkey that is defined for
 	   the group - exit. */
-	if (!osm_physp_has_pkey(p_rcv->p_log, p_mgrp->mcmember_rec.pkey,
+	if (!osm_physp_has_pkey(sa->p_log, p_mgrp->mcmember_rec.pkey,
 				p_req_physp))
 		goto Exit;
 
@@ -1830,7 +1797,7 @@ __osm_sa_mcm_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
 		goto Exit;
 
 	/* need to validate mtu, rate, and pkt_lifetime fields */
-	if (__validate_more_comp_fields(p_rcv->p_log,
+	if (__validate_more_comp_fields(sa->p_log,
 					p_mgrp, p_rcvd_rec, comp_mask) == FALSE)
 		goto Exit;
 
@@ -1861,7 +1828,7 @@ __osm_sa_mcm_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
 	/* Many MC records returned */
 	if ((p_ctxt->trusted_req == TRUE)
 	    && !(IB_MCR_COMPMASK_PORT_GID & comp_mask)) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_sa_mcm_by_comp_mask_cb: "
 			"Trusted req is TRUE and no specific port defined\n");
 
@@ -1878,7 +1845,7 @@ __osm_sa_mcm_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
 				memcpy(&(match_rec.port_gid),
 				       &(p_mcm_port->port_gid),
 				       sizeof(ib_gid_t));
-				osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+				osm_log(sa->p_log, OSM_LOG_DEBUG,
 					"__osm_sa_mcm_by_comp_mask_cb: "
 					"Record of port_gid: 0x%016" PRIx64
 					"0x%016" PRIx64
@@ -1893,7 +1860,7 @@ __osm_sa_mcm_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
 				match_rec.proxy_join =
 				    (uint8_t) (p_mcm_port->proxy_join);
 
-				__osm_mcmr_rcv_new_mcmr(p_rcv, &match_rec,
+				__osm_mcmr_rcv_new_mcmr(sa, &match_rec,
 							p_ctxt->p_list);
 			}
 			p_item = cl_qmap_next(p_item);
@@ -1911,18 +1878,18 @@ __osm_sa_mcm_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
 		memcpy(&(match_rec.port_gid), &port_gid, sizeof(ib_gid_t));
 		match_rec.proxy_join = (uint8_t) proxy_join;
 
-		__osm_mcmr_rcv_new_mcmr(p_rcv, &match_rec, p_ctxt->p_list);
+		__osm_mcmr_rcv_new_mcmr(sa, &match_rec, p_ctxt->p_list);
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
  Handle a query request
 **********************************************************************/
 static void
-__osm_mcmr_query_mgrp(IN osm_mcmr_recv_t * const p_rcv,
+__osm_mcmr_query_mgrp(IN osm_sa_t * sa,
 		      IN const osm_madw_t * const p_madw)
 {
 	const ib_sa_mad_t *p_rcvd_mad;
@@ -1943,7 +1910,7 @@ __osm_mcmr_query_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 	osm_physp_t *p_req_physp;
 	boolean_t trusted_req;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_mcmr_query_mgrp);
+	OSM_LOG_ENTER(sa->p_log, __osm_mcmr_query_mgrp);
 
 	p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);
 	p_rcvd_rec = (ib_member_rec_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);
@@ -1956,12 +1923,12 @@ __osm_mcmr_query_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 	trusted_req = (p_rcvd_mad->sm_key != 0);
 
 	/* update the requester physical port. */
-	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-						p_rcv->p_subn,
+	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log,
+						sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
 	if (p_req_physp == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_mcmr_query_mgrp: ERR 1B04: "
 			"Cannot find requester physical port\n");
 		goto Exit;
@@ -1972,17 +1939,17 @@ __osm_mcmr_query_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 	context.p_mcmember_rec = p_rcvd_rec;
 	context.p_list = &rec_list;
 	context.comp_mask = p_rcvd_mad->comp_mask;
-	context.p_rcv = p_rcv;
+	context.sa = sa;
 	context.p_req_physp = p_req_physp;
 	context.trusted_req = trusted_req;
 
-	CL_PLOCK_ACQUIRE(p_rcv->p_lock);
+	CL_PLOCK_ACQUIRE(sa->p_lock);
 
 	/* simply go over all MCGs and match */
-	cl_qmap_apply_func(&p_rcv->p_subn->mgrp_mlid_tbl,
+	cl_qmap_apply_func(&sa->p_subn->mgrp_mlid_tbl,
 			   __osm_sa_mcm_by_comp_mask_cb, &context);
 
-	CL_PLOCK_RELEASE(p_rcv->p_lock);
+	CL_PLOCK_RELEASE(sa->p_lock);
 
 	num_rec = cl_qlist_count(&rec_list);
 
@@ -1991,11 +1958,11 @@ __osm_mcmr_query_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 	 * If we do a SubnAdmGet and got more than one record it is an error !
 	 */
 	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec > 1)) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_mcmr_query_mgrp: ERR 1B05: "
 			"Got more than one record for SubnAdmGet (%u)\n",
 			num_rec);
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
 
 		/* need to set the mem free ... */
@@ -2016,7 +1983,7 @@ __osm_mcmr_query_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 	trim_num_rec =
 	    (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_member_rec_t);
 	if (trim_num_rec < num_rec) {
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sa->p_log, OSM_LOG_VERBOSE,
 			"__osm_mcmr_query_mgrp: "
 			"Number of records:%u trimmed to:%u to fit in one MAD\n",
 			num_rec, trim_num_rec);
@@ -2024,11 +1991,11 @@ __osm_mcmr_query_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 	}
 #endif
 
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sa->p_log, OSM_LOG_DEBUG,
 		"__osm_mcmr_query_mgrp: " "Returning %u records\n", num_rec);
 
 	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0)) {
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RECORDS);
 		goto Exit;
 	}
@@ -2036,14 +2003,14 @@ __osm_mcmr_query_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 	/*
 	 * Get a MAD to reply. Address of Mad is in the received mad_wrapper
 	 */
-	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+	p_resp_madw = osm_mad_pool_get(sa->p_mad_pool,
 				       p_madw->h_bind,
 				       num_rec * sizeof(ib_member_rec_t) +
 				       IB_SA_MAD_HDR_SIZE,
 				       osm_madw_get_mad_addr_ptr(p_madw));
 
 	if (!p_resp_madw) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_mcmr_query_mgrp: ERR 1B16: "
 			"osm_mad_pool_get failed\n");
 
@@ -2053,7 +2020,7 @@ __osm_mcmr_query_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 			free(p_rec_item);
 		}
 
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RESOURCES);
 		goto Exit;
 	}
@@ -2121,9 +2088,9 @@ __osm_mcmr_query_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 	CL_ASSERT(cl_is_qlist_empty(&rec_list));
 
 	status = osm_sa_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE,
-				    p_rcv->p_subn);
+				    sa->p_subn);
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_mcmr_query_mgrp: ERR 1B17: "
 			"osm_sa_vendor_send status = %s\n",
 			ib_get_err_str(status));
@@ -2131,23 +2098,23 @@ __osm_mcmr_query_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 void osm_mcmr_rcv_process(IN void *context, IN void *data)
 {
-	osm_mcmr_recv_t *p_rcv = context;
+	osm_sa_t *sa = context;
 	osm_madw_t *p_madw = data;
 	ib_sa_mad_t *p_sa_mad;
 	ib_net16_t sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
 	ib_member_rec_t *p_recvd_mcmember_rec;
 	boolean_t valid;
 
-	CL_ASSERT(p_rcv);
+	CL_ASSERT(sa);
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_mcmr_rcv_process);
+	OSM_LOG_ENTER(sa->p_log, osm_mcmr_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -2161,7 +2128,7 @@ void osm_mcmr_rcv_process(IN void *context, IN void *data)
 	case IB_MAD_METHOD_SET:
 		valid = __check_join_comp_mask(p_sa_mad->comp_mask);
 		if (!valid) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_mcmr_rcv_process: ERR 1B18: "
 				"component mask = 0x%016" PRIx64 ", "
 				"expected comp mask = 0x%016" PRIx64 " ,"
@@ -2180,52 +2147,52 @@ void osm_mcmr_rcv_process(IN void *context, IN void *data)
 				cl_ntoh64(p_recvd_mcmember_rec->port_gid.
 					  unicast.interface_id));
 
-			osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+			osm_sa_send_error(sa, p_madw, sa_status);
 			goto Exit;
 		}
 
 		/*
 		 * Join or Create Multicast Group
 		 */
-		__osm_mcmr_rcv_join_mgrp(p_rcv, p_madw);
+		__osm_mcmr_rcv_join_mgrp(sa, p_madw);
 		break;
 	case IB_MAD_METHOD_DELETE:
 		valid = __check_join_comp_mask(p_sa_mad->comp_mask);
 		if (!valid) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_mcmr_rcv_process: ERR 1B20: "
 				"component mask = 0x%016" PRIx64 ", "
 				"expected comp mask = 0x%016" PRIx64 "\n",
 				cl_ntoh64(p_sa_mad->comp_mask),
 				CL_NTOH64(JOIN_MC_COMP_MASK));
 
-			osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+			osm_sa_send_error(sa, p_madw, sa_status);
 			goto Exit;
 		}
 
 		/*
 		 * Leave Multicast Group
 		 */
-		__osm_mcmr_rcv_leave_mgrp(p_rcv, p_madw);
+		__osm_mcmr_rcv_leave_mgrp(sa, p_madw);
 		break;
 	case IB_MAD_METHOD_GET:
 	case IB_MAD_METHOD_GETTABLE:
 		/*
 		 * Querying a Multicast Group
 		 */
-		__osm_mcmr_query_mgrp(p_rcv, p_madw);
+		__osm_mcmr_query_mgrp(sa, p_madw);
 		break;
 	default:
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_mcmr_rcv_process: ERR 1B21: "
 			"Unsupported Method (%s)\n",
 			ib_get_sa_method_str(p_sa_mad->method));
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		break;
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return;
 }
diff --git a/opensm/opensm/osm_sa_mft_record.c b/opensm/opensm/osm_sa_mft_record.c
index f9ac527..30506a6 100644
--- a/opensm/opensm/osm_sa_mft_record.c
+++ b/opensm/opensm/osm_sa_mft_record.c
@@ -52,9 +52,8 @@
 #include <iba/ib_types.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
-#include <opensm/osm_sa_mft_record.h>
-#include <opensm/osm_switch.h>
 #include <vendor/osm_vendor_api.h>
+#include <opensm/osm_switch.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_sa.h>
@@ -68,52 +67,14 @@ typedef struct _osm_mftr_search_ctxt {
 	const ib_mft_record_t *p_rcvd_rec;
 	ib_net64_t comp_mask;
 	cl_qlist_t *p_list;
-	osm_mftr_rcv_t *p_rcv;
+	osm_sa_t *sa;
 	const osm_physp_t *p_req_physp;
 } osm_mftr_search_ctxt_t;
 
 /**********************************************************************
  **********************************************************************/
-void osm_mftr_rcv_construct(IN osm_mftr_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_mftr_rcv_destroy(IN osm_mftr_rcv_t * const p_rcv)
-{
-	OSM_LOG_ENTER(p_rcv->p_log, osm_mftr_rcv_destroy);
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_mftr_rcv_init(IN osm_mftr_rcv_t * const p_rcv,
-		  IN osm_sa_resp_t * const p_resp,
-		  IN osm_mad_pool_t * const p_mad_pool,
-		  IN osm_subn_t * const p_subn,
-		  IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
-{
-	OSM_LOG_ENTER(p_log, osm_mftr_rcv_init);
-
-	osm_mftr_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_resp = p_resp;
-	p_rcv->p_mad_pool = p_mad_pool;
-
-	OSM_LOG_EXIT(p_log);
-	return IB_SUCCESS;
-}
-
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
-__osm_mftr_rcv_new_mftr(IN osm_mftr_rcv_t * const p_rcv,
+__osm_mftr_rcv_new_mftr(IN osm_sa_t * sa,
 			IN osm_switch_t * const p_sw,
 			IN cl_qlist_t * const p_list,
 			IN ib_net16_t const lid,
@@ -123,19 +84,19 @@ __osm_mftr_rcv_new_mftr(IN osm_mftr_rcv_t * const p_rcv,
 	ib_api_status_t status = IB_SUCCESS;
 	uint16_t position_block_num;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_mftr_rcv_new_mftr);
+	OSM_LOG_ENTER(sa->p_log, __osm_mftr_rcv_new_mftr);
 
 	p_rec_item = malloc(sizeof(*p_rec_item));
 	if (p_rec_item == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_mftr_rcv_new_mftr: ERR 4A02: "
 			"rec_item alloc failed\n");
 		status = IB_INSUFFICIENT_RESOURCES;
 		goto Exit;
 	}
 
-	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(sa->p_log, OSM_LOG_DEBUG)) {
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_mftr_rcv_new_mftr: "
 			"New MulticastForwardingTable: sw 0x%016" PRIx64
 			"\n\t\t\t\tblock %u position %u lid 0x%02X\n",
@@ -158,27 +119,27 @@ __osm_mftr_rcv_new_mftr(IN osm_mftr_rcv_t * const p_rcv,
 	cl_qlist_insert_tail(p_list, &p_rec_item->list_item);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
-static osm_port_t *__osm_mftr_get_port_by_guid(IN osm_mftr_rcv_t * const p_rcv,
+static osm_port_t *__osm_mftr_get_port_by_guid(IN osm_sa_t * sa,
 					       IN uint64_t port_guid)
 {
 	osm_port_t *p_port;
 
-	CL_PLOCK_ACQUIRE(p_rcv->p_lock);
+	CL_PLOCK_ACQUIRE(sa->p_lock);
 
-	p_port = osm_get_port_by_guid(p_rcv->p_subn, port_guid);
+	p_port = osm_get_port_by_guid(sa->p_subn, port_guid);
 	if (!p_port) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_mftr_get_port_by_guid ERR 4A04: "
 			"Invalid port GUID 0x%016" PRIx64 "\n", port_guid);
 	}
 
-	CL_PLOCK_RELEASE(p_rcv->p_lock);
+	CL_PLOCK_RELEASE(sa->p_lock);
 	return p_port;
 }
 
@@ -192,7 +153,7 @@ __osm_mftr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
 	    (osm_mftr_search_ctxt_t *) context;
 	osm_switch_t *const p_sw = (osm_switch_t *) p_map_item;
 	const ib_mft_record_t *const p_rcvd_rec = p_ctxt->p_rcvd_rec;
-	osm_mftr_rcv_t *const p_rcv = p_ctxt->p_rcv;
+	osm_sa_t *sa = p_ctxt->sa;
 	ib_net64_t const comp_mask = p_ctxt->comp_mask;
 	const osm_physp_t *const p_req_physp = p_ctxt->p_req_physp;
 	osm_port_t *p_port;
@@ -204,10 +165,10 @@ __osm_mftr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
 
 	/* In switches, the port guid is the node guid. */
 	p_port =
-	    __osm_mftr_get_port_by_guid(p_rcv,
+	    __osm_mftr_get_port_by_guid(sa,
 					p_sw->p_node->node_info.port_guid);
 	if (!p_port) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_mftr_rcv_by_comp_mask: ERR 4A05: "
 			"Failed to find Port by Node Guid:0x%016" PRIx64
 			"\n", cl_ntoh64(p_sw->p_node->node_info.node_guid)
@@ -219,7 +180,7 @@ __osm_mftr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
 	   the same partition. */
 	p_physp = p_port->p_physp;
 	if (!p_physp) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_mftr_rcv_by_comp_mask: ERR 4A06: "
 			"Failed to find default physical Port by Node Guid:0x%016"
 			PRIx64 "\n",
@@ -227,7 +188,7 @@ __osm_mftr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
 		    );
 		return;
 	}
-	if (!osm_physp_share_pkey(p_rcv->p_log, p_req_physp, p_physp))
+	if (!osm_physp_share_pkey(sa->p_log, p_req_physp, p_physp))
 		return;
 
 	/* get the port 0 of the switch */
@@ -235,7 +196,7 @@ __osm_mftr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
 
 	/* compare the lids - if required */
 	if (comp_mask & IB_MFTR_COMPMASK_LID) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_mftr_rcv_by_comp_mask: "
 			"Comparing lid:0x%02X to port lid range: 0x%02X .. 0x%02X\n",
 			cl_ntoh16(p_rcvd_rec->lid), min_lid_ho, max_lid_ho);
@@ -282,7 +243,7 @@ __osm_mftr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
 	for (block = min_block; block <= max_block; block++)
 		for (position = min_position; position <= max_position;
 		     position++)
-			__osm_mftr_rcv_new_mftr(p_rcv, p_sw, p_ctxt->p_list,
+			__osm_mftr_rcv_new_mftr(sa, p_sw, p_ctxt->p_list,
 						osm_port_get_base_lid(p_port),
 						block, position);
 }
@@ -291,7 +252,7 @@ __osm_mftr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
  **********************************************************************/
 void osm_mftr_rcv_process(IN void *ctx, IN void *data)
 {
-	osm_mftr_rcv_t *p_rcv = ctx;
+	osm_sa_t *sa = ctx;
 	osm_madw_t *p_madw = data;
 	const ib_sa_mad_t *p_rcvd_mad;
 	const ib_mft_record_t *p_rcvd_rec;
@@ -309,9 +270,9 @@ void osm_mftr_rcv_process(IN void *ctx, IN void *data)
 	ib_api_status_t status = IB_SUCCESS;
 	osm_physp_t *p_req_physp;
 
-	CL_ASSERT(p_rcv);
+	CL_ASSERT(sa);
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_mftr_rcv_process);
+	OSM_LOG_ENTER(sa->p_log, osm_mftr_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -323,22 +284,22 @@ void osm_mftr_rcv_process(IN void *ctx, IN void *data)
 	/* we only support SubnAdmGet and SubnAdmGetTable methods */
 	if ((p_rcvd_mad->method != IB_MAD_METHOD_GET) &&
 	    (p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE)) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_mftr_rcv_process: ERR 4A08: "
 			"Unsupported Method (%s)\n",
 			ib_get_sa_method_str(p_rcvd_mad->method));
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
 	}
 
 	/* update the requester physical port. */
-	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-						p_rcv->p_subn,
+	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log,
+						sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
 	if (p_req_physp == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_mftr_rcv_process: ERR 4A07: "
 			"Cannot find requester physical port\n");
 		goto Exit;
@@ -349,16 +310,16 @@ void osm_mftr_rcv_process(IN void *ctx, IN void *data)
 	context.p_rcvd_rec = p_rcvd_rec;
 	context.p_list = &rec_list;
 	context.comp_mask = p_rcvd_mad->comp_mask;
-	context.p_rcv = p_rcv;
+	context.sa = sa;
 	context.p_req_physp = p_req_physp;
 
-	cl_plock_acquire(p_rcv->p_lock);
+	cl_plock_acquire(sa->p_lock);
 
 	/* Go over all switches */
-	cl_qmap_apply_func(&p_rcv->p_subn->sw_guid_tbl,
+	cl_qmap_apply_func(&sa->p_subn->sw_guid_tbl,
 			   __osm_mftr_rcv_by_comp_mask, &context);
 
-	cl_plock_release(p_rcv->p_lock);
+	cl_plock_release(sa->p_lock);
 
 	num_rec = cl_qlist_count(&rec_list);
 
@@ -368,16 +329,16 @@ void osm_mftr_rcv_process(IN void *ctx, IN void *data)
 	 */
 	if (p_rcvd_mad->method == IB_MAD_METHOD_GET) {
 		if (num_rec == 0) {
-			osm_sa_send_error(p_rcv->p_resp, p_madw,
+			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_NO_RECORDS);
 			goto Exit;
 		}
 		if (num_rec > 1) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_mftr_rcv_process: ERR 4A09: "
 				"Got more than one record for SubnAdmGet (%u)\n",
 				num_rec);
-			osm_sa_send_error(p_rcv->p_resp, p_madw,
+			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
 
 			/* need to set the mem free ... */
@@ -400,7 +361,7 @@ void osm_mftr_rcv_process(IN void *ctx, IN void *data)
 	trim_num_rec =
 	    (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_mft_record_t);
 	if (trim_num_rec < num_rec) {
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sa->p_log, OSM_LOG_VERBOSE,
 			"osm_mftr_rcv_process: "
 			"Number of records:%u trimmed to:%u to fit in one MAD\n",
 			num_rec, trim_num_rec);
@@ -408,11 +369,11 @@ void osm_mftr_rcv_process(IN void *ctx, IN void *data)
 	}
 #endif
 
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sa->p_log, OSM_LOG_DEBUG,
 		"osm_mftr_rcv_process: " "Returning %u records\n", num_rec);
 
 	if ((p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) && (num_rec == 0)) {
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RECORDS);
 		goto Exit;
 	}
@@ -420,13 +381,13 @@ void osm_mftr_rcv_process(IN void *ctx, IN void *data)
 	/*
 	 * Get a MAD to reply. Address of Mad is in the received mad_wrapper
 	 */
-	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+	p_resp_madw = osm_mad_pool_get(sa->p_mad_pool,
 				       p_madw->h_bind,
 				       num_rec * sizeof(ib_mft_record_t) +
 				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
 
 	if (!p_resp_madw) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_mftr_rcv_process: ERR 4A10: "
 			"osm_mad_pool_get failed\n");
 
@@ -436,7 +397,7 @@ void osm_mftr_rcv_process(IN void *ctx, IN void *data)
 			free(p_rec_item);
 		}
 
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RESOURCES);
 
 		goto Exit;
@@ -489,9 +450,9 @@ void osm_mftr_rcv_process(IN void *ctx, IN void *data)
 	CL_ASSERT(cl_is_qlist_empty(&rec_list));
 
 	status = osm_sa_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE,
-				    p_rcv->p_subn);
+				    sa->p_subn);
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_mftr_rcv_process: ERR 4A11: "
 			"osm_sa_vendor_send status = %s\n",
 			ib_get_err_str(status));
@@ -499,5 +460,5 @@ void osm_mftr_rcv_process(IN void *ctx, IN void *data)
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
diff --git a/opensm/opensm/osm_sa_multipath_record.c b/opensm/opensm/osm_sa_multipath_record.c
index 6851cce..1fa81d6 100644
--- a/opensm/opensm/osm_sa_multipath_record.c
+++ b/opensm/opensm/osm_sa_multipath_record.c
@@ -56,13 +56,11 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
-#include <opensm/osm_sa_multipath_record.h>
+#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_port.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_switch.h>
 #include <opensm/osm_partition.h>
-#include <vendor/osm_vendor.h>
-#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_qos_policy.h>
 #include <opensm/osm_sa.h>
@@ -89,44 +87,6 @@ typedef struct _osm_path_parms {
 
 /**********************************************************************
  **********************************************************************/
-void osm_mpr_rcv_construct(IN osm_mpr_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_mpr_rcv_destroy(IN osm_mpr_rcv_t * const p_rcv)
-{
-	OSM_LOG_ENTER(p_rcv->p_log, osm_mpr_rcv_destroy);
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_mpr_rcv_init(IN osm_mpr_rcv_t * const p_rcv,
-		 IN osm_sa_resp_t * const p_resp,
-		 IN osm_mad_pool_t * const p_mad_pool,
-		 IN osm_subn_t * const p_subn,
-		 IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
-{
-	OSM_LOG_ENTER(p_log, osm_mpr_rcv_init);
-
-	osm_mpr_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_resp = p_resp;
-	p_rcv->p_mad_pool = p_mad_pool;
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-	return IB_SUCCESS;
-}
-
-/**********************************************************************
- **********************************************************************/
 static inline boolean_t
 __osm_sa_multipath_rec_is_tavor_port(IN const osm_port_t * const p_port)
 {
@@ -201,7 +161,7 @@ __osm_sa_multipath_rec_apply_tavor_mtu_limit(IN const ib_multipath_rec_t *
 /**********************************************************************
  **********************************************************************/
 static ib_api_status_t
-__osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
+__osm_mpr_rcv_get_path_parms(IN osm_sa_t * sa,
 			     IN const ib_multipath_rec_t * const p_mpr,
 			     IN const osm_port_t * const p_src_port,
 			     IN const osm_port_t * const p_dest_port,
@@ -232,7 +192,7 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
 	osm_qos_level_t *p_qos_level = NULL;
 	uint16_t valid_sl_mask = 0xffff;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_mpr_rcv_get_path_parms);
+	OSM_LOG_ENTER(sa->p_log, __osm_mpr_rcv_get_path_parms);
 
 	dest_lid = cl_hton16(dest_lid_ho);
 
@@ -250,13 +210,13 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
 	   and at least one end of the path is Tavor we override the
 	   port MTU with 1K.
 	 */
-	if (p_rcv->p_subn->opt.enable_quirks &&
+	if (sa->p_subn->opt.enable_quirks &&
 	    __osm_sa_multipath_rec_apply_tavor_mtu_limit(p_mpr, p_src_port,
 							 p_dest_port,
 							 comp_mask))
 		if (mtu > IB_MTU_LEN_1024) {
 			mtu = IB_MTU_LEN_1024;
-			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			osm_log(sa->p_log, OSM_LOG_DEBUG,
 				"__osm_mpr_rcv_get_path_parms: "
 				"Optimized Path MTU to 1K for Mellanox Tavor device\n");
 		}
@@ -279,7 +239,7 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
 		 */
 		p_physp = osm_switch_get_route_by_lid(p_node->sw, dest_lid);
 		if (p_physp == 0) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_mpr_rcv_get_path_parms: ERR 4514: "
 				"Can't find routing to LID 0x%X from switch for GUID 0x%016"
 				PRIx64 "\n", dest_lid_ho,
@@ -289,7 +249,7 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
 		}
 	}
 
-	if (p_rcv->p_subn->opt.qos) {
+	if (sa->p_subn->opt.qos) {
 
 		/*
 		 * Whether this node is switch or CA, the IN port for
@@ -304,8 +264,8 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
 				valid_sl_mask &= ~(1 << i);
 		}
 		if (!valid_sl_mask) {
-			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(sa->p_log, OSM_LOG_DEBUG))
+				osm_log(sa->p_log, OSM_LOG_DEBUG,
 					"__osm_mpr_rcv_get_path_parms: "
 					"All the SLs lead to VL15 on this path\n");
 			status = IB_NOT_FOUND;
@@ -325,7 +285,7 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
 		p_dest_physp = osm_switch_get_route_by_lid(p_node->sw, dest_lid);
 
 		if (p_dest_physp == 0) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_mpr_rcv_get_path_parms: ERR 4515: "
 				"Can't find routing to LID 0x%X from switch for GUID 0x%016"
 				PRIx64 "\n", dest_lid_ho,
@@ -346,7 +306,7 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
 		p_physp = osm_physp_get_remote(p_physp);
 
 		if (p_physp == 0) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_mpr_rcv_get_path_parms: ERR 4505: "
 				"Can't find remote phys port when routing to LID 0x%X from node GUID 0x%016"
 				PRIx64 "\n", dest_lid_ho,
@@ -372,7 +332,7 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
 			   If this isn't a switch, we should have reached
 			   the destination by now!
 			 */
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_mpr_rcv_get_path_parms: ERR 4503: "
 				"Internal error, bad path\n");
 			status = IB_ERROR;
@@ -396,7 +356,7 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
 		p_physp = osm_switch_get_route_by_lid(p_node->sw, dest_lid);
 
 		if (p_physp == 0) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_mpr_rcv_get_path_parms: ERR 4516: "
 				"Dead end on path to LID 0x%X from switch for GUID 0x%016"
 				PRIx64 "\n", dest_lid_ho,
@@ -415,7 +375,7 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
 		if (rate > ib_port_info_compute_rate(p_pi))
 			rate = ib_port_info_compute_rate(p_pi);
 
-		if (p_rcv->p_subn->opt.qos) {
+		if (sa->p_subn->opt.qos) {
 			/*
 			 * Check SL2VL table of the switch and update valid SLs
 			 */
@@ -426,8 +386,8 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
 					valid_sl_mask &= ~(1 << i);
 			}
 			if (!valid_sl_mask) {
-				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(sa->p_log, OSM_LOG_DEBUG))
+					osm_log(sa->p_log, OSM_LOG_DEBUG,
 						"__osm_mpr_rcv_get_path_parms: "
 						"All the SLs lead to VL15 "
 						"on this path\n");
@@ -448,8 +408,8 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
 	if (rate > ib_port_info_compute_rate(p_pi))
 		rate = ib_port_info_compute_rate(p_pi);
 
-	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(sa->p_log, OSM_LOG_DEBUG)) {
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_mpr_rcv_get_path_parms: "
 			"Path min MTU = %u, min rate = %u\n", mtu, rate);
 	}
@@ -458,15 +418,15 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
 	 * Get QoS Level object according to the MultiPath request
 	 * and adjust MultiPath parameters according to QoS settings
 	 */
-	if (p_rcv->p_subn->opt.qos &&
-	    p_rcv->p_subn->p_qos_policy &&
+	if (sa->p_subn->opt.qos &&
+	    sa->p_subn->p_qos_policy &&
 	    (p_qos_level =
-	     osm_qos_policy_get_qos_level_by_mpr(p_rcv->p_subn->p_qos_policy,
+	     osm_qos_policy_get_qos_level_by_mpr(sa->p_subn->p_qos_policy,
 						 p_mpr, p_src_physp,
 						 p_dest_physp, comp_mask))) {
 
-		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(sa->p_log, OSM_LOG_DEBUG))
+			osm_log(sa->p_log, OSM_LOG_DEBUG,
 				"__osm_mpr_rcv_get_path_parms: "
 				"MultiPathRecord request matches QoS Level '%s' (%s)\n",
 				p_qos_level->name,
@@ -651,7 +611,7 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
 		required_pkey = p_mpr->pkey;
 		if (!osm_physp_share_this_pkey
 		    (p_src_physp, p_dest_physp, required_pkey)) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_mpr_rcv_get_path_parms: ERR 4518: "
 				"Ports do not share specified PKey 0x%04x\n"
 				"\t\tsrc %" PRIx64 " dst %" PRIx64 "\n",
@@ -664,7 +624,7 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
 		}
 		if (p_qos_level && p_qos_level->pkey_range_len &&
 		    !osm_qos_level_has_pkey(p_qos_level, required_pkey)) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_mpr_rcv_get_path_parms: ERR 451C: "
 				"Ports do not share PKeys defined by QoS level\n");
 			status = IB_NOT_FOUND;
@@ -680,7 +640,7 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
 							      p_src_physp,
 							      p_dest_physp);
 		if (!required_pkey) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_mpr_rcv_get_path_parms: ERR 451D: "
 				"Ports do not share PKeys defined by QoS level\n");
 			status = IB_NOT_FOUND;
@@ -695,7 +655,7 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
 		required_pkey =
 		    osm_physp_find_common_pkey(p_src_physp, p_dest_physp);
 		if (!required_pkey) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_mpr_rcv_get_path_parms: ERR 4519: "
 				"Ports do not have any shared PKeys\n"
 				"\t\tsrc %" PRIx64 " dst %" PRIx64 "\n",
@@ -709,11 +669,11 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
 
 	if (required_pkey) {
 		p_prtn =
-		    (osm_prtn_t *) cl_qmap_get(&p_rcv->p_subn->prtn_pkey_tbl,
+		    (osm_prtn_t *) cl_qmap_get(&sa->p_subn->prtn_pkey_tbl,
 					       required_pkey &
 					       cl_ntoh16((uint16_t) ~ 0x8000));
 		if (p_prtn ==
-		    (osm_prtn_t *) cl_qmap_end(&p_rcv->p_subn->prtn_pkey_tbl))
+		    (osm_prtn_t *) cl_qmap_end(&sa->p_subn->prtn_pkey_tbl))
 			p_prtn = NULL;
 	}
 
@@ -729,7 +689,7 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
 
 		if (p_qos_level && p_qos_level->sl_set &&
 		    p_qos_level->sl != required_sl) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_mpr_rcv_get_path_parms: ERR 451E: "
 				"QoS constaraints: required MultiPathRecord SL (%u) "
 				"doesn't match QoS policy SL (%u)\n",
@@ -746,7 +706,7 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
 		required_sl = p_qos_level->sl;
 
 		if (required_pkey && p_prtn && p_prtn->sl != p_qos_level->sl)
-			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			osm_log(sa->p_log, OSM_LOG_DEBUG,
 				"__osm_mpr_rcv_get_path_parms: "
 				"QoS level SL (%u) overrides partition SL (%u)\n",
 				p_qos_level->sl, p_prtn->sl);
@@ -756,21 +716,21 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
 		 * No specific SL in request or in QoS level - use partition SL
 		 */
 		p_prtn =
-		    (osm_prtn_t *) cl_qmap_get(&p_rcv->p_subn->prtn_pkey_tbl,
+		    (osm_prtn_t *) cl_qmap_get(&sa->p_subn->prtn_pkey_tbl,
 					       required_pkey &
 					       cl_ntoh16((uint16_t) ~ 0x8000));
 		if (!p_prtn) {
 			required_sl = OSM_DEFAULT_SL;
 			/* this may be possible when pkey tables are created somehow in
 			   previous runs or things are going wrong here */
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_mpr_rcv_get_path_parms: ERR 451A: "
 				"No partition found for PKey 0x%04x - using default SL %d\n",
 				cl_ntoh16(required_pkey), required_sl);
 		} else
 			required_sl = p_prtn->sl;
 
-	} else if (p_rcv->p_subn->opt.qos) {
+	} else if (sa->p_subn->opt.qos) {
 		if (valid_sl_mask & (1 << OSM_DEFAULT_SL))
 			required_sl = OSM_DEFAULT_SL;
 		else {
@@ -782,8 +742,8 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
 	} else
 		required_sl = OSM_DEFAULT_SL;
 
-	if (p_rcv->p_subn->opt.qos && !(valid_sl_mask & (1 << required_sl))) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+	if (sa->p_subn->opt.qos && !(valid_sl_mask & (1 << required_sl))) {
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_mpr_rcv_get_path_parms: ERR 451F: "
 			"Selected SL (%u) leads to VL15\n", required_sl);
 		status = IB_NOT_FOUND;
@@ -802,22 +762,22 @@ __osm_mpr_rcv_get_path_parms(IN osm_mpr_rcv_t * const p_rcv,
 	p_parms->sl = required_sl;
 	p_parms->hops = hops;
 
-	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(sa->p_log, OSM_LOG_DEBUG))
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_mpr_rcv_get_path_parms: MultiPath params:"
 			" mtu = %u, rate = %u, packet lifetime = %u,"
 			" pkey = 0x%04X, sl = %u, hops = %u\n", mtu, rate,
 			pkt_life, cl_ntoh16(required_pkey), required_sl, hops);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_mpr_rcv_build_pr(IN osm_mpr_rcv_t * const p_rcv,
+__osm_mpr_rcv_build_pr(IN osm_sa_t * sa,
 		       IN const osm_port_t * const p_src_port,
 		       IN const osm_port_t * const p_dest_port,
 		       IN const uint16_t src_lid_ho,
@@ -829,7 +789,7 @@ __osm_mpr_rcv_build_pr(IN osm_mpr_rcv_t * const p_rcv,
 	const osm_physp_t *p_src_physp;
 	const osm_physp_t *p_dest_physp;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_mpr_rcv_build_pr);
+	OSM_LOG_ENTER(sa->p_log, __osm_mpr_rcv_build_pr);
 
 	p_src_physp = p_src_port->p_physp;
 	p_dest_physp = p_dest_port->p_physp;
@@ -864,13 +824,13 @@ __osm_mpr_rcv_build_pr(IN osm_mpr_rcv_t * const p_rcv,
 	if (p_parms->reversible)
 		p_pr->num_path = 0x80;
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static osm_mpr_item_t *
-__osm_mpr_rcv_get_lid_pair_path(IN osm_mpr_rcv_t * const p_rcv,
+__osm_mpr_rcv_get_lid_pair_path(IN osm_sa_t * sa,
 				IN const ib_multipath_rec_t * const p_mpr,
 				IN const osm_port_t * const p_src_port,
 				IN const osm_port_t * const p_dest_port,
@@ -884,24 +844,24 @@ __osm_mpr_rcv_get_lid_pair_path(IN osm_mpr_rcv_t * const p_rcv,
 	osm_mpr_item_t *p_pr_item;
 	ib_api_status_t status, rev_path_status;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_mpr_rcv_get_lid_pair_path);
+	OSM_LOG_ENTER(sa->p_log, __osm_mpr_rcv_get_lid_pair_path);
 
-	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(sa->p_log, OSM_LOG_DEBUG))
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_mpr_rcv_get_lid_pair_path: "
 			"Src LID 0x%X, Dest LID 0x%X\n",
 			src_lid_ho, dest_lid_ho);
 
 	p_pr_item = malloc(sizeof(*p_pr_item));
 	if (p_pr_item == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_mpr_rcv_get_lid_pair_path: ERR 4501: "
 			"Unable to allocate path record\n");
 		goto Exit;
 	}
 	memset(p_pr_item, 0, sizeof(*p_pr_item));
 
-	status = __osm_mpr_rcv_get_path_parms(p_rcv, p_mpr, p_src_port,
+	status = __osm_mpr_rcv_get_path_parms(sa, p_mpr, p_src_port,
 					      p_dest_port, dest_lid_ho,
 					      comp_mask, &path_parms);
 
@@ -913,7 +873,7 @@ __osm_mpr_rcv_get_lid_pair_path(IN osm_mpr_rcv_t * const p_rcv,
 
 	/* now try the reversible path */
 	rev_path_status =
-	    __osm_mpr_rcv_get_path_parms(p_rcv, p_mpr, p_dest_port, p_src_port,
+	    __osm_mpr_rcv_get_path_parms(sa, p_mpr, p_dest_port, p_src_port,
 					 src_lid_ho, comp_mask,
 					 &rev_path_parms);
 	path_parms.reversible = (rev_path_status == IB_SUCCESS);
@@ -926,7 +886,7 @@ __osm_mpr_rcv_get_lid_pair_path(IN osm_mpr_rcv_t * const p_rcv,
 	 */
 	if (comp_mask & IB_MPR_COMPMASK_REVERSIBLE) {
 		if ((!path_parms.reversible && (p_mpr->num_path & 0x80))) {
-			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			osm_log(sa->p_log, OSM_LOG_DEBUG,
 				"__osm_mpr_rcv_get_lid_pair_path: "
 				"Requested reversible path but failed to get one\n");
 
@@ -940,19 +900,19 @@ __osm_mpr_rcv_get_lid_pair_path(IN osm_mpr_rcv_t * const p_rcv,
 	p_pr_item->p_dest_port = p_dest_port;
 	p_pr_item->hops = path_parms.hops;
 
-	__osm_mpr_rcv_build_pr(p_rcv, p_src_port, p_dest_port, src_lid_ho,
+	__osm_mpr_rcv_build_pr(sa, p_src_port, p_dest_port, src_lid_ho,
 			       dest_lid_ho, preference, &path_parms,
 			       &p_pr_item->path_rec);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return (p_pr_item);
 }
 
 /**********************************************************************
  **********************************************************************/
 static uint32_t
-__osm_mpr_rcv_get_port_pair_paths(IN osm_mpr_rcv_t * const p_rcv,
+__osm_mpr_rcv_get_port_pair_paths(IN osm_sa_t * sa,
 				  IN const ib_multipath_rec_t * const p_mpr,
 				  IN const osm_port_t * const p_req_port,
 				  IN const osm_port_t * const p_src_port,
@@ -973,10 +933,10 @@ __osm_mpr_rcv_get_port_pair_paths(IN osm_mpr_rcv_t * const p_rcv,
 	uintn_t src_offset;
 	uintn_t dest_offset;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_mpr_rcv_get_port_pair_paths);
+	OSM_LOG_ENTER(sa->p_log, __osm_mpr_rcv_get_port_pair_paths);
 
-	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(sa->p_log, OSM_LOG_DEBUG))
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_mpr_rcv_get_port_pair_paths: "
 			"Src port 0x%016" PRIx64 ", "
 			"Dst port 0x%016" PRIx64 "\n",
@@ -985,10 +945,10 @@ __osm_mpr_rcv_get_port_pair_paths(IN osm_mpr_rcv_t * const p_rcv,
 
 	/* Check that the req_port, src_port and dest_port all share a
 	   pkey. The check is done on the default physical port of the ports. */
-	if (osm_port_share_pkey(p_rcv->p_log, p_req_port, p_src_port) == FALSE
-	    || osm_port_share_pkey(p_rcv->p_log, p_req_port,
+	if (osm_port_share_pkey(sa->p_log, p_req_port, p_src_port) == FALSE
+	    || osm_port_share_pkey(sa->p_log, p_req_port,
 				   p_dest_port) == FALSE
-	    || osm_port_share_pkey(p_rcv->p_log, p_src_port,
+	    || osm_port_share_pkey(sa->p_log, p_src_port,
 				   p_dest_port) == FALSE)
 		/* One of the pairs doesn't share a pkey so the path is disqualified. */
 		goto Exit;
@@ -1042,8 +1002,8 @@ __osm_mpr_rcv_get_port_pair_paths(IN osm_mpr_rcv_t * const p_rcv,
 	osm_port_get_lid_range_ho(p_dest_port, &dest_lid_min_ho,
 				  &dest_lid_max_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(sa->p_log, OSM_LOG_DEBUG))
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_mpr_rcv_get_port_pair_paths: "
 			"Src LID [0x%X-0x%X], "
 			"Dest LID [0x%X-0x%X]\n",
@@ -1062,7 +1022,7 @@ __osm_mpr_rcv_get_port_pair_paths(IN osm_mpr_rcv_t * const p_rcv,
 		/*
 		   These paths are "fully redundant"
 		 */
-		p_pr_item = __osm_mpr_rcv_get_lid_pair_path(p_rcv, p_mpr,
+		p_pr_item = __osm_mpr_rcv_get_lid_pair_path(sa, p_mpr,
 							    p_src_port,
 							    p_dest_port,
 							    src_lid_ho,
@@ -1128,7 +1088,7 @@ __osm_mpr_rcv_get_port_pair_paths(IN osm_mpr_rcv_t * const p_rcv,
 		if (src_offset == dest_offset)
 			continue;	/* already reported */
 
-		p_pr_item = __osm_mpr_rcv_get_lid_pair_path(p_rcv, p_mpr,
+		p_pr_item = __osm_mpr_rcv_get_lid_pair_path(sa, p_mpr,
 							    p_src_port,
 							    p_dest_port,
 							    src_lid_ho,
@@ -1143,7 +1103,7 @@ __osm_mpr_rcv_get_port_pair_paths(IN osm_mpr_rcv_t * const p_rcv,
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return path_num;
 }
 
@@ -1153,7 +1113,7 @@ __osm_mpr_rcv_get_port_pair_paths(IN osm_mpr_rcv_t * const p_rcv,
 /**********************************************************************
  **********************************************************************/
 static osm_mpr_item_t *
-__osm_mpr_rcv_get_apm_port_pair_paths(IN osm_mpr_rcv_t * const p_rcv,
+__osm_mpr_rcv_get_apm_port_pair_paths(IN osm_sa_t * sa,
 				      IN const ib_multipath_rec_t * const p_mpr,
 				      IN const osm_port_t * const p_src_port,
 				      IN const osm_port_t * const p_dest_port,
@@ -1171,10 +1131,10 @@ __osm_mpr_rcv_get_apm_port_pair_paths(IN osm_mpr_rcv_t * const p_rcv,
 	uintn_t iterations;
 	int src_lids, dest_lids;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_mpr_rcv_get_apm_port_pair_paths);
+	OSM_LOG_ENTER(sa->p_log, __osm_mpr_rcv_get_apm_port_pair_paths);
 
-	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(sa->p_log, OSM_LOG_DEBUG))
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_mpr_rcv_get_apm_port_pair_paths: "
 			"Src port 0x%016" PRIx64 ", "
 			"Dst port 0x%016" PRIx64 ", base offs %d\n",
@@ -1194,7 +1154,7 @@ __osm_mpr_rcv_get_apm_port_pair_paths(IN osm_mpr_rcv_t * const p_rcv,
 	src_lid_ho += base_offs % src_lids;
 	dest_lid_ho += base_offs % dest_lids;
 
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sa->p_log, OSM_LOG_DEBUG,
 		"__osm_mpr_rcv_get_apm_port_pair_paths: "
 		"Src LIDs [0x%X-0x%X] hashed %d, "
 		"Dest LIDs [0x%X-0x%X] hashed %d\n",
@@ -1207,7 +1167,7 @@ __osm_mpr_rcv_get_apm_port_pair_paths(IN osm_mpr_rcv_t * const p_rcv,
 		/*
 		   These paths are "fully redundant"
 		 */
-		p_pr_item = __osm_mpr_rcv_get_lid_pair_path(p_rcv, p_mpr,
+		p_pr_item = __osm_mpr_rcv_get_lid_pair_path(sa, p_mpr,
 							    p_src_port,
 							    p_dest_port,
 							    src_lid_ho,
@@ -1215,7 +1175,7 @@ __osm_mpr_rcv_get_apm_port_pair_paths(IN osm_mpr_rcv_t * const p_rcv,
 							    comp_mask, 0);
 
 		if (p_pr_item) {
-			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			osm_log(sa->p_log, OSM_LOG_DEBUG,
 				"__osm_mpr_rcv_get_apm_port_pair_paths: "
 				"Found matching path from Src LID 0x%X to Dest LID 0x%X with %d hops\n",
 				src_lid_ho, dest_lid_ho, p_pr_item->hops);
@@ -1229,14 +1189,14 @@ __osm_mpr_rcv_get_apm_port_pair_paths(IN osm_mpr_rcv_t * const p_rcv,
 			dest_lid_ho = dest_lid_min_ho;
 	}
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return p_pr_item;
 }
 
 /**********************************************************************
  **********************************************************************/
 static ib_net16_t
-__osm_mpr_rcv_get_gids(IN osm_mpr_rcv_t * const p_rcv,
+__osm_mpr_rcv_get_gids(IN osm_sa_t * sa,
 		       IN const ib_gid_t * gids,
 		       IN int ngids, IN int is_sgid, OUT osm_port_t ** pp_port)
 {
@@ -1244,19 +1204,19 @@ __osm_mpr_rcv_get_gids(IN osm_mpr_rcv_t * const p_rcv,
 	ib_net16_t ib_status = IB_SUCCESS;
 	int i;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_mpr_rcv_get_gids);
+	OSM_LOG_ENTER(sa->p_log, __osm_mpr_rcv_get_gids);
 
 	for (i = 0; i < ngids; i++, gids++) {
 		if (!ib_gid_is_link_local(gids)) {
 			if ((is_sgid && ib_gid_is_multicast(gids)) ||
 			    (ib_gid_get_subnet_prefix(gids) !=
-			     p_rcv->p_subn->opt.subnet_prefix)) {
+			     sa->p_subn->opt.subnet_prefix)) {
 				/*
 				   This 'error' is the client's fault (bad gid) so
 				   don't enter it as an error in our own log.
 				   Return an error response to the client.
 				 */
-				osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+				osm_log(sa->p_log, OSM_LOG_VERBOSE,
 					"__osm_mpr_rcv_get_gids: ERR 451B: "
 					"%sGID 0x%016" PRIx64
 					" is multicast or non local subnet prefix\n",
@@ -1269,7 +1229,7 @@ __osm_mpr_rcv_get_gids(IN osm_mpr_rcv_t * const p_rcv,
 		}
 
 		p_port =
-		    osm_get_port_by_guid(p_rcv->p_subn,
+		    osm_get_port_by_guid(sa->p_subn,
 					 gids->unicast.interface_id);
 		if (!p_port) {
 			/*
@@ -1277,7 +1237,7 @@ __osm_mpr_rcv_get_gids(IN osm_mpr_rcv_t * const p_rcv,
 			   don't enter it as an error in our own log.
 			   Return an error response to the client.
 			 */
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_mpr_rcv_get_gids: ERR 4506: "
 				"No port with GUID 0x%016" PRIx64 "\n",
 				cl_ntoh64(gids->unicast.interface_id));
@@ -1290,7 +1250,7 @@ __osm_mpr_rcv_get_gids(IN osm_mpr_rcv_t * const p_rcv,
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 
 	return ib_status;
 }
@@ -1298,7 +1258,7 @@ __osm_mpr_rcv_get_gids(IN osm_mpr_rcv_t * const p_rcv,
 /**********************************************************************
  **********************************************************************/
 static ib_net16_t
-__osm_mpr_rcv_get_end_points(IN osm_mpr_rcv_t * const p_rcv,
+__osm_mpr_rcv_get_end_points(IN osm_sa_t * sa,
 			     IN const osm_madw_t * const p_madw,
 			     OUT osm_port_t ** pp_ports,
 			     OUT int *nsrc, OUT int *ndest)
@@ -1309,7 +1269,7 @@ __osm_mpr_rcv_get_end_points(IN osm_mpr_rcv_t * const p_rcv,
 	ib_net16_t sa_status = IB_SA_MAD_STATUS_SUCCESS;
 	ib_gid_t *gids;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_mpr_rcv_get_end_points);
+	OSM_LOG_ENTER(sa->p_log, __osm_mpr_rcv_get_end_points);
 
 	/*
 	   Determine what fields are valid and then get a pointer
@@ -1332,7 +1292,7 @@ __osm_mpr_rcv_get_end_points(IN osm_mpr_rcv_t * const p_rcv,
 		if (*nsrc > IB_MULTIPATH_MAX_GIDS)
 			*nsrc = IB_MULTIPATH_MAX_GIDS;
 		sa_status =
-		    __osm_mpr_rcv_get_gids(p_rcv, gids, *nsrc, 1, pp_ports);
+		    __osm_mpr_rcv_get_gids(sa, gids, *nsrc, 1, pp_ports);
 		if (sa_status != IB_SUCCESS)
 			goto Exit;
 	}
@@ -1342,12 +1302,12 @@ __osm_mpr_rcv_get_end_points(IN osm_mpr_rcv_t * const p_rcv,
 		if (*ndest + *nsrc > IB_MULTIPATH_MAX_GIDS)
 			*ndest = IB_MULTIPATH_MAX_GIDS - *nsrc;
 		sa_status =
-		    __osm_mpr_rcv_get_gids(p_rcv, gids + *nsrc, *ndest, 0,
+		    __osm_mpr_rcv_get_gids(sa, gids + *nsrc, *ndest, 0,
 					   pp_ports + *nsrc);
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return (sa_status);
 }
 
@@ -1357,7 +1317,7 @@ __osm_mpr_rcv_get_end_points(IN osm_mpr_rcv_t * const p_rcv,
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_mpr_rcv_get_apm_paths(IN osm_mpr_rcv_t * const p_rcv,
+__osm_mpr_rcv_get_apm_paths(IN osm_sa_t * sa,
 			    IN const ib_multipath_rec_t * const p_mpr,
 			    IN const osm_port_t * const p_req_port,
 			    IN osm_port_t ** _pp_ports,
@@ -1369,7 +1329,7 @@ __osm_mpr_rcv_get_apm_paths(IN osm_mpr_rcv_t * const p_rcv,
 	int base_offs, src_lid_ho, dest_lid_ho;
 	int sumA, sumB, minA, minB;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_mpr_rcv_get_apm_paths);
+	OSM_LOG_ENTER(sa->p_log, __osm_mpr_rcv_get_apm_paths);
 
 	/*
 	 * We want to:
@@ -1404,27 +1364,27 @@ __osm_mpr_rcv_get_apm_paths(IN osm_mpr_rcv_t * const p_rcv,
 	dest_lid_ho = osm_port_get_base_lid(pp_ports[2]);
 
 	base_offs = src_lid_ho < dest_lid_ho ?
-	    __hash_lids(src_lid_ho, dest_lid_ho, p_rcv->p_subn->opt.lmc) :
-	    __hash_lids(dest_lid_ho, src_lid_ho, p_rcv->p_subn->opt.lmc);
+	    __hash_lids(src_lid_ho, dest_lid_ho, sa->p_subn->opt.lmc) :
+	    __hash_lids(dest_lid_ho, src_lid_ho, sa->p_subn->opt.lmc);
 
 	matrix[0][0] =
-	    __osm_mpr_rcv_get_apm_port_pair_paths(p_rcv, p_mpr, pp_ports[0],
+	    __osm_mpr_rcv_get_apm_port_pair_paths(sa, p_mpr, pp_ports[0],
 						  pp_ports[2], base_offs,
 						  comp_mask, p_list);
 	matrix[0][1] =
-	    __osm_mpr_rcv_get_apm_port_pair_paths(p_rcv, p_mpr, pp_ports[0],
+	    __osm_mpr_rcv_get_apm_port_pair_paths(sa, p_mpr, pp_ports[0],
 						  pp_ports[3], base_offs,
 						  comp_mask, p_list);
 	matrix[1][0] =
-	    __osm_mpr_rcv_get_apm_port_pair_paths(p_rcv, p_mpr, pp_ports[1],
+	    __osm_mpr_rcv_get_apm_port_pair_paths(sa, p_mpr, pp_ports[1],
 						  pp_ports[2], base_offs + 1,
 						  comp_mask, p_list);
 	matrix[1][1] =
-	    __osm_mpr_rcv_get_apm_port_pair_paths(p_rcv, p_mpr, pp_ports[1],
+	    __osm_mpr_rcv_get_apm_port_pair_paths(sa, p_mpr, pp_ports[1],
 						  pp_ports[3], base_offs + 1,
 						  comp_mask, p_list);
 
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG, "__osm_mpr_rcv_get_apm_paths: "
+	osm_log(sa->p_log, OSM_LOG_DEBUG, "__osm_mpr_rcv_get_apm_paths: "
 		"APM matrix:\n"
 		"\t{0,0} 0x%X->0x%X (%d)\t| {0,1} 0x%X->0x%X (%d)\n"
 		"\t{1,0} 0x%X->0x%X (%d)\t| {1,1} 0x%X->0x%X (%d)\n",
@@ -1446,7 +1406,7 @@ __osm_mpr_rcv_get_apm_paths(IN osm_mpr_rcv_t * const p_rcv,
 	/* and the winner is... */
 	if (minA <= minB || (minA == minB && sumA < sumB)) {
 		/* Diag A */
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_mpr_rcv_get_apm_paths: "
 			"Diag {0,0} & {1,1} is the best:\n"
 			"\t{0,0} 0x%X->0x%X (%d)\t & {1,1} 0x%X->0x%X (%d)\n",
@@ -1460,7 +1420,7 @@ __osm_mpr_rcv_get_apm_paths(IN osm_mpr_rcv_t * const p_rcv,
 		free(matrix[1][0]);
 	} else {
 		/* Diag B */
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_mpr_rcv_get_apm_paths: "
 			"Diag {0,1} & {1,0} is the best:\n"
 			"\t{0,1} 0x%X->0x%X (%d)\t & {1,0} 0x%X->0x%X (%d)\n",
@@ -1474,13 +1434,13 @@ __osm_mpr_rcv_get_apm_paths(IN osm_mpr_rcv_t * const p_rcv,
 		free(matrix[1][1]);
 	}
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_mpr_rcv_process_pairs(IN osm_mpr_rcv_t * const p_rcv,
+__osm_mpr_rcv_process_pairs(IN osm_sa_t * sa,
 			    IN const ib_multipath_rec_t * const p_mpr,
 			    IN osm_port_t * const p_req_port,
 			    IN osm_port_t ** pp_ports,
@@ -1493,7 +1453,7 @@ __osm_mpr_rcv_process_pairs(IN osm_mpr_rcv_t * const p_rcv,
 	osm_port_t **pp_dest_port, **pp_ed;
 	uint32_t max_paths, num_paths, total_paths = 0;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_mpr_rcv_process_pairs);
+	OSM_LOG_ENTER(sa->p_log, __osm_mpr_rcv_process_pairs);
 
 	if (comp_mask & IB_MPR_COMPMASK_NUMBPATH)
 		max_paths = p_mpr->num_path & 0x7F;
@@ -1505,7 +1465,7 @@ __osm_mpr_rcv_process_pairs(IN osm_mpr_rcv_t * const p_rcv,
 		for (pp_dest_port = pp_es, pp_ed = pp_es + ndest;
 		     pp_dest_port < pp_ed; pp_dest_port++) {
 			num_paths =
-			    __osm_mpr_rcv_get_port_pair_paths(p_rcv, p_mpr,
+			    __osm_mpr_rcv_get_port_pair_paths(sa, p_mpr,
 							      p_req_port,
 							      *pp_src_port,
 							      *pp_dest_port,
@@ -1514,7 +1474,7 @@ __osm_mpr_rcv_process_pairs(IN osm_mpr_rcv_t * const p_rcv,
 							      comp_mask,
 							      p_list);
 			total_paths += num_paths;
-			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			osm_log(sa->p_log, OSM_LOG_DEBUG,
 				"__osm_mpr_rcv_process_pairs: "
 				"%d paths %d total paths %d max paths\n",
 				num_paths, total_paths, max_paths);
@@ -1525,13 +1485,13 @@ __osm_mpr_rcv_process_pairs(IN osm_mpr_rcv_t * const p_rcv,
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_mpr_rcv_respond(IN osm_mpr_rcv_t * const p_rcv,
+__osm_mpr_rcv_respond(IN osm_sa_t * sa,
 		      IN const osm_madw_t * const p_madw,
 		      IN cl_qlist_t * const p_list)
 {
@@ -1546,14 +1506,14 @@ __osm_mpr_rcv_respond(IN osm_mpr_rcv_t * const p_rcv,
 	osm_mpr_item_t *p_mpr_item;
 	uint32_t i;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_mpr_rcv_respond);
+	OSM_LOG_ENTER(sa->p_log, __osm_mpr_rcv_respond);
 
 	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
 	p_mpr = (ib_multipath_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
 
 	num_rec = cl_qlist_count(p_list);
 
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sa->p_log, OSM_LOG_DEBUG,
 		"__osm_mpr_rcv_respond: "
 		"Generating response with %zu records\n", num_rec);
 
@@ -1562,11 +1522,11 @@ __osm_mpr_rcv_respond(IN osm_mpr_rcv_t * const p_rcv,
 	/*
 	   Get a MAD to reply. Address of Mad is in the received mad_wrapper
 	 */
-	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool, p_madw->h_bind,
+	p_resp_madw = osm_mad_pool_get(sa->p_mad_pool, p_madw->h_bind,
 				       mad_size, &p_madw->mad_addr);
 
 	if (!p_resp_madw) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_mpr_rcv_respond: "
 			"ERR 4502: Unable to allocate MAD\n");
 
@@ -1576,7 +1536,7 @@ __osm_mpr_rcv_respond(IN osm_mpr_rcv_t * const p_rcv,
 			free(p_mpr_item);
 		}
 
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RESOURCES);
 		goto Exit;
 	}
@@ -1614,27 +1574,27 @@ __osm_mpr_rcv_respond(IN osm_mpr_rcv_t * const p_rcv,
 
 	CL_ASSERT(cl_is_qlist_empty(p_list));
 
-	osm_dump_sa_mad(p_rcv->p_log, p_resp_sa_mad, OSM_LOG_FRAMES);
+	osm_dump_sa_mad(sa->p_log, p_resp_sa_mad, OSM_LOG_FRAMES);
 
 	status = osm_sa_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE,
-				    p_rcv->p_subn);
+				    sa->p_subn);
 
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_mpr_rcv_respond: ERR 4507: "
 			"Unable to send MAD (%s)\n", ib_get_err_str(status));
-		/*  osm_mad_pool_put( p_rcv->p_mad_pool, p_resp_madw ); */
+		/*  osm_mad_pool_put( sa->p_mad_pool, p_resp_madw ); */
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 void osm_mpr_rcv_process(IN void *context, IN void *data)
 {
-	osm_mpr_rcv_t *p_rcv = context;
+	osm_sa_t *sa = context;
 	osm_madw_t *p_madw = data;
 	const ib_multipath_rec_t *p_mpr;
 	const ib_sa_mad_t *p_sa_mad;
@@ -1644,7 +1604,7 @@ void osm_mpr_rcv_process(IN void *context, IN void *data)
 	ib_net16_t sa_status;
 	int nsrc, ndest;
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_mpr_rcv_process);
+	OSM_LOG_ENTER(sa->p_log, osm_mpr_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -1654,38 +1614,38 @@ void osm_mpr_rcv_process(IN void *context, IN void *data)
 	CL_ASSERT(p_sa_mad->attr_id == IB_MAD_ATTR_MULTIPATH_RECORD);
 
 	if ((p_sa_mad->rmpp_flags & IB_RMPP_FLAG_ACTIVE) != IB_RMPP_FLAG_ACTIVE) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_mpr_rcv_process: ERR 4510: "
 			"Invalid request since RMPP_FLAG_ACTIVE is not set\n");
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_REQ_INVALID);
 		goto Exit;
 	}
 
 	/* we only support SubnAdmGetMulti method */
 	if (p_sa_mad->method != IB_MAD_METHOD_GETMULTI) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_mpr_rcv_process: ERR 4513: "
 			"Unsupported Method (%s)\n",
 			ib_get_sa_method_str(p_sa_mad->method));
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
 	}
 
 	/* update the requester physical port. */
-	requester_port = osm_get_port_by_mad_addr(p_rcv->p_log, p_rcv->p_subn,
+	requester_port = osm_get_port_by_mad_addr(sa->p_log, sa->p_subn,
 						  osm_madw_get_mad_addr_ptr
 						  (p_madw));
 	if (requester_port == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_mpr_rcv_process: ERR 4517: "
 			"Cannot find requester physical port\n");
 		goto Exit;
 	}
 
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
-		osm_dump_multipath_record(p_rcv->p_log, p_mpr, OSM_LOG_DEBUG);
+	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
+		osm_dump_multipath_record(sa->p_log, p_mpr, OSM_LOG_DEBUG);
 
 	cl_qlist_init(&pr_list);
 
@@ -1693,40 +1653,40 @@ void osm_mpr_rcv_process(IN void *context, IN void *data)
 	   Most SA functions (including this one) are read-only on the
 	   subnet object, so we grab the lock non-exclusively.
 	 */
-	cl_plock_acquire(p_rcv->p_lock);
+	cl_plock_acquire(sa->p_lock);
 
-	sa_status = __osm_mpr_rcv_get_end_points(p_rcv, p_madw, pp_ports,
+	sa_status = __osm_mpr_rcv_get_end_points(sa, p_madw, pp_ports,
 						 &nsrc, &ndest);
 
 	if (sa_status != IB_SA_MAD_STATUS_SUCCESS || !nsrc || !ndest) {
 		if (sa_status == IB_SA_MAD_STATUS_SUCCESS && (!nsrc || !ndest))
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_mpr_rcv_process_cb: ERR 4512: "
 				"__osm_mpr_rcv_get_end_points failed, not enough GIDs "
 				"(nsrc %d ndest %d)\n", nsrc, ndest);
-		cl_plock_release(p_rcv->p_lock);
+		cl_plock_release(sa->p_lock);
 		if (sa_status == IB_SA_MAD_STATUS_SUCCESS)
-			osm_sa_send_error(p_rcv->p_resp, p_madw,
+			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_REQ_INVALID);
 		else
-			osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+			osm_sa_send_error(sa, p_madw, sa_status);
 		goto Exit;
 	}
 
 	/* APM request */
 	if (nsrc == 2 && ndest == 2 && (p_mpr->num_path & 0x7F) == 2)
-		__osm_mpr_rcv_get_apm_paths(p_rcv, p_mpr, requester_port,
+		__osm_mpr_rcv_get_apm_paths(sa, p_mpr, requester_port,
 					    pp_ports, p_sa_mad->comp_mask,
 					    &pr_list);
 	else
-		__osm_mpr_rcv_process_pairs(p_rcv, p_mpr, requester_port,
+		__osm_mpr_rcv_process_pairs(sa, p_mpr, requester_port,
 					    pp_ports, nsrc, ndest,
 					    p_sa_mad->comp_mask, &pr_list);
 
-	cl_plock_release(p_rcv->p_lock);
-	__osm_mpr_rcv_respond(p_rcv, p_madw, &pr_list);
+	cl_plock_release(sa->p_lock);
+	__osm_mpr_rcv_respond(sa, p_madw, &pr_list);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 #endif
diff --git a/opensm/opensm/osm_sa_node_record.c b/opensm/opensm/osm_sa_node_record.c
index e78e827..a9a3708 100644
--- a/opensm/opensm/osm_sa_node_record.c
+++ b/opensm/opensm/osm_sa_node_record.c
@@ -53,9 +53,8 @@
 #include <iba/ib_types.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
-#include <opensm/osm_sa_node_record.h>
-#include <opensm/osm_node.h>
 #include <vendor/osm_vendor_api.h>
+#include <opensm/osm_node.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_sa.h>
@@ -69,52 +68,14 @@ typedef struct _osm_nr_search_ctxt {
 	const ib_node_record_t *p_rcvd_rec;
 	ib_net64_t comp_mask;
 	cl_qlist_t *p_list;
-	osm_nr_rcv_t *p_rcv;
+	osm_sa_t *sa;
 	const osm_physp_t *p_req_physp;
 } osm_nr_search_ctxt_t;
 
 /**********************************************************************
  **********************************************************************/
-void osm_nr_rcv_construct(IN osm_nr_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_nr_rcv_destroy(IN osm_nr_rcv_t * const p_rcv)
-{
-	OSM_LOG_ENTER(p_rcv->p_log, osm_nr_rcv_destroy);
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_nr_rcv_init(IN osm_nr_rcv_t * const p_rcv,
-		IN osm_sa_resp_t * const p_resp,
-		IN osm_mad_pool_t * const p_mad_pool,
-		IN osm_subn_t * const p_subn,
-		IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
-{
-	OSM_LOG_ENTER(p_log, osm_nr_rcv_init);
-
-	osm_nr_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_resp = p_resp;
-	p_rcv->p_mad_pool = p_mad_pool;
-
-	OSM_LOG_EXIT(p_log);
-	return IB_SUCCESS;
-}
-
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
-__osm_nr_rcv_new_nr(IN osm_nr_rcv_t * const p_rcv,
+__osm_nr_rcv_new_nr(IN osm_sa_t * sa,
 		    IN const osm_node_t * const p_node,
 		    IN cl_qlist_t * const p_list,
 		    IN ib_net64_t const port_guid, IN ib_net16_t const lid)
@@ -122,19 +83,19 @@ __osm_nr_rcv_new_nr(IN osm_nr_rcv_t * const p_rcv,
 	osm_nr_item_t *p_rec_item;
 	ib_api_status_t status = IB_SUCCESS;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_nr_rcv_new_nr);
+	OSM_LOG_ENTER(sa->p_log, __osm_nr_rcv_new_nr);
 
 	p_rec_item = malloc(sizeof(*p_rec_item));
 	if (p_rec_item == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_nr_rcv_new_nr: ERR 1D02: "
 			"rec_item alloc failed\n");
 		status = IB_INSUFFICIENT_RESOURCES;
 		goto Exit;
 	}
 
-	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(sa->p_log, OSM_LOG_DEBUG))
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_nr_rcv_new_nr: "
 			"New NodeRecord: node 0x%016" PRIx64
 			"\n\t\t\t\tport 0x%016" PRIx64 ", lid 0x%X\n",
@@ -153,14 +114,14 @@ __osm_nr_rcv_new_nr(IN osm_nr_rcv_t * const p_rcv,
 	cl_qlist_insert_tail(p_list, &p_rec_item->list_item);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_nr_rcv_create_nr(IN osm_nr_rcv_t * const p_rcv,
+__osm_nr_rcv_create_nr(IN osm_sa_t * sa,
 		       IN const osm_node_t * const p_node,
 		       IN cl_qlist_t * const p_list,
 		       IN ib_net64_t const match_port_guid,
@@ -177,10 +138,10 @@ __osm_nr_rcv_create_nr(IN osm_nr_rcv_t * const p_rcv,
 	uint8_t lmc;
 	ib_net64_t port_guid;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_nr_rcv_create_nr);
+	OSM_LOG_ENTER(sa->p_log, __osm_nr_rcv_create_nr);
 
-	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(sa->p_log, OSM_LOG_DEBUG)) {
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_nr_rcv_create_nr: "
 			"Looking for NodeRecord with LID: 0x%X GUID:0x%016"
 			PRIx64 "\n", cl_ntoh16(match_lid),
@@ -205,7 +166,7 @@ __osm_nr_rcv_create_nr(IN osm_nr_rcv_t * const p_rcv,
 
 		/* Check to see if the found p_physp and the requester physp
 		   share a pkey. If not - continue */
-		if (!osm_physp_share_pkey(p_rcv->p_log, p_physp, p_req_physp))
+		if (!osm_physp_share_pkey(sa->p_log, p_physp, p_req_physp))
 			continue;
 
 		port_guid = osm_physp_get_port_guid(p_physp);
@@ -223,8 +184,8 @@ __osm_nr_rcv_create_nr(IN osm_nr_rcv_t * const p_rcv,
 			/*
 			   We validate that the lid belongs to this node.
 			 */
-			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(sa->p_log, OSM_LOG_DEBUG)) {
+				osm_log(sa->p_log, OSM_LOG_DEBUG,
 					"__osm_nr_rcv_create_nr: "
 					"Comparing LID: 0x%X <= 0x%X <= 0x%X\n",
 					base_lid_ho, match_lid_ho, max_lid_ho);
@@ -235,11 +196,11 @@ __osm_nr_rcv_create_nr(IN osm_nr_rcv_t * const p_rcv,
 				continue;
 		}
 
-		__osm_nr_rcv_new_nr(p_rcv, p_node, p_list, port_guid, base_lid);
+		__osm_nr_rcv_new_nr(sa, p_node, p_list, port_guid, base_lid);
 
 	}
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
@@ -252,14 +213,14 @@ __osm_nr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item, IN void *context)
 	const osm_node_t *const p_node = (osm_node_t *) p_map_item;
 	const ib_node_record_t *const p_rcvd_rec = p_ctxt->p_rcvd_rec;
 	const osm_physp_t *const p_req_physp = p_ctxt->p_req_physp;
-	osm_nr_rcv_t *const p_rcv = p_ctxt->p_rcv;
+	osm_sa_t *sa = p_ctxt->sa;
 	ib_net64_t const comp_mask = p_ctxt->comp_mask;
 	ib_net64_t match_port_guid = 0;
 	ib_net16_t match_lid = 0;
 
-	OSM_LOG_ENTER(p_ctxt->p_rcv->p_log, __osm_nr_rcv_by_comp_mask);
+	OSM_LOG_ENTER(p_ctxt->sa->p_log, __osm_nr_rcv_by_comp_mask);
 
-	osm_dump_node_info(p_ctxt->p_rcv->p_log,
+	osm_dump_node_info(p_ctxt->sa->p_log,
 			   &p_node->node_info, OSM_LOG_VERBOSE);
 
 	if (comp_mask & IB_NR_COMPMASK_LID)
@@ -269,8 +230,8 @@ __osm_nr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item, IN void *context)
 		/*
 		   DEBUG TOP
 		 */
-		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(sa->p_log, OSM_LOG_DEBUG)) {
+			osm_log(sa->p_log, OSM_LOG_DEBUG,
 				"__osm_nr_rcv_by_comp_mask: "
 				"Looking for node 0x%016" PRIx64
 				", found 0x%016" PRIx64 "\n",
@@ -345,18 +306,18 @@ __osm_nr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item, IN void *context)
 			goto Exit;
 	}
 
-	__osm_nr_rcv_create_nr(p_rcv, p_node, p_ctxt->p_list,
+	__osm_nr_rcv_create_nr(sa, p_node, p_ctxt->p_list,
 			       match_port_guid, match_lid, p_req_physp);
 
       Exit:
-	OSM_LOG_EXIT(p_ctxt->p_rcv->p_log);
+	OSM_LOG_EXIT(p_ctxt->sa->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 void osm_nr_rcv_process(IN void *ctx, IN void *data)
 {
-	osm_nr_rcv_t *p_rcv = ctx;
+	osm_sa_t *sa = ctx;
 	osm_madw_t *p_madw = data;
 	const ib_sa_mad_t *p_rcvd_mad;
 	const ib_node_record_t *p_rcvd_rec;
@@ -374,9 +335,9 @@ void osm_nr_rcv_process(IN void *ctx, IN void *data)
 	ib_api_status_t status;
 	osm_physp_t *p_req_physp;
 
-	CL_ASSERT(p_rcv);
+	CL_ASSERT(sa);
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_nr_rcv_process);
+	OSM_LOG_ENTER(sa->p_log, osm_nr_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -388,44 +349,44 @@ void osm_nr_rcv_process(IN void *ctx, IN void *data)
 	/* we only support SubnAdmGet and SubnAdmGetTable methods */
 	if ((p_rcvd_mad->method != IB_MAD_METHOD_GET) &&
 	    (p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE)) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_nr_rcv_process: ERR 1D05: "
 			"Unsupported Method (%s)\n",
 			ib_get_sa_method_str(p_rcvd_mad->method));
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
 	}
 
 	/* update the requester physical port. */
-	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-						p_rcv->p_subn,
+	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log,
+						sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
 	if (p_req_physp == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_nr_rcv_process: ERR 1D04: "
 			"Cannot find requester physical port\n");
 		goto Exit;
 	}
 
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
-		osm_dump_node_record(p_rcv->p_log, p_rcvd_rec, OSM_LOG_DEBUG);
+	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
+		osm_dump_node_record(sa->p_log, p_rcvd_rec, OSM_LOG_DEBUG);
 
 	cl_qlist_init(&rec_list);
 
 	context.p_rcvd_rec = p_rcvd_rec;
 	context.p_list = &rec_list;
 	context.comp_mask = p_rcvd_mad->comp_mask;
-	context.p_rcv = p_rcv;
+	context.sa = sa;
 	context.p_req_physp = p_req_physp;
 
-	cl_plock_acquire(p_rcv->p_lock);
+	cl_plock_acquire(sa->p_lock);
 
-	cl_qmap_apply_func(&p_rcv->p_subn->node_guid_tbl,
+	cl_qmap_apply_func(&sa->p_subn->node_guid_tbl,
 			   __osm_nr_rcv_by_comp_mask, &context);
 
-	cl_plock_release(p_rcv->p_lock);
+	cl_plock_release(sa->p_lock);
 
 	num_rec = cl_qlist_count(&rec_list);
 
@@ -434,11 +395,11 @@ void osm_nr_rcv_process(IN void *ctx, IN void *data)
 	 * If we do a SubnAdmGet and got more than one record it is an error !
 	 */
 	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec > 1)) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_nr_rcv_process: ERR 1D03: "
 			"Got more than one record for SubnAdmGet (%u)\n",
 			num_rec);
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
 
 		/* need to set the mem free ... */
@@ -458,7 +419,7 @@ void osm_nr_rcv_process(IN void *ctx, IN void *data)
 	trim_num_rec =
 	    (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_node_record_t);
 	if (trim_num_rec < num_rec) {
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sa->p_log, OSM_LOG_VERBOSE,
 			"osm_nr_rcv_process: "
 			"Number of records:%u trimmed to:%u to fit in one MAD\n",
 			num_rec, trim_num_rec);
@@ -466,11 +427,11 @@ void osm_nr_rcv_process(IN void *ctx, IN void *data)
 	}
 #endif
 
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sa->p_log, OSM_LOG_DEBUG,
 		"osm_nr_rcv_process: " "Returning %u records\n", num_rec);
 
 	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0)) {
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RECORDS);
 		goto Exit;
 	}
@@ -478,13 +439,13 @@ void osm_nr_rcv_process(IN void *ctx, IN void *data)
 	/*
 	 * Get a MAD to reply. Address of Mad is in the received mad_wrapper
 	 */
-	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+	p_resp_madw = osm_mad_pool_get(sa->p_mad_pool,
 				       p_madw->h_bind,
 				       num_rec * sizeof(ib_node_record_t) +
 				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
 
 	if (!p_resp_madw) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_nr_rcv_process: ERR 1D06: "
 			"osm_mad_pool_get failed\n");
 
@@ -494,7 +455,7 @@ void osm_nr_rcv_process(IN void *ctx, IN void *data)
 			free(p_rec_item);
 		}
 
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RESOURCES);
 		goto Exit;
 	}
@@ -545,9 +506,9 @@ void osm_nr_rcv_process(IN void *ctx, IN void *data)
 	CL_ASSERT(cl_is_qlist_empty(&rec_list));
 
 	status = osm_sa_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE,
-				    p_rcv->p_subn);
+				    sa->p_subn);
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_nr_rcv_process: ERR 1D07: "
 			"osm_sa_vendor_send status = %s\n",
 			ib_get_err_str(status));
@@ -555,5 +516,5 @@ void osm_nr_rcv_process(IN void *ctx, IN void *data)
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
diff --git a/opensm/opensm/osm_sa_path_record.c b/opensm/opensm/osm_sa_path_record.c
index 2ea6211..749a936 100644
--- a/opensm/opensm/osm_sa_path_record.c
+++ b/opensm/opensm/osm_sa_path_record.c
@@ -55,13 +55,11 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
+#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_base.h>
-#include <opensm/osm_sa_path_record.h>
 #include <opensm/osm_port.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_switch.h>
-#include <vendor/osm_vendor.h>
-#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_multicast.h>
@@ -70,7 +68,6 @@
 #include <opensm/osm_qos_policy.h>
 #include <opensm/osm_sa.h>
 #include <opensm/osm_router.h>
-#include <opensm/osm_sa_mcmember_record.h>
 #include <opensm/osm_prefix_route.h>
 
 extern uint8_t osm_get_lash_sl(osm_opensm_t * p_osm,
@@ -94,7 +91,7 @@ typedef struct _osm_path_parms {
 typedef struct osm_sa_pr_mcmr_search_ctxt {
 	ib_gid_t *p_mgid;
 	osm_mgrp_t *p_mgrp;
-	osm_pr_rcv_t *p_rcv;
+	osm_sa_t *sa;
 } osm_sa_pr_mcmr_search_ctxt_t;
 
 static const ib_gid_t zero_gid = { {0x00, 0x00, 0x00, 0x00,
@@ -105,44 +102,6 @@ static const ib_gid_t zero_gid = { {0x00, 0x00, 0x00, 0x00,
 
 /**********************************************************************
  **********************************************************************/
-void osm_pr_rcv_construct(IN osm_pr_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_pr_rcv_destroy(IN osm_pr_rcv_t * const p_rcv)
-{
-	OSM_LOG_ENTER(p_rcv->p_log, osm_pr_rcv_destroy);
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_pr_rcv_init(IN osm_pr_rcv_t * const p_rcv,
-		IN osm_sa_resp_t * const p_resp,
-		IN osm_mad_pool_t * const p_mad_pool,
-		IN osm_subn_t * const p_subn,
-		IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
-{
-	OSM_LOG_ENTER(p_log, osm_pr_rcv_init);
-
-	osm_pr_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_resp = p_resp;
-	p_rcv->p_mad_pool = p_mad_pool;
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-	return IB_SUCCESS;
-}
-
-/**********************************************************************
- **********************************************************************/
 static inline boolean_t
 __osm_sa_path_rec_is_tavor_port(IN const osm_port_t * const p_port)
 {
@@ -214,7 +173,7 @@ __osm_sa_path_rec_apply_tavor_mtu_limit(IN const ib_path_rec_t * const p_pr,
 /**********************************************************************
  **********************************************************************/
 static ib_api_status_t
-__osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
+__osm_pr_rcv_get_path_parms(IN osm_sa_t * sa,
 			    IN const ib_path_rec_t * const p_pr,
 			    IN const osm_port_t * const p_src_port,
 			    IN const osm_port_t * const p_dest_port,
@@ -246,7 +205,7 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 	uint16_t valid_sl_mask = 0xffff;
 	int is_lash;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_pr_rcv_get_path_parms);
+	OSM_LOG_ENTER(sa->p_log, __osm_pr_rcv_get_path_parms);
 
 	dest_lid = cl_hton16(dest_lid_ho);
 
@@ -254,7 +213,7 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 	p_physp = p_src_port->p_physp;
 	p_src_physp = p_physp;
 	p_pi = &p_physp->port_info;
-	p_osm = p_rcv->p_subn->p_osm;
+	p_osm = sa->p_subn->p_osm;
 
 	mtu = ib_port_info_get_mtu_cap(p_pi);
 	rate = ib_port_info_compute_rate(p_pi);
@@ -265,12 +224,12 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 	   and at least one end of the path is Tavor we override the
 	   port MTU with 1K.
 	 */
-	if (p_rcv->p_subn->opt.enable_quirks &&
+	if (sa->p_subn->opt.enable_quirks &&
 	    __osm_sa_path_rec_apply_tavor_mtu_limit(p_pr, p_src_port,
 						    p_dest_port, comp_mask))
 		if (mtu > IB_MTU_LEN_1024) {
 			mtu = IB_MTU_LEN_1024;
-			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			osm_log(sa->p_log, OSM_LOG_DEBUG,
 				"__osm_pr_rcv_get_path_parms: "
 				"Optimized Path MTU to 1K for Mellanox Tavor device\n");
 		}
@@ -293,7 +252,7 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 		 */
 		p_physp = osm_switch_get_route_by_lid(p_node->sw, dest_lid);
 		if (p_physp == 0) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_pr_rcv_get_path_parms: ERR 1F02: "
 				"Cannot find routing to LID 0x%X from switch for GUID 0x%016"
 				PRIx64 "\n", dest_lid_ho,
@@ -303,7 +262,7 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 		}
 	}
 
-	if (p_rcv->p_subn->opt.qos) {
+	if (sa->p_subn->opt.qos) {
 
 		/*
 		 * Whether this node is switch or CA, the IN port for
@@ -318,8 +277,8 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 				valid_sl_mask &= ~(1 << i);
 		}
 		if (!valid_sl_mask) {
-			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(sa->p_log, OSM_LOG_DEBUG))
+				osm_log(sa->p_log, OSM_LOG_DEBUG,
 					"__osm_pr_rcv_get_path_parms: "
 					"All the SLs lead to VL15 on this path\n");
 			status = IB_NOT_FOUND;
@@ -339,7 +298,7 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 		p_dest_physp = osm_switch_get_route_by_lid(p_node->sw, dest_lid);
 
 		if (p_dest_physp == 0) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_pr_rcv_get_path_parms: ERR 1F03: "
 				"Cannot find routing to LID 0x%X from switch for GUID 0x%016"
 				PRIx64 "\n", dest_lid_ho,
@@ -360,7 +319,7 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 		p_physp = osm_physp_get_remote(p_physp);
 
 		if (p_physp == 0) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_pr_rcv_get_path_parms: ERR 1F05: "
 				"Cannot find remote phys port when routing to LID 0x%X from node GUID 0x%016"
 				PRIx64 "\n", dest_lid_ho,
@@ -385,7 +344,7 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 			   If this isn't a switch, we should have reached
 			   the destination by now!
 			 */
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_pr_rcv_get_path_parms: ERR 1F06: "
 				"Internal error, bad path\n");
 			status = IB_ERROR;
@@ -409,7 +368,7 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 		p_physp = osm_switch_get_route_by_lid(p_node->sw, dest_lid);
 
 		if (p_physp == 0) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_pr_rcv_get_path_parms: ERR 1F07: "
 				"Dead end on path to LID 0x%X from switch for GUID 0x%016"
 				PRIx64 "\n", dest_lid_ho,
@@ -428,7 +387,7 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 		if (rate > ib_port_info_compute_rate(p_pi))
 			rate = ib_port_info_compute_rate(p_pi);
 
-		if (p_rcv->p_subn->opt.qos) {
+		if (sa->p_subn->opt.qos) {
 			/*
 			 * Check SL2VL table of the switch and update valid SLs
 			 */
@@ -439,8 +398,8 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 					valid_sl_mask &= ~(1 << i);
 			}
 			if (!valid_sl_mask) {
-				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(sa->p_log, OSM_LOG_DEBUG))
+					osm_log(sa->p_log, OSM_LOG_DEBUG,
 						"__osm_pr_rcv_get_path_parms: "
 						"All the SLs lead to VL15 "
 						"on this path\n");
@@ -461,8 +420,8 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 	if (rate > ib_port_info_compute_rate(p_pi))
 		rate = ib_port_info_compute_rate(p_pi);
 
-	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(sa->p_log, OSM_LOG_DEBUG))
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_pr_rcv_get_path_parms: "
 			"Path min MTU = %u, min rate = %u\n", mtu, rate);
 
@@ -470,14 +429,14 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 	 * Get QoS Level object according to the path request
 	 * and adjust path parameters according to QoS settings
 	 */
-	if (p_rcv->p_subn->opt.qos &&
-	    p_rcv->p_subn->p_qos_policy &&
+	if (sa->p_subn->opt.qos &&
+	    sa->p_subn->p_qos_policy &&
 	    (p_qos_level =
-	     osm_qos_policy_get_qos_level_by_pr(p_rcv->p_subn->p_qos_policy,
+	     osm_qos_policy_get_qos_level_by_pr(sa->p_subn->p_qos_policy,
 						p_pr, p_src_physp, p_dest_physp,
 						comp_mask))) {
-		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(sa->p_log, OSM_LOG_DEBUG))
+			osm_log(sa->p_log, OSM_LOG_DEBUG,
 				"__osm_pr_rcv_get_path_parms: "
 				"PathRecord request matches QoS Level '%s' (%s)\n",
 				p_qos_level->name,
@@ -664,7 +623,7 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 		 */
 		pkey = p_pr->pkey;
 		if (!osm_physp_share_this_pkey(p_src_physp, p_dest_physp, pkey)) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_pr_rcv_get_path_parms: ERR 1F1A: "
 				"Ports do not share specified PKey 0x%04x\n",
 				cl_ntoh16(pkey));
@@ -673,7 +632,7 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 		}
 		if (p_qos_level && p_qos_level->pkey_range_len &&
 		    !osm_qos_level_has_pkey(p_qos_level, pkey)) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_pr_rcv_get_path_parms: ERR 1F1D: "
 				"Ports do not share PKeys defined by QoS level\n");
 			status = IB_NOT_FOUND;
@@ -688,7 +647,7 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 		pkey = osm_qos_level_get_shared_pkey(p_qos_level,
 						     p_src_physp, p_dest_physp);
 		if (!pkey) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_pr_rcv_get_path_parms: ERR 1F1E: "
 				"Ports do not share PKeys defined by QoS level\n");
 			status = IB_NOT_FOUND;
@@ -701,7 +660,7 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 		 */
 		pkey = osm_physp_find_common_pkey(p_src_physp, p_dest_physp);
 		if (!pkey) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_pr_rcv_get_path_parms: ERR 1F1B: "
 				"Ports do not have any shared PKeys\n");
 			status = IB_NOT_FOUND;
@@ -711,11 +670,11 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 
 	if (pkey) {
 		p_prtn =
-		    (osm_prtn_t *) cl_qmap_get(&p_rcv->p_subn->prtn_pkey_tbl,
+		    (osm_prtn_t *) cl_qmap_get(&sa->p_subn->prtn_pkey_tbl,
 					       pkey & cl_hton16((uint16_t) ~
 								0x8000));
 		if (p_prtn ==
-		    (osm_prtn_t *) cl_qmap_end(&p_rcv->p_subn->prtn_pkey_tbl))
+		    (osm_prtn_t *) cl_qmap_end(&sa->p_subn->prtn_pkey_tbl))
 			p_prtn = NULL;
 	}
 
@@ -733,7 +692,7 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 
 		if (p_qos_level && p_qos_level->sl_set
 		    && (p_qos_level->sl != sl)) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_pr_rcv_get_path_parms: ERR 1F1F: "
 				"QoS constaraints: required PathRecord SL (%u) "
 				"doesn't match QoS policy SL (%u)\n", sl,
@@ -744,7 +703,7 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 
 		if (is_lash
 		    && osm_get_lash_sl(p_osm, p_src_port, p_dest_port) != sl) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_pr_rcv_get_path_parms: ERR 1F23: "
 				"Required PathRecord SL (%u) doesn't "
 				"match LASH SL\n", sl);
@@ -759,7 +718,6 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 		 * slid and dest_lid are stored in network in lash.
 		 */
 		sl = osm_get_lash_sl(p_osm, p_src_port, p_dest_port);
-
 	} else if (p_qos_level && p_qos_level->sl_set) {
 		/*
 		 * No specific SL was requested, and we're not in
@@ -768,7 +726,7 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 		sl = p_qos_level->sl;
 
 		if (pkey && p_prtn && p_prtn->sl != p_qos_level->sl)
-			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			osm_log(sa->p_log, OSM_LOG_DEBUG,
 				"__osm_pr_rcv_get_path_parms: "
 				"QoS level SL (%u) overrides partition SL (%u)\n",
 				p_qos_level->sl, p_prtn->sl);
@@ -781,13 +739,13 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 			sl = OSM_DEFAULT_SL;
 			/* this may be possible when pkey tables are created somehow in
 			   previous runs or things are going wrong here */
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_pr_rcv_get_path_parms: ERR 1F1C: "
 				"No partition found for PKey 0x%04x - using default SL %d\n",
 				cl_ntoh16(pkey), sl);
 		} else
 			sl = p_prtn->sl;
-	} else if (p_rcv->p_subn->opt.qos) {
+	} else if (sa->p_subn->opt.qos) {
 		if (valid_sl_mask & (1 << OSM_DEFAULT_SL))
 			sl = OSM_DEFAULT_SL;
 		else {
@@ -799,8 +757,8 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 	} else
 		sl = OSM_DEFAULT_SL;
 
-	if (p_rcv->p_subn->opt.qos && !(valid_sl_mask & (1 << sl))) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+	if (sa->p_subn->opt.qos && !(valid_sl_mask & (1 << sl))) {
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_pr_rcv_get_path_parms: ERR 1F24: "
 			"Selected SL (%u) leads to VL15\n", sl);
 		status = IB_NOT_FOUND;
@@ -818,21 +776,21 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 	p_parms->pkey = pkey;
 	p_parms->sl = sl;
 
-	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(sa->p_log, OSM_LOG_DEBUG))
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_pr_rcv_get_path_parms: Path params:"
 			" mtu = %u, rate = %u, packet lifetime = %u,"
 			" pkey = 0x%04X, sl = %u\n",
 			mtu, rate, pkt_life, cl_ntoh16(pkey), sl);
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_pr_rcv_build_pr(IN osm_pr_rcv_t * const p_rcv,
+__osm_pr_rcv_build_pr(IN osm_sa_t * sa,
 		      IN const osm_port_t * const p_src_port,
 		      IN const osm_port_t * const p_dest_port,
 		      IN const ib_gid_t * const p_dgid,
@@ -846,7 +804,7 @@ __osm_pr_rcv_build_pr(IN osm_pr_rcv_t * const p_rcv,
 	const osm_physp_t *p_dest_physp;
 	boolean_t is_nonzero_gid = 0;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_pr_rcv_build_pr);
+	OSM_LOG_ENTER(sa->p_log, __osm_pr_rcv_build_pr);
 
 	p_src_physp = p_src_port->p_physp;
 
@@ -897,13 +855,13 @@ __osm_pr_rcv_build_pr(IN osm_pr_rcv_t * const p_rcv,
 	if (p_parms->reversible)
 		p_pr->num_path = 0x80;
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static osm_pr_item_t *
-__osm_pr_rcv_get_lid_pair_path(IN osm_pr_rcv_t * const p_rcv,
+__osm_pr_rcv_get_lid_pair_path(IN osm_sa_t * sa,
 			       IN const ib_path_rec_t * const p_pr,
 			       IN const osm_port_t * const p_src_port,
 			       IN const osm_port_t * const p_dest_port,
@@ -918,24 +876,24 @@ __osm_pr_rcv_get_lid_pair_path(IN osm_pr_rcv_t * const p_rcv,
 	osm_pr_item_t *p_pr_item;
 	ib_api_status_t status, rev_path_status;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_pr_rcv_get_lid_pair_path);
+	OSM_LOG_ENTER(sa->p_log, __osm_pr_rcv_get_lid_pair_path);
 
-	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(sa->p_log, OSM_LOG_DEBUG))
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_pr_rcv_get_lid_pair_path: "
 			"Src LID 0x%X, Dest LID 0x%X\n",
 			src_lid_ho, dest_lid_ho);
 
 	p_pr_item = malloc(sizeof(*p_pr_item));
 	if (p_pr_item == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_pr_rcv_get_lid_pair_path: ERR 1F01: "
 			"Unable to allocate path record\n");
 		goto Exit;
 	}
 	memset(p_pr_item, 0, sizeof(*p_pr_item));
 
-	status = __osm_pr_rcv_get_path_parms(p_rcv, p_pr, p_src_port,
+	status = __osm_pr_rcv_get_path_parms(sa, p_pr, p_src_port,
 					     p_dest_port, dest_lid_ho,
 					     comp_mask, &path_parms);
 
@@ -946,7 +904,7 @@ __osm_pr_rcv_get_lid_pair_path(IN osm_pr_rcv_t * const p_rcv,
 	}
 
 	/* now try the reversible path */
-	rev_path_status = __osm_pr_rcv_get_path_parms(p_rcv, p_pr, p_dest_port,
+	rev_path_status = __osm_pr_rcv_get_path_parms(sa, p_pr, p_dest_port,
 						      p_src_port, src_lid_ho,
 						      comp_mask,
 						      &rev_path_parms);
@@ -960,7 +918,7 @@ __osm_pr_rcv_get_lid_pair_path(IN osm_pr_rcv_t * const p_rcv,
 	 */
 	if (comp_mask & IB_PR_COMPMASK_REVERSIBLE) {
 		if ((!path_parms.reversible && (p_pr->num_path & 0x80))) {
-			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			osm_log(sa->p_log, OSM_LOG_DEBUG,
 				"__osm_pr_rcv_get_lid_pair_path: "
 				"Requested reversible path but failed to get one\n");
 
@@ -970,19 +928,19 @@ __osm_pr_rcv_get_lid_pair_path(IN osm_pr_rcv_t * const p_rcv,
 		}
 	}
 
-	__osm_pr_rcv_build_pr(p_rcv, p_src_port, p_dest_port, p_dgid,
+	__osm_pr_rcv_build_pr(sa, p_src_port, p_dest_port, p_dgid,
 			      src_lid_ho, dest_lid_ho, preference, &path_parms,
 			      &p_pr_item->path_rec);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return (p_pr_item);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_pr_rcv_get_port_pair_paths(IN osm_pr_rcv_t * const p_rcv,
+__osm_pr_rcv_get_port_pair_paths(IN osm_sa_t * sa,
 				 IN const osm_madw_t * const p_madw,
 				 IN const osm_port_t * const p_req_port,
 				 IN const osm_port_t * const p_src_port,
@@ -1006,10 +964,10 @@ __osm_pr_rcv_get_port_pair_paths(IN osm_pr_rcv_t * const p_rcv,
 	uintn_t src_offset;
 	uintn_t dest_offset;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_pr_rcv_get_port_pair_paths);
+	OSM_LOG_ENTER(sa->p_log, __osm_pr_rcv_get_port_pair_paths);
 
-	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(sa->p_log, OSM_LOG_DEBUG))
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_pr_rcv_get_port_pair_paths: "
 			"Src port 0x%016" PRIx64 ", "
 			"Dst port 0x%016" PRIx64 "\n",
@@ -1018,10 +976,10 @@ __osm_pr_rcv_get_port_pair_paths(IN osm_pr_rcv_t * const p_rcv,
 
 	/* Check that the req_port, src_port and dest_port all share a
 	   pkey. The check is done on the default physical port of the ports. */
-	if (osm_port_share_pkey(p_rcv->p_log, p_req_port, p_src_port) == FALSE
-	    || osm_port_share_pkey(p_rcv->p_log, p_req_port,
+	if (osm_port_share_pkey(sa->p_log, p_req_port, p_src_port) == FALSE
+	    || osm_port_share_pkey(sa->p_log, p_req_port,
 				   p_dest_port) == FALSE
-	    || osm_port_share_pkey(p_rcv->p_log, p_src_port,
+	    || osm_port_share_pkey(sa->p_log, p_src_port,
 				   p_dest_port) == FALSE)
 		/* One of the pairs doesn't share a pkey so the path is disqualified. */
 		goto Exit;
@@ -1092,21 +1050,21 @@ __osm_pr_rcv_get_port_pair_paths(IN osm_pr_rcv_t * const p_rcv,
 					  &src_lid_max_ho);
 
 	if (src_lid_min_ho == 0) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_pr_rcv_get_port_pair_paths: ERR 1F20:"
 			"Obtained source LID of 0. No such LID possible\n");
 		goto Exit;
 	}
 
 	if (dest_lid_min_ho == 0) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_pr_rcv_get_port_pair_paths: ERR 1F21:"
 			"Obtained destination LID of 0. No such LID possible\n");
 		goto Exit;
 	}
 
-	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(sa->p_log, OSM_LOG_DEBUG))
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_pr_rcv_get_port_pair_paths: "
 			"Src LIDs [0x%X-0x%X], "
 			"Dest LIDs [0x%X-0x%X]\n",
@@ -1136,7 +1094,7 @@ __osm_pr_rcv_get_port_pair_paths(IN osm_pr_rcv_t * const p_rcv,
 		   These paths are "fully redundant"
 		 */
 
-		p_pr_item = __osm_pr_rcv_get_lid_pair_path(p_rcv, p_pr,
+		p_pr_item = __osm_pr_rcv_get_lid_pair_path(sa, p_pr,
 							   p_src_port,
 							   p_dest_port, p_dgid,
 							   src_lid_ho,
@@ -1202,7 +1160,7 @@ __osm_pr_rcv_get_port_pair_paths(IN osm_pr_rcv_t * const p_rcv,
 		if (src_offset == dest_offset)
 			continue;	/* already reported */
 
-		p_pr_item = __osm_pr_rcv_get_lid_pair_path(p_rcv, p_pr,
+		p_pr_item = __osm_pr_rcv_get_lid_pair_path(sa, p_pr,
 							   p_src_port,
 							   p_dest_port, p_dgid,
 							   src_lid_ho,
@@ -1217,13 +1175,13 @@ __osm_pr_rcv_get_port_pair_paths(IN osm_pr_rcv_t * const p_rcv,
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static ib_net16_t
-__osm_pr_rcv_get_end_points(IN osm_pr_rcv_t * const p_rcv,
+__osm_pr_rcv_get_end_points(IN osm_sa_t * sa,
 			    IN const osm_madw_t * const p_madw,
 			    OUT const osm_port_t ** const pp_src_port,
 			    OUT const osm_port_t ** const pp_dest_port,
@@ -1238,7 +1196,7 @@ __osm_pr_rcv_get_end_points(IN osm_pr_rcv_t * const p_rcv,
 	osm_router_t *p_rtr;
 	osm_port_t *p_rtr_port;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_pr_rcv_get_end_points);
+	OSM_LOG_ENTER(sa->p_log, __osm_pr_rcv_get_end_points);
 
 	/*
 	   Determine what fields are valid and then get a pointer
@@ -1258,13 +1216,13 @@ __osm_pr_rcv_get_end_points(IN osm_pr_rcv_t * const p_rcv,
 	if (comp_mask & IB_PR_COMPMASK_SGID) {
 		if (!ib_gid_is_link_local(&p_pr->sgid)) {
 			if (ib_gid_get_subnet_prefix(&p_pr->sgid) !=
-			    p_rcv->p_subn->opt.subnet_prefix) {
+			    sa->p_subn->opt.subnet_prefix) {
 				/*
 				   This 'error' is the client's fault (bad gid) so
 				   don't enter it as an error in our own log.
 				   Return an error response to the client.
 				 */
-				osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+				osm_log(sa->p_log, OSM_LOG_VERBOSE,
 					"__osm_pr_rcv_get_end_points: "
 					"Non local SGID subnet prefix 0x%016"
 					PRIx64 "\n",
@@ -1275,7 +1233,7 @@ __osm_pr_rcv_get_end_points(IN osm_pr_rcv_t * const p_rcv,
 			}
 		}
 
-		*pp_src_port = osm_get_port_by_guid(p_rcv->p_subn,
+		*pp_src_port = osm_get_port_by_guid(sa->p_subn,
 						    p_pr->sgid.unicast.
 						    interface_id);
 		if (!*pp_src_port) {
@@ -1284,7 +1242,7 @@ __osm_pr_rcv_get_end_points(IN osm_pr_rcv_t * const p_rcv,
 			   don't enter it as an error in our own log.
 			   Return an error response to the client.
 			 */
-			osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			osm_log(sa->p_log, OSM_LOG_VERBOSE,
 				"__osm_pr_rcv_get_end_points: "
 				"No source port with GUID 0x%016" PRIx64 "\n",
 				cl_ntoh64(p_pr->sgid.unicast.interface_id));
@@ -1295,7 +1253,7 @@ __osm_pr_rcv_get_end_points(IN osm_pr_rcv_t * const p_rcv,
 	} else {
 		*pp_src_port = 0;
 		if (comp_mask & IB_PR_COMPMASK_SLID) {
-			status = cl_ptr_vector_at(&p_rcv->p_subn->port_lid_tbl,
+			status = cl_ptr_vector_at(&sa->p_subn->port_lid_tbl,
 						  cl_ntoh16(p_pr->slid),
 						  (void **)pp_src_port);
 
@@ -1305,7 +1263,7 @@ __osm_pr_rcv_get_end_points(IN osm_pr_rcv_t * const p_rcv,
 				   don't enter it as an error in our own log.
 				   Return an error response to the client.
 				 */
-				osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+				osm_log(sa->p_log, OSM_LOG_VERBOSE,
 					"__osm_pr_rcv_get_end_points: "
 					"No source port with LID = 0x%X\n",
 					cl_ntoh16(p_pr->slid));
@@ -1324,8 +1282,8 @@ __osm_pr_rcv_get_end_points(IN osm_pr_rcv_t * const p_rcv,
 		if (!ib_gid_is_link_local(&p_pr->dgid)) {
 			if (!ib_gid_is_multicast(&p_pr->dgid) &&
 			    ib_gid_get_subnet_prefix(&p_pr->dgid) !=
-			    p_rcv->p_subn->opt.subnet_prefix) {
-				osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			    sa->p_subn->opt.subnet_prefix) {
+				osm_log(sa->p_log, OSM_LOG_VERBOSE,
 					"__osm_pr_rcv_get_end_points: "
 					"Non local DGID subnet prefix 0x%016"
 					PRIx64 "\n",
@@ -1335,10 +1293,10 @@ __osm_pr_rcv_get_end_points(IN osm_pr_rcv_t * const p_rcv,
 				   this prefix, if any: */
 				osm_prefix_route_t *route = NULL;
 				osm_prefix_route_t *r = (osm_prefix_route_t *)
-					cl_qlist_head(&p_rcv->p_subn->prefix_routes_list);
+					cl_qlist_head(&sa->p_subn->prefix_routes_list);
 
 				while (r != (osm_prefix_route_t *)
-				       cl_qlist_end(&p_rcv->p_subn->prefix_routes_list))
+				       cl_qlist_end(&sa->p_subn->prefix_routes_list))
 				{
 					if (r->prefix == p_pr->dgid.unicast.prefix ||
 					    r->prefix == 0)
@@ -1360,23 +1318,23 @@ __osm_pr_rcv_get_end_points(IN osm_pr_rcv_t * const p_rcv,
 				} else if (route->guid == 0) {
 					/* first router */
 					p_rtr = (osm_router_t *)
-						cl_qmap_head(&p_rcv->
+						cl_qmap_head(&sa->
 							     p_subn->
 							     rtr_guid_tbl);
 				} else {
 					p_rtr = (osm_router_t *)
-						cl_qmap_get(&p_rcv->
+						cl_qmap_get(&sa->
 							    p_subn->
 							    rtr_guid_tbl,
 							    route->guid);
 				}
 
 				if (p_rtr ==
-				    (osm_router_t *) cl_qmap_end(&p_rcv->
+				    (osm_router_t *) cl_qmap_end(&sa->
 								 p_subn->
 								 rtr_guid_tbl))
 				{
-					osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+					osm_log(sa->p_log, OSM_LOG_ERROR,
 						"__osm_pr_rcv_get_end_points: ERR 1F22: "
 						"Off subnet DGID but router not found\n");
 					sa_status =
@@ -1391,14 +1349,14 @@ __osm_pr_rcv_get_end_points(IN osm_pr_rcv_t * const p_rcv,
 			}
 		}
 
-		*pp_dest_port = osm_get_port_by_guid(p_rcv->p_subn, dest_guid);
+		*pp_dest_port = osm_get_port_by_guid(sa->p_subn, dest_guid);
 		if (!*pp_dest_port) {
 			/*
 			   This 'error' is the client's fault (bad gid) so
 			   don't enter it as an error in our own log.
 			   Return an error response to the client.
 			 */
-			osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			osm_log(sa->p_log, OSM_LOG_VERBOSE,
 				"__osm_pr_rcv_get_end_points: "
 				"No dest port with GUID 0x%016" PRIx64 "\n",
 				cl_ntoh64(dest_guid));
@@ -1409,7 +1367,7 @@ __osm_pr_rcv_get_end_points(IN osm_pr_rcv_t * const p_rcv,
 	} else {
 		*pp_dest_port = 0;
 		if (comp_mask & IB_PR_COMPMASK_DLID) {
-			status = cl_ptr_vector_at(&p_rcv->p_subn->port_lid_tbl,
+			status = cl_ptr_vector_at(&sa->p_subn->port_lid_tbl,
 						  cl_ntoh16(p_pr->dlid),
 						  (void **)pp_dest_port);
 
@@ -1419,7 +1377,7 @@ __osm_pr_rcv_get_end_points(IN osm_pr_rcv_t * const p_rcv,
 				   don't enter it as an error in our own log.
 				   Return an error response to the client.
 				 */
-				osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+				osm_log(sa->p_log, OSM_LOG_VERBOSE,
 					"__osm_pr_rcv_get_end_points: "
 					"No dest port with LID = 0x%X\n",
 					cl_ntoh16(p_pr->dlid));
@@ -1431,14 +1389,14 @@ __osm_pr_rcv_get_end_points(IN osm_pr_rcv_t * const p_rcv,
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return (sa_status);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_pr_rcv_process_world(IN osm_pr_rcv_t * const p_rcv,
+__osm_pr_rcv_process_world(IN osm_sa_t * sa,
 			   IN const osm_madw_t * const p_madw,
 			   IN const osm_port_t * const requester_port,
 			   IN const ib_gid_t * const p_dgid,
@@ -1449,7 +1407,7 @@ __osm_pr_rcv_process_world(IN osm_pr_rcv_t * const p_rcv,
 	const osm_port_t *p_dest_port;
 	const osm_port_t *p_src_port;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_pr_rcv_process_world);
+	OSM_LOG_ENTER(sa->p_log, __osm_pr_rcv_process_world);
 
 	/*
 	   Iterate the entire port space over itself.
@@ -1459,13 +1417,13 @@ __osm_pr_rcv_process_world(IN osm_pr_rcv_t * const p_rcv,
 	   We compute both A -> B and B -> A, since we don't have
 	   any check to determine the reversability of the paths.
 	 */
-	p_tbl = &p_rcv->p_subn->port_guid_tbl;
+	p_tbl = &sa->p_subn->port_guid_tbl;
 
 	p_dest_port = (osm_port_t *) cl_qmap_head(p_tbl);
 	while (p_dest_port != (osm_port_t *) cl_qmap_end(p_tbl)) {
 		p_src_port = (osm_port_t *) cl_qmap_head(p_tbl);
 		while (p_src_port != (osm_port_t *) cl_qmap_end(p_tbl)) {
-			__osm_pr_rcv_get_port_pair_paths(p_rcv, p_madw,
+			__osm_pr_rcv_get_port_pair_paths(sa, p_madw,
 							 requester_port,
 							 p_src_port,
 							 p_dest_port, p_dgid,
@@ -1479,13 +1437,13 @@ __osm_pr_rcv_process_world(IN osm_pr_rcv_t * const p_rcv,
 		    (osm_port_t *) cl_qmap_next(&p_dest_port->map_item);
 	}
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_pr_rcv_process_half(IN osm_pr_rcv_t * const p_rcv,
+__osm_pr_rcv_process_half(IN osm_sa_t * sa,
 			  IN const osm_madw_t * const p_madw,
 			  IN const osm_port_t * const requester_port,
 			  IN const osm_port_t * const p_src_port,
@@ -1497,14 +1455,14 @@ __osm_pr_rcv_process_half(IN osm_pr_rcv_t * const p_rcv,
 	const cl_qmap_t *p_tbl;
 	const osm_port_t *p_port;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_pr_rcv_process_half);
+	OSM_LOG_ENTER(sa->p_log, __osm_pr_rcv_process_half);
 
 	/*
 	   Iterate over every port, looking for matches...
 	   A path record from a port to itself is legit, so no
 	   need to special case that one.
 	 */
-	p_tbl = &p_rcv->p_subn->port_guid_tbl;
+	p_tbl = &sa->p_subn->port_guid_tbl;
 
 	if (p_src_port) {
 		/*
@@ -1512,7 +1470,7 @@ __osm_pr_rcv_process_half(IN osm_pr_rcv_t * const p_rcv,
 		 */
 		p_port = (osm_port_t *) cl_qmap_head(p_tbl);
 		while (p_port != (osm_port_t *) cl_qmap_end(p_tbl)) {
-			__osm_pr_rcv_get_port_pair_paths(p_rcv, p_madw,
+			__osm_pr_rcv_get_port_pair_paths(sa, p_madw,
 							 requester_port,
 							 p_src_port, p_port,
 							 p_dgid, comp_mask,
@@ -1525,7 +1483,7 @@ __osm_pr_rcv_process_half(IN osm_pr_rcv_t * const p_rcv,
 		 */
 		p_port = (osm_port_t *) cl_qmap_head(p_tbl);
 		while (p_port != (osm_port_t *) cl_qmap_end(p_tbl)) {
-			__osm_pr_rcv_get_port_pair_paths(p_rcv, p_madw,
+			__osm_pr_rcv_get_port_pair_paths(sa, p_madw,
 							 requester_port, p_port,
 							 p_dest_port, p_dgid,
 							 comp_mask, p_list);
@@ -1533,13 +1491,13 @@ __osm_pr_rcv_process_half(IN osm_pr_rcv_t * const p_rcv,
 		}
 	}
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_pr_rcv_process_pair(IN osm_pr_rcv_t * const p_rcv,
+__osm_pr_rcv_process_pair(IN osm_sa_t * sa,
 			  IN const osm_madw_t * const p_madw,
 			  IN const osm_port_t * const requester_port,
 			  IN const osm_port_t * const p_src_port,
@@ -1548,13 +1506,13 @@ __osm_pr_rcv_process_pair(IN osm_pr_rcv_t * const p_rcv,
 			  IN const ib_net64_t comp_mask,
 			  IN cl_qlist_t * const p_list)
 {
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_pr_rcv_process_pair);
+	OSM_LOG_ENTER(sa->p_log, __osm_pr_rcv_process_pair);
 
-	__osm_pr_rcv_get_port_pair_paths(p_rcv, p_madw, requester_port,
+	__osm_pr_rcv_get_port_pair_paths(sa, p_madw, requester_port,
 					 p_src_port, p_dest_port, p_dgid,
 					 comp_mask, p_list);
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
@@ -1566,11 +1524,11 @@ __search_mgrp_by_mgid(IN cl_map_item_t * const p_map_item, IN void *context)
 	osm_sa_pr_mcmr_search_ctxt_t *p_ctxt =
 	    (osm_sa_pr_mcmr_search_ctxt_t *) context;
 	const ib_gid_t *p_recvd_mgid;
-	osm_pr_rcv_t *p_rcv;
+	osm_sa_t *sa;
 	/* uint32_t i; */
 
 	p_recvd_mgid = p_ctxt->p_mgid;
-	p_rcv = p_ctxt->p_rcv;
+	sa = p_ctxt->sa;
 
 	/* ignore groups marked for deletion */
 	if (p_mgrp->to_be_deleted)
@@ -1592,7 +1550,7 @@ __search_mgrp_by_mgid(IN cl_map_item_t * const p_map_item, IN void *context)
 #endif
 
 	if (p_ctxt->p_mgrp) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__search_mgrp_by_mgid: ERR 1F08: "
 			"Multiple MC groups for same MGID\n");
 		return;
@@ -1603,17 +1561,17 @@ __search_mgrp_by_mgid(IN cl_map_item_t * const p_map_item, IN void *context)
 /**********************************************************************
  **********************************************************************/
 static ib_api_status_t
-__get_mgrp_by_mgid(IN osm_pr_rcv_t * const p_rcv,
+__get_mgrp_by_mgid(IN osm_sa_t * sa,
 		   IN ib_path_rec_t * p_recvd_path_rec,
 		   OUT osm_mgrp_t ** pp_mgrp)
 {
 	osm_sa_pr_mcmr_search_ctxt_t mcmr_search_context;
 
 	mcmr_search_context.p_mgid = &p_recvd_path_rec->dgid;
-	mcmr_search_context.p_rcv = p_rcv;
+	mcmr_search_context.sa = sa;
 	mcmr_search_context.p_mgrp = NULL;
 
-	cl_qmap_apply_func(&p_rcv->p_subn->mgrp_mlid_tbl,
+	cl_qmap_apply_func(&sa->p_subn->mgrp_mlid_tbl,
 			   __search_mgrp_by_mgid, &mcmr_search_context);
 
 	if (mcmr_search_context.p_mgrp == NULL)
@@ -1625,14 +1583,14 @@ __get_mgrp_by_mgid(IN osm_pr_rcv_t * const p_rcv,
 
 /**********************************************************************
  **********************************************************************/
-static osm_mgrp_t *__get_mgrp_by_mlid(IN const osm_pr_rcv_t * const p_rcv,
+static osm_mgrp_t *__get_mgrp_by_mlid(IN osm_sa_t * sa,
 				      IN ib_net16_t const mlid)
 {
 	cl_map_item_t *map_item;
 
-	map_item = cl_qmap_get(&p_rcv->p_subn->mgrp_mlid_tbl, mlid);
+	map_item = cl_qmap_get(&sa->p_subn->mgrp_mlid_tbl, mlid);
 
-	if (map_item == cl_qmap_end(&p_rcv->p_subn->mgrp_mlid_tbl))
+	if (map_item == cl_qmap_end(&sa->p_subn->mgrp_mlid_tbl))
 		return NULL;
 
 	return (osm_mgrp_t *) map_item;
@@ -1641,7 +1599,7 @@ static osm_mgrp_t *__get_mgrp_by_mlid(IN const osm_pr_rcv_t * const p_rcv,
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_pr_get_mgrp(IN osm_pr_rcv_t * const p_rcv,
+__osm_pr_get_mgrp(IN osm_sa_t * sa,
 		  IN const osm_madw_t * const p_madw, OUT osm_mgrp_t ** pp_mgrp)
 {
 	ib_path_rec_t *p_pr;
@@ -1649,7 +1607,7 @@ __osm_pr_get_mgrp(IN osm_pr_rcv_t * const p_rcv,
 	ib_net64_t comp_mask;
 	ib_api_status_t status;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_pr_get_mgrp);
+	OSM_LOG_ENTER(sa->p_log, __osm_pr_get_mgrp);
 
 	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
 	p_pr = (ib_path_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
@@ -1657,9 +1615,9 @@ __osm_pr_get_mgrp(IN osm_pr_rcv_t * const p_rcv,
 	comp_mask = p_sa_mad->comp_mask;
 
 	if (comp_mask & IB_PR_COMPMASK_DGID) {
-		status = __get_mgrp_by_mgid(p_rcv, p_pr, pp_mgrp);
+		status = __get_mgrp_by_mgid(sa, p_pr, pp_mgrp);
 		if (status != IB_SUCCESS) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_pr_get_mgrp: ERR 1F09: "
 				"No MC group found for PathRecord destination GID\n");
 			goto Exit;
@@ -1672,29 +1630,29 @@ __osm_pr_get_mgrp(IN osm_pr_rcv_t * const p_rcv,
 			/* the same as the DLID in the PathRecord */
 			if ((*pp_mgrp)->mlid != p_pr->dlid) {
 				/* Note: perhaps this might be better indicated as an invalid request */
-				osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				osm_log(sa->p_log, OSM_LOG_ERROR,
 					"__osm_pr_get_mgrp: ERR 1F10: "
 					"MC group MLID does not match PathRecord destination LID\n");
 				*pp_mgrp = NULL;
 				goto Exit;
 			}
 		} else {
-			*pp_mgrp = __get_mgrp_by_mlid(p_rcv, p_pr->dlid);
+			*pp_mgrp = __get_mgrp_by_mlid(sa, p_pr->dlid);
 			if (*pp_mgrp == NULL)
-				osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				osm_log(sa->p_log, OSM_LOG_ERROR,
 					"__osm_pr_get_mgrp: ERR 1F11: "
 					"No MC group found for PathRecord destination LID\n");
 		}
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static ib_api_status_t
-__osm_pr_match_mgrp_attributes(IN osm_pr_rcv_t * const p_rcv,
+__osm_pr_match_mgrp_attributes(IN osm_sa_t * sa,
 			       IN const osm_madw_t * const p_madw,
 			       IN const osm_mgrp_t * const p_mgrp)
 {
@@ -1706,7 +1664,7 @@ __osm_pr_match_mgrp_attributes(IN osm_pr_rcv_t * const p_rcv,
 	uint8_t sl;
 	uint8_t hop_limit;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_pr_match_mgrp_attributes);
+	OSM_LOG_ENTER(sa->p_log, __osm_pr_match_mgrp_attributes);
 
 	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
 	p_pr = (ib_path_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
@@ -1753,14 +1711,14 @@ __osm_pr_match_mgrp_attributes(IN osm_pr_rcv_t * const p_rcv,
 	status = IB_SUCCESS;
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 static int
-__osm_pr_rcv_check_mcast_dest(IN osm_pr_rcv_t * const p_rcv,
+__osm_pr_rcv_check_mcast_dest(IN osm_sa_t * sa,
 			      IN const osm_madw_t * const p_madw)
 {
 	const ib_path_rec_t *p_pr;
@@ -1768,7 +1726,7 @@ __osm_pr_rcv_check_mcast_dest(IN osm_pr_rcv_t * const p_rcv,
 	ib_net64_t comp_mask;
 	int is_multicast = 0;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_pr_rcv_check_mcast_dest);
+	OSM_LOG_ENTER(sa->p_log, __osm_pr_rcv_check_mcast_dest);
 
 	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
 	p_pr = (ib_path_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
@@ -1786,7 +1744,7 @@ __osm_pr_rcv_check_mcast_dest(IN osm_pr_rcv_t * const p_rcv,
 		    cl_ntoh16(p_pr->dlid) <= IB_LID_MCAST_END_HO)
 			is_multicast = 1;
 		else if (is_multicast) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_pr_rcv_check_mcast_dest: ERR 1F12: "
 				"PathRecord request indicates MGID but not MLID\n");
 			is_multicast = -1;
@@ -1794,14 +1752,14 @@ __osm_pr_rcv_check_mcast_dest(IN osm_pr_rcv_t * const p_rcv,
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return (is_multicast);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_pr_rcv_respond(IN osm_pr_rcv_t * const p_rcv,
+__osm_pr_rcv_respond(IN osm_sa_t * sa,
 		     IN const osm_madw_t * const p_madw,
 		     IN cl_qlist_t * const p_list)
 {
@@ -1814,11 +1772,11 @@ __osm_pr_rcv_respond(IN osm_pr_rcv_t * const p_rcv,
 #endif
 	ib_path_rec_t *p_resp_pr;
 	ib_api_status_t status;
-	const ib_sa_mad_t *p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	const ib_sa_mad_t *sad_mad = osm_madw_get_sa_mad_ptr(p_madw);
 	osm_pr_item_t *p_pr_item;
 	uint32_t i;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_pr_rcv_respond);
+	OSM_LOG_ENTER(sa->p_log, __osm_pr_rcv_respond);
 
 	num_rec = cl_qlist_count(p_list);
 
@@ -1826,18 +1784,18 @@ __osm_pr_rcv_respond(IN osm_pr_rcv_t * const p_rcv,
 	 * C15-0.1.30:
 	 * If we do a SubnAdmGet and got more than one record it is an error !
 	 */
-	if (p_rcvd_mad->method == IB_MAD_METHOD_GET) {
+	if (sad_mad->method == IB_MAD_METHOD_GET) {
 		if (num_rec == 0) {
-			osm_sa_send_error(p_rcv->p_resp, p_madw,
+			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_NO_RECORDS);
 			goto Exit;
 		}
 		if (num_rec > 1) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_pr_rcv_respond: ERR 1F13: "
 				"Got more than one record for SubnAdmGet (%zu)\n",
 				num_rec);
-			osm_sa_send_error(p_rcv->p_resp, p_madw,
+			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
 			/* need to set the mem free ... */
 			p_pr_item =
@@ -1857,7 +1815,7 @@ __osm_pr_rcv_respond(IN osm_pr_rcv_t * const p_rcv,
 	trim_num_rec =
 	    (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_path_rec_t);
 	if (trim_num_rec < num_rec) {
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sa->p_log, OSM_LOG_VERBOSE,
 			"__osm_pr_rcv_respond: "
 			"Number of records:%u trimmed to:%u to fit in one MAD\n",
 			num_rec, trim_num_rec);
@@ -1865,12 +1823,12 @@ __osm_pr_rcv_respond(IN osm_pr_rcv_t * const p_rcv,
 	}
 #endif
 
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sa->p_log, OSM_LOG_DEBUG,
 		"__osm_pr_rcv_respond: "
 		"Generating response with %zu records\n", num_rec);
 
-	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0)) {
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+	if ((sad_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0)) {
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RECORDS);
 		goto Exit;
 	}
@@ -1878,11 +1836,11 @@ __osm_pr_rcv_respond(IN osm_pr_rcv_t * const p_rcv,
 	/*
 	 * Get a MAD to reply. Address of Mad is in the received mad_wrapper
 	 */
-	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool, p_madw->h_bind,
+	p_resp_madw = osm_mad_pool_get(sa->p_mad_pool, p_madw->h_bind,
 				       num_rec * sizeof(ib_path_rec_t) +
 				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
 	if (!p_resp_madw) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_pr_rcv_respond: ERR 1F14: "
 			"Unable to allocate MAD\n");
 
@@ -1892,7 +1850,7 @@ __osm_pr_rcv_respond(IN osm_pr_rcv_t * const p_rcv,
 			free(p_pr_item);
 		}
 
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RESOURCES);
 		goto Exit;
 	}
@@ -1937,24 +1895,24 @@ __osm_pr_rcv_respond(IN osm_pr_rcv_t * const p_rcv,
 	CL_ASSERT(cl_is_qlist_empty(p_list));
 
 	status = osm_sa_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE,
-				    p_rcv->p_subn);
+				    sa->p_subn);
 
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_pr_rcv_respond: ERR 1F15: "
 			"Unable to send MAD (%s)\n", ib_get_err_str(status));
-		/*  osm_mad_pool_put( p_rcv->p_mad_pool, p_resp_madw ); */
+		/*  osm_mad_pool_put( sa->p_mad_pool, p_resp_madw ); */
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 void osm_pr_rcv_process(IN void *context, IN void *data)
 {
-	osm_pr_rcv_t *p_rcv = context;
+	osm_sa_t *sa = context;
 	osm_madw_t *p_madw = data;
 	const ib_path_rec_t *p_pr;
 	const ib_sa_mad_t *p_sa_mad;
@@ -1966,7 +1924,7 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 	osm_port_t *requester_port;
 	int ret;
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_pr_rcv_process);
+	OSM_LOG_ENTER(sa->p_log, osm_pr_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -1978,28 +1936,28 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 	/* we only support SubnAdmGet and SubnAdmGetTable methods */
 	if ((p_sa_mad->method != IB_MAD_METHOD_GET) &&
 	    (p_sa_mad->method != IB_MAD_METHOD_GETTABLE)) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_pr_rcv_process: ERR 1F17: "
 			"Unsupported Method (%s)\n",
 			ib_get_sa_method_str(p_sa_mad->method));
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
 	}
 
 	/* update the requester physical port. */
-	requester_port = osm_get_port_by_mad_addr(p_rcv->p_log, p_rcv->p_subn,
+	requester_port = osm_get_port_by_mad_addr(sa->p_log, sa->p_subn,
 						  osm_madw_get_mad_addr_ptr
 						  (p_madw));
 	if (requester_port == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_pr_rcv_process: ERR 1F16: "
 			"Cannot find requester physical port\n");
 		goto Exit;
 	}
 
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
-		osm_dump_path_record(p_rcv->p_log, p_pr, OSM_LOG_DEBUG);
+	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
+		osm_dump_path_record(sa->p_log, p_pr, OSM_LOG_DEBUG);
 
 	cl_qlist_init(&pr_list);
 
@@ -2007,13 +1965,13 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 	   Most SA functions (including this one) are read-only on the
 	   subnet object, so we grab the lock non-exclusively.
 	 */
-	cl_plock_acquire(p_rcv->p_lock);
+	cl_plock_acquire(sa->p_lock);
 
 	/* Handle multicast destinations separately */
-	if ((ret = __osm_pr_rcv_check_mcast_dest(p_rcv, p_madw)) < 0) {
+	if ((ret = __osm_pr_rcv_check_mcast_dest(sa, p_madw)) < 0) {
 		/* Multicast DGID with unicast DLID */
-		cl_plock_release(p_rcv->p_lock);
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		cl_plock_release(sa->p_lock);
+		osm_sa_send_error(sa, p_madw,
 				  IB_MAD_STATUS_INVALID_FIELD);
 		goto Exit;
 	}
@@ -2021,10 +1979,10 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 	if (ret > 0)
 		goto McastDest;
 
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sa->p_log, OSM_LOG_DEBUG,
 		"osm_pr_rcv_process: " "Unicast destination requested\n");
 
-	sa_status = __osm_pr_rcv_get_end_points(p_rcv, p_madw,
+	sa_status = __osm_pr_rcv_get_end_points(sa, p_madw,
 						&p_src_port, &p_dest_port,
 						&dgid);
 
@@ -2035,14 +1993,14 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 		 */
 		if (p_src_port) {
 			if (p_dest_port)
-				__osm_pr_rcv_process_pair(p_rcv, p_madw,
+				__osm_pr_rcv_process_pair(sa, p_madw,
 							  requester_port,
 							  p_src_port,
 							  p_dest_port, &dgid,
 							  p_sa_mad->comp_mask,
 							  &pr_list);
 			else
-				__osm_pr_rcv_process_half(p_rcv, p_madw,
+				__osm_pr_rcv_process_half(sa, p_madw,
 							  requester_port,
 							  p_src_port, NULL,
 							  &dgid,
@@ -2050,7 +2008,7 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 							  &pr_list);
 		} else {
 			if (p_dest_port)
-				__osm_pr_rcv_process_half(p_rcv, p_madw,
+				__osm_pr_rcv_process_half(sa, p_madw,
 							  requester_port, NULL,
 							  p_dest_port, &dgid,
 							  p_sa_mad->comp_mask,
@@ -2059,7 +2017,7 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 				/*
 				   Katie, bar the door!
 				 */
-				__osm_pr_rcv_process_world(p_rcv, p_madw,
+				__osm_pr_rcv_process_world(sa, p_madw,
 							   requester_port,
 							   &dgid,
 							   p_sa_mad->comp_mask,
@@ -2069,7 +2027,7 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 	goto Unlock;
 
       McastDest:
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sa->p_log, OSM_LOG_DEBUG,
 		"osm_pr_rcv_process: " "Multicast destination requested\n");
 	{
 		osm_mgrp_t *p_mgrp = NULL;
@@ -2080,15 +2038,15 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 		uint8_t hop_limit;
 
 		/* First, get the MC info */
-		__osm_pr_get_mgrp(p_rcv, p_madw, &p_mgrp);
+		__osm_pr_get_mgrp(sa, p_madw, &p_mgrp);
 
 		if (!p_mgrp)
 			goto Unlock;
 
 		/* Make sure the rest of the PathRecord matches the MC group attributes */
-		status = __osm_pr_match_mgrp_attributes(p_rcv, p_madw, p_mgrp);
+		status = __osm_pr_match_mgrp_attributes(sa, p_madw, p_mgrp);
 		if (status != IB_SUCCESS) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_pr_rcv_process: ERR 1F19: "
 				"MC group attributes don't match PathRecord request\n");
 			goto Unlock;
@@ -2096,7 +2054,7 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 
 		p_pr_item = malloc(sizeof(*p_pr_item));
 		if (p_pr_item == NULL) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_pr_rcv_process: ERR 1F18: "
 				"Unable to allocate path record for MC group\n");
 			goto Unlock;
@@ -2142,11 +2100,11 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 	}
 
       Unlock:
-	cl_plock_release(p_rcv->p_lock);
+	cl_plock_release(sa->p_lock);
 
 	/* Now, (finally) respond to the PathRecord request */
-	__osm_pr_rcv_respond(p_rcv, p_madw, &pr_list);
+	__osm_pr_rcv_respond(sa, p_madw, &pr_list);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
diff --git a/opensm/opensm/osm_sa_pkey_record.c b/opensm/opensm/osm_sa_pkey_record.c
index 1e9f50f..e7547df 100644
--- a/opensm/opensm/osm_sa_pkey_record.c
+++ b/opensm/opensm/osm_sa_pkey_record.c
@@ -43,10 +43,9 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
-#include <opensm/osm_sa_pkey_record.h>
+#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_port.h>
 #include <opensm/osm_node.h>
-#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_sa.h>
@@ -61,52 +60,14 @@ typedef struct _osm_pkey_search_ctxt {
 	ib_net64_t comp_mask;
 	uint16_t block_num;
 	cl_qlist_t *p_list;
-	osm_pkey_rec_rcv_t *p_rcv;
+	osm_sa_t *sa;
 	const osm_physp_t *p_req_physp;
 } osm_pkey_search_ctxt_t;
 
 /**********************************************************************
  **********************************************************************/
-void osm_pkey_rec_rcv_construct(IN osm_pkey_rec_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_pkey_rec_rcv_destroy(IN osm_pkey_rec_rcv_t * const p_rcv)
-{
-	OSM_LOG_ENTER(p_rcv->p_log, osm_pkey_rec_rcv_destroy);
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_pkey_rec_rcv_init(IN osm_pkey_rec_rcv_t * const p_rcv,
-		      IN osm_sa_resp_t * const p_resp,
-		      IN osm_mad_pool_t * const p_mad_pool,
-		      IN osm_subn_t * const p_subn,
-		      IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
-{
-	OSM_LOG_ENTER(p_log, osm_pkey_rec_rcv_init);
-
-	osm_pkey_rec_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_resp = p_resp;
-	p_rcv->p_mad_pool = p_mad_pool;
-
-	OSM_LOG_EXIT(p_log);
-	return IB_SUCCESS;
-}
-
-/**********************************************************************
- **********************************************************************/
 static void
-__osm_sa_pkey_create(IN osm_pkey_rec_rcv_t * const p_rcv,
+__osm_sa_pkey_create(IN osm_sa_t * sa,
 		     IN osm_physp_t * const p_physp,
 		     IN osm_pkey_search_ctxt_t * const p_ctxt,
 		     IN uint16_t block)
@@ -115,11 +76,11 @@ __osm_sa_pkey_create(IN osm_pkey_rec_rcv_t * const p_rcv,
 	uint16_t lid;
 	ib_api_status_t status = IB_SUCCESS;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_pkey_create);
+	OSM_LOG_ENTER(sa->p_log, __osm_sa_pkey_create);
 
 	p_rec_item = malloc(sizeof(*p_rec_item));
 	if (p_rec_item == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_sa_pkey_create: ERR 4602: "
 			"rec_item alloc failed\n");
 		status = IB_INSUFFICIENT_RESOURCES;
@@ -131,8 +92,8 @@ __osm_sa_pkey_create(IN osm_pkey_rec_rcv_t * const p_rcv,
 	else
 		lid = osm_node_get_base_lid(p_physp->p_node, 0);
 
-	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(sa->p_log, OSM_LOG_DEBUG)) {
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_sa_pkey_create: "
 			"New P_Key table for: port 0x%016" PRIx64
 			", lid 0x%X, port 0x%X Block:%u\n",
@@ -151,40 +112,40 @@ __osm_sa_pkey_create(IN osm_pkey_rec_rcv_t * const p_rcv,
 	cl_qlist_insert_tail(p_ctxt->p_list, &p_rec_item->list_item);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sa_pkey_check_physp(IN osm_pkey_rec_rcv_t * const p_rcv,
+__osm_sa_pkey_check_physp(IN osm_sa_t * sa,
 			  IN osm_physp_t * const p_physp,
 			  osm_pkey_search_ctxt_t * const p_ctxt)
 {
 	ib_net64_t comp_mask = p_ctxt->comp_mask;
 	uint16_t block, num_blocks;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_pkey_check_physp);
+	OSM_LOG_ENTER(sa->p_log, __osm_sa_pkey_check_physp);
 
 	/* we got here with the phys port - all is left is to get the right block */
 	if (comp_mask & IB_PKEY_COMPMASK_BLOCK) {
-		__osm_sa_pkey_create(p_rcv, p_physp, p_ctxt, p_ctxt->block_num);
+		__osm_sa_pkey_create(sa, p_physp, p_ctxt, p_ctxt->block_num);
 	} else {
 		num_blocks =
 		    osm_pkey_tbl_get_num_blocks(osm_physp_get_pkey_tbl
 						(p_physp));
 		for (block = 0; block < num_blocks; block++) {
-			__osm_sa_pkey_create(p_rcv, p_physp, p_ctxt, block);
+			__osm_sa_pkey_create(sa, p_physp, p_ctxt, block);
 		}
 	}
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sa_pkey_by_comp_mask(IN osm_pkey_rec_rcv_t * const p_rcv,
+__osm_sa_pkey_by_comp_mask(IN osm_sa_t * sa,
 			   IN const osm_port_t * const p_port,
 			   osm_pkey_search_ctxt_t * const p_ctxt)
 {
@@ -195,7 +156,7 @@ __osm_sa_pkey_by_comp_mask(IN osm_pkey_rec_rcv_t * const p_rcv,
 	uint8_t num_ports;
 	const osm_physp_t *p_req_physp;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_pkey_by_comp_mask);
+	OSM_LOG_ENTER(sa->p_log, __osm_sa_pkey_by_comp_mask);
 
 	p_rcvd_rec = p_ctxt->p_rcvd_rec;
 	comp_mask = p_ctxt->comp_mask;
@@ -207,7 +168,7 @@ __osm_sa_pkey_by_comp_mask(IN osm_pkey_rec_rcv_t * const p_rcv,
 	if (p_port->p_node->node_info.node_type != IB_NODE_TYPE_SWITCH) {
 		/* we put it in the comp mask and port num */
 		port_num = p_port->p_physp->port_num;
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_sa_pkey_by_comp_mask:  "
 			"Using Physical Default Port Number: 0x%X (for End Node)\n",
 			port_num);
@@ -222,11 +183,11 @@ __osm_sa_pkey_by_comp_mask(IN osm_pkey_rec_rcv_t * const p_rcv,
 			   with the p_req_physp. */
 			if (osm_physp_is_valid(p_physp) &&
 			    (osm_physp_share_pkey
-			     (p_rcv->p_log, p_req_physp, p_physp)))
-				__osm_sa_pkey_check_physp(p_rcv, p_physp,
+			     (sa->p_log, p_req_physp, p_physp)))
+				__osm_sa_pkey_check_physp(sa, p_physp,
 							  p_ctxt);
 		} else {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_sa_pkey_by_comp_mask: ERR 4603: "
 				"Given Physical Port Number: 0x%X is out of range should be < 0x%X\n",
 				port_num,
@@ -244,14 +205,14 @@ __osm_sa_pkey_by_comp_mask(IN osm_pkey_rec_rcv_t * const p_rcv,
 			/* if the requester and the p_physp don't share a pkey -
 			   continue */
 			if (!osm_physp_share_pkey
-			    (p_rcv->p_log, p_req_physp, p_physp))
+			    (sa->p_log, p_req_physp, p_physp))
 				continue;
 
-			__osm_sa_pkey_check_physp(p_rcv, p_physp, p_ctxt);
+			__osm_sa_pkey_check_physp(sa, p_physp, p_ctxt);
 		}
 	}
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
@@ -264,14 +225,14 @@ __osm_sa_pkey_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
 	osm_pkey_search_ctxt_t *const p_ctxt =
 	    (osm_pkey_search_ctxt_t *) context;
 
-	__osm_sa_pkey_by_comp_mask(p_ctxt->p_rcv, p_port, p_ctxt);
+	__osm_sa_pkey_by_comp_mask(p_ctxt->sa, p_port, p_ctxt);
 }
 
 /**********************************************************************
  **********************************************************************/
 void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
 {
-	osm_pkey_rec_rcv_t *p_rcv = ctx;
+	osm_sa_t *sa = ctx;
 	osm_madw_t *p_madw = data;
 	const ib_sa_mad_t *p_rcvd_mad;
 	const ib_pkey_table_record_t *p_rcvd_rec;
@@ -293,9 +254,9 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
 	ib_net64_t comp_mask;
 	osm_physp_t *p_req_physp;
 
-	CL_ASSERT(p_rcv);
+	CL_ASSERT(sa);
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_pkey_rec_rcv_process);
+	OSM_LOG_ENTER(sa->p_log, osm_pkey_rec_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -309,11 +270,11 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
 	/* we only support SubnAdmGet and SubnAdmGetTable methods */
 	if ((p_rcvd_mad->method != IB_MAD_METHOD_GET) &&
 	    (p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE)) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_pkey_rec_rcv_process: ERR 4605: "
 			"Unsupported Method (%s)\n",
 			ib_get_sa_method_str(p_rcvd_mad->method));
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
 	}
@@ -323,25 +284,25 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
 	   to trusted requests.
 	   Check that the requester is a trusted one.
 	 */
-	if (p_rcvd_mad->sm_key != p_rcv->p_subn->opt.sm_key) {
+	if (p_rcvd_mad->sm_key != sa->p_subn->opt.sm_key) {
 		/* This is not a trusted requester! */
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_pkey_rec_rcv_process ERR 4608: "
 			"Request from non-trusted requester: "
 			"Given SM_Key:0x%016" PRIx64 "\n",
 			cl_ntoh64(p_rcvd_mad->sm_key));
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_REQ_INVALID);
 		goto Exit;
 	}
 
 	/* update the requester physical port. */
-	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-						p_rcv->p_subn,
+	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log,
+						sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
 	if (p_req_physp == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_pkey_rec_rcv_process: ERR 4604: "
 			"Cannot find requester physical port\n");
 		goto Exit;
@@ -354,11 +315,11 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
 	context.p_rcvd_rec = p_rcvd_rec;
 	context.p_list = &rec_list;
 	context.comp_mask = p_rcvd_mad->comp_mask;
-	context.p_rcv = p_rcv;
+	context.sa = sa;
 	context.block_num = p_rcvd_rec->block_num;
 	context.p_req_physp = p_req_physp;
 
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sa->p_log, OSM_LOG_DEBUG,
 		"osm_pkey_rec_rcv_process: "
 		"Got Query Lid:0x%04X(%02X), Block:0x%02X(%02X), Port:0x%02X(%02X)\n",
 		cl_ntoh16(p_rcvd_rec->lid),
@@ -366,7 +327,7 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
 		(comp_mask & IB_PKEY_COMPMASK_PORT) != 0, p_rcvd_rec->block_num,
 		(comp_mask & IB_PKEY_COMPMASK_BLOCK) != 0);
 
-	cl_plock_acquire(p_rcv->p_lock);
+	cl_plock_acquire(sa->p_lock);
 
 	/*
 	   If the user specified a LID, it obviously narrows our
@@ -374,16 +335,16 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
 	 */
 	if (comp_mask & IB_PKEY_COMPMASK_LID) {
 
-		p_tbl = &p_rcv->p_subn->port_lid_tbl;
+		p_tbl = &sa->p_subn->port_lid_tbl;
 
 		CL_ASSERT(cl_ptr_vector_get_size(p_tbl) < 0x10000);
 
 		status =
-		    osm_get_port_by_base_lid(p_rcv->p_subn, p_rcvd_rec->lid,
+		    osm_get_port_by_base_lid(sa->p_subn, p_rcvd_rec->lid,
 					     &p_port);
 		if ((status != IB_SUCCESS) || (p_port == NULL)) {
 			status = IB_NOT_FOUND;
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_pkey_rec_rcv_process: ERR 460B: "
 				"No port found with LID 0x%x\n",
 				cl_ntoh16(p_rcvd_rec->lid));
@@ -394,15 +355,15 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
 		/* if we got a unique port - no need for a port search */
 		if (p_port)
 			/* this does the loop on all the port phys ports */
-			__osm_sa_pkey_by_comp_mask(p_rcv, p_port, &context);
+			__osm_sa_pkey_by_comp_mask(sa, p_port, &context);
 		else {
-			cl_qmap_apply_func(&p_rcv->p_subn->port_guid_tbl,
+			cl_qmap_apply_func(&sa->p_subn->port_guid_tbl,
 					   __osm_sa_pkey_by_comp_mask_cb,
 					   &context);
 		}
 	}
 
-	cl_plock_release(p_rcv->p_lock);
+	cl_plock_release(sa->p_lock);
 
 	num_rec = cl_qlist_count(&rec_list);
 
@@ -412,16 +373,16 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
 	 */
 	if (p_rcvd_mad->method == IB_MAD_METHOD_GET) {
 		if (num_rec == 0) {
-			osm_sa_send_error(p_rcv->p_resp, p_madw,
+			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_NO_RECORDS);
 			goto Exit;
 		}
 		if (num_rec > 1) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_pkey_rec_rcv_process: ERR 460A: "
 				"Got more than one record for SubnAdmGet (%u)\n",
 				num_rec);
-			osm_sa_send_error(p_rcv->p_resp, p_madw,
+			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
 
 			/* need to set the mem free ... */
@@ -444,7 +405,7 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
 	    (MAD_BLOCK_SIZE -
 	     IB_SA_MAD_HDR_SIZE) / sizeof(ib_pkey_table_record_t);
 	if (trim_num_rec < num_rec) {
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sa->p_log, OSM_LOG_VERBOSE,
 			"osm_pkey_rec_rcv_process: "
 			"Number of records:%u trimmed to:%u to fit in one MAD\n",
 			num_rec, trim_num_rec);
@@ -452,11 +413,11 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
 	}
 #endif
 
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sa->p_log, OSM_LOG_DEBUG,
 		"osm_pkey_rec_rcv_process: " "Returning %u records\n", num_rec);
 
 	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0)) {
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RECORDS);
 		goto Exit;
 	}
@@ -464,14 +425,14 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
 	/*
 	 * Get a MAD to reply. Address of Mad is in the received mad_wrapper
 	 */
-	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+	p_resp_madw = osm_mad_pool_get(sa->p_mad_pool,
 				       p_madw->h_bind,
 				       num_rec *
 				       sizeof(ib_pkey_table_record_t) +
 				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
 
 	if (!p_resp_madw) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_pkey_rec_rcv_process: ERR 4606: "
 			"osm_mad_pool_get failed\n");
 
@@ -481,7 +442,7 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
 			free(p_rec_item);
 		}
 
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RESOURCES);
 		goto Exit;
 	}
@@ -534,9 +495,9 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
 	CL_ASSERT(cl_is_qlist_empty(&rec_list));
 
 	status = osm_sa_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE,
-				    p_rcv->p_subn);
+				    sa->p_subn);
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_pkey_rec_rcv_process: ERR 4607: "
 			"osm_sa_vendor_send status = %s\n",
 			ib_get_err_str(status));
@@ -544,5 +505,5 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
diff --git a/opensm/opensm/osm_sa_portinfo_record.c b/opensm/opensm/osm_sa_portinfo_record.c
index ed3684c..16dd852 100644
--- a/opensm/opensm/osm_sa_portinfo_record.c
+++ b/opensm/opensm/osm_sa_portinfo_record.c
@@ -55,11 +55,10 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
-#include <opensm/osm_sa_portinfo_record.h>
+#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_port.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_switch.h>
-#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_sa.h>
@@ -73,72 +72,34 @@ typedef struct _osm_pir_search_ctxt {
 	const ib_portinfo_record_t *p_rcvd_rec;
 	ib_net64_t comp_mask;
 	cl_qlist_t *p_list;
-	osm_pir_rcv_t *p_rcv;
+	osm_sa_t *sa;
 	const osm_physp_t *p_req_physp;
 	boolean_t is_enhanced_comp_mask;
 } osm_pir_search_ctxt_t;
 
 /**********************************************************************
  **********************************************************************/
-void osm_pir_rcv_construct(IN osm_pir_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_pir_rcv_destroy(IN osm_pir_rcv_t * const p_rcv)
-{
-	OSM_LOG_ENTER(p_rcv->p_log, osm_pir_rcv_destroy);
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_pir_rcv_init(IN osm_pir_rcv_t * const p_rcv,
-		 IN osm_sa_resp_t * const p_resp,
-		 IN osm_mad_pool_t * const p_mad_pool,
-		 IN osm_subn_t * const p_subn,
-		 IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
-{
-	OSM_LOG_ENTER(p_log, osm_pir_rcv_init);
-
-	osm_pir_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_resp = p_resp;
-	p_rcv->p_mad_pool = p_mad_pool;
-
-	OSM_LOG_EXIT(p_log);
-	return IB_SUCCESS;
-}
-
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
-__osm_pir_rcv_new_pir(IN osm_pir_rcv_t * const p_rcv,
+__osm_pir_rcv_new_pir(IN osm_sa_t * sa,
 		      IN const osm_physp_t * const p_physp,
 		      IN cl_qlist_t * const p_list, IN ib_net16_t const lid)
 {
 	osm_pir_item_t *p_rec_item;
 	ib_api_status_t status = IB_SUCCESS;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_pir_rcv_new_pir);
+	OSM_LOG_ENTER(sa->p_log, __osm_pir_rcv_new_pir);
 
 	p_rec_item = malloc(sizeof(*p_rec_item));
 	if (p_rec_item == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_pir_rcv_new_pir: ERR 2102: "
 			"rec_item alloc failed\n");
 		status = IB_INSUFFICIENT_RESOURCES;
 		goto Exit;
 	}
 
-	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(sa->p_log, OSM_LOG_DEBUG))
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_pir_rcv_new_pir: "
 			"New PortInfoRecord: port 0x%016" PRIx64
 			", lid 0x%X, port 0x%X\n",
@@ -154,14 +115,14 @@ __osm_pir_rcv_new_pir(IN osm_pir_rcv_t * const p_rcv,
 	cl_qlist_insert_tail(p_list, &p_rec_item->list_item);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sa_pir_create(IN osm_pir_rcv_t * const p_rcv,
+__osm_sa_pir_create(IN osm_sa_t * sa,
 		    IN const osm_physp_t * const p_physp,
 		    IN osm_pir_search_ctxt_t * const p_ctxt)
 {
@@ -171,14 +132,14 @@ __osm_sa_pir_create(IN osm_pir_rcv_t * const p_rcv,
 	uint16_t match_lid_ho;
 	osm_physp_t *p_node_physp;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_pir_create);
+	OSM_LOG_ENTER(sa->p_log, __osm_sa_pir_create);
 
 	if (p_physp->p_node->sw) {
 		p_node_physp = osm_node_get_physp_ptr(p_physp->p_node, 0);
 		base_lid_ho = cl_ntoh16(osm_physp_get_base_lid(p_node_physp));
 		lmc =
 		    osm_switch_sp0_is_lmc_capable(p_physp->p_node->sw,
-						  p_rcv->
+						  sa->
 						  p_subn) ?
 		    osm_physp_get_lmc(p_node_physp) : 0;
 	} else {
@@ -193,8 +154,8 @@ __osm_sa_pir_create(IN osm_pir_rcv_t * const p_rcv,
 		/*
 		   We validate that the lid belongs to this node.
 		 */
-		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(sa->p_log, OSM_LOG_DEBUG))
+			osm_log(sa->p_log, OSM_LOG_DEBUG,
 				"__osm_sa_pir_create: "
 				"Comparing LID: 0x%X <= 0x%X <= 0x%X\n",
 				base_lid_ho, match_lid_ho, max_lid_ho);
@@ -203,17 +164,17 @@ __osm_sa_pir_create(IN osm_pir_rcv_t * const p_rcv,
 			goto Exit;
 	}
 
-	__osm_pir_rcv_new_pir(p_rcv, p_physp, p_ctxt->p_list,
+	__osm_pir_rcv_new_pir(sa, p_physp, p_ctxt->p_list,
 			      cl_hton16(base_lid_ho));
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sa_pir_check_physp(IN osm_pir_rcv_t * const p_rcv,
+__osm_sa_pir_check_physp(IN osm_sa_t * sa,
 			 IN const osm_physp_t * const p_physp,
 			 osm_pir_search_ctxt_t * const p_ctxt)
 {
@@ -222,14 +183,14 @@ __osm_sa_pir_check_physp(IN osm_pir_rcv_t * const p_rcv,
 	const ib_port_info_t *p_comp_pi;
 	const ib_port_info_t *p_pi;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_pir_check_physp);
+	OSM_LOG_ENTER(sa->p_log, __osm_sa_pir_check_physp);
 
 	p_rcvd_rec = p_ctxt->p_rcvd_rec;
 	comp_mask = p_ctxt->comp_mask;
 	p_comp_pi = &p_rcvd_rec->port_info;
 	p_pi = &p_physp->port_info;
 
-	osm_dump_port_info(p_rcv->p_log,
+	osm_dump_port_info(sa->p_log,
 			   osm_node_get_node_guid(p_physp->p_node),
 			   p_physp->port_guid,
 			   p_physp->port_num,
@@ -436,16 +397,16 @@ __osm_sa_pir_check_physp(IN osm_pir_rcv_t * const p_rcv,
 			goto Exit;
 	}
 
-	__osm_sa_pir_create(p_rcv, p_physp, p_ctxt);
+	__osm_sa_pir_create(sa, p_physp, p_ctxt);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sa_pir_by_comp_mask(IN osm_pir_rcv_t * const p_rcv,
+__osm_sa_pir_by_comp_mask(IN osm_sa_t * sa,
 			  IN const osm_node_t * const p_node,
 			  osm_pir_search_ctxt_t * const p_ctxt)
 {
@@ -456,7 +417,7 @@ __osm_sa_pir_by_comp_mask(IN osm_pir_rcv_t * const p_rcv,
 	uint8_t num_ports;
 	const osm_physp_t *p_req_physp;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_pir_by_comp_mask);
+	OSM_LOG_ENTER(sa->p_log, __osm_sa_pir_by_comp_mask);
 
 	p_rcvd_rec = p_ctxt->p_rcvd_rec;
 	comp_mask = p_ctxt->comp_mask;
@@ -472,9 +433,9 @@ __osm_sa_pir_by_comp_mask(IN osm_pir_rcv_t * const p_rcv,
 			/* Check that the p_physp is valid, and that the p_physp and the
 			   p_req_physp share a pkey. */
 			if (osm_physp_is_valid(p_physp) &&
-			    osm_physp_share_pkey(p_rcv->p_log, p_req_physp,
+			    osm_physp_share_pkey(sa->p_log, p_req_physp,
 						 p_physp))
-				__osm_sa_pir_check_physp(p_rcv, p_physp,
+				__osm_sa_pir_check_physp(sa, p_physp,
 							 p_ctxt);
 		}
 	} else {
@@ -487,14 +448,14 @@ __osm_sa_pir_by_comp_mask(IN osm_pir_rcv_t * const p_rcv,
 			/* if the requester and the p_physp don't share a pkey -
 			   continue */
 			if (!osm_physp_share_pkey
-			    (p_rcv->p_log, p_req_physp, p_physp))
+			    (sa->p_log, p_req_physp, p_physp))
 				continue;
 
-			__osm_sa_pir_check_physp(p_rcv, p_physp, p_ctxt);
+			__osm_sa_pir_check_physp(sa, p_physp, p_ctxt);
 		}
 	}
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
@@ -506,14 +467,14 @@ __osm_sa_pir_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
 	const osm_node_t *const p_node = (osm_node_t *) p_map_item;
 	osm_pir_search_ctxt_t *const p_ctxt = (osm_pir_search_ctxt_t *) context;
 
-	__osm_sa_pir_by_comp_mask(p_ctxt->p_rcv, p_node, p_ctxt);
+	__osm_sa_pir_by_comp_mask(p_ctxt->sa, p_node, p_ctxt);
 }
 
 /**********************************************************************
  **********************************************************************/
 void osm_pir_rcv_process(IN void *ctx, IN void *data)
 {
-	osm_pir_rcv_t *p_rcv = ctx;
+	osm_sa_t *sa = ctx;
 	osm_madw_t *p_madw = data;
 	const ib_sa_mad_t *p_rcvd_mad;
 	const ib_portinfo_record_t *p_rcvd_rec;
@@ -536,9 +497,9 @@ void osm_pir_rcv_process(IN void *ctx, IN void *data)
 	osm_physp_t *p_req_physp;
 	boolean_t trusted_req = TRUE;
 
-	CL_ASSERT(p_rcv);
+	CL_ASSERT(sa);
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_pir_rcv_process);
+	OSM_LOG_ENTER(sa->p_log, osm_pir_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -552,32 +513,32 @@ void osm_pir_rcv_process(IN void *ctx, IN void *data)
 	/* we only support SubnAdmGet and SubnAdmGetTable methods */
 	if ((p_rcvd_mad->method != IB_MAD_METHOD_GET) &&
 	    (p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE)) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_pir_rcv_process: ERR 2105: "
 			"Unsupported Method (%s)\n",
 			ib_get_sa_method_str(p_rcvd_mad->method));
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
 	}
 
 	/* update the requester physical port. */
-	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-						p_rcv->p_subn,
+	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log,
+						sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
 	if (p_req_physp == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_pir_rcv_process: ERR 2104: "
 			"Cannot find requester physical port\n");
 		goto Exit;
 	}
 
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
-		osm_dump_portinfo_record(p_rcv->p_log, p_rcvd_rec,
+	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
+		osm_dump_portinfo_record(sa->p_log, p_rcvd_rec,
 					 OSM_LOG_DEBUG);
 
-	p_tbl = &p_rcv->p_subn->port_lid_tbl;
+	p_tbl = &sa->p_subn->port_lid_tbl;
 	p_pi = &p_rcvd_rec->port_info;
 
 	cl_qlist_init(&rec_list);
@@ -585,12 +546,12 @@ void osm_pir_rcv_process(IN void *ctx, IN void *data)
 	context.p_rcvd_rec = p_rcvd_rec;
 	context.p_list = &rec_list;
 	context.comp_mask = p_rcvd_mad->comp_mask;
-	context.p_rcv = p_rcv;
+	context.sa = sa;
 	context.p_req_physp = p_req_physp;
 	context.is_enhanced_comp_mask =
 	    cl_ntoh32(p_rcvd_mad->attr_mod) & (1 << 31);
 
-	cl_plock_acquire(p_rcv->p_lock);
+	cl_plock_acquire(sa->p_lock);
 
 	CL_ASSERT(cl_ptr_vector_get_size(p_tbl) < 0x10000);
 
@@ -600,11 +561,11 @@ void osm_pir_rcv_process(IN void *ctx, IN void *data)
 	 */
 	if (comp_mask & IB_PIR_COMPMASK_LID) {
 		status =
-		    osm_get_port_by_base_lid(p_rcv->p_subn, p_rcvd_rec->lid,
+		    osm_get_port_by_base_lid(sa->p_subn, p_rcvd_rec->lid,
 					     &p_port);
 		if ((status != IB_SUCCESS) || (p_port == NULL)) {
 			status = IB_NOT_FOUND;
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_pir_rcv_process: ERR 2109: "
 				"No port found with LID 0x%x\n",
 				cl_ntoh16(p_rcvd_rec->lid));
@@ -616,7 +577,7 @@ void osm_pir_rcv_process(IN void *ctx, IN void *data)
 						   cl_ntoh16(p_pi->base_lid));
 		else {
 			status = IB_NOT_FOUND;
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_pir_rcv_process: ERR 2103: "
 				"Given LID (0x%X) is out of range:0x%X\n",
 				cl_ntoh16(p_pi->base_lid),
@@ -626,15 +587,15 @@ void osm_pir_rcv_process(IN void *ctx, IN void *data)
 
 	if (status == IB_SUCCESS) {
 		if (p_port)
-			__osm_sa_pir_by_comp_mask(p_rcv, p_port->p_node,
+			__osm_sa_pir_by_comp_mask(sa, p_port->p_node,
 						  &context);
 		else
-			cl_qmap_apply_func(&p_rcv->p_subn->node_guid_tbl,
+			cl_qmap_apply_func(&sa->p_subn->node_guid_tbl,
 					   __osm_sa_pir_by_comp_mask_cb,
 					   &context);
 	}
 
-	cl_plock_release(p_rcv->p_lock);
+	cl_plock_release(sa->p_lock);
 
 	num_rec = cl_qlist_count(&rec_list);
 
@@ -644,16 +605,16 @@ void osm_pir_rcv_process(IN void *ctx, IN void *data)
 	 */
 	if (p_rcvd_mad->method == IB_MAD_METHOD_GET) {
 		if (num_rec == 0) {
-			osm_sa_send_error(p_rcv->p_resp, p_madw,
+			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_NO_RECORDS);
 			goto Exit;
 		}
 		if (num_rec > 1) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_pir_rcv_process: ERR 2108: "
 				"Got more than one record for SubnAdmGet (%u)\n",
 				num_rec);
-			osm_sa_send_error(p_rcv->p_resp, p_madw,
+			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
 
 			/* need to set the mem free ... */
@@ -676,7 +637,7 @@ void osm_pir_rcv_process(IN void *ctx, IN void *data)
 	    (MAD_BLOCK_SIZE -
 	     IB_SA_MAD_HDR_SIZE) / sizeof(ib_portinfo_record_t);
 	if (trim_num_rec < num_rec) {
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sa->p_log, OSM_LOG_VERBOSE,
 			"osm_pir_rcv_process: "
 			"Number of records:%u trimmed to:%u to fit in one MAD\n",
 			num_rec, trim_num_rec);
@@ -684,11 +645,11 @@ void osm_pir_rcv_process(IN void *ctx, IN void *data)
 	}
 #endif
 
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sa->p_log, OSM_LOG_DEBUG,
 		"osm_pir_rcv_process: " "Returning %u records\n", num_rec);
 
 	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0)) {
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RECORDS);
 		goto Exit;
 	}
@@ -696,13 +657,13 @@ void osm_pir_rcv_process(IN void *ctx, IN void *data)
 	/*
 	 * Get a MAD to reply. Address of Mad is in the received mad_wrapper
 	 */
-	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+	p_resp_madw = osm_mad_pool_get(sa->p_mad_pool,
 				       p_madw->h_bind,
 				       num_rec * sizeof(ib_portinfo_record_t) +
 				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
 
 	if (!p_resp_madw) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_pir_rcv_process: ERR 2106: "
 			"osm_mad_pool_get failed\n");
 
@@ -712,7 +673,7 @@ void osm_pir_rcv_process(IN void *ctx, IN void *data)
 			free(p_rec_item);
 		}
 
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RESOURCES);
 
 		goto Exit;
@@ -777,9 +738,9 @@ void osm_pir_rcv_process(IN void *ctx, IN void *data)
 	CL_ASSERT(cl_is_qlist_empty(&rec_list));
 
 	status = osm_sa_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE,
-				    p_rcv->p_subn);
+				    sa->p_subn);
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_pir_rcv_process: ERR 2107: "
 			"osm_sa_vendor_send status = %s\n",
 			ib_get_err_str(status));
@@ -787,5 +748,5 @@ void osm_pir_rcv_process(IN void *ctx, IN void *data)
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
diff --git a/opensm/opensm/osm_sa_response.c b/opensm/opensm/osm_sa_response.c
index e47ac1d..d63fa70 100644
--- a/opensm/opensm/osm_sa_response.c
+++ b/opensm/opensm/osm_sa_response.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2007 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
@@ -52,51 +52,15 @@
 #include <string.h>
 #include <iba/ib_types.h>
 #include <complib/cl_debug.h>
-#include <opensm/osm_sa_response.h>
-#include <opensm/osm_helper.h>
 #include <vendor/osm_vendor_api.h>
+#include <opensm/osm_helper.h>
 #include <opensm/osm_opensm.h>
 #include <opensm/osm_sa.h>
 
 /**********************************************************************
  **********************************************************************/
-void osm_sa_resp_construct(IN osm_sa_resp_t * const p_resp)
-{
-	memset(p_resp, 0, sizeof(*p_resp));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_sa_resp_destroy(IN osm_sa_resp_t * const p_resp)
-{
-	CL_ASSERT(p_resp);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_sa_resp_init(IN osm_sa_resp_t * const p_resp,
-		 IN osm_mad_pool_t * const p_pool,
-		 IN osm_subn_t * const p_subn, IN osm_log_t * const p_log)
-{
-	ib_api_status_t status = IB_SUCCESS;
-
-	OSM_LOG_ENTER(p_log, osm_sa_resp_init);
-
-	osm_sa_resp_construct(p_resp);
-
-	p_resp->p_subn = p_subn;
-	p_resp->p_log = p_log;
-	p_resp->p_pool = p_pool;
-
-	OSM_LOG_EXIT(p_log);
-	return (status);
-}
-
-/**********************************************************************
- **********************************************************************/
 void
-osm_sa_send_error(IN osm_sa_resp_t * const p_resp,
+osm_sa_send_error(IN osm_sa_t * sa,
 		  IN const osm_madw_t * const p_madw,
 		  IN const ib_net16_t sa_status)
 {
@@ -105,22 +69,22 @@ osm_sa_send_error(IN osm_sa_resp_t * const p_resp,
 	ib_sa_mad_t *p_sa_mad;
 	ib_api_status_t status;
 
-	OSM_LOG_ENTER(p_resp->p_log, osm_sa_send_error);
+	OSM_LOG_ENTER(sa->p_log, osm_sa_send_error);
 
 	/* avoid races - if we are exiting - exit */
 	if (osm_exit_flag) {
-		osm_log(p_resp->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"osm_sa_send_error: "
 			"Ignoring requested send after exit\n");
 		goto Exit;
 	}
 
-	p_resp_madw = osm_mad_pool_get(p_resp->p_pool,
+	p_resp_madw = osm_mad_pool_get(sa->p_mad_pool,
 				       p_madw->h_bind, MAD_BLOCK_SIZE,
 				       &p_madw->mad_addr);
 
 	if (p_resp_madw == NULL) {
-		osm_log(p_resp->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_sa_send_error: ERR 2301: "
 			"Unable to acquire response MAD\n");
 		goto Exit;
@@ -150,20 +114,20 @@ osm_sa_send_error(IN osm_sa_resp_t * const p_resp,
 	if (p_resp_sa_mad->attr_id == IB_MAD_ATTR_MULTIPATH_RECORD)
 		p_resp_sa_mad->attr_id = IB_MAD_ATTR_PATH_RECORD;
 
-	if (osm_log_is_active(p_resp->p_log, OSM_LOG_FRAMES))
-		osm_dump_sa_mad(p_resp->p_log, p_resp_sa_mad, OSM_LOG_FRAMES);
+	if (osm_log_is_active(sa->p_log, OSM_LOG_FRAMES))
+		osm_dump_sa_mad(sa->p_log, p_resp_sa_mad, OSM_LOG_FRAMES);
 
 	status = osm_sa_vendor_send(osm_madw_get_bind_handle(p_resp_madw),
-				    p_resp_madw, FALSE, p_resp->p_subn);
+				    p_resp_madw, FALSE, sa->p_subn);
 
 	if (status != IB_SUCCESS) {
-		osm_log(p_resp->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_sa_send_error: ERR 2302: "
 			"Error sending MAD (%s)\n", ib_get_err_str(status));
-		/*  osm_mad_pool_put( p_resp->p_pool, p_resp_madw ); */
+		/*  osm_mad_pool_put( sa->p_mad_pool, p_resp_madw ); */
 		goto Exit;
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_resp->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
diff --git a/opensm/opensm/osm_sa_service_record.c b/opensm/opensm/osm_sa_service_record.c
index fb0193e..19de389 100644
--- a/opensm/opensm/osm_sa_service_record.c
+++ b/opensm/opensm/osm_sa_service_record.c
@@ -55,12 +55,10 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
-#include <opensm/osm_sa_service_record.h>
+#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_port.h>
 #include <opensm/osm_node.h>
 #include <opensm/osm_switch.h>
-#include <vendor/osm_vendor.h>
-#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_sa.h>
 #include <opensm/osm_service.h>
@@ -75,7 +73,7 @@ typedef struct osm_sr_match_item {
 	cl_qlist_t sr_list;
 	ib_service_record_t *p_service_rec;
 	ib_net64_t comp_mask;
-	osm_sr_rcv_t *p_rcv;
+	osm_sa_t *sa;
 } osm_sr_match_item_t;
 
 typedef struct _osm_sr_search_ctxt {
@@ -85,53 +83,8 @@ typedef struct _osm_sr_search_ctxt {
 
 /**********************************************************************
  **********************************************************************/
-void osm_sr_rcv_construct(IN osm_sr_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-	cl_timer_construct(&p_rcv->sr_timer);
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_sr_rcv_destroy(IN osm_sr_rcv_t * const p_rcv)
-{
-	OSM_LOG_ENTER(p_rcv->p_log, osm_sr_rcv_destroy);
-	cl_timer_trim(&p_rcv->sr_timer, 1);
-	cl_timer_destroy(&p_rcv->sr_timer);
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_sr_rcv_init(IN osm_sr_rcv_t * const p_rcv,
-		IN osm_sa_resp_t * const p_resp,
-		IN osm_mad_pool_t * const p_mad_pool,
-		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;
-
-	OSM_LOG_ENTER(p_log, osm_sr_rcv_init);
-
-	osm_sr_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_resp = p_resp;
-	p_rcv->p_mad_pool = p_mad_pool;
-
-	status = cl_timer_init(&p_rcv->sr_timer, osm_sr_rcv_lease_cb, p_rcv);
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-	return (status);
-}
-
-/**********************************************************************
- **********************************************************************/
 static boolean_t
-__match_service_pkey_with_ports_pkey(IN osm_sr_rcv_t * const p_rcv,
+__match_service_pkey_with_ports_pkey(IN osm_sa_t * sa,
 				     IN const osm_madw_t * const p_madw,
 				     ib_service_record_t * const p_service_rec,
 				     ib_net64_t const comp_mask)
@@ -142,12 +95,12 @@ __match_service_pkey_with_ports_pkey(IN osm_sr_rcv_t * const p_rcv,
 	osm_port_t *service_port;
 
 	/* update the requester physical port. */
-	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-						p_rcv->p_subn,
+	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log,
+						sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
 	if (p_req_physp == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__match_service_pkey_with_ports_pkey: ERR 2404: "
 			"Cannot find requester physical port\n");
 		valid = FALSE;
@@ -159,7 +112,7 @@ __match_service_pkey_with_ports_pkey(IN osm_sr_rcv_t * const p_rcv,
 		   ServiceGid port (if such exists) */
 		/* Make sure it matches the p_req_physp */
 		if (!osm_physp_has_pkey
-		    (p_rcv->p_log, p_service_rec->service_pkey, p_req_physp)) {
+		    (sa->p_log, p_service_rec->service_pkey, p_req_physp)) {
 			valid = FALSE;
 			goto Exit;
 		}
@@ -169,9 +122,9 @@ __match_service_pkey_with_ports_pkey(IN osm_sr_rcv_t * const p_rcv,
 			service_guid =
 			    p_service_rec->service_gid.unicast.interface_id;
 			service_port =
-			    osm_get_port_by_guid(p_rcv->p_subn, service_guid);
+			    osm_get_port_by_guid(sa->p_subn, service_guid);
 			if (!service_port) {
-				osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				osm_log(sa->p_log, OSM_LOG_ERROR,
 					"__match_service_pkey_with_ports_pkey: ERR 2405: "
 					"No port object for port 0x%016" PRIx64
 					"\n", cl_ntoh64(service_guid));
@@ -179,7 +132,7 @@ __match_service_pkey_with_ports_pkey(IN osm_sr_rcv_t * const p_rcv,
 				goto Exit;
 			}
 			/* check on the table of the default physical port of the service port */
-			if (!osm_physp_has_pkey(p_rcv->p_log,
+			if (!osm_physp_has_pkey(sa->p_log,
 						p_service_rec->service_pkey,
 						service_port->p_physp)) {
 				valid = FALSE;
@@ -195,12 +148,12 @@ __match_service_pkey_with_ports_pkey(IN osm_sr_rcv_t * const p_rcv,
 /**********************************************************************
  **********************************************************************/
 static boolean_t
-__match_name_to_key_association(IN osm_sr_rcv_t * const p_rcv,
+__match_name_to_key_association(IN osm_sa_t * sa,
 				ib_service_record_t * p_service_rec,
 				ib_net64_t comp_mask)
 {
 	UNUSED_PARAM(p_service_rec);
-	UNUSED_PARAM(p_rcv);
+	UNUSED_PARAM(sa);
 
 	if ((comp_mask & (IB_SR_COMPMASK_SKEY | IB_SR_COMPMASK_SNAME)) ==
 	    (IB_SR_COMPMASK_SKEY | IB_SR_COMPMASK_SNAME)) {
@@ -216,36 +169,36 @@ __match_name_to_key_association(IN osm_sr_rcv_t * const p_rcv,
 /**********************************************************************
  **********************************************************************/
 static boolean_t
-__validate_sr(IN osm_sr_rcv_t * const p_rcv, IN const osm_madw_t * const p_madw)
+__validate_sr(IN osm_sa_t * sa, IN const osm_madw_t * const p_madw)
 {
 	boolean_t valid = TRUE;
 	ib_sa_mad_t *p_sa_mad;
 	ib_service_record_t *p_recvd_service_rec;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __validate_sr);
+	OSM_LOG_ENTER(sa->p_log, __validate_sr);
 
 	p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw);
 	p_recvd_service_rec =
 	    (ib_service_record_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
 
-	valid = __match_service_pkey_with_ports_pkey(p_rcv,
+	valid = __match_service_pkey_with_ports_pkey(sa,
 						     p_madw,
 						     p_recvd_service_rec,
 						     p_sa_mad->comp_mask);
 
 	if (!valid) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__validate_sr: " "No Match for Service Pkey\n");
 		valid = FALSE;
 		goto Exit;
 	}
 
-	valid = __match_name_to_key_association(p_rcv,
+	valid = __match_name_to_key_association(sa,
 						p_recvd_service_rec,
 						p_sa_mad->comp_mask);
 
 	if (!valid) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__validate_sr: "
 			"Service Record Name to key matching failed\n");
 		valid = FALSE;
@@ -253,14 +206,14 @@ __validate_sr(IN osm_sr_rcv_t * const p_rcv, IN const osm_madw_t * const p_madw)
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return valid;
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sr_rcv_respond(IN osm_sr_rcv_t * const p_rcv,
+__osm_sr_rcv_respond(IN osm_sa_t * sa,
 		     IN const osm_madw_t * const p_madw,
 		     IN cl_qlist_t * const p_list)
 {
@@ -277,7 +230,7 @@ __osm_sr_rcv_respond(IN osm_sr_rcv_t * const p_rcv,
 	const ib_sa_mad_t *p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);
 	boolean_t trusted_req = TRUE;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_sr_rcv_respond);
+	OSM_LOG_ENTER(sa->p_log, __osm_sr_rcv_respond);
 
 	num_rec = cl_qlist_count(p_list);
 
@@ -286,11 +239,11 @@ __osm_sr_rcv_respond(IN osm_sr_rcv_t * const p_rcv,
 	 * If we do a SubnAdmGet and got more than one record it is an error !
 	 */
 	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec > 1)) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_sr_rcv_respond: ERR 2406: "
 			"Got more than one record for SubnAdmGet (%u).\n",
 			num_rec);
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
 
 		/* need to set the mem free ... */
@@ -307,7 +260,7 @@ __osm_sr_rcv_respond(IN osm_sr_rcv_t * const p_rcv,
 	trim_num_rec =
 	    (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_service_record_t);
 	if (trim_num_rec < num_rec) {
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sa->p_log, OSM_LOG_VERBOSE,
 			"__osm_sr_rcv_respond: "
 			"Number of records:%u trimmed to:%u to fit in one MAD\n",
 			num_rec, trim_num_rec);
@@ -315,8 +268,8 @@ __osm_sr_rcv_respond(IN osm_sr_rcv_t * const p_rcv,
 	}
 #endif
 
-	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(sa->p_log, OSM_LOG_DEBUG)) {
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_sr_rcv_respond: "
 			"Generating response with %u records\n", num_rec);
 	}
@@ -324,12 +277,12 @@ __osm_sr_rcv_respond(IN osm_sr_rcv_t * const p_rcv,
 	/*
 	   Get a MAD to reply. Address of Mad is in the received mad_wrapper
 	 */
-	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+	p_resp_madw = osm_mad_pool_get(sa->p_mad_pool,
 				       p_madw->h_bind,
 				       num_rec * sizeof(ib_service_record_t) +
 				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
 	if (!p_resp_madw) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_sr_rcv_respond: ERR 2402: "
 			"Unable to allocate MAD\n");
 		/* Release the quick pool items */
@@ -417,18 +370,18 @@ __osm_sr_rcv_respond(IN osm_sr_rcv_t * const p_rcv,
 	}
 
 	status = osm_sa_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE,
-				    p_rcv->p_subn);
+				    sa->p_subn);
 
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_sr_rcv_respond: ERR 2407: "
 			"Unable to send MAD (%s)\n", ib_get_err_str(status));
-		/*  osm_mad_pool_put( p_rcv->p_mad_pool, p_resp_madw ); */
+		/*  osm_mad_pool_put( sa->p_mad_pool, p_resp_madw ); */
 		goto Exit;
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
@@ -635,10 +588,10 @@ __get_matching_sr(IN cl_list_item_t * const p_list_item, IN void *context)
 	   If not - then it cannot receive this ServiceRecord. */
 	/* The check is relevant only if the service_pkey is valid */
 	if (!ib_pkey_is_invalid(p_svcr->service_record.service_pkey)) {
-		if (!osm_physp_has_pkey(p_sr_item->p_rcv->p_log,
+		if (!osm_physp_has_pkey(p_sr_item->sa->p_log,
 					p_svcr->service_record.service_pkey,
 					p_req_physp)) {
-			osm_log(p_sr_item->p_rcv->p_log, OSM_LOG_VERBOSE,
+			osm_log(p_sr_item->sa->p_log, OSM_LOG_VERBOSE,
 				"__get_matching_sr: "
 				"requester port doesn't have the service_pkey: 0x%X\n",
 				cl_ntoh16(p_svcr->service_record.service_pkey));
@@ -648,7 +601,7 @@ __get_matching_sr(IN cl_list_item_t * const p_list_item, IN void *context)
 
 	p_sr_pool_item = malloc(sizeof(*p_sr_pool_item));
 	if (p_sr_pool_item == NULL) {
-		osm_log(p_sr_item->p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(p_sr_item->sa->p_log, OSM_LOG_ERROR,
 			"__get_matching_sr: ERR 2408: "
 			"Unable to acquire Service Record from pool\n");
 		goto Exit;
@@ -665,7 +618,7 @@ __get_matching_sr(IN cl_list_item_t * const p_list_item, IN void *context)
 /**********************************************************************
  **********************************************************************/
 static void
-osm_sr_rcv_process_get_method(IN osm_sr_rcv_t * const p_rcv,
+osm_sr_rcv_process_get_method(IN osm_sa_t * sa,
 			      IN const osm_madw_t * const p_madw)
 {
 	ib_sa_mad_t *p_sa_mad;
@@ -674,17 +627,17 @@ osm_sr_rcv_process_get_method(IN osm_sr_rcv_t * const p_rcv,
 	osm_sr_search_ctxt_t context;
 	osm_physp_t *p_req_physp;
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_sr_rcv_process_get_method);
+	OSM_LOG_ENTER(sa->p_log, osm_sr_rcv_process_get_method);
 
 	CL_ASSERT(p_madw);
 
 	/* update the requester physical port. */
-	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-						p_rcv->p_subn,
+	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log,
+						sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
 	if (p_req_physp == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_sr_rcv_process_get_method: ERR 2409: "
 			"Cannot find requester physical port\n");
 		goto Exit;
@@ -694,49 +647,49 @@ osm_sr_rcv_process_get_method(IN osm_sr_rcv_t * const p_rcv,
 	p_recvd_service_rec =
 	    (ib_service_record_t *) ib_sa_mad_get_payload_ptr(p_sa_mad);
 
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
-		osm_dump_service_record(p_rcv->p_log,
+	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG)) {
+		osm_dump_service_record(sa->p_log,
 					p_recvd_service_rec, OSM_LOG_DEBUG);
 	}
 
 	cl_qlist_init(&sr_match_item.sr_list);
 	sr_match_item.p_service_rec = p_recvd_service_rec;
 	sr_match_item.comp_mask = p_sa_mad->comp_mask;
-	sr_match_item.p_rcv = p_rcv;
+	sr_match_item.sa = sa;
 
 	context.p_sr_item = &sr_match_item;
 	context.p_req_physp = p_req_physp;
 
 	/* Grab the lock */
-	cl_plock_excl_acquire(p_rcv->p_lock);
+	cl_plock_excl_acquire(sa->p_lock);
 
-	cl_qlist_apply_func(&p_rcv->p_subn->sa_sr_list,
+	cl_qlist_apply_func(&sa->p_subn->sa_sr_list,
 			    __get_matching_sr, &context);
 
-	cl_plock_release(p_rcv->p_lock);
+	cl_plock_release(sa->p_lock);
 
 	if ((p_sa_mad->method == IB_MAD_METHOD_GET) &&
 	    (cl_qlist_count(&sr_match_item.sr_list) == 0)) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"osm_sr_rcv_process_get_method: "
 			"No records matched the Service Record query\n");
 
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RECORDS);
 		goto Exit;
 	}
 
-	__osm_sr_rcv_respond(p_rcv, p_madw, &sr_match_item.sr_list);
+	__osm_sr_rcv_respond(sa, p_madw, &sr_match_item.sr_list);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return;
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-osm_sr_rcv_process_set_method(IN osm_sr_rcv_t * const p_rcv,
+osm_sr_rcv_process_set_method(IN osm_sa_t * sa,
 			      IN const osm_madw_t * const p_madw)
 {
 	ib_sa_mad_t *p_sa_mad;
@@ -747,7 +700,7 @@ osm_sr_rcv_process_set_method(IN osm_sr_rcv_t * const p_rcv,
 	osm_sr_item_t *p_sr_item;
 	cl_qlist_t sr_list;
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_sr_rcv_process_set_method);
+	OSM_LOG_ENTER(sa->p_log, osm_sr_rcv_process_set_method);
 
 	CL_ASSERT(p_madw);
 
@@ -757,78 +710,78 @@ osm_sr_rcv_process_set_method(IN osm_sr_rcv_t * const p_rcv,
 
 	comp_mask = p_sa_mad->comp_mask;
 
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
-		osm_dump_service_record(p_rcv->p_log,
+	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG)) {
+		osm_dump_service_record(sa->p_log,
 					p_recvd_service_rec, OSM_LOG_DEBUG);
 	}
 
 	if ((comp_mask & (IB_SR_COMPMASK_SID | IB_SR_COMPMASK_SGID)) !=
 	    (IB_SR_COMPMASK_SID | IB_SR_COMPMASK_SGID)) {
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sa->p_log, OSM_LOG_VERBOSE,
 			"osm_sr_rcv_process_set_method: "
 			"Component Mask RID check failed for METHOD_SET\n");
-		osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+		osm_sa_send_error(sa, p_madw, sa_status);
 		goto Exit;
 	}
 
 	/* if we were not provided with a service lease make it
 	   infinite */
 	if ((comp_mask & IB_SR_COMPMASK_SLEASE) != IB_SR_COMPMASK_SLEASE) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"osm_sr_rcv_process_set_method: "
 			"ServiceLease Component Mask not set - using infinite lease\n");
 		p_recvd_service_rec->service_lease = 0xFFFFFFFF;
 	}
 
 	/* Grab the lock */
-	cl_plock_excl_acquire(p_rcv->p_lock);
+	cl_plock_excl_acquire(sa->p_lock);
 
 	/* If Record exists with matching RID */
-	p_svcr = osm_svcr_get_by_rid(p_rcv->p_subn,
-				     p_rcv->p_log, p_recvd_service_rec);
+	p_svcr = osm_svcr_get_by_rid(sa->p_subn,
+				     sa->p_log, p_recvd_service_rec);
 
 	if (p_svcr == NULL) {
 		/* Create the instance of the osm_svcr_t object */
 		p_svcr = osm_svcr_new(p_recvd_service_rec);
 		if (p_svcr == NULL) {
-			cl_plock_release(p_rcv->p_lock);
+			cl_plock_release(sa->p_lock);
 
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_sr_rcv_process_set_method: ERR 2411: "
 				"osm_svcr_get_by_rid failed\n");
 
-			osm_sa_send_error(p_rcv->p_resp, p_madw,
+			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_NO_RESOURCES);
 			goto Exit;
 		}
 
 		/* Add this new osm_svcr_t object to subnet object */
-		osm_svcr_insert_to_db(p_rcv->p_subn, p_rcv->p_log, p_svcr);
+		osm_svcr_insert_to_db(sa->p_subn, sa->p_log, p_svcr);
 
 	} else {
 		/* Update the old instance of the osm_svcr_t object */
 		osm_svcr_init(p_svcr, p_recvd_service_rec);
 	}
 
-	cl_plock_release(p_rcv->p_lock);
+	cl_plock_release(sa->p_lock);
 
 	if (p_recvd_service_rec->service_lease != 0xFFFFFFFF) {
 #if 0
-		cl_timer_trim(&p_rcv->sr_timer,
+		cl_timer_trim(&sa->sr_timer,
 			      p_recvd_service_rec->service_lease * 1000);
 #endif
 		/*  This was a bug since no check was made to see if too long */
 		/*  just make sure the timer works - get a call back within a second */
-		cl_timer_trim(&p_rcv->sr_timer, 1000);
+		cl_timer_trim(&sa->sr_timer, 1000);
 		p_svcr->modified_time = cl_get_time_stamp_sec();
 	}
 
 	p_sr_item = malloc(sizeof(*p_sr_item));
 	if (p_sr_item == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_sr_rcv_process_set_method: ERR 2412: "
 			"Unable to acquire Service record\n");
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RESOURCES);
 		goto Exit;
 	}
@@ -843,17 +796,17 @@ osm_sr_rcv_process_set_method(IN osm_sr_rcv_t * const p_rcv,
 
 	cl_qlist_insert_tail(&sr_list, &p_sr_item->list_item);
 
-	__osm_sr_rcv_respond(p_rcv, p_madw, &sr_list);
+	__osm_sr_rcv_respond(sa, p_madw, &sr_list);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return;
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-osm_sr_rcv_process_delete_method(IN osm_sr_rcv_t * const p_rcv,
+osm_sr_rcv_process_delete_method(IN osm_sa_t * sa,
 				 IN const osm_madw_t * const p_madw)
 {
 	ib_sa_mad_t *p_sa_mad;
@@ -863,7 +816,7 @@ osm_sr_rcv_process_delete_method(IN osm_sr_rcv_t * const p_rcv,
 	osm_sr_item_t *p_sr_item;
 	cl_qlist_t sr_list;
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_sr_rcv_process_delete_method);
+	OSM_LOG_ENTER(sa->p_log, osm_sr_rcv_process_delete_method);
 
 	CL_ASSERT(p_madw);
 
@@ -873,38 +826,38 @@ osm_sr_rcv_process_delete_method(IN osm_sr_rcv_t * const p_rcv,
 
 	comp_mask = p_sa_mad->comp_mask;
 
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG)) {
-		osm_dump_service_record(p_rcv->p_log,
+	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG)) {
+		osm_dump_service_record(sa->p_log,
 					p_recvd_service_rec, OSM_LOG_DEBUG);
 	}
 
 	/* Grab the lock */
-	cl_plock_excl_acquire(p_rcv->p_lock);
+	cl_plock_excl_acquire(sa->p_lock);
 
 	/* If Record exists with matching RID */
-	p_svcr = osm_svcr_get_by_rid(p_rcv->p_subn,
-				     p_rcv->p_log, p_recvd_service_rec);
+	p_svcr = osm_svcr_get_by_rid(sa->p_subn,
+				     sa->p_log, p_recvd_service_rec);
 
 	if (p_svcr == NULL) {
-		cl_plock_release(p_rcv->p_lock);
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		cl_plock_release(sa->p_lock);
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"osm_sr_rcv_process_delete_method: "
 			"No records matched the RID\n");
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RECORDS);
 		goto Exit;
 	} else {
-		osm_svcr_remove_from_db(p_rcv->p_subn, p_rcv->p_log, p_svcr);
+		osm_svcr_remove_from_db(sa->p_subn, sa->p_log, p_svcr);
 	}
 
-	cl_plock_release(p_rcv->p_lock);
+	cl_plock_release(sa->p_lock);
 
 	p_sr_item = malloc(sizeof(*p_sr_item));
 	if (p_sr_item == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_sr_rcv_process_delete_method: ERR 2413: "
 			"Unable to acquire Service record\n");
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RESOURCES);
 		goto Exit;
 	}
@@ -918,10 +871,10 @@ osm_sr_rcv_process_delete_method(IN osm_sr_rcv_t * const p_rcv,
 	if (p_svcr)
 		osm_svcr_delete(p_svcr);
 
-	__osm_sr_rcv_respond(p_rcv, p_madw, &sr_list);
+	__osm_sr_rcv_respond(sa, p_madw, &sr_list);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return;
 }
 
@@ -929,13 +882,13 @@ osm_sr_rcv_process_delete_method(IN osm_sr_rcv_t * const p_rcv,
  **********************************************************************/
 void osm_sr_rcv_process(IN void *context, IN void *data)
 {
-	osm_sr_rcv_t *p_rcv = context;
+	osm_sa_t *sa = context;
 	osm_madw_t *p_madw = data;
 	ib_sa_mad_t *p_sa_mad;
 	ib_net16_t sa_status = IB_SA_MAD_STATUS_REQ_INVALID;
 	boolean_t valid;
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_sr_rcv_process);
+	OSM_LOG_ENTER(sa->p_log, osm_sr_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -945,43 +898,43 @@ void osm_sr_rcv_process(IN void *context, IN void *data)
 
 	switch (p_sa_mad->method) {
 	case IB_MAD_METHOD_SET:
-		valid = __validate_sr(p_rcv, p_madw);
+		valid = __validate_sr(sa, p_madw);
 		if (!valid) {
-			osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+			osm_log(sa->p_log, OSM_LOG_VERBOSE,
 				"osm_sr_rcv_process: "
 				"Component Mask check failed for set request\n");
-			osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+			osm_sa_send_error(sa, p_madw, sa_status);
 			goto Exit;
 		}
-		osm_sr_rcv_process_set_method(p_rcv, p_madw);
+		osm_sr_rcv_process_set_method(sa, p_madw);
 		break;
 	case IB_MAD_METHOD_DELETE:
-		valid = __validate_sr(p_rcv, p_madw);
+		valid = __validate_sr(sa, p_madw);
 		if (!valid) {
-			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			osm_log(sa->p_log, OSM_LOG_DEBUG,
 				"osm_sr_rcv_process: "
 				"Component Mask check failed for delete request\n");
-			osm_sa_send_error(p_rcv->p_resp, p_madw, sa_status);
+			osm_sa_send_error(sa, p_madw, sa_status);
 			goto Exit;
 		}
-		osm_sr_rcv_process_delete_method(p_rcv, p_madw);
+		osm_sr_rcv_process_delete_method(sa, p_madw);
 		break;
 	case IB_MAD_METHOD_GET:
 	case IB_MAD_METHOD_GETTABLE:
-		osm_sr_rcv_process_get_method(p_rcv, p_madw);
+		osm_sr_rcv_process_get_method(sa, p_madw);
 		break;
 	default:
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"osm_sr_rcv_process: "
 			"Unsupported Method (%s)\n",
 			ib_get_sa_method_str(p_sa_mad->method));
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		break;
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return;
 }
 
@@ -989,7 +942,7 @@ void osm_sr_rcv_process(IN void *context, IN void *data)
  **********************************************************************/
 void osm_sr_rcv_lease_cb(IN void *context)
 {
-	osm_sr_rcv_t *p_rcv = (osm_sr_rcv_t *) context;
+	osm_sa_t *sa = context;
 	cl_list_item_t *p_list_item;
 	cl_list_item_t *p_next_list_item;
 	osm_svcr_t *p_svcr;
@@ -997,13 +950,13 @@ void osm_sr_rcv_lease_cb(IN void *context)
 	uint32_t elapsed_time;
 	uint32_t trim_time = 20;	/*  maxiaml timer refresh is 20 seconds */
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_sr_rcv_lease_cb);
+	OSM_LOG_ENTER(sa->p_log, osm_sr_rcv_lease_cb);
 
-	cl_plock_excl_acquire(p_rcv->p_lock);
+	cl_plock_excl_acquire(sa->p_lock);
 
-	p_list_item = cl_qlist_head(&p_rcv->p_subn->sa_sr_list);
+	p_list_item = cl_qlist_head(&sa->p_subn->sa_sr_list);
 
-	while (p_list_item != cl_qlist_end(&p_rcv->p_subn->sa_sr_list)) {
+	while (p_list_item != cl_qlist_end(&sa->p_subn->sa_sr_list)) {
 		p_svcr = (osm_svcr_t *) p_list_item;
 
 		if (p_svcr->service_record.service_lease == 0xFFFFFFFF) {
@@ -1027,7 +980,7 @@ void osm_sr_rcv_lease_cb(IN void *context)
 			 */
 			p_svcr->lease_period -= elapsed_time;
 
-			osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+			osm_log(sa->p_log, OSM_LOG_DEBUG,
 				"osm_sr_rcv_lease_cb: "
 				"Remaining time for Service Name:%s is:0x%X\n",
 				p_svcr->service_record.service_name,
@@ -1049,8 +1002,8 @@ void osm_sr_rcv_lease_cb(IN void *context)
 			p_next_list_item = cl_qlist_next(p_list_item);
 
 			/* Remove the service Record */
-			osm_svcr_remove_from_db(p_rcv->p_subn,
-						p_rcv->p_log, p_svcr);
+			osm_svcr_remove_from_db(sa->p_subn,
+						sa->p_log, p_svcr);
 
 			osm_svcr_delete(p_svcr);
 
@@ -1060,11 +1013,11 @@ void osm_sr_rcv_lease_cb(IN void *context)
 	}
 
 	/* Release the Lock */
-	cl_plock_release(p_rcv->p_lock);
+	cl_plock_release(sa->p_lock);
 
 	if (trim_time != 0xFFFFFFFF) {
-		cl_timer_trim(&p_rcv->sr_timer, trim_time * 1000);	/* Convert to milli seconds */
+		cl_timer_trim(&sa->sr_timer, trim_time * 1000);	/* Convert to milli seconds */
 	}
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
diff --git a/opensm/opensm/osm_sa_slvl_record.c b/opensm/opensm/osm_sa_slvl_record.c
index fd48296..87891b0 100644
--- a/opensm/opensm/osm_sa_slvl_record.c
+++ b/opensm/opensm/osm_sa_slvl_record.c
@@ -55,10 +55,9 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
-#include <opensm/osm_sa_slvl_record.h>
+#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_port.h>
 #include <opensm/osm_node.h>
-#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_sa.h>
@@ -73,52 +72,14 @@ typedef struct _osm_slvl_search_ctxt {
 	ib_net64_t comp_mask;
 	uint8_t in_port_num;
 	cl_qlist_t *p_list;
-	osm_slvl_rec_rcv_t *p_rcv;
+	osm_sa_t *sa;
 	const osm_physp_t *p_req_physp;
 } osm_slvl_search_ctxt_t;
 
 /**********************************************************************
  **********************************************************************/
-void osm_slvl_rec_rcv_construct(IN osm_slvl_rec_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_slvl_rec_rcv_destroy(IN osm_slvl_rec_rcv_t * const p_rcv)
-{
-	OSM_LOG_ENTER(p_rcv->p_log, osm_slvl_rec_rcv_destroy);
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_slvl_rec_rcv_init(IN osm_slvl_rec_rcv_t * const p_rcv,
-		      IN osm_sa_resp_t * const p_resp,
-		      IN osm_mad_pool_t * const p_mad_pool,
-		      IN osm_subn_t * const p_subn,
-		      IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
-{
-	OSM_LOG_ENTER(p_log, osm_slvl_rec_rcv_init);
-
-	osm_slvl_rec_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_resp = p_resp;
-	p_rcv->p_mad_pool = p_mad_pool;
-
-	OSM_LOG_EXIT(p_log);
-	return IB_SUCCESS;
-}
-
-/**********************************************************************
- **********************************************************************/
 static void
-__osm_sa_slvl_create(IN osm_slvl_rec_rcv_t * const p_rcv,
+__osm_sa_slvl_create(IN osm_sa_t * sa,
 		     IN const osm_physp_t * const p_physp,
 		     IN osm_slvl_search_ctxt_t * const p_ctxt,
 		     IN uint8_t in_port_idx)
@@ -127,11 +88,11 @@ __osm_sa_slvl_create(IN osm_slvl_rec_rcv_t * const p_rcv,
 	uint16_t lid;
 	ib_api_status_t status = IB_SUCCESS;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_slvl_create);
+	OSM_LOG_ENTER(sa->p_log, __osm_sa_slvl_create);
 
 	p_rec_item = malloc(sizeof(*p_rec_item));
 	if (p_rec_item == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_sa_slvl_create: ERR 2602: "
 			"rec_item alloc failed\n");
 		status = IB_INSUFFICIENT_RESOURCES;
@@ -143,8 +104,8 @@ __osm_sa_slvl_create(IN osm_slvl_rec_rcv_t * const p_rcv,
 	else
 		lid = osm_node_get_base_lid(p_physp->p_node, 0);
 
-	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(sa->p_log, OSM_LOG_DEBUG))
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_sa_slvl_create: "
 			"New SLtoVL Map for: OUT port 0x%016" PRIx64
 			", lid 0x%X, port 0x%X to In Port:%u\n",
@@ -163,13 +124,13 @@ __osm_sa_slvl_create(IN osm_slvl_rec_rcv_t * const p_rcv,
 	cl_qlist_insert_tail(p_ctxt->p_list, &p_rec_item->list_item);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sa_slvl_by_comp_mask(IN osm_slvl_rec_rcv_t * const p_rcv,
+__osm_sa_slvl_by_comp_mask(IN osm_sa_t * sa,
 			   IN const osm_port_t * const p_port,
 			   osm_slvl_search_ctxt_t * const p_ctxt)
 {
@@ -182,7 +143,7 @@ __osm_sa_slvl_by_comp_mask(IN osm_slvl_rec_rcv_t * const p_rcv,
 	uint8_t out_port_start, out_port_end;
 	const osm_physp_t *p_req_physp;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_slvl_by_comp_mask);
+	OSM_LOG_ENTER(sa->p_log, __osm_sa_slvl_by_comp_mask);
 
 	p_rcvd_rec = p_ctxt->p_rcvd_rec;
 	comp_mask = p_ctxt->comp_mask;
@@ -194,15 +155,15 @@ __osm_sa_slvl_by_comp_mask(IN osm_slvl_rec_rcv_t * const p_rcv,
 	p_req_physp = p_ctxt->p_req_physp;
 
 	if (p_port->p_node->node_info.node_type != IB_NODE_TYPE_SWITCH) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_sa_slvl_by_comp_mask:  "
 			"Using Physical Default Port Number: 0x%X (for End Node)\n",
 			p_port->p_physp->port_num);
 		p_out_physp = p_port->p_physp;
 		/* check that the p_out_physp and the p_req_physp share a pkey */
 		if (osm_physp_share_pkey
-		    (p_rcv->p_log, p_req_physp, p_out_physp))
-			__osm_sa_slvl_create(p_rcv, p_out_physp, p_ctxt, 0);
+		    (sa->p_log, p_req_physp, p_out_physp))
+			__osm_sa_slvl_create(sa, p_out_physp, p_ctxt, 0);
 	} else {
 		if (comp_mask & IB_SLVL_COMPMASK_OUT_PORT)
 			out_port_start = out_port_end =
@@ -234,15 +195,15 @@ __osm_sa_slvl_by_comp_mask(IN osm_slvl_rec_rcv_t * const p_rcv,
 				/* if the requester and the p_out_physp don't share a pkey -
 				   continue */
 				if (!osm_physp_share_pkey
-				    (p_rcv->p_log, p_req_physp, p_out_physp))
+				    (sa->p_log, p_req_physp, p_out_physp))
 					continue;
 
-				__osm_sa_slvl_create(p_rcv, p_out_physp, p_ctxt,
+				__osm_sa_slvl_create(sa, p_out_physp, p_ctxt,
 						     in_port_num);
 			}
 		}
 	}
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
@@ -255,14 +216,14 @@ __osm_sa_slvl_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
 	osm_slvl_search_ctxt_t *const p_ctxt =
 	    (osm_slvl_search_ctxt_t *) context;
 
-	__osm_sa_slvl_by_comp_mask(p_ctxt->p_rcv, p_port, p_ctxt);
+	__osm_sa_slvl_by_comp_mask(p_ctxt->sa, p_port, p_ctxt);
 }
 
 /**********************************************************************
  **********************************************************************/
 void osm_slvl_rec_rcv_process(IN void *ctx, IN void *data)
 {
-	osm_slvl_rec_rcv_t *p_rcv = ctx;
+	osm_sa_t *sa = ctx;
 	osm_madw_t *p_madw = data;
 	const ib_sa_mad_t *p_rcvd_mad;
 	const ib_slvl_table_record_t *p_rcvd_rec;
@@ -284,9 +245,9 @@ void osm_slvl_rec_rcv_process(IN void *ctx, IN void *data)
 	ib_net64_t comp_mask;
 	osm_physp_t *p_req_physp;
 
-	CL_ASSERT(p_rcv);
+	CL_ASSERT(sa);
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_slvl_rec_rcv_process);
+	OSM_LOG_ENTER(sa->p_log, osm_slvl_rec_rcv_process);
 
 	CL_ASSERT(p_madw);
 
@@ -300,22 +261,22 @@ void osm_slvl_rec_rcv_process(IN void *ctx, IN void *data)
 	/* we only support SubnAdmGet and SubnAdmGetTable methods */
 	if ((p_rcvd_mad->method != IB_MAD_METHOD_GET) &&
 	    (p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE)) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_slvl_rec_rcv_process: ERR 2604: "
 			"Unsupported Method (%s)\n",
 			ib_get_sa_method_str(p_rcvd_mad->method));
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
 	}
 
 	/* update the requester physical port. */
-	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-						p_rcv->p_subn,
+	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log,
+						sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
 	if (p_req_physp == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_slvl_rec_rcv_process: ERR 2603: "
 			"Cannot find requester physical port\n");
 		goto Exit;
@@ -328,13 +289,13 @@ void osm_slvl_rec_rcv_process(IN void *ctx, IN void *data)
 	context.p_rcvd_rec = p_rcvd_rec;
 	context.p_list = &rec_list;
 	context.comp_mask = p_rcvd_mad->comp_mask;
-	context.p_rcv = p_rcv;
+	context.sa = sa;
 	context.in_port_num = p_rcvd_rec->in_port_num;
 	context.p_req_physp = p_req_physp;
 
-	cl_plock_acquire(p_rcv->p_lock);
+	cl_plock_acquire(sa->p_lock);
 
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sa->p_log, OSM_LOG_DEBUG,
 		"osm_slvl_rec_rcv_process: "
 		"Got Query Lid:0x%04X(%02X), In-Port:0x%02X(%02X), Out-Port:0x%02X(%02X)\n",
 		cl_ntoh16(p_rcvd_rec->lid),
@@ -350,16 +311,16 @@ void osm_slvl_rec_rcv_process(IN void *ctx, IN void *data)
 	 */
 	if (comp_mask & IB_SLVL_COMPMASK_LID) {
 
-		p_tbl = &p_rcv->p_subn->port_lid_tbl;
+		p_tbl = &sa->p_subn->port_lid_tbl;
 
 		CL_ASSERT(cl_ptr_vector_get_size(p_tbl) < 0x10000);
 
 		status =
-		    osm_get_port_by_base_lid(p_rcv->p_subn, p_rcvd_rec->lid,
+		    osm_get_port_by_base_lid(sa->p_subn, p_rcvd_rec->lid,
 					     &p_port);
 		if ((status != IB_SUCCESS) || (p_port == NULL)) {
 			status = IB_NOT_FOUND;
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_slvl_rec_rcv_process: ERR 2608: "
 				"No port found with LID 0x%x\n",
 				cl_ntoh16(p_rcvd_rec->lid));
@@ -370,14 +331,14 @@ void osm_slvl_rec_rcv_process(IN void *ctx, IN void *data)
 		/* if we have a unique port - no need for a port search */
 		if (p_port)
 			/*  this does the loop on all the port phys ports */
-			__osm_sa_slvl_by_comp_mask(p_rcv, p_port, &context);
+			__osm_sa_slvl_by_comp_mask(sa, p_port, &context);
 		else
-			cl_qmap_apply_func(&p_rcv->p_subn->port_guid_tbl,
+			cl_qmap_apply_func(&sa->p_subn->port_guid_tbl,
 					   __osm_sa_slvl_by_comp_mask_cb,
 					   &context);
 	}
 
-	cl_plock_release(p_rcv->p_lock);
+	cl_plock_release(sa->p_lock);
 
 	num_rec = cl_qlist_count(&rec_list);
 
@@ -387,16 +348,16 @@ void osm_slvl_rec_rcv_process(IN void *ctx, IN void *data)
 	 */
 	if (p_rcvd_mad->method == IB_MAD_METHOD_GET) {
 		if (num_rec == 0) {
-			osm_sa_send_error(p_rcv->p_resp, p_madw,
+			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_NO_RECORDS);
 			goto Exit;
 		}
 		if (num_rec > 1) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_slvl_rec_rcv_process: ERR 2607: "
 				"Got more than one record for SubnAdmGet (%u)\n",
 				num_rec);
-			osm_sa_send_error(p_rcv->p_resp, p_madw,
+			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
 
 			/* need to set the mem free ... */
@@ -419,7 +380,7 @@ void osm_slvl_rec_rcv_process(IN void *ctx, IN void *data)
 	    (MAD_BLOCK_SIZE -
 	     IB_SA_MAD_HDR_SIZE) / sizeof(ib_slvl_table_record_t);
 	if (trim_num_rec < num_rec) {
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sa->p_log, OSM_LOG_VERBOSE,
 			"osm_slvl_rec_rcv_process: "
 			"Number of records:%u trimmed to:%u to fit in one MAD\n",
 			num_rec, trim_num_rec);
@@ -427,11 +388,11 @@ void osm_slvl_rec_rcv_process(IN void *ctx, IN void *data)
 	}
 #endif
 
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sa->p_log, OSM_LOG_DEBUG,
 		"osm_slvl_rec_rcv_process: " "Returning %u records\n", num_rec);
 
 	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0)) {
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RECORDS);
 		goto Exit;
 	}
@@ -439,14 +400,14 @@ void osm_slvl_rec_rcv_process(IN void *ctx, IN void *data)
 	/*
 	 * Get a MAD to reply. Address of Mad is in the received mad_wrapper
 	 */
-	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+	p_resp_madw = osm_mad_pool_get(sa->p_mad_pool,
 				       p_madw->h_bind,
 				       num_rec *
 				       sizeof(ib_slvl_table_record_t) +
 				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
 
 	if (!p_resp_madw) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_slvl_rec_rcv_process: ERR 2605: "
 			"osm_mad_pool_get failed\n");
 
@@ -456,7 +417,7 @@ void osm_slvl_rec_rcv_process(IN void *ctx, IN void *data)
 			free(p_rec_item);
 		}
 
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RESOURCES);
 		goto Exit;
 	}
@@ -509,9 +470,9 @@ void osm_slvl_rec_rcv_process(IN void *ctx, IN void *data)
 	CL_ASSERT(cl_is_qlist_empty(&rec_list));
 
 	status = osm_sa_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE,
-				    p_rcv->p_subn);
+				    sa->p_subn);
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_slvl_rec_rcv_process: ERR 2606: "
 			"osm_vendor_send status = %s\n",
 			ib_get_err_str(status));
@@ -519,5 +480,5 @@ void osm_slvl_rec_rcv_process(IN void *ctx, IN void *data)
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
diff --git a/opensm/opensm/osm_sa_sminfo_record.c b/opensm/opensm/osm_sa_sminfo_record.c
index 6f84ac7..b89173c 100644
--- a/opensm/opensm/osm_sa_sminfo_record.c
+++ b/opensm/opensm/osm_sa_sminfo_record.c
@@ -55,20 +55,18 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
-#include <opensm/osm_sa_sminfo_record.h>
-#include <opensm/osm_sa_response.h>
+#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_subnet.h>
 #include <opensm/osm_mad_pool.h>
-#include <vendor/osm_vendor.h>
-#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_msgdef.h>
 #include <opensm/osm_port.h>
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_remote_sm.h>
 #include <opensm/osm_sa.h>
+#include <opensm/osm_opensm.h>
 
 typedef struct _osm_smir_item {
 	cl_list_item_t list_item;
@@ -79,53 +77,12 @@ typedef struct _osm_smir_search_ctxt {
 	const ib_sminfo_record_t *p_rcvd_rec;
 	ib_net64_t comp_mask;
 	cl_qlist_t *p_list;
-	osm_smir_rcv_t *p_rcv;
+	osm_sa_t *sa;
 	const osm_physp_t *p_req_physp;
 } osm_smir_search_ctxt_t;
 
-/**********************************************************************
- **********************************************************************/
-void osm_smir_rcv_construct(IN osm_smir_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_smir_rcv_destroy(IN osm_smir_rcv_t * const p_rcv)
-{
-	CL_ASSERT(p_rcv);
-	OSM_LOG_ENTER(p_rcv->p_log, osm_smir_rcv_destroy);
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_smir_rcv_init(IN osm_smir_rcv_t * const p_rcv,
-		  IN osm_sa_resp_t * const p_resp,
-		  IN osm_mad_pool_t * const p_mad_pool,
-		  IN osm_subn_t * const p_subn,
-		  IN osm_stats_t * const p_stats,
-		  IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
-{
-	OSM_LOG_ENTER(p_log, osm_smir_rcv_init);
-
-	osm_smir_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_resp = p_resp;
-	p_rcv->p_stats = p_stats;
-	p_rcv->p_mad_pool = p_mad_pool;
-
-	OSM_LOG_EXIT(p_rcv->p_log);
-	return IB_SUCCESS;
-}
-
 static ib_api_status_t
-__osm_smir_rcv_new_smir(IN osm_smir_rcv_t * const p_rcv,
+__osm_smir_rcv_new_smir(IN osm_sa_t * sa,
 			IN const osm_port_t * const p_port,
 			IN cl_qlist_t * const p_list,
 			IN ib_net64_t const guid,
@@ -136,19 +93,19 @@ __osm_smir_rcv_new_smir(IN osm_smir_rcv_t * const p_rcv,
 	osm_smir_item_t *p_rec_item;
 	ib_api_status_t status = IB_SUCCESS;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_smir_rcv_new_smir);
+	OSM_LOG_ENTER(sa->p_log, __osm_smir_rcv_new_smir);
 
 	p_rec_item = malloc(sizeof(*p_rec_item));
 	if (p_rec_item == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_smir_rcv_new_smir: ERR 2801: "
 			"rec_item alloc failed\n");
 		status = IB_INSUFFICIENT_RESOURCES;
 		goto Exit;
 	}
 
-	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(sa->p_log, OSM_LOG_DEBUG))
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_smir_rcv_new_smir: "
 			"New SMInfo: GUID 0x%016" PRIx64 "\n", cl_ntoh64(guid)
 		    );
@@ -163,14 +120,14 @@ __osm_smir_rcv_new_smir(IN osm_smir_rcv_t * const p_rcv,
 	cl_qlist_insert_tail(p_list, &p_rec_item->list_item);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sa_smir_by_comp_mask(IN osm_smir_rcv_t * const p_rcv,
+__osm_sa_smir_by_comp_mask(IN osm_sa_t * sa,
 			   IN const osm_remote_sm_t * const p_rem_sm,
 			   osm_smir_search_ctxt_t * const p_ctxt)
 {
@@ -178,7 +135,7 @@ __osm_sa_smir_by_comp_mask(IN osm_smir_rcv_t * const p_rcv,
 	const osm_physp_t *const p_req_physp = p_ctxt->p_req_physp;
 	ib_net64_t const comp_mask = p_ctxt->comp_mask;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_smir_by_comp_mask);
+	OSM_LOG_ENTER(sa->p_log, __osm_sa_smir_by_comp_mask);
 
 	if (comp_mask & IB_SMIR_COMPMASK_GUID) {
 		if (p_rem_sm->smi.guid != p_rcvd_rec->sm_info.guid)
@@ -199,13 +156,13 @@ __osm_sa_smir_by_comp_mask(IN osm_smir_rcv_t * const p_rcv,
 
 	/* Implement any other needed search cases */
 
-	__osm_smir_rcv_new_smir(p_rcv, p_rem_sm->p_port, p_ctxt->p_list,
+	__osm_smir_rcv_new_smir(sa, p_rem_sm->p_port, p_ctxt->p_list,
 				p_rem_sm->smi.guid,
 				p_rem_sm->smi.act_count,
 				p_rem_sm->smi.pri_state, p_req_physp);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
@@ -218,16 +175,16 @@ __osm_sa_smir_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
 	osm_smir_search_ctxt_t *const p_ctxt =
 	    (osm_smir_search_ctxt_t *) context;
 
-	__osm_sa_smir_by_comp_mask(p_ctxt->p_rcv, p_rem_sm, p_ctxt);
+	__osm_sa_smir_by_comp_mask(p_ctxt->sa, p_rem_sm, p_ctxt);
 }
 
 /**********************************************************************
  **********************************************************************/
 void osm_smir_rcv_process(IN void *ctx, IN void *data)
 {
-	osm_smir_rcv_t *p_rcv = ctx;
+	osm_sa_t *sa = ctx;
 	osm_madw_t *p_madw = data;
-	const ib_sa_mad_t *p_rcvd_mad;
+	const ib_sa_mad_t *sad_mad;
 	const ib_sminfo_record_t *p_rcvd_rec;
 	const cl_qmap_t *p_tbl;
 	const osm_port_t *p_port = NULL;
@@ -252,59 +209,59 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)
 	cl_qmap_t *p_sm_guid_tbl;
 	uint8_t pri_state;
 
-	CL_ASSERT(p_rcv);
+	CL_ASSERT(sa);
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_smir_rcv_process);
+	OSM_LOG_ENTER(sa->p_log, osm_smir_rcv_process);
 
 	CL_ASSERT(p_madw);
 
-	p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	sad_mad = osm_madw_get_sa_mad_ptr(p_madw);
 	p_rcvd_rec =
-	    (ib_sminfo_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);
-	comp_mask = p_rcvd_mad->comp_mask;
+	    (ib_sminfo_record_t *) ib_sa_mad_get_payload_ptr(sad_mad);
+	comp_mask = sad_mad->comp_mask;
 
-	CL_ASSERT(p_rcvd_mad->attr_id == IB_MAD_ATTR_SMINFO_RECORD);
+	CL_ASSERT(sad_mad->attr_id == IB_MAD_ATTR_SMINFO_RECORD);
 
 	/* we only support SubnAdmGet and SubnAdmGetTable methods */
-	if ((p_rcvd_mad->method != IB_MAD_METHOD_GET) &&
-	    (p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE)) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+	if ((sad_mad->method != IB_MAD_METHOD_GET) &&
+	    (sad_mad->method != IB_MAD_METHOD_GETTABLE)) {
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_smir_rcv_process: ERR 2804: "
 			"Unsupported Method (%s)\n",
-			ib_get_sa_method_str(p_rcvd_mad->method));
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+			ib_get_sa_method_str(sad_mad->method));
+		osm_sa_send_error(sa, p_madw,
 				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
 	}
 
 	/* update the requester physical port. */
-	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-						p_rcv->p_subn,
+	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log,
+						sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
 	if (p_req_physp == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_smir_rcv_process: ERR 2803: "
 			"Cannot find requester physical port\n");
 		goto Exit;
 	}
 
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
-		osm_dump_sm_info_record(p_rcv->p_log, p_rcvd_rec,
+	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
+		osm_dump_sm_info_record(sa->p_log, p_rcvd_rec,
 					OSM_LOG_DEBUG);
 
-	p_tbl = &p_rcv->p_subn->sm_guid_tbl;
+	p_tbl = &sa->p_subn->sm_guid_tbl;
 	p_smi = &p_rcvd_rec->sm_info;
 
 	cl_qlist_init(&rec_list);
 
 	context.p_rcvd_rec = p_rcvd_rec;
 	context.p_list = &rec_list;
-	context.comp_mask = p_rcvd_mad->comp_mask;
-	context.p_rcv = p_rcv;
+	context.comp_mask = sad_mad->comp_mask;
+	context.sa = sa;
 	context.p_req_physp = p_req_physp;
 
-	cl_plock_acquire(p_rcv->p_lock);
+	cl_plock_acquire(sa->p_lock);
 
 	/*
 	   If the user specified a LID, it obviously narrows our
@@ -312,11 +269,11 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)
 	 */
 	if (comp_mask & IB_SMIR_COMPMASK_LID) {
 		status =
-		    osm_get_port_by_base_lid(p_rcv->p_subn, p_rcvd_rec->lid,
+		    osm_get_port_by_base_lid(sa->p_subn, p_rcvd_rec->lid,
 					     &p_port);
 		if ((status != IB_SUCCESS) || (p_port == NULL)) {
 			status = IB_NOT_FOUND;
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_smir_rcv_process: ERR 2806: "
 				"No port found with LID 0x%x\n",
 				cl_ntoh16(p_rcvd_rec->lid));
@@ -326,23 +283,23 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)
 	if (status == IB_SUCCESS) {
 		/* Handle our own SM first */
 		local_port =
-		    osm_get_port_by_guid(p_rcv->p_subn,
-					 p_rcv->p_subn->sm_port_guid);
+		    osm_get_port_by_guid(sa->p_subn,
+					 sa->p_subn->sm_port_guid);
 		if (!local_port) {
-			cl_plock_release(p_rcv->p_lock);
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			cl_plock_release(sa->p_lock);
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_smir_rcv_process: ERR 2809: "
 				"No port found with GUID 0x%016" PRIx64 "\n",
-				cl_ntoh64(p_rcv->p_subn->sm_port_guid));
+				cl_ntoh64(sa->p_subn->sm_port_guid));
 			goto Exit;
 		}
 
 		if (!p_port || local_port == p_port) {
 			if (FALSE ==
-			    osm_physp_share_pkey(p_rcv->p_log, p_req_physp,
+			    osm_physp_share_pkey(sa->p_log, p_req_physp,
 						 local_port->p_physp)) {
-				cl_plock_release(p_rcv->p_lock);
-				osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				cl_plock_release(sa->p_lock);
+				osm_log(sa->p_log, OSM_LOG_ERROR,
 					"osm_smir_rcv_process: ERR 2805: "
 					"Cannot get SMInfo record due to pkey violation\n");
 				goto Exit;
@@ -350,29 +307,28 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)
 
 			/* Check that other search components specified match */
 			if (comp_mask & IB_SMIR_COMPMASK_GUID) {
-				if (p_rcv->p_subn->sm_port_guid != p_smi->guid)
+				if (sa->p_subn->sm_port_guid != p_smi->guid)
 					goto Remotes;
 			}
 			if (comp_mask & IB_SMIR_COMPMASK_PRIORITY) {
-				if (p_rcv->p_subn->opt.sm_priority !=
+				if (sa->p_subn->opt.sm_priority !=
 				    ib_sminfo_get_priority(p_smi))
 					goto Remotes;
 			}
 			if (comp_mask & IB_SMIR_COMPMASK_SMSTATE) {
-				if (p_rcv->p_subn->sm_state !=
+				if (sa->p_subn->sm_state !=
 				    ib_sminfo_get_state(p_smi))
 					goto Remotes;
 			}
 
 			/* Now, add local SMInfo to list */
-			pri_state = p_rcv->p_subn->sm_state & 0x0F;
+			pri_state = sa->p_subn->sm_state & 0x0F;
 			pri_state |=
-			    (p_rcv->p_subn->opt.sm_priority & 0x0F) << 4;
-			__osm_smir_rcv_new_smir(p_rcv, local_port,
+			    (sa->p_subn->opt.sm_priority & 0x0F) << 4;
+			__osm_smir_rcv_new_smir(sa, local_port,
 						context.p_list,
-						p_rcv->p_subn->sm_port_guid,
-						cl_ntoh32(p_rcv->p_stats->
-							  qp0_mads_sent),
+						sa->p_subn->sm_port_guid,
+						cl_ntoh32(sa->p_subn->p_osm->stats.qp0_mads_sent),
 						pri_state, p_req_physp);
 		}
 
@@ -380,29 +336,29 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)
 		if (p_port && p_port != local_port) {
 			/* Find remote SM corresponding to p_port */
 			port_guid = osm_port_get_guid(p_port);
-			p_sm_guid_tbl = &p_rcv->p_subn->sm_guid_tbl;
+			p_sm_guid_tbl = &sa->p_subn->sm_guid_tbl;
 			p_rem_sm =
 			    (osm_remote_sm_t *) cl_qmap_get(p_sm_guid_tbl,
 							    port_guid);
 			if (p_rem_sm !=
 			    (osm_remote_sm_t *) cl_qmap_end(p_sm_guid_tbl))
-				__osm_sa_smir_by_comp_mask(p_rcv, p_rem_sm,
+				__osm_sa_smir_by_comp_mask(sa, p_rem_sm,
 							   &context);
 			else {
-				osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+				osm_log(sa->p_log, OSM_LOG_ERROR,
 					"osm_smir_rcv_process: ERR 280A: "
 					"No remote SM for GUID 0x%016" PRIx64
 					"\n", cl_ntoh64(port_guid));
 			}
 		} else {
 			/* Go over all other known (remote) SMs */
-			cl_qmap_apply_func(&p_rcv->p_subn->sm_guid_tbl,
+			cl_qmap_apply_func(&sa->p_subn->sm_guid_tbl,
 					   __osm_sa_smir_by_comp_mask_cb,
 					   &context);
 		}
 	}
 
-	cl_plock_release(p_rcv->p_lock);
+	cl_plock_release(sa->p_lock);
 
 	num_rec = cl_qlist_count(&rec_list);
 
@@ -410,18 +366,18 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)
 	 * C15-0.1.30:
 	 * If we do a SubnAdmGet and got more than one record it is an error !
 	 */
-	if (p_rcvd_mad->method == IB_MAD_METHOD_GET) {
+	if (sad_mad->method == IB_MAD_METHOD_GET) {
 		if (num_rec == 0) {
-			osm_sa_send_error(p_rcv->p_resp, p_madw,
+			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_NO_RECORDS);
 			goto Exit;
 		}
 		if (num_rec > 1) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_smir_rcv_process: ERR 2808: "
 				"Got more than one record for SubnAdmGet (%u)\n",
 				num_rec);
-			osm_sa_send_error(p_rcv->p_resp, p_madw,
+			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
 
 			/* need to set the mem free ... */
@@ -443,7 +399,7 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)
 	trim_num_rec =
 	    (MAD_BLOCK_SIZE - IB_SA_MAD_HDR_SIZE) / sizeof(ib_sminfo_record_t);
 	if (trim_num_rec < num_rec) {
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sa->p_log, OSM_LOG_VERBOSE,
 			"osm_smir_rcv_process: "
 			"Number of records:%u trimmed to:%u to fit in one MAD\n",
 			num_rec, trim_num_rec);
@@ -451,11 +407,11 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)
 	}
 #endif
 
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sa->p_log, OSM_LOG_DEBUG,
 		"osm_smir_rcv_process: " "Returning %u records\n", num_rec);
 
-	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0)) {
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+	if ((sad_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0)) {
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RECORDS);
 		goto Exit;
 	}
@@ -463,13 +419,13 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)
 	/*
 	 * Get a MAD to reply. Address of Mad is in the received mad_wrapper
 	 */
-	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+	p_resp_madw = osm_mad_pool_get(sa->p_mad_pool,
 				       p_madw->h_bind,
 				       num_rec * sizeof(ib_sminfo_record_t) +
 				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
 
 	if (!p_resp_madw) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_smir_rcv_process: ERR 2807: "
 			"osm_mad_pool_get failed\n");
 
@@ -479,7 +435,7 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)
 			free(p_rec_item);
 		}
 
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RESOURCES);
 
 		goto Exit;
@@ -493,7 +449,7 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)
 	   Then copy all records from the list into the response payload.
 	 */
 
-	memcpy(p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE);
+	memcpy(p_resp_sa_mad, sad_mad, IB_SA_MAD_HDR_SIZE);
 	p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
 	/* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
 	p_resp_sa_mad->sm_key = 0;
@@ -534,14 +490,14 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)
 	CL_ASSERT(cl_is_qlist_empty(&rec_list));
 
 	status = osm_sa_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE,
-				    p_rcv->p_subn);
+				    sa->p_subn);
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_smir_rcv_process: ERR 2802: "
 			"Error sending MAD (%s)\n", ib_get_err_str(status));
 		goto Exit;
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
diff --git a/opensm/opensm/osm_sa_sw_info_record.c b/opensm/opensm/osm_sa_sw_info_record.c
index a9947e1..f1eddda 100644
--- a/opensm/opensm/osm_sa_sw_info_record.c
+++ b/opensm/opensm/osm_sa_sw_info_record.c
@@ -52,16 +52,12 @@
 #include <iba/ib_types.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
-#include <opensm/osm_sa_sw_info_record.h>
-#include <opensm/osm_node.h>
 #include <vendor/osm_vendor_api.h>
+#include <opensm/osm_node.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_sa.h>
 
-#define OSM_SIR_RCV_POOL_MIN_SIZE    32
-#define OSM_SIR_RCV_POOL_GROW_SIZE   32
-
 typedef struct _osm_sir_item {
 	cl_list_item_t list_item;
 	ib_switch_info_record_t rec;
@@ -71,71 +67,33 @@ typedef struct _osm_sir_search_ctxt {
 	const ib_switch_info_record_t *p_rcvd_rec;
 	ib_net64_t comp_mask;
 	cl_qlist_t *p_list;
-	osm_sir_rcv_t *p_rcv;
+	osm_sa_t *sa;
 	const osm_physp_t *p_req_physp;
 } osm_sir_search_ctxt_t;
 
 /**********************************************************************
  **********************************************************************/
-void osm_sir_rcv_construct(IN osm_sir_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_sir_rcv_destroy(IN osm_sir_rcv_t * const p_rcv)
-{
-	OSM_LOG_ENTER(p_rcv->p_log, osm_sir_rcv_destroy);
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_sir_rcv_init(IN osm_sir_rcv_t * const p_rcv,
-		 IN osm_sa_resp_t * const p_resp,
-		 IN osm_mad_pool_t * const p_mad_pool,
-		 IN osm_subn_t * const p_subn,
-		 IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
-{
-	OSM_LOG_ENTER(p_log, osm_sir_rcv_init);
-
-	osm_sir_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_resp = p_resp;
-	p_rcv->p_mad_pool = p_mad_pool;
-
-	OSM_LOG_EXIT(p_log);
-	return IB_SUCCESS;
-}
-
-/**********************************************************************
- **********************************************************************/
 static ib_api_status_t
-__osm_sir_rcv_new_sir(IN osm_sir_rcv_t * const p_rcv,
+__osm_sir_rcv_new_sir(IN osm_sa_t * sa,
 		      IN const osm_switch_t * const p_sw,
 		      IN cl_qlist_t * const p_list, IN ib_net16_t const lid)
 {
 	osm_sir_item_t *p_rec_item;
 	ib_api_status_t status = IB_SUCCESS;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_sir_rcv_new_sir);
+	OSM_LOG_ENTER(sa->p_log, __osm_sir_rcv_new_sir);
 
 	p_rec_item = malloc(sizeof(*p_rec_item));
 	if (p_rec_item == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_sir_rcv_new_sir: ERR 5308: "
 			"rec_item alloc failed\n");
 		status = IB_INSUFFICIENT_RESOURCES;
 		goto Exit;
 	}
 
-	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(sa->p_log, OSM_LOG_DEBUG))
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_sir_rcv_new_sir: "
 			"New SwitchInfoRecord: lid 0x%X\n", cl_ntoh16(lid)
 		    );
@@ -148,35 +106,35 @@ __osm_sir_rcv_new_sir(IN osm_sir_rcv_t * const p_rcv,
 	cl_qlist_insert_tail(p_list, &p_rec_item->list_item);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 	return (status);
 }
 
 /**********************************************************************
  **********************************************************************/
-static osm_port_t *__osm_sir_get_port_by_guid(IN osm_sir_rcv_t * const p_rcv,
+static osm_port_t *__osm_sir_get_port_by_guid(IN osm_sa_t * sa,
 					      IN uint64_t port_guid)
 {
 	osm_port_t *p_port;
 
-	CL_PLOCK_ACQUIRE(p_rcv->p_lock);
+	CL_PLOCK_ACQUIRE(sa->p_lock);
 
-	p_port = osm_get_port_by_guid(p_rcv->p_subn, port_guid);
+	p_port = osm_get_port_by_guid(sa->p_subn, port_guid);
 	if (!p_port) {
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_sir_get_port_by_guid ERR 5309: "
 			"Invalid port GUID 0x%016" PRIx64 "\n", port_guid);
 		p_port = NULL;
 	}
 
-	CL_PLOCK_RELEASE(p_rcv->p_lock);
+	CL_PLOCK_RELEASE(sa->p_lock);
 	return p_port;
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sir_rcv_create_sir(IN osm_sir_rcv_t * const p_rcv,
+__osm_sir_rcv_create_sir(IN osm_sa_t * sa,
 			 IN const osm_switch_t * const p_sw,
 			 IN cl_qlist_t * const p_list,
 			 IN ib_net16_t const match_lid,
@@ -188,10 +146,10 @@ __osm_sir_rcv_create_sir(IN osm_sir_rcv_t * const p_rcv,
 	ib_net16_t min_lid_ho;
 	ib_net16_t max_lid_ho;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_sir_rcv_create_sir);
+	OSM_LOG_ENTER(sa->p_log, __osm_sir_rcv_create_sir);
 
-	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(sa->p_log, OSM_LOG_DEBUG)) {
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_sir_rcv_create_sir: "
 			"Looking for SwitchInfoRecord with LID: 0x%X\n",
 			cl_ntoh16(match_lid)
@@ -200,10 +158,10 @@ __osm_sir_rcv_create_sir(IN osm_sir_rcv_t * const p_rcv,
 
 	/* In switches, the port guid is the node guid. */
 	p_port =
-	    __osm_sir_get_port_by_guid(p_rcv,
+	    __osm_sir_get_port_by_guid(sa,
 				       p_sw->p_node->node_info.port_guid);
 	if (!p_port) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_sir_rcv_create_sir: ERR 530A: "
 			"Failed to find Port by Node Guid:0x%016" PRIx64
 			"\n", cl_ntoh64(p_sw->p_node->node_info.node_guid)
@@ -215,7 +173,7 @@ __osm_sir_rcv_create_sir(IN osm_sir_rcv_t * const p_rcv,
 	   the same partition. */
 	p_physp = p_port->p_physp;
 	if (!p_physp) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_sir_rcv_create_sir: ERR 530B: "
 			"Failed to find default physical Port by Node Guid:0x%016"
 			PRIx64 "\n",
@@ -223,7 +181,7 @@ __osm_sir_rcv_create_sir(IN osm_sir_rcv_t * const p_rcv,
 		    );
 		goto Exit;
 	}
-	if (!osm_physp_share_pkey(p_rcv->p_log, p_req_physp, p_physp))
+	if (!osm_physp_share_pkey(sa->p_log, p_req_physp, p_physp))
 		goto Exit;
 
 	/* get the port 0 of the switch */
@@ -234,8 +192,8 @@ __osm_sir_rcv_create_sir(IN osm_sir_rcv_t * const p_rcv,
 		/*
 		   We validate that the lid belongs to this switch.
 		 */
-		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(sa->p_log, OSM_LOG_DEBUG)) {
+			osm_log(sa->p_log, OSM_LOG_DEBUG,
 				"__osm_sir_rcv_create_sir: "
 				"Comparing LID: 0x%X <= 0x%X <= 0x%X\n",
 				min_lid_ho, match_lid_ho, max_lid_ho);
@@ -246,11 +204,11 @@ __osm_sir_rcv_create_sir(IN osm_sir_rcv_t * const p_rcv,
 
 	}
 
-	__osm_sir_rcv_new_sir(p_rcv, p_sw, p_list,
+	__osm_sir_rcv_new_sir(sa, p_sw, p_list,
 			      osm_port_get_base_lid(p_port));
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
@@ -264,13 +222,13 @@ __osm_sir_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
 	const osm_switch_t *const p_sw = (osm_switch_t *) p_map_item;
 	const ib_switch_info_record_t *const p_rcvd_rec = p_ctxt->p_rcvd_rec;
 	const osm_physp_t *const p_req_physp = p_ctxt->p_req_physp;
-	osm_sir_rcv_t *const p_rcv = p_ctxt->p_rcv;
+	osm_sa_t *sa = p_ctxt->sa;
 	ib_net64_t const comp_mask = p_ctxt->comp_mask;
 	ib_net16_t match_lid = 0;
 
-	OSM_LOG_ENTER(p_ctxt->p_rcv->p_log, __osm_sir_rcv_by_comp_mask);
+	OSM_LOG_ENTER(p_ctxt->sa->p_log, __osm_sir_rcv_by_comp_mask);
 
-	osm_dump_switch_info(p_ctxt->p_rcv->p_log,
+	osm_dump_switch_info(p_ctxt->sa->p_log,
 			     &p_sw->switch_info, OSM_LOG_VERBOSE);
 
 	if (comp_mask & IB_SWIR_COMPMASK_LID) {
@@ -279,20 +237,20 @@ __osm_sir_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
 			goto Exit;
 	}
 
-	__osm_sir_rcv_create_sir(p_rcv, p_sw, p_ctxt->p_list,
+	__osm_sir_rcv_create_sir(sa, p_sw, p_ctxt->p_list,
 				 match_lid, p_req_physp);
 
       Exit:
-	OSM_LOG_EXIT(p_ctxt->p_rcv->p_log);
+	OSM_LOG_EXIT(p_ctxt->sa->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 void osm_sir_rcv_process(IN void *ctx, IN void *data)
 {
-	osm_sir_rcv_t *p_rcv = ctx;
+	osm_sa_t *sa = ctx;
 	osm_madw_t *p_madw = data;
-	const ib_sa_mad_t *p_rcvd_mad;
+	const ib_sa_mad_t *sad_mad;
 	const ib_switch_info_record_t *p_rcvd_rec;
 	ib_switch_info_record_t *p_resp_rec;
 	cl_qlist_t rec_list;
@@ -308,61 +266,61 @@ void osm_sir_rcv_process(IN void *ctx, IN void *data)
 	ib_api_status_t status;
 	osm_physp_t *p_req_physp;
 
-	CL_ASSERT(p_rcv);
+	CL_ASSERT(sa);
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_sir_rcv_process);
+	OSM_LOG_ENTER(sa->p_log, osm_sir_rcv_process);
 
 	CL_ASSERT(p_madw);
 
-	p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	sad_mad = osm_madw_get_sa_mad_ptr(p_madw);
 	p_rcvd_rec =
-	    (ib_switch_info_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);
+	    (ib_switch_info_record_t *) ib_sa_mad_get_payload_ptr(sad_mad);
 
-	CL_ASSERT(p_rcvd_mad->attr_id == IB_MAD_ATTR_SWITCH_INFO_RECORD);
+	CL_ASSERT(sad_mad->attr_id == IB_MAD_ATTR_SWITCH_INFO_RECORD);
 
 	/* we only support SubnAdmGet and SubnAdmGetTable methods */
-	if ((p_rcvd_mad->method != IB_MAD_METHOD_GET) &&
-	    (p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE)) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+	if ((sad_mad->method != IB_MAD_METHOD_GET) &&
+	    (sad_mad->method != IB_MAD_METHOD_GETTABLE)) {
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_sir_rcv_process: ERR 5305: "
 			"Unsupported Method (%s)\n",
-			ib_get_sa_method_str(p_rcvd_mad->method));
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+			ib_get_sa_method_str(sad_mad->method));
+		osm_sa_send_error(sa, p_madw,
 				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
 	}
 
 	/* update the requester physical port. */
-	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-						p_rcv->p_subn,
+	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log,
+						sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
 	if (p_req_physp == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_sir_rcv_process: ERR 5304: "
 			"Cannot find requester physical port\n");
 		goto Exit;
 	}
 
-	if (osm_log_is_active(p_rcv->p_log, OSM_LOG_DEBUG))
-		osm_dump_switch_info_record(p_rcv->p_log, p_rcvd_rec,
+	if (osm_log_is_active(sa->p_log, OSM_LOG_DEBUG))
+		osm_dump_switch_info_record(sa->p_log, p_rcvd_rec,
 					    OSM_LOG_DEBUG);
 
 	cl_qlist_init(&rec_list);
 
 	context.p_rcvd_rec = p_rcvd_rec;
 	context.p_list = &rec_list;
-	context.comp_mask = p_rcvd_mad->comp_mask;
-	context.p_rcv = p_rcv;
+	context.comp_mask = sad_mad->comp_mask;
+	context.sa = sa;
 	context.p_req_physp = p_req_physp;
 
-	cl_plock_acquire(p_rcv->p_lock);
+	cl_plock_acquire(sa->p_lock);
 
 	/* Go over all switches */
-	cl_qmap_apply_func(&p_rcv->p_subn->sw_guid_tbl,
+	cl_qmap_apply_func(&sa->p_subn->sw_guid_tbl,
 			   __osm_sir_rcv_by_comp_mask, &context);
 
-	cl_plock_release(p_rcv->p_lock);
+	cl_plock_release(sa->p_lock);
 
 	num_rec = cl_qlist_count(&rec_list);
 
@@ -370,12 +328,12 @@ void osm_sir_rcv_process(IN void *ctx, IN void *data)
 	 * C15-0.1.30:
 	 * If we do a SubnAdmGet and got more than one record it is an error !
 	 */
-	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec > 1)) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+	if ((sad_mad->method == IB_MAD_METHOD_GET) && (num_rec > 1)) {
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_sir_rcv_process: ERR 5303: "
 			"Got more than one record for SubnAdmGet (%u)\n",
 			num_rec);
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
 
 		/* need to set the mem free ... */
@@ -396,7 +354,7 @@ void osm_sir_rcv_process(IN void *ctx, IN void *data)
 	    (MAD_BLOCK_SIZE -
 	     IB_SA_MAD_HDR_SIZE) / sizeof(ib_switch_info_record_t);
 	if (trim_num_rec < num_rec) {
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sa->p_log, OSM_LOG_VERBOSE,
 			"osm_sir_rcv_process: "
 			"Number of records:%u trimmed to:%u to fit in one MAD\n",
 			num_rec, trim_num_rec);
@@ -404,11 +362,11 @@ void osm_sir_rcv_process(IN void *ctx, IN void *data)
 	}
 #endif
 
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sa->p_log, OSM_LOG_DEBUG,
 		"osm_sir_rcv_process: " "Returning %u records\n", num_rec);
 
-	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0)) {
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+	if ((sad_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0)) {
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RECORDS);
 		goto Exit;
 	}
@@ -416,14 +374,14 @@ void osm_sir_rcv_process(IN void *ctx, IN void *data)
 	/*
 	 * Get a MAD to reply. Address of Mad is in the received mad_wrapper
 	 */
-	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+	p_resp_madw = osm_mad_pool_get(sa->p_mad_pool,
 				       p_madw->h_bind,
 				       num_rec *
 				       sizeof(ib_switch_info_record_t) +
 				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
 
 	if (!p_resp_madw) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_sir_rcv_process: ERR 5306: "
 			"osm_mad_pool_get failed\n");
 
@@ -433,7 +391,7 @@ void osm_sir_rcv_process(IN void *ctx, IN void *data)
 			free(p_rec_item);
 		}
 
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RESOURCES);
 		goto Exit;
 	}
@@ -446,7 +404,7 @@ void osm_sir_rcv_process(IN void *ctx, IN void *data)
 	   Then copy all records from the list into the response payload.
 	 */
 
-	memcpy(p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE);
+	memcpy(p_resp_sa_mad, sad_mad, IB_SA_MAD_HDR_SIZE);
 	p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
 	/* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
 	p_resp_sa_mad->sm_key = 0;
@@ -484,9 +442,9 @@ void osm_sir_rcv_process(IN void *ctx, IN void *data)
 	CL_ASSERT(cl_is_qlist_empty(&rec_list));
 
 	status = osm_sa_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE,
-				    p_rcv->p_subn);
+				    sa->p_subn);
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_sir_rcv_process: ERR 5307: "
 			"osm_sa_vendor_send status = %s\n",
 			ib_get_err_str(status));
@@ -494,5 +452,5 @@ void osm_sir_rcv_process(IN void *ctx, IN void *data)
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
diff --git a/opensm/opensm/osm_sa_vlarb_record.c b/opensm/opensm/osm_sa_vlarb_record.c
index a538a0b..51bc517 100644
--- a/opensm/opensm/osm_sa_vlarb_record.c
+++ b/opensm/opensm/osm_sa_vlarb_record.c
@@ -55,10 +55,9 @@
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qlist.h>
-#include <opensm/osm_sa_vlarb_record.h>
+#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_port.h>
 #include <opensm/osm_node.h>
-#include <vendor/osm_vendor_api.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_sa.h>
@@ -73,52 +72,14 @@ typedef struct _osm_vl_arb_search_ctxt {
 	ib_net64_t comp_mask;
 	uint8_t block_num;
 	cl_qlist_t *p_list;
-	osm_vlarb_rec_rcv_t *p_rcv;
+	osm_sa_t *sa;
 	const osm_physp_t *p_req_physp;
 } osm_vl_arb_search_ctxt_t;
 
 /**********************************************************************
  **********************************************************************/
-void osm_vlarb_rec_rcv_construct(IN osm_vlarb_rec_rcv_t * const p_rcv)
-{
-	memset(p_rcv, 0, sizeof(*p_rcv));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_vlarb_rec_rcv_destroy(IN osm_vlarb_rec_rcv_t * const p_rcv)
-{
-	OSM_LOG_ENTER(p_rcv->p_log, osm_vlarb_rec_rcv_destroy);
-	OSM_LOG_EXIT(p_rcv->p_log);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_vlarb_rec_rcv_init(IN osm_vlarb_rec_rcv_t * const p_rcv,
-		       IN osm_sa_resp_t * const p_resp,
-		       IN osm_mad_pool_t * const p_mad_pool,
-		       IN osm_subn_t * const p_subn,
-		       IN osm_log_t * const p_log, IN cl_plock_t * const p_lock)
-{
-	OSM_LOG_ENTER(p_log, osm_vlarb_rec_rcv_init);
-
-	osm_vlarb_rec_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_resp = p_resp;
-	p_rcv->p_mad_pool = p_mad_pool;
-
-	OSM_LOG_EXIT(p_log);
-	return IB_SUCCESS;
-}
-
-/**********************************************************************
- **********************************************************************/
 static void
-__osm_sa_vl_arb_create(IN osm_vlarb_rec_rcv_t * const p_rcv,
+__osm_sa_vl_arb_create(IN osm_sa_t * sa,
 		       IN osm_physp_t * const p_physp,
 		       IN osm_vl_arb_search_ctxt_t * const p_ctxt,
 		       IN uint8_t block)
@@ -127,11 +88,11 @@ __osm_sa_vl_arb_create(IN osm_vlarb_rec_rcv_t * const p_rcv,
 	uint16_t lid;
 	ib_api_status_t status = IB_SUCCESS;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_vl_arb_create);
+	OSM_LOG_ENTER(sa->p_log, __osm_sa_vl_arb_create);
 
 	p_rec_item = malloc(sizeof(*p_rec_item));
 	if (p_rec_item == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"__osm_sa_vl_arb_create: ERR 2A02: "
 			"rec_item alloc failed\n");
 		status = IB_INSUFFICIENT_RESOURCES;
@@ -143,8 +104,8 @@ __osm_sa_vl_arb_create(IN osm_vlarb_rec_rcv_t * const p_rcv,
 	else
 		lid = osm_node_get_base_lid(p_physp->p_node, 0);
 
-	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(sa->p_log, OSM_LOG_DEBUG))
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_sa_vl_arb_create: "
 			"New VLArbitration for: port 0x%016" PRIx64
 			", lid 0x%X, port 0x%X Block:%u\n",
@@ -161,36 +122,36 @@ __osm_sa_vl_arb_create(IN osm_vlarb_rec_rcv_t * const p_rcv,
 	cl_qlist_insert_tail(p_ctxt->p_list, &p_rec_item->list_item);
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sa_vl_arb_check_physp(IN osm_vlarb_rec_rcv_t * const p_rcv,
+__osm_sa_vl_arb_check_physp(IN osm_sa_t * sa,
 			    IN osm_physp_t * const p_physp,
 			    osm_vl_arb_search_ctxt_t * const p_ctxt)
 {
 	ib_net64_t comp_mask = p_ctxt->comp_mask;
 	uint8_t block;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_vl_arb_check_physp);
+	OSM_LOG_ENTER(sa->p_log, __osm_sa_vl_arb_check_physp);
 
 	/* we got here with the phys port - all that's left is to get the right block */
 	for (block = 1; block <= 4; block++) {
 		if (!(comp_mask & IB_VLA_COMPMASK_BLOCK)
 		    || block == p_ctxt->block_num) {
-			__osm_sa_vl_arb_create(p_rcv, p_physp, p_ctxt, block);
+			__osm_sa_vl_arb_create(sa, p_physp, p_ctxt, block);
 		}
 	}
 
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
  **********************************************************************/
 static void
-__osm_sa_vl_arb_by_comp_mask(IN osm_vlarb_rec_rcv_t * const p_rcv,
+__osm_sa_vl_arb_by_comp_mask(IN osm_sa_t * sa,
 			     IN const osm_port_t * const p_port,
 			     osm_vl_arb_search_ctxt_t * const p_ctxt)
 {
@@ -201,7 +162,7 @@ __osm_sa_vl_arb_by_comp_mask(IN osm_vlarb_rec_rcv_t * const p_rcv,
 	uint8_t num_ports;
 	const osm_physp_t *p_req_physp;
 
-	OSM_LOG_ENTER(p_rcv->p_log, __osm_sa_vl_arb_by_comp_mask);
+	OSM_LOG_ENTER(sa->p_log, __osm_sa_vl_arb_by_comp_mask);
 
 	p_rcvd_rec = p_ctxt->p_rcvd_rec;
 	comp_mask = p_ctxt->comp_mask;
@@ -213,7 +174,7 @@ __osm_sa_vl_arb_by_comp_mask(IN osm_vlarb_rec_rcv_t * const p_rcv,
 	if (p_port->p_node->node_info.node_type != IB_NODE_TYPE_SWITCH) {
 		/* we put it in the comp mask and port num */
 		port_num = p_port->p_physp->port_num;
-		osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+		osm_log(sa->p_log, OSM_LOG_DEBUG,
 			"__osm_sa_vl_arb_by_comp_mask:  "
 			"Using Physical Default Port Number: 0x%X (for End Node)\n",
 			port_num);
@@ -227,12 +188,12 @@ __osm_sa_vl_arb_by_comp_mask(IN osm_vlarb_rec_rcv_t * const p_rcv,
 			/* check that the p_physp is valid, and that the requester
 			   and the p_physp share a pkey. */
 			if (osm_physp_is_valid(p_physp) &&
-			    osm_physp_share_pkey(p_rcv->p_log, p_req_physp,
+			    osm_physp_share_pkey(sa->p_log, p_req_physp,
 						 p_physp))
-				__osm_sa_vl_arb_check_physp(p_rcv, p_physp,
+				__osm_sa_vl_arb_check_physp(sa, p_physp,
 							    p_ctxt);
 		} else {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"__osm_sa_vl_arb_by_comp_mask: ERR 2A03: "
 				"Given Physical Port Number: 0x%X is out of range should be < 0x%X\n",
 				port_num,
@@ -250,14 +211,14 @@ __osm_sa_vl_arb_by_comp_mask(IN osm_vlarb_rec_rcv_t * const p_rcv,
 			/* if the requester and the p_physp don't share a pkey -
 			   continue */
 			if (!osm_physp_share_pkey
-			    (p_rcv->p_log, p_req_physp, p_physp))
+			    (sa->p_log, p_req_physp, p_physp))
 				continue;
 
-			__osm_sa_vl_arb_check_physp(p_rcv, p_physp, p_ctxt);
+			__osm_sa_vl_arb_check_physp(sa, p_physp, p_ctxt);
 		}
 	}
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
 
 /**********************************************************************
@@ -270,16 +231,16 @@ __osm_sa_vl_arb_by_comp_mask_cb(IN cl_map_item_t * const p_map_item,
 	osm_vl_arb_search_ctxt_t *const p_ctxt =
 	    (osm_vl_arb_search_ctxt_t *) context;
 
-	__osm_sa_vl_arb_by_comp_mask(p_ctxt->p_rcv, p_port, p_ctxt);
+	__osm_sa_vl_arb_by_comp_mask(p_ctxt->sa, p_port, p_ctxt);
 }
 
 /**********************************************************************
  **********************************************************************/
 void osm_vlarb_rec_rcv_process(IN void *ctx, IN void *data)
 {
-	osm_vlarb_rec_rcv_t *p_rcv = ctx;
+	osm_sa_t *sa = ctx;
 	osm_madw_t *p_madw = data;
-	const ib_sa_mad_t *p_rcvd_mad;
+	const ib_sa_mad_t *sad_mad;
 	const ib_vl_arb_table_record_t *p_rcvd_rec;
 	const cl_ptr_vector_t *p_tbl;
 	const osm_port_t *p_port = NULL;
@@ -299,55 +260,55 @@ void osm_vlarb_rec_rcv_process(IN void *ctx, IN void *data)
 	ib_net64_t comp_mask;
 	osm_physp_t *p_req_physp;
 
-	CL_ASSERT(p_rcv);
+	CL_ASSERT(sa);
 
-	OSM_LOG_ENTER(p_rcv->p_log, osm_vlarb_rec_rcv_process);
+	OSM_LOG_ENTER(sa->p_log, osm_vlarb_rec_rcv_process);
 
 	CL_ASSERT(p_madw);
 
-	p_rcvd_mad = osm_madw_get_sa_mad_ptr(p_madw);
+	sad_mad = osm_madw_get_sa_mad_ptr(p_madw);
 	p_rcvd_rec =
-	    (ib_vl_arb_table_record_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);
-	comp_mask = p_rcvd_mad->comp_mask;
+	    (ib_vl_arb_table_record_t *) ib_sa_mad_get_payload_ptr(sad_mad);
+	comp_mask = sad_mad->comp_mask;
 
-	CL_ASSERT(p_rcvd_mad->attr_id == IB_MAD_ATTR_VLARB_RECORD);
+	CL_ASSERT(sad_mad->attr_id == IB_MAD_ATTR_VLARB_RECORD);
 
 	/* we only support SubnAdmGet and SubnAdmGetTable methods */
-	if ((p_rcvd_mad->method != IB_MAD_METHOD_GET) &&
-	    (p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE)) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+	if ((sad_mad->method != IB_MAD_METHOD_GET) &&
+	    (sad_mad->method != IB_MAD_METHOD_GETTABLE)) {
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_vlarb_rec_rcv_process: ERR 2A05: "
 			"Unsupported Method (%s)\n",
-			ib_get_sa_method_str(p_rcvd_mad->method));
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+			ib_get_sa_method_str(sad_mad->method));
+		osm_sa_send_error(sa, p_madw,
 				  IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
 	}
 
 	/* update the requester physical port. */
-	p_req_physp = osm_get_physp_by_mad_addr(p_rcv->p_log,
-						p_rcv->p_subn,
+	p_req_physp = osm_get_physp_by_mad_addr(sa->p_log,
+						sa->p_subn,
 						osm_madw_get_mad_addr_ptr
 						(p_madw));
 	if (p_req_physp == NULL) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_vlarb_rec_rcv_process: ERR 2A04: "
 			"Cannot find requester physical port\n");
 		goto Exit;
 	}
 
-	p_vl_arb = (ib_vl_arb_table_t *) ib_sa_mad_get_payload_ptr(p_rcvd_mad);
+	p_vl_arb = (ib_vl_arb_table_t *) ib_sa_mad_get_payload_ptr(sad_mad);
 
 	cl_qlist_init(&rec_list);
 
 	context.p_rcvd_rec = p_rcvd_rec;
 	context.p_list = &rec_list;
-	context.comp_mask = p_rcvd_mad->comp_mask;
-	context.p_rcv = p_rcv;
+	context.comp_mask = sad_mad->comp_mask;
+	context.sa = sa;
 	context.block_num = p_rcvd_rec->block_num;
 	context.p_req_physp = p_req_physp;
 
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sa->p_log, OSM_LOG_DEBUG,
 		"osm_vlarb_rec_rcv_process: "
 		"Got Query Lid:0x%04X(%02X), Port:0x%02X(%02X), Block:0x%02X(%02X)\n",
 		cl_ntoh16(p_rcvd_rec->lid),
@@ -356,7 +317,7 @@ void osm_vlarb_rec_rcv_process(IN void *ctx, IN void *data)
 		p_rcvd_rec->block_num,
 		(comp_mask & IB_VLA_COMPMASK_BLOCK) != 0);
 
-	cl_plock_acquire(p_rcv->p_lock);
+	cl_plock_acquire(sa->p_lock);
 
 	/*
 	   If the user specified a LID, it obviously narrows our
@@ -364,16 +325,16 @@ void osm_vlarb_rec_rcv_process(IN void *ctx, IN void *data)
 	 */
 	if (comp_mask & IB_VLA_COMPMASK_LID) {
 
-		p_tbl = &p_rcv->p_subn->port_lid_tbl;
+		p_tbl = &sa->p_subn->port_lid_tbl;
 
 		CL_ASSERT(cl_ptr_vector_get_size(p_tbl) < 0x10000);
 
 		status =
-		    osm_get_port_by_base_lid(p_rcv->p_subn, p_rcvd_rec->lid,
+		    osm_get_port_by_base_lid(sa->p_subn, p_rcvd_rec->lid,
 					     &p_port);
 		if ((status != IB_SUCCESS) || (p_port == NULL)) {
 			status = IB_NOT_FOUND;
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_vlarb_rec_rcv_process: ERR 2A09: "
 				"No port found with LID 0x%x\n",
 				cl_ntoh16(p_rcvd_rec->lid));
@@ -384,15 +345,15 @@ void osm_vlarb_rec_rcv_process(IN void *ctx, IN void *data)
 		/* if we got a unique port - no need for a port search */
 		if (p_port)
 			/*  this does the loop on all the port phys ports */
-			__osm_sa_vl_arb_by_comp_mask(p_rcv, p_port, &context);
+			__osm_sa_vl_arb_by_comp_mask(sa, p_port, &context);
 		else {
-			cl_qmap_apply_func(&p_rcv->p_subn->port_guid_tbl,
+			cl_qmap_apply_func(&sa->p_subn->port_guid_tbl,
 					   __osm_sa_vl_arb_by_comp_mask_cb,
 					   &context);
 		}
 	}
 
-	cl_plock_release(p_rcv->p_lock);
+	cl_plock_release(sa->p_lock);
 
 	num_rec = cl_qlist_count(&rec_list);
 
@@ -400,18 +361,18 @@ void osm_vlarb_rec_rcv_process(IN void *ctx, IN void *data)
 	 * C15-0.1.30:
 	 * If we do a SubnAdmGet and got more than one record it is an error !
 	 */
-	if (p_rcvd_mad->method == IB_MAD_METHOD_GET) {
+	if (sad_mad->method == IB_MAD_METHOD_GET) {
 		if (num_rec == 0) {
-			osm_sa_send_error(p_rcv->p_resp, p_madw,
+			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_NO_RECORDS);
 			goto Exit;
 		}
 		if (num_rec > 1) {
-			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+			osm_log(sa->p_log, OSM_LOG_ERROR,
 				"osm_vlarb_rec_rcv_process:  ERR 2A08: "
 				"Got more than one record for SubnAdmGet (%u)\n",
 				num_rec);
-			osm_sa_send_error(p_rcv->p_resp, p_madw,
+			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_TOO_MANY_RECORDS);
 
 			/* need to set the mem free ... */
@@ -434,7 +395,7 @@ void osm_vlarb_rec_rcv_process(IN void *ctx, IN void *data)
 	    (MAD_BLOCK_SIZE -
 	     IB_SA_MAD_HDR_SIZE) / sizeof(ib_vl_arb_table_record_t);
 	if (trim_num_rec < num_rec) {
-		osm_log(p_rcv->p_log, OSM_LOG_VERBOSE,
+		osm_log(sa->p_log, OSM_LOG_VERBOSE,
 			"osm_vlarb_rec_rcv_process: "
 			"Number of records:%u trimmed to:%u to fit in one MAD\n",
 			num_rec, trim_num_rec);
@@ -442,12 +403,12 @@ void osm_vlarb_rec_rcv_process(IN void *ctx, IN void *data)
 	}
 #endif
 
-	osm_log(p_rcv->p_log, OSM_LOG_DEBUG,
+	osm_log(sa->p_log, OSM_LOG_DEBUG,
 		"osm_vlarb_rec_rcv_process: "
 		"Returning %u records\n", num_rec);
 
-	if ((p_rcvd_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0)) {
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+	if ((sad_mad->method == IB_MAD_METHOD_GET) && (num_rec == 0)) {
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RECORDS);
 		goto Exit;
 	}
@@ -455,14 +416,14 @@ void osm_vlarb_rec_rcv_process(IN void *ctx, IN void *data)
 	/*
 	 * Get a MAD to reply. Address of Mad is in the received mad_wrapper
 	 */
-	p_resp_madw = osm_mad_pool_get(p_rcv->p_mad_pool,
+	p_resp_madw = osm_mad_pool_get(sa->p_mad_pool,
 				       p_madw->h_bind,
 				       num_rec *
 				       sizeof(ib_vl_arb_table_record_t) +
 				       IB_SA_MAD_HDR_SIZE, &p_madw->mad_addr);
 
 	if (!p_resp_madw) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_vlarb_rec_rcv_process: ERR 2A06: "
 			"osm_mad_pool_get failed\n");
 
@@ -472,7 +433,7 @@ void osm_vlarb_rec_rcv_process(IN void *ctx, IN void *data)
 			free(p_rec_item);
 		}
 
-		osm_sa_send_error(p_rcv->p_resp, p_madw,
+		osm_sa_send_error(sa, p_madw,
 				  IB_SA_MAD_STATUS_NO_RESOURCES);
 		goto Exit;
 	}
@@ -485,7 +446,7 @@ void osm_vlarb_rec_rcv_process(IN void *ctx, IN void *data)
 	   Then copy all records from the list into the response payload.
 	 */
 
-	memcpy(p_resp_sa_mad, p_rcvd_mad, IB_SA_MAD_HDR_SIZE);
+	memcpy(p_resp_sa_mad, sad_mad, IB_SA_MAD_HDR_SIZE);
 	p_resp_sa_mad->method |= IB_MAD_METHOD_RESP_MASK;
 	/* C15-0.1.5 - always return SM_Key = 0 (table 185 p 884) */
 	p_resp_sa_mad->sm_key = 0;
@@ -525,9 +486,9 @@ void osm_vlarb_rec_rcv_process(IN void *ctx, IN void *data)
 	CL_ASSERT(cl_is_qlist_empty(&rec_list));
 
 	status = osm_sa_vendor_send(p_resp_madw->h_bind, p_resp_madw, FALSE,
-				    p_rcv->p_subn);
+				    sa->p_subn);
 	if (status != IB_SUCCESS) {
-		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+		osm_log(sa->p_log, OSM_LOG_ERROR,
 			"osm_vlarb_rec_rcv_process: ERR 2A07: "
 			"osm_sa_vendor_send status = %s\n",
 			ib_get_err_str(status));
@@ -535,5 +496,5 @@ void osm_vlarb_rec_rcv_process(IN void *ctx, IN void *data)
 	}
 
       Exit:
-	OSM_LOG_EXIT(p_rcv->p_log);
+	OSM_LOG_EXIT(sa->p_log);
 }
-- 
1.5.3.4.206.g58ba4




More information about the general mailing list