[ofa-general] [PATCH] opensm: serialize osm_state_mgr_process()
Sasha Khapyorsky
sashak at voltaire.com
Tue Aug 28 04:34:24 PDT 2007
This serializes osm_state_mgr_process() - this is running only from SM
thread. The rest OpenSM components will schedule osm_state_mgr_process()
runs with new function osm_sm_signal(), which only updates the mask of
required for processing event (signals) and wake SM thread up.
This prevents MAD processor dispatchers blocking. Also "big state lock"
(osm_state_mgr.state_lock) is not needed anymore and removed.
Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
opensm/include/Makefile.am | 1 -
opensm/include/opensm/osm_msgdef.h | 15 --
opensm/include/opensm/osm_node_info_rcv.h | 9 -
opensm/include/opensm/osm_port_info_rcv.h | 9 -
opensm/include/opensm/osm_sm.h | 37 ++++-
opensm/include/opensm/osm_sm_state_mgr.h | 11 +--
opensm/include/opensm/osm_sminfo_rcv.h | 9 -
opensm/include/opensm/osm_state_mgr.h | 4 -
opensm/include/opensm/osm_state_mgr_ctrl.h | 224 ---------------------------
opensm/include/opensm/osm_sw_info_rcv.h | 9 -
opensm/include/opensm/osm_sweep_fail_ctrl.h | 16 +-
opensm/include/opensm/osm_trap_rcv.h | 9 -
opensm/opensm/Makefile.am | 2 +-
opensm/opensm/osm_helper.c | 1 -
opensm/opensm/osm_node_info_rcv.c | 12 +-
opensm/opensm/osm_port_info_rcv.c | 7 +-
opensm/opensm/osm_sm.c | 122 ++++++++-------
opensm/opensm/osm_sm_mad_ctrl.c | 27 +---
opensm/opensm/osm_sm_state_mgr.c | 17 +--
opensm/opensm/osm_sminfo_rcv.c | 14 +-
opensm/opensm/osm_state_mgr.c | 24 +---
opensm/opensm/osm_state_mgr_ctrl.c | 115 --------------
opensm/opensm/osm_sw_info_rcv.c | 7 +-
opensm/opensm/osm_sweep_fail_ctrl.c | 7 +-
opensm/opensm/osm_trap_rcv.c | 4 +-
25 files changed, 140 insertions(+), 572 deletions(-)
delete mode 100644 opensm/include/opensm/osm_state_mgr_ctrl.h
delete mode 100644 opensm/opensm/osm_state_mgr_ctrl.c
diff --git a/opensm/include/Makefile.am b/opensm/include/Makefile.am
index ea62507..8b85bd2 100644
--- a/opensm/include/Makefile.am
+++ b/opensm/include/Makefile.am
@@ -87,7 +87,6 @@ EXTRA_DIST = \
$(srcdir)/opensm/osm_vl15intf.h \
$(srcdir)/opensm/osm_drop_mgr.h \
$(srcdir)/opensm/osm_port_info_rcv.h \
- $(srcdir)/opensm/osm_state_mgr_ctrl.h \
$(srcdir)/opensm/osm_perfmgr.h \
$(srcdir)/opensm/osm_perfmgr_db.h \
$(srcdir)/complib/cl_thread_osd.h \
diff --git a/opensm/include/opensm/osm_msgdef.h b/opensm/include/opensm/osm_msgdef.h
index c4e1714..0dee6b9 100644
--- a/opensm/include/opensm/osm_msgdef.h
+++ b/opensm/include/opensm/osm_msgdef.h
@@ -130,27 +130,12 @@ BEGIN_C_DECLS
*
* SOURCE
***********/
-/****d* OpenSM: Dispatcher Messages/OSM_MSG_NO_SMPS_OUTSTANDING
-* NAME
-* OSM_MSG_NO_SMPS_OUTSTANDING
-*
-* DESCRIPTION
-* Message indicating that there are no outstanding SMPs on the subnet.
-*
-* NOTES
-* Sent by: osm_mad_ctrl_t
-* Received by: osm_state_mgr_ctrl_t
-* Delivery notice: no
-*
-* SOURCE
-***********/
enum {
OSM_MSG_NONE = 0,
OSM_MSG_MAD_NODE_INFO,
OSM_MSG_MAD_PORT_INFO,
OSM_MSG_MAD_SWITCH_INFO,
OSM_MSG_MAD_NODE_DESC,
- OSM_MSG_NO_SMPS_OUTSTANDING,
OSM_MSG_MAD_NODE_RECORD,
OSM_MSG_MAD_PORTINFO_RECORD,
OSM_MSG_MAD_SERVICE_RECORD,
diff --git a/opensm/include/opensm/osm_node_info_rcv.h b/opensm/include/opensm/osm_node_info_rcv.h
index 31b89ac..32e3df0 100644
--- a/opensm/include/opensm/osm_node_info_rcv.h
+++ b/opensm/include/opensm/osm_node_info_rcv.h
@@ -56,7 +56,6 @@
#include <opensm/osm_req.h>
#include <opensm/osm_subnet.h>
#include <opensm/osm_log.h>
-#include <opensm/osm_state_mgr.h>
#ifdef __cplusplus
# define BEGIN_C_DECLS extern "C" {
@@ -100,7 +99,6 @@ typedef struct _osm_ni_rcv {
osm_subn_t *p_subn;
osm_req_t *p_gen_req;
osm_log_t *p_log;
- osm_state_mgr_t *p_state_mgr;
cl_plock_t *p_lock;
} osm_ni_rcv_t;
/*
@@ -114,9 +112,6 @@ typedef struct _osm_ni_rcv {
* p_log
* Pointer to the log object.
*
-* p_state_mgr
-* Pointer to the State Manager object.
-*
* p_lock
* Pointer to the serializing lock.
*
@@ -199,7 +194,6 @@ ib_api_status_t osm_ni_rcv_init(IN osm_ni_rcv_t * const p_ctrl,
IN osm_req_t * const p_req,
IN osm_subn_t * const p_subn,
IN osm_log_t * const p_log,
- IN osm_state_mgr_t * const p_state_mgr,
IN cl_plock_t * const p_lock);
/*
* PARAMETERS
@@ -215,9 +209,6 @@ ib_api_status_t osm_ni_rcv_init(IN osm_ni_rcv_t * const p_ctrl,
* p_log
* [in] Pointer to the log object.
*
-* p_state_mgr
-* [in] Pointer to the State Manager object.
-*
* p_lock
* [in] Pointer to the OpenSM serializing lock.
*
diff --git a/opensm/include/opensm/osm_port_info_rcv.h b/opensm/include/opensm/osm_port_info_rcv.h
index 9f3ab22..c4c7d96 100644
--- a/opensm/include/opensm/osm_port_info_rcv.h
+++ b/opensm/include/opensm/osm_port_info_rcv.h
@@ -56,7 +56,6 @@
#include <opensm/osm_vl15intf.h>
#include <opensm/osm_req.h>
#include <opensm/osm_log.h>
-#include <opensm/osm_state_mgr.h>
#ifdef __cplusplus
# define BEGIN_C_DECLS extern "C" {
@@ -100,7 +99,6 @@ typedef struct _osm_pi_rcv {
osm_subn_t *p_subn;
osm_req_t *p_req;
osm_log_t *p_log;
- osm_state_mgr_t *p_state_mgr;
cl_plock_t *p_lock;
} osm_pi_rcv_t;
/*
@@ -114,9 +112,6 @@ typedef struct _osm_pi_rcv {
* p_log
* Pointer to the log object.
*
-* p_state_mgr
-* Pointer to the State Manager object.
-*
* p_lock
* Pointer to the serializing lock.
*
@@ -198,7 +193,6 @@ ib_api_status_t osm_pi_rcv_init(IN osm_pi_rcv_t * const p_ctrl,
IN osm_req_t * const p_req,
IN osm_subn_t * const p_subn,
IN osm_log_t * const p_log,
- IN osm_state_mgr_t * const p_state_mgr,
IN cl_plock_t * const p_lock);
/*
* PARAMETERS
@@ -214,9 +208,6 @@ ib_api_status_t osm_pi_rcv_init(IN osm_pi_rcv_t * const p_ctrl,
* p_log
* [in] Pointer to the log object.
*
-* p_state_mgr
-* [in] Pointer to the state manager object.
-*
* p_lock
* [in] Pointer to the OpenSM serializing lock.
*
diff --git a/opensm/include/opensm/osm_sm.h b/opensm/include/opensm/osm_sm.h
index 4811d2a..341ec5a 100644
--- a/opensm/include/opensm/osm_sm.h
+++ b/opensm/include/opensm/osm_sm.h
@@ -52,11 +52,11 @@
#include <complib/cl_passivelock.h>
#include <complib/cl_event.h>
#include <complib/cl_thread.h>
-#include <opensm/osm_stats.h>
#include <complib/cl_dispatcher.h>
+#include <vendor/osm_vendor.h>
+#include <opensm/osm_stats.h>
#include <opensm/osm_subnet.h>
#include <opensm/osm_vl15intf.h>
-#include <vendor/osm_vendor.h>
#include <opensm/osm_mad_pool.h>
#include <opensm/osm_req.h>
#include <opensm/osm_resp.h>
@@ -66,7 +66,6 @@
#include <opensm/osm_sw_info_rcv.h>
#include <opensm/osm_node_desc_rcv.h>
#include <opensm/osm_sm_mad_ctrl.h>
-#include <opensm/osm_state_mgr_ctrl.h>
#include <opensm/osm_lid_mgr.h>
#include <opensm/osm_ucast_mgr.h>
#include <opensm/osm_link_mgr.h>
@@ -83,6 +82,7 @@
#include <opensm/osm_port.h>
#include <opensm/osm_mcast_mgr.h>
#include <opensm/osm_db.h>
+#include <opensm/osm_state_mgr.h>
#ifdef __cplusplus
# define BEGIN_C_DECLS extern "C" {
@@ -123,9 +123,11 @@ BEGIN_C_DECLS
*
* SYNOPSIS
*/
-typedef struct _osm_sm {
+typedef struct osm_sm {
osm_thread_state_t thread_state;
- cl_event_t signal;
+ unsigned signal_mask;
+ cl_spinlock_t signal_lock;
+ cl_event_t signal_event;
cl_event_t subnet_up_event;
cl_thread_t sweeper;
osm_subn_t *p_subn;
@@ -144,7 +146,6 @@ typedef struct _osm_sm {
osm_nd_rcv_t nd_rcv;
osm_sm_mad_ctrl_t mad_ctrl;
osm_si_rcv_t si_rcv;
- osm_state_mgr_ctrl_t state_mgr_ctrl;
osm_lid_mgr_t lid_mgr;
osm_ucast_mgr_t ucast_mgr;
osm_link_mgr_t link_mgr;
@@ -367,6 +368,30 @@ osm_sm_init(IN osm_sm_t * const p_sm,
* SM object, osm_sm_construct, osm_sm_destroy
*********/
+/****f* OpenSM: SM/osm_sm_signal
+* NAME
+* osm_sm_signal
+*
+* DESCRIPTION
+* Signal event to SM
+*
+* SYNOPSIS
+*/
+void osm_sm_signal(IN osm_sm_t * const p_sm, osm_signal_t signal);
+/*
+* PARAMETERS
+* p_sm
+* [in] Pointer to an osm_sm_t object.
+*
+* signal
+* [in] sm signal number.
+*
+* NOTES
+*
+* SEE ALSO
+* SM object
+*********/
+
/****f* OpenSM: SM/osm_sm_sweep
* NAME
* osm_sm_sweep
diff --git a/opensm/include/opensm/osm_sm_state_mgr.h b/opensm/include/opensm/osm_sm_state_mgr.h
index ab2aaff..b8ee174 100644
--- a/opensm/include/opensm/osm_sm_state_mgr.h
+++ b/opensm/include/opensm/osm_sm_state_mgr.h
@@ -104,7 +104,6 @@ typedef struct _osm_sm_state_mgr {
cl_timer_t polling_timer;
uint32_t retry_number;
ib_net64_t master_guid;
- osm_state_mgr_t *p_state_mgr;
osm_subn_t *p_subn;
osm_req_t *p_req;
osm_log_t *p_log;
@@ -126,9 +125,6 @@ typedef struct _osm_sm_state_mgr {
* master_guid
* Port GUID of master SM.
*
-* p_state_mgr
-* Pointer to the state manager object.
-*
* p_subn
* Pointer to the Subnet object for this subnet.
*
@@ -219,7 +215,6 @@ void osm_sm_state_mgr_destroy(IN osm_sm_state_mgr_t * const p_sm_mgr);
*/
ib_api_status_t
osm_sm_state_mgr_init(IN osm_sm_state_mgr_t * const p_sm_mgr,
- IN osm_state_mgr_t * const p_state_mgr,
IN osm_subn_t * const p_subn,
IN osm_req_t * const p_req, IN osm_log_t * const p_log);
/*
@@ -227,14 +222,10 @@ osm_sm_state_mgr_init(IN osm_sm_state_mgr_t * const p_sm_mgr,
* p_sm_mgr
* [in] Pointer to an osm_sm_state_mgr_t object to initialize.
*
-*
-* p_state_mgr
-* [in] Pointer to the State Manager object.
-*
* p_subn
* [in] Pointer to the Subnet object for this subnet.
*
-* p_req
+* p_req
* [in] Pointer to an osm_req_t object.
*
* p_log
diff --git a/opensm/include/opensm/osm_sminfo_rcv.h b/opensm/include/opensm/osm_sminfo_rcv.h
index 1cbf2e6..9bbe7f8 100644
--- a/opensm/include/opensm/osm_sminfo_rcv.h
+++ b/opensm/include/opensm/osm_sminfo_rcv.h
@@ -56,7 +56,6 @@
#include <opensm/osm_resp.h>
#include <opensm/osm_remote_sm.h>
#include <opensm/osm_log.h>
-#include <opensm/osm_state_mgr.h>
#ifdef __cplusplus
# define BEGIN_C_DECLS extern "C" {
@@ -101,7 +100,6 @@ typedef struct _osm_sminfo_rcv {
osm_stats_t *p_stats;
osm_log_t *p_log;
osm_resp_t *p_resp;
- osm_state_mgr_t *p_state_mgr;
struct _osm_sm_state_mgr *p_sm_state_mgr;
cl_plock_t *p_lock;
} osm_sminfo_rcv_t;
@@ -119,9 +117,6 @@ typedef struct _osm_sminfo_rcv {
* p_resp
* Pointer to the generic MAD responder object.
*
-* p_state_mgr
-* Pointer to the State Manager object.
-*
* p_sm_state_mgr
* Pointer to the SM State Manager object.
*
@@ -207,7 +202,6 @@ ib_api_status_t osm_sminfo_rcv_init(IN osm_sminfo_rcv_t * const p_rcv,
IN osm_stats_t * const p_stats,
IN osm_resp_t * const p_resp,
IN osm_log_t * const p_log,
- IN osm_state_mgr_t * const p_state_mgr,
IN struct _osm_sm_state_mgr *const
p_sm_state_mgr,
IN cl_plock_t * const p_lock);
@@ -228,9 +222,6 @@ ib_api_status_t osm_sminfo_rcv_init(IN osm_sminfo_rcv_t * const p_rcv,
* p_log
* [in] Pointer to the log object.
*
-* p_state_mgr
-* [in] Pointer to the State Manager object.
-*
* p_sm_state_mgr
* [in] Pointer to the SM State Manager object.
*
diff --git a/opensm/include/opensm/osm_state_mgr.h b/opensm/include/opensm/osm_state_mgr.h
index 5b45a91..dada097 100644
--- a/opensm/include/opensm/osm_state_mgr.h
+++ b/opensm/include/opensm/osm_state_mgr.h
@@ -109,7 +109,6 @@ typedef struct _osm_state_mgr {
osm_stats_t *p_stats;
struct _osm_sm_state_mgr *p_sm_state_mgr;
const osm_sm_mad_ctrl_t *p_mad_ctrl;
- cl_spinlock_t state_lock;
cl_spinlock_t idle_lock;
cl_qlist_t idle_time_list;
cl_plock_t *p_lock;
@@ -151,9 +150,6 @@ typedef struct _osm_state_mgr {
* p_mad_ctrl
* Pointer to the SM's MAD Controller object.
*
-* state_lock
-* Spinlock guarding the state and processes.
-*
* p_lock
* lock guarding the subnet object.
*
diff --git a/opensm/include/opensm/osm_state_mgr_ctrl.h b/opensm/include/opensm/osm_state_mgr_ctrl.h
deleted file mode 100644
index 4751335..0000000
--- a/opensm/include/opensm/osm_state_mgr_ctrl.h
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
- *
- * This software is available to you under a choice of one of two
- * licenses. You may choose to be licensed under the terms of the GNU
- * General Public License (GPL) Version 2, available from the file
- * COPYING in the main directory of this source tree, or the
- * OpenIB.org BSD license below:
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the following
- * disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- */
-
-/*
- * Abstract:
- * Declaration of osm_state_mgr_ctrl_t.
- * This object represents a controller that receives the
- * State indication after a subnet sweep.
- * This object is part of the OpenSM family of objects.
- *
- * Environment:
- * Linux User Mode
- *
- * $Revision: 1.4 $
- */
-
-#ifndef _OSM_STATE_MGR_CTRL_H_
-#define _OSM_STATE_MGR_CTRL_H_
-
-#include <complib/cl_dispatcher.h>
-#include <opensm/osm_base.h>
-#include <opensm/osm_state_mgr.h>
-#include <opensm/osm_log.h>
-
-#ifdef __cplusplus
-# define BEGIN_C_DECLS extern "C" {
-# define END_C_DECLS }
-#else /* !__cplusplus */
-# define BEGIN_C_DECLS
-# define END_C_DECLS
-#endif /* __cplusplus */
-
-BEGIN_C_DECLS
-/****h* OpenSM/State Manager Controller
-* NAME
-* State Manager Controller
-*
-* DESCRIPTION
-* The State Manager Controller object encapsulates the information
-* needed to pass the dispatcher message from the dispatcher
-* to the State Manager.
-*
-* The State Manager Controller object is thread safe.
-*
-* This object should be treated as opaque and should be
-* manipulated only through the provided functions.
-*
-* AUTHOR
-* Steve King, Intel
-*
-*********/
-/****s* OpenSM: State Manager Controller/osm_state_mgr_ctrl_t
-* NAME
-* osm_state_mgr_ctrl_t
-*
-* DESCRIPTION
-* State Manager Controller structure.
-*
-* This object should be treated as opaque and should
-* be manipulated only through the provided functions.
-*
-* SYNOPSIS
-*/
-typedef struct _osm_state_mgr_ctrl {
- osm_state_mgr_t *p_mgr;
- osm_log_t *p_log;
- cl_dispatcher_t *p_disp;
- cl_disp_reg_handle_t h_disp;
-
-} osm_state_mgr_ctrl_t;
-/*
-* FIELDS
-* p_mgr
-* Pointer to the State Manager object.
-*
-* p_log
-* Pointer to the log object.
-*
-* p_disp
-* Pointer to the Dispatcher.
-*
-* h_disp
-* Handle returned from dispatcher registration.
-*
-* SEE ALSO
-* State Manager Controller object
-*********/
-
-/****f* OpenSM: State Manager Controller/osm_state_mgr_ctrl_construct
-* NAME
-* osm_state_mgr_ctrl_construct
-*
-* DESCRIPTION
-* This function constructs a State Manager Controller object.
-*
-* SYNOPSIS
-*/
-void osm_state_mgr_ctrl_construct(IN osm_state_mgr_ctrl_t * const p_ctrl);
-/*
-* PARAMETERS
-* p_ctrl
-* [in] Pointer to a State Manager Controller
-* object to construct.
-*
-* RETURN VALUE
-* This function does not return a value.
-*
-* NOTES
-* Allows calling osm_state_mgr_ctrl_init, and osm_state_mgr_ctrl_destroy.
-*
-* Calling osm_state_mgr_ctrl_construct is a prerequisite to calling any
-* other method except osm_state_mgr_ctrl_init.
-*
-* SEE ALSO
-* State Manager Controller object, osm_state_mgr_ctrl_init,
-* osm_state_mgr_ctrl_destroy
-*********/
-
-/****f* OpenSM: State Manager Controller/osm_state_mgr_ctrl_destroy
-* NAME
-* osm_state_mgr_ctrl_destroy
-*
-* DESCRIPTION
-* The osm_state_mgr_ctrl_destroy function destroys the object, releasing
-* all resources.
-*
-* SYNOPSIS
-*/
-void osm_state_mgr_ctrl_destroy(IN osm_state_mgr_ctrl_t * const p_ctrl);
-/*
-* PARAMETERS
-* p_ctrl
-* [in] Pointer to the object to destroy.
-*
-* RETURN VALUE
-* This function does not return a value.
-*
-* NOTES
-* Performs any necessary cleanup of the specified
-* State Manager Controller object.
-* Further operations should not be attempted on the destroyed object.
-* This function should only be called after a call to
-* osm_state_mgr_ctrl_construct or osm_state_mgr_ctrl_init.
-*
-* SEE ALSO
-* State Manager Controller object, osm_state_mgr_ctrl_construct,
-* osm_state_mgr_ctrl_init
-*********/
-
-/****f* OpenSM: State Manager Controller/osm_state_mgr_ctrl_init
-* NAME
-* osm_state_mgr_ctrl_init
-*
-* DESCRIPTION
-* The osm_state_mgr_ctrl_init function initializes a
-* State Manager Controller object for use.
-*
-* SYNOPSIS
-*/
-ib_api_status_t
-osm_state_mgr_ctrl_init(IN osm_state_mgr_ctrl_t * const p_ctrl,
- IN osm_state_mgr_t * const p_mgr,
- IN osm_log_t * const p_log,
- IN cl_dispatcher_t * const p_disp);
-/*
-* PARAMETERS
-* p_ctrl
-* [in] Pointer to an osm_state_mgr_ctrl_t object to initialize.
-*
-* p_mgr
-* [in] Pointer to an osm_state_mgr_t object.
-*
-* p_log
-* [in] Pointer to the log object.
-*
-* p_disp
-* [in] Pointer to the OpenSM central Dispatcher.
-*
-* RETURN VALUES
-* IB_SUCCESS if the State Manager Controller object
-* was initialized successfully.
-*
-* NOTES
-* Allows calling other State Manager Controller methods.
-*
-* SEE ALSO
-* State Manager Controller object, osm_state_mgr_ctrl_construct,
-* osm_state_mgr_ctrl_destroy
-*********/
-
-END_C_DECLS
-#endif /* OSM_STATE_MGR_CTRL_H_ */
diff --git a/opensm/include/opensm/osm_sw_info_rcv.h b/opensm/include/opensm/osm_sw_info_rcv.h
index 724d0d3..2e7cbfa 100644
--- a/opensm/include/opensm/osm_sw_info_rcv.h
+++ b/opensm/include/opensm/osm_sw_info_rcv.h
@@ -54,7 +54,6 @@
#include <opensm/osm_madw.h>
#include <opensm/osm_subnet.h>
#include <opensm/osm_req.h>
-#include <opensm/osm_state_mgr.h>
#include <opensm/osm_log.h>
#ifdef __cplusplus
@@ -99,7 +98,6 @@ typedef struct _osm_si_rcv {
osm_subn_t *p_subn;
osm_log_t *p_log;
osm_req_t *p_req;
- osm_state_mgr_t *p_state_mgr;
cl_plock_t *p_lock;
} osm_si_rcv_t;
/*
@@ -113,9 +111,6 @@ typedef struct _osm_si_rcv {
* p_req
* Pointer to the Request object.
*
-* p_state_mgr
-* Pointer to the State Manager object.
-*
* p_lock
* Pointer to the serializing lock.
*
@@ -198,7 +193,6 @@ ib_api_status_t osm_si_rcv_init(IN osm_si_rcv_t * const p_ctrl,
IN osm_subn_t * const p_subn,
IN osm_log_t * const p_log,
IN osm_req_t * const p_req,
- IN osm_state_mgr_t * const p_state_mgr,
IN cl_plock_t * const p_lock);
/*
* PARAMETERS
@@ -214,9 +208,6 @@ ib_api_status_t osm_si_rcv_init(IN osm_si_rcv_t * const p_ctrl,
* p_req
* [in] Pointer to an osm_req_t object.
*
-* p_state_mgr
-* [in] Pointer to the State Manager object.
-*
* p_lock
* [in] Pointer to the OpenSM serializing lock.
*
diff --git a/opensm/include/opensm/osm_sweep_fail_ctrl.h b/opensm/include/opensm/osm_sweep_fail_ctrl.h
index 579ef58..2fca6eb 100644
--- a/opensm/include/opensm/osm_sweep_fail_ctrl.h
+++ b/opensm/include/opensm/osm_sweep_fail_ctrl.h
@@ -52,7 +52,6 @@
#include <complib/cl_dispatcher.h>
#include <opensm/osm_base.h>
#include <opensm/osm_madw.h>
-#include <opensm/osm_state_mgr.h>
#include <opensm/osm_log.h>
#ifdef __cplusplus
@@ -82,6 +81,7 @@ BEGIN_C_DECLS
* Steve King, Intel
*
*********/
+struct osm_sm;
/****s* OpenSM: Sweep Fail Controller/osm_sweep_fail_ctrl_t
* NAME
* osm_sweep_fail_ctrl_t
@@ -95,20 +95,20 @@ BEGIN_C_DECLS
* SYNOPSIS
*/
typedef struct _osm_sweep_fail_ctrl {
+ struct osm_sm *sm;
osm_log_t *p_log;
- osm_state_mgr_t *p_state_mgr;
cl_dispatcher_t *p_disp;
cl_disp_reg_handle_t h_disp;
} osm_sweep_fail_ctrl_t;
/*
* FIELDS
+* sm
+* Pointer to the sm object.
+*
* p_log
* Pointer to the log object.
*
-* p_sate_mgr
-* Pointer to the state manager object.
-*
* p_disp
* Pointer to the Dispatcher.
*
@@ -194,7 +194,7 @@ void osm_sweep_fail_ctrl_destroy(IN osm_sweep_fail_ctrl_t * const p_ctrl);
ib_api_status_t
osm_sweep_fail_ctrl_init(IN osm_sweep_fail_ctrl_t * const p_ctrl,
IN osm_log_t * const p_log,
- IN osm_state_mgr_t * const p_state_mgr,
+ IN struct osm_sm * const sm,
IN cl_dispatcher_t * const p_disp);
/*
* PARAMETERS
@@ -207,8 +207,8 @@ osm_sweep_fail_ctrl_init(IN osm_sweep_fail_ctrl_t * const p_ctrl,
* p_log
* [in] Pointer to the log object.
*
-* p_state_mgr
-* [in] Pointer to the state manager object.
+* sm
+* [in] Pointer to the sm object.
*
* p_disp
* [in] Pointer to the OpenSM central Dispatcher.
diff --git a/opensm/include/opensm/osm_trap_rcv.h b/opensm/include/opensm/osm_trap_rcv.h
index 393c5b1..e06f6b3 100644
--- a/opensm/include/opensm/osm_trap_rcv.h
+++ b/opensm/include/opensm/osm_trap_rcv.h
@@ -57,7 +57,6 @@
#include <opensm/osm_resp.h>
#include <opensm/osm_remote_sm.h>
#include <opensm/osm_log.h>
-#include <opensm/osm_state_mgr.h>
#ifdef __cplusplus
# define BEGIN_C_DECLS extern "C" {
@@ -102,7 +101,6 @@ typedef struct _osm_trap_rcv {
osm_stats_t *p_stats;
osm_log_t *p_log;
osm_resp_t *p_resp;
- osm_state_mgr_t *p_state_mgr;
cl_plock_t *p_lock;
cl_event_wheel_t trap_aging_tracker;
} osm_trap_rcv_t;
@@ -120,9 +118,6 @@ typedef struct _osm_trap_rcv {
* p_resp
* Pointer to the generic MAD responder object.
*
-* p_state_mgr
-* Pointer to the State Manager object.
-*
* p_lock
* Pointer to the serializing lock.
*
@@ -210,7 +205,6 @@ ib_api_status_t osm_trap_rcv_init(IN osm_trap_rcv_t * const p_rcv,
IN osm_stats_t * const p_stats,
IN osm_resp_t * const p_resp,
IN osm_log_t * const p_log,
- IN osm_state_mgr_t * const p_state_mgr,
IN cl_plock_t * const p_lock);
/*
* PARAMETERS
@@ -229,9 +223,6 @@ ib_api_status_t osm_trap_rcv_init(IN osm_trap_rcv_t * const p_rcv,
* p_log
* [in] Pointer to the log object.
*
-* p_state_mgr
-* [in] Pointer to the State Manager object.
-*
* p_lock
* [in] Pointer to the OpenSM serializing lock.
*
diff --git a/opensm/opensm/Makefile.am b/opensm/opensm/Makefile.am
index 6dfa824..9411f23 100644
--- a/opensm/opensm/Makefile.am
+++ b/opensm/opensm/Makefile.am
@@ -49,7 +49,7 @@ opensm_SOURCES = main.c osm_console.c osm_db_files.c \
osm_sa_sw_info_record.c osm_service.c \
osm_slvl_map_rcv.c osm_sm.c osm_sminfo_rcv.c \
osm_sm_mad_ctrl.c osm_sm_state_mgr.c osm_state_mgr.c \
- osm_state_mgr_ctrl.c osm_subnet.c \
+ osm_subnet.c \
osm_sweep_fail_ctrl.c osm_sw_info_rcv.c osm_switch.c \
osm_prtn.c osm_prtn_config.c osm_qos.c osm_router.c \
osm_trap_rcv.c osm_ucast_mgr.c osm_ucast_updn.c \
diff --git a/opensm/opensm/osm_helper.c b/opensm/opensm/osm_helper.c
index 04e52a8..5dd3955 100644
--- a/opensm/opensm/osm_helper.c
+++ b/opensm/opensm/osm_helper.c
@@ -2141,7 +2141,6 @@ static const char *const __osm_disp_msg_str[] = {
"OSM_MSG_MAD_PORT_INFO",
"OSM_MSG_MAD_SWITCH_INFO",
"OSM_MSG_MAD_NODE_DESC",
- "OSM_MSG_NO_SMPS_OUTSTANDING",
"OSM_MSG_MAD_NODE_RECORD",
"OSM_MSG_MAD_PORTINFO_RECORD",
"OSM_MSG_MAD_SERVICE_RECORD",
diff --git a/opensm/opensm/osm_node_info_rcv.c b/opensm/opensm/osm_node_info_rcv.c
index 33a41fe..0f47859 100644
--- a/opensm/opensm/osm_node_info_rcv.c
+++ b/opensm/opensm/osm_node_info_rcv.c
@@ -65,6 +65,7 @@
#include <opensm/osm_mad_pool.h>
#include <opensm/osm_helper.h>
#include <opensm/osm_msgdef.h>
+#include <opensm/osm_opensm.h>
static void
report_duplicated_guid(IN const osm_ni_rcv_t * const p_rcv,
@@ -867,7 +868,6 @@ osm_ni_rcv_init(IN osm_ni_rcv_t * const p_rcv,
IN osm_req_t * const p_req,
IN osm_subn_t * const p_subn,
IN osm_log_t * const p_log,
- IN osm_state_mgr_t * const p_state_mgr,
IN cl_plock_t * const p_lock)
{
ib_api_status_t status = IB_SUCCESS;
@@ -880,7 +880,6 @@ osm_ni_rcv_init(IN osm_ni_rcv_t * const p_rcv,
p_rcv->p_subn = p_subn;
p_rcv->p_lock = p_lock;
p_rcv->p_gen_req = p_req;
- p_rcv->p_state_mgr = p_state_mgr;
OSM_LOG_EXIT(p_rcv->p_log);
return (status);
@@ -944,13 +943,12 @@ void osm_ni_rcv_process(IN void *context, IN void *data)
CL_PLOCK_RELEASE(p_rcv->p_lock);
/*
- * If we processed a new node - need to signal to the state_mgr that
- * change detected. BUT - we cannot call the osm_state_mgr_process
- * from within the lock of p_rcv->p_lock (can cause a deadlock).
+ * If we processed a new node - need to signal to the SM that
+ * change detected.
*/
if (process_new_flag)
- osm_state_mgr_process(p_rcv->p_state_mgr,
- OSM_SIGNAL_CHANGE_DETECTED);
+ osm_sm_signal(&p_rcv->p_subn->p_osm->sm,
+ OSM_SIGNAL_CHANGE_DETECTED);
Exit:
OSM_LOG_EXIT(p_rcv->p_log);
diff --git a/opensm/opensm/osm_port_info_rcv.c b/opensm/opensm/osm_port_info_rcv.c
index 114a705..fd63cd0 100644
--- a/opensm/opensm/osm_port_info_rcv.c
+++ b/opensm/opensm/osm_port_info_rcv.c
@@ -67,6 +67,7 @@
#include <vendor/osm_vendor_api.h>
#include <opensm/osm_pkey.h>
#include <opensm/osm_remote_sm.h>
+#include <opensm/osm_opensm.h>
/**********************************************************************
**********************************************************************/
@@ -481,7 +482,6 @@ osm_pi_rcv_init(IN osm_pi_rcv_t * const p_rcv,
IN osm_req_t * const p_req,
IN osm_subn_t * const p_subn,
IN osm_log_t * const p_log,
- IN osm_state_mgr_t * const p_state_mgr,
IN cl_plock_t * const p_lock)
{
ib_api_status_t status = IB_SUCCESS;
@@ -493,7 +493,6 @@ osm_pi_rcv_init(IN osm_pi_rcv_t * const p_rcv,
p_rcv->p_subn = p_subn;
p_rcv->p_lock = p_lock;
p_rcv->p_req = p_req;
- p_rcv->p_state_mgr = p_state_mgr;
OSM_LOG_EXIT(p_log);
return (status);
@@ -629,8 +628,8 @@ void osm_pi_rcv_process(IN void *context, IN void *data)
"GUID 0x%" PRIx64 " port 0x%016" PRIx64
", Commencing heavy sweep\n",
cl_ntoh64(node_guid), cl_ntoh64(port_guid));
- osm_state_mgr_process(p_rcv->p_state_mgr,
- OSM_SIGNAL_CHANGE_DETECTED);
+ osm_sm_signal(&p_rcv->p_subn->p_osm->sm,
+ OSM_SIGNAL_CHANGE_DETECTED);
goto Exit;
}
diff --git a/opensm/opensm/osm_sm.c b/opensm/opensm/osm_sm.c
index 6fc9496..c052456 100644
--- a/opensm/opensm/osm_sm.c
+++ b/opensm/opensm/osm_sm.c
@@ -69,50 +69,51 @@
/**********************************************************************
**********************************************************************/
-void __osm_sm_sweeper(IN void *p_ptr)
+static void __osm_sm_sweeper(IN void *p_ptr)
{
ib_api_status_t status;
osm_sm_t *const p_sm = (osm_sm_t *) p_ptr;
+ unsigned signals, i;
OSM_LOG_ENTER(p_sm->p_log, __osm_sm_sweeper);
- if (p_sm->thread_state == OSM_THREAD_STATE_INIT) {
- p_sm->thread_state = OSM_THREAD_STATE_RUN;
- }
-
- /* If the sweep interval was updated before - then run only if
- * it is not zero. */
- while (p_sm->thread_state == OSM_THREAD_STATE_RUN &&
- p_sm->p_subn->opt.sweep_interval != 0) {
- /* do the sweep only if we are in MASTER state */
- if (p_sm->p_subn->sm_state == IB_SMINFO_STATE_MASTER ||
- p_sm->p_subn->sm_state == IB_SMINFO_STATE_DISCOVERING)
- osm_state_mgr_process(&p_sm->state_mgr,
- OSM_SIGNAL_SWEEP);
-
+ while (p_sm->thread_state == OSM_THREAD_STATE_RUN) {
/*
* Wait on the event with a timeout.
* Sweeps may be initiated "off schedule" by simply
* signaling the event.
*/
- status = cl_event_wait_on(&p_sm->signal,
+ status = cl_event_wait_on(&p_sm->signal_event,
+ p_sm->p_subn->opt.sweep_interval ?
p_sm->p_subn->opt.sweep_interval *
- 1000000, TRUE);
-
- if (status == CL_SUCCESS) {
- if (osm_log_is_active(p_sm->p_log, OSM_LOG_DEBUG)) {
- osm_log(p_sm->p_log, OSM_LOG_DEBUG,
- "__osm_sm_sweeper: "
- "Off schedule sweep signalled\n");
- }
- } else {
- if (status != CL_TIMEOUT) {
- osm_log(p_sm->p_log, OSM_LOG_ERROR,
- "__osm_sm_sweeper: ERR 2E01: "
- "Event wait failed (%s)\n",
- CL_STATUS_MSG(status));
- }
+ 1000000 : EVENT_NO_TIMEOUT, TRUE);
+
+ if (status == CL_SUCCESS)
+ osm_log(p_sm->p_log, OSM_LOG_DEBUG,
+ "__osm_sm_sweeper: "
+ "Off schedule sweep signalled\n");
+ else if (status != CL_TIMEOUT) {
+ osm_log(p_sm->p_log, OSM_LOG_ERROR,
+ "__osm_sm_sweeper: ERR 2E01: "
+ "Event wait failed (%s)\n",
+ CL_STATUS_MSG(status));
+ continue;
}
+
+ cl_spinlock_acquire(&p_sm->signal_lock);
+ signals = p_sm->signal_mask;
+ p_sm->signal_mask = 0;
+ cl_spinlock_release(&p_sm->signal_lock);
+
+ /* do the sweep only if we are in MASTER state */
+ if (status == CL_TIMEOUT &&
+ (p_sm->p_subn->sm_state == IB_SMINFO_STATE_MASTER ||
+ p_sm->p_subn->sm_state == IB_SMINFO_STATE_DISCOVERING))
+ p_sm->signal_mask |= 1 << OSM_SIGNAL_SWEEP;
+
+ for (i = 0 ; signals ; signals >>= 1 , i++)
+ if (signals&1)
+ osm_state_mgr_process(&p_sm->state_mgr, i);
}
OSM_LOG_EXIT(p_sm->p_log);
@@ -125,7 +126,8 @@ void osm_sm_construct(IN osm_sm_t * const p_sm)
memset(p_sm, 0, sizeof(*p_sm));
p_sm->thread_state = OSM_THREAD_STATE_NONE;
p_sm->sm_trans_id = OSM_SM_INITIAL_TID_VALUE;
- cl_event_construct(&p_sm->signal);
+ cl_spinlock_construct(&p_sm->signal_lock);
+ cl_event_construct(&p_sm->signal_event);
cl_event_construct(&p_sm->subnet_up_event);
cl_thread_construct(&p_sm->sweeper);
osm_req_construct(&p_sm->req);
@@ -139,7 +141,6 @@ void osm_sm_construct(IN osm_sm_t * const p_sm)
osm_ucast_mgr_construct(&p_sm->ucast_mgr);
osm_link_mgr_construct(&p_sm->link_mgr);
osm_state_mgr_construct(&p_sm->state_mgr);
- osm_state_mgr_ctrl_construct(&p_sm->state_mgr_ctrl);
osm_drop_mgr_construct(&p_sm->drop_mgr);
osm_lft_rcv_construct(&p_sm->lft_rcv);
osm_mft_rcv_construct(&p_sm->mft_rcv);
@@ -174,7 +175,7 @@ void osm_sm_shutdown(IN osm_sm_t * const p_sm)
* Destroy the thread before we tear down the other objects.
*/
if (signal_event)
- cl_event_signal(&p_sm->signal);
+ cl_event_signal(&p_sm->signal_event);
cl_thread_destroy(&p_sm->sweeper);
@@ -196,7 +197,6 @@ void osm_sm_shutdown(IN osm_sm_t * const p_sm)
cl_disp_unregister(p_sm->vla_disp_h);
cl_disp_unregister(p_sm->pkey_disp_h);
osm_sweep_fail_ctrl_destroy(&p_sm->sweep_fail_ctrl);
- osm_state_mgr_ctrl_destroy(&p_sm->state_mgr_ctrl);
OSM_LOG_EXIT(p_sm->p_log);
}
@@ -226,8 +226,9 @@ void osm_sm_destroy(IN osm_sm_t * const p_sm)
osm_state_mgr_destroy(&p_sm->state_mgr);
osm_sm_state_mgr_destroy(&p_sm->sm_state_mgr);
osm_mcast_mgr_destroy(&p_sm->mcast_mgr);
- cl_event_destroy(&p_sm->signal);
+ cl_event_destroy(&p_sm->signal_event);
cl_event_destroy(&p_sm->subnet_up_event);
+ cl_spinlock_destroy(&p_sm->signal_lock);
osm_log(p_sm->p_log, OSM_LOG_SYS, "Exiting SM\n"); /* Format Waived */
OSM_LOG_EXIT(p_sm->p_log);
@@ -259,7 +260,11 @@ osm_sm_init(IN osm_sm_t * const p_sm,
p_sm->p_disp = p_disp;
p_sm->p_lock = p_lock;
- status = cl_event_init(&p_sm->signal, FALSE);
+ status = cl_spinlock_init(&p_sm->signal_lock);
+ if (status != CL_SUCCESS)
+ goto Exit;
+
+ status = cl_event_init(&p_sm->signal_event, FALSE);
if (status != CL_SUCCESS)
goto Exit;
@@ -288,20 +293,20 @@ osm_sm_init(IN osm_sm_t * const p_sm,
status = osm_ni_rcv_init(&p_sm->ni_rcv,
&p_sm->req,
- p_subn, p_log, &p_sm->state_mgr, p_lock);
+ p_subn, p_log, p_lock);
if (status != IB_SUCCESS)
goto Exit;
status = osm_pi_rcv_init(&p_sm->pi_rcv,
&p_sm->req,
- p_subn, p_log, &p_sm->state_mgr, p_lock);
+ p_subn, p_log, p_lock);
if (status != IB_SUCCESS)
goto Exit;
status = osm_si_rcv_init(&p_sm->si_rcv,
p_sm->p_subn,
p_sm->p_log,
- &p_sm->req, &p_sm->state_mgr, p_sm->p_lock);
+ &p_sm->req, p_sm->p_lock);
if (status != IB_SUCCESS)
goto Exit;
@@ -345,12 +350,6 @@ osm_sm_init(IN osm_sm_t * const p_sm,
if (status != IB_SUCCESS)
goto Exit;
- status = osm_state_mgr_ctrl_init(&p_sm->state_mgr_ctrl,
- &p_sm->state_mgr,
- p_sm->p_log, p_sm->p_disp);
- if (status != IB_SUCCESS)
- goto Exit;
-
status = osm_drop_mgr_init(&p_sm->drop_mgr,
p_sm->p_subn,
p_sm->p_log, &p_sm->req, p_sm->p_lock);
@@ -366,7 +365,7 @@ osm_sm_init(IN osm_sm_t * const p_sm,
goto Exit;
status = osm_sweep_fail_ctrl_init(&p_sm->sweep_fail_ctrl,
- p_log, &p_sm->state_mgr, p_disp);
+ p_log, p_sm, p_disp);
if (status != IB_SUCCESS)
goto Exit;
@@ -375,7 +374,6 @@ osm_sm_init(IN osm_sm_t * const p_sm,
p_stats,
&p_sm->resp,
p_log,
- &p_sm->state_mgr,
&p_sm->sm_state_mgr, p_lock);
if (status != IB_SUCCESS)
goto Exit;
@@ -383,13 +381,11 @@ osm_sm_init(IN osm_sm_t * const p_sm,
status = osm_trap_rcv_init(&p_sm->trap_rcv,
p_subn,
p_stats,
- &p_sm->resp, p_log, &p_sm->state_mgr,
- p_lock);
+ &p_sm->resp, p_log, p_lock);
if (status != IB_SUCCESS)
goto Exit;
status = osm_sm_state_mgr_init(&p_sm->sm_state_mgr,
- &p_sm->state_mgr,
p_sm->p_subn, &p_sm->req, p_sm->p_log);
if (status != IB_SUCCESS)
goto Exit;
@@ -480,13 +476,11 @@ osm_sm_init(IN osm_sm_t * const p_sm,
* Now that the component objects are initialized, start
* the sweeper thread if the user wants sweeping.
*/
- if (p_sm->p_subn->opt.sweep_interval) {
- p_sm->thread_state = OSM_THREAD_STATE_INIT;
- status = cl_thread_init(&p_sm->sweeper, __osm_sm_sweeper, p_sm,
- "opensm sweeper");
- if (status != IB_SUCCESS)
- goto Exit;
- }
+ p_sm->thread_state = OSM_THREAD_STATE_RUN;
+ status = cl_thread_init(&p_sm->sweeper, __osm_sm_sweeper, p_sm,
+ "opensm sweeper");
+ if (status != IB_SUCCESS)
+ goto Exit;
Exit:
OSM_LOG_EXIT(p_log);
@@ -495,10 +489,20 @@ osm_sm_init(IN osm_sm_t * const p_sm,
/**********************************************************************
**********************************************************************/
+void osm_sm_signal(osm_sm_t * p_sm, osm_signal_t signal)
+{
+ cl_spinlock_acquire(&p_sm->signal_lock);
+ p_sm->signal_mask |= 1 << signal;
+ cl_event_signal(&p_sm->signal_event);
+ cl_spinlock_release(&p_sm->signal_lock);
+}
+
+/**********************************************************************
+ **********************************************************************/
void osm_sm_sweep(IN osm_sm_t * const p_sm)
{
OSM_LOG_ENTER(p_sm->p_log, osm_sm_sweep);
- osm_state_mgr_process(&p_sm->state_mgr, OSM_SIGNAL_SWEEP);
+ osm_sm_signal(p_sm, OSM_SIGNAL_SWEEP);
OSM_LOG_EXIT(p_sm->p_log);
}
diff --git a/opensm/opensm/osm_sm_mad_ctrl.c b/opensm/opensm/osm_sm_mad_ctrl.c
index 4842f94..2ed973d 100644
--- a/opensm/opensm/osm_sm_mad_ctrl.c
+++ b/opensm/opensm/osm_sm_mad_ctrl.c
@@ -74,7 +74,6 @@ __osm_sm_mad_ctrl_retire_trans_mad(IN osm_sm_mad_ctrl_t * const p_ctrl,
IN osm_madw_t * const p_madw)
{
uint32_t outstanding;
- cl_status_t status;
OSM_LOG_ENTER(p_ctrl->p_log, __osm_sm_mad_ctrl_retire_trans_mad);
@@ -101,30 +100,16 @@ __osm_sm_mad_ctrl_retire_trans_mad(IN osm_sm_mad_ctrl_t * const p_ctrl,
if (outstanding == 0) {
/*
The wire is clean.
- Signal the state manager.
+ Signal the subnet manager.
*/
- if (osm_log_is_active(p_ctrl->p_log, OSM_LOG_DEBUG))
- osm_log(p_ctrl->p_log, OSM_LOG_DEBUG,
- "__osm_sm_mad_ctrl_retire_trans_mad: "
- "Posting Dispatcher message %s\n",
- osm_get_disp_msg_str
- (OSM_MSG_NO_SMPS_OUTSTANDING));
-
- status = cl_disp_post(p_ctrl->h_disp,
- OSM_MSG_NO_SMPS_OUTSTANDING, (void *)
- OSM_SIGNAL_NO_PENDING_TRANSACTIONS, NULL,
- NULL);
+ osm_log(p_ctrl->p_log, OSM_LOG_DEBUG,
+ "__osm_sm_mad_ctrl_retire_trans_mad: "
+ "signal OSM_SIGNAL_NO_PENDING_TRANSACTIONS\n");
- if (status != CL_SUCCESS) {
- osm_log(p_ctrl->p_log, OSM_LOG_ERROR,
- "__osm_sm_mad_ctrl_retire_trans_mad: ERR 3101: "
- "Dispatcher post message failed (%s)\n",
- CL_STATUS_MSG(status));
- goto Exit;
- }
+ osm_sm_signal(&p_ctrl->p_subn->p_osm->sm,
+ OSM_SIGNAL_NO_PENDING_TRANSACTIONS);
}
- Exit:
OSM_LOG_EXIT(p_ctrl->p_log);
}
diff --git a/opensm/opensm/osm_sm_state_mgr.c b/opensm/opensm/osm_sm_state_mgr.c
index 2ff9639..185070f 100644
--- a/opensm/opensm/osm_sm_state_mgr.c
+++ b/opensm/opensm/osm_sm_state_mgr.c
@@ -53,7 +53,6 @@
#include <complib/cl_passivelock.h>
#include <complib/cl_debug.h>
#include <time.h>
-#include <opensm/osm_state_mgr.h>
#include <opensm/osm_madw.h>
#include <opensm/osm_switch.h>
#include <opensm/osm_log.h>
@@ -325,7 +324,7 @@ static void __osm_sm_state_mgr_polling_callback(IN void *context)
osm_log(p_sm_mgr->p_log, OSM_LOG_VERBOSE,
"__osm_sm_state_mgr_polling_callback: "
"Signalling subnet_up_event\n");
- cl_event_signal(p_sm_mgr->p_state_mgr->p_subnet_up_event);
+ cl_event_signal(&p_sm_mgr->p_subn->p_osm->sm.subnet_up_event);
goto Exit;
}
@@ -394,7 +393,6 @@ void osm_sm_state_mgr_destroy(IN osm_sm_state_mgr_t * const p_sm_mgr)
**********************************************************************/
ib_api_status_t
osm_sm_state_mgr_init(IN osm_sm_state_mgr_t * const p_sm_mgr,
- IN osm_state_mgr_t * const p_state_mgr,
IN osm_subn_t * const p_subn,
IN osm_req_t * const p_req, IN osm_log_t * const p_log)
{
@@ -411,7 +409,6 @@ osm_sm_state_mgr_init(IN osm_sm_state_mgr_t * const p_sm_mgr,
p_sm_mgr->p_log = p_log;
p_sm_mgr->p_req = p_req;
p_sm_mgr->p_subn = p_subn;
- p_sm_mgr->p_state_mgr = p_state_mgr;
if (p_subn->opt.sm_inactive) {
/* init the state of the SM to not active */
@@ -575,8 +572,8 @@ osm_sm_state_mgr_process(IN osm_sm_state_mgr_t * const p_sm_mgr,
p_sm_mgr->p_subn->sm_state =
IB_SMINFO_STATE_DISCOVERING;
p_sm_mgr->p_subn->coming_out_of_standby = TRUE;
- osm_state_mgr_process(p_sm_mgr->p_state_mgr,
- OSM_SIGNAL_EXIT_STBY);
+ osm_sm_signal(&p_sm_mgr->p_subn->p_osm->sm,
+ OSM_SIGNAL_EXIT_STBY);
break;
case OSM_SM_SIGNAL_DISABLE:
/*
@@ -609,8 +606,8 @@ osm_sm_state_mgr_process(IN osm_sm_state_mgr_t * const p_sm_mgr,
p_sm_mgr->p_subn->master_sm_base_lid =
p_sm_mgr->p_subn->sm_base_lid;
p_sm_mgr->p_subn->coming_out_of_standby = TRUE;
- osm_state_mgr_process(p_sm_mgr->p_state_mgr,
- OSM_SIGNAL_EXIT_STBY);
+ osm_sm_signal(&p_sm_mgr->p_subn->p_osm->sm,
+ OSM_SIGNAL_EXIT_STBY);
break;
case OSM_SM_SIGNAL_ACKNOWLEDGE:
/*
@@ -671,8 +668,8 @@ osm_sm_state_mgr_process(IN osm_sm_state_mgr_t * const p_sm_mgr,
"Received OSM_SM_SIGNAL_HANDOVER or OSM_SM_SIGNAL_POLLING_TIMEOUT\n");
p_sm_mgr->p_polling_sm = NULL;
p_sm_mgr->p_subn->force_immediate_heavy_sweep = TRUE;
- osm_state_mgr_process(p_sm_mgr->p_state_mgr,
- OSM_SIGNAL_SWEEP);
+ osm_sm_signal(&p_sm_mgr->p_subn->p_osm->sm,
+ OSM_SIGNAL_SWEEP);
break;
case OSM_SM_SIGNAL_HANDOVER_SENT:
/*
diff --git a/opensm/opensm/osm_sminfo_rcv.c b/opensm/opensm/osm_sminfo_rcv.c
index 8d049a8..2367941 100644
--- a/opensm/opensm/osm_sminfo_rcv.c
+++ b/opensm/opensm/osm_sminfo_rcv.c
@@ -90,7 +90,6 @@ osm_sminfo_rcv_init(IN osm_sminfo_rcv_t * const p_rcv,
IN osm_stats_t * const p_stats,
IN osm_resp_t * const p_resp,
IN osm_log_t * const p_log,
- IN osm_state_mgr_t * const p_state_mgr,
IN osm_sm_state_mgr_t * const p_sm_state_mgr,
IN cl_plock_t * const p_lock)
{
@@ -105,7 +104,6 @@ osm_sminfo_rcv_init(IN osm_sminfo_rcv_t * const p_rcv,
p_rcv->p_lock = p_lock;
p_rcv->p_stats = p_stats;
p_rcv->p_resp = p_resp;
- p_rcv->p_state_mgr = p_state_mgr;
p_rcv->p_sm_state_mgr = p_sm_state_mgr;
OSM_LOG_EXIT(p_rcv->p_log);
@@ -387,10 +385,8 @@ __osm_sminfo_rcv_process_set_request(IN const osm_sminfo_rcv_t * const p_rcv,
}
/**********************************************************************
- * Return a signal with which to call the osm_state_mgr_process.
- * This is done since we are locked by p_rcv->p_lock in this function,
- * and thus cannot call osm_state_mgr_process (that locks the state_lock).
- * If return OSM_SIGNAL_NONE - do not call osm_state_mgr_process.
+ * Return a signal with which to call the osm_sm_signal.
+ * If return OSM_SIGNAL_NONE - do not call osm_sm_signal.
**********************************************************************/
static osm_signal_t
__osm_sminfo_rcv_process_get_sm(IN const osm_sminfo_rcv_t * const p_rcv,
@@ -617,10 +613,10 @@ __osm_sminfo_rcv_process_get_response(IN const osm_sminfo_rcv_t * const p_rcv,
CL_PLOCK_RELEASE(p_rcv->p_lock);
/* If process_get_sm_ret_val != OSM_SIGNAL_NONE then we have to signal
- * to the state_mgr with that signal. */
+ * to the SM with that signal. */
if (process_get_sm_ret_val != OSM_SIGNAL_NONE)
- osm_state_mgr_process(p_rcv->p_state_mgr,
- process_get_sm_ret_val);
+ osm_sm_signal(&p_rcv->p_subn->p_osm->sm,
+ process_get_sm_ret_val);
Exit:
OSM_LOG_EXIT(p_rcv->p_log);
diff --git a/opensm/opensm/osm_state_mgr.c b/opensm/opensm/osm_state_mgr.c
index 030d344..c7cd4e8 100644
--- a/opensm/opensm/osm_state_mgr.c
+++ b/opensm/opensm/osm_state_mgr.c
@@ -78,7 +78,6 @@ osm_signal_t osm_qos_setup(IN osm_opensm_t * p_osm);
void osm_state_mgr_construct(IN osm_state_mgr_t * const p_mgr)
{
memset(p_mgr, 0, sizeof(*p_mgr));
- cl_spinlock_construct(&p_mgr->state_lock);
cl_spinlock_construct(&p_mgr->idle_lock);
p_mgr->state = OSM_SM_STATE_INIT;
}
@@ -92,7 +91,6 @@ void osm_state_mgr_destroy(IN osm_state_mgr_t * const p_mgr)
OSM_LOG_ENTER(p_mgr->p_log, osm_state_mgr_destroy);
/* destroy the locks */
- cl_spinlock_destroy(&p_mgr->state_lock);
cl_spinlock_destroy(&p_mgr->idle_lock);
OSM_LOG_EXIT(p_mgr->p_log);
@@ -149,13 +147,6 @@ osm_state_mgr_init(IN osm_state_mgr_t * const p_mgr,
p_mgr->p_lock = p_lock;
p_mgr->p_subnet_up_event = p_subnet_up_event;
- status = cl_spinlock_init(&p_mgr->state_lock);
- if (status != CL_SUCCESS) {
- osm_log(p_mgr->p_log, OSM_LOG_ERROR,
- "osm_state_mgr_init: ERR 3301: "
- "Spinlock init failed (%s)\n", CL_STATUS_MSG(status));
- }
-
cl_qlist_init(&p_mgr->idle_time_list);
status = cl_spinlock_init(&p_mgr->idle_lock);
@@ -1791,16 +1782,6 @@ void osm_state_mgr_process(IN osm_state_mgr_t * const p_mgr,
if (osm_exit_flag)
signal = OSM_SIGNAL_NONE;
- /*
- * The state lock prevents many race conditions from screwing
- * up the state transition process. For example, if an function
- * puts transactions on the wire, the state lock guarantees this
- * loop will see the return code ("DONE PENDING") of the function
- * before the "NO OUTSTANDING TRANSACTIONS" signal is asynchronously
- * received.
- */
- cl_spinlock_acquire(&p_mgr->state_lock);
-
while (signal != OSM_SIGNAL_NONE) {
if (osm_log_is_active(p_mgr->p_log, OSM_LOG_DEBUG)) {
osm_log(p_mgr->p_log, OSM_LOG_DEBUG,
@@ -2779,8 +2760,6 @@ void osm_state_mgr_process(IN osm_state_mgr_t * const p_mgr,
}
- cl_spinlock_release(&p_mgr->state_lock);
-
OSM_LOG_EXIT(p_mgr->p_log);
}
@@ -2814,7 +2793,8 @@ osm_state_mgr_process_idle(IN osm_state_mgr_t * const p_mgr,
cl_qlist_insert_tail(&p_mgr->idle_time_list, &p_idle_item->list_item);
cl_spinlock_release(&p_mgr->idle_lock);
- osm_state_mgr_process(p_mgr, OSM_SIGNAL_IDLE_TIME_PROCESS_REQUEST);
+ osm_sm_signal(&p_mgr->p_subn->p_osm->sm,
+ OSM_SIGNAL_IDLE_TIME_PROCESS_REQUEST);
OSM_LOG_EXIT(p_mgr->p_log);
diff --git a/opensm/opensm/osm_state_mgr_ctrl.c b/opensm/opensm/osm_state_mgr_ctrl.c
deleted file mode 100644
index 53868cf..0000000
--- a/opensm/opensm/osm_state_mgr_ctrl.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
- *
- * This software is available to you under a choice of one of two
- * licenses. You may choose to be licensed under the terms of the GNU
- * General Public License (GPL) Version 2, available from the file
- * COPYING in the main directory of this source tree, or the
- * OpenIB.org BSD license below:
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the following
- * disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- */
-
-/*
- * Abstract:
- * Implementation of osm_state_mgr_ctrl_t.
- * This object represents the State Manager Controller object.
- * This object is part of the opensm family of objects.
- *
- * Environment:
- * Linux User Mode
- *
- * $Revision: 1.5 $
- */
-
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif /* HAVE_CONFIG_H */
-
-#include <string.h>
-#include <opensm/osm_state_mgr_ctrl.h>
-#include <opensm/osm_msgdef.h>
-
-/**********************************************************************
- **********************************************************************/
-void __osm_state_mgr_ctrl_disp_callback(IN void *context, IN void *p_data)
-{
- /* ignore return status when invoked via the dispatcher */
- osm_state_mgr_process(((osm_state_mgr_ctrl_t *) context)->p_mgr,
- (osm_signal_t) (p_data));
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_state_mgr_ctrl_construct(IN osm_state_mgr_ctrl_t * const p_ctrl)
-{
- memset(p_ctrl, 0, sizeof(*p_ctrl));
- p_ctrl->h_disp = CL_DISP_INVALID_HANDLE;
-}
-
-/**********************************************************************
- **********************************************************************/
-void osm_state_mgr_ctrl_destroy(IN osm_state_mgr_ctrl_t * const p_ctrl)
-{
- CL_ASSERT(p_ctrl);
- cl_disp_unregister(p_ctrl->h_disp);
-}
-
-/**********************************************************************
- **********************************************************************/
-ib_api_status_t
-osm_state_mgr_ctrl_init(IN osm_state_mgr_ctrl_t * const p_ctrl,
- IN osm_state_mgr_t * const p_mgr,
- IN osm_log_t * const p_log,
- IN cl_dispatcher_t * const p_disp)
-{
- ib_api_status_t status = IB_SUCCESS;
-
- OSM_LOG_ENTER(p_log, osm_state_mgr_ctrl_init);
-
- osm_state_mgr_ctrl_construct(p_ctrl);
- p_ctrl->p_log = p_log;
-
- p_ctrl->p_mgr = p_mgr;
- p_ctrl->p_disp = p_disp;
-
- p_ctrl->h_disp = cl_disp_register(p_disp,
- OSM_MSG_NO_SMPS_OUTSTANDING,
- __osm_state_mgr_ctrl_disp_callback,
- p_ctrl);
-
- if (p_ctrl->h_disp == CL_DISP_INVALID_HANDLE) {
- osm_log(p_log, OSM_LOG_ERROR,
- "osm_state_mgr_ctrl_init: ERR 3401: "
- "Dispatcher registration failed\n");
- status = IB_INSUFFICIENT_RESOURCES;
- goto Exit;
- }
-
- Exit:
- OSM_LOG_EXIT(p_log);
- return (status);
-}
diff --git a/opensm/opensm/osm_sw_info_rcv.c b/opensm/opensm/osm_sw_info_rcv.c
index a2feadf..5988f8c 100644
--- a/opensm/opensm/osm_sw_info_rcv.c
+++ b/opensm/opensm/osm_sw_info_rcv.c
@@ -59,6 +59,7 @@
#include <opensm/osm_switch.h>
#include <opensm/osm_subnet.h>
#include <opensm/osm_helper.h>
+#include <opensm/osm_opensm.h>
/**********************************************************************
The plock must be held before calling this function.
@@ -519,7 +520,6 @@ osm_si_rcv_init(IN osm_si_rcv_t * const p_rcv,
IN osm_subn_t * const p_subn,
IN osm_log_t * const p_log,
IN osm_req_t * const p_req,
- IN osm_state_mgr_t * const p_state_mgr,
IN cl_plock_t * const p_lock)
{
ib_api_status_t status = IB_SUCCESS;
@@ -531,7 +531,6 @@ osm_si_rcv_init(IN osm_si_rcv_t * const p_rcv,
p_rcv->p_subn = p_subn;
p_rcv->p_lock = p_lock;
p_rcv->p_req = p_req;
- p_rcv->p_state_mgr = p_state_mgr;
OSM_LOG_EXIT(p_rcv->p_log);
return (status);
@@ -614,8 +613,8 @@ void osm_si_rcv_process(IN void *context, IN void *data)
if (__osm_si_rcv_process_existing
(p_rcv, p_node, p_madw)) {
CL_PLOCK_RELEASE(p_rcv->p_lock);
- osm_state_mgr_process(p_rcv->p_state_mgr,
- OSM_SIGNAL_CHANGE_DETECTED);
+ osm_sm_signal(&p_rcv->p_subn->p_osm->sm,
+ OSM_SIGNAL_CHANGE_DETECTED);
goto Exit;
}
}
diff --git a/opensm/opensm/osm_sweep_fail_ctrl.c b/opensm/opensm/osm_sweep_fail_ctrl.c
index 1ddb4f2..cd182c7 100644
--- a/opensm/opensm/osm_sweep_fail_ctrl.c
+++ b/opensm/opensm/osm_sweep_fail_ctrl.c
@@ -50,6 +50,7 @@
#include <string.h>
#include <opensm/osm_sweep_fail_ctrl.h>
#include <opensm/osm_msgdef.h>
+#include <opensm/osm_sm.h>
/**********************************************************************
**********************************************************************/
@@ -63,7 +64,7 @@ void __osm_sweep_fail_ctrl_disp_callback(IN void *context, IN void *p_data)
/*
Notify the state manager that we had a light sweep failure.
*/
- osm_state_mgr_process(p_ctrl->p_state_mgr, OSM_SIGNAL_LIGHT_SWEEP_FAIL);
+ osm_sm_signal(p_ctrl->sm, OSM_SIGNAL_LIGHT_SWEEP_FAIL);
OSM_LOG_EXIT(p_ctrl->p_log);
}
@@ -89,7 +90,7 @@ void osm_sweep_fail_ctrl_destroy(IN osm_sweep_fail_ctrl_t * const p_ctrl)
ib_api_status_t
osm_sweep_fail_ctrl_init(IN osm_sweep_fail_ctrl_t * const p_ctrl,
IN osm_log_t * const p_log,
- IN osm_state_mgr_t * const p_state_mgr,
+ IN osm_sm_t * const sm,
IN cl_dispatcher_t * const p_disp)
{
ib_api_status_t status = IB_SUCCESS;
@@ -99,7 +100,7 @@ osm_sweep_fail_ctrl_init(IN osm_sweep_fail_ctrl_t * const p_ctrl,
osm_sweep_fail_ctrl_construct(p_ctrl);
p_ctrl->p_log = p_log;
p_ctrl->p_disp = p_disp;
- p_ctrl->p_state_mgr = p_state_mgr;
+ p_ctrl->sm = sm;
p_ctrl->h_disp = cl_disp_register(p_disp,
OSM_MSG_LIGHT_SWEEP_FAIL,
diff --git a/opensm/opensm/osm_trap_rcv.c b/opensm/opensm/osm_trap_rcv.c
index babc625..3323a83 100644
--- a/opensm/opensm/osm_trap_rcv.c
+++ b/opensm/opensm/osm_trap_rcv.c
@@ -187,7 +187,6 @@ osm_trap_rcv_init(IN osm_trap_rcv_t * const p_rcv,
IN osm_stats_t * const p_stats,
IN osm_resp_t * const p_resp,
IN osm_log_t * const p_log,
- IN osm_state_mgr_t * const p_state_mgr,
IN cl_plock_t * const p_lock)
{
ib_api_status_t status = IB_SUCCESS;
@@ -201,7 +200,6 @@ osm_trap_rcv_init(IN osm_trap_rcv_t * const p_rcv,
p_rcv->p_lock = p_lock;
p_rcv->p_stats = p_stats;
p_rcv->p_resp = p_resp;
- p_rcv->p_state_mgr = p_state_mgr;
if(cl_event_wheel_init(&p_rcv->trap_aging_tracker)) {
osm_log(p_log, OSM_LOG_ERROR,
@@ -665,7 +663,7 @@ __osm_trap_rcv_process_request(IN osm_trap_rcv_t * const p_rcv,
p_rcv->p_subn->force_immediate_heavy_sweep = TRUE;
}
- osm_state_mgr_process(p_rcv->p_state_mgr, OSM_SIGNAL_SWEEP);
+ osm_sm_signal(&p_rcv->p_subn->p_osm->sm, OSM_SIGNAL_SWEEP);
}
/* If we reached here due to trap 129/130/131 - do not need to do
--
1.5.3.rc2.38.g11308
More information about the general
mailing list