Move run-time port_prof_ignore_guids map to osm_subnet_t struct and
instead in options define port_prof_ignore_file - a name of the file with
port guids to be ignored by port profiling. Command line option '-i'
('--ignore-guids') will work as before.

Signed-off-by: Sasha Khapyorsky <[EMAIL PROTECTED]>
---
 opensm/include/opensm/osm_port_profile.h |    7 +++----
 opensm/include/opensm/osm_subnet.h       |   10 +++++++---
 opensm/opensm/main.c                     |    9 ++++-----
 opensm/opensm/osm_subnet.c               |   17 ++++++++++++++---
 4 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/opensm/include/opensm/osm_port_profile.h 
b/opensm/include/opensm/osm_port_profile.h
index 2442850..bbb59ef 100644
--- a/opensm/include/opensm/osm_port_profile.h
+++ b/opensm/include/opensm/osm_port_profile.h
@@ -205,7 +205,7 @@ static inline boolean_t
 osm_port_prof_is_ignored_port(IN const osm_subn_t * p_subn,
                              IN ib_net64_t port_guid, IN uint8_t port_num)
 {
-       const cl_map_t *p_map = &(p_subn->opt.port_prof_ignore_guids);
+       const cl_map_t *p_map = &p_subn->port_prof_ignore_guids;
        const void *p_obj = cl_map_get(p_map, port_guid);
        size_t res;
 
@@ -246,7 +246,7 @@ static inline void
 osm_port_prof_set_ignored_port(IN osm_subn_t * p_subn,
                               IN ib_net64_t port_guid, IN uint8_t port_num)
 {
-       cl_map_t *p_map = &(p_subn->opt.port_prof_ignore_guids);
+       cl_map_t *p_map = &p_subn->port_prof_ignore_guids;
        const void *p_obj = cl_map_get(p_map, port_guid);
        size_t value = 0;
 
@@ -259,8 +259,7 @@ osm_port_prof_set_ignored_port(IN osm_subn_t * p_subn,
        }
 
        value = value | (1 << port_num);
-       cl_map_insert(&(p_subn->opt.port_prof_ignore_guids),
-                     port_guid, (void *)value);
+       cl_map_insert(p_map, port_guid, (void *)value);
 }
 
 /*
diff --git a/opensm/include/opensm/osm_subnet.h 
b/opensm/include/opensm/osm_subnet.h
index 56b0165..349ba79 100644
--- a/opensm/include/opensm/osm_subnet.h
+++ b/opensm/include/opensm/osm_subnet.h
@@ -246,7 +246,7 @@ typedef struct _osm_subn_opt {
        boolean_t accum_log_file;
        char *console;
        uint16_t console_port;
-       cl_map_t port_prof_ignore_guids;
+       char *port_prof_ignore_file;
        boolean_t port_profile_switch_nodes;
        boolean_t sweep_on_trap;
        char *routing_engine_name;
@@ -401,8 +401,8 @@ typedef struct _osm_subn_opt {
 *              If TRUE (default) - the log file will be accumulated.
 *              If FALSE - the log file will be erased before starting current 
opensm run.
 *
-*      port_prof_ignore_guids
-*              A map of guids to be ignored by port profiling.
+*      port_prof_ignore_file
+*              Name of file with port guids to be ignored by port profiling.
 *
 *      port_profile_switch_nodes
 *              If TRUE will count the number of switch nodes routed through
@@ -531,6 +531,7 @@ typedef struct _osm_subn {
        cl_qlist_t sa_sr_list;
        cl_qlist_t sa_infr_list;
        cl_ptr_vector_t port_lid_tbl;
+       cl_map_t port_prof_ignore_guids;
        ib_net16_t master_sm_base_lid;
        ib_net16_t sm_base_lid;
        ib_net64_t sm_port_guid;
@@ -587,6 +588,9 @@ typedef struct _osm_subn {
 *              Container of pointers to all Port objects in the subent.
 *              Indexed by port LID.
 *
+*      port_prof_ignore_guids
+*              A map of guids to be ignored by port profiling.
+*
 *      master_sm_base_lid
 *              The base LID owned by the subnet's master SM.
 *
diff --git a/opensm/opensm/main.c b/opensm/opensm/main.c
index fb41d50..89a42b4 100644
--- a/opensm/opensm/main.c
+++ b/opensm/opensm/main.c
@@ -596,7 +596,6 @@ int main(int argc, char *argv[])
        int32_t vendor_debug = 0;
        uint32_t next_option;
        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:u:m:R:zM:U:S:P:Y:NBIQvVhorcyxp:n:q:k:C:";
@@ -702,9 +701,9 @@ int main(int argc, char *argv[])
                        /*
                           Specifies ignore guids file.
                         */
-                       ignore_guids_file_name = optarg;
+                       opt.port_prof_ignore_file = optarg;
                        printf(" Ignore Guids File = %s\n",
-                              ignore_guids_file_name);
+                              opt.port_prof_ignore_file);
                        break;
 
                case 'g':
@@ -1027,8 +1026,8 @@ int main(int argc, char *argv[])
        /*
         * Define some port guids to ignore during path equalization
         */
-       if (ignore_guids_file_name != NULL) {
-               status = parse_ignore_guids_file(ignore_guids_file_name, &osm);
+       if (opt.port_prof_ignore_file != NULL) {
+               status = parse_ignore_guids_file(opt.port_prof_ignore_file, 
&osm);
                if (status != IB_SUCCESS) {
                        printf("\nError from parse_ignore_guids_file (0x%X)\n",
                               status);
diff --git a/opensm/opensm/osm_subnet.c b/opensm/opensm/osm_subnet.c
index 2191f2d..20add92 100644
--- a/opensm/opensm/osm_subnet.c
+++ b/opensm/opensm/osm_subnet.c
@@ -166,8 +166,9 @@ void osm_subn_destroy(IN osm_subn_t * const p_subn)
        }
 
        cl_ptr_vector_destroy(&p_subn->port_lid_tbl);
-       cl_map_remove_all(&(p_subn->opt.port_prof_ignore_guids));
-       cl_map_destroy(&(p_subn->opt.port_prof_ignore_guids));
+
+       cl_map_remove_all(&p_subn->port_prof_ignore_guids);
+       cl_map_destroy(&p_subn->port_prof_ignore_guids);
 
        osm_qos_policy_destroy(p_subn->p_qos_policy);
 
@@ -212,7 +213,7 @@ osm_subn_init(IN osm_subn_t * const p_subn,
        p_subn->min_ca_rate = IB_MAX_RATE;
 
        /* note that insert and remove are part of the port_profile thing */
-       cl_map_init(&(p_subn->opt.port_prof_ignore_guids), 10);
+       cl_map_init(&p_subn->port_prof_ignore_guids, 10);
 
        p_subn->ignore_existing_lfts = TRUE;
 
@@ -452,6 +453,7 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * const 
p_opt)
        p_opt->qos = FALSE;
        p_opt->qos_policy_file = OSM_DEFAULT_QOS_POLICY_FILE;
        p_opt->accum_log_file = TRUE;
+       p_opt->port_prof_ignore_file = NULL;
        p_opt->port_profile_switch_nodes = FALSE;
        p_opt->sweep_on_trap = TRUE;
        p_opt->routing_engine_name = NULL;
@@ -1270,6 +1272,9 @@ ib_api_status_t osm_subn_parse_conf_file(IN 
osm_subn_opt_t * const p_opts)
                opts_unpack_uint8("log_flags",
                                  p_key, p_val, &p_opts->log_flags);
 
+               opts_unpack_charp("port_prof_ignore_file", p_key, p_val,
+                                 &p_opts->port_prof_ignore_file);
+
                opts_unpack_boolean("port_profile_switch_nodes", p_key, p_val,
                                    &p_opts->port_profile_switch_nodes);
 
@@ -1525,6 +1530,12 @@ ib_api_status_t osm_subn_write_conf_file(IN 
osm_subn_opt_t * const p_opts)
                "port_profile_switch_nodes %s\n\n",
                p_opts->port_profile_switch_nodes ? "TRUE" : "FALSE");
 
+       if (p_opts->port_prof_ignore_file)
+               fprintf(opts_file,
+                       "# Name of file with port guids to be ignored by port 
profiling\n"
+                       "port_prof_ignore_file %s\n\n",
+                       p_opts->port_prof_ignore_file);
+
        if (p_opts->routing_engine_name)
                fprintf(opts_file,
                        "# Routing engine\n"
-- 
1.5.4.rc2.60.gb2e62

_______________________________________________
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