[ofa-general] [PATCH 6/7] osm: QoS - adding QoS policy file option

Yevgeny Kliteynik kliteyn at dev.mellanox.co.il
Mon Aug 20 05:10:27 PDT 2007


Adding QoS policy file option to OpenSM

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

diff --git a/opensm/include/opensm/osm_base.h b/opensm/include/opensm/osm_base.h
index 545779b..0a35e22 100644
--- a/opensm/include/opensm/osm_base.h
+++ b/opensm/include/opensm/osm_base.h
@@ -224,6 +224,23 @@ BEGIN_C_DECLS
 #define OSM_DEFAULT_PARTITION_CONFIG_FILE "/etc/ofa/opensm-partitions.conf"
 #endif
 /***********/
+
+/****d* OpenSM: Base/OSM_DEFAULT_QOS_POLICY_FILE
+* NAME
+*	OSM_DEFAULT_QOS_POLICY_FILE
+*
+* DESCRIPTION
+*	Specifies the default QoS policy file name
+*
+* SYNOPSIS
+*/
+#ifdef __WIN__
+#define OSM_DEFAULT_QOS_POLICY_FILE strcat(GetOsmCachePath(), "osm-qos-policy.conf")
+#else
+#define OSM_DEFAULT_QOS_POLICY_FILE "/etc/ofa/opensm-qos-policy.conf"
+#endif
+/***********/
+
 /****d* OpenSM: Base/OSM_DEFAULT_SWEEP_INTERVAL_SECS
 * NAME
 *	OSM_DEFAULT_SWEEP_INTERVAL_SECS
diff --git a/opensm/include/opensm/osm_subnet.h b/opensm/include/opensm/osm_subnet.h
index a7543dc..8ffd104 100644
--- a/opensm/include/opensm/osm_subnet.h
+++ b/opensm/include/opensm/osm_subnet.h
@@ -257,6 +257,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;
diff --git a/opensm/opensm/main.c b/opensm/opensm/main.c
index 0827f1c..06b3aa1 100644
--- a/opensm/opensm/main.c
+++ b/opensm/opensm/main.c
@@ -269,6 +269,10 @@ void show_usage(void)
 	       "          The default name is \'"
 	       OSM_DEFAULT_PARTITION_CONFIG_FILE "\'.\n\n");
 	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"
+	       "          The default name is \'" OSM_DEFAULT_QOS_POLICY_FILE "\'.\n\n");
 	printf("-N\n"
 	       "--no_part_enforce\n"
 	       "          This option disables partition enforcement on switch external ports.\n\n");
@@ -574,7 +578,7 @@ int main(int argc, char *argv[])
 	char *ignore_guids_file_name = NULL;
 	uint32_t val;
 	const char *const short_option =
-	    "i:f:ed:g:l:L:s:t:a:u:R:zM:U:S:P:NBIQvVhorcyxp:n:q:k:C:";
+	    "i:f:ed:g:l:L:s:t:a:u:R:zM:U:S:P:Y:NBIQvVhorcyxp:n:q:k:C:";
 
 	/*
 	   In the array below, the 2nd parameter specifies the number
@@ -598,6 +602,7 @@ int main(int argc, char *argv[])
 		{"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'},
@@ -817,6 +822,11 @@ int main(int argc, char *argv[])
 			opt.no_qos = FALSE;
 			break;
 
+		case 'Y':
+			opt.qos_policy_file = optarg;
+			printf(" QoS policy file \'%s\'\n", optarg);
+			break;
+
 		case 'y':
 			opt.exit_on_fatal = FALSE;
 			printf(" Staying on fatal initialization errors\n");
diff --git a/opensm/opensm/osm_subnet.c b/opensm/opensm/osm_subnet.c
index 818d73f..4162522 100644
--- a/opensm/opensm/osm_subnet.c
+++ b/opensm/opensm/osm_subnet.c
@@ -452,6 +452,7 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * const p_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 = OSM_DEFAULT_QOS_POLICY_FILE;
 	p_opt->accum_log_file = TRUE;
 	p_opt->port_profile_switch_nodes = FALSE;
 	p_opt->pfn_ui_pre_lid_assign = NULL;
@@ -1178,6 +1179,9 @@ ib_api_status_t osm_subn_parse_conf_file(IN osm_subn_opt_t * const p_opts)
 
 		opts_unpack_boolean("no_qos", p_key, p_val, &p_opts->no_qos);
 
+		opts_unpack_charp("qos_policy_file",
+				    p_key, p_val, &p_opts->qos_policy_file);
+
 		opts_unpack_boolean("accum_log_file",
 				    p_key, p_val, &p_opts->accum_log_file);
 
@@ -1541,7 +1545,11 @@ ib_api_status_t osm_subn_write_conf_file(IN osm_subn_opt_t * const p_opts)
 	fprintf(opts_file,
 		"#\n# QoS OPTIONS\n#\n"
 		"# Disable QoS setup\n"
-		"no_qos %s\n\n", p_opts->no_qos ? "TRUE" : "FALSE");
+		"no_qos %s\n\n"
+		"# QoS policy file to be used\n"
+		"qos_policy_file %s\n\n",
+		p_opts->no_qos ? "TRUE" : "FALSE",
+		p_opts->qos_policy_file);
 
 	subn_dump_qos_options(opts_file,
 			      "QoS default options", "qos",
-- 
1.5.1.4





More information about the general mailing list