From patchwork Wed May 11 00:14:57 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: 9064141 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 86C269F1D3 for ; Wed, 11 May 2016 00:15:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E58F120160 for ; Wed, 11 May 2016 00:15:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3CC3320123 for ; Wed, 11 May 2016 00:15:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751890AbcEKAPF (ORCPT ); Tue, 10 May 2016 20:15:05 -0400 Received: from mail-bn1bon0069.outbound.protection.outlook.com ([157.56.111.69]:10240 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750922AbcEKAPC (ORCPT ); Tue, 10 May 2016 20:15:02 -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=REb+1Xiqj4jE9h5vLAqIBCB1NUn8Ld4Q7pSfv6C8qZE=; b=PDu5PZonzF4IkczEZShMm9rqLcfqqIrbzwcR8aSsmK5YFQq5dNouDu/MxFPPNtoXa1XQ8OmRPjYOFhUe1BAxADIurmmbDu1u9nhBrlFSZ7OqmBJ7cZeMsH+T5CYVsBQ8xzEf8QN9rtaN+k/RSdr1lEWj+C2GC74I+MA1EQ5bH7o= Received: from CY1PR0201CA0014.namprd02.prod.outlook.com (10.163.30.152) by SN1PR0201MB1936.namprd02.prod.outlook.com (10.163.87.158) with Microsoft SMTP Server (TLS) id 15.1.485.9; Wed, 11 May 2016 00:14:59 +0000 Received: from BY2FFO11OLC004.protection.gbl (2a01:111:f400:7c0c::189) by CY1PR0201CA0014.outlook.office365.com (2a01:111:e400:58b9::24) with Microsoft SMTP Server (TLS) id 15.1.492.11 via Frontend Transport; Wed, 11 May 2016 00:14:58 +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 BY2FFO11OLC004.mail.protection.outlook.com (10.1.15.184) with Microsoft SMTP Server (TLS) id 15.1.492.8 via Frontend Transport; Wed, 11 May 2016 00:14:58 +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 4A.11.03047.ED872375; Tue, 10 May 2016 17:12:14 -0700 (PDT) Received: from milsmgip11.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:14:58 -0700 X-AuditID: ac160c69-5f3ff70000000be7-60-573278de87f5 Received: from exp-402881.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 27.7C.02566.18972375; Tue, 10 May 2016 17:14:57 -0700 (PDT) Subject: [PATCH 4/6] IB/core: Enhance ib_map_mr_sg() To: Doug Ledford References: <573278D9.4050908@sandisk.com> CC: Christoph Hellwig , Sagi Grimberg , Laurence Oberman , "linux-rdma@vger.kernel.org" , Or Gerlitz , "Leon Romanovsky" From: Bart Van Assche Message-ID: <57327981.4080404@sandisk.com> Date: Tue, 10 May 2016 17:14:57 -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+NgFmplkeLIzCtJLcpLzFFi42JZI8azSPdehVG4we+rBhYvz39gtVi5+iiT xaHpf1gtnh3qZbE4/+EVk8X0W8cZLda9fs/iwO5x/t5GFo+e6dkeu282sHk8m36YyeP9vqts Hp83yQWwRXHZpKTmZJalFunbJXBlXHw/j6Vgdk3F4rY/zA2MnaldjJwcEgImEp/Xf2fuYuTi EBKYyyTxa95tJghnB6NE+4Q+ZpiqVW9gEksZJa4tWM0IkhAGSmzoW8cOYosIqElserUIzBYS 0JJY2T6fFcRmFvjIKHHpgDmIzSZgJPHt/UwWEJsXqObttc9MIDaLgKrEkcdnwGxRgQiJ1euu MUPUCEqcnPkErJ5TQFvi/67/bF2MHEAzNSXW79KHGC8vsf3tHLAPJAQuskocnnyJCeIGdYmT S+YzTWAUnoVk1CyE9llI2hcwMq9iFMvNzCnOTU8tMDTVK07MS8ksztZLzs/dxAiJnMwdjHef eB9iFOBgVOLh3cFlGC7EmlhWXJl7iFGCg1lJhDen2ChciDclsbIqtSg/vqg0J7X4EKM0B4uS OK/bvS9hQgLpiSWp2ampBalFMFkmDk6pBsbrhSuML+WXT1eSUL+jeDllpaS5/aOmeKkpsbpt C1Ofiu7/JZw9abL9j57XS+b776g6tO5PxTm7rVe543NflxxdtXHHS2NlfsG+ObsjE94z3zrV v6GP83K8DvP1sn7ZlX9lHsj2unIuPyq3YEex+L7gbha2XF+F8/2B926frtBb/2HbKduXs/Yr sRRnJBpqMRcVJwIAbJdAsJgCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLJMWRmVeSWpSXmKPExsXCtZEjRbex0ijcYMElc4uX5z+wWqxcfZTJ 4tD0P6wWzw71slic//CKyWL6reOMFutev2dxYPc4f28ji0fP9GyP3Tcb2DyeTT/M5PF+31U2 j8+b5ALYorhsUlJzMstSi/TtErgyLr6fx1Iwu6Zicdsf5gbGztQuRk4OCQETiVVvbjN1MXJx CAksZpRYurOdFSQhDJTY0LeOHcQWEVCT2PRqEZgtJKAlsbJ9PitIA7PAR0aJv1ObmEESbAJG Et/ez2QBsXmBit5e+8wEYrMIqEoceXwGzBYViJBYve4aM0SNoMTJmU/A6jkFtCX+7/rPBmIz C6hL/Jl3iRnClpfY/nYO8wRGvllIWmYhKZuFpGwBI/MqRrHczJzi3PTMAkNDveLEvJTM4my9 5PzcTYzgAOaM3MH4dKL5IUYmDk6pBkbOvddW9/JVTc27zcf9QNN3jc/XbQsmWf1QkrszOc/y 7Q07liqvh1lTTTJc797vX5PobP67btba/aF6k6IU53Lb7jnpbfx0y8uOJzOfn+BPF/rYe8X9 5eYnSRdcXui/5dVi/7lrY1tK7KWLvYqMp034C4+XVfUKv5ixb8L62fbXYnYpbb6xRT5biaU4 I9FQi7moOBEACdjQQRACAAA= 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)(189002)(199003)(9170700003)(5008740100001)(50466002)(50986999)(86362001)(76176999)(99136001)(81166006)(575784001)(54356999)(87266999)(8936002)(87936001)(6806005)(4001350100001)(47776003)(189998001)(110136002)(65816999)(2906002)(230700001)(117636001)(586003)(5003600100002)(23676002)(106466001)(229853001)(59896002)(4326007)(2950100001)(19580395003)(19580405001)(11100500001)(122286003)(53416004)(1220700001)(77096005)(36756003)(92566002)(65956001)(65806001)(62816006); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR0201MB1936; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC004; 1:4jChtfeQT5i5DrrXvc2TvbfwHDfvqX/LX8s7VUCzM7Ql2ZawiWlQVLlx99ux8TPPYdrfGTsBZFroCCxyrzgrgPOc6Rt9CtNBrYTIc2zeFCPS8UknemYRVSmDo7qD6lrHoh7BhHZTgSbTYEAt2hIO56d+sguJJthv4qloVwFEc95kxo3I9qdPayy+JeZzatmO5iyjPOWOSE5SpdIw8V9T0f5ZAWMaaZxSddpMtBvfkabjr1gLHe8aEKqOOw05uB9xUQ7h6qfyaghMvWGhl3TTgBIbsP7hGowzh2HWASg1aNFgwWhzm43084ZGaRfViDGlQs7rAMzAPxs4/x4bURGfp9nepP8zZSwNXMtOb6wRb9TPJzZLs5G8Z2dmPznqBbZ0//oVSzSGjsjaUgd/vM5wG7t9XMIeBpoxwT14xQOvCXP/46VNxDrh9zln5UYuGzfG3hr2Tuw6KFt5Rsj28IYqQA== X-MS-Office365-Filtering-Correlation-Id: b1f36f88-a2c4-4996-f4a8-08d3793149c1 X-Microsoft-Exchange-Diagnostics: 1; SN1PR0201MB1936; 2:rvyCxZTp4oovdedI86/EawMfELfVcgVqFA7S/Cbf/tmen5uQ1YOQH6d56YurGkyjs1v8mHW+iSZYGqb9YuXUYj71fwusHeLaOni44mdgfPwAVc7MjsmE0Euh4voSZSqQprBY/DZaNo0p1rJMshfrGTrh+D1ldZsRAtg+ltmVwSFPkFSBgkzDb0+U4mOWRQFn; 3:krXTMEClNLwnURS7TeAPGX8PtuaI06aEhMPaqzvouxfRqjbKMw1ZQieIR8whJ5p9R0E/BFSi9+T+5O4+FARG4I/3qkvL4tfgPeTxXLMcmj0Tx4i5nDGpvs8IY7parWbFueTlEysANdaceZmjirOuLjjW22MHln88SKBziM1lxPicHuxZMX7VYLxswM4hpVZXVGPNEr8jWnWw+k8NhceKQN8GOI/VB/htB1T6pLdNC4BOuDE2uyfA1+DXkAevhPfLy27n7B9MKLnqXoBWkQ1/Mw== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:SN1PR0201MB1936; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0201MB1936; 25:DWAmOLdJP2HzcSv4XCwNFevD+Pmv7Z+NY7BCoYhGifwezmpZlsHyjGnYRWvfu7Qar9de0EzaNkBke+FQiPmDh5Dnrs1j8ExF9ALY7M/gEianHVqDClE5zZH/TBPYK9YR5518MnJR90VKXH3+QWTGW/xsfz/xoFlNsK26IvzgSpndCf8gLmIvC6BULqKWsmnlnZIuiW0I798DErWZOBa53wxHoC31Zic9a/EdoF2gKvAe34XJXuJxUBvMq9CSaZ0Du3cZcxBHl0kNRqrXsSrZr6mpqEbcohJf8yfsji0qfrCIYjkbYVuS7MMb3kkbk0TAFbq9FCHsL8yXtjcXeqMKJoZadGn0IHvrlERMVHHEe7eXMIJrJ6PO1GAkVeT9ciZ4nnKf6sABzT3S0NVG31NY5T96XjsSkxkLhqZKTxn6GiP0pp18hZwj6bO2hY9k9HzS/FsUpH9xnbEN9wL9mbPgH6RBAQzzFaE4RCle9hQMZSteM/s+Tzjz+TGZBzmHhGplQK9UkQKEGzjQNbg9ji8o2uWOKyo1eG0/1tIcgv0xQXNFliZMVQj88g3lIO/MK1eyxQbA4oB3fyJbWePJPM/R669koBJms2rYCzi+jXf4+RiZmbio6dufWfKUsWiTfxZJHOCvGlO8CRqzGrNefV6avlfLohUOdINrgy/K8sC+1i+aN7EMtBHYYxttCyCWWerPkzEkua21iwXeBn4oRZ3SurToR4HZESIuIqfVd8SefZtUYj+FE4zeJ5aWeNVuIubOPr0vbPmLYr8ghwcVAyPxGZFMsNn0O6s78OXE/d879wo= X-Microsoft-Exchange-Diagnostics: 1; SN1PR0201MB1936; 20:ANt1eUpYslflXlXSCmm1FGCO2PGNqndJRHNNKG/RQRW1pH3sTIsWH97mpm9aCPGlftmTPBvwf2b55fpXxyjjKRLVDiLRYGLRnxGijNVCDDM+doAh9pulPrSp/eTT9yE6eeQMnSqyubKyzfW/un4J8Paep+B00wE4v81ji/PChpQ9nMhFRD2AaOwknhngwUh6gHbqOfDPKAlAMrKgpCGHvC6nlyCz19I7PsQ051RiRS3wAKqTNbplIS+ieIzsc8QxtuAfahKlSizIE/fKgj5tlClxfMS4WpcUTgx4H/BENUW4LRUUHvAd2fVXdGawD5otbPIzICdNP/5iu5udtLCaWoU2VqtIhp/L75Kaxs5RF31Yu9RTBbZFaWsDDaCw7ZAHmkSV8DWCai1/CpFDGqI8Obj6Uox2I0jhbTE5PoB++AFfnUugeZ02MgVK2SOdS8g8nJwncUyVlPxtFNckObW54J2fWIPv7RYZi2PeHPtsTUQ2WOLO2dCbvcq7IyfdAHy3; 4:AzIlKGNu9S9XGP9CO784RFMOo9hgR4ICQLbHx8bn6lD+RrOo/ItSBM81a731iahntdKgcOmIYZitTGZyo4HCpuu46TSBBaQ+M9ha3PbHiMQ1j9B7atlYYo8bsSgG3rE5nFGoZLiWUCFhA7uGFwgzWA1iRdHRT25gK9XDZ8oJhU++3g6bOWr1j0Jrkc3NnLANfWyA4pWl17KdCxNBW5nRe7eaJJ6wNu29jPcVQieQLmeb4CgqsgAR8pq+Z8N4W94hvHaF7MRExEbst6Um6G22xws+loTAku+fqMsWbwLHiOoMCAi7gRoTKja0IQ/l2CHRo2LKzv/nUux7pQC5iNeIZqVHwszaGrfD7PgpWzFKNe00ZZ7cjQsMaM8laRslgPGmLTsCDXYYe4cx6hR4uFmkjXzEhyPHmFPMAhlU 3EVtKN0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13018025)(13016025)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:SN1PR0201MB1936; BCL:0; PCL:0; RULEID:; SRVR:SN1PR0201MB1936; X-Forefront-PRVS: 0939529DE2 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtTTjFQUjAyMDFNQjE5MzY7MjM6UGduVTl3SFJNYU5mUzBsb0xaSDMvMTVQ?= =?utf-8?B?WXRH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jK5eVbfBaZyaNKt4IUUGwS2Lfgnrezk0s9vc4EbwnJAeNX4yrFiVu9+M4o=; 7:3ox37OC35gxyNpYn9ZcwhejzsFvIxwd98Lr3eAE4w5KwBeK871CRQ+ZwspX/LUtQbpflqIM8TRGZRYUNnE7y64GsApOeM4h/5PScIDhzpZ5K2MAmVvfiG4yA9gCj6US0nXg2AiDJMS77OCx0v6qAqYrsRz8qkWs/SgkLDx1zbwr8BOPueUi5pYv9hw3HD4aU; 20:8JmBumZ/1mQj6cGizo+QeGMe1S2MnbB7ldi6YAmKhjHjN2VIYk6/42/1gYAAHmV2MrAzaMqM2orOYmNFIx4tS1KeyRT4WjEQ/ioUkpFFj4hQ/GBgyyU8jIZqMPxnIVCWArt82qovsDZ+JkrUTnYBs6mHq5CypxjJiTZCRQf2oSfaFfmIjPcqP1+kKcwpRzDoFeS7boOhxYV1p1BJyLX9r30d+FF7TWdN36fscs9+EDlIc3p5HMZaN0QE6cwWv29K SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2016 00:14:58.6554 (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: SN1PR0201MB1936 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 The SRP initiator allows to set max_sectors to a value that exceeds the largest amount of data that can be mapped at once with an mlx4 HCA using fast registration and a page size of 4 KB. Hence modify ib_map_mr_sg() such that it can map partial sg-elements. If an sg-element has been mapped partially, let the caller know which fraction has been mapped by adjusting *sg_offset. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Sagi Grimberg Cc: Laurence Oberman Tested-by: Laurence Oberman --- drivers/infiniband/core/rw.c | 2 +- drivers/infiniband/core/verbs.c | 26 +++++++++++++++++++++----- drivers/infiniband/hw/cxgb3/iwch_provider.c | 2 +- drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 2 +- drivers/infiniband/hw/cxgb4/mem.c | 2 +- drivers/infiniband/hw/i40iw/i40iw_verbs.c | 2 +- drivers/infiniband/hw/mlx4/mlx4_ib.h | 2 +- drivers/infiniband/hw/mlx4/mr.c | 2 +- drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 +- drivers/infiniband/hw/mlx5/mr.c | 8 ++++++-- drivers/infiniband/hw/nes/nes_verbs.c | 2 +- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 2 +- drivers/infiniband/hw/ocrdma/ocrdma_verbs.h | 2 +- drivers/infiniband/ulp/iser/iser_memory.c | 4 ++-- drivers/infiniband/ulp/srp/ib_srp.c | 2 +- include/rdma/ib_verbs.h | 8 ++++---- net/sunrpc/xprtrdma/frwr_ops.c | 2 +- net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 2 +- 18 files changed, 47 insertions(+), 27 deletions(-) diff --git a/drivers/infiniband/core/rw.c b/drivers/infiniband/core/rw.c index 6fc50bf..1eb9b12 100644 --- a/drivers/infiniband/core/rw.c +++ b/drivers/infiniband/core/rw.c @@ -92,7 +92,7 @@ static int rdma_rw_init_one_mr(struct ib_qp *qp, u8 port_num, reg->inv_wr.next = NULL; } - ret = ib_map_mr_sg(reg->mr, sg, nents, offset, PAGE_SIZE); + ret = ib_map_mr_sg(reg->mr, sg, nents, &offset, PAGE_SIZE); if (ret < nents) { ib_mr_pool_put(qp, &qp->rdma_mrs, reg->mr); return -EINVAL; diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index 3d7b266..ffb9863 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -1655,7 +1655,7 @@ EXPORT_SYMBOL(ib_set_vf_guid); * is ready for registration. */ int ib_map_mr_sg(struct ib_mr *mr, struct scatterlist *sg, int sg_nents, - unsigned int sg_offset, unsigned int page_size) + unsigned int *sg_offset, unsigned int page_size) { if (unlikely(!mr->device->map_mr_sg)) return -ENOSYS; @@ -1672,7 +1672,10 @@ EXPORT_SYMBOL(ib_map_mr_sg); * @mr: memory region * @sgl: dma mapped scatterlist * @sg_nents: number of entries in sg - * @sg_offset: offset in bytes into sg + * @sg_offset_p: IN: start offset in bytes into sg + * OUT: offset in bytes for element n of the sg of the first + * byte that has not been processed where n is the return + * value of this function. * @set_page: driver page assignment function pointer * * Core service helper for drivers to convert the largest @@ -1684,19 +1687,24 @@ EXPORT_SYMBOL(ib_map_mr_sg); * a page vector. */ int ib_sg_to_pages(struct ib_mr *mr, struct scatterlist *sgl, int sg_nents, - unsigned int sg_offset, int (*set_page)(struct ib_mr *, u64)) + unsigned int *sg_offset_p, int (*set_page)(struct ib_mr *, u64)) { struct scatterlist *sg; u64 last_end_dma_addr = 0; + unsigned int sg_offset = sg_offset_p ? *sg_offset_p : 0; unsigned int last_page_off = 0; u64 page_mask = ~((u64)mr->page_size - 1); int i, ret; + if (unlikely(sg_nents <= 0 || sg_offset > sg_dma_len(&sgl[0]))) + return -EINVAL; + mr->iova = sg_dma_address(&sgl[0]) + sg_offset; mr->length = 0; for_each_sg(sgl, sg, sg_nents, i) { u64 dma_addr = sg_dma_address(sg) + sg_offset; + u64 prev_addr = dma_addr; unsigned int dma_len = sg_dma_len(sg) - sg_offset; u64 end_dma_addr = dma_addr + dma_len; u64 page_addr = dma_addr & page_mask; @@ -1721,8 +1729,14 @@ int ib_sg_to_pages(struct ib_mr *mr, struct scatterlist *sgl, int sg_nents, do { ret = set_page(mr, page_addr); - if (unlikely(ret < 0)) - return i ? : ret; + if (unlikely(ret < 0)) { + sg_offset = prev_addr - dma_addr; + mr->length += sg_offset; + if (sg_offset_p) + *sg_offset_p = sg_offset; + return i || sg_offset ? i : ret; + } + prev_addr = page_addr; next_page: page_addr += mr->page_size; } while (page_addr < end_dma_addr); @@ -1734,6 +1748,8 @@ next_page: sg_offset = 0; } + if (sg_offset_p) + *sg_offset_p = 0; return i; } EXPORT_SYMBOL(ib_sg_to_pages); diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c index 608aa0c..47cb927 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c @@ -784,7 +784,7 @@ static int iwch_set_page(struct ib_mr *ibmr, u64 addr) } static int iwch_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, - int sg_nents, unsigned sg_offset) + int sg_nents, unsigned int *sg_offset) { struct iwch_mr *mhp = to_iwch_mr(ibmr); diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h index 067cb3f..1ff3ba8 100644 --- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h +++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h @@ -918,7 +918,7 @@ struct ib_mr *c4iw_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type, u32 max_num_sg); int c4iw_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents, - unsigned int sg_offset); + unsigned int *sg_offset); int c4iw_dealloc_mw(struct ib_mw *mw); struct ib_mw *c4iw_alloc_mw(struct ib_pd *pd, enum ib_mw_type type, struct ib_udata *udata); diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c index 38afb3d..83960df 100644 --- a/drivers/infiniband/hw/cxgb4/mem.c +++ b/drivers/infiniband/hw/cxgb4/mem.c @@ -691,7 +691,7 @@ static int c4iw_set_page(struct ib_mr *ibmr, u64 addr) } int c4iw_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents, - unsigned int sg_offset) + unsigned int *sg_offset) { struct c4iw_mr *mhp = to_c4iw_mr(ibmr); diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c index 141eaba..4a740f7 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c +++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c @@ -1574,7 +1574,7 @@ static int i40iw_set_page(struct ib_mr *ibmr, u64 addr) * @sg_nents: number of sg pages */ static int i40iw_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, - int sg_nents, unsigned int sg_offset) + int sg_nents, unsigned int *sg_offset) { struct i40iw_mr *iwmr = to_iwmr(ibmr); diff --git a/drivers/infiniband/hw/mlx4/mlx4_ib.h b/drivers/infiniband/hw/mlx4/mlx4_ib.h index ba328177..6c5ac5d 100644 --- a/drivers/infiniband/hw/mlx4/mlx4_ib.h +++ b/drivers/infiniband/hw/mlx4/mlx4_ib.h @@ -718,7 +718,7 @@ struct ib_mr *mlx4_ib_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type, u32 max_num_sg); int mlx4_ib_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents, - unsigned int sg_offset); + unsigned int *sg_offset); int mlx4_ib_modify_cq(struct ib_cq *cq, u16 cq_count, u16 cq_period); int mlx4_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata); struct ib_cq *mlx4_ib_create_cq(struct ib_device *ibdev, diff --git a/drivers/infiniband/hw/mlx4/mr.c b/drivers/infiniband/hw/mlx4/mr.c index b04f623..6312721 100644 --- a/drivers/infiniband/hw/mlx4/mr.c +++ b/drivers/infiniband/hw/mlx4/mr.c @@ -529,7 +529,7 @@ static int mlx4_set_page(struct ib_mr *ibmr, u64 addr) } int mlx4_ib_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents, - unsigned int sg_offset) + unsigned int *sg_offset) { struct mlx4_ib_mr *mr = to_mmr(ibmr); int rc; diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h index 8c835b2..f05cf57 100644 --- a/drivers/infiniband/hw/mlx5/mlx5_ib.h +++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h @@ -713,7 +713,7 @@ struct ib_mr *mlx5_ib_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type, u32 max_num_sg); int mlx5_ib_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents, - unsigned int sg_offset); + unsigned int *sg_offset); int mlx5_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, const struct ib_wc *in_wc, const struct ib_grh *in_grh, const struct ib_mad_hdr *in, size_t in_mad_size, diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c index b678eac..8cf2ce5 100644 --- a/drivers/infiniband/hw/mlx5/mr.c +++ b/drivers/infiniband/hw/mlx5/mr.c @@ -1752,10 +1752,11 @@ static int mlx5_ib_sg_to_klms(struct mlx5_ib_mr *mr, struct scatterlist *sgl, unsigned short sg_nents, - unsigned int sg_offset) + unsigned int *sg_offset_p) { struct scatterlist *sg = sgl; struct mlx5_klm *klms = mr->descs; + unsigned int sg_offset = sg_offset_p ? *sg_offset_p : 0; u32 lkey = mr->ibmr.pd->local_dma_lkey; int i; @@ -1774,6 +1775,9 @@ mlx5_ib_sg_to_klms(struct mlx5_ib_mr *mr, sg_offset = 0; } + if (sg_offset_p) + *sg_offset_p = sg_offset; + return i; } @@ -1792,7 +1796,7 @@ static int mlx5_set_page(struct ib_mr *ibmr, u64 addr) } int mlx5_ib_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents, - unsigned int sg_offset) + unsigned int *sg_offset) { struct mlx5_ib_mr *mr = to_mmr(ibmr); int n; diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c index 698aab6..4ebea4c 100644 --- a/drivers/infiniband/hw/nes/nes_verbs.c +++ b/drivers/infiniband/hw/nes/nes_verbs.c @@ -403,7 +403,7 @@ static int nes_set_page(struct ib_mr *ibmr, u64 addr) } static int nes_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, - int sg_nents, unsigned int sg_offset) + int sg_nents, unsigned int *sg_offset) { struct nes_mr *nesmr = to_nesmr(ibmr); diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index 9ddd550..b1a3d91 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c @@ -3082,7 +3082,7 @@ static int ocrdma_set_page(struct ib_mr *ibmr, u64 addr) } int ocrdma_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents, - unsigned int sg_offset) + unsigned int *sg_offset) { struct ocrdma_mr *mr = get_ocrdma_mr(ibmr); diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.h b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.h index b290e5d..704ef1e 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.h +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.h @@ -123,6 +123,6 @@ struct ib_mr *ocrdma_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type, u32 max_num_sg); int ocrdma_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents, - unsigned sg_offset); + unsigned int *sg_offset); #endif /* __OCRDMA_VERBS_H__ */ diff --git a/drivers/infiniband/ulp/iser/iser_memory.c b/drivers/infiniband/ulp/iser/iser_memory.c index 44cc85f..90be568 100644 --- a/drivers/infiniband/ulp/iser/iser_memory.c +++ b/drivers/infiniband/ulp/iser/iser_memory.c @@ -236,7 +236,7 @@ int iser_fast_reg_fmr(struct iscsi_iser_task *iser_task, page_vec->npages = 0; page_vec->fake_mr.page_size = SIZE_4K; plen = ib_sg_to_pages(&page_vec->fake_mr, mem->sg, - mem->size, 0, iser_set_page); + mem->size, NULL, iser_set_page); if (unlikely(plen < mem->size)) { iser_err("page vec too short to hold this SG\n"); iser_data_buf_dump(mem, device->ib_device); @@ -446,7 +446,7 @@ static int iser_fast_reg_mr(struct iscsi_iser_task *iser_task, ib_update_fast_reg_key(mr, ib_inc_rkey(mr->rkey)); - n = ib_map_mr_sg(mr, mem->sg, mem->size, 0, SIZE_4K); + n = ib_map_mr_sg(mr, mem->sg, mem->size, NULL, SIZE_4K); if (unlikely(n != mem->size)) { iser_err("failed to map sg (%d/%d)\n", n, mem->size); diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index f4dc6f9..6440469 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -1329,7 +1329,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, sg_nents, 0, dev->mr_page_size); + n = ib_map_mr_sg(desc->mr, state->sg, sg_nents, NULL, dev->mr_page_size); if (unlikely(n < 0)) { srp_fr_pool_put(ch->fr_pool, &desc, 1); pr_debug("%s: ib_map_mr_sg(%d) returned %d.\n", diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 544c55b..56bb0f3 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -1848,7 +1848,7 @@ struct ib_device { int (*map_mr_sg)(struct ib_mr *mr, struct scatterlist *sg, int sg_nents, - unsigned sg_offset); + unsigned int *sg_offset); struct ib_mw * (*alloc_mw)(struct ib_pd *pd, enum ib_mw_type type, struct ib_udata *udata); @@ -3145,11 +3145,11 @@ struct net_device *ib_get_net_dev_by_params(struct ib_device *dev, u8 port, const struct sockaddr *addr); int ib_map_mr_sg(struct ib_mr *mr, struct scatterlist *sg, int sg_nents, - unsigned int sg_offset, unsigned int page_size); + unsigned int *sg_offset, unsigned int page_size); static inline int ib_map_mr_sg_zbva(struct ib_mr *mr, struct scatterlist *sg, int sg_nents, - unsigned int sg_offset, unsigned int page_size) + unsigned int *sg_offset, unsigned int page_size) { int n; @@ -3160,7 +3160,7 @@ ib_map_mr_sg_zbva(struct ib_mr *mr, struct scatterlist *sg, int sg_nents, } int ib_sg_to_pages(struct ib_mr *mr, struct scatterlist *sgl, int sg_nents, - unsigned int sg_offset, int (*set_page)(struct ib_mr *, u64)); + unsigned int *sg_offset, int (*set_page)(struct ib_mr *, u64)); void ib_drain_rq(struct ib_qp *qp); void ib_drain_sq(struct ib_qp *qp); diff --git a/net/sunrpc/xprtrdma/frwr_ops.c b/net/sunrpc/xprtrdma/frwr_ops.c index 3274a4a..94c3fa9 100644 --- a/net/sunrpc/xprtrdma/frwr_ops.c +++ b/net/sunrpc/xprtrdma/frwr_ops.c @@ -421,7 +421,7 @@ frwr_op_map(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr_seg *seg, return -ENOMEM; } - n = ib_map_mr_sg(mr, frmr->sg, frmr->sg_nents, 0, PAGE_SIZE); + n = ib_map_mr_sg(mr, frmr->sg, frmr->sg_nents, NULL, PAGE_SIZE); if (unlikely(n != frmr->sg_nents)) { pr_err("RPC: %s: failed to map mr %p (%u/%u)\n", __func__, frmr->fr_mr, n, frmr->sg_nents); diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c index 19a74e9..fbe7444 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c @@ -281,7 +281,7 @@ int rdma_read_chunk_frmr(struct svcxprt_rdma *xprt, } atomic_inc(&xprt->sc_dma_used); - n = ib_map_mr_sg(frmr->mr, frmr->sg, frmr->sg_nents, 0, PAGE_SIZE); + n = ib_map_mr_sg(frmr->mr, frmr->sg, frmr->sg_nents, NULL, PAGE_SIZE); if (unlikely(n != frmr->sg_nents)) { pr_err("svcrdma: failed to map mr %p (%d/%d elements)\n", frmr->mr, n, frmr->sg_nents);