From patchwork Tue Aug 11 00:08:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 6987021 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 C7D339F373 for ; Tue, 11 Aug 2015 00:08:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BF8DE205B9 for ; Tue, 11 Aug 2015 00:08:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C98F6205B8 for ; Tue, 11 Aug 2015 00:08:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754853AbbHKAI2 (ORCPT ); Mon, 10 Aug 2015 20:08:28 -0400 Received: from mail-bn1bon0053.outbound.protection.outlook.com ([157.56.111.53]:30589 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754847AbbHKAI0 (ORCPT ); Mon, 10 Aug 2015 20:08:26 -0400 Received: from BY2PR02CA0013.namprd02.prod.outlook.com (10.242.32.13) by CY1PR0201MB0747.namprd02.prod.outlook.com (10.160.141.15) with Microsoft SMTP Server (TLS) id 15.1.225.19; Tue, 11 Aug 2015 00:08:22 +0000 Received: from BL2FFO11FD012.protection.gbl (2a01:111:f400:7c09::132) by BY2PR02CA0013.outlook.office365.com (2a01:111:e400:2c2a::13) with Microsoft SMTP Server (TLS) id 15.1.225.19 via Frontend Transport; Tue, 11 Aug 2015 00:08:21 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.172) smtp.mailfrom=sandisk.com; vger.kernel.org; dkim=none (message not signed) header.d=none; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.172 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.172; helo=milsmgep11.sandisk.com; Received: from milsmgep11.sandisk.com (63.163.107.172) by BL2FFO11FD012.mail.protection.outlook.com (10.173.161.18) with Microsoft SMTP Server id 15.1.243.9 via Frontend Transport; Tue, 11 Aug 2015 00:08:19 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com ( [172.22.12.162]) by milsmgep11.sandisk.com (Symantec Messaging Gateway) with SMTP id CE.EB.04667.3FC39C55; Mon, 10 Aug 2015 17:08:19 -0700 (PDT) Received: from milsmgip11.sandisk.com (10.177.8.100) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.224.2; Mon, 10 Aug 2015 17:07:32 -0700 X-AuditID: ac160a68-f790b6d00000123b-f8-55c93cf39be4 Received: from [10.60.52.33] ( [10.177.8.100]) by milsmgip11.sandisk.com (Symantec Messaging Gateway) with SMTP id 95.6B.03643.2FC39C55; Mon, 10 Aug 2015 17:08:18 -0700 (PDT) Subject: [PATCH 5/8] IB/srp: Remove use_mr argument from srp_map_sg_entry() To: Jason Gunthorpe References: <55BBF4B8.2050700@sandisk.com> <20150803152420.GA24193@infradead.org> <55BFB40F.8000500@sandisk.com> <20150804180933.GB5038@obsidianresearch.com> <1438756876.5698.2.camel@haswell.thedillows.org> <20150805195122.GA31595@obsidianresearch.com> <55C2840C.5050301@sandisk.com> <55C2912A.50709@sandisk.com> <20150806001006.GD2483@obsidianresearch.com> <55C2A7FE.7020904@sandisk.com> <20150806043642.GA14153@obsidianresearch.com> <55C93C61.9010508@sandisk.com> CC: "linux-rdma@vger.kernel.org" From: Bart Van Assche Message-ID: <55C93CF2.8080005@sandisk.com> Date: Mon, 10 Aug 2015 17:08:18 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <55C93C61.9010508@sandisk.com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CY8LKLFaJGUOLkzCdA 9RwcnALaEo1TZSFGqkv8mXcJary8xPa3c5gnMPLPQtIxC0nZLCRlCxiZVzGK5WbmFOemZxYY GuoVJ+alZBZn6yXn525iBAcfZ+QOxqcTzQ8xMnFwSjUwdl2Y0fkr5plSQ2bgpGMzTp95afyT h9t0be/m+r1/P+mvFPjPv+72kUf9P0Qfb3nq9E7p2vYbpz28+NVz151hNju82lTU3UlKvf76 vsjd9z32q6TUe0z24BA5u1hsad7N9W+ZrbWtz2+sMGU9r6wlX3jVK6FXtH2T3Ix4vy0Nb57u 2DTlpPkzFiWW4oxEQy3mouJEAMBJxn3uAQAA X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD012; 1:mhI+cXlHA3NXmlZ3pYKojA0Jzvy/9P7odbwPMTz/wzlLv8TyW2xMBRVp6ZIhpTZoWV0lWDc/PzNUbUrwTn/LZpMtzdEWMKlkbjDll+zDir3dD98q5eaAFl+8V6fhsrVPEVVlh5z4B+HZ5Asj+JoELCQe9gcNejagO9Xef3ZWr1LJ0Qq7FRWypzsJMZYV17CZN/Z/gEoqZgfex3lpwZl7pEUcwB+/Pz9wqAnc0nAP5NwfPDEx7lbP4E5tWj7KAuPOwSdrZi22WVByVmzUtvzlBRGg61kZHZBB8BvffllZ7YIMBS32BxfcAbLjL0ts2kBaGz2/e4fX/4hCWkXDGwsfS5vyjp1W5BVQU7TEMQUTSlJYPihbhP/5Eo6SG1Efzu9W X-Forefront-Antispam-Report: CIP:63.163.107.172; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(3050300001)(199003)(189002)(68736005)(50986999)(36756003)(59896002)(77096005)(229853001)(47776003)(64126003)(110136002)(5001960100002)(80316001)(65816999)(65806001)(23676002)(19580395003)(64706001)(54356999)(5001830100001)(76176999)(2950100001)(87266999)(189998001)(97736004)(65956001)(4001540100001)(46102003)(33656002)(81156007)(77156002)(92566002)(5001860100001)(19580405001)(93886004)(69596002)(62966003)(87936001)(86362001)(83506001)(50466002)(106466001)(4001350100001)(309714004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0201MB0747; H:milsmgep11.sandisk.com; FPR:; SPF:Pass; PTR:ErrorRetry; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB0747; 2:7MmnO7gWTm97L6RkPvpJSZdKOJ8aMdsSnMuGuv5L6kiT47fnAq0+Bot13leO0+XWTouQZtEeA/aUjWRNotGUvjQomzk36XW9yqF86pKhkmHgq+PORG/qBiM5qxes1oGOtPFZttTGegti4TCmsGtkCHRj4D0KQpr1JJUMAAJ80vQ=; 3:PAmzgZnc+YwwaIVxwqwBratXsNkLeo2XIOPGRP7g5ObqwzDoRdHv+yyBVfBMa9NcizrjV9Vrddz9+TSkvseSPms8GjLxVp82XBLj91rghWw35aCLkQkyvNl2DtaLHtKJqtKJBZB4N5Jg6CJM4b3BHoc/Akl0OaRLICvB50C9bD6coEetUNaC2yHDS6QtmAInkClY1rCw58EM7Q7bNa6So330K8KP1ezUdv8b9/+hKIBwQUxf9YB+3PYRt/zoSu+r; 25:zadv50SATeNatvH5rSPdrRlkTa656VTxHUY/MhRQqXBroN7s+ob0SmW+xYRJHCe9VdaRYM8x8wz2Vyf5LwPMDnwsWyi+B9GfhfZuLwZFzHRwnc4udqLXv9v6BPYiP9uu3w+4yxWQ9/JzZR4Aly+kopiKz/ItqD+ky+gr7fF6G6M3TElXk8gBmFP/Vq4oc94LDpBK2GndLl6yCvQNxA4tzYVlA/Qn1jS2PcFnCkNEXhog+vyNjfWeXelxNX3oOjNSY4G89/niSABNIw+Xp0//dA== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0201MB0747; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB0747; 20:BuLz+o9MDkQNzf4cAvG9c2TWPtH8OfSKxmDv2EM8IA0d8F8uczU4QHHMC9JVwltLX9uTAmzHYaCuE90YtgXFmrdC2n4elTUNc1Kvhuh0/s1oqTKa7i5h7WxPXMmeJLHLYZYUdu6OOyb1cElQf3PA20c9HzrG8O7xyNqldD8lc5TVFUviuemxkrFINYFw8A6Na2YSXAqLxf8ahwjCORoo+mH/EL/GLcDdfbQDyiw4CtZhcbHi4P6DnLxKglbvcWYKoQBXvHApFMqW3PT0nK/koqeb4sjXTzFqwo/XcFfu7UNlHuQmYH5OCAY8ckNPgNYhpbpu0jEHpoiiRkT+N7QTdmWY//wSc6WVBskbK02U29gGyKrHkYGaL3Uyz3MTcF1cFktl607skyUDD7DC+HewtCurVQmEcjb5fWnZEJLec9whOllm05Q/jAegWCAFv+EXY/Eon6T1dDm+mltn7jPsaZJ8FobxDUlD7DqdcWwQ7SeotY5ocA17Uvx/hBL47Z+e; 4:JTDWtDPBJjxinTH5BPOlHvKIC6UXOU54237fNdTgxZilT5Y4TaWQtxL3R8s9rMkEHCKK8Fdx3s4HBhLUAi4ig3/RnZSDh7WpQ89mxTB9Tsu9QmhEEQjj6WlWrZgF71tOAWmCJ05WJqOOOzM2N2C+yo9O+OJIXOgKXHfm4h/f2vd+FtLCWQv0h1H3iIR8YEohnNPDioGQsP9rOOpeS41ggIp0UbfdgQd1BOXOk6Rsf6lbzRtrAZP7j8vh4TwVTQz/4qorM221hGuFZiD4uioP5WJl8Xu42SbzUnwBNjbfzrw= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:CY1PR0201MB0747; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0201MB0747; X-Forefront-PRVS: 066517B35B X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTFQUjAyMDFNQjA3NDc7MjM6TjJjNnp1ZFc2MlV0eHA2aUV0Q2thYzlV?= =?utf-8?B?WEpuNFp2dkpHMlpGQnlMTnk1NTQxUjlqekU2L25iekx4QmJBRjN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tigrT/R0MM0sErU0a/xlZF2DHU/sgD2MP2/IolUKi3T3dRuI3Eitt/0G0s3qkmkExKrtuNF1ZFRatg1X65pcKvV4=; 20:hYjo7/UqODkUC027ejHd/FVdyyk5cvclC2hvxtdOWvyCk0AUwNUGYUkHjJ7bM6qZA5+m1YbDfPDkOvJsT8K3E0YgzJnZBrPy01Gl5YkJfa8hLqZ4gJO3V44Cvwt2OOtlP49gS5cdxzPww8bUGTHfag04NtI+xvv4WJnmEoDicy4= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2015 00:08:19.2079 (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.172]; Helo=[milsmgep11.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0201MB0747 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 Move the srp_map_desc() call from inside srp_map_sg_entry() to srp_map_sg() such that the use_mr argument can be removed from srp_map_sg_entry(). Signed-off-by: Bart Van Assche --- drivers/infiniband/ulp/srp/ib_srp.c | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 660a4a4..b8fc35b 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -1260,6 +1260,8 @@ static void srp_map_desc(struct srp_map_state *state, dma_addr_t dma_addr, { struct srp_direct_buf *desc = state->desc; + WARN_ON_ONCE(!dma_len); + desc->va = cpu_to_be64(dma_addr); desc->key = cpu_to_be32(rkey); desc->len = cpu_to_be32(dma_len); @@ -1366,29 +1368,17 @@ static int srp_finish_mapping(struct srp_map_state *state, static int srp_map_sg_entry(struct srp_map_state *state, struct srp_rdma_ch *ch, - struct scatterlist *sg, int sg_index, - bool use_mr) + struct scatterlist *sg, int sg_index) { struct srp_target_port *target = ch->target; struct srp_device *dev = target->srp_host->srp_dev; struct ib_device *ibdev = dev->dev; dma_addr_t dma_addr = ib_sg_dma_address(ibdev, sg); unsigned int dma_len = ib_sg_dma_len(ibdev, sg); - unsigned int len; + unsigned int len = 0; int ret; - if (!dma_len) - return 0; - - if (!use_mr) { - /* - * Once we're in direct map mode for a request, we don't - * go back to FMR or FR mode, so no need to update anything - * other than the descriptor. - */ - srp_map_desc(state, dma_addr, dma_len, target->rkey); - return 0; - } + WARN_ON_ONCE(!dma_len); while (dma_len) { unsigned offset = dma_addr & ~dev->mr_page_mask; @@ -1441,16 +1431,20 @@ static int srp_map_sg(struct srp_map_state *state, struct srp_rdma_ch *ch, use_mr = !!ch->fmr_pool; } - for_each_sg(scat, sg, count, i) { - ret = srp_map_sg_entry(state, ch, sg, i, use_mr); - if (ret) - goto out; - } - if (use_mr) { + for_each_sg(scat, sg, count, i) { + ret = srp_map_sg_entry(state, ch, sg, i); + if (ret) + goto out; + } ret = srp_finish_mapping(state, ch); if (ret) goto out; + } else { + for_each_sg(scat, sg, count, i) { + srp_map_desc(state, ib_sg_dma_address(dev->dev, sg), + ib_sg_dma_len(dev->dev, sg), target->rkey); + } } req->nmdesc = state->nmdesc;