From patchwork Fri Jan 29 23:13:32 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: 8168561 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B96B6BEEE5 for ; Fri, 29 Jan 2016 23:14:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A18442039C for ; Fri, 29 Jan 2016 23:14:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B784A20398 for ; Fri, 29 Jan 2016 23:14:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753947AbcA2XOI (ORCPT ); Fri, 29 Jan 2016 18:14:08 -0500 Received: from mail-by2on0099.outbound.protection.outlook.com ([207.46.100.99]:40480 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753560AbcA2XOH (ORCPT ); Fri, 29 Jan 2016 18:14:07 -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=J1/L6X1LPTirM6Ry+dXmYVmTl9dcLv8pu9Oh3ABNFYs=; b=hWJuHF/ZcQ/HR4dfwMxscyH+A8ieMAm/t9bYbjp+hhMm/HPAUu3RTEhieaVxAegNPE3eTVEm2SdWkSe9L99G+nR9EXGRROd4wHVcSxbk5lvfjfsOAwb6luvfbfR0IeWzPmCUVHHmVn5Ns5pkeybawQdOqn8jk+CGvIaewZJcYmw= Received: from BLUPR0201CA0004.namprd02.prod.outlook.com (10.163.116.14) by DM2PR02MB304.namprd02.prod.outlook.com (10.141.83.148) with Microsoft SMTP Server (TLS) id 15.1.390.13; Fri, 29 Jan 2016 23:14:04 +0000 Received: from BN1BFFO11FD016.protection.gbl (2a01:111:f400:7c10::1:147) by BLUPR0201CA0004.outlook.office365.com (2a01:111:e400:52e7::14) with Microsoft SMTP Server (TLS) id 15.1.396.15 via Frontend Transport; Fri, 29 Jan 2016 23:14:04 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.172) 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.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 BN1BFFO11FD016.mail.protection.outlook.com (10.58.144.79) with Microsoft SMTP Server id 15.1.355.15 via Frontend Transport; Fri, 29 Jan 2016 23:14:03 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com ( [172.22.12.162]) by (Symantec Messaging Gateway) with SMTP id 1B.20.29304.832FBA65; Fri, 29 Jan 2016 15:14:00 -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:13:32 -0800 X-AuditID: ac160a68-2a63198000007278-f6-56abf2380771 Received: from [10.60.52.49] ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 61.57.02700.C12FBA65; Fri, 29 Jan 2016 15:13:32 -0800 (PST) Subject: [PATCH v2 07/22] IB/srpt: Simplify srpt_handle_tsk_mgmt() 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: <56ABF21C.5070409@sandisk.com> Date: Fri, 29 Jan 2016 15:13:32 -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+NgFvrOLMWRmVeSWpSXmKPExsWyRoxnka7Fp9VhBrPv61lcePqdyeLl+Q+s FitXH2WyeHaol8XiRtsDNgdWj8V7XjJ57L7ZwObxbPphJo/3+66yeXzeJBfAGsVlk5Kak1mW WqRvl8CVcfLZJ9aCqfIVx5Y3sTcwLpfsYuTgkBAwkZjyMaWLkYtDSGATo8S1F/2MEM4ORokF G74AOZxgRccOHGKCSMxhlNi19BIbSEJYwEni64IFYEUiAmoSm14tYgexhQS0JM5d+MIO0sAs sIpRYtPV62AJNgEjiW/vZ7KA2LxARUf+tTKB2CwCqhIHr3SCxUUFIiQOd3axQ9QISpyc+QQs zimgLbFk9gUWkLOZBTQl1u/SBwkzC8hLbH87hxlkl4TAJlaJiac3skAcoS5xcsl8pgmMwrOQ jJqF0D4LSfsCRuZVjGK5mTnFuempBYaGesWJeSmZxdl6yfm5mxjB0cGVsYNx6yTzQ4wCHIxK PLwey1aHCbEmlhVX5h5ilOBgVhLhrXsBFOJNSaysSi3Kjy8qzUktPsQozcGiJM5r3aIWJiSQ nliSmp2aWpBaBJNl4uCUamCc5L7c8pnshIds8UVzQ013J96Q/csufLjt9wfXnJfLhVeELFr0 0F2/9qN2+4y0SzU/5yTlzw3Nb4vymrjB5varhr/X/8Z63NaU6nq3KKblomr7/WLei3fu3p33 82fBlSmVS7vCyrW+s347/X9Jwu0X6wt9fSXk9/B2hAo7nrl+V5KvRe6RWlWCEktxRqKhFnNR cSIAGbbQMIoCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHJMWRmVeSWpSXmKPExsXCtZEjRVfm0+owg5972C0uPP3OZPHy/AdW i5WrjzJZPDvUy2Jxo+0BmwOrx+I9L5k8dt9sYPN4Nv0wk8f7fVfZPD5vkgtgjeKySUnNySxL LdK3S+DKOPnsE2vBVPmKY8ub2BsYl0t2MXJySAiYSBw7cIgJxBYSmMUo8fQdC4gtLOAk8XXB AkYQW0RATWLTq0XsEDVaEucufAGyuTiYBVYxSvxe+YENJMEmYCTx7f1MsGZeoKIj/1rBhrII qEocvNIJFhcViJA43NnFDlEjKHFy5hOwOKeAtsSS2RfAbGYBdYk/8y4xQ9jyEtvfzmGewMg3 C0nLLCRls5CULWBkXsUolpuZU5ybnllgaKhXnJiXklmcrZecn7uJERyinJE7GJ9OND/EyMTB KdXA6BgsJj5h5av956zvXXPOqvxpmGp+eVa1+wOxt6e0NBJqJ8vNkKi4/Hpr1pZz1vnPebYf Yp383bZ3u33Z/+jbnDP0rWdnz9s3ed2lx4aqEotuGsRx/pqrzem5jvvPAck7q3qrK66kif+P 2/iGQfp4nM6OYqX790y6JwlYnPvE9sXYVDGnan77diWW4oxEQy3mouJEAHuqUt4BAgAA X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD016; 1:pIuhf3LVt4p91nucPpQefGNYF1nYWsS6rHWmj4xicpB02qeyY3Bl+KyaifVTfi49AXs8OV4tzJFYJnwGJlcsSRAhrougXMJCMqqgm92/JLMNXXOoY167cXvoZVAYnfLklwneHX9vA9N1fNXxFdFe1Eyjmjbhf2C5SE3OFbTHWBrK73PghFP/tfkIQ8t4vMRtXdvYxe3oNAVYxRtRbEwuePdJPE2lS1K9ANMgmDRvfr/WjPhSNTl92kVlD3LoeWbMAzTATPmsfMPM9Ot86MXYdFI43XhaQOxvx45CxAOD0TLE8YoSGTFw/dSfkHJDH8f7PQkuWavsQDq+CWmKfTF2HwZxL9f4GoSdU20mEtF/RJsrxysXVR9L42664fIrL5zqpQhgo3DsEZnb9R51mqu9rIcdXmkOaIy6lnxI911PgFk= X-Forefront-Antispam-Report: CIP:63.163.107.172; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(189002)(199003)(23676002)(11100500001)(33656002)(64126003)(5008740100001)(36756003)(189998001)(1096002)(586003)(1220700001)(4326007)(92566002)(2906002)(110136002)(50986999)(87936001)(47776003)(19580395003)(80316001)(76176999)(230700001)(19580405001)(4001350100001)(83506001)(65816999)(50466002)(87266999)(65806001)(65956001)(77096005)(5001960100002)(2950100001)(106466001)(229853001)(54356999)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR02MB304; H:milsmgep11.sandisk.com; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM2PR02MB304; 2:r4zhPFly4wiP4ktUjrMKi3oSS/JRZHURZMs51UtbfaS9uxMe7+E0A9/YE4HrpybCd568mN08qw5BK8oDNNxnE9j66mIRGwtYl1/EqS69DmfPgYxPqqXP9P5L0UJpLVg6hm9SCXP2PeqAot+SOvQFJg==; 3:oE4qdgmSABrzVXnNPQGzPGHZxbl4KMbQqb+uPA3RaQNpbU/zDQt+n1oFxTpKIQpMP0J9WLFpvYolRk+x6oOxsLh6mwiTGxXBvIf/isSTv/h+aFRXTm/6yvEXrnV5mpvutbqYMXF4CTAnoeG9PuNSWWeXGJldPn1apHskggw4X3KK2u6JpPebzUWZNygManfDWxhqjmZOg0cEsHWDQYJ3Nm7OqLWRrSANsMsPQ7y7a0rKYwFNp3Pg4o1vYUzl/UsXDy1YgN1zad1vh6KrxBb94A==; 25:CSkELdbSkPYAGPzA6DDWsJltgmtZrw07tdVJHjVYaMMfK0xLsN45kLFjvVWlfMYAcXkzfO30MNj/GwAjCZFIKOv6wsWgJ5SUttyBzoi+X4lQbNNtiiOcCEGplfdCtqe3C8TSRL+t0byb97hfG4jRlPgMcXeL4G8sqRs2FHD/BN5/G932SF5/e8YnuT4fYHLVBzS/96cz3jaqErFmFSnUTM0kvGEFGdsucIEk6p2t2Ipw0wwE20sHJ1tIu5ONiQqr X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501001); SRVR:DM2PR02MB304; X-MS-Office365-Filtering-Correlation-Id: 1274aca4-2c24-4f30-bc11-08d32901e180 X-Microsoft-Exchange-Diagnostics: 1; DM2PR02MB304; 20:4gNS1SCUOdwKw/4o0mIhmE9Qv4ka3Idzyl6efPOvw1FIhL/aBkTHKeUs8ff15iG6Bcvv5DUaCB9jII9/2zoWAGm/PIVUD97y8P70DY+sJqBIss4khlJqTJn1itOomDnemHjVjof2CjIx7T+yjL0Bmc3Q/wqx+NjPILlwgRJPGtERvPTd778jgYdmmO3j2K37W0A8IvgcdfdLqwaY0lQKFnbIhLuPcNXiHw6IEcdAtsRLNKYX1L+sPh2bF9Ms31HRqNXDEtg/n/yaNMnGU3pvbbA9Ff9L60viwfACxQj074b34ZC+pEftqdkRhLMlq3mMZdRj4xkczP0CvSYMvgXHxHR5VnqZjaPH35g4w3riGm9W7+Ccm5vU6pQky0sU0beWm69vjcZwC4+bkQU3rfITTfKeSiiLhWOUdBQtoR3/8KJCc5dQmUOoApzoufLpKJ6NCkXg/rGsxLVjP+up+YGFUf/RmHMBFml/Vf/udcgqvVNkBlmcf2hWZ1BDGhcBBpYj 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)(13017025)(13018025)(13024025)(5005006)(8121501046)(13015025)(13023025)(3002001)(10201501046); SRVR:DM2PR02MB304; BCL:0; PCL:0; RULEID:; SRVR:DM2PR02MB304; X-Microsoft-Exchange-Diagnostics: 1; DM2PR02MB304; 4:AvLufhtgf5vI0NTC1GGiUSyF+VJSD1VTLlcRYUgDA6hkAX0sWArQwFAARBPUpn4IeScbrvKZlYDHsYExRsDzN2QQhH+uwHIkMgh8gDT/bLZ6lbyo1e9b0SUgGYqcw7b/RM29iph1PvNPpJ0vwpY67evFhU5IxJNWLgYyyPEVGdPPVyusq6Rzv37tKXv7d6Iv7KxClBj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?lpXEXtq0seqmG9DE4c+g8xg+vL?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR02MB304; 5:Ui8ZSYLq1/6UQjOdKL2gwZY7fQV9wk9K8l/pgiGAGmZrAxW1XvlsF7KYAo5fgKW2fNee3WfVQTHaLH5d4cGy7D972K2p3abmT4FRtQC+fATY+/GIQ2qv/ovwIbq9SDcY2EDe2QCsfC7pWwtUw2HqlA==; 24:xhOhtZaZhi+H1pL4EPK82x4ri/v+3yNpBHzIyWxW2fgnQUA+9tRiSRu9A0jqL8UO3ZzEyI+CZllVdDQODHKuarKW9KDhixksbVfp5DiXZz4=; 20:nal/9eVE09UX7F5LTHimp0KY1uahIb9qLzJdPcEHEC44FyA5ucZ6jiX7yR5mmSYdvuM1vmWUalliMNkten6jpdBfEOek+HMg/jOzoJtG2Qtv8xUmQheOil8K8Xz4wtgVYhLFu+J1sCbkSCaZVxaZBJeTDr+pfsGLiNHBO2wGqRXR87f0R/8HgKSDExS85oIisUnd5RRS2U/dNS61o/ciTE7CNb/iW6G7VOY3gJvuMD+Pqb+CLi/Ql2kOM+9bG8Qc SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2016 23:14:03.8927 (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: DM2PR02MB304 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 Let the target core check task existence instead of the SRP target driver. Additionally, let the target core check the validity of the task management request instead of the ib_srpt driver. Signed-off-by: Bart Van Assche Fixes: 3e4f574857ee ("ib_srpt: Convert TMR path to target_submit_tmr") Cc: Christoph Hellwig Cc: Sagi Grimberg Tested-by: Alex Estrin Reviewed-by: Christoph Hellwig --- drivers/infiniband/ulp/srpt/ib_srpt.c | 61 ++--------------------------------- include/target/target_core_base.h | 1 + 2 files changed, 4 insertions(+), 58 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index b38372b..64820a2 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -1560,47 +1560,6 @@ send_sense: return -1; } -/** - * srpt_rx_mgmt_fn_tag() - Process a task management function by tag. - * @ch: RDMA channel of the task management request. - * @fn: Task management function to perform. - * @req_tag: Tag of the SRP task management request. - * @mgmt_ioctx: I/O context of the task management request. - * - * Returns zero if the target core will process the task management - * request asynchronously. - * - * Note: It is assumed that the initiator serializes tag-based task management - * requests. - */ -static int srpt_rx_mgmt_fn_tag(struct srpt_send_ioctx *ioctx, u64 tag) -{ - struct srpt_device *sdev; - struct srpt_rdma_ch *ch; - struct srpt_send_ioctx *target; - int ret, i; - - ret = -EINVAL; - ch = ioctx->ch; - BUG_ON(!ch); - BUG_ON(!ch->sport); - sdev = ch->sport->sdev; - BUG_ON(!sdev); - spin_lock_irq(&sdev->spinlock); - for (i = 0; i < ch->rq_size; ++i) { - target = ch->ioctx_ring[i]; - if (target->cmd.se_lun == ioctx->cmd.se_lun && - target->cmd.tag == tag && - srpt_get_cmd_state(target) != SRPT_STATE_DONE) { - ret = 0; - /* now let the target core abort &target->cmd; */ - break; - } - } - spin_unlock_irq(&sdev->spinlock); - return ret; -} - static int srp_tmr_to_tcm(int fn) { switch (fn) { @@ -1615,7 +1574,7 @@ static int srp_tmr_to_tcm(int fn) case SRP_TSK_CLEAR_ACA: return TMR_CLEAR_ACA; default: - return -1; + return UNKNOWN_TMR; } } @@ -1634,7 +1593,6 @@ static void srpt_handle_tsk_mgmt(struct srpt_rdma_ch *ch, struct srp_tsk_mgmt *srp_tsk; struct se_cmd *cmd; struct se_session *sess = ch->sess; - uint32_t tag = 0; int tcm_tmr; int rc; @@ -1650,23 +1608,10 @@ static void srpt_handle_tsk_mgmt(struct srpt_rdma_ch *ch, srpt_set_cmd_state(send_ioctx, SRPT_STATE_MGMT); send_ioctx->cmd.tag = srp_tsk->tag; tcm_tmr = srp_tmr_to_tcm(srp_tsk->tsk_mgmt_func); - if (tcm_tmr < 0) { - send_ioctx->cmd.se_tmr_req->response = - TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED; - goto fail; - } - if (srp_tsk->tsk_mgmt_func == SRP_TSK_ABORT_TASK) { - rc = srpt_rx_mgmt_fn_tag(send_ioctx, srp_tsk->task_tag); - if (rc < 0) { - send_ioctx->cmd.se_tmr_req->response = - TMR_TASK_DOES_NOT_EXIST; - goto fail; - } - tag = srp_tsk->task_tag; - } rc = target_submit_tmr(&send_ioctx->cmd, sess, NULL, scsilun_to_int(&srp_tsk->lun), srp_tsk, tcm_tmr, - GFP_KERNEL, tag, TARGET_SCF_ACK_KREF); + GFP_KERNEL, srp_tsk->task_tag, + TARGET_SCF_ACK_KREF); if (rc != 0) { send_ioctx->cmd.se_tmr_req->response = TMR_FUNCTION_REJECTED; goto fail; diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 5d82816..cffe66d 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -191,6 +191,7 @@ enum target_sc_flags_table { /* fabric independent task management function values */ enum tcm_tmreq_table { + UNKNOWN_TMR = 0, TMR_ABORT_TASK = 1, TMR_ABORT_TASK_SET = 2, TMR_CLEAR_ACA = 3,