From patchwork Fri Jan 29 23:12:49 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: 8168511 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 2ECD49F96D for ; Fri, 29 Jan 2016 23:13:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 33F482039C for ; Fri, 29 Jan 2016 23:13:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4504020398 for ; Fri, 29 Jan 2016 23:13:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753509AbcA2XNM (ORCPT ); Fri, 29 Jan 2016 18:13:12 -0500 Received: from mail-bl2on0090.outbound.protection.outlook.com ([65.55.169.90]:63214 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753351AbcA2XNK (ORCPT ); Fri, 29 Jan 2016 18:13:10 -0500 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=VWtjm614x1rs/Nx04BEDorXmLRaALWpXxQNPUv7n9V4=; b=ZUtWd2ax+eYZtyyMAWKlZY2IX57z1vZct4nILVP0bSaDPBt4bSRG7SC4NtDVrl8tG+eaHyzA8hu/zkj9Csrazjh6JSMmMbJz6Q/ko8DWmMvMR0tBNnKflxEcynL5OoJOQlqZ7oZaLCx0HW6ch/5nsRwgxLzwQh1bL0GyPbds0yk= Received: from BN1PR02CA0046.namprd02.prod.outlook.com (10.141.56.46) by DM2PR0201MB0832.namprd02.prod.outlook.com (10.160.95.153) with Microsoft SMTP Server (TLS) id 15.1.390.13; Fri, 29 Jan 2016 23:13:08 +0000 Received: from BN1AFFO11FD005.protection.gbl (2a01:111:f400:7c10::153) by BN1PR02CA0046.outlook.office365.com (2a01:111:e400:2a::46) with Microsoft SMTP Server (TLS) id 15.1.390.13 via Frontend Transport; Fri, 29 Jan 2016 23:13:07 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.174) smtp.mailfrom=sandisk.com; mellanox.com; dkim=none (message not signed) header.d=none;mellanox.com; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.174 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.174; helo=milsmgep12.sandisk.com; Received: from milsmgep12.sandisk.com (63.163.107.174) by BN1AFFO11FD005.mail.protection.outlook.com (10.58.52.65) with Microsoft SMTP Server id 15.1.355.15 via Frontend Transport; Fri, 29 Jan 2016 23:13:07 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com ( [172.22.12.162]) by (Symantec Messaging Gateway) with SMTP id 36.A8.25823.102FBA65; Fri, 29 Jan 2016 15:13:05 -0800 (PST) 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.248.2; Fri, 29 Jan 2016 15:12:49 -0800 X-AuditID: ac160a69-a17cc980000064df-62-56abf201035c Received: from [10.60.52.49] ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 8C.47.02700.1F1FBA65; Fri, 29 Jan 2016 15:12:49 -0800 (PST) Subject: [PATCH v2 05/22] IB/srpt: Introduce target_reverse_dma_direction() To: Doug Ledford References: <56ABF16E.7070006@sandisk.com> CC: Christoph Hellwig , Sagi Grimberg , "Alex Estrin" , "linux-rdma@vger.kernel.org" From: Bart Van Assche Message-ID: <56ABF1F1.6060102@sandisk.com> Date: Fri, 29 Jan 2016 15:12:49 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <56ABF16E.7070006@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOLMWRmVeSWpSXmKPExsWyRoxnkS7jp9VhBodXCllcePqdyeLl+Q+s FitXH2WyeHaol8XiRtsDNgdWj8V7XjJ57L7ZwObxbPphJo/3+66yeXzeJBfAGsVlk5Kak1mW WqRvl8CVcW3ZT5aCS3wVz3u+MzUwrubpYuTkkBAwkWhcOJuxi5GLQ0hgE6PEidWv2UASQgI7 GCW+Ts2DKVo99TorRNEcRokpbZOYQRLCAt4S0773s4PYIgJqEpteLWKHaNaSOHfhCztIA7PA KkaJTVevgyXYBIwkvr2fyQJi8wIVveu7DGazCKhK/JjSxQpiiwpESBzu7GKHqBGUODnzCVgN p4C2xJLZF4BsDqChmhLrd+mDhJkF5CW2v53DDLJLQmAvq8SRO+eZIY5Qlzi5ZD7TBEbhWUhG zUJon4WkfQEj8ypGsdzMnOLc9NQCQyO94sS8lMzibL3k/NxNjODo4MrcwbhikvkhRgEORiUe 3gUrVocJsSaWFVfmHmKU4GBWEuGtewEU4k1JrKxKLcqPLyrNSS0+xCjNwaIkzmvdohYmJJCe WJKanZpakFoEk2Xi4JRqYNQM4o5wDmbY3to3b16JlvzNx18FjZ4a/73V1yHo9fVG2EzVsuNe GwoiXG6sz3ocEnDTO5tXWeLsc7lTsTeeZD39cOvdVnsRxaWrRP+9etKySvNk+3L/2O0bS4zP r5/1NnpmOaPKP6ldJVOmb3fhipry5vuXiKts+0OZ+3XkKj5d4rDgf6ItJ6bEUpyRaKjFXFSc CACNmkONigIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrPJMWRmVeSWpSXmKPExsXCtZEjRffjx9VhBqfnqlpcePqdyeLl+Q+s FitXH2WyeHaol8XiRtsDNgdWj8V7XjJ57L7ZwObxbPphJo/3+66ye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US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(189002)(199003)(64126003)(11100500001)(33656002)(5008740100001)(36756003)(1220700001)(586003)(1096002)(23676002)(4326007)(92566002)(2906002)(230700001)(47776003)(50986999)(19580395003)(83506001)(80316001)(76176999)(19580405001)(110136002)(87936001)(4001350100001)(87266999)(50466002)(65816999)(65956001)(65806001)(77096005)(189998001)(86362001)(229853001)(2950100001)(5001960100002)(106466001)(54356999); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR0201MB0832; H:milsmgep12.sandisk.com; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0201MB0832; 2:m8H5lGOxFllaHhQnCw/R0tZhytfGxatTLtY40fr1vUpPGt+l3pnlEisak5UCRxoE3sODZ4QL8A9Yt5Cpcd7QQOW1NTJyBF0RbwVPdDguhxyMAVUppam42M0o60XhFEIsAhNvbmzLPoN/jJrQYW6tpQ==; 3:0Ae27K4joMfxfBdmqlApLmNSu37/RxobdaEiDV3i5lRsDMg1oNuzAbLes8VnMTkDwXYgZDwbmX9EXoCJc/NrH7arwny9q95slJTT3H33b1MypaPCxQPXHIU11rSKiognnM48rWh7BQVqjJrv520LF6kxQBpCQwxEpbobHrJOTtE2fD/xRKa0ADQO6x1dQcFlNlpQideoXh9ZwKuez/DZYTx2kk89AnLUU7/4H04Gbl+xB3527QpSPOoGjsRgYJx4ZGEZhL5oWgKVe0tFHAJ7KA==; 25:X0QladxPzGtV4pw0Dh8NAO3jIV2oZvVYMuYVZGFIi40DfJ6p0E0FoAdyHjU1lLqQ4Cjsu+EreDdPM3Va3VS3ii+mlHAA6tlyhoocOZqgaPlRZsTxL4Z0GeYhkGo7F0ZV+8gPKAzRcc5LhjOCGBD1b0ySd4r3C2UXvLm5yYF/jT4cyEIwGbgKuAWDW+5+15k4LeN9WEzw2BaJcmk7Vnfb8ILlgPVoWrQ3dos7a0MNTkNKS9i5Y91WoEkDwyx36LT7 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501001); SRVR:DM2PR0201MB0832; X-MS-Office365-Filtering-Correlation-Id: 7387c3da-2e71-4572-9a19-08d32901bfb4 X-Microsoft-Exchange-Diagnostics: 1; DM2PR0201MB0832; 20:56gT84jdIJ3G9qdX2mx6KhahARaYmT80tNMi86KZnuMJ0gpQv5S7FqQ/tIfAB1E38m15cjS27dGrnZL05KDfKrOvwI3XDZqAUwPCCGMbUu1mwhptzFZsfbpNMyZHbvtQw376zWdrW0WeRfn3Vki+NEWHDZhiZTKr5CN1AGPsk/IiogbPxe8/WNxq7r3v1wRjRtxhYhkOUYC34xljWU+7+NGb7xtOfsr5cB1lzETxZU+ISGr1eq0vKqF5hKdcKBrolUKMM2fbWp0258gzJu6ltFy7e+bZ6VhnzgPkfXeAjIoEbH8xtn+3Q+WXN9Va/3AJ4Vs5AzeE1diRWq9KPwJ4C/PS497VUTjAQeyiTdXlCJI+2g/9Rk56NH+Oh6w7vXgWeS2pEoWXXSw4gRj7m+PyjJBUJ14DJDuq9OquDhLBkeWb2MnELH138mnMmR/Pt+YdPWEfkTUi1DSpjxrmZOcb8MqAueZDzIujB2v3CHgUGxfFPnuvGap+vBiYHa94V2gT 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)(13017025)(5005006)(13024025)(13018025)(13015025)(13023025)(10201501046)(3002001); SRVR:DM2PR0201MB0832; BCL:0; PCL:0; RULEID:; SRVR:DM2PR0201MB0832; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0201MB0832; 4:F2OHp1U2uczf/iPJ7rxgJcZLew24lhxKEHYbRQmO6L5vOyru9caQh+TR5U7kK5AHZQIuO+6BlbUWAcuSHoaI/zGs7rH5WlaMBcehPH4UZRjngDOy1fiyviBuicUSPk4XYZ6wdD40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pGYmNXYkhmdzZFSDNDQ2c4SFE4RnNPWG4vWkFpc1h4cWZ3Smd5MjNu?= =?utf-8?Q?7v9jIwSKIiwA47GrjSEVaoF890ZJG?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR0201MB0832; 5:4xVUiV8EuuvRcySJ/rzzUp2oDXACxE7qKDxVzHaphQwQ2eP8JunYv+ocRgDwKEuF6qGJt7TA/OUa1erXRZB953/0BKeRulSw6l8Z8h0b5qOnN5uZIc8CDKtg2zeVs7iWYlrHqtSonzd9pBk6zGx0Sw==; 24:Xaz9JRf+eQKXHuPx26GDmRHjDEh7xAJ7BWvXmpJX4UAItYFFV6G+GwqOSpYoEM7uBGWaqBmpjdAVC9xc1sKbKKXAAwQKwB/5/at1JPsRBw8=; 20:tG1GdiRIucPb28PbFUt0PA3vKWBnUxWnomPthKjCKOcmyrSwYyh8niOmvr/7vjziPNplRU3rtl/L0pj219fJqvrkytBzkPOYMfzaF5DC8/5Ge19USqaw/aIurOfWD2nqX6usW75Hgp8a5HG5S2nJlNPEkG36mrNbjfER14DT1MAsjYO6qX0LjXVCYS0QkoDWHS7e1KNK/rWrooVvCELnXd8z21xl8CTT0JnxolJps57KpG5tUhMC8w1kiWvSVL6+ SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2016 23:13:07.2214 (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.174]; Helo=[milsmgep12.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0201MB0832 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.8 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 Use the function target_reverse_dma_direction() instead of reimplementing it. Signed-off-by: Bart Van Assche Reviewed-by: Christoph Hellwig Reviewed-by: Sagi Grimberg --- drivers/infiniband/ulp/srpt/ib_srpt.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 018be38..1fb8bb6 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -96,19 +96,6 @@ static int srpt_queue_status(struct se_cmd *cmd); static void srpt_recv_done(struct ib_cq *cq, struct ib_wc *wc); static void srpt_send_done(struct ib_cq *cq, struct ib_wc *wc); -/** - * opposite_dma_dir() - Swap DMA_TO_DEVICE and DMA_FROM_DEVICE. - */ -static inline -enum dma_data_direction opposite_dma_dir(enum dma_data_direction dir) -{ - switch (dir) { - case DMA_TO_DEVICE: return DMA_FROM_DEVICE; - case DMA_FROM_DEVICE: return DMA_TO_DEVICE; - default: return dir; - } -} - static enum rdma_ch_state srpt_set_ch_state(struct srpt_rdma_ch *ch, enum rdma_ch_state new_state) { @@ -1049,7 +1036,7 @@ static void srpt_unmap_sg_to_ib_sge(struct srpt_rdma_ch *ch, dir = ioctx->cmd.data_direction; BUG_ON(dir == DMA_NONE); ib_dma_unmap_sg(ch->sport->sdev->device, sg, ioctx->sg_cnt, - opposite_dma_dir(dir)); + target_reverse_dma_direction(&ioctx->cmd)); ioctx->mapped_sg_count = 0; } } @@ -1086,7 +1073,7 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch, ioctx->sg_cnt = sg_cnt = cmd->t_data_nents; count = ib_dma_map_sg(ch->sport->sdev->device, sg, sg_cnt, - opposite_dma_dir(dir)); + target_reverse_dma_direction(cmd)); if (unlikely(!count)) return -EAGAIN;