From patchwork Tue Aug 11 00:08:44 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: 6987041 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 456549F373 for ; Tue, 11 Aug 2015 00:10:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 41445205B9 for ; Tue, 11 Aug 2015 00:10:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 26BC0205B8 for ; Tue, 11 Aug 2015 00:10:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933067AbbHKAKS (ORCPT ); Mon, 10 Aug 2015 20:10:18 -0400 Received: from mail-bl2on0074.outbound.protection.outlook.com ([65.55.169.74]:31094 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933486AbbHKAKP (ORCPT ); Mon, 10 Aug 2015 20:10:15 -0400 Received: from BLUPR0201CA0041.namprd02.prod.outlook.com (10.163.116.51) by BN1PR0201MB0739.namprd02.prod.outlook.com (10.160.169.26) with Microsoft SMTP Server (TLS) id 15.1.225.19; Tue, 11 Aug 2015 00:10:12 +0000 Received: from BL2FFO11FD032.protection.gbl (2a01:111:f400:7c09::161) by BLUPR0201CA0041.outlook.office365.com (2a01:111:e400:52e7::51) with Microsoft SMTP Server (TLS) id 15.1.225.19 via Frontend Transport; Tue, 11 Aug 2015 00:09:09 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.172) smtp.mailfrom=sandisk.com; obsidianresearch.com; 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 BL2FFO11FD032.mail.protection.outlook.com (10.173.160.73) with Microsoft SMTP Server id 15.1.243.9 via Frontend Transport; Tue, 11 Aug 2015 00:09:08 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com ( [172.22.12.162]) by milsmgep11.sandisk.com (Symantec Messaging Gateway) with SMTP id 3F.EB.04667.C0D39C55; Mon, 10 Aug 2015 17:08:44 -0700 (PDT) Received: from milsmgip12.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:57 -0700 X-AuditID: ac160a68-f790b6d00000123b-ff-55c93d0c774e Received: from [10.60.52.33] ( [10.177.8.100]) by milsmgip12.sandisk.com (Symantec Messaging Gateway) with SMTP id AF.33.04661.C0D39C55; Mon, 10 Aug 2015 17:08:44 -0700 (PDT) Subject: [PATCH 6/8] IB/srp: Introduce srp_device.use_fmr 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: <55C93D0C.7060000@sandisk.com> Date: Mon, 10 Aug 2015 17:08:44 -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> X-Brightmail-Tracker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VzcHAKaEs0TpWFGKku8WfeJajx8hLb385hnsDIPwtJxywkZbOQlC1gZF7FKJabmVOcm55Z YGikV5yYl5JZnK2XnJ+7iREcfJxROxivTzQ/xMjEwSnVwGi2v5hlevGj67e+sVVmq11nrlXT qJ0V7LfIU7Xj28S9q0r93rY8uL5k9r0F5/498eh+7bM0O5jnzqzJe54G/H3MmeL4Vl75pN7z 7LWpW77JSXxm+/r+xHqB2Oipv5mvLGv4eDTPfYPH5nNn2Y7Lrj+4asJr91dFbeE+5xTLez05 ajvn3mUu1elVYinOSDTUYi4qTgQA2Q0jtO4BAAA= X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD032; 1:V+iNQ29vO68QnD4WMpLbSpRutwcdqlEdk0YprYOZHyOrihMV3QNC71f8xEeIxoZETxmJPoceEOiPS+Ey884DzwwTtWD1ASmLj9uVMgs7nushtU/OG+fQIsoOcKaBGIsYE3Qz6MYYeakJLzQw/6xKYIMcBmAsEs1dLVbmp3vqmG8ycbKbg38Big4pyuHjwor7I5GEo8xJya88HKxNz5AcvsUn16GvCYuw6bK4c30q/hvSEN+bWo98z1Bk62MvZ0IAsVXJW1Ey5cmafCfTfaT9KmchYy1MkHBlfUu94o0wRq2zWGXA81+PSfGGSzalHYNKp+UHeDnkLw1NATCu8zNc8w== 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)(189998001)(50986999)(4001350100001)(47776003)(65816999)(65806001)(87936001)(50466002)(76176999)(65956001)(36756003)(86362001)(7520500002)(4001540100001)(77096005)(2950100001)(54356999)(68736005)(87266999)(81156007)(97736004)(106466001)(19580405001)(229853001)(110136002)(5001920100001)(19580395003)(80316001)(93886004)(5001960100002)(23676002)(92566002)(33656002)(62966003)(46102003)(83506001)(59896002)(69596002)(64126003)(77156002)(5001830100001)(5001860100001)(64706001)(309714004); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0201MB0739; H:milsmgep11.sandisk.com; FPR:; SPF:Pass; PTR:ErrorRetry; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0739; 2:YzJlwmoo6hjSLoyAXcW9QNFJWwhXO41QCImLyswqUdl2zUdZXyORY41KHLvuDO9CsqovgXQcDtI5266TEKE86trqR7is0HAO3zQ1z0u+PZ2RaLp8VwNVOh9gDFa+QUFhAf9tL9yWTwdHTDc4Hc0PJXOmOVf1BV3jPrQ8x1GxYbc=; 3:QplHv5Rit+tEvwFgRn7pP/8hKP24/zTcRuvWQSBjc1ZMUdycdwHcvR7eIcXx8HZ3wZUs+WNbPn/Trtst3AE83ULNIpdmMLRi7ZjffFR4a1WonS7M0UXJIgiDPEooxqBLmMAy/4gX/RpwR3eWVob/uUk8CUb5+D/k8fhSPaabo9ljq6ovXdoecfkkJz3uxmbeMB4BeWKGH8gYYkGVqfQIein0XP4WHLYHFdcGgUpH/as4q3BeLnZLOYlfM3LWZr1e; 25:Acj7IQhaDhRkr+7DRYay5ZuK8JWCw7ReQxGwiEa6l8VosmTilPTRj3BXw8kZ8p7pjXgqZ7+UhyLBYpQcJyc/Kg5021BIo53ev5rb7rtEKZOWStHhUTQbtL3MsDnS9udDN1n133ksZi8SwPXpCvsU+iamIFJ2sKW6pHKPbzELQzL5KvUtLunkgEgzBDAmzSWvY5Fw3VURD7nJYl4A/ELcolZQRxKokKILGNGkWKiTiIm9WzMqqzad2I0dU1wEKjYd X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN1PR0201MB0739; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0739; 20:Hxs0ras9RCdjI9+dpQbbW4oYBgiZkMT9l1b0bmhkhPq3UACj2KH//VIsTc6joXkoX4nL340xtwhQcz4MewkBfHE2dgsDPza1kltPbx5g03B5lX5bQc+6OGBnvrjDQ9J49fA+TdvHjPuBFNSIJQPjzq8b5rHSw8ZgkptbpaJdx3pjxbYVbYPy4GsgW3F2RE7+9ODsIpatnQvcZUnAgu/ghkMbyvR/A4mf7RL59PqeuFTYdK+gnI0jhD1Tdg7KD4lsXxY1Wz4PepOoa9k4Y6Z2zGXMPUMlDcoXTGU0QhMimRTktkWdoZ+qQFyCEuSfWYrvdMXhTZGGAAaYGB/CJqGKsBa9Rgv/MUmTXqxA+bp2oeElH9wMreUMvBMVGXVcZHgGqBWsuylTWD6z/y6EYttjYzxW96BDHhwQ8vyVyVTdiyGt+1DLoL6oPl2BwCMuGxomKDSCn1PRG/RUuWt3xraWnspZBDT9UO0yDG6Q1JgKSdryNOUJHrcgTgNwjhkYCSqS; 4:hx8b7d+X8bYXXuALXfDRsYYjI7K/HsDqflG5Go0B23xv28DLDwFw8EQZnLlFCglosBdkyUUHqn/LXrciFo6UpoHDcQLRR3NPyFfuCaasmObAXWua4pIbUHKoqzdDzjScihwRM2B17H3+US5y6ThuRJyQucW/X7iQ9oK2BI8MiGLZbEw/pVSiLSFIKa3DxwTW6nN4Fk8W8EU5M693oyoFRSj5gxm6O9JRTMcKcqjVd9bwq02vozDCBb9i2f8fKQ+AS1wY/maPBGV1i2QwR/WJyewYPMKLxh63DyAzt9HmvSI= 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:BN1PR0201MB0739; BCL:0; PCL:0; RULEID:; SRVR:BN1PR0201MB0739; X-Forefront-PRVS: 066517B35B X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTjFQUjAyMDFNQjA3Mzk7MjM6cmlwZW1kQUV2eTg4OWRJUm9BdjJ1eGRZ?= =?utf-8?B?TUYvd1NwR2ZoNnc3SlJJRlpRL3NyaVZ6VW9GRlp4Q243ODFMazdnTG1hOW1E?= =?utf-8?B?cWlseWlDaE81NDFVeWF0TUZyOTJVZ0tYNksrU2V1TTFlbVdPdW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qg97JNS2yWD8hEl9m3erYaoOJEEfC9pA10NpeM3GwbvmKLHWXPp7Lo0u+0ZkO6HPQzHDC9k1tsyTICch3SI+7hHuuxrmjjqyZLmdKpE=; 20:JVC28eqWAIVCFqSihItPncGk6MwHWL/o7fKwbKLaSGjUqP1afudiyqN1BZFmSSnvMGA6S40+ZM4YHv9tJCtpZUwMo3aIslW6XgGUsbiYc5rNrx6/vCQmf224deYiTH3oCzOltUF23EeHDiBcbdTYdIfBPeHHQ7/lRuLd+mrcrjE= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2015 00:09:08.2874 (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: BN1PR0201MB0739 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 Introduce the variable srp_device.use_fmr. Leave out the dev->has_fr / dev->has_fmr and ch->fr_pool / ch->fmr_pool checks since these are redundant. This patch does not change any functionality but makes the source code easier to read. Signed-off-by: Bart Van Assche --- drivers/infiniband/ulp/srp/ib_srp.c | 22 +++++++++++----------- drivers/infiniband/ulp/srp/ib_srp.h | 1 + 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index b8fc35b..1029fd2 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -546,7 +546,7 @@ static int srp_create_ch_ib(struct srp_rdma_ch *ch) if (ret) goto err_qp; - if (dev->use_fast_reg && dev->has_fr) { + if (dev->use_fast_reg) { fr_pool = srp_alloc_fr_pool(target); if (IS_ERR(fr_pool)) { ret = PTR_ERR(fr_pool); @@ -557,7 +557,7 @@ static int srp_create_ch_ib(struct srp_rdma_ch *ch) if (ch->fr_pool) srp_destroy_fr_pool(ch->fr_pool); ch->fr_pool = fr_pool; - } else if (!dev->use_fast_reg && dev->has_fmr) { + } else if (dev->use_fmr) { fmr_pool = srp_alloc_fmr_pool(target); if (IS_ERR(fmr_pool)) { ret = PTR_ERR(fmr_pool); @@ -623,7 +623,7 @@ static void srp_free_ch_ib(struct srp_target_port *target, if (dev->use_fast_reg) { if (ch->fr_pool) srp_destroy_fr_pool(ch->fr_pool); - } else { + } else if (dev->use_fmr) { if (ch->fmr_pool) ib_destroy_fmr_pool(ch->fmr_pool); } @@ -1085,7 +1085,7 @@ static void srp_unmap_data(struct scsi_cmnd *scmnd, if (req->nmdesc) srp_fr_pool_put(ch->fr_pool, req->fr_list, req->nmdesc); - } else { + } else if (dev->use_fmr) { struct ib_pool_fmr **pfmr; for (i = req->nmdesc, pfmr = req->fmr_list; i > 0; i--, pfmr++) @@ -1345,8 +1345,11 @@ static int srp_finish_mapping(struct srp_map_state *state, struct srp_rdma_ch *ch) { struct srp_target_port *target = ch->target; + struct srp_device *dev = target->srp_host->srp_dev; int ret = 0; + WARN_ON_ONCE(!dev->use_fast_reg && !dev->use_fmr); + if (state->npages == 0) return 0; @@ -1354,8 +1357,7 @@ static int srp_finish_mapping(struct srp_map_state *state, srp_map_desc(state, state->base_dma_addr, state->dma_len, target->rkey); else - ret = target->srp_host->srp_dev->use_fast_reg ? - srp_map_finish_fr(state, ch) : + ret = dev->use_fast_reg ? srp_map_finish_fr(state, ch) : srp_map_finish_fmr(state, ch); if (ret == 0) { @@ -1417,21 +1419,18 @@ static int srp_map_sg(struct srp_map_state *state, struct srp_rdma_ch *ch, struct srp_device *dev = target->srp_host->srp_dev; struct scatterlist *sg; int i, ret; - bool use_mr; state->desc = req->indirect_desc; state->pages = req->map_page; if (dev->use_fast_reg) { state->fr.next = req->fr_list; state->fr.end = req->fr_list + target->cmd_sg_cnt; - use_mr = !!ch->fr_pool; - } else { + } else if (dev->use_fmr) { state->fmr.next = req->fmr_list; state->fmr.end = req->fmr_list + target->cmd_sg_cnt; - use_mr = !!ch->fmr_pool; } - if (use_mr) { + if (dev->use_fast_reg || dev->use_fmr) { for_each_sg(scat, sg, count, i) { ret = srp_map_sg_entry(state, ch, sg, i); if (ret) @@ -3355,6 +3354,7 @@ static void srp_add_one(struct ib_device *device) 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 diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h index 1e42418..60a33c1 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.h +++ b/drivers/infiniband/ulp/srp/ib_srp.h @@ -102,6 +102,7 @@ struct srp_device { int max_pages_per_mr; bool has_fmr; bool has_fr; + bool use_fmr; bool use_fast_reg; };