[openib-general] [PATCH 1/2] opensm: low-level QoS configuration

Sasha Khapyorsky sashak at voltaire.com
Mon May 8 13:03:45 PDT 2006


Trivial low-level QoS configuration parameters description, definition
and processing.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---

 osm/doc/qos-config.txt          |   44 +++++++++++++
 osm/include/opensm/osm_subnet.h |   81 ++++++++++++++++++++++++
 osm/opensm/osm_subnet.c         |  133 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 258 insertions(+), 0 deletions(-)

diff --git a/osm/doc/qos-config.txt b/osm/doc/qos-config.txt
new file mode 100644
index 0000000..d40dfb9
--- /dev/null
+++ b/osm/doc/qos-config.txt
@@ -0,0 +1,44 @@
+Trivial low level QoS configuration proposition.
+===============================================
+
+Basically we have set of QoS related low-level configuration parameters.
+All those parameter names are prefixed by "qos_" string. There is full
+list of such parameters:
+
+  qos_max_vls    - The number of maximum VLs will be on the Subnet
+  qos_high_limit - The limit of High Priority component of VL Arbitration
+                   table (IBA 7.6.9)
+  qos_vlarb_low  - High priority VL Arbitration table (IBA 7.6.9) template.
+  qos_vlarb_high - Low priority VL Arbitration table (IBA 7.6.9) template.
+                   Both VL arbitration templates are pairs of VL and weight.
+  qos_sl2vl      - SL2VL Mapping table (IBA 7.6.6) template. It is a list
+                   of VLs corresponding to SLs 0-15. (Note the VL15 used
+                   here means drop this SL).
+
+Typical default values (hard-coded in OpenSM initialization) are:
+
+  qos_max_vls=15
+  qos_high_limit=0
+  qos_vlarb_low=0:4,1:0,2:0,3:0,4:0,5:0,6:0,7:0
+  qos_vlarb_high=0:0,1:4,2:4,3:4,4:4,5:4,6:4,7:4
+  qos_sl2vl=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,7
+
+The syntax is compatible with rest of OpenSM configuration options and
+values may be stored in OpenSM config file (cached options file).
+
+In addition to above we may to define separate QoS configuration
+parameters sets for various target types. As targets we currently support
+HCA, routers, switch external ports and switch's enhanced port 0. The
+names of such specialized parameters are prefixed by "qos_<type>_"
+string. There is full list of currently supported sets:
+
+  qos_hca_ - QoS configuration parameters set for HCAs.
+  qos_rtr_ - parameters set for routers.
+  qos_sw0_ - parameters set for switches' port 0.
+  qos_swe_ - parameters set for switches' external ports.
+
+Examples:
+
+  qos_sw0_max_vls=2
+  qos_hca_sl2vl=0,1,2,3,5,5,5,12,12,0,
+  qos_swe_high_limit=0
diff --git a/osm/include/opensm/osm_subnet.h b/osm/include/opensm/osm_subnet.h
index 767e598..0da3f0c 100644
--- a/osm/include/opensm/osm_subnet.h
+++ b/osm/include/opensm/osm_subnet.h
@@ -180,6 +180,44 @@ typedef enum _osm_testability_modes
 } osm_testability_modes_t;
 /***********/
 
+/****s* OpenSM: Subnet/osm_qos_options_t
+* NAME
+*	osm_qos_options_t
+*
+* DESCRIPTION
+*	Subnet QoS options structure.  This structure contains the various
+*	QoS specific configuration parameters for the subnet.
+*
+* SYNOPSIS
+*/
+typedef struct _osm_qos_options_t {
+  unsigned max_vls;
+  unsigned high_limit;
+  char *vlarb_high;
+  char *vlarb_low;
+  char *sl2vl;
+} osm_qos_options_t;
+/*
+* FIELDS
+*
+*	max_vls
+*		The number of maximum VLs on the Subnet
+*
+*	high_limit
+*		The limit of High Priority component of VL Arbitration
+*		table (IBA 7.6.9)
+*
+*	vlarb_high
+*		High priority VL Arbitration table template.
+*
+*	vlarb_low
+*		Low priority VL Arbitration table template.
+*
+*	sl2vl
+*		SL2VL Mapping table (IBA 7.6.6) template.
+*
+*********/
+
 /****s* OpenSM: Subnet/osm_subn_opt_t
 * NAME
 *	osm_subn_opt_t
@@ -242,6 +280,10 @@ typedef struct _osm_subn_opt
   char *                   updn_guid_file;
   boolean_t                exit_on_fatal;
   boolean_t                honor_guid2lid_file;
+  osm_qos_options_t        qos_options;
+  osm_qos_options_t        qos_hca_options;
+  osm_qos_options_t        qos_sw0_options;
+  osm_qos_options_t        qos_swe_options;
 } osm_subn_opt_t;
 /*
 * FIELDS
@@ -394,6 +436,18 @@ typedef struct _osm_subn_opt
 *     the file will be honored when SM is coming out of STANDBY. 
 *     By default this is FALSE.
 *
+*  qos_options
+*     Default set of QoS options
+*
+*  qos_hca_options
+*     QoS options for HCA ports
+*
+*  qos_sw0_options
+*     QoS options for switches' port 0
+*
+*  qos_swe_options
+*     QoS options for switches' external ports
+*
 * SEE ALSO
 *	Subnet object
 *********/
@@ -1016,6 +1070,33 @@ osm_subn_parse_conf_file(
 *	osm_subn_is_inited
 *********/
 
+/****f* OpenSM: Subnet/osm_subn_parse_conf_file
+* NAME
+*	osm_subn_rescan_conf_file
+*
+* DESCRIPTION
+*	The osm_subn_rescan_conf_file function parses the configuration
+*	file and update selected subnet options
+*
+* SYNOPSIS
+*/
+void
+osm_subn_rescan_conf_file(
+  IN osm_subn_opt_t* const p_opts );
+/*
+* PARAMETERS
+*
+*	p_opt
+*		[in] Pointer to the subnet options structure.
+*
+* RETURN VALUES
+*	None
+*
+* NOTES
+*  This uses the same file as osm_subn_parse_conf_file()
+*
+*********/
+
 /****f* OpenSM: Subnet/osm_subn_write_conf_file
 * NAME
 *	osm_subn_write_conf_file
diff --git a/osm/opensm/osm_subnet.c b/osm/opensm/osm_subnet.c
index ef64e05..f155df7 100644
--- a/osm/opensm/osm_subnet.c
+++ b/osm/opensm/osm_subnet.c
@@ -398,6 +398,19 @@ osm_get_port_by_guid(
 
 /**********************************************************************
  **********************************************************************/
+static void
+subn_set_default_qos_options(
+  IN osm_qos_options_t *opt)
+{
+  opt->max_vls = 15;
+  opt->high_limit = 0;
+  opt->vlarb_high = "0:4,1:0,2:0,3:0,4:0,5:0,6:0,7:0";
+  opt->vlarb_low = "0:0,1:4,2:4,3:4,4:4,5:4,6:4,7:4";
+  opt->sl2vl = "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,7";
+}
+
+/**********************************************************************
+ **********************************************************************/
 void
 osm_subn_set_default_opt(
   IN osm_subn_opt_t* const p_opt )
@@ -457,6 +470,10 @@ osm_subn_set_default_opt(
   p_opt->updn_activate = FALSE;
   p_opt->updn_guid_file = NULL;
   p_opt->exit_on_fatal = TRUE;
+  subn_set_default_qos_options(&p_opt->qos_options);
+  subn_set_default_qos_options(&p_opt->qos_hca_options);
+  subn_set_default_qos_options(&p_opt->qos_sw0_options);
+  subn_set_default_qos_options(&p_opt->qos_swe_options);
 }
 
 /**********************************************************************
@@ -619,6 +636,95 @@ __osm_subn_opts_unpack_charp(
 
 /**********************************************************************
  **********************************************************************/
+static void
+subn_parse_qos_options(
+  IN const char *prefix,
+  IN char *p_key,
+  IN char *p_val_str,
+  IN osm_qos_options_t *opt)
+{
+  char name[256];
+  snprintf(name, sizeof(name), "%s_max_vls", prefix);
+  __osm_subn_opts_unpack_uint32(name, p_key, p_val_str, &opt->max_vls);
+  snprintf(name, sizeof(name), "%s_high_limit", prefix);
+  __osm_subn_opts_unpack_uint32(name, p_key, p_val_str, &opt->high_limit);
+  snprintf(name, sizeof(name), "%s_vlarb_high", prefix);
+  __osm_subn_opts_unpack_charp(name, p_key, p_val_str, &opt->vlarb_high);
+  snprintf(name, sizeof(name), "%s_vlarb_low", prefix);
+  __osm_subn_opts_unpack_charp(name, p_key, p_val_str, &opt->vlarb_low);
+  snprintf(name, sizeof(name), "%s_sl2vl", prefix);
+  __osm_subn_opts_unpack_charp(name, p_key, p_val_str, &opt->sl2vl);
+}
+
+static int
+subn_dump_qos_options(
+  FILE *file,
+  const char *set_name,
+  const char *prefix,
+  osm_qos_options_t *opt)
+{
+	return fprintf(file, "# %s\n"
+		"%s_max_vls %u\n"
+		"%s_high_limit %u\n"
+		"%s_vlarb_high %s\n"
+		"%s_vlarb_low %s\n"
+		"%s_sl2vl %s\n",
+		set_name,
+		prefix, opt->max_vls,
+		prefix, opt->high_limit,
+		prefix, opt->vlarb_high,
+		prefix, opt->vlarb_low,
+		prefix, opt->sl2vl);
+}
+
+/**********************************************************************
+ **********************************************************************/
+void
+osm_subn_rescan_conf_file(
+  IN osm_subn_opt_t* const p_opts )
+{
+  char *p_cache_dir = getenv("OSM_CACHE_DIR");
+  char file_name[256];
+  FILE *opts_file;
+  char line[1024];
+  char *p_key, *p_val ,*p_last;
+  
+  /* try to open the options file from the cache dir */
+  if (! p_cache_dir) p_cache_dir = OSM_DEFAULT_CACHE_DIR;
+
+  strcpy(file_name, p_cache_dir);
+  strcat(file_name,"opensm.opts");
+  
+  opts_file = fopen(file_name, "r");
+  if (!opts_file) return;
+
+  while (fgets(line, 1023, opts_file) != NULL)
+  {
+    /* get the first token */
+    p_key = strtok_r(line, " \t\n", &p_last);
+    if (p_key)
+    {
+      p_val = strtok_r(NULL, " \t\n", &p_last);
+
+      subn_parse_qos_options("qos",
+        p_key, p_val, &p_opts->qos_options);
+
+      subn_parse_qos_options("qos_hca",
+        p_key, p_val, &p_opts->qos_hca_options);
+
+      subn_parse_qos_options("qos_sw0",
+        p_key, p_val, &p_opts->qos_sw0_options);
+
+      subn_parse_qos_options("qos_swe",
+        p_key, p_val, &p_opts->qos_swe_options);
+
+    }
+  }
+  fclose(opts_file);
+}
+
+/**********************************************************************
+ **********************************************************************/
 void
 osm_subn_parse_conf_file(
   IN osm_subn_opt_t* const p_opts )
@@ -802,6 +908,18 @@ osm_subn_parse_conf_file(
         "honor_guid2lid_file",
         p_key, p_val, &p_opts->honor_guid2lid_file);
 
+      subn_parse_qos_options("qos",
+        p_key, p_val, &p_opts->qos_options);
+
+      subn_parse_qos_options("qos_hca",
+        p_key, p_val, &p_opts->qos_hca_options);
+
+      subn_parse_qos_options("qos_sw0",
+        p_key, p_val, &p_opts->qos_sw0_options);
+
+      subn_parse_qos_options("qos_swe",
+        p_key, p_val, &p_opts->qos_swe_options);
+
     }
   }
   fclose(opts_file);
@@ -997,6 +1115,21 @@ osm_subn_write_conf_file(
     p_opts->exit_on_fatal ? "TRUE" : "FALSE"
     );
   
+  fprintf(
+    opts_file,
+    "#\n# QoS OPTIONS\n#\n\n");
+  subn_dump_qos_options(opts_file,
+    "QoS default options", "qos", &p_opts->qos_options);
+  fprintf(opts_file, "\n");
+  subn_dump_qos_options(opts_file,
+    "QoS HCA options", "qos_hca", &p_opts->qos_hca_options);
+  fprintf(opts_file, "\n");
+  subn_dump_qos_options(opts_file,
+    "QoS Switch Port 0 options", "qos_sw0", &p_opts->qos_sw0_options);
+  fprintf(opts_file, "\n");
+  subn_dump_qos_options(opts_file,
+    "QoS Switch external ports options", "qos_swe", &p_opts->qos_swe_options);
+
   /* optional string attributes ... */
   
   fclose(opts_file);



More information about the general mailing list