diff mbox series

[opensm] opensm/main.c: Add '--subnet_prefix' and '--dump_files_dir' options

Message ID 20190109081251.9552-1-honli@redhat.com (mailing list archive)
State Not Applicable
Headers show
Series [opensm] opensm/main.c: Add '--subnet_prefix' and '--dump_files_dir' options | expand

Commit Message

Honggang LI Jan. 9, 2019, 8:12 a.m. UTC
The original patch was wrote by Doug Ledford.

For RHEL users who need to run multiple instances of opensm over
multiple InfiniBand ports, most of time, they need to pass five options
to all instances of opensm.

1) guid
2) subnet_prefix
3) partition_config_file
4) log_file
5) dump_files_dir

1), 3) and 4) are available in upstream. But 2) and 5) are not.
We need create separate configuration files for opensm instances
to apply 2) and 5), when those options are unavailable.

We add '--subnet_prefix' option because:
openmpi will refuse to run if you have two physically separate subnets
with the same subnet prefix.  The subnet prefix is supposed to be unique
on each subnet.  It's how software can tell for certain whether or not
to end points can communicate with each other.

We add '--dump_files_dir' option to keep dumps of different fabrics
into different directories.

Signed-off-by: Honggang Li <honli@redhat.com>
---
 man/opensm.8.in | 10 ++++++++++
 opensm/main.c   | 15 +++++++++++++++
 2 files changed, 25 insertions(+)

Comments

Hal Rosenstock Feb. 6, 2019, 12:46 p.m. UTC | #1
On 1/9/2019 3:12 AM, Honggang Li wrote:
> The original patch was wrote by Doug Ledford.
> 
> For RHEL users who need to run multiple instances of opensm over
> multiple InfiniBand ports, most of time, they need to pass five options
> to all instances of opensm.
> 
> 1) guid
> 2) subnet_prefix
> 3) partition_config_file
> 4) log_file
> 5) dump_files_dir

This is based on only using command line and not opensm config/options
files.

> 1), 3) and 4) are available in upstream. But 2) and 5) are not.
> We need create separate configuration files for opensm instances
> to apply 2) and 5), when those options are unavailable.

5 was available in either config/options file or via OSM_TMP_DIR
environment variable.

> We add '--subnet_prefix' option because:
> openmpi will refuse to run if you have two physically separate subnets
> with the same subnet prefix.  The subnet prefix is supposed to be unique
> on each subnet.  It's how software can tell for certain whether or not
> to end points can communicate with each other.
> 
> We add '--dump_files_dir' option to keep dumps of different fabrics
> into different directories.
> 
> Signed-off-by: Honggang Li <honli@redhat.com>

Thanks. Applied.

-- Hal
diff mbox series

Patch

diff --git a/man/opensm.8.in b/man/opensm.8.in
index 1ee2b16d17a5..ad712810db9f 100644
--- a/man/opensm.8.in
+++ b/man/opensm.8.in
@@ -11,6 +11,7 @@  opensm \- InfiniBand subnet manager and administration (SM/SA)
 [\-g(uid) <GUID in hex>]
 [\-l(mc) <LMC>]
 [\-p(riority) <PRIORITY>]
+[\-\-subnet_prefix <PREFIX in hex>]
 [\-\-smkey <SM_Key>]
 [\-\-sm_sl <SL number>]
 [\-r(eassign_lids)]
@@ -42,6 +43,7 @@  opensm \- InfiniBand subnet manager and administration (SM/SA)
 [\-w | \-\-hop_weights_file <path to file>]
 [\-O | \-\-port_search_ordering_file <path to file>]
 [\-O | \-\-dimn_ports_file <path to file>] (DEPRECATED)
+[\-\-dump_files_dir <directory-name>]
 [\-f <log file path> | \-\-log_file <log file path> ]
 [\-L | \-\-log_limit <size in MB>] [\-e(rase_log_file)]
 [\-P(config) <partition config file> ]
@@ -136,6 +138,11 @@  This will effect the handover cases, where master
 is chosen by priority and GUID.  Range goes from 0
 (default and lowest priority) to 15 (highest).
 .TP
+\fB\-\-subnet_prefix\fR <PREFIX in hex>
+This option specifies the subnet prefix to use in
+on the fabric.  The default prefix is
+0xfe80000000000000.
+.TP
 \fB\-\-smkey\fR <SM_Key value>
 This option specifies the SM\'s SM_Key (64 bits).
 This will effect SM authentication.
@@ -359,6 +366,9 @@  when it comes out of Standby state, if such file exists
 under OSM_CACHE_DIR, and is valid.
 By default, this is FALSE.
 .TP
+\fB\-\-dump_files_dir <directory name>
+This option will set the directory to hold the file OpenSM dumps.
+.TP
 \fB\-f\fR, \fB\-\-log_file\fR <file name>
 This option defines the log to be the given file.
 By default, the log goes to /var/log/opensm.log.
diff --git a/opensm/main.c b/opensm/main.c
index 0b50b43d75a0..22bf00ee427c 100644
--- a/opensm/main.c
+++ b/opensm/main.c
@@ -161,6 +161,9 @@  static void show_usage(void)
 	       "          This will effect the handover cases, where master\n"
 	       "          is chosen by priority and GUID.  Range goes\n"
 	       "          from 0 (lowest priority) to 15 (highest).\n\n");
+	printf("--subnet_prefix <prefix>\n"
+	       "          Set the subnet prefix to something other than the\n"
+	       "          default value of 0xfe80000000000000\n\n");
 	printf("--smkey, -k <SM_Key>\n"
 	       "          This option specifies the SM's SM_Key (64 bits).\n"
 	       "          This will effect SM authentication.\n"
@@ -319,6 +322,8 @@  static void show_usage(void)
 	       "          This option forces OpenSM to honor the guid2lid file,\n"
 	       "          when it comes out of Standby state, if such file exists\n"
 	       "          under OSM_CACHE_DIR, and is valid. By default, this is FALSE.\n\n");
+	printf("--dump_files_dir <directory-name>"
+	       "          The directory to hold the file OpenSM dumps.\n");
 	printf("--log_file, -f <log-file-name>\n"
 	       "          This option defines the log to be the given file.\n"
 	       "          By default, the log goes to /var/log/opensm.log.\n"
@@ -665,6 +670,7 @@  int main(int argc, char *argv[])
 		{"once", 0, NULL, 'o'},
 		{"reassign_lids", 0, NULL, 'r'},
 		{"priority", 1, NULL, 'p'},
+		{"subnet_prefix", 1, NULL, 16},
 		{"smkey", 1, NULL, 'k'},
 		{"routing_engine", 1, NULL, 'R'},
 		{"ucast_cache", 0, NULL, 'A'},
@@ -702,6 +708,7 @@  int main(int argc, char *argv[])
 		{"torus_config", 1, NULL, 10},
 		{"guid_routing_order_no_scatter", 0, NULL, 13},
 		{"nue_max_num_vls", 1, NULL, 15},
+		{"dump_files_dir", 1, NULL, 17},
 		{NULL, 0, NULL, 0}	/* Required at the end of the array */
 	};
 
@@ -1008,6 +1015,11 @@  int main(int argc, char *argv[])
 			printf(" Priority = %d\n", temp);
 			break;
 
+		case 16:
+			opt.subnet_prefix = cl_hton64(strtoull(optarg, NULL, 16));
+			printf(" Subnet_Prefix = <0x%" PRIx64 ">\n", cl_hton64(opt.subnet_prefix));
+			break;
+
 		case 'k':
 			sm_key = cl_hton64(strtoull(optarg, NULL, 16));
 			printf(" SM Key <0x%" PRIx64 ">\n", cl_hton64(sm_key));
@@ -1162,6 +1174,9 @@  int main(int argc, char *argv[])
 			opt.nue_max_num_vls = (uint8_t) temp;
 			printf(" Nue maximum #VLs = %d\n", opt.nue_max_num_vls);
 			break;
+		case 17:
+			SET_STR_OPT(opt.dump_files_dir, optarg);
+			break;
 		case 'h':
 		case '?':
 		case ':':