From patchwork Wed Feb 8 22:24:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9563669 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 215036020F for ; Wed, 8 Feb 2017 22:28:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E91F4284F2 for ; Wed, 8 Feb 2017 22:28:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DDFA42852C; Wed, 8 Feb 2017 22:28:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DAD3284F2 for ; Wed, 8 Feb 2017 22:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752164AbdBHW2M (ORCPT ); Wed, 8 Feb 2017 17:28:12 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:63858 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751856AbdBHW1y (ORCPT ); Wed, 8 Feb 2017 17:27:54 -0500 X-IronPort-AV: E=Sophos;i="5.35,348,1483977600"; d="scan'208";a="76618171" Received: from unknown (HELO milsmgep14.sandisk.com) ([63.163.107.225]) by ob1.hgst.iphmx.com with ESMTP; 09 Feb 2017 06:28:20 +0800 Received: from MILHUBIP04.sdcorp.global.sandisk.com (Unknown_Domain [10.201.67.162]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id 35.72.18895.ACA9B985; Wed, 8 Feb 2017 14:25:15 -0800 (PST) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Wed, 8 Feb 2017 14:25:11 -0800 X-AuditID: 0ac94371-0fadb980000049cf-f8-589b9acad109 Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id A0.42.18148.7CA9B985; Wed, 8 Feb 2017 14:25:11 -0800 (PST) From: Bart Van Assche To: Bart Van Assche CC: , Himanshu Madhani , Giridhar Malavali Subject: [PATCH v4 10/37] tcm_qla2xxx: Let the target core look up the LUN of the aborted cmd Date: Wed, 8 Feb 2017 14:24:40 -0800 Message-ID: <20170208222507.25715-11-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170208222507.25715-1-bart.vanassche@sandisk.com> References: <20170208222507.25715-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrBLMWRmVeSWpSXmKPExsXCddJ5ke7pWbMjDOae5bTY8+Acm8WFPd2M Fq1L3zI5MHvM+L2IxePzJrkApigum5TUnMyy1CJ9uwSujBW3pjEXbNGv+Px/GWsD4yz1LkZO DgkBE4ltK/6wdTFycQgJLGWSWPr3IyOEs51RYuXDzUwwVVse7oGq2sgocfPGZ3aQBJuAkcS3 9zNZQGwRAQOJ370XGEFsZoEORokZX2NBbGGBWIk5J+6D1bAIqEicuDuTDcTmFXCQ6G3/ALVA XmJX20VWEJsTKD7h5TOwOUIC9hKvDnwBu0hC4BOLxN25HVDNghInZz5hgVgmIXHwxQtmiAZ1 iZNL5jNNYBSahaRsFpKyBYxMqxjFcjNzinPTUwsMTfSKE/NSMouz9ZLzczcxQsK3cAfj69ve hxgFOBiVeHgvWM+OEGJNLCuuzD3EKMHBrCTCmzINKMSbklhZlVqUH19UmpNafIhRmoNFSZw3 S3ZqhJBAemJJanZqakFqEUyWiYNTqoExRfeOzo8IMd3Fh89JCwdtTqgOfHyjnkVn/RfNhcdX TfFUXrnjcsD7Hx6bTCNOGZ9fNCPrysIJHvmVIsuKN9x7Lb1qHk/yAtei0t+tmjt44xv5CqvT zD647VDzK63Osbujbzs/JdCUZ4n17JzTGUxGgnYtQX/vRSUG/ROTmjH1eKXLhEhtsX9KLMUZ iYZazEXFiQCZZVFZWwIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprBJMWRmVeSWpSXmKPExsXCtZGTTff4rNkRBr8nKlkc/NnGaLHnwTk2 iwt7uhktWpe+ZXJg8ZjxexGLx7Q155k8Pm+SC2CO4rJJSc3JLEst0rdL4MpYcWsac8EW/YrP /5exNjDOUu9i5OSQEDCR2PJwD1sXIxeHkMB6RonFn5exgSTYBIwkvr2fyQJiiwgYSPzuvcAI UsQs0MYocX77Y7CEsECsxJwT98FsFgFViWXTToA18wo4SNxumMsIsUFeYlfbRVYQmxMoPuHl M7C4kIC9xKsDXxgnMHIvYGRYxSiWm5lTnJueWWBopFecmJeSWZytl5yfu4kR4veoHYzXJ5of YmTi4JRqYGxl/js5MvVduHvH/sZJrz6+it6a+LD4+afOK4G3GxSmMMx6whty0YHfkvfqiX+J RziNQoyrV9w8G7fb+u1vu3kFEWe+fbX/WHFva4zG3N2LBDvPBse8+TnDXfKFwZ1eF8t6h0ky fv8Nz6XUyB0Um1Vdv+zsd3+RY40cW98EP198d7v1pDkT1vIpsRRnJBpqMRcVJwIA3FqEx6sB AAA= MIME-Version: 1.0 Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use the new flag TARGET_SCF_IGNORE_TMR_LUN instead of letting the qla2xxx target driver look up the LUN of the command that has to be aborted. Signed-off-by: Bart Van Assche Reviewed-by: Hannes Reinecke Reviewed-by: Christoph Hellwig Cc: Himanshu Madhani Cc: Giridhar Malavali --- drivers/scsi/qla2xxx/qla_target.c | 66 +++++++++++++------------------------- drivers/scsi/qla2xxx/qla_target.h | 2 +- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 8 +++-- 3 files changed, 30 insertions(+), 46 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 45f5077684f0..0a32a3786c4e 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -1818,39 +1818,8 @@ static int __qlt_24xx_handle_abts(struct scsi_qla_host *vha, struct abts_recv_from_24xx *abts, struct fc_port *sess) { struct qla_hw_data *ha = vha->hw; - struct se_session *se_sess = sess->se_sess; struct qla_tgt_mgmt_cmd *mcmd; - struct se_cmd *se_cmd; - u32 lun = 0; int rc; - bool found_lun = false; - unsigned long flags; - - spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); - list_for_each_entry(se_cmd, &se_sess->sess_cmd_list, se_cmd_list) { - struct qla_tgt_cmd *cmd = - container_of(se_cmd, struct qla_tgt_cmd, se_cmd); - if (se_cmd->tag == abts->exchange_addr_to_abort) { - lun = cmd->unpacked_lun; - found_lun = true; - break; - } - } - spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); - - /* cmd not in LIO lists, look in qla list */ - if (!found_lun) { - if (abort_cmd_for_tag(vha, abts->exchange_addr_to_abort)) { - /* send TASK_ABORT response immediately */ - qlt_24xx_send_abts_resp(vha, abts, FCP_TMF_CMPL, false); - return 0; - } else { - ql_dbg(ql_dbg_tgt_mgt, vha, 0xf081, - "unable to find cmd in driver or LIO for tag 0x%x\n", - abts->exchange_addr_to_abort); - return -ENOENT; - } - } ql_dbg(ql_dbg_tgt_mgt, vha, 0xf00f, "qla_target(%d): task abort (tag=%d)\n", @@ -1870,17 +1839,27 @@ static int __qlt_24xx_handle_abts(struct scsi_qla_host *vha, mcmd->reset_count = vha->hw->chip_reset; mcmd->tmr_func = QLA_TGT_ABTS; - rc = ha->tgt.tgt_ops->handle_tmr(mcmd, lun, mcmd->tmr_func, - abts->exchange_addr_to_abort); - if (rc != 0) { - ql_dbg(ql_dbg_tgt_mgt, vha, 0xf052, - "qla_target(%d): tgt_ops->handle_tmr()" - " failed: %d", vha->vp_idx, rc); - mempool_free(mcmd, qla_tgt_mgmt_cmd_mempool); - return -EFAULT; + rc = ha->tgt.tgt_ops->handle_tmr(mcmd, -1, mcmd->tmr_func, + abts->exchange_addr_to_abort, false); + if (rc == 0) + return 0; + + ql_dbg(ql_dbg_tgt_mgt, vha, 0xf052, + "qla_target(%d): tgt_ops->handle_tmr() failed: %d", + vha->vp_idx, rc); + mempool_free(mcmd, qla_tgt_mgmt_cmd_mempool); + + /* cmd not in LIO lists, look in qla list */ + if (abort_cmd_for_tag(vha, abts->exchange_addr_to_abort)) { + /* send TASK_ABORT response immediately */ + qlt_24xx_send_abts_resp(vha, abts, FCP_TMF_CMPL, false); + return 0; } - return 0; + ql_dbg(ql_dbg_tgt_mgt, vha, 0xf081, + "unable to find cmd in driver or LIO for tag 0x%x\n", + abts->exchange_addr_to_abort); + return -ENOENT; } /* @@ -4195,7 +4174,7 @@ static int qlt_issue_task_mgmt(struct fc_port *sess, u64 lun, break; } - res = ha->tgt.tgt_ops->handle_tmr(mcmd, lun, mcmd->tmr_func, 0); + res = ha->tgt.tgt_ops->handle_tmr(mcmd, lun, mcmd->tmr_func, 0, true); if (res != 0) { ql_dbg(ql_dbg_tgt_tmr, vha, 0x1000b, "qla_target(%d): tgt.tgt_ops->handle_tmr() failed: %d\n", @@ -4272,8 +4251,9 @@ static int __qlt_abort_task(struct scsi_qla_host *vha, mcmd->reset_count = vha->hw->chip_reset; mcmd->tmr_func = QLA_TGT_2G_ABORT_TASK; - rc = ha->tgt.tgt_ops->handle_tmr(mcmd, unpacked_lun, mcmd->tmr_func, - le16_to_cpu(iocb->u.isp2x.seq_id)); + rc = ha->tgt.tgt_ops->handle_tmr(mcmd, unpacked_lun, TMR_ABORT_TASK, + le16_to_cpu(iocb->u.isp2x.seq_id), + true); if (rc != 0) { ql_dbg(ql_dbg_tgt_mgt, vha, 0xf060, "qla_target(%d): tgt_ops->handle_tmr() failed: %d\n", diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h index a7f90dcaae37..bc9468f7a643 100644 --- a/drivers/scsi/qla2xxx/qla_target.h +++ b/drivers/scsi/qla2xxx/qla_target.h @@ -669,7 +669,7 @@ struct qla_tgt_func_tmpl { void (*handle_data)(struct qla_tgt_cmd *); void (*handle_dif_err)(struct qla_tgt_cmd *); int (*handle_tmr)(struct qla_tgt_mgmt_cmd *, uint32_t, uint16_t, - uint32_t); + uint32_t, bool); void (*free_cmd)(struct qla_tgt_cmd *); void (*free_mcmd)(struct qla_tgt_mgmt_cmd *); void (*free_session)(struct fc_port *); diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 8b878a2d7304..4d9180efb9aa 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -580,10 +580,12 @@ static void tcm_qla2xxx_handle_dif_err(struct qla_tgt_cmd *cmd) * Called from qla_target.c:qlt_issue_task_mgmt() */ static int tcm_qla2xxx_handle_tmr(struct qla_tgt_mgmt_cmd *mcmd, uint32_t lun, - uint16_t tmr_func, uint32_t tag) + uint16_t tmr_func, uint32_t tag, + bool use_lun) { struct fc_port *sess = mcmd->sess; struct se_cmd *se_cmd = &mcmd->se_cmd; + unsigned int flags = TARGET_SCF_ACK_KREF; int transl_tmr_func = 0; switch (tmr_func) { @@ -621,8 +623,10 @@ static int tcm_qla2xxx_handle_tmr(struct qla_tgt_mgmt_cmd *mcmd, uint32_t lun, return -ENOSYS; } + if (!use_lun) + flags |= TARGET_SCF_IGNORE_TMR_LUN; return target_submit_tmr(se_cmd, sess->se_sess, NULL, lun, mcmd, - transl_tmr_func, GFP_ATOMIC, tag, TARGET_SCF_ACK_KREF); + transl_tmr_func, GFP_ATOMIC, tag, flags); } static int tcm_qla2xxx_queue_data_in(struct se_cmd *se_cmd)