[ofa-general] [PATCH] opensm: cleanup osm_sweep_fail_ctrl

Sasha Khapyorsky sashak at voltaire.com
Mon Aug 4 07:47:45 PDT 2008


Cleanup osm_sweep_fail_ctrl - just similar to other controllers.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/include/opensm/osm_sm.h |    3 +--
 opensm/opensm/Makefile.am      |    4 +---
 opensm/opensm/osm_sm.c         |   17 +++++++++++++----
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/opensm/include/opensm/osm_sm.h b/opensm/include/opensm/osm_sm.h
index ba18b2e..f44f8a2 100644
--- a/opensm/include/opensm/osm_sm.h
+++ b/opensm/include/opensm/osm_sm.h
@@ -58,7 +58,6 @@
 #include <opensm/osm_sm_mad_ctrl.h>
 #include <opensm/osm_lid_mgr.h>
 #include <opensm/osm_ucast_mgr.h>
-#include <opensm/osm_sweep_fail_ctrl.h>
 #include <opensm/osm_port.h>
 #include <opensm/osm_db.h>
 #include <opensm/osm_remote_sm.h>
@@ -131,7 +130,7 @@ typedef struct osm_sm {
 	osm_sm_mad_ctrl_t mad_ctrl;
 	osm_lid_mgr_t lid_mgr;
 	osm_ucast_mgr_t ucast_mgr;
-	osm_sweep_fail_ctrl_t sweep_fail_ctrl;
+	cl_disp_reg_handle_t sweep_fail_disp_h;
 	cl_disp_reg_handle_t ni_disp_h;
 	cl_disp_reg_handle_t pi_disp_h;
 	cl_disp_reg_handle_t nd_disp_h;
diff --git a/opensm/opensm/Makefile.am b/opensm/opensm/Makefile.am
index 0974cac..f5e752f 100644
--- a/opensm/opensm/Makefile.am
+++ b/opensm/opensm/Makefile.am
@@ -52,8 +52,7 @@ opensm_SOURCES = main.c osm_console_io.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_subnet.c \
-		 osm_sweep_fail_ctrl.c osm_sw_info_rcv.c osm_switch.c \
+		 osm_subnet.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 \
 		 osm_ucast_lash.c osm_ucast_file.c osm_ucast_ftree.c \
@@ -138,7 +137,6 @@ opensminclude_HEADERS = \
 	$(srcdir)/../include/opensm/st.h \
 	$(srcdir)/../include/opensm/osm_stats.h \
 	$(srcdir)/../include/opensm/osm_subnet.h \
-	$(srcdir)/../include/opensm/osm_sweep_fail_ctrl.h \
 	$(srcdir)/../include/opensm/osm_switch.h \
 	$(srcdir)/../include/opensm/osm_ucast_mgr.h \
 	$(srcdir)/../include/opensm/osm_vl15intf.h \
diff --git a/opensm/opensm/osm_sm.c b/opensm/opensm/osm_sm.c
index 3548935..98d0b1b 100644
--- a/opensm/opensm/osm_sm.c
+++ b/opensm/opensm/osm_sm.c
@@ -144,6 +144,14 @@ static void sm_sweep(void *arg)
 	cl_timer_start(&sm->sweep_timer, sm->p_subn->opt.sweep_interval * 1000);
 }
 
+static void sweep_fail_process(IN void *context, IN void *p_data)
+{
+	osm_sm_t *sm = context;
+
+	OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "light sweep failed\n");
+	sm->p_subn->force_heavy_sweep = TRUE;
+}
+
 /**********************************************************************
  **********************************************************************/
 void osm_sm_construct(IN osm_sm_t * const p_sm)
@@ -162,7 +170,6 @@ void osm_sm_construct(IN osm_sm_t * const p_sm)
 	osm_sm_mad_ctrl_construct(&p_sm->mad_ctrl);
 	osm_lid_mgr_construct(&p_sm->lid_mgr);
 	osm_ucast_mgr_construct(&p_sm->ucast_mgr);
-	osm_sweep_fail_ctrl_construct(&p_sm->sweep_fail_ctrl);
 }
 
 /**********************************************************************
@@ -209,7 +216,7 @@ void osm_sm_shutdown(IN osm_sm_t * const p_sm)
 	cl_disp_unregister(p_sm->slvl_disp_h);
 	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);
+	cl_disp_unregister(p_sm->sweep_fail_disp_h);
 
 	OSM_LOG_EXIT(p_sm->p_log);
 }
@@ -312,8 +319,10 @@ osm_sm_init(IN osm_sm_t * const p_sm,
 	if (status != IB_SUCCESS)
 		goto Exit;
 
-	status = osm_sweep_fail_ctrl_init(&p_sm->sweep_fail_ctrl, p_sm);
-	if (status != IB_SUCCESS)
+	p_sm->sweep_fail_disp_h = cl_disp_register(p_disp,
+						   OSM_MSG_LIGHT_SWEEP_FAIL,
+						   sweep_fail_process, p_sm);
+	if (p_sm->sweep_fail_disp_h == CL_DISP_INVALID_HANDLE)
 		goto Exit;
 
 	p_sm->ni_disp_h = cl_disp_register(p_disp, OSM_MSG_MAD_NODE_INFO,
-- 
1.5.4.rc2.60.gb2e62




More information about the general mailing list