From patchwork Wed Jan 9 08:12:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honggang LI X-Patchwork-Id: 10753559 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C8F4C6C2 for ; Wed, 9 Jan 2019 08:13:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B818E28E53 for ; Wed, 9 Jan 2019 08:13:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A746028E56; Wed, 9 Jan 2019 08:13:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,SUBJ_OBFU_PUNCT_FEW autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 216A528E53 for ; Wed, 9 Jan 2019 08:13:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729674AbfAIINC (ORCPT ); Wed, 9 Jan 2019 03:13:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53516 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729658AbfAIINC (ORCPT ); Wed, 9 Jan 2019 03:13:02 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9744213A9A; Wed, 9 Jan 2019 08:13:01 +0000 (UTC) Received: from localhost (ovpn-12-20.pek2.redhat.com [10.72.12.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B55DA5D739; Wed, 9 Jan 2019 08:13:00 +0000 (UTC) From: Honggang Li To: hal@dev.mellanox.co.il Cc: linux-rdma@vger.kernel.org, dledford@redhat.com, Honggang Li Subject: [opensm patch] opensm/main.c: Add '--subnet_prefix' and '--dump_files_dir' options Date: Wed, 9 Jan 2019 16:12:51 +0800 Message-Id: <20190109081251.9552-1-honli@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 09 Jan 2019 08:13:01 +0000 (UTC) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- man/opensm.8.in | 10 ++++++++++ opensm/main.c | 15 +++++++++++++++ 2 files changed, 25 insertions(+) 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) ] [\-l(mc) ] [\-p(riority) ] +[\-\-subnet_prefix ] [\-\-smkey ] [\-\-sm_sl ] [\-r(eassign_lids)] @@ -42,6 +43,7 @@ opensm \- InfiniBand subnet manager and administration (SM/SA) [\-w | \-\-hop_weights_file ] [\-O | \-\-port_search_ordering_file ] [\-O | \-\-dimn_ports_file ] (DEPRECATED) +[\-\-dump_files_dir ] [\-f | \-\-log_file ] [\-L | \-\-log_limit ] [\-e(rase_log_file)] [\-P(config) ] @@ -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 +This option specifies the subnet prefix to use in +on the fabric. The default prefix is +0xfe80000000000000. +.TP \fB\-\-smkey\fR 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 +This option will set the directory to hold the file OpenSM dumps. +.TP \fB\-f\fR, \fB\-\-log_file\fR 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 \n" + " Set the subnet prefix to something other than the\n" + " default value of 0xfe80000000000000\n\n"); printf("--smkey, -k \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 " + " The directory to hold the file OpenSM dumps.\n"); printf("--log_file, -f \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 ':':