[ofa-general] [PATCH] opensm: send trap144 to master SM when priority is raised

Sasha Khapyorsky sashak at voltaire.com
Sat Oct 25 11:22:56 PDT 2008


When our SM is in Standby state and its priority is increased (via
console command), notify master SM by sending Trap 144.

This trap 144 extension is not in the IBA spec yet, so formally the
feature is not IBA complaint yet. Still be pretty useful in some cases -
for instance when Standby SM is started (with low priority) after Master
and its port doesn't support traps (such as ConnectX), the master will
never pull SMInfo there. In over cases this will speed up handover -
Master SM may be unaware about Standby SM priority changes.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/include/iba/ib_types.h  |    1 +
 opensm/include/opensm/osm_sm.h |    2 ++
 opensm/opensm/osm_console.c    |    3 +--
 opensm/opensm/osm_sm.c         |   11 +++++++++++
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/opensm/include/iba/ib_types.h b/opensm/include/iba/ib_types.h
index 257b19c..6412ea9 100644
--- a/opensm/include/iba/ib_types.h
+++ b/opensm/include/iba/ib_types.h
@@ -7215,6 +7215,7 @@ typedef struct _ib_mad_notice_attr	// Total Size calc  Accumulated
  * Trap 144 masks
  */
 #define TRAP_144_MASK_OTHER_LOCAL_CHANGES      0x01
+#define TRAP_144_MASK_SM_PRIORITY_CHANGE       (CL_HTON16(0x0008))
 #define TRAP_144_MASK_LINK_SPEED_ENABLE_CHANGE (CL_HTON16(0x0004))
 #define TRAP_144_MASK_LINK_WIDTH_ENABLE_CHANGE (CL_HTON16(0x0002))
 #define TRAP_144_MASK_NODE_DESCRIPTION_CHANGE  (CL_HTON16(0x0001))
diff --git a/opensm/include/opensm/osm_sm.h b/opensm/include/opensm/osm_sm.h
index bc87ea6..ebe3dc3 100644
--- a/opensm/include/opensm/osm_sm.h
+++ b/opensm/include/opensm/osm_sm.h
@@ -792,5 +792,7 @@ int osm_send_trap144(osm_sm_t *sm, ib_net16_t local);
 *
 *********/
 
+void osm_set_sm_priority(osm_sm_t *sm, uint8_t priority);
+
 END_C_DECLS
 #endif				/* _OSM_SM_H_ */
diff --git a/opensm/opensm/osm_console.c b/opensm/opensm/osm_console.c
index e3a673a..18168ff 100644
--- a/opensm/opensm/osm_console.c
+++ b/opensm/opensm/osm_console.c
@@ -283,8 +283,7 @@ static void priority_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 				priority);
 		else {
 			fprintf(out, "Setting sm-priority to %d\n", priority);
-			p_osm->subn.opt.sm_priority = (uint8_t) priority;
-			/* Does the SM state machine need a kick now ? */
+			osm_set_sm_priority(&p_osm->sm, (uint8_t)priority);
 		}
 	}
 }
diff --git a/opensm/opensm/osm_sm.c b/opensm/opensm/osm_sm.c
index dff5409..efebf4a 100644
--- a/opensm/opensm/osm_sm.c
+++ b/opensm/opensm/osm_sm.c
@@ -658,3 +658,14 @@ Exit:
 	OSM_LOG_EXIT(p_sm->p_log);
 	return (status);
 }
+
+void osm_set_sm_priority(osm_sm_t *sm, uint8_t priority)
+{
+	uint8_t old_pri = sm->p_subn->opt.sm_priority;
+
+	sm->p_subn->opt.sm_priority = priority;
+
+	if (old_pri < priority &&
+	    sm->p_subn->sm_state == IB_SMINFO_STATE_STANDBY)
+		osm_send_trap144(sm, TRAP_144_MASK_SM_PRIORITY_CHANGE);
+}
-- 
1.6.0.3.517.g759a




More information about the general mailing list