Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751506AbdFGBND (ORCPT ); Tue, 6 Jun 2017 21:13:03 -0400 Received: from mail-bn3nam01on0065.outbound.protection.outlook.com ([104.47.33.65]:27584 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751436AbdFGBNB (ORCPT ); Tue, 6 Jun 2017 21:13:01 -0400 From: "Tran, Quinn" To: "Nicholas A. Bellinger" , target-devel CC: linux-scsi , lkml , "Madhani, Himanshu" , Mike Christie , Hannes Reinecke , Christoph Hellwig Subject: Re: [PATCH 3/3] qla2xxx: Convert QLA_TGT_ABTS to TARGET_SCF_LOOKUP_LUN_FROM_TAG Thread-Topic: [PATCH 3/3] qla2xxx: Convert QLA_TGT_ABTS to TARGET_SCF_LOOKUP_LUN_FROM_TAG Thread-Index: AQHS3LXBu42cPaaUgUieDI2kc/hA6aIYJ58A Date: Wed, 7 Jun 2017 01:12:57 +0000 Message-ID: <26A27AC7-401E-4560-89C3-458F1611BD14@cavium.com> References: <1496527808-28789-1-git-send-email-nab@linux-iscsi.org> <1496527808-28789-4-git-send-email-nab@linux-iscsi.org> In-Reply-To: <1496527808-28789-4-git-send-email-nab@linux-iscsi.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: linux-iscsi.org; dkim=none (message not signed) header.d=none;linux-iscsi.org; dmarc=none action=none header.from=cavium.com; x-originating-ip: [198.186.0.2] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR07MB3450;7:IAfxzyszaNTzEby923R3greuURLW+CqQBS3+j+R0WylObpqJ9jnm7T1It10ZIQ2d5j/Y1BKHOZafQYJSo9TDqBta1K6a4XgC+QkU6TmZzpIdfTFF+Nihky8AXrO5ItiY2Xeoa21y4+w4sgMOYPskhT88D03MF7fokTP9g70JOTvGj6vZtDWzviN1HOso/U3AKreXsA6CJm+6RSFfD3LGvXQy5CB3kP4oBNWyFdxpY0vzQBDZ52IZm6EtbwdAJ9Jf+sAuA5btLbpQbGZjHEW4E5LGzzCetGx5y8PA8WTPLiYpeVc/LSUBWCvwwszVqeEX2VL0wdSgvMLFwCp3kzGn/g== x-forefront-antispam-report: SFV:SKI;SCL:-1SFV:NSPM;SFS:(10009020)(6009001)(39840400002)(39400400002)(39410400002)(39450400003)(39850400002)(377454003)(13464003)(3660700001)(3846002)(2906002)(33656002)(54356999)(229853002)(50986999)(3280700002)(77096006)(53546009)(54906002)(2950100002)(25786009)(4326008)(6436002)(76176999)(6246003)(38730400002)(6486002)(53936002)(99286003)(6506006)(6512007)(5660300001)(2900100001)(122556002)(66066001)(189998001)(14454004)(82746002)(6116002)(86362001)(8676002)(478600001)(305945005)(36756003)(81166006)(8936002)(7736002)(83716003)(72206003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR07MB3450;H:SN1PR07MB2413.namprd07.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; x-ms-traffictypediagnostic: DM5PR07MB3450: x-ms-office365-filtering-correlation-id: 11548a46-6b63-4112-923f-08d4ad42550e x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254075)(201703131423075)(201703031133081);SRVR:DM5PR07MB3450; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(9452136761055); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(100000703101)(100105400095)(10201501046)(6041248)(20161123560025)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123564025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DM5PR07MB3450;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DM5PR07MB3450; x-forefront-prvs: 03319F6FEF spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" Content-ID: <9F37337D59651F4EBB2217901ABE6FCE@namprd07.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jun 2017 01:12:57.1046 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3450 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id v571DAre025536 Content-Length: 4959 Lines: 124 Nic, Thanks. It looks good. Regards, Quinn Tran -----Original Message----- From: Nicholas Bellinger Date: Saturday, June 3, 2017 at 3:10 PM To: target-devel Cc: linux-scsi , lkml , Nicholas Bellinger , "Madhani, Himanshu" , "Tran, Quinn" , Mike Christie , Hannes Reinecke , Christoph Hellwig Subject: [PATCH 3/3] qla2xxx: Convert QLA_TGT_ABTS to TARGET_SCF_LOOKUP_LUN_FROM_TAG From: Nicholas Bellinger Following Himanshu's earlier patch to drop the redundant tag lookup within __qlt_24xx_handle_abts(), go ahead and drop this now QLA_TGT_ABTS can use TARGET_SCF_LOOKUP_LUN_FROM_TAG and have target_submit_tmr() do this from common code. Cc: Himanshu Madhani Cc: Quinn Tran Cc: Mike Christie Cc: Hannes Reinecke Cc: Christoph Hellwig Signed-off-by: Nicholas Bellinger --- drivers/scsi/qla2xxx/qla_target.c | 39 +++++++++----------------------------- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 +++- 2 files changed, 12 insertions(+), 31 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 0e03ca2..401e245 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -1847,38 +1847,13 @@ 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; - } + 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; } ql_dbg(ql_dbg_tgt_mgt, vha, 0xf00f, @@ -1899,7 +1874,11 @@ 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, + /* + * LUN is looked up by target-core internally based on the passed + * abts->exchange_addr_to_abort tag. + */ + rc = ha->tgt.tgt_ops->handle_tmr(mcmd, 0, mcmd->tmr_func, abts->exchange_addr_to_abort); if (rc != 0) { ql_dbg(ql_dbg_tgt_mgt, vha, 0xf052, diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 7443e4e..75aeb9f 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -601,11 +601,13 @@ static int tcm_qla2xxx_handle_tmr(struct qla_tgt_mgmt_cmd *mcmd, uint32_t lun, struct fc_port *sess = mcmd->sess; struct se_cmd *se_cmd = &mcmd->se_cmd; int transl_tmr_func = 0; + int flags = TARGET_SCF_ACK_KREF; switch (tmr_func) { case QLA_TGT_ABTS: pr_debug("%ld: ABTS received\n", sess->vha->host_no); transl_tmr_func = TMR_ABORT_TASK; + flags |= TARGET_SCF_LOOKUP_LUN_FROM_TAG; break; case QLA_TGT_2G_ABORT_TASK: pr_debug("%ld: 2G Abort Task received\n", sess->vha->host_no); @@ -638,7 +640,7 @@ static int tcm_qla2xxx_handle_tmr(struct qla_tgt_mgmt_cmd *mcmd, uint32_t 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) -- 1.9.1