[openib-general] [PATCH 9/10] osm: QoS in OpenSM

Yevgeny Kliteynik kliteyn at dev.mellanox.co.il
Tue Jan 30 07:32:16 PST 2007


Added new command line option for OSM: '-Y' or '--qos_policy_file'

Signed-off-by: Yevgeny Kliteynik <kliteyn at dev.mellanox.co.il>
---
 osm/include/opensm/osm_subnet.h |    4 ++++
 osm/opensm/main.c               |   10 +++++++++-
 osm/opensm/osm_opensm.c         |   10 ++++++++++
 osm/opensm/osm_subnet.c         |   10 ++++++++++
 4 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/osm/include/opensm/osm_subnet.h b/osm/include/opensm/osm_subnet.h
index a6ffd45..58be7c9 100644
--- a/osm/include/opensm/osm_subnet.h
+++ b/osm/include/opensm/osm_subnet.h
@@ -264,6 +264,7 @@ typedef struct _osm_subn_opt
   char *                   partition_config_file;
   boolean_t                no_partition_enforcement;
   boolean_t                no_qos;
+  char *                   qos_policy_file;
   boolean_t                accum_log_file;
   char *                   console;
   uint16_t                 console_port;
@@ -397,6 +398,9 @@ typedef struct _osm_subn_opt
 *		specified the log file will be truncated upon reaching
 *		this limit.
 *
+*	qos_policy_file
+*		Name of the QoS policy file.
+*
 *	accum_log_file
 *		If TRUE (default) - the log file will be accumulated.
 *		If FALSE - the log file will be erased before starting current opensm run.
diff --git a/osm/opensm/main.c b/osm/opensm/main.c
index 69c940c..8db1938 100644
--- a/osm/opensm/main.c
+++ b/osm/opensm/main.c
@@ -259,6 +259,9 @@ show_usage(void)
   printf( "-Q\n"
           "--qos\n"
           "          This option enables QoS setup.\n\n");
+  printf( "-Y\n"
+          "--qos_policy_file\n"
+          "          This option defines the optional QoS policy file.\n\n");
   printf( "-N\n"
           "--no_part_enforce\n"
           "          This option disables partition enforcement on switch external ports.\n\n");
@@ -551,7 +554,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:L:s:t:a:R:M:U:S:P:NQvVhorcyx";
+  const char * const    short_option = "i:f:ed:g:l:L:s:t:a:R:M:U:S:P:Y:NQvVhorcyx";
 
   /*
     In the array below, the 2nd parameter specified the number
@@ -576,6 +579,7 @@ main(
       {  "Pconfig",       1, NULL, 'P'},
       {  "no_part_enforce",0,NULL, 'N'},
       {  "qos",           0, NULL, 'Q'},
+      {  "qos_policy_file",1, NULL, 'Y'},
       {  "maxsmps",       1, NULL, 'n'},
       {  "console",       1, NULL, 'q'},
       {  "V",             0, NULL, 'V'},
@@ -793,6 +797,10 @@ main(
       opt.no_qos = FALSE;
       break;
 
+    case 'Y':
+      opt.qos_policy_file = optarg;
+      break;
+
     case 'y':
       opt.exit_on_fatal = FALSE;
       printf(" Staying on fatal initialization errors\n");
diff --git a/osm/opensm/osm_opensm.c b/osm/opensm/osm_opensm.c
index 1c17979..52923b7 100644
--- a/osm/opensm/osm_opensm.c
+++ b/osm/opensm/osm_opensm.c
@@ -63,6 +63,7 @@
 #include <opensm/osm_subnet.h>
 #include <opensm/osm_sm.h>
 #include <opensm/osm_vl15intf.h>
+#include <opensm/osm_qos_parser.h>
 
 struct routing_engine_module {
 	const char *name;
@@ -290,6 +291,15 @@ osm_opensm_init(
       goto Exit;
    }
 
+   if( p_opt->qos_policy_file )
+   {
+       if (!osm_qos_parse_policy_file(&p_osm->log,
+                                      p_opt->qos_policy_file))
+          osm_log(&p_osm->log, OSM_LOG_VERBOSE,
+                  "osm_opensm_init: QoS policy file %s parsed successfully\n",
+                  p_opt->qos_policy_file);
+   }
+
  Exit:
    osm_log( &p_osm->log, OSM_LOG_FUNCS, "osm_opensm_init: ]\n" ); /* Format Waived */
    return ( status );
diff --git a/osm/opensm/osm_subnet.c b/osm/opensm/osm_subnet.c
index f2e909b..9905335 100644
--- a/osm/opensm/osm_subnet.c
+++ b/osm/opensm/osm_subnet.c
@@ -470,6 +470,7 @@ osm_subn_set_default_opt(
   p_opt->partition_config_file = OSM_DEFAULT_PARTITION_CONFIG_FILE;
   p_opt->no_partition_enforcement = FALSE;
   p_opt->no_qos = TRUE;
+  p_opt->qos_policy_file = NULL;
   p_opt->accum_log_file = TRUE;
   p_opt->port_profile_switch_nodes = FALSE;
   p_opt->pfn_ui_pre_lid_assign = NULL;
@@ -977,6 +978,9 @@ osm_subn_parse_conf_file(
         "no_qos",
         p_key, p_val, &p_opts->no_qos);
 
+      __osm_subn_opts_unpack_charp(
+        "qos_policy_file", p_key, p_val, &p_opts->qos_policy_file);
+
       __osm_subn_opts_unpack_boolean(
         "accum_log_file",
         p_key, p_val, &p_opts->accum_log_file);
@@ -1281,6 +1285,12 @@ osm_subn_write_conf_file(
     "no_qos %s\n\n",
     p_opts->no_qos ? "TRUE" : "FALSE");
 
+  if (p_opts->qos_policy_file)
+    fprintf( opts_file,
+             "# QoS policy file name\n"
+             "qos_policy_file %s\n\n",
+             p_opts->qos_policy_file);
+
   subn_dump_qos_options(opts_file,
     "QoS default options", "qos", &p_opts->qos_options);
   fprintf(opts_file, "\n");
-- 
1.4.4.1.GIT







More information about the general mailing list