Hi Al,

On 15:01 Thu 30 Oct     , Al Chu wrote:
> 
> I found a bunch of qos config parsing issues, listed below:
> 
> 1)
> 
> If the user sets the qos default fields (i.e. qos_high_limit,
> qos_vlarb_high. etc.), but do not have the qos_ca, qos_swe, qos_rtr,
> etc. equivalent fields listed (i.e. qos_ca_high_limit,
> qos_sw0_vlarb_high), the values set in teh qos default fields are not
> loaded into the CAs, switches, etc.  The reason is in qos_build_config()
> we load defaults like this:
> 
> p = opt->vlarb_high ? opt->vlarb_high : dflt->vlarb_high;
> 
> but we always set the fields to something non-NULL.
> 
> static void subn_set_default_qos_options(IN osm_qos_options_t * opt)
> {
>         opt->max_vls = OSM_DEFAULT_QOS_MAX_VLS;
>         opt->high_limit = OSM_DEFAULT_QOS_HIGH_LIMIT;
>         opt->vlarb_high = OSM_DEFAULT_QOS_VLARB_HIGH;
>         opt->vlarb_low = OSM_DEFAULT_QOS_VLARB_LOW;
>         opt->sl2vl = OSM_DEFAULT_QOS_SL2VL;
> }

Yes, we are setting this to the default qos set (if not explicitly
specified by user). So finally we always have valid set. No?

> 2)
> 
> In qos_build_config() we load the high_limit like this:
> 
> cfg->vl_high_limit = (uint8_t) opt->high_limit;
> 
> So there is no way to tell the qos_ca, qos_swe, qos_rtr, etc. high_limit
> options to "go back to" the default high_limit.  It just assumes that
> whatever is input (or was set by default) is what you should use.

Right. What is a limitation here? That an user cannot set this to
"no value"? But she/he can just skip it.

> 3)
> 
> Some fields like qos_vlarb_high are assumed to be correctly set and can
> segfault opensm.

qos_build_config() assumes that valid parameters are used. And we are
using this this way (I hope :)) (finally it is not library API).

> The attached patch fixes these up.  Obviously there's tons of ways to
> do this.  I decided to ...
> 
> A) only initialization qos_options to the real defaults
> 
> B) init all qos_*_options to sentinel values (-1, NULL, etc.) to
> indicate it should use the configured defaults if they aren't set by the
> user.  The high_limit was changed from an unsigned to an int b/c 0 is a
> valid high_limit value.
> 
> C) verify that the default qos inputs are definitely correct (i.e. can't
> be NULL).  Reset to hard coded defaults if need be.
> 
> D) load the default vs. non-default appropriately in QoS.

And I see that we have here much more sometimes not-trivial flows and
default values are spread over many places... :(

Sasha

> 
> Al
> 
> P.S.  This patch does not rely on my previous "remove qos_max_vls
> config" patch.  I assume we're keeping the max_vls fields in this patch.
> 
> -- 
> Albert Chu
> [EMAIL PROTECTED]
> Computer Scientist
> High Performance Systems Division
> Lawrence Livermore National Laboratory

> From 00a15a1797b79fd5e3298d98742b6da3613fb9c3 Mon Sep 17 00:00:00 2001
> From: root <[EMAIL PROTECTED](none)>
> Date: Thu, 30 Oct 2008 09:32:29 -0700
> Subject: [PATCH] fix qos config parsing bugs
> 
> 
> Signed-off-by: root <[EMAIL PROTECTED](none)>
> ---
>  opensm/include/opensm/osm_subnet.h |   12 +-
>  opensm/opensm/osm_qos.c            |    6 +-
>  opensm/opensm/osm_subnet.c         |  467 
> ++++++++++++++++++++++--------------
>  3 files changed, 293 insertions(+), 192 deletions(-)
> 
> diff --git a/opensm/include/opensm/osm_subnet.h 
> b/opensm/include/opensm/osm_subnet.h
> index 7259587..11063b7 100644
> --- a/opensm/include/opensm/osm_subnet.h
> +++ b/opensm/include/opensm/osm_subnet.h
> @@ -99,7 +99,7 @@ struct osm_qos_policy;
>  */
>  typedef struct osm_qos_options {
>       unsigned max_vls;
> -     unsigned high_limit;
> +     int high_limit;
>       char *vlarb_high;
>       char *vlarb_low;
>       char *sl2vl;
> @@ -108,20 +108,20 @@ typedef struct osm_qos_options {
>  * FIELDS
>  *
>  *    max_vls
> -*            The number of maximum VLs on the Subnet
> +*            The number of maximum VLs on the Subnet (0 == use default)
>  *
>  *    high_limit
>  *            The limit of High Priority component of VL Arbitration
> -*            table (IBA 7.6.9)
> +*            table (IBA 7.6.9) (-1 == use default)
>  *
>  *    vlarb_high
> -*            High priority VL Arbitration table template.
> +*            High priority VL Arbitration table template. (NULL == use 
> default)
>  *
>  *    vlarb_low
> -*            Low priority VL Arbitration table template.
> +*            Low priority VL Arbitration table template. (NULL == use 
> default)
>  *
>  *    sl2vl
> -*            SL2VL Mapping table (IBA 7.6.6) template.
> +*            SL2VL Mapping table (IBA 7.6.6) template. (NULL == use default)
>  *
>  *********/
>  
> diff --git a/opensm/opensm/osm_qos.c b/opensm/opensm/osm_qos.c
> index 1679ae0..b451c25 100644
> --- a/opensm/opensm/osm_qos.c
> +++ b/opensm/opensm/osm_qos.c
> @@ -382,7 +382,11 @@ static void qos_build_config(struct qos_config *cfg,
>       memset(cfg, 0, sizeof(*cfg));
>  
>       cfg->max_vls = opt->max_vls > 0 ? opt->max_vls : dflt->max_vls;
> -     cfg->vl_high_limit = (uint8_t) opt->high_limit;
> +
> +     if (opt->high_limit >= 0)
> +             cfg->vl_high_limit = (uint8_t) opt->high_limit;
> +     else
> +             cfg->vl_high_limit = (uint8_t) dflt->high_limit;
>  
>       p = opt->vlarb_high ? opt->vlarb_high : dflt->vlarb_high;
>       for (i = 0; i < 2 * IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK; i++) {
> diff --git a/opensm/opensm/osm_subnet.c b/opensm/opensm/osm_subnet.c
> index 0422d0f..ab2ff9c 100644
> --- a/opensm/opensm/osm_subnet.c
> +++ b/opensm/opensm/osm_subnet.c
> @@ -370,6 +370,15 @@ static void subn_set_default_qos_options(IN 
> osm_qos_options_t * opt)
>       opt->sl2vl = OSM_DEFAULT_QOS_SL2VL;
>  }
>  
> +static void subn_init_qos_options(IN osm_qos_options_t * opt)
> +{
> +     opt->max_vls = 0;
> +     opt->high_limit = -1;
> +     opt->vlarb_high = NULL;
> +     opt->vlarb_low = NULL;
> +     opt->sl2vl = NULL;
> +}
> +
>  /**********************************************************************
>   **********************************************************************/
>  void osm_subn_set_default_opt(IN osm_subn_opt_t * const p_opt)
> @@ -458,10 +467,10 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * const 
> p_opt)
>       p_opt->prefix_routes_file = OSM_DEFAULT_PREFIX_ROUTES_FILE;
>       p_opt->consolidate_ipv6_snm_req = FALSE;
>       subn_set_default_qos_options(&p_opt->qos_options);
> -     subn_set_default_qos_options(&p_opt->qos_ca_options);
> -     subn_set_default_qos_options(&p_opt->qos_sw0_options);
> -     subn_set_default_qos_options(&p_opt->qos_swe_options);
> -     subn_set_default_qos_options(&p_opt->qos_rtr_options);
> +     subn_init_qos_options(&p_opt->qos_ca_options);
> +     subn_init_qos_options(&p_opt->qos_sw0_options);
> +     subn_init_qos_options(&p_opt->qos_swe_options);
> +     subn_init_qos_options(&p_opt->qos_rtr_options);
>  }
>  
>  /**********************************************************************
> @@ -497,6 +506,7 @@ opts_unpack_net64(IN char *p_req_key,
>       }
>  }
>  
> +
>  /**********************************************************************
>   **********************************************************************/
>  static void
> @@ -511,6 +521,20 @@ opts_unpack_uint32(IN char *p_req_key,
>               }
>       }
>  }
> +/**********************************************************************
> + **********************************************************************/
> +static void
> +opts_unpack_int32(IN char *p_req_key,
> +               IN char *p_key, IN char *p_val_str, IN int32_t * p_val)
> +{
> +     if (!strcmp(p_req_key, p_key)) {
> +             int32_t val = strtol(p_val_str, NULL, 0);
> +             if (val != *p_val) {
> +                     log_config_value(p_key, "%d", val);
> +                     *p_val = val;
> +             }
> +     }
> +}
>  
>  /**********************************************************************
>   **********************************************************************/
> @@ -641,7 +665,7 @@ subn_parse_qos_options(IN const char *prefix,
>       snprintf(name, sizeof(name), "%s_max_vls", prefix);
>       opts_unpack_uint32(name, p_key, p_val_str, &opt->max_vls);
>       snprintf(name, sizeof(name), "%s_high_limit", prefix);
> -     opts_unpack_uint32(name, p_key, p_val_str, &opt->high_limit);
> +     opts_unpack_int32(name, p_key, p_val_str, &opt->high_limit);
>       snprintf(name, sizeof(name), "%s_vlarb_high", prefix);
>       opts_unpack_charp(name, p_key, p_val_str, &opt->vlarb_high);
>       snprintf(name, sizeof(name), "%s_vlarb_low", prefix);
> @@ -653,7 +677,9 @@ subn_parse_qos_options(IN const char *prefix,
>  static int
>  subn_dump_qos_options(FILE * file,
>                     const char *set_name,
> -                   const char *prefix, osm_qos_options_t * opt)
> +                   const char *prefix, 
> +                   osm_qos_options_t * opt,
> +                   osm_qos_options_t * dflt)
>  {
>       return fprintf(file, "# %s\n"
>                      "%s_max_vls %u\n"
> @@ -662,10 +688,11 @@ subn_dump_qos_options(FILE * file,
>                      "%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);
> +                    prefix, opt->max_vls > 0 ? opt->max_vls : dflt->max_vls,
> +                    prefix, opt->high_limit >= 0 ? opt->high_limit : 
> dflt->high_limit,
> +                    prefix, opt->vlarb_high ? opt->vlarb_high : 
> dflt->vlarb_high,
> +                    prefix, opt->vlarb_low ? opt->vlarb_low : 
> dflt->vlarb_low, 
> +                    prefix, opt->sl2vl ? opt->sl2vl : dflt->sl2vl);
>  }
>  
>  /**********************************************************************
> @@ -833,169 +860,182 @@ int osm_subn_rescan_conf_files(IN osm_subn_t * const 
> p_subn)
>  /**********************************************************************
>   **********************************************************************/
>  
> -static void subn_verify_max_vls(IN unsigned *max_vls, IN char *key)
> +static void subn_verify_max_vls(IN unsigned *max_vls, IN char *key, IN 
> unsigned dflt)
>  {
>       char buff[128];
>  
> -     if (*max_vls > 15) {
> +     if (!(*max_vls) || *max_vls > 15) {
>               sprintf(buff, " Invalid Cached Option:%s=%u:"
> -                     "Using Default:%u\n",
> -                     key, *max_vls, OSM_DEFAULT_QOS_MAX_VLS);
> +                     "Using Default\n",
> +                     key, *max_vls);
>               printf(buff);
>               cl_log_event("OpenSM", CL_LOG_INFO, buff, NULL, 0);
> -             *max_vls = OSM_DEFAULT_QOS_MAX_VLS;
> +             *max_vls = dflt;
>       }
>  }
>  
> -static void subn_verify_high_limit(IN unsigned *high_limit, IN char *key)
> +static void subn_verify_high_limit(IN int *high_limit, IN char *key, IN int 
> dflt)
>  {
>       char buff[128];
>  
> -     if (*high_limit > 255) {
> -             sprintf(buff, " Invalid Cached Option:%s=%u:"
> -                     "Using Default:%u\n",
> -                     key, *high_limit, OSM_DEFAULT_QOS_HIGH_LIMIT);
> +     if (*high_limit < 0 || *high_limit > 255) {
> +             sprintf(buff, " Invalid Cached Option:%s=%d:"
> +                     "Using Default\n", key, *high_limit);
>               printf(buff);
>               cl_log_event("OpenSM", CL_LOG_INFO, buff, NULL, 0);
> -             *high_limit = OSM_DEFAULT_QOS_HIGH_LIMIT;
> +             *high_limit = dflt;
>       }
>  }
>  
> -static void subn_verify_vlarb(IN char *vlarb, IN char *key)
> +static void subn_verify_vlarb(IN char **vlarb, IN char *key, IN char *dflt)
>  {
> -     if (vlarb) {
> -             char buff[128];
> -             char *str, *tok, *end, *ptr;
> -             int count = 0;
> -
> -             str = (char *)malloc(strlen(vlarb) + 1);
> -             strcpy(str, vlarb);
> -
> -             tok = strtok_r(str, ",\n", &ptr);
> -             while (tok) {
> -                     char *vl_str, *weight_str;
> -
> -                     vl_str = tok;
> -                     weight_str = strchr(tok, ':');
> -
> -                     if (weight_str) {
> -                             long vl, weight;
> -
> -                             *weight_str = '\0';
> -                             weight_str++;
> -
> -                             vl = strtol(vl_str, &end, 0);
> -
> -                             if (*end) {
> -                                     sprintf(buff,
> -                                             " Warning: Cached Option 
> %s:vl=%s improperly formatted\n",
> -                                             key, vl_str);
> -                                     printf(buff);
> -                                     cl_log_event("OpenSM", CL_LOG_INFO,
> -                                                  buff, NULL, 0);
> -                             } else if (vl < 0 || vl > 14) {
> -                                     sprintf(buff,
> -                                             " Warning: Cached Option 
> %s:vl=%ld out of range\n",
> -                                             key, vl);
> -                                     printf(buff);
> -                                     cl_log_event("OpenSM", CL_LOG_INFO,
> -                                                  buff, NULL, 0);
> -                             }
> -
> -                             weight = strtol(weight_str, &end, 0);
> -
> -                             if (*end) {
> -                                     sprintf(buff,
> -                                             " Warning: Cached Option 
> %s:weight=%s improperly formatted\n",
> -                                             key, weight_str);
> -                                     printf(buff);
> -                                     cl_log_event("OpenSM", CL_LOG_INFO,
> -                                                  buff, NULL, 0);
> -                             } else if (weight < 0 || weight > 255) {
> -                                     sprintf(buff,
> -                                             " Warning: Cached Option 
> %s:weight=%ld out of range\n",
> -                                             key, weight);
> -                                     printf(buff);
> -                                     cl_log_event("OpenSM", CL_LOG_INFO,
> -                                                  buff, NULL, 0);
> -                             }
> -                     } else {
> -                             sprintf(buff,
> -                                     " Warning: Cached Option 
> %s:vl:weight=%s improperly formatted\n",
> -                                     key, tok);
> -                             printf(buff);
> -                             cl_log_event("OpenSM", CL_LOG_INFO, buff, NULL,
> -                                          0);
> -                     }
> +     char buff[128];
> +     char *str, *tok, *end, *ptr;
> +     int count = 0;
>  
> -                     count++;
> -                     tok = strtok_r(NULL, ",\n", &ptr);
> -             }
> +     if (*vlarb == NULL) {
> +             sprintf(buff, " Invalid Cached Option:%s:"
> +                     "Using Default\n", key);
> +             printf(buff);
> +             cl_log_event("OpenSM", CL_LOG_INFO, buff, NULL, 0);
> +             (*vlarb) = dflt;                        
> +             return;
> +     }
>  
> -             if (count > 64) {
> -                     sprintf(buff,
> -                             " Warning: Cached Option %s: > 64 listed: "
> -                             "excess vl:weight pairs will be dropped\n",
> -                             key);
> -                     printf(buff);
> -                     cl_log_event("OpenSM", CL_LOG_INFO, buff, NULL, 0);
> -             }
> +     str = (char *)malloc(strlen(*vlarb) + 1);
> +     strcpy(str, *vlarb);
>  
> -             free(str);
> -     }
> -}
> +     tok = strtok_r(str, ",\n", &ptr);
> +     while (tok) {
> +             char *vl_str, *weight_str;
>  
> -static void subn_verify_sl2vl(IN char *sl2vl, IN char *key)
> -{
> -     if (sl2vl) {
> -             char buff[128];
> -             char *str, *tok, *end, *ptr;
> -             int count = 0;
> +             vl_str = tok;
> +             weight_str = strchr(tok, ':');
>  
> -             str = (char *)malloc(strlen(sl2vl) + 1);
> -             strcpy(str, sl2vl);
> +             if (weight_str) {
> +                     long vl, weight;
>  
> -             tok = strtok_r(str, ",\n", &ptr);
> -             while (tok) {
> -                     long vl = strtol(tok, &end, 0);
> +                     *weight_str = '\0';
> +                     weight_str++;
> +
> +                     vl = strtol(vl_str, &end, 0);
>  
>                       if (*end) {
>                               sprintf(buff,
>                                       " Warning: Cached Option %s:vl=%s 
> improperly formatted\n",
> -                                     key, tok);
> +                                     key, vl_str);
>                               printf(buff);
> -                             cl_log_event("OpenSM", CL_LOG_INFO, buff, NULL,
> -                                          0);
> -                     } else if (vl < 0 || vl > 15) {
> +                             cl_log_event("OpenSM", CL_LOG_INFO,
> +                                          buff, NULL, 0);
> +                     } else if (vl < 0 || vl > 14) {
>                               sprintf(buff,
>                                       " Warning: Cached Option %s:vl=%ld out 
> of range\n",
>                                       key, vl);
>                               printf(buff);
> -                             cl_log_event("OpenSM", CL_LOG_INFO, buff, NULL,
> -                                          0);
> +                             cl_log_event("OpenSM", CL_LOG_INFO,
> +                                          buff, NULL, 0);
>                       }
>  
> -                     count++;
> -                     tok = strtok_r(NULL, ",\n", &ptr);
> -             }
> +                     weight = strtol(weight_str, &end, 0);
>  
> -             if (count < 16) {
> +                     if (*end) {
> +                             sprintf(buff,
> +                                     " Warning: Cached Option %s:weight=%s 
> improperly formatted\n",
> +                                     key, weight_str);
> +                             printf(buff);
> +                             cl_log_event("OpenSM", CL_LOG_INFO,
> +                                          buff, NULL, 0);
> +                     } else if (weight < 0 || weight > 255) {
> +                             sprintf(buff,
> +                                     " Warning: Cached Option %s:weight=%ld 
> out of range\n",
> +                                     key, weight);
> +                             printf(buff);
> +                             cl_log_event("OpenSM", CL_LOG_INFO,
> +                                          buff, NULL, 0);
> +                     }
> +             } else {
>                       sprintf(buff,
> -                             " Warning: Cached Option %s: < 16 VLs listed\n",
> -                             key);
> +                             " Warning: Cached Option %s:vl:weight=%s 
> improperly formatted\n",
> +                             key, tok);
>                       printf(buff);
> -                     cl_log_event("OpenSM", CL_LOG_INFO, buff, NULL, 0);
> +                     cl_log_event("OpenSM", CL_LOG_INFO, buff, NULL,
> +                                  0);
>               }
> -             if (count > 16) {
> +
> +             count++;
> +             tok = strtok_r(NULL, ",\n", &ptr);
> +     }
> +
> +     if (count > 64) {
> +             sprintf(buff,
> +                     " Warning: Cached Option %s: > 64 listed: "
> +                     "excess vl:weight pairs will be dropped\n",
> +                     key);
> +             printf(buff);
> +             cl_log_event("OpenSM", CL_LOG_INFO, buff, NULL, 0);
> +     }
> +
> +     free(str);
> +}
> +
> +static void subn_verify_sl2vl(IN char **sl2vl, IN char *key, IN char *dflt)
> +{
> +     char buff[128];
> +     char *str, *tok, *end, *ptr;
> +     int count = 0;
> +
> +     if (*sl2vl == NULL) {
> +             sprintf(buff, " Invalid Cached Option:%s:"
> +                     "Using Default\n", key);
> +             printf(buff);
> +             cl_log_event("OpenSM", CL_LOG_INFO, buff, NULL, 0);
> +             (*sl2vl) = dflt;                        
> +             return;
> +     }
> +
> +     str = (char *)malloc(strlen(*sl2vl) + 1);
> +     strcpy(str, *sl2vl);
> +
> +     tok = strtok_r(str, ",\n", &ptr);
> +     while (tok) {
> +             long vl = strtol(tok, &end, 0);
> +
> +             if (*end) {
>                       sprintf(buff,
> -                             " Warning: Cached Option %s: > 16 listed: "
> -                             "excess VLs will be dropped\n", key);
> +                             " Warning: Cached Option %s:vl=%s improperly 
> formatted\n",
> +                             key, tok);
>                       printf(buff);
> -                     cl_log_event("OpenSM", CL_LOG_INFO, buff, NULL, 0);
> +                     cl_log_event("OpenSM", CL_LOG_INFO, buff, NULL,
> +                                  0);
> +             } else if (vl < 0 || vl > 15) {
> +                     sprintf(buff,
> +                             " Warning: Cached Option %s:vl=%ld out of 
> range\n",
> +                             key, vl);
> +                     printf(buff);
> +                     cl_log_event("OpenSM", CL_LOG_INFO, buff, NULL,
> +                                  0);
>               }
>  
> -             free(str);
> +             count++;
> +             tok = strtok_r(NULL, ",\n", &ptr);
> +     }
> +
> +     if (count < 16) {
> +             sprintf(buff,
> +                     " Warning: Cached Option %s: < 16 VLs listed\n",
> +                     key);
> +             printf(buff);
> +             cl_log_event("OpenSM", CL_LOG_INFO, buff, NULL, 0);
>       }
> +     if (count > 16) {
> +             sprintf(buff,
> +                     " Warning: Cached Option %s: > 16 listed: "
> +                     "excess VLs will be dropped\n", key);
> +             printf(buff);
> +             cl_log_event("OpenSM", CL_LOG_INFO, buff, NULL, 0);
> +     }
> +
> +     free(str);
>  }
>  
>  static void subn_verify_conf_file(IN osm_subn_opt_t * const p_opts)
> @@ -1046,61 +1086,113 @@ static void subn_verify_conf_file(IN osm_subn_opt_t 
> * const p_opts)
>       }
>  
>       if (p_opts->qos) {
> +             /* the default options in qos_options must be correct.
> +              * every other one need not be, b/c those will default
> +              * back to whatever is in qos_options.
> +              */
> +
>               subn_verify_max_vls(&(p_opts->qos_options.max_vls),
> -                                 "qos_max_vls");
> -             subn_verify_max_vls(&(p_opts->qos_ca_options.max_vls),
> -                                 "qos_ca_max_vls");
> -             subn_verify_max_vls(&(p_opts->qos_sw0_options.max_vls),
> -                                 "qos_sw0_max_vls");
> -             subn_verify_max_vls(&(p_opts->qos_swe_options.max_vls),
> -                                 "qos_swe_max_vls");
> -             subn_verify_max_vls(&(p_opts->qos_rtr_options.max_vls),
> -                                 "qos_rtr_max_vls");
> +                                 "qos_max_vls",
> +                                 OSM_DEFAULT_MAX_OP_VLS);
> +             if (p_opts->qos_ca_options.max_vls)
> +                     subn_verify_max_vls(&(p_opts->qos_ca_options.max_vls),
> +                                         "qos_ca_max_vls",
> +                                         0);
> +             if (p_opts->qos_sw0_options.max_vls)
> +                     subn_verify_max_vls(&(p_opts->qos_sw0_options.max_vls),
> +                                         "qos_sw0_max_vls",
> +                                         0);
> +             if (p_opts->qos_swe_options.max_vls)
> +                     subn_verify_max_vls(&(p_opts->qos_swe_options.max_vls),
> +                                         "qos_swe_max_vls",
> +                                         0);
> +             if (p_opts->qos_rtr_options.max_vls)
> +                     subn_verify_max_vls(&(p_opts->qos_rtr_options.max_vls),
> +                                         "qos_rtr_max_vls",
> +                                         0);
>  
>               subn_verify_high_limit(&(p_opts->qos_options.high_limit),
> -                                    "qos_high_limit");
> -             subn_verify_high_limit(&(p_opts->qos_ca_options.high_limit),
> -                                    "qos_ca_high_limit");
> -             subn_verify_high_limit(&
> -                                    (p_opts->qos_sw0_options.high_limit),
> -                                    "qos_sw0_high_limit");
> -             subn_verify_high_limit(&
> -                                    (p_opts->qos_swe_options.high_limit),
> -                                    "qos_swe_high_limit");
> -             subn_verify_high_limit(&
> -                                    (p_opts->qos_rtr_options.high_limit),
> -                                    "qos_rtr_high_limit");
> -
> -             subn_verify_vlarb(p_opts->qos_options.vlarb_low,
> -                               "qos_vlarb_low");
> -             subn_verify_vlarb(p_opts->qos_ca_options.vlarb_low,
> -                               "qos_ca_vlarb_low");
> -             subn_verify_vlarb(p_opts->qos_sw0_options.vlarb_low,
> -                               "qos_sw0_vlarb_low");
> -             subn_verify_vlarb(p_opts->qos_swe_options.vlarb_low,
> -                               "qos_swe_vlarb_low");
> -             subn_verify_vlarb(p_opts->qos_rtr_options.vlarb_low,
> -                               "qos_rtr_vlarb_low");
> -
> -             subn_verify_vlarb(p_opts->qos_options.vlarb_high,
> -                               "qos_vlarb_high");
> -             subn_verify_vlarb(p_opts->qos_ca_options.vlarb_high,
> -                               "qos_ca_vlarb_high");
> -             subn_verify_vlarb(p_opts->qos_sw0_options.vlarb_high,
> -                               "qos_sw0_vlarb_high");
> -             subn_verify_vlarb(p_opts->qos_swe_options.vlarb_high,
> -                               "qos_swe_vlarb_high");
> -             subn_verify_vlarb(p_opts->qos_rtr_options.vlarb_high,
> -                               "qos_rtr_vlarb_high");
> -
> -             subn_verify_sl2vl(p_opts->qos_options.sl2vl, "qos_sl2vl");
> -             subn_verify_sl2vl(p_opts->qos_ca_options.sl2vl, "qos_ca_sl2vl");
> -             subn_verify_sl2vl(p_opts->qos_sw0_options.sl2vl,
> -                               "qos_sw0_sl2vl");
> -             subn_verify_sl2vl(p_opts->qos_swe_options.sl2vl,
> -                               "qos_swe_sl2vl");
> -             subn_verify_sl2vl(p_opts->qos_rtr_options.sl2vl,
> -                               "qos_rtr_sl2vl");
> +                                    "qos_high_limit",
> +                                    OSM_DEFAULT_QOS_HIGH_LIMIT);
> +             if (p_opts->qos_ca_options.high_limit >= 0)
> +                     
> subn_verify_high_limit(&(p_opts->qos_ca_options.high_limit),
> +                                            "qos_ca_high_limit",
> +                                            -1);
> +             if (p_opts->qos_sw0_options.high_limit >= 0)
> +                     subn_verify_high_limit(&
> +                                            
> (p_opts->qos_sw0_options.high_limit),
> +                                            "qos_sw0_high_limit",
> +                                            -1);
> +             if (p_opts->qos_swe_options.high_limit >= 0)
> +                     subn_verify_high_limit(&
> +                                            
> (p_opts->qos_swe_options.high_limit),
> +                                            "qos_swe_high_limit",
> +                                            -1);
> +             if (p_opts->qos_rtr_options.high_limit >= 0)
> +                     subn_verify_high_limit(&
> +                                            
> (p_opts->qos_rtr_options.high_limit),
> +                                            "qos_rtr_high_limit",
> +                                            -1);
> +
> +             subn_verify_vlarb(&(p_opts->qos_options.vlarb_low),
> +                               "qos_vlarb_low",
> +                               OSM_DEFAULT_QOS_VLARB_LOW);
> +             if (p_opts->qos_ca_options.vlarb_low)
> +                     subn_verify_vlarb(&(p_opts->qos_ca_options.vlarb_low),
> +                                       "qos_ca_vlarb_low",
> +                                       NULL);
> +             if (p_opts->qos_sw0_options.vlarb_low)
> +                     subn_verify_vlarb(&(p_opts->qos_sw0_options.vlarb_low),
> +                                       "qos_sw0_vlarb_low",
> +                                       NULL);
> +             if (p_opts->qos_swe_options.vlarb_low)
> +                     subn_verify_vlarb(&(p_opts->qos_swe_options.vlarb_low),
> +                                       "qos_swe_vlarb_low",
> +                                       NULL);
> +             if (p_opts->qos_rtr_options.vlarb_low)
> +                     subn_verify_vlarb(&(p_opts->qos_rtr_options.vlarb_low),
> +                                       "qos_rtr_vlarb_low",
> +                                       NULL);
> +
> +             subn_verify_vlarb(&(p_opts->qos_options.vlarb_high),
> +                               "qos_vlarb_high",
> +                               OSM_DEFAULT_QOS_VLARB_HIGH);
> +             if (p_opts->qos_ca_options.vlarb_high)
> +                     subn_verify_vlarb(&(p_opts->qos_ca_options.vlarb_high),
> +                                       "qos_ca_vlarb_high",
> +                                       NULL);
> +             if (p_opts->qos_sw0_options.vlarb_high)
> +                     subn_verify_vlarb(&(p_opts->qos_sw0_options.vlarb_high),
> +                                       "qos_sw0_vlarb_high",
> +                                       NULL);
> +             if (p_opts->qos_swe_options.vlarb_high)
> +                     subn_verify_vlarb(&(p_opts->qos_swe_options.vlarb_high),
> +                                       "qos_swe_vlarb_high",
> +                                       NULL);
> +             if (p_opts->qos_rtr_options.vlarb_high)
> +                     subn_verify_vlarb(&(p_opts->qos_rtr_options.vlarb_high),
> +                                       "qos_rtr_vlarb_high",
> +                                       NULL);
> +
> +             subn_verify_sl2vl(&(p_opts->qos_options.sl2vl), 
> +                               "qos_sl2vl",
> +                               OSM_DEFAULT_QOS_SL2VL);
> +             if (p_opts->qos_ca_options.sl2vl)
> +                     subn_verify_sl2vl(&(p_opts->qos_ca_options.sl2vl), 
> +                                       "qos_ca_sl2vl",
> +                                       NULL);
> +             if (p_opts->qos_sw0_options.sl2vl)
> +                     subn_verify_sl2vl(&(p_opts->qos_sw0_options.sl2vl),
> +                                       "qos_sw0_sl2vl",
> +                                       NULL);
> +             if (p_opts->qos_swe_options.sl2vl)
> +                     subn_verify_sl2vl(&(p_opts->qos_swe_options.sl2vl),
> +                                       "qos_swe_sl2vl",
> +                                       NULL);
> +             if (p_opts->qos_rtr_options.sl2vl)
> +                     subn_verify_sl2vl(&(p_opts->qos_rtr_options.sl2vl),
> +                                       "qos_rtr_sl2vl",
> +                                       NULL);
>       }
>  #ifdef ENABLE_OSM_PERF_MGR
>       if (p_opts->perfmgr_sweep_time_s < 1) {
> @@ -1714,23 +1806,28 @@ int osm_subn_write_conf_file(char *file_name, IN 
> osm_subn_opt_t *const p_opts)
>  
>       subn_dump_qos_options(opts_file,
>                             "QoS default options", "qos",
> +                           &p_opts->qos_options,
>                             &p_opts->qos_options);
>       fprintf(opts_file, "\n");
>       subn_dump_qos_options(opts_file,
>                             "QoS CA options", "qos_ca",
> -                           &p_opts->qos_ca_options);
> +                           &p_opts->qos_ca_options,
> +                           &p_opts->qos_options);
>       fprintf(opts_file, "\n");
>       subn_dump_qos_options(opts_file,
>                             "QoS Switch Port 0 options", "qos_sw0",
> -                           &p_opts->qos_sw0_options);
> +                           &p_opts->qos_sw0_options,
> +                           &p_opts->qos_options);
>       fprintf(opts_file, "\n");
>       subn_dump_qos_options(opts_file,
>                             "QoS Switch external ports options", "qos_swe",
> -                           &p_opts->qos_swe_options);
> +                           &p_opts->qos_swe_options,
> +                           &p_opts->qos_options);
>       fprintf(opts_file, "\n");
>       subn_dump_qos_options(opts_file,
>                             "QoS Router ports options", "qos_rtr",
> -                           &p_opts->qos_rtr_options);
> +                           &p_opts->qos_rtr_options,
> +                           &p_opts->qos_options);
>       fprintf(opts_file, "\n");
>  
>       fprintf(opts_file,
> -- 
> 1.5.4.5
> 

_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to