[ofa-general] [PATCH] opensm: query remote SMs during light sweep

Sasha Khapyorsky sashak at voltaire.com
Wed Aug 6 22:52:58 PDT 2008


Remote statndby SM(s) may change priority, etc.. Somehow it should be
detected - query remotes SMs for SMIfno in a light sweep.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/include/opensm/osm_madw.h |    1 +
 opensm/opensm/osm_sminfo_rcv.c   |   11 +++++++++--
 opensm/opensm/osm_state_mgr.c    |   23 +++++++++++++++++++++++
 3 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/opensm/include/opensm/osm_madw.h b/opensm/include/opensm/osm_madw.h
index 70649a3..fd39272 100644
--- a/opensm/include/opensm/osm_madw.h
+++ b/opensm/include/opensm/osm_madw.h
@@ -249,6 +249,7 @@ typedef struct osm_mft_context {
 typedef struct osm_smi_context {
 	ib_net64_t port_guid;
 	boolean_t set_method;
+	boolean_t light_sweep;
 } osm_smi_context_t;
 /*********/
 
diff --git a/opensm/opensm/osm_sminfo_rcv.c b/opensm/opensm/osm_sminfo_rcv.c
index 47c346d..98c1994 100644
--- a/opensm/opensm/osm_sminfo_rcv.c
+++ b/opensm/opensm/osm_sminfo_rcv.c
@@ -307,7 +307,8 @@ Exit:
  **********************************************************************/
 static osm_signal_t
 __osm_sminfo_rcv_process_get_sm(IN osm_sm_t * sm,
-				IN const osm_remote_sm_t * const p_sm)
+				IN const osm_remote_sm_t * const p_sm,
+				boolean_t light_sweep)
 {
 	const ib_sm_info_t *p_smi;
 
@@ -398,6 +399,11 @@ __osm_sminfo_rcv_process_get_sm(IN osm_sm_t * sm,
 				   is done and all SMs are recongnized. */
 			}
 			break;
+		case IB_SMINFO_STATE_STANDBY:
+			if (light_sweep &&
+			    __osm_sminfo_rcv_remote_sm_is_higher(sm, p_smi))
+				sm->p_subn->force_heavy_sweep = TRUE;
+			break;
 		default:
 			/* any other state - do nothing */
 			break;
@@ -497,7 +503,8 @@ __osm_sminfo_rcv_process_get_response(IN osm_sm_t * sm,
 		/* We already know this SM. Update the SMInfo attribute. */
 		p_sm->smi = *p_smi;
 
-	__osm_sminfo_rcv_process_get_sm(sm, p_sm);
+	__osm_sminfo_rcv_process_get_sm(sm, p_sm,
+					osm_madw_get_smi_context_ptr(p_madw)->light_sweep);
 
 _unlock_and_exit:
 	CL_PLOCK_RELEASE(sm->p_lock);
diff --git a/opensm/opensm/osm_state_mgr.c b/opensm/opensm/osm_state_mgr.c
index 5c5167f..3cdb2cf 100644
--- a/opensm/opensm/osm_state_mgr.c
+++ b/opensm/opensm/osm_state_mgr.c
@@ -49,6 +49,7 @@
 #include <iba/ib_types.h>
 #include <complib/cl_passivelock.h>
 #include <complib/cl_debug.h>
+#include <complib/cl_qmap.h>
 #include <opensm/osm_sm.h>
 #include <opensm/osm_madw.h>
 #include <opensm/osm_switch.h>
@@ -495,6 +496,25 @@ Exit:
 	return (status);
 }
 
+static void query_sm_info(cl_map_item_t *item, void *cxt)
+{
+	osm_madw_context_t context;
+	osm_remote_sm_t *r_sm = cl_item_obj(item, r_sm, map_item);
+	osm_sm_t *sm = cxt;
+	ib_api_status_t ret;
+
+	context.smi_context.port_guid = r_sm->p_port->guid;
+	context.smi_context.set_method = FALSE;
+	context.smi_context.light_sweep = TRUE;
+
+	ret = osm_req_get(sm, osm_physp_get_dr_path_ptr(r_sm->p_port->p_physp),
+			  IB_MAD_ATTR_SM_INFO, 0, CL_DISP_MSGID_NONE, &context);
+	if (ret != IB_SUCCESS)
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3314: "
+			"Failure requesting SMInfo (%s)\n",
+			ib_get_err_str(ret));
+}
+
 /**********************************************************************
  Initiates a lightweight sweep of the subnet.
  Used during normal sweeps after the subnet is up.
@@ -560,6 +580,9 @@ static ib_api_status_t __osm_state_mgr_light_sweep_start(IN osm_sm_t * sm)
 			}
 		}
 	}
+
+	cl_qmap_apply_func(&sm->p_subn->sm_guid_tbl, query_sm_info, sm);
+
 	CL_PLOCK_RELEASE(sm->p_lock);
 
 _exit:
-- 
1.5.5.1.178.g1f811




More information about the general mailing list