From patchwork Wed May 11 00:15:21 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: 9064151 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 01C129F1D3 for ; Wed, 11 May 2016 00:15:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0D71A20160 for ; Wed, 11 May 2016 00:15:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0113620123 for ; Wed, 11 May 2016 00:15:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751650AbcEKAP1 (ORCPT ); Tue, 10 May 2016 20:15:27 -0400 Received: from mail-bn1on0073.outbound.protection.outlook.com ([157.56.110.73]:58496 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750922AbcEKAP0 (ORCPT ); Tue, 10 May 2016 20:15:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sandiskcorp.onmicrosoft.com; s=selector1-sandisk-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=aiQdGZO20RZfeU75hNjOCLyUWWwGPTjy3zAkdV3QQs8=; b=nMOnmt5Iz2OOSWi0l6rrkcyoXKrWHZ1wT0QyrgjoGvbOf4CPJrU/zFa4R657Ye882gMS1J0aCt0WvUav2W71zNpQO8hrORbzbijtI134FHOT59m7j5Ug/Fd2mMD7DceE+3jat5enDGJZrnlT5DbVI1Eo/idglP1pYze/FPDF84o= Received: from BY2PR02CA0123.namprd02.prod.outlook.com (10.163.44.177) by BY2PR0201MB1925.namprd02.prod.outlook.com (10.163.75.155) with Microsoft SMTP Server (TLS) id 15.1.492.11; Wed, 11 May 2016 00:15:23 +0000 Received: from BL2FFO11FD011.protection.gbl (2a01:111:f400:7c09::114) by BY2PR02CA0123.outlook.office365.com (2a01:111:e400:5261::49) with Microsoft SMTP Server (TLS) id 15.1.492.11 via Frontend Transport; Wed, 11 May 2016 00:15:22 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; redhat.com; dkim=none (message not signed) header.d=none;redhat.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 BL2FFO11FD011.mail.protection.outlook.com (10.173.161.17) with Microsoft SMTP Server (TLS) id 15.1.492.8 via Frontend Transport; Wed, 11 May 2016 00:15:21 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com (Unknown_Domain [172.22.12.162]) (using TLS with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id 34.21.03047.5F872375; Tue, 10 May 2016 17:12:38 -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.279.2; Tue, 10 May 2016 17:15:21 -0700 X-AuditID: ac160c69-5dfff70000000be7-7b-573278f5b045 Received: from exp-402881.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id B3.14.03935.99972375; Tue, 10 May 2016 17:15:21 -0700 (PDT) Subject: [PATCH 5/6] IB/srp: Swap two code blocks in srp_add_one() To: Doug Ledford References: <573278D9.4050908@sandisk.com> CC: Christoph Hellwig , Sagi Grimberg , Laurence Oberman , "linux-rdma@vger.kernel.org" From: Bart Van Assche Message-ID: <57327999.20106@sandisk.com> Date: Tue, 10 May 2016 17:15:21 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <573278D9.4050908@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrILMWRmVeSWpSXmKPExsWyRoxnke63CqNwg2OLOC1env/AarFy9VEm i2eHelkszn94xWSx7vV7FgdWj/P3NrJ47L7ZwObxft9VNo/Pm+QCWKK4bFJSczLLUov07RK4 Mp4destacFGgYsKjfpYGxj+8XYycHBICJhKbFjaygthCAnOZJDp/VncxcgHZOxglFs6ewghT tKzhPgtEYimjxKF9F1hAEsICThLTDj1lA7FFBNQkNr1axA4xSUtiZft8VpAGZoHVjBJflr1i AkmwCRhJfHs/E6yZV0BD4lHTPSCbg4NFQFXi5D0hkLCoQITE6nXXmCFKBCVOznwCVs4poC3x f9d/NpByZgFNifW79EHCzALyEtvfzmEGWSUhsI1Vouv/Vqhv1CVOLpnPNIFReBaSUbMQ2mch aV/AyLyKUSw3M6c4Nz21wNBUrzgxLyWzOFsvOT93EyMkIjJ3MN594n2IUYCDUYmHdweXYbgQ a2JZcWXuIUYJDmYlEd6cYqNwId6UxMqq1KL8+KLSnNTiQ4zSHCxK4rxu976ECQmkJ5akZqem FqQWwWSZODilGhjN4pVCZC/l/p8e0u/iHdX76I3HnWlBVx5nRv7J1dr6R+BWVksVxxPhZ3FG P1xWmy7jlTSMfhR4eSLjVLPzxgfsz02uMjDkzi6ID9nVdHJdo1Kbla2Tme3lWzLfir3iL/RE rHgR4OEZz+WiWTrDLeJfatumRx+n5WTvVQ3hYWNxlrN16pbzUWIpzkg01GIuKk4EAIcutrSE AgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJJMWRmVeSWpSXmKPExsXCtZEjRXdmpVG4wZonohYvz39gtVi5+iiT xbNDvSwW5z+8YrJY9/o9iwOrx/l7G1k8dt9sYPN4v+8qm8fnTXIBLFFcNimpOZllqUX6dglc Gc8OvWUtuChQMeFRP0sD4x/eLkZODgkBE4llDfdZuhi5OIQEFjNKHGndywSSEBZwkph26Ckb iC0ioCax6dUidhBbSEBLYmX7fFaQBmaB1YwS9/p+MYIk2ASMJL69n8kCYvMKaEg8aroHZHNw sAioSpy8JwQSFhWIkFi97hozRImgxMmZT8DKOQW0Jf7v+g+2i1lAXeLPvEvMELa8xPa3c5gn MPLNQtIyC0nZLCRlCxiZVzGK5WbmFOemZxYYGukVJ+alZBZn6yXn525iBAcmZ9QOxusTzQ8x MnFwSjUwHulLC++9ajTDknHTukKjLYsMdi+fe6z9TOoVprhjnBv4Jr6f0eo0x93n9imLjq0M USWZK6R/rhKe/kPLzvXQCe5ivbjXuvtaNXevmNUZHJHkzLzzT65DhvnjtLd7dvjvv7SKV4zL XH9W7qJAtcWnFvUnTzTJnXvkrVvZi7m31DZU3NaVmWe2UYmlOCPRUIu5qDgRAF+OHfH8AQAA X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:63.163.107.21; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(199003)(189002)(9170700003)(5008740100001)(65816999)(54356999)(76176999)(87936001)(50986999)(110136002)(6806005)(86362001)(586003)(19580395003)(1220700001)(50466002)(2906002)(189998001)(19580405001)(4326007)(106466001)(77096005)(117636001)(2950100001)(53416004)(229853001)(36756003)(5003600100002)(23676002)(11100500001)(4001350100001)(8936002)(47776003)(65956001)(65806001)(81166006)(92566002)(122286003)(230700001)(62816006); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0201MB1925; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD011; 1:+3Z1dMViBv3UhiKp4AXhlpA0M5V14PDM3NgyA/7rakyES2m1lRqgaoQ30PrVzPhtcMi1ntEXysonSIHvhH4LzjQjIBNcE2+eMckzI1/bskMg8w29eiNYAMyki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mjxo++6suaETfX6imrg7BBwr9oeulG283Z/fuc4QwLuVpbgvFmIforQkYfPHjjS3L09fM9DXrm6xJ5PvK/ZzqajwugwzA8yRsqN6ZRrjLZCgN4EkHA2pX+WqaUZcORMLY2ujespomJ1d2Qb6MaND5VsJjRbD3mMKuHbyS9UwBbFBpeMnkSxYyDiJ2q/xEydn1Y0kp+t0kb6SGJkv7ma0TFI1H0e+gfRMm/uE4lCoT/noxkgNJy2AyuT 4S8+c2I= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13016025)(13018025)(5005006)(8121501046)(10201501046)(3002001)(6055026); SRVR:BY2PR0201MB1925; BCL:0; PCL:0; RULEID:; SRVR:BY2PR0201MB1925; X-Forefront-PRVS: 0939529DE2 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCWTJQUjAyMDFNQjE5MjU7MjM6cU95RW1IWjU5Ryt3Y0tTa3hMSDk5cXVv?= =?utf-8?B?a0hPdlZ4Qmh2NEtNSTVuOHlEekllZ09PemRuU015NXJzNW9weCtaMXR3RThw?= =?utf-8?B?ZmRzQ1NrL1E0MmNGQ2JnSW9adURpSm9EWDFmWlhQTzUvaGMvTkRGK1NwWkZG?= =?utf-8?B?TkJoQUovaGlqTjJYYTkwZVRUNXY4VW1CazRFRFZhdm5iQ0ZWdENUM21hek9M?= =?utf-8?B?WGRmSE5OR1p0dWVJOFJGVm85RkRndlJSaFMwN2E5UDFIOWFuZXVvYTJhYWFT?= =?utf-8?B?NzkydGdqcG50bWYvTlJNd3AydERlWXM0dWhxYlV4YUpjTC9WYkJlSm9vNU9n?= =?utf-8?B?bXlYZGk5R0wvWEFMdUxDdnd1NHBRaWtPZDVFSEFxQnM5ekFadysvVndsZ3FZ?= =?utf-8?B?ZzR5eEVjK3pUV0ZUQVE3QWNPc0V0SGk2YmVEMHRiSXRITTB6dTEyWmw5c2Jy?= =?ut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qcHJQYVUwRWxwT3FT?= =?utf-8?B?cGl3U29MTHN4UHowT05JZllWcm1nZVgvUDA3eFpjRTllNXFHUWpZSHFNcC9h?= =?utf-8?B?cFdvRzJ0L0pvTU4rMU51ak9QMkYrcHhHOURPbXRSamZjSU1JczFmejROVHJn?= =?utf-8?Q?iDMBhcD1bPv1fbaZ447Bh0ShYUA=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB1925; 5:i7N0egeFEzwbmIuXmFUGoEJvS5vgUS+YfzUgmWfi4I72rCFnvJn3f8WoTkRgIHy5dOn8JcZakMe/r3eVnSeUTqHB9JYsgzZ2FXFPKLoGHqYOt5lDoVdj5ucdlnv6HVHHwpyWrFnMtMxsux4R5hMPOg==; 24:ZwyJs+LHvd6A8ossk72r4Se1WvowDCCo+XhdQeVdlZY7TAHtgM1sPzZXRXvViXsHbOLNHGR9K0Ex97ZiQ6GW5bVXucuwlAfSsHPab2jQBfk=; 7:FCcxpHswBL0GfyGyPs6mNt1CWM+ZSr6EOBnkPRQmKQsQD01Osx68Xbfwg9cSBUIDNsz2SxlicsHAkt+sZdjjkbHift4QtS055oE/5x8XVdpFcyhWGMGgCWLZHR0s8bhXJquZfFB15W9BqJSvW1b10pLiDyITofSxLCxFps5cj0YUCiLNXuikTwNGBySm0ppc; 20:FcgN2EDhqkSEsFxhshGDFG5ef7vcYapUYXyyhP1N1RMP0H/5skl5cs8eTOqtuuaM5IQ8KD6MibatEvqL9seSb9D/mYYCZvbgTC34FvG9mq+QvUN2AeIU7EfkLu6I1GxSKZDj/Ipv1kXH8LCwsOY7PU8r+sspZbA6fKwW/Uc6rc1h7iRpdtrUIM/tGn5b2E98HOeXc1nVbNrLX3A9wkM3Ai/U1xmVg8efNOwX7IWGnAW3U9j76rOj54HWBCHUoziI SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2016 00:15:21.8910 (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: BY2PR0201MB1925 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-8.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch does not change any functionality but makes the next patch in this series easier to read. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Sagi Grimberg --- drivers/infiniband/ulp/srp/ib_srp.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 6440469..e530a77 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -3430,17 +3430,6 @@ static void srp_add_one(struct ib_device *device) if (!srp_dev) return; - srp_dev->has_fmr = (device->alloc_fmr && device->dealloc_fmr && - device->map_phys_fmr && device->unmap_fmr); - srp_dev->has_fr = (device->attrs.device_cap_flags & - IB_DEVICE_MEM_MGT_EXTENSIONS); - if (!srp_dev->has_fmr && !srp_dev->has_fr) - dev_warn(&device->dev, "neither FMR nor FR is supported\n"); - - srp_dev->use_fast_reg = (srp_dev->has_fr && - (!srp_dev->has_fmr || prefer_fr)); - srp_dev->use_fmr = !srp_dev->use_fast_reg && srp_dev->has_fmr; - /* * Use the smallest page size supported by the HCA, down to a * minimum of 4096 bytes. We're unlikely to build large sglists @@ -3453,6 +3442,18 @@ static void srp_add_one(struct ib_device *device) do_div(max_pages_per_mr, srp_dev->mr_page_size); srp_dev->max_pages_per_mr = min_t(u64, SRP_MAX_PAGES_PER_MR, max_pages_per_mr); + + srp_dev->has_fmr = (device->alloc_fmr && device->dealloc_fmr && + device->map_phys_fmr && device->unmap_fmr); + srp_dev->has_fr = (device->attrs.device_cap_flags & + IB_DEVICE_MEM_MGT_EXTENSIONS); + if (!srp_dev->has_fmr && !srp_dev->has_fr) + dev_warn(&device->dev, "neither FMR nor FR is supported\n"); + + srp_dev->use_fast_reg = (srp_dev->has_fr && + (!srp_dev->has_fmr || prefer_fr)); + srp_dev->use_fmr = !srp_dev->use_fast_reg && srp_dev->has_fmr; + if (srp_dev->use_fast_reg) { srp_dev->max_pages_per_mr = min_t(u32, srp_dev->max_pages_per_mr,