From patchwork Tue Dec 1 18:19:38 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: 7739621 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 9C53C9F30B for ; Tue, 1 Dec 2015 18:19:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A075D20459 for ; Tue, 1 Dec 2015 18:19:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7EB6220456 for ; Tue, 1 Dec 2015 18:19:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756358AbbLASTw (ORCPT ); Tue, 1 Dec 2015 13:19:52 -0500 Received: from mail-bn1bon0084.outbound.protection.outlook.com ([157.56.111.84]:2496 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756752AbbLASTm (ORCPT ); Tue, 1 Dec 2015 13:19:42 -0500 Received: from BN1PR0201MB0818.namprd02.prod.outlook.com (10.160.170.150) by BN1PR0201MB0836.namprd02.prod.outlook.com (10.160.170.156) with Microsoft SMTP Server (TLS) id 15.1.331.20; Tue, 1 Dec 2015 18:19:41 +0000 Received: from BY1PR0201CA0005.namprd02.prod.outlook.com (10.160.191.143) by BN1PR0201MB0818.namprd02.prod.outlook.com (10.160.170.150) with Microsoft SMTP Server (TLS) id 15.1.331.20; Tue, 1 Dec 2015 18:19:40 +0000 Received: from BY2FFO11OLC016.protection.gbl (2a01:111:f400:7c0c::135) by BY1PR0201CA0005.outlook.office365.com (2a01:111:e400:4814::15) with Microsoft SMTP Server (TLS) id 15.1.331.20 via Frontend Transport; Tue, 1 Dec 2015 18:19:39 +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;vger.kernel.org; dmarc=bestguesspass action=none header.from=sandisk.com; 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 BY2FFO11OLC016.mail.protection.outlook.com (10.1.15.61) with Microsoft SMTP Server id 15.1.331.11 via Frontend Transport; Tue, 1 Dec 2015 18:19:39 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com ( [172.22.12.162]) by milsmgep11.sandisk.com (Symantec Messaging Gateway) with SMTP id B1.CE.04667.BB4ED565; Tue, 1 Dec 2015 10:19:39 -0800 (PST) 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.248.2; Tue, 1 Dec 2015 10:19:39 -0800 X-AuditID: ac160a68-f790b6d00000123b-7d-565de4bbf57d Received: from [10.60.52.33] ( [10.177.8.100]) by milsmgip12.sandisk.com (Symantec Messaging Gateway) with SMTP id C5.A2.17166.AB4ED565; Tue, 1 Dec 2015 10:19:39 -0800 (PST) Subject: [PATCH 6/6] IB/srp: Fix srp_map_sg_fr() To: Doug Ledford References: <565DE3EC.2070002@sandisk.com> CC: Sagi Grimberg , Christoph Hellwig , Sebastian Parschauer , "linux-rdma@vger.kernel.org" From: Bart Van Assche Message-ID: <565DE4BA.1040703@sandisk.com> Date: Tue, 1 Dec 2015 10:19:38 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <565DE3EC.2070002@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpgkeLIzCtJLcpLzFF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N C1S0cdEvoCIODhYBFYm+LxkgYVGBCImJExpYIUoEJU7OfAJWzimgLfH8y0ewMcwC6hJ/5l2C suUltr+dwzyBkX8WkpZZSMpmISlbwMi8ilEsNzOnODc9s8DQSK84MS8lszhbLzk/dxMjOGw5 o3YwXp9ofoiRiYNTqoFRs7DyxnrO9R+6Stuq9AIe3d9e89Aq0jbil+nKqWlFvQWLa2ZfaBNJ vN1kGn3ANC0k7aBUettPzjmrLxvFvq/iWl/llh+0ZKqLfNDjd1xh7Z6PFshYKZ7davGWcfbP h+s+q6aVPKnz2npwrv4mAx/XK9tilM61HPruzsw99StTqvKxXY80H8YpsRRnJBpqMRcVJwIA pq/LpAsCAAA= X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC016; 1:C1tZQW/BGyZ1DCyd9eAf3Eyb2i4GeOJCdCKtWdpxVsbD35cA+qPXp94jUWaWwQLhfmBMaLDmQy2EQlsKtrKsTUZCf7OkXedg2YxStmQTUUOuGwAtDup4iLzI96T0CLoArwGzhbMRCzBCeuDLVyeuGXIYQiOHgITpvWZb/u2csPnB4YmIa1XdVy7ynFsx7Bc8pH5JKu2ummbObrGCs/LV93r62Mryw4Bdy6hHukHYdDk7tm1PQPp+U4+L0xBsOj7f5AkMc6rr9iJbXkdnkds+OQ2P+txmvBoQ8UZ+POfyWUpYUAU0++epvWf2tUpviDzr/b6QVmhcLzjo6QKN1T61NV4V2tv4K+gQn0IQ/cxCI6mHwHdHimZCm5dQmfbHeiA0RoS/yC1k5ZFixn2SuqA/UQh+xlDmYM5mCVYu+4qdYVg= X-Forefront-Antispam-Report: CIP:63.163.107.172; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(189002)(199003)(65816999)(59896002)(92566002)(19580395003)(87936001)(97736004)(50466002)(5008740100001)(36756003)(1220700001)(77096005)(65956001)(65806001)(2950100001)(54356999)(81156007)(1096002)(23676002)(4001350100001)(47776003)(5001960100002)(229853001)(230700001)(80316001)(83506001)(106466001)(69596002)(87266999)(50986999)(189998001)(110136002)(64126003)(76176999)(11100500001)(33656002)(586003)(19580405001)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0201MB0818; H:milsmgep11.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0818; 2:l9UEahAMgazfI/UuZ+xVokcr/9fK0qFQxWFLQk34Uzy4TsdDjUC8MBG4KukFnE2FVRRLmU+eh53ec9w7NdStAX0+zMPwSp4xELAgojJQ+oSPtHXnY7TbNcuzIIThSqgKAJzaebQkKvpifZJehfNtcg==; 3:TZB36EvwMzmviIaXni+tSGmNLgxaSB7Nw7eBxB5OqeuJGW/7zHrVEWziIL48u9cWE33HNxKPAfmA5I2zN+6oEsRkZ6rcm+aUyFxAGaTv9sIiOjK2RVC/X+EUph9ZCuW5i1JFNot0MZIwVnYIihRhTX1S1Z1AM/iJHf3kEmvDGaWGY23rPz4A6Rc8MyhHePY4OWzGmE5PR9KTTSfxc3r6sUhUkR+h+7JSDSyCmsRNqTNwr6rjfSdwGRFbEGCrjSeT/nx4Mli9Mk0pIkHmW3sf4Q==; 25:JQBmwjXhU/V0gPZml3eAIEY3QJ1Hp2G6PoQQq8TX1+dFN5honahsyVLyAOitT/C5xP2fx9G1Uwaw7mHarvuo9XYtKspQ/1yF+SMGAKQ9Wr3SbeY958GRc8SK7NY0IA+8GW51RlgUSdTOmPOsJzDHXCk6aww5KjgzA1no9ozrgtUif4gHmN+K2yvKTF/oNvLLILSYIujeUwowtBlCHKxLf9Iq5ty/Ok8sHJOsYn13693+ESGt1tDCJUUj65hJcjlQ X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501001); SRVR:BN1PR0201MB0818; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0818; 20:NCLv3QXSY/xZK23Ju1qnz1gy50+TBoAdJ6ScvlnE+jlcIi63aFBJv1jQfj7uYjnmGoHfzLTG3b4Wwt7M4v3KOXMviz+4+PcAZ+AKTBccxql3VyjjzjrDP6p+1VACTwH/pL9AeOYxtlx9937+eHHAVT+Sn1rbpw/8c0IvBitOgmCK/FnA4i9C6ofKTkJthzo2L2Wlv/O08VoFJnE1/rl5YChuZHHOl8XxF0RJIF8LzCHhwcum7cLV/KRQYAwDQLywnFiLlaxGMU9tKEKl2m0QLuQQSpniA7qwjQbieWjSMnkUv5EHFTHEAwoqjOPiyy/AokXv7Mtju+t65ubeTy02OZdqdLYb/hZeJGgXzZ6EMlw2prdCmLSSTO8DYCDRLsgczwsIWD+upJ90lxuqfhXS23IqLXkqaLUeX2J/7vK/sfbANn0wFkXTHc4Si1v8ovnCVBPftHR9bM9jyXc3JSY8vfwyxoi8ZOenYA9u2vYDgWlDPoTl3sWEW/3DN3uldcj5 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(34787635062028)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(3002001)(10201501046); SRVR:BN1PR0201MB0818; BCL:0; PCL:0; RULEID:; SRVR:BN1PR0201MB0818; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0818; 4:8QyuoOs6ID1DAlDsG9ocHha5OW4AapxoE8sjkTHynn7E5+bu6drbGFodPJW9/+hKmHOqP802XjkNP9uGw9jLlBlSEX4lIxyevjpdDNFMXLHKA1xa3cof9gvP3kgq0nHQSXo+0wWnF9ryi0dE//QAyhPJMml0OwK9yzURRRBNxkjNFcSqZskjioLim/UqBEAcaaDtQB38L2Xm8lEquqPECVJOsjcBQAHg0TaYqCrg2d5luVNwu1LKQjTA2lGTWdvsZbMcO2WBjrqwzH01XVbGkKturaRwuj4pdq0p+FoEzvtd7t5hWhTfo7G86o97ciACe1ckTVsVW1jf54VMymVu9G8gX4hOyQ01MME8WkyXYsXDceLOfdf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pP1Nj47BOUcDOaIWaTKv0LEc+3dxuOZEpUlKvwbQ==; 24:ZNL0ig6pYqCHgMgCtCLfuDPHW/6XvHhbseiTlAMAf9XyTucz89L/6zKHFqpfanRMdCFTBsb9RjgKdE++nKBQnYxRAcZfPj0oBBTRClEHyUs=; 20:c4ayCo4uLsw0G1X1DWMlhFUnEWX0iarqtc0yYjCSsU9V8M89poJx1LNlkTKob18XNE7G3RIttF2OW28k4HdvJqz758/PRAPSWp+iuj799raMc/HCockVQQE6skyfuU4vmRIzVvsVycw19uaPdnIyYu7DZD6eisfRC8hNifTu8XQEy2YUtzfD5fxaE+30qxmZr4YKgFpoRkOudlyJNdRHh6VX9cdDr517MJZRmjKscf22Px6k34Qcols+ES1j3CFP SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2015 18:19:39.3928 (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: BN1PR0201MB0818 X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0836; 2:L7EWF62XVqY6MpeLa+hExo7VY53rWP7a8ZVQ+JHxB0O0yoor7CXZ9uQCULCuD7CwDuvrEbiOt28s4AEYyik8TPvVuae7D1zIqRku+vabp711ba/Ki1q1rGkoWtDihbTZTHSvnoDAnXwESt61U3MoJA==; 23:tV0EvF8MASkmx0iEwQaNKzii0w9391NTyjL4AZtVNvNS5Y9CmaLRBBVew23JeOnCtL+MArVLB/6LOCrsuthqn1riAWH676ke6AAilIHhhCvoT5NupyCJZ/VAH4lxAPUeh3yXwj/bZMlRDJ0wDsKT/TIfg3gMBGtmhCHwJGRILqf/uNgPGxWcoro5zXbHthRG X-OriginatorOrg: sandisk.com 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, T_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 After dma_map_sg() has been called the return value of that function must be used as the number of elements in the scatterlist instead of scsi_sg_count(). Fixes: commit f7f7aab1a5c0 ("IB/srp: Convert to new registration API") Reported-by: Christoph Hellwig Signed-off-by: Bart Van Assche Cc: stable # v4.4+ Cc: Sagi Grimberg Cc: Sebastian Parschauer Reviewed-by: Sagi Grimberg --- drivers/infiniband/ulp/srp/ib_srp.c | 19 ++++++++----------- drivers/infiniband/ulp/srp/ib_srp.h | 5 +---- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index fac1423..3db9a65 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -1313,7 +1313,7 @@ reset_state: } static int srp_map_finish_fr(struct srp_map_state *state, - struct srp_rdma_ch *ch) + struct srp_rdma_ch *ch, int sg_nents) { struct srp_target_port *target = ch->target; struct srp_device *dev = target->srp_host->srp_dev; @@ -1328,10 +1328,10 @@ static int srp_map_finish_fr(struct srp_map_state *state, WARN_ON_ONCE(!dev->use_fast_reg); - if (state->sg_nents == 0) + if (sg_nents == 0) return 0; - if (state->sg_nents == 1 && target->global_mr) { + if (sg_nents == 1 && target->global_mr) { srp_map_desc(state, sg_dma_address(state->sg), sg_dma_len(state->sg), target->global_mr->rkey); @@ -1345,8 +1345,7 @@ static int srp_map_finish_fr(struct srp_map_state *state, rkey = ib_inc_rkey(desc->mr->rkey); ib_update_fast_reg_key(desc->mr, rkey); - n = ib_map_mr_sg(desc->mr, state->sg, state->sg_nents, - dev->mr_page_size); + n = ib_map_mr_sg(desc->mr, state->sg, sg_nents, dev->mr_page_size); if (unlikely(n < 0)) return n; @@ -1452,16 +1451,15 @@ static int srp_map_sg_fr(struct srp_map_state *state, struct srp_rdma_ch *ch, state->fr.next = req->fr_list; state->fr.end = req->fr_list + ch->target->cmd_sg_cnt; state->sg = scat; - state->sg_nents = scsi_sg_count(req->scmnd); - while (state->sg_nents) { + while (count) { int i, n; - n = srp_map_finish_fr(state, ch); + n = srp_map_finish_fr(state, ch, count); if (unlikely(n < 0)) return n; - state->sg_nents -= n; + count -= n; for (i = 0; i < n; i++) state->sg = sg_next(state->sg); } @@ -1521,13 +1519,12 @@ static int srp_map_idb(struct srp_rdma_ch *ch, struct srp_request *req, if (dev->use_fast_reg) { state.sg = idb_sg; - state.sg_nents = 1; sg_set_buf(idb_sg, req->indirect_desc, idb_len); idb_sg->dma_address = req->indirect_dma_addr; /* hack! */ #ifdef CONFIG_NEED_SG_DMA_LENGTH idb_sg->dma_length = idb_sg->length; /* hack^2 */ #endif - ret = srp_map_finish_fr(&state, ch); + ret = srp_map_finish_fr(&state, ch, 1); if (ret < 0) return ret; } else if (dev->use_fmr) { diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h index 87a2a91..f6af531 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.h +++ b/drivers/infiniband/ulp/srp/ib_srp.h @@ -300,10 +300,7 @@ struct srp_map_state { dma_addr_t base_dma_addr; u32 dma_len; u32 total_len; - union { - unsigned int npages; - int sg_nents; - }; + unsigned int npages; unsigned int nmdesc; unsigned int ndesc; };