[ofa-general] [PATCH 1/2] OpenSM: Add support for making SM inactive

Hal Rosenstock halr at voltaire.com
Tue Mar 27 18:22:11 PDT 2007


OpenSM: Add support for making SM inactive

Signed-off-by: Hal Rosenstock <halr at voltaire.com>

diff --git a/osm/include/opensm/osm_subnet.h b/osm/include/opensm/osm_subnet.h
index 5d1b023..ade73ac 100644
--- a/osm/include/opensm/osm_subnet.h
+++ b/osm/include/opensm/osm_subnet.h
@@ -283,6 +283,7 @@ typedef struct _osm_subn_opt
   boolean_t                exit_on_fatal;
   boolean_t                honor_guid2lid_file;
   boolean_t                daemon;
+  boolean_t                sm_inactive;
   osm_qos_options_t        qos_options;
   osm_qos_options_t        qos_ca_options;
   osm_qos_options_t        qos_sw0_options;
@@ -464,6 +465,9 @@ typedef struct _osm_subn_opt
 *	daemon
 *		OpenSM will run in daemon mode.
 *
+*	sm_inactive
+*		OpenSM will start with SM in not active state.
+*	
 *	qos_options
 *		Default set of QoS options
 *
diff --git a/osm/opensm/osm_port_info_rcv.c b/osm/opensm/osm_port_info_rcv.c
index 566b927..4a14ee0 100644
--- a/osm/opensm/osm_port_info_rcv.c
+++ b/osm/opensm/osm_port_info_rcv.c
@@ -74,7 +74,8 @@
 static void
 __osm_pi_rcv_set_sm(
   IN const osm_pi_rcv_t* const p_rcv,
-  IN osm_physp_t* const p_physp )
+  IN osm_physp_t* const p_physp,
+  IN boolean_t const is_smdis )
 {
   osm_bind_handle_t h_bind;
   osm_dr_path_t *p_dr_path;
@@ -85,15 +86,27 @@ __osm_pi_rcv_set_sm(
   {
     osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
              "__osm_pi_rcv_set_sm: "
-             "Setting 'IS_SM' bit in port attributes\n" );
+             "Setting '%s' bit in port attributes\n",
+             is_smdis ? "SM_DISAB" : "IS_SM");
   }
 
   p_dr_path = osm_physp_get_dr_path_ptr( p_physp );
   h_bind = osm_dr_path_get_bind_handle( p_dr_path );
-  /*
-    The 'IS_SM' bit isn't already set, so set it.
-  */
-  osm_vendor_set_sm( h_bind, TRUE );
+
+  if (is_smdis)
+  {
+    /*
+      The 'SM_DISAB' bit isn't already set, so set it.
+    */
+    osm_vendor_set_sm( h_bind, FALSE );
+  }
+  else
+  {
+    /*
+      The 'IS_SM' bit isn't already set, so set it.
+    */
+    osm_vendor_set_sm( h_bind, TRUE );
+  }
 
   OSM_LOG_EXIT( p_rcv->p_log );
 }
@@ -112,6 +125,7 @@ __osm_pi_rcv_process_endport(
   uint8_t            rate, mtu;
   cl_qmap_t*         p_sm_tbl;
   osm_remote_sm_t*   p_sm;
+  boolean_t          is_smdis;
 
   OSM_LOG_ENTER( p_rcv->p_log, __osm_pi_rcv_process_endport );
 
@@ -148,15 +162,17 @@ __osm_pi_rcv_process_endport(
 
   if( port_guid == p_rcv->p_subn->sm_port_guid )
   {
+    is_smdis = (p_rcv->p_subn->sm_state == IB_SMINFO_STATE_NOTACTIVE);
     /*
       We received the PortInfo for our own port.
     */
-    if( !(p_pi->capability_mask & IB_PORT_CAP_IS_SM ) )
+    if( (!is_smdis && !(p_pi->capability_mask & IB_PORT_CAP_IS_SM ) ) ||
+        ( is_smdis && !(p_pi->capability_mask & IB_PORT_CAP_SM_DISAB ) ) )
     {
       /*
-        Set the IS_SM bit to indicate our port hosts an SM.
+        Set the IS_SM or SM_DISAB bit to indicate our port hosts an SM.
       */
-      __osm_pi_rcv_set_sm( p_rcv, p_physp );
+      __osm_pi_rcv_set_sm( p_rcv, p_physp, is_smdis );
     }
   }
   else
diff --git a/osm/opensm/osm_sm_state_mgr.c b/osm/opensm/osm_sm_state_mgr.c
index 61492b7..fc68f7e 100644
--- a/osm/opensm/osm_sm_state_mgr.c
+++ b/osm/opensm/osm_sm_state_mgr.c
@@ -449,8 +449,17 @@ osm_sm_state_mgr_init(
    p_sm_mgr->p_subn = p_subn;
    p_sm_mgr->p_state_mgr = p_state_mgr;
 
-   /* init the state of the SM to init */
-   p_sm_mgr->p_subn->sm_state = IB_SMINFO_STATE_INIT;
+   if (p_subn->opt.sm_inactive)
+   {
+     /* init the state of the SM to not active */
+     p_sm_mgr->p_subn->sm_state = IB_SMINFO_STATE_NOTACTIVE;
+     __osm_sm_state_mgr_notactive_msg( p_sm_mgr );
+   }
+   else
+   {
+     /* init the state of the SM to init */
+     p_sm_mgr->p_subn->sm_state = IB_SMINFO_STATE_INIT;
+   }
 
    status = cl_spinlock_init( &p_sm_mgr->state_lock );
    if( status != CL_SUCCESS )
diff --git a/osm/opensm/osm_subnet.c b/osm/opensm/osm_subnet.c
index f3450d1..326b642 100644
--- a/osm/opensm/osm_subnet.c
+++ b/osm/opensm/osm_subnet.c
@@ -461,6 +461,7 @@ osm_subn_set_default_opt(
   p_opt->log_flags = 0;
   p_opt->honor_guid2lid_file = FALSE;
   p_opt->daemon = FALSE;
+  p_opt->sm_inactive = FALSE;
 
   p_opt->dump_files_dir = getenv("OSM_TMP_DIR");
   if (!p_opt->dump_files_dir || !(*p_opt->dump_files_dir))
@@ -1056,6 +1057,10 @@ osm_subn_parse_conf_file(
         "daemon",
         p_key, p_val, &p_opts->daemon);
 
+      __osm_subn_opts_unpack_boolean(
+        "sm_inactive",
+        p_key, p_val, &p_opts->sm_inactive);
+
       subn_parse_qos_options("qos",
         p_key, p_val, &p_opts->qos_options);
 
@@ -1291,8 +1296,11 @@ osm_subn_write_conf_file(
     opts_file,
     "#\n# MISC OPTIONS\n#\n"
     "# Daemon mode\n"
-    "daemon %s\n\n",
-    p_opts->daemon ? "TRUE" : "FALSE"
+    "daemon %s\n\n"
+    "# SM Inactive\n"
+    "sm_inactive %s\n\n",
+    p_opts->daemon ? "TRUE" : "FALSE",
+    p_opts->sm_inactive ? "TRUE" : "FALSE"
     );
 
   fprintf( 






More information about the general mailing list