From patchwork Thu Feb 11 19:05:01 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: 8284541 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 84B869F38B for ; Thu, 11 Feb 2016 19:05:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7FDC820222 for ; Thu, 11 Feb 2016 19:05:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5F60720121 for ; Thu, 11 Feb 2016 19:05:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750752AbcBKTFQ (ORCPT ); Thu, 11 Feb 2016 14:05:16 -0500 Received: from mail-by2on0084.outbound.protection.outlook.com ([207.46.100.84]:58080 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750967AbcBKTFG (ORCPT ); Thu, 11 Feb 2016 14:05:06 -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=W1xSooBLlcqwHtHK7RV8x+CRP29ifvMkUlajAvYJ3Uk=; b=Jx4prWaUiAtK7M87tEOrYHNWKrNIsffE+rKKpZGYQjiCSttL6OsbRPD/Fask1qRu155NXi551qOPPGAFBHZJiBLcyabzzPzkS+qBavhzrqf2rGmvG6NdXgvzb8GvrBMMdp8zsOXUo405kekr4GT+UnsexDwgd52UQg4FQlAEFWs= Received: from BN1PR02CA0030.namprd02.prod.outlook.com (10.141.56.30) by CY1PR0201MB0825.namprd02.prod.outlook.com (10.160.141.26) with Microsoft SMTP Server (TLS) id 15.1.409.15; Thu, 11 Feb 2016 19:05:04 +0000 Received: from BL2FFO11FD027.protection.gbl (2a01:111:f400:7c09::136) by BN1PR02CA0030.outlook.office365.com (2a01:111:e400:2a::30) with Microsoft SMTP Server (TLS) id 15.1.409.15 via Frontend Transport; Thu, 11 Feb 2016 19:05:04 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.172) smtp.mailfrom=sandisk.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; 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 BL2FFO11FD027.mail.protection.outlook.com (10.173.161.106) with Microsoft SMTP Server id 15.1.415.6 via Frontend Transport; Thu, 11 Feb 2016 19:05:03 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com ( [172.22.12.162]) by (Symantec Messaging Gateway) with SMTP id E4.16.02658.E5BDCB65; Thu, 11 Feb 2016 11:05:02 -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; Thu, 11 Feb 2016 11:05:02 -0800 X-AuditID: ac160a68-addca98000000a62-dd-56bcdb5ecd67 Received: from [10.60.52.49] ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 4A.D7.02402.E5BDCB65; Thu, 11 Feb 2016 11:05:02 -0800 (PST) Subject: [PATCH v4 06/21] IB/srpt: Introduce target_reverse_dma_direction() To: Doug Ledford References: <56BCDAAD.7030906@sandisk.com> CC: Christoph Hellwig , Sagi Grimberg , "Alex Estrin" , "linux-rdma@vger.kernel.org" From: Bart Van Assche Message-ID: <56BCDB5D.4090302@sandisk.com> Date: Thu, 11 Feb 2016 11:05:01 -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: <56BCDAAD.7030906@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrKLMWRmVeSWpSXmKPExsWyRoxnkW7c7T1hBq2ThC0uPP3OZPHy/AdW i5WrjzJZPDvUy2Jxo+0BmwOrx+I9L5k8dt9sYPN4Nv0wk8f7fVfZPD5vkgtgjeKySUnNySxL LdK3S+DK2Duxgb3gN1/Fm6WT2BoYz/N0MXJySAiYSPybfJili5GLQ0hgE6PEpP3nGEESQgI7 GCV+7mOGKXr18SkjRNEcRonJX8+ygSSEBbwllt6YzQRiiwioSWx6tYgdollL4nl/PytIA7PA KkaJTVevgyXYBIwkvr2fyQJi8wIVdXx4CxZnEVCV2D13D9hQUYEIicOdXewQNYISJ2c+Aarn 4OAU0JaYeSUCxGQW0JRYv0sfpIJZQF5i+9s5UHceZJXoOR4DcYK6xMkl85kmMArPQjJoFkL3 LCTdCxiZVzGK5WbmFOempxYYGuoVJ+alZBZn6yXn525iBEcGV8YOxq2TzA8xCnAwKvHw3ri+ J0yINbGsuDL3EKMEB7OSCO/9TUAh3pTEyqrUovz4otKc1OJDjNIcLErivNYtamFCAumJJanZ qakFqUUwWSYOTqkGxgl6/Ce/f3lQbb94qXTMrgipr7Hm58Pm/ygXihX1u798+Y3GDy/YOndH FDBrdaeZFP7Ne/ZyCe+R7VEn7gYUcH7e5Rm07f13oS3f07+de7ux66K3efPiS4f8Zs2fOfnK aedFIpt2+u/5svGV2Sp97S79F8Evdlb02u8uDYxiK2u5KuBtt1by+DElluKMREMt5qLiRABi 0V1siAIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHJMWRmVeSWpSXmKPExsXCtZEjRTfu9p4wgy/rOSwuPP3OZPHy/AdW i5WrjzJZPDvUy2Jxo+0BmwOrx+I9L5k8dt9sYPN4Nv0wk8f7fVfZPD5vkg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/2hOz0Sxl7WWSW8GxTYTBEXETriwVijABp9W2zxjV3J/lWu70fq8f X-Forefront-Antispam-Report: CIP:63.163.107.172; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(979002)(6009001)(2980300002)(438002)(3190300001)(189002)(199003)(65956001)(65806001)(36756003)(19580405001)(77096005)(230700001)(80316001)(92566002)(50986999)(76176999)(87266999)(50466002)(33656002)(54356999)(64126003)(229853001)(23676002)(19580395003)(106466001)(65816999)(189998001)(47776003)(5008740100001)(2950100001)(4326007)(586003)(2906002)(83506001)(11100500001)(1096002)(110136002)(87936001)(1220700001)(59896002)(4001350100001)(86362001)(97736004)(5001960100002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0201MB0825; H:milsmgep11.sandisk.com; FPR:; SPF:Pass; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB0825; 2:oXjxY19vWnAAasiRs49QcxHzY1dQs3814DsV17/44NCNv1G97gS3J2BwbxlOQ2J7cUTkfTdpeoYvdn7sYESVQT4ZxtFVFxBKjATidzsWDpWm8Dmr4+63pnH6cVZoHM/SNbBKOtJJvkxJFVw3rRrlCg==; 3:gMrVKokUVcXZJYiShXeNsd9Q/zV5k5zVmerivOwUwRN2gEak8LaxFnj84umaCViY8/xUAH3NV5xuN0gPfo20q4WKhe3d2DAm9xuzyn8dM8n0ChRKbK7EdETtdiD3wyBYjmBec7HR02mb8dHraFY5Gk8rQjNcoWCMLhvi8xJLI++6anHh0Xu0vxAGyPIIiHDyckN1YS47DZAWiSfT5y3LA4RpEkbFF1IGt93ZUkXwbRZIpHd9AHpWZYCOhmKHbkGBY/qAAIj2xPrIaAqQf2bwDA==; 25:OsppOR75bxhcpzhKnWJOiHbmuI9HVdI0NBjlnHJ9YfyPxvumGGJYwtmbkcO01o5ifW2bQVQUiz22Co9lyIqZvM8o8mxrLwmb7RBDX8V+9Mzg23vGnjzRz98r5/dXqaHWQeVIU4aioPmlxxB7je/mFqI650SlE3D9XIDhLCAOd2T16LtzQMxamNrSyOkIW/o8qubG4jZRHzgK2Ci4HbrYPaIH52FwP1kyS25o+INPTL+z1VWIg6LrVFGnmhSA79vCSuneGDj98SY6hPaoXsRZ9ELPIpI43CKjG7x1zNMLVFlVlvaMqPfwB2WEte7UvJ1Z X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501001); SRVR:CY1PR0201MB0825; X-MS-Office365-Filtering-Correlation-Id: c28b262c-bf5c-43ab-65e1-08d333163fb0 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB0825; 20:We5805/CaNPqXzFEzDwxZ5iTZgi3o4AivMa1OfWzRFwHY1TQ958uBJl8NLyaqDmfWCzAq/NWc7/y5My9f7t5CQBgXspl+1IpAMEXS0Q2QWLLOcnMq5/G+qh4YVy87BdrT1iHzDTepa4G4VNV3sIL4lqz0Tsj2fte1oqT2vaBv7/j/0HIzxm0K3B1cOqniPaKN2zvV8rGmedqPmdZtB9z1Lifm4GH8iYiVLqHSaAMeXFoqyTJx2Zt5tf/4WVTSBAvKxIChSO1mgsu4QZ3M7jrf5sMIZfDZdwruUeZbvHVsYjktqq/gbwpdUrX+vqrogpRZ2qslLxrQCuiWUDh4IZs8Bfz++g6fDqv1rbkX9N7P9DrfPKH3Z0ED+3XjiWeG8gz7wY7/feVlKySR8CfZPRLNYRiElbu9LbRpyWXG4hYn1GhsYtneJUpCN59ygpFoAi4SipnqWnQvkJkQHZZkUFgXpjryF9h/Eqsa9yBgSrQ7cLvB3Px54j4e+BYOqTKJuii X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13017025)(13018025)(13023025)(13015025)(13024025)(8121501046)(5005006)(3002001)(10201501046); SRVR:CY1PR0201MB0825; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0201MB0825; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB0825; 4:NRCN4Ct5QJUnf2ehR1hvqkFi/D0QIZOcIDtu27HaCu0g5MRCb7zWCy4drh2gkjcGZpc7U6/ANB96suNX+EftDceqMQXi5nfq+mG7enKflmelBtprTLHmGMPyz6oJ2w9rYP/AhSFWrHxhO9BFh+yS98AjVWJX2GB893i1Co1/V9rkdpas0GsS6kHUPVUHt7rjwMPa+QSSEOLPQDnEhxPVe6e4X2oyzLTTHW57CI/u4K6fe5EpN8zXYUnhglWyS4dRqQIenJsnPRKLEcnlueePw+w6dhosvqvEVUpQae52k6QB/xqgVIpzu/r00txCulWWQSEUEYExHbgSymweR3KXrn1Fc7yx6Mue/G+gfltBqoiLAMuDsVRBSt7GJFAZPndu02izasTqUFf6qHXWuoXwRHfvr5kyCLO8RKR/oNxp6r4Tb+nBK8K71uZ59MqqxKWF/AyqMkmnNrRfTZSguuB8ZLmFSePE1wuN+XnLugoAaC9IzCatGNhXrTCOBk1nzkK/ X-Forefront-PRVS: 08497C3D99 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTFQUjAyMDFNQjA4MjU7MjM6WkhQc0FtTFJEcE9BV1IrUFZzK0xoZmhF?= =?utf-8?B?TkpZZGMxWkNuS3RLVFU2U3BXSmFhQi82NFNFbys1empUY0Fhckl6WnpJMTA3?= =?utf-8?B?Wm42b0ZzQnN1eWR5Nm0xdDQyWFMvUngzRkZTOEdqRlZrOE0wZFZReUxkRTRa?= =?utf-8?B?TGxla2t1V3hvVVlWdTZtODR1M1BseUFRa0pKRFNENFp0cXBsZHdoQ1c0eUxT?= =?utf-8?B?RUdCRDNwaGpUNkZJYVpkeEhhcDZuc2J6WDVJdDVhRUVPaG1TWHNNdERvekVo?= =?utf-8?B?MExwUzV4U0ovZWZURGpCVGZxZDMzL2F6UkdsL3JXZXZWckRQK2cxMEw4eFh0?= =?utf-8?B?TExsVUh4bTRUM0xlbX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4+ZXW7ZkcpVKTtGgaKSHOYHVZ SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2016 19:05:03.4266 (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: CY1PR0201MB0825 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.0 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 Cc: Alex Estrin --- 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 6d1a137..5da59f4 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;