From patchwork Fri Oct 7 18:38:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9367377 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E891160487 for ; Fri, 7 Oct 2016 18:38:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D8D03297DA for ; Fri, 7 Oct 2016 18:38:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C8C57297F0; Fri, 7 Oct 2016 18:38:48 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 CAA2E297DA for ; Fri, 7 Oct 2016 18:38:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754604AbcJGSir (ORCPT ); Fri, 7 Oct 2016 14:38:47 -0400 Received: from mail-sn1nam02on0054.outbound.protection.outlook.com ([104.47.36.54]:2532 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753430AbcJGSip (ORCPT ); Fri, 7 Oct 2016 14:38:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sandiskcorp.onmicrosoft.com; s=selector1-sandisk-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=1dKoghFp5Q2DJOiTDJbr1kxEtkrmYJhP2mVrVqGWJqc=; b=HNtlpdq/6g1KR2hitRDWRHqPJi//OqWbd/Ed3XDQ2ycYeznuT9V8td859FwV25JFZgF/noOeN0dy0beur9HKfwO/EYOWfLK1YJ0t1NVxA+DmigqXm1nrAo4NvQ0cBUiZEvq6hcz15xjVj/Sh4QEOvGyC0rOIdPkTVsd9cs6on8A= Received: from BLUPR0201CA0013.namprd02.prod.outlook.com (10.163.116.23) by BLUPR02MB1617.namprd02.prod.outlook.com (10.162.212.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.649.16; Fri, 7 Oct 2016 18:38:42 +0000 Received: from BN1BFFO11FD014.protection.gbl (2a01:111:f400:7c10::1:134) by BLUPR0201CA0013.outlook.office365.com (2a01:111:e400:52e7::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.659.11 via Frontend Transport; Fri, 7 Oct 2016 18:38:42 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; obsidianresearch.com; dkim=none (message not signed) header.d=none; obsidianresearch.com; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.21 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.21; helo=milsmgep15.sandisk.com; Received: from milsmgep15.sandisk.com (63.163.107.21) by BN1BFFO11FD014.mail.protection.outlook.com (10.58.144.77) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.629.5 via Frontend Transport; Fri, 7 Oct 2016 18:38:41 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com (Unknown_Domain [10.201.67.162]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id DF.A4.26959.839E7F75; Fri, 7 Oct 2016 11:28:08 -0700 (PDT) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Fri, 7 Oct 2016 11:38:23 -0700 X-AuditID: 0ac94369-b97ff7000001694f-b6-57f7e93824cc Received: from asus.site ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 2F.4C.03606.F9BE7F75; Fri, 7 Oct 2016 11:38:23 -0700 (PDT) Subject: [PATCH 1/5] rxe_cfg: Use Perl functions instead of parsing the output of shell commands To: Doug Ledford , Jason Gunthorpe References: CC: Moni Shoua , linux-rdma From: Bart Van Assche Message-ID: <51c02d54-9189-2993-a9cb-a6f6452e9ff3@sandisk.com> Date: Fri, 7 Oct 2016 11:38:22 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrNLMWRmVeSWpSXmKPExsXCddJ5ka7Fy+/hBk2XVSxenv/AavH9hqnF s0O9LBYb3q9hd2DxeDb9MJPH9x29jB7v911l8/i8SS6AJYrLJiU1J7MstUjfLoEr4+LvDsaC TtmKa238DYynRLsYOTkkBEwkHizew9rFyMUhJLCUSWLO6kYoZzujxMtf+9lgqk7MWcgCkZjG KPHwxUmwhLBAksSSD0fZQWwRgWiJprOLweJCAnYSSz72MYPYzAI+EruXN7GA2GwCRhLf3s8E s3mBas7fecYKYrMIqEhs//OXCcQWFYiQuPWwA6pGUOLkzCdgNqeAvcTuxa1ANRxAMzUl1u/S hxgvL7H97RxmkNskBGaxSuxd+4wZ4gZ1iZNL5jNNYBSehWTULIT2WUjaFzAyr2IUy83MKc5N Ty0wNNUrTsxLySzO1kvOz93ECImCzB2Md594H2IU4GBU4uHdseZ7uBBrYllxZe4hRgkOZiUR XsGHQCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8bve+hAkJpCeWpGanphakFsFkmTg4pRoYWfdU KUj0LeaM81OyNf3wxqH/zv+Tx/2z7NQ+u7Ckvj7g095x6+PLOolFTfap4rJBK+Q3aK7WYj2q 5JZT5PH4x4f51z9KtzS6iHpzn94gePltSrD45/qspL1unXIVn2eKTRMu96jdUp7OrtC3bW6e 2lWRD07xOy7fM/1hNu/jgx16bEf2KZ9RYinOSDTUYi4qTgQAtc5ayn4CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrIJMWRmVeSWpSXmKPExsXCtZEjRXf+6+/hBgfXG1u8PP+B1eL7DVOL Z4d6WSw2vF/D7sDi8Wz6YSaP7zt6GT3e77vK5vF5k1wASxSXTUpqTmZZapG+XQJXxsXfHYwF nbIV19r4GxhPiXYxcnJICJhInJizkAXEFhKYxiix7SNYXFggSWLJh6PsILaIQLTE2+WzmCFq 7CSWfOwDs5kFfCT6l19lArHZBIwkvr2fCTaHF6jm/J1nrCA2i4CKxPY/f8FqRAUiJG497ICq EZQ4OfMJmM0pYC+xe3ErE8RMdYk/8y5BzZeX2P52DvMERr5ZSFpmISmbhaRsASPzKkax3Myc 4tz0zAJDI73ixLyUzOJsveT83E2M4EDkjNrBeH2i+SFGJg5OqQbGQiPjfz+OmN2L7E+7/XAl qyDTO5lIpdnvjy1aLmn/QlfW+OO3vQ/e3S2ap6/kuGOackaTifO7yc6p/UxuGw0MeB9rTHpu /JuxyrTyUMg2x66b3PyHRPM8PyWGfLC6dGjxX/PaOTvELkyxu/Vk83StVPMknz/3i3k+vprU 7Zyz8IHYfoXCiUxPlViKMxINtZiLihMBcMLM8fQBAAA= X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.21; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(438002)(189002)(199003)(64126003)(2270400002)(86362001)(229853001)(31696002)(106466001)(47776003)(76176999)(65956001)(81156014)(65806001)(2906002)(50986999)(81166006)(36756003)(54356999)(68736007)(11100500001)(5001770100001)(8676002)(31686004)(4326007)(97736004)(189998001)(77096005)(8936002)(50466002)(626004)(19580395003)(92566002)(4001350100001)(65826007)(5660300001)(19580405001)(230700001)(586003)(87936001)(33646002)(23676002)(356003)(305945005)(69596002)(83506001)(2950100002)(7846002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR02MB1617; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD014; 1:1snq/hQspzmpLh0/Y1ASMoV5v3yFylczqY4pJafwTpPikdF+w83+z1Vexsj8FEL/+RRqDk1kkEH7jjdUF/D/vj+Qf6ValfYk5WMzYksiZtemCOCO1bILZTW2SMcB2tB5xMUwi6KYFh87vjMjKy657S7UNLCzs+ce9fsfJL5q4qX8EZh6MS/Kbg+ZvtGC1olJk0jGYcmeJV67OThu0tHWvI8/bNzUPnKZWRmWJ3xPDrR8ljXBvgXtH7TiH94ovO/Uw7GCzYOFr8AdSDAm2Ugqw+UZo8QDczm3I8JWU6IHvdE4UhAu+r0FHvSl9jRceK3/j3srUTWntSn+75n8F9tq389rbUz/+zBi8CWPURG01EUDglrYzRG08HMNuOXaHR+Mim/8Z9GtxmcOczQpGbBt1Ph1PcvOzTaR1CZkFtnpnKJJj4ASAU+1wwxvJjbHPjoaobHLnSZAmHXvXMdi/RCrj9URsr92PbpKHpLfG5xW2thqUeEMkh9+c0vv7hCGjCcnudZh+usgKLUWTQ7B11niF1NmwrGZdqJvjw2Ydg3rCi8= X-MS-Office365-Filtering-Correlation-Id: f4f925e1-8b36-4d1d-c7d9-08d3eee129a3 X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB1617; 2:qCzKbORDGIJJqhyckBZB2/W3ND4lhIXCIjBnajD7AgVOHv0DVWrhwb684H5Ojb91Ut3UP/y9QnFWatOmfEBfB2zRZIaPQ2WzO2NXyCs8iBme6vW8mIl0GSv0B58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UriScan:(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(13016025)(13018025)(3002001)(10201501046)(6055026); SRVR:BLUPR02MB1617; BCL:0; PCL:0; RULEID:; SRVR:BLUPR02MB1617; X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB1617; 4:ZnNRlCes1jmho2lOMlSB+a9Q+xecufk21hQDLZbPCY6bssvVtnYRkYp82oDwh9GTRVHlz/Bn1jHVrAn4P5enLRV8Q8aV1mwT7vzmTDGolyPS19obS+wdEf4Qd9dZLp9lJGUgbmi3prqgh7c+nJNY+WcmpTwl5rknzbQepqh/Aid6QX2ZORoV8SiGGqlGDkF2vDxU7q0185pipfNU/jpp4otb40xJr02TF/j9onaFRPaiM//Hf/Y+NPSvbNU97s9kd8hRBewtDG97EbxiR5G6M3Lvsb7Bo4GkLRNVNeyFtD1ciYoxG2LruXADCqJAjaCtIiDzdSGiPnn5IVTLabY7ItSEUr/WUrYLU2d7tGmYWjmaQ4LyJ2NqKFWQcWVaPmuR4nKd1HLVxBEMwxC+o+IWWnt/l7TUgtbgbMyuyYKM2O4htR9e/oH1DOmEgQTWxHl5zdmU0YOTJpaCKJkVc+M1hN6a10WN1Tpqv9E2/7uabR6OupsrG3IdM6D9c3jGqXC9 X-Forefront-PRVS: 0088C92887 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTFVQUjAyTUIxNjE3OzIzOldWMTVWMnlya252ZTFUUDFmbFdzTDdycGhE?= =?utf-8?B?UGlaOE1zMnh2eUJ6TzlQMktjWVAvQmQvZDRGYnBMZDQrOGdDdUNNZlU1VTFo?= =?utf-8?B?b0xhQ0pZRy8xckVFaEVZZkNPZjNvbGg4THM5OFNPNXg3eFIvR3k2MGJaSkpl?= =?utf-8?B?a0lXdzdGOEs5Y1BnQU50VGFyM1ppTUIwYUFVQWxrWTZMMkVxYUNMTURKYTND?= =?utf-8?B?SGo2eFBmWW5vWVNzK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io57f/tDMm/XVKSjVzsGKWz4kuLF28uiLi3j3HK6duZZobzADNmDHRnzjyir3dOj7yhkEo3SW+GaPBSYIt+b+isKAamxtRp8Egb3w0dKWZDcFA3XMLetSk6mH3jCmBz1LZ6p4GJSIxrpnAfH6hjcA2X8=; 24:VUbYuvh34fy1rBkMJX5zaRwgfFksVfHKInQcWadj7voXDXv8I78mW67Tg2AbVKQPTQIGxwxxkBOx0He6l5Uki8dFSJxwFKh5lBOQZtLaJRE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB1617; 7:yvD2DZzh9QSJvmqRMWF/LFcVBiHZbKqJicj83YbhTobAnHgGfuPQK1fNd1bSCTpvSr/wgssPExBRGXM1FHCJwmHap0dE5zL6fZOD+eMfMszmf7/b+T+oEv+TAKDaigned1ABV9OIxAKFgnRVnULmNsxCLmw/+XmyRSy0q/RHYLDcLjJbReb0mZUlc+6dvlkVtBfo5VNFuSahpeoTOVQtBaUV/q1SWJyJDuiIxBb45d685TWek2yixOlK10REPUk+nU+ZWDzR/3iUwOPV0obyZoSsEOPXBdj4/1UQaTBOSIgTck1vJmxrPB0HJn551G2KK58AScxi1uepapB7spbMwQ==; 20:Nh/1HAIchUtVEDcQmdbPb5i/kM6KLCI/vIYwR/2fnsiOO608mtxniJdktBNRaOuGEO8pwnTEt4yeejLFdFL10NneU2iyqvgWzQpkyR2riQAkf4Lkf0AGzQ5mtpC3EVNgVYmf1sFwaWznorW4AEpZTSgEE4MNgqj2FUnze+zXtWi6a0+4KD0B3kM10g3BrFTkdU6jKk3Ord7M1+58xyl8qcJ4lRI2UMGiG+l2T7CBLFae6TCqgUsCF2XM9x26HcHB X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2016 18:38:41.8031 (UTC) X-MS-Exchange-CrossTenant-Id: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d; Ip=[63.163.107.21]; Helo=[milsmgep15.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR02MB1617 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 Signed-off-by: Bart Van Assche --- providers/rxe/rxe_cfg | 67 ++++++++++++++++++++++++--------------------------- 1 file changed, 31 insertions(+), 36 deletions(-) diff --git a/providers/rxe/rxe_cfg b/providers/rxe/rxe_cfg index 6783dc78c340..0310d25bad91 100755 --- a/providers/rxe/rxe_cfg +++ b/providers/rxe/rxe_cfg @@ -35,6 +35,7 @@ use warnings; use strict; +use File::Basename; use Getopt::Long; use Switch; @@ -67,20 +68,25 @@ my @mlx4_port; my @mlx4_ether; my @roce_list; +# Read a file and return its contents as a string. +sub read_file { + my $filename = shift; + my $result = ""; + + if (open(FILE, $filename)) { + $result = ; + close FILE; + } + return $result; +} + #get mapping between rxe and eth devices sub get_names { - return if (!(-e "/sys/class/infiniband")); - - my @list; - my $rxe; - my $eth; my $i = 0; - @list = `ls /sys/class/infiniband | grep rxe $z`; - foreach $rxe (@list) { - chomp($rxe); - - $eth = `cat /sys/class/infiniband/$rxe/parent $z`; + foreach my $rxe (glob("/sys/class/infiniband/rxe*")) { + $rxe = basename($rxe); + my $eth = read_file("/sys/class/infiniband/$rxe/parent"); chomp($eth); if (($eth =~ /[\w]+[\d]/) @@ -98,25 +104,13 @@ sub get_names { # get list of Mellanox RoCE ports sub get_mlx4_list { - return if (!(-e "/sys/class/infiniband")); - - my @list; - my $mlx4; - my @ports; - my $port; - my $link; my $i = 0; - @list = `ls /sys/class/infiniband | grep mlx4_ $z`; - foreach $mlx4 (@list) { - chomp($mlx4); - chdir("/sys/class/infiniband/$mlx4/ports"); - - @ports = `ls $z`; - foreach $port (@ports) { - chomp($port); - - $link= `cat $port/link_layer $z`; + foreach my $mlx4 (glob("/sys/class/infiniband/mlx4_*")) { + $mlx4 = basename($mlx4); + foreach my $port (glob("/sys/class/infiniband/$mlx4/ports/*")) { + $port = basename($port); + my $link = read_file("$port/link_layer"); chomp($link); if ($link =~ "Ethernet") { @@ -141,10 +135,10 @@ sub get_dev_info { get_mlx4_list(); my @my_eth_list = (); - my @my_eth_devs = `ls /sys/class/net`; - foreach my $my_eth_dev (@my_eth_devs) { - chomp($my_eth_dev); - my $my_dev_type = `cat /sys/class/net/${my_eth_dev}/type`; + foreach my $my_eth_dev (glob("/sys/class/net/*")) { + $my_eth_dev = basename($my_eth_dev); + my $my_dev_type = read_file("/sys/class/net/${my_eth_dev}/type"); + chomp($my_dev_type); if ($my_dev_type == "1") { push(@my_eth_list, "$my_eth_dev"); } @@ -378,11 +372,11 @@ sub do_status { # read file containing list of ethernet devices into a list sub populate_persistence { - my @lines = `cat $persistence_file $z`; - my $line; my $i = 0; - foreach $line (@lines) { + open FILE, $persistence_file; + while() { + my $line = $_; chomp($line); $line =~ s/^\s+//g; if ($line =~ /[\w]+[\d]/) { @@ -394,6 +388,7 @@ sub populate_persistence { } } } + close FILE; $num_persistent = $i; } @@ -604,7 +599,7 @@ sub do_debug { } } - my $current = `cat $debugfile $z`; + my $current = read_file($debugfile); chomp($current); if ($current > 0) { print "Debug is ON ($current)\n"; @@ -681,7 +676,7 @@ sub main { } # create persistence file if necessary - `mkdir -p $persistence_path $z`; + mkdir -p $persistence_path; if (!(-e $persistence_file)) { `touch $persistence_file $z`; }