[openib-general] [PATCH] OpenSM - honor guid2lid when coming outofstandby - branch patch

Yael Kalka yael at mellanox.co.il
Wed Mar 22 03:54:29 PST 2006


Hi Hal,

Attached is the patch for adding honor_guid2lid flag for the 1.0 branch.

Thanks,
Yael

Signed-off-by:  Yael Kalka <yael at mellanox.co.il>

Index: include/opensm/osm_subnet.h
===================================================================
--- include/opensm/osm_subnet.h	(revision 5955)
+++ include/opensm/osm_subnet.h	(working copy)
@@ -236,6 +236,7 @@ typedef struct _osm_subn_opt
   boolean_t                updn_activate;
   char *                   updn_guid_file;
   boolean_t                exit_on_fatal;
+  boolean_t                honor_guid2lid_file;
 } osm_subn_opt_t;
 /*
 * FIELDS
@@ -380,6 +381,11 @@ typedef struct _osm_subn_opt
 *     a. SM recognizes 2 different nodes with the same guid, or 12x link with
 *        lane reversal badly configured.
 *
+*  honor_guid2lid_file
+*     Always honor the guid2lid file if it exists and is valid. This means that
+*     the file will be honored when SM is coming out of STANDBY. 
+*     By default this is FALSE.
+*
 * SEE ALSO
 *	Subnet object
 *********/
Index: opensm/osm_subnet.c
===================================================================
--- opensm/osm_subnet.c	(revision 5955)
+++ opensm/osm_subnet.c	(working copy)
@@ -423,6 +423,8 @@ osm_subn_set_default_opt(
   p_opt->polling_retry_number = 4;
   p_opt->force_heavy_sweep = FALSE;
   p_opt->log_flags = 0;
+  p_opt->honor_guid2lid_file = FALSE;
+
   p_opt->dump_files_dir = getenv("OSM_TMP_DIR");
   if (!p_opt->dump_files_dir)
     p_opt->dump_files_dir = OSM_DEFAULT_TMP_DIR;
@@ -771,6 +773,11 @@ osm_subn_parse_conf_file(
       __osm_subn_opts_unpack_boolean(
         "exit_on_fatal",
         p_key, p_val, &p_opts->exit_on_fatal);
+
+      __osm_subn_opts_unpack_boolean( 
+        "honor_guid2lid_file",
+        p_key, p_val, &p_opts->honor_guid2lid_file);
+
     }
   }
   fclose(opts_file);
@@ -894,11 +901,15 @@ osm_subn_write_conf_file(
     "# Timeout in [sec] between two polls of active master SM\n"
     "sminfo_polling_timeout %u\n\n"
     "# Number of failing polls of remote SM that declares it dead\n"
-    "polling_retry_number %u\n\n",
+    "polling_retry_number %u\n"
+    "# If true honor the guid2lid file when coming out of standby\n"
+    "# state, if such file exists and is valid\n"
+    "honor_guid2lid_file %s\n\n",
     p_opts->sm_priority,
     p_opts->ignore_other_sm ? "TRUE" : "FALSE",
     p_opts->sminfo_polling_timeout,
-    p_opts->polling_retry_number
+    p_opts->polling_retry_number,
+    p_opts->honor_guid2lid_file ? "TRUE" : "FALSE"
     );
     
   fprintf(
Index: opensm/main.c
===================================================================
--- opensm/main.c	(revision 5955)
+++ opensm/main.c	(working copy)
@@ -218,6 +218,12 @@ show_usage(void)
           "          This option provides the means to define a set of ports\n"
           "          (by guids) that will be ignored by the link load\n"
           "          equalization algorithm.\n\n" );
+  printf( "-x\n"
+          "--honor_guid2lid\n"
+          "          This option forces OpenSM to honor the guid2lid file,\n"
+          "          when it comes out of Standby state, if such file exists\n"
+          "          under OSM_CACHE_DIR, and is valid.\n"
+          "          By default this is FALSE.\n" );
   printf( "-f\n"
           "--log_file\n"
           "          This option defines the log to be the given file.\n"
@@ -515,7 +521,7 @@ main(
   boolean_t             cache_options = FALSE;
   char                 *ignore_guids_file_name = NULL;
   uint32_t              val;
-  const char * const    short_option = "i:f:ed:g:l:s:t:a:uvVhorcy";
+  const char * const    short_option = "i:f:ed:g:l:s:t:a:uvVhorcyx";
 
   /*
     In the array below, the 2nd parameter specified the number
@@ -548,6 +554,7 @@ main(
       {  "add_guid_file", 1, NULL, 'a'},
       {  "cache-options", 0, NULL, 'c'},
       {  "stay_on_fatal", 0, NULL, 'y'},
+      {  "honor_guid2lid", 0, NULL, 'x'},
       {  NULL,            0, NULL,  0 }  /* Required at the end of the array */
     };
 
@@ -775,6 +782,11 @@ main(
       printf (" Caching command line options\n");
       break;
 
+    case 'x':
+      opt.honor_guid2lid_file = TRUE;
+      printf (" Honor guid2lid file, if possible\n");
+      break;
+
     case 'h':
     case '?':
     case ':':
Index: opensm/osm_lid_mgr.c
===================================================================
--- opensm/osm_lid_mgr.c	(revision 5955)
+++ opensm/osm_lid_mgr.c	(working copy)
@@ -359,13 +359,32 @@ __osm_lid_mgr_init_sweep(
     lmc_mask = 0xffff;
 
   /* if we came out of standby we need to discard any previous guid2lid
-     info we might have */
+     info we might have. 
+     Do this only if the honor_guid2lid_file option is FALSE. If not, then
+     need to honor this file. */
   if ( p_mgr->p_subn->coming_out_of_standby == TRUE )
   {
+    if ( p_mgr->p_subn->opt.honor_guid2lid_file == FALSE )
+    {
+      osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
+               "__osm_lid_mgr_init_sweep: "
+               "Ignore guid2lid file when coming out of standby\n");
     osm_db_clear( p_mgr->p_g2l );
     for (lid = 0; lid < cl_ptr_vector_get_size(&p_mgr->used_lids); lid++)
       cl_ptr_vector_set(p_persistent_vec, lid, NULL);
   }
+    else
+    {
+      osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
+               "__osm_lid_mgr_init_sweep: "
+               "Honor current guid2lid file when coming out of standby\n");
+      osm_db_clear( p_mgr->p_g2l );
+      if (osm_db_restore(p_mgr->p_g2l))
+        osm_log( p_mgr->p_log, OSM_LOG_ERROR,
+                 "osm_lid_mgr_init_sweep: ERR 0306: " 
+                 "Error restoring Guid-to-Lid persistant database. Ignoring it\n");
+    }
+  }
 
   /* we need to cleanup the empty ranges list */
   p_item = cl_qlist_remove_head( &p_mgr->free_ranges );




More information about the general mailing list