From patchwork Wed Nov 20 22:27:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Bolshakov X-Patchwork-Id: 11254921 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 30C6414E5 for ; Wed, 20 Nov 2019 22:27:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1109720878 for ; Wed, 20 Nov 2019 22:27:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=yadro.com header.i=@yadro.com header.b="K1NQ/5Wr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726265AbfKTW1h (ORCPT ); Wed, 20 Nov 2019 17:27:37 -0500 Received: from mta-02.yadro.com ([89.207.88.252]:51224 "EHLO mta-01.yadro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725819AbfKTW1h (ORCPT ); Wed, 20 Nov 2019 17:27:37 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 13218437F6; Wed, 20 Nov 2019 22:27:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1574288852; x=1576103253; bh=9fNV4bbeGM8GwuUw0Ic03IOWWS6vLEJ0/fd 1qigtzgg=; b=K1NQ/5WrSuISYF4UYqMZxLLhKmUGabjJ0IsQCOfderBq/Oh6JGn dP2wIfF/6fK44HJCOBsvXQ1JzmOILFF00psAR3oIPBAN1/d8mDifDKSgfqKhe+e4 0iw9ieOkHJEUJRjHcy/gFX0nGBzPYj38Q7MZvFeVlKy0oodV//OK12tE= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 31vxLfNzJBaI; Thu, 21 Nov 2019 01:27:32 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id EFAD342F10; Thu, 21 Nov 2019 01:27:31 +0300 (MSK) Received: from localhost (172.17.128.60) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 21 Nov 2019 01:27:31 +0300 From: Roman Bolshakov To: , CC: , Roman Bolshakov , Quinn Tran , Bart Van Assche , Thomas Abraham , , Himanshu Madhani Subject: [PATCH v2 01/15] scsi: qla2xxx: Ignore NULL pointer in tcm_qla2xxx_free_mcmd Date: Thu, 21 Nov 2019 01:27:09 +0300 Message-ID: <20191120222723.27779-2-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191120222723.27779-1-r.bolshakov@yadro.com> References: <20191120222723.27779-1-r.bolshakov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [172.17.128.60] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org If ABTS cannot be completed in target mode, the driver attempts to free related management command and crashes: NIP [d000000019181ee8] tcm_qla2xxx_free_mcmd+0x40/0x80 [tcm_qla2xxx] LR [d00000001dc1e6f8] qlt_response_pkt+0x190/0xa10 [qla2xxx] Call Trace: [c000003fff27bb50] [c000003fff27bc10] 0xc000003fff27bc10 (unreliable) [c000003fff27bb70] [d00000001dc1e6f8] qlt_response_pkt+0x190/0xa10 [qla2xxx] [c000003fff27bc10] [d00000001dbc2be0] qla24xx_process_response_queue+0x5d8/0xbd0 [qla2xxx] [c000003fff27bd50] [d00000001dbc632c] qla24xx_msix_rsp_q+0x64/0x150 [qla2xxx] [c000003fff27bde0] [c000000000187200] __handle_irq_event_percpu+0x90/0x310 [c000003fff27bea0] [c0000000001874b8] handle_irq_event_percpu+0x38/0x90 [c000003fff27bee0] [c000000000187574] handle_irq_event+0x64/0xb0 [c000003fff27bf10] [c00000000018cd38] handle_fasteoi_irq+0xe8/0x280 [c000003fff27bf40] [c000000000185ccc] generic_handle_irq+0x4c/0x70 [c000003fff27bf60] [c000000000016cec] __do_irq+0x7c/0x1d0 [c000003fff27bf90] [c00000000002a530] call_do_irq+0x14/0x24 [c00000207d2cba90] [c000000000016edc] do_IRQ+0x9c/0x130 [c00000207d2cbae0] [c000000000008bf4] hardware_interrupt_common+0x114/0x120 --- interrupt: 501 at arch_local_irq_restore+0x74/0x90 LR = arch_local_irq_restore+0x74/0x90 [c00000207d2cbdd0] [c0000000001c64fc] tick_broadcast_oneshot_control+0x4c/0x60 (unreliable) [c00000207d2cbdf0] [c0000000007ac840] cpuidle_enter_state+0xf0/0x450 [c00000207d2cbe50] [c00000000016b81c] call_cpuidle+0x4c/0x90 [c00000207d2cbe70] [c00000000016bc30] do_idle+0x2b0/0x330 [c00000207d2cbec0] [c00000000016beec] cpu_startup_entry+0x3c/0x50 [c00000207d2cbef0] [c00000000004a06c] start_secondary+0x63c/0x670 [c00000207d2cbf90] [c00000000000aa6c] start_secondary_prolog+0x10/0x14 The crash can be triggered by ACL deletion when there's active I/O. During ACL deletion, qla2xxx performs implicit LOGO that's invisible for the initiator. Only the driver and firmware are aware of the logout. Therefore the initiator continues to send SCSI commands and the target always responds with SAM STATUS BUSY as it can't find the session. The command times out after a while and initiator invokes ABORT TASK TMF for the command. The TMF is mapped to ABTS-LS in FCP. The target can't find session for S_ID originating ABTS-LS so it never allocates mcmd. And since N_Port handle was deleted after LOGO, it is no longer valid and ABTS Response IOCB is returned from firmware with status 31. Then free_mcmd is invoked on NULL pointer and the kernel crashes. [ 7734.578642] qla2xxx [0000:00:0c.0]-e837:6: ABTS_RECV_24XX: instance 0 [ 7734.578644] qla2xxx [0000:00:0c.0]-f811:6: qla_target(0): task abort (s_id=1:2:0, tag=1209504, param=0) [ 7734.578645] find_sess_by_s_id: 0x010200 [ 7734.578645] Unable to locate s_id: 0x010200 [ 7734.578646] qla2xxx [0000:00:0c.0]-f812:6: qla_target(0): task abort for non-existent session [ 7734.578648] qla2xxx [0000:00:0c.0]-e806:6: Sending task mgmt ABTS response (ha=c0000000d5819000, atio=c0000000d3fd4700, status=4 [ 7734.578730] qla2xxx [0000:00:0c.0]-e838:6: ABTS_RESP_24XX: compl_status 31 [ 7734.578732] qla2xxx [0000:00:0c.0]-e863:6: qla_target(0): ABTS_RESP_24XX failed 31 (subcode 19:a) [ 7734.578740] Unable to handle kernel paging request for data at address 0x00000200 Fixes: 6b0431d6fa20b ("scsi: qla2xxx: Fix out of order Termination and ABTS response") Cc: Quinn Tran Cc: Bart Van Assche Cc: Thomas Abraham Cc: stable@vger.kernel.org Signed-off-by: Roman Bolshakov Acked-by: Himanshu Madhani --- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 042a24314edc..bab2073c1f72 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -246,6 +246,8 @@ static void tcm_qla2xxx_complete_mcmd(struct work_struct *work) */ static void tcm_qla2xxx_free_mcmd(struct qla_tgt_mgmt_cmd *mcmd) { + if (!mcmd) + return; INIT_WORK(&mcmd->free_work, tcm_qla2xxx_complete_mcmd); queue_work(tcm_qla2xxx_free_wq, &mcmd->free_work); } From patchwork Wed Nov 20 22:27:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Bolshakov X-Patchwork-Id: 11254925 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 98EAF14DB for ; Wed, 20 Nov 2019 22:27:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 790B420857 for ; Wed, 20 Nov 2019 22:27:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=yadro.com header.i=@yadro.com header.b="lMRiEuNY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726380AbfKTW1i (ORCPT ); Wed, 20 Nov 2019 17:27:38 -0500 Received: from mta-02.yadro.com ([89.207.88.252]:51232 "EHLO mta-01.yadro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725842AbfKTW1h (ORCPT ); Wed, 20 Nov 2019 17:27:37 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 2DDEB43B4E; Wed, 20 Nov 2019 22:27:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1574288854; x=1576103255; bh=nW1cocBIVdnfExHHKeub5wEzBjP8PYatwtD ByxdI6uI=; b=lMRiEuNYcXfMfUoilY4RCn8AkywhnwfgXlCpayC6rZkfeoLXK2H Sr51rlkCoxmo4oUrCATWWQj8r0jKxb5UutpqQwJPktpSnjDl/yOd8iwlHaoqAyTW w5KpJSn9WVMgKestE/lfCbIydiLQLyFVg4cLh/TWtEMXCT2oA4urqQv0= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HyyTAWu7e90H; Thu, 21 Nov 2019 01:27:34 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id C82C642F12; Thu, 21 Nov 2019 01:27:32 +0300 (MSK) Received: from localhost (172.17.128.60) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 21 Nov 2019 01:27:32 +0300 From: Roman Bolshakov To: , CC: , Roman Bolshakov , Quinn Tran , , Himanshu Madhani Subject: [PATCH v2 02/15] scsi: qla2xxx: Initialize free_work before flushing it Date: Thu, 21 Nov 2019 01:27:10 +0300 Message-ID: <20191120222723.27779-3-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191120222723.27779-1-r.bolshakov@yadro.com> References: <20191120222723.27779-1-r.bolshakov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [172.17.128.60] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org Target creation triggers a new BUG_ON introduced in in 4d43d395fed12 ("workqueue: Try to catch flush_work() without INIT_WORK()."). The BUG_ON reveals an attempt to flush free_work in qla24xx_do_nack_work before it's initialized in qlt_unreg_sess: WARNING: CPU: 7 PID: 211 at kernel/workqueue.c:3031 __flush_work.isra.38+0x40/0x2e0 CPU: 7 PID: 211 Comm: kworker/7:1 Kdump: loaded Tainted: G E 5.3.0-rc7-vanilla+ #2 Workqueue: qla2xxx_wq qla2x00_iocb_work_fn [qla2xxx] NIP: c000000000159620 LR: c0080000009d91b0 CTR: c0000000001598c0 REGS: c000000005f3f730 TRAP: 0700 Tainted: G E (5.3.0-rc7-vanilla+) MSR: 800000000282b033 CR: 24002222 XER: 00000000 CFAR: c0000000001598d0 IRQMASK: 0 GPR00: c0080000009d91b0 c000000005f3f9c0 c000000001670a00 c0000003f8655ca8 GPR04: c0000003f8655c00 000000000000ffff 0000000000000011 ffffffffffffffff GPR08: c008000000949228 0000000000000000 0000000000000001 c0080000009e7780 GPR12: 0000000000002200 c00000003fff6200 c000000000161bc8 0000000000000004 GPR16: c0000003f9d68280 0000000002000000 0000000000000005 0000000000000003 GPR20: 0000000000000002 000000000000ffff 0000000000000000 fffffffffffffef7 GPR24: c000000004f73848 c000000004f73838 c000000004f73f28 c000000005f3fb60 GPR28: c000000004f73e48 c000000004f73c80 c000000004f73818 c0000003f9d68280 NIP [c000000000159620] __flush_work.isra.38+0x40/0x2e0 LR [c0080000009d91b0] qla24xx_do_nack_work+0x88/0x180 [qla2xxx] Call Trace: [c000000005f3f9c0] [c000000000159644] __flush_work.isra.38+0x64/0x2e0 (unreliable) [c000000005f3fa50] [c0080000009d91a0] qla24xx_do_nack_work+0x78/0x180 [qla2xxx] [c000000005f3fae0] [c0080000009496ec] qla2x00_do_work+0x604/0xb90 [qla2xxx] [c000000005f3fc40] [c008000000949cd8] qla2x00_iocb_work_fn+0x60/0xe0 [qla2xxx] [c000000005f3fc80] [c000000000157bb8] process_one_work+0x2c8/0x5b0 [c000000005f3fd10] [c000000000157f28] worker_thread+0x88/0x660 [c000000005f3fdb0] [c000000000161d64] kthread+0x1a4/0x1b0 [c000000005f3fe20] [c00000000000b960] ret_from_kernel_thread+0x5c/0x7c Instruction dump: 3d22001d 892966b1 7d908026 91810008 f821ff71 69290001 0b090000 2e290000 40920200 e9230018 7d2a0074 794ad182 <0b0a0000> 2fa90000 419e01e8 7c0802a6 ---[ end trace 5ccf335d4f90fcb8 ]--- Fixes: 1021f0bc2f3d6 ("scsi: qla2xxx: allow session delete to finish before create.") Cc: Quinn Tran Cc: stable@vger.kernel.org Signed-off-by: Roman Bolshakov Acked-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_init.c | 1 + drivers/scsi/qla2xxx/qla_target.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 1dbee8800218..4f3da968163e 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -4852,6 +4852,7 @@ qla2x00_alloc_fcport(scsi_qla_host_t *vha, gfp_t flags) } INIT_WORK(&fcport->del_work, qla24xx_delete_sess_fn); + INIT_WORK(&fcport->free_work, qlt_free_session_done); INIT_WORK(&fcport->reg_work, qla_register_fcport_fn); INIT_LIST_HEAD(&fcport->gnl_entry); INIT_LIST_HEAD(&fcport->list); diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 51b275a575a5..7f470a314b1a 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -1160,7 +1160,6 @@ void qlt_unreg_sess(struct fc_port *sess) sess->last_rscn_gen = sess->rscn_gen; sess->last_login_gen = sess->login_gen; - INIT_WORK(&sess->free_work, qlt_free_session_done); queue_work(sess->vha->hw->wq, &sess->free_work); } EXPORT_SYMBOL(qlt_unreg_sess); From patchwork Wed Nov 20 22:27:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Bolshakov X-Patchwork-Id: 11254981 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4480114ED for ; Wed, 20 Nov 2019 22:27:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 249C820857 for ; Wed, 20 Nov 2019 22:27:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=yadro.com header.i=@yadro.com header.b="FqePgKZq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726351AbfKTW1h (ORCPT ); Wed, 20 Nov 2019 17:27:37 -0500 Received: from mta-02.yadro.com ([89.207.88.252]:51244 "EHLO mta-01.yadro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726170AbfKTW1h (ORCPT ); Wed, 20 Nov 2019 17:27:37 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 2EAC243C28; Wed, 20 Nov 2019 22:27:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1574288855; x=1576103256; bh=5xqnCLbcYErwmr1sSEDE0GD4w2qgfE9byGK cCcbpPJM=; b=FqePgKZq4bBFd1fX7iRRtEu8LbmA6yl/ATljgHA10VAkK5VvImA SPxzeSd0a7RS7NUN3nr5HxAjSKQNPZLpe2TJyB/CKiJTtPY1olPweA6Hg/Vkxnh8 OHEj1v0uM8uQdMMIIOfN5lnMoVjCpjx/ZLXIwJFXlNPk5ShaxDC61WFk= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8ZJce0FGBAOv; Thu, 21 Nov 2019 01:27:35 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 0414F42F13; Thu, 21 Nov 2019 01:27:33 +0300 (MSK) Received: from localhost (172.17.128.60) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 21 Nov 2019 01:27:32 +0300 From: Roman Bolshakov To: , CC: , Roman Bolshakov , Quinn Tran , Hannes Reinecke , Himanshu Madhani Subject: [PATCH v2 03/15] scsi: qla2xxx: Drop superfluous INIT_WORK of del_work Date: Thu, 21 Nov 2019 01:27:11 +0300 Message-ID: <20191120222723.27779-4-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191120222723.27779-1-r.bolshakov@yadro.com> References: <20191120222723.27779-1-r.bolshakov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [172.17.128.60] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org del_work is already initialized inside qla2x00_alloc_fcport, there's no need to overwrite it. Indeed, it might prevent complete traversal of workqueue list. Fixes: a01c77d2cbc45 ("scsi: qla2xxx: Move session delete to driver work queue") Cc: Quinn Tran Cc: Hannes Reinecke Signed-off-by: Roman Bolshakov Acked-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_target.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 7f470a314b1a..ab62fcba8ab3 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -1264,7 +1264,6 @@ void qlt_schedule_sess_for_deletion(struct fc_port *sess) "Scheduling sess %p for deletion %8phC\n", sess, sess->port_name); - INIT_WORK(&sess->del_work, qla24xx_delete_sess_fn); WARN_ON(!queue_work(sess->vha->hw->wq, &sess->del_work)); } From patchwork Wed Nov 20 22:27:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Bolshakov X-Patchwork-Id: 11254929 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6331914E5 for ; Wed, 20 Nov 2019 22:27:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4267320872 for ; Wed, 20 Nov 2019 22:27:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=yadro.com header.i=@yadro.com header.b="XumyDsq4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726510AbfKTW1j (ORCPT ); Wed, 20 Nov 2019 17:27:39 -0500 Received: from mta-02.yadro.com ([89.207.88.252]:51252 "EHLO mta-01.yadro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726346AbfKTW1i (ORCPT ); Wed, 20 Nov 2019 17:27:38 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 2F10643D79; Wed, 20 Nov 2019 22:27:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1574288856; x=1576103257; bh=bukIwQHWOI0oe/Kwe6RNHTVy/xzfD1g7Tzr Im4yeQc8=; b=XumyDsq4dKFGr5jfWSbRy41kfAngfcHK43Z1QE9gYH024CsvsB1 F4QsaoVTNxeDaV9nWyruUOSckb/o8NrB/PnKYsbniJqI31MYzet6OTi1zIaviAJx nCjz7wqgfSjFBJ6oksmRMfki69ySGM81AJPTn4+QwXmWEhYrer18C4ho= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YYtdjL79dd2y; Thu, 21 Nov 2019 01:27:36 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 8483D43597; Thu, 21 Nov 2019 01:27:33 +0300 (MSK) Received: from localhost (172.17.128.60) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 21 Nov 2019 01:27:33 +0300 From: Roman Bolshakov To: , CC: , Roman Bolshakov , Quinn Tran , , Himanshu Madhani Subject: [PATCH v2 04/15] scsi: qla2xxx: Change discovery state before PLOGI Date: Thu, 21 Nov 2019 01:27:12 +0300 Message-ID: <20191120222723.27779-5-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191120222723.27779-1-r.bolshakov@yadro.com> References: <20191120222723.27779-1-r.bolshakov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [172.17.128.60] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org When a port sends PLOGI, discovery state should be changed to login pending, otherwise RELOGIN_NEEDED bit is set in qla24xx_handle_plogi_done_event(). RELOGIN_NEEDED triggers another PLOGI, and it never goes out of the loop until login timer expires. Fixes: 8777e4314d397 ("scsi: qla2xxx: Migrate NVME N2N handling into state machine") Fixes: 8b5292bcfcacf ("scsi: qla2xxx: Fix Relogin to prevent modifying scan_state flag") Cc: Quinn Tran Cc: stable@vger.kernel.org Signed-off-by: Roman Bolshakov Acked-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_init.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 4f3da968163e..fcb309be50d9 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -533,6 +533,7 @@ static int qla_post_els_plogi_work(struct scsi_qla_host *vha, fc_port_t *fcport) e->u.fcport.fcport = fcport; fcport->flags |= FCF_ASYNC_ACTIVE; + fcport->disc_state = DSC_LOGIN_PEND; return qla2x00_post_work(vha, e); } From patchwork Wed Nov 20 22:27:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Bolshakov X-Patchwork-Id: 11254973 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 045B514E5 for ; Wed, 20 Nov 2019 22:27:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D904520857 for ; Wed, 20 Nov 2019 22:27:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=yadro.com header.i=@yadro.com header.b="amsHgQsz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726454AbfKTW1k (ORCPT ); Wed, 20 Nov 2019 17:27:40 -0500 Received: from mta-02.yadro.com ([89.207.88.252]:51262 "EHLO mta-01.yadro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725842AbfKTW1k (ORCPT ); Wed, 20 Nov 2019 17:27:40 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 06C9443B4E; Wed, 20 Nov 2019 22:27:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1574288856; x=1576103257; bh=Ni0NC50v8cLQ+ef77rJzWipKfOYzhZwnm3V jCC/GSAE=; b=amsHgQszU9ikOym1/8a81sQiWHxC1pHDzD+4XoAOF9dfyCD9iyK tZYmJRPffG+za3KD5/sxJpoNetY92DjJdShJ7icAyDJkgdV1zrVF+xYR2Bh4oxpX 7AHCR4W/SKyg5ISwpTh7LV4+dRXd8D/WF9GfR86ERdrXt0SDKNL2ul1w= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WTbId02nmtiC; Thu, 21 Nov 2019 01:27:36 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 1BA5C42F10; Thu, 21 Nov 2019 01:27:34 +0300 (MSK) Received: from localhost (172.17.128.60) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 21 Nov 2019 01:27:33 +0300 From: Roman Bolshakov To: , CC: , Roman Bolshakov , Quinn Tran , Himanshu Madhani Subject: [PATCH v2 05/15] scsi: qla2xxx: Allow PLOGI in target mode Date: Thu, 21 Nov 2019 01:27:13 +0300 Message-ID: <20191120222723.27779-6-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191120222723.27779-1-r.bolshakov@yadro.com> References: <20191120222723.27779-1-r.bolshakov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [172.17.128.60] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org According to FC-LS-3 (Fibre Channel Link Services) 6.3.2.4 "N_Port Login - No Fabric present", if both parties in the point-to-point connection know N_Port_Names of each other, Nx_Port with the highest N_Port_name shall transmit PLOGI. The specification sets no restrictions on the port role that should send PLOGI. However, FCP-4 (Fibre Channel Protocol for SCSI, Fourth Version) 6.2 "Overview of Process Login and Process Logout", instructs that in point-to-point topology, initiator shall send explicit PRLI ELS. The change fixes stuck P2P login, when target WWPN is higher than initiator WWPN. Cc: Quinn Tran Cc: Himanshu Madhani Signed-off-by: Roman Bolshakov Signed-off-by: Roman Bolshakov --- drivers/scsi/qla2xxx/qla_init.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index fcb309be50d9..12391815be06 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -1527,10 +1527,6 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport) } } - /* for pure Target Mode. Login will not be initiated */ - if (vha->host->active_mode == MODE_TARGET) - return 0; - if (fcport->flags & FCF_ASYNC_SENT) { set_bit(RELOGIN_NEEDED, &vha->dpc_flags); return 0; @@ -1720,6 +1716,10 @@ void qla24xx_handle_relogin_event(scsi_qla_host_t *vha, void qla_handle_els_plogi_done(scsi_qla_host_t *vha, struct event_arg *ea) { + /* for pure Target Mode, PRLI will not be initiated */ + if (vha->host->active_mode == MODE_TARGET) + return; + ql_dbg(ql_dbg_disc, vha, 0x2118, "%s %d %8phC post PRLI\n", __func__, __LINE__, ea->fcport->port_name); From patchwork Wed Nov 20 22:27:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Bolshakov X-Patchwork-Id: 11254931 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EB44914ED for ; Wed, 20 Nov 2019 22:27:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CB0AB20857 for ; Wed, 20 Nov 2019 22:27:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=yadro.com header.i=@yadro.com header.b="FR+oUiNf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726346AbfKTW1j (ORCPT ); Wed, 20 Nov 2019 17:27:39 -0500 Received: from mta-02.yadro.com ([89.207.88.252]:51266 "EHLO mta-01.yadro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726454AbfKTW1j (ORCPT ); Wed, 20 Nov 2019 17:27:39 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 23E4942F10; Wed, 20 Nov 2019 22:27:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1574288857; x=1576103258; bh=Sq70+y2s2skbF9xcugbCIin3cT80GZmW4Cl HUd8/nUw=; b=FR+oUiNfvRy337nS9DdraG1yBe1nnoamMhHY7Zkrv92Vc2T6AqE aNF+p72NiKjIwfQzno2HAM2ch/kPvd3SCqGef6+lS4CzG6NrQFREdr07DSofWrGF r1hr8KK+RfLmdOWzYwvcGHhmE4pn2+P4JSLe4zwqNGbN7X9FOyh7UAdQ= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id K9Lp-AMPaDlQ; Thu, 21 Nov 2019 01:27:37 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 8FD95438D1; Thu, 21 Nov 2019 01:27:34 +0300 (MSK) Received: from localhost (172.17.128.60) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 21 Nov 2019 01:27:34 +0300 From: Roman Bolshakov To: , CC: , Roman Bolshakov , Quinn Tran , Himanshu Madhani Subject: [PATCH v2 06/15] scsi: qla2xxx: Don't call qlt_async_event twice Date: Thu, 21 Nov 2019 01:27:14 +0300 Message-ID: <20191120222723.27779-7-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191120222723.27779-1-r.bolshakov@yadro.com> References: <20191120222723.27779-1-r.bolshakov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [172.17.128.60] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org MBA_PORT_UPDATE generates duplicate log lines in target mode because qlt_async_event is called twice. Drop the calls within the case as the function will be called right after the switch statement. Cc: Quinn Tran Cc: Himanshu Madhani Signed-off-by: Roman Bolshakov Acked-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_isr.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 1b8f297449cf..c6274178b0b0 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -1061,8 +1061,6 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb) ql_dbg(ql_dbg_async, vha, 0x5011, "Asynchronous PORT UPDATE ignored %04x/%04x/%04x.\n", mb[1], mb[2], mb[3]); - - qlt_async_event(mb[0], vha, mb); break; } @@ -1079,8 +1077,6 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb) set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); set_bit(VP_CONFIG_OK, &vha->vp_flags); - - qlt_async_event(mb[0], vha, mb); break; case MBA_RSCN_UPDATE: /* State Change Registration */ From patchwork Wed Nov 20 22:27:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Bolshakov X-Patchwork-Id: 11254969 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ED45A14E5 for ; Wed, 20 Nov 2019 22:27:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CB35E20857 for ; Wed, 20 Nov 2019 22:27:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=yadro.com header.i=@yadro.com header.b="nLXXl2JF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726666AbfKTW1l (ORCPT ); Wed, 20 Nov 2019 17:27:41 -0500 Received: from mta-02.yadro.com ([89.207.88.252]:51276 "EHLO mta-01.yadro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726536AbfKTW1l (ORCPT ); Wed, 20 Nov 2019 17:27:41 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id F325543E07; Wed, 20 Nov 2019 22:27:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1574288858; x=1576103259; bh=FJaTLojVV5xO0HBNOT++1T1b7T1o7HKRwl3 0Rk4VK5U=; b=nLXXl2JFZb5xKGvvowbYiuBWNyxRwFpEryGk7tB66lwbtWD3AN0 Ptxe1WYpTbEgAIRjq+d6+wXiOzANg4uEst4Pk9fJnz0F8Njx2DLY833ZIZf3Qh6L UkLMpCfnP5kc62iohz55glozyDjwRLmLTqJ0dkZZajUOW3szMPKAraG8= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FjDiiJsRsJ4x; Thu, 21 Nov 2019 01:27:38 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 1A98943B0D; Thu, 21 Nov 2019 01:27:35 +0300 (MSK) Received: from localhost (172.17.128.60) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 21 Nov 2019 01:27:34 +0300 From: Roman Bolshakov To: , CC: , Roman Bolshakov , Quinn Tran , Himanshu Madhani Subject: [PATCH v2 07/15] scsi: qla2xxx: Fix PLOGI payload and ELS IOCB dump length Date: Thu, 21 Nov 2019 01:27:15 +0300 Message-ID: <20191120222723.27779-8-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191120222723.27779-1-r.bolshakov@yadro.com> References: <20191120222723.27779-1-r.bolshakov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [172.17.128.60] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org The size of the buffer is hardcoded as 0x70 or 112 bytes, while the size of ELS IOCB is 0x40 and the size of PLOGI payload returned by Get Parameters command is 0x74. Cc: Quinn Tran Cc: Himanshu Madhani Signed-off-by: Roman Bolshakov Acked-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_iocb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index b25f87ff8cde..bd8160fddcd3 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -2676,7 +2676,8 @@ qla24xx_els_logo_iocb(srb_t *sp, struct els_entry_24xx *els_iocb) ql_dbg(ql_dbg_io + ql_dbg_buffer, vha, 0x3073, "PLOGI ELS IOCB:\n"); ql_dump_buffer(ql_log_info, vha, 0x0109, - (uint8_t *)els_iocb, 0x70); + (uint8_t *)els_iocb, + sizeof(*els_iocb)); } else { els_iocb->control_flags = 1 << 13; els_iocb->tx_byte_count = @@ -2934,7 +2935,8 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode, ql_dbg(ql_dbg_disc + ql_dbg_buffer, vha, 0x3073, "PLOGI buffer:\n"); ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x0109, - (uint8_t *)elsio->u.els_plogi.els_plogi_pyld, 0x70); + (uint8_t *)elsio->u.els_plogi.els_plogi_pyld, + sizeof(*elsio->u.els_plogi.els_plogi_pyld)); rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) { From patchwork Wed Nov 20 22:27:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Bolshakov X-Patchwork-Id: 11254977 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 711781871 for ; Wed, 20 Nov 2019 22:27:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 50E0020872 for ; Wed, 20 Nov 2019 22:27:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=yadro.com header.i=@yadro.com header.b="oH7dRNOm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726750AbfKTW1t (ORCPT ); Wed, 20 Nov 2019 17:27:49 -0500 Received: from mta-02.yadro.com ([89.207.88.252]:51280 "EHLO mta-01.yadro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726554AbfKTW1k (ORCPT ); Wed, 20 Nov 2019 17:27:40 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 1F88643B0D; Wed, 20 Nov 2019 22:27:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1574288858; x=1576103259; bh=AoW3kTas39MbUxlrFQ89zzmfOPycLEZixrm itxLfY7k=; b=oH7dRNOmXmzHODTgBxoD9id1MfSuQAs03iNjKGlYKG35VvUEzCi rEp74BGDgdrYEymtO9/p/tD2VYdaEfWCtbzh4UYToCRgsKdYOc1a07SXCPOENTqk VDWfqi8CAW3KNc1cAGYvALaZRZ5SWz4UMOrZEf9IWjfZ8Bym7GG7tt5o= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5DvocU4BwFvS; Thu, 21 Nov 2019 01:27:38 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 9CD9842F12; Thu, 21 Nov 2019 01:27:35 +0300 (MSK) Received: from localhost (172.17.128.60) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 21 Nov 2019 01:27:35 +0300 From: Roman Bolshakov To: , CC: , Roman Bolshakov , Quinn Tran , Himanshu Madhani Subject: [PATCH v2 08/15] scsi: qla2xxx: Configure local loop for N2N target Date: Thu, 21 Nov 2019 01:27:16 +0300 Message-ID: <20191120222723.27779-9-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191120222723.27779-1-r.bolshakov@yadro.com> References: <20191120222723.27779-1-r.bolshakov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [172.17.128.60] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org qla2x00_configure_local_loop initializes PLOGI payload for PLOGI ELS using Get Parameters mailbox command. In the case when the driver is running in target mode, the topology is N2N and the target port has higher WWPN, LOCAL_LOOP_UPDATE bit is cleared too early and PLOGI payload is not initialized by the Get Parameters command. That causes a failure of ELS IOCB carrying the PLOGI with 0x15 aka Data Underrun error. LOCAL_LOOP_UPDATE has to be set to initialize PLOGI payload. Fixes: 48acad099074 ("scsi: qla2xxx: Fix N2N link re-connect") Cc: Quinn Tran Cc: Himanshu Madhani Signed-off-by: Roman Bolshakov Signed-off-by: Roman Bolshakov Acked-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_init.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 12391815be06..096f41fe17d2 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -4932,14 +4932,8 @@ qla2x00_configure_loop(scsi_qla_host_t *vha) set_bit(RSCN_UPDATE, &flags); clear_bit(LOCAL_LOOP_UPDATE, &flags); - } else if (ha->current_topology == ISP_CFG_N) { - clear_bit(RSCN_UPDATE, &flags); - if (qla_tgt_mode_enabled(vha)) { - /* allow the other side to start the login */ - clear_bit(LOCAL_LOOP_UPDATE, &flags); - set_bit(RELOGIN_NEEDED, &vha->dpc_flags); - } - } else if (ha->current_topology == ISP_CFG_NL) { + } else if (ha->current_topology == ISP_CFG_NL || + ha->current_topology == ISP_CFG_N) { clear_bit(RSCN_UPDATE, &flags); set_bit(LOCAL_LOOP_UPDATE, &flags); } else if (!vha->flags.online || From patchwork Wed Nov 20 22:27:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Bolshakov X-Patchwork-Id: 11254945 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 09CCE14DB for ; Wed, 20 Nov 2019 22:27:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DE8B820857 for ; Wed, 20 Nov 2019 22:27:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=yadro.com header.i=@yadro.com header.b="dhXhkrDV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726703AbfKTW1m (ORCPT ); Wed, 20 Nov 2019 17:27:42 -0500 Received: from mta-02.yadro.com ([89.207.88.252]:51252 "EHLO mta-01.yadro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726574AbfKTW1l (ORCPT ); Wed, 20 Nov 2019 17:27:41 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id F3D1943D79; Wed, 20 Nov 2019 22:27:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1574288859; x=1576103260; bh=rSnJTzuxkzVlpvhu14/MVeJvHTaJrfQHCMa qfaTBCio=; b=dhXhkrDVyza3x43c9hphqqOxb4z4TtdcVkHGt/iRAjLwJRTtJW+ IBEr4N0S5jQLtZJ8H2V7LkvkV0kXB8oGvP2INiNiCo/bo781iglWqxCNxlfwiKZP erGf67QEkbEZFQsHKU+l208CmPsiq82WKZDRiI8U/oaJeneapTw7TLvk= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jHdJxb6qvwOL; Thu, 21 Nov 2019 01:27:39 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 3597F42F13; Thu, 21 Nov 2019 01:27:36 +0300 (MSK) Received: from localhost (172.17.128.60) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 21 Nov 2019 01:27:35 +0300 From: Roman Bolshakov To: , CC: , Roman Bolshakov , Quinn Tran , Himanshu Madhani , Krishna Kant , Alexei Potashnik Subject: [PATCH v2 09/15] scsi: qla2xxx: Send Notify ACK after N2N PLOGI Date: Thu, 21 Nov 2019 01:27:17 +0300 Message-ID: <20191120222723.27779-10-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191120222723.27779-1-r.bolshakov@yadro.com> References: <20191120222723.27779-1-r.bolshakov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [172.17.128.60] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org qlt_handle_login schedules session for deletion even if a login is in progress. That causes login bouncing, i.e. a few logins are made before it settles down. Complete the first login by sending Notify Acknowledge IOCB via qlt_plogi_ack_unref if the session is pending login completion. Fixes: 9cd883f07a54 ("scsi: qla2xxx: Fix session cleanup for N2N") Cc: Quinn Tran Cc: Himanshu Madhani Cc: Krishna Kant Cc: Alexei Potashnik Signed-off-by: Roman Bolshakov Acked-by: Quinn Tran Signed-off-by: Roman Bolshakov Acked-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_target.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index ab62fcba8ab3..853fa187d827 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -4802,6 +4802,7 @@ static int qlt_handle_login(struct scsi_qla_host *vha, switch (sess->disc_state) { case DSC_DELETED: + case DSC_LOGIN_PEND: qlt_plogi_ack_unref(vha, pla); break; From patchwork Wed Nov 20 22:27:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Bolshakov X-Patchwork-Id: 11254939 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 09B8414DB for ; Wed, 20 Nov 2019 22:27:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DE35920872 for ; Wed, 20 Nov 2019 22:27:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=yadro.com header.i=@yadro.com header.b="j6kuWOlA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726638AbfKTW1l (ORCPT ); Wed, 20 Nov 2019 17:27:41 -0500 Received: from mta-02.yadro.com ([89.207.88.252]:51266 "EHLO mta-01.yadro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726614AbfKTW1l (ORCPT ); Wed, 20 Nov 2019 17:27:41 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 1610C42F13; Wed, 20 Nov 2019 22:27:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1574288859; x=1576103260; bh=0sXTTF72oAejcpoLubq8lVzbK7V8EhPGVF9 MYZCpRXc=; b=j6kuWOlAZwNuNiVe1uG+aZBlIEvlsFDwLR3AgPl1m/uhDOw16UB aohIdS87/sy8bz6HsbRyh5s7j5/z1RwP8iYtySLTSgpn3nY7cMsU3QNu+jwlyNUb iNY24Y2wgvyd71aVCCa1WNHSoUZ8FH13qvQVRD46xS+0RSkMQNtyP07M= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id R9mD_C1HLt3A; Thu, 21 Nov 2019 01:27:39 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id A6D1543C73; Thu, 21 Nov 2019 01:27:36 +0300 (MSK) Received: from localhost (172.17.128.60) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 21 Nov 2019 01:27:36 +0300 From: Roman Bolshakov To: , CC: , Roman Bolshakov , Quinn Tran , Himanshu Madhani Subject: [PATCH v2 10/15] scsi: qla2xxx: Don't defer relogin unconditonally Date: Thu, 21 Nov 2019 01:27:18 +0300 Message-ID: <20191120222723.27779-11-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191120222723.27779-1-r.bolshakov@yadro.com> References: <20191120222723.27779-1-r.bolshakov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [172.17.128.60] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org qla2x00_configure_local_loop sets RELOGIN_NEEDED bit and calls qla24xx_fcport_handle_login to perform the login. This bit triggers a wake up of DPC later after a successful login. The deferred call is not needed if login succeeds, and it's set in qla24xx_fcport_handle_login in case of errors, hence it should be safe to drop. Cc: Quinn Tran Cc: Himanshu Madhani Signed-off-by: Roman Bolshakov Acked-by: Quinn Tran Signed-off-by: Roman Bolshakov --- drivers/scsi/qla2xxx/qla_init.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 096f41fe17d2..e984746e7428 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -5050,7 +5050,6 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha) memcpy(&ha->plogi_els_payld.data, (void *)ha->init_cb, sizeof(ha->plogi_els_payld.data)); - set_bit(RELOGIN_NEEDED, &vha->dpc_flags); } else { ql_dbg(ql_dbg_init, vha, 0x00d1, "PLOGI ELS param read fail.\n"); From patchwork Wed Nov 20 22:27:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Bolshakov X-Patchwork-Id: 11254963 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2C2F21871 for ; Wed, 20 Nov 2019 22:27:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0852820857 for ; Wed, 20 Nov 2019 22:27:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=yadro.com header.i=@yadro.com header.b="U8SPjd79" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726714AbfKTW1n (ORCPT ); Wed, 20 Nov 2019 17:27:43 -0500 Received: from mta-02.yadro.com ([89.207.88.252]:51262 "EHLO mta-01.yadro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725819AbfKTW1l (ORCPT ); Wed, 20 Nov 2019 17:27:41 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id EC87D42F10; Wed, 20 Nov 2019 22:27:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1574288860; x=1576103261; bh=8juQ/+xQP0fjrdeggdmrYn1F+F1tz+SrUVs 3eiNcJoE=; b=U8SPjd79H1Lm3w84qcjRhRICJWIofIZ8MKFFStaF2vHWA2i9EJx SixctuiUXJnry8yY2G8P3ZUD/FqfW/yfhYM5tj6LGXiyLmXgkTo19GLsZxmnZ5kG f7MOtmkhvsxY05cLu++sQS167HVQVOO4eC4BT+scePxlHehmm/GfgnVw= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OjHgONY1vIYN; Thu, 21 Nov 2019 01:27:40 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 2D5B442004; Thu, 21 Nov 2019 01:27:37 +0300 (MSK) Received: from localhost (172.17.128.60) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 21 Nov 2019 01:27:36 +0300 From: Roman Bolshakov To: , CC: , Roman Bolshakov , Quinn Tran , Himanshu Madhani Subject: [PATCH v2 11/15] scsi: qla2xxx: Ignore PORT UPDATE after N2N PLOGI Date: Thu, 21 Nov 2019 01:27:19 +0300 Message-ID: <20191120222723.27779-12-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191120222723.27779-1-r.bolshakov@yadro.com> References: <20191120222723.27779-1-r.bolshakov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [172.17.128.60] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org PORT UPDATE asynchronous event is generated on the host that issues PLOGI ELS (in the case of higher WWPN). In that case, the event shouldn't be handled as it sets unwanted DPC flags (i.e. LOOP_RESYNC_NEEDED) that trigger link flap. Ignore the event if the host has higher WWPN, but handle otherwise. Cc: Quinn Tran Cc: Himanshu Madhani Signed-off-by: Roman Bolshakov --- drivers/scsi/qla2xxx/qla_mbx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 4eb88c3ee08e..bb6811b94683 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -3920,6 +3920,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, vha->d_id.b24 = 0; vha->d_id.b.al_pa = 1; ha->flags.n2n_bigger = 1; + ha->flags.n2n_ae = 0; id.b.al_pa = 2; ql_dbg(ql_dbg_async, vha, 0x5075, @@ -3930,6 +3931,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, "Format 1: Remote login - Waiting for WWPN %8phC.\n", rptid_entry->u.f1.port_name); ha->flags.n2n_bigger = 0; + ha->flags.n2n_ae = 1; } qla24xx_post_newsess_work(vha, &id, rptid_entry->u.f1.port_name, @@ -3941,7 +3943,6 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, /* if our portname is higher then initiate N2N login */ set_bit(N2N_LOGIN_NEEDED, &vha->dpc_flags); - ha->flags.n2n_ae = 1; return; break; case TOPO_FL: From patchwork Wed Nov 20 22:27:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Bolshakov X-Patchwork-Id: 11254955 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E72DA1871 for ; Wed, 20 Nov 2019 22:27:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C6DB620857 for ; Wed, 20 Nov 2019 22:27:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=yadro.com header.i=@yadro.com header.b="LsujtCqt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726721AbfKTW1o (ORCPT ); Wed, 20 Nov 2019 17:27:44 -0500 Received: from mta-02.yadro.com ([89.207.88.252]:51280 "EHLO mta-01.yadro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726658AbfKTW1n (ORCPT ); Wed, 20 Nov 2019 17:27:43 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 28F7642004; Wed, 20 Nov 2019 22:27:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1574288860; x=1576103261; bh=ATTKVf3A7Bd7aCGacapEQlVHTfGwIRao2f/ c1INGfYY=; b=LsujtCqtBeHnurfnmn9cu3KiPjs3JI9i5sl3ZtJ4yyug4Fz93fa pWV85Vj+adt1naSRPsrncW47tXFHD2RGC/ZmwLES97GLDP+8n1EclmntltUU5kIo Y2V4AdwRkl4CH9zwl7rXd0ur9BOl9Kd0x8DWpHz+YnryMedx9Z97itWY= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MRuHGdyV6Hz8; Thu, 21 Nov 2019 01:27:40 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id A3C4243597; Thu, 21 Nov 2019 01:27:37 +0300 (MSK) Received: from localhost (172.17.128.60) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 21 Nov 2019 01:27:37 +0300 From: Roman Bolshakov To: , CC: , Quinn Tran , Himanshu Madhani , Roman Bolshakov Subject: [PATCH v2 12/15] scsi: qla2xxx: Use explicit LOGO in target mode Date: Thu, 21 Nov 2019 01:27:20 +0300 Message-ID: <20191120222723.27779-13-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191120222723.27779-1-r.bolshakov@yadro.com> References: <20191120222723.27779-1-r.bolshakov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [172.17.128.60] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org From: Quinn Tran Target makes implicit LOGO on session teardown. LOGO ELS is not send on the wire and initiator is not aware that target no longer wants talking to it. Initiator keeps sending I/O requests, target responds with BA_RJT, they time out and then initiator sends ABORT TASK (ABTS-LS). Current behaviour incurs unneeded I/O timeout and can be fixed by making explicit LOGO on session deletion. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani Signed-off-by: Roman Bolshakov --- drivers/scsi/qla2xxx/qla_def.h | 1 + drivers/scsi/qla2xxx/qla_iocb.c | 16 ++++++++++++---- drivers/scsi/qla2xxx/qla_target.c | 1 + drivers/scsi/qla2xxx/tcm_qla2xxx.c | 1 + 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 460f443f6471..2edd9f7b3074 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -2401,6 +2401,7 @@ typedef struct fc_port { unsigned int id_changed:1; unsigned int scan_needed:1; unsigned int n2n_flag:1; + unsigned int explicit_logout:1; struct completion nvme_del_done; uint32_t nvme_prli_service_param; diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index bd8160fddcd3..53ccbd6b71ed 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -2405,11 +2405,19 @@ qla2x00_login_iocb(srb_t *sp, struct mbx_entry *mbx) static void qla24xx_logout_iocb(srb_t *sp, struct logio_entry_24xx *logio) { + u16 control_flags = LCF_COMMAND_LOGO; logio->entry_type = LOGINOUT_PORT_IOCB_TYPE; - logio->control_flags = - cpu_to_le16(LCF_COMMAND_LOGO|LCF_IMPL_LOGO); - if (!sp->fcport->keep_nport_handle) - logio->control_flags |= cpu_to_le16(LCF_FREE_NPORT); + + if (sp->fcport->explicit_logout) { + control_flags |= LCF_EXPL_LOGO|LCF_FREE_NPORT; + } else { + control_flags |= LCF_IMPL_LOGO; + + if (!sp->fcport->keep_nport_handle) + control_flags |= LCF_FREE_NPORT; + } + + logio->control_flags = cpu_to_le16(control_flags); logio->nport_handle = cpu_to_le16(sp->fcport->loop_id); logio->port_id[0] = sp->fcport->d_id.b.al_pa; logio->port_id[1] = sp->fcport->d_id.b.area; diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 853fa187d827..68c14143e50e 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -1104,6 +1104,7 @@ void qlt_free_session_done(struct work_struct *work) } } + sess->explicit_logout = 0; spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); sess->free_pending = 0; diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index bab2073c1f72..abe7f79bb789 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -350,6 +350,7 @@ static void tcm_qla2xxx_close_session(struct se_session *se_sess) target_sess_cmd_list_set_waiting(se_sess); spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); + sess->explicit_logout = 1; tcm_qla2xxx_put_sess(sess); } From patchwork Wed Nov 20 22:27:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Bolshakov X-Patchwork-Id: 11254965 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5269414DB for ; Wed, 20 Nov 2019 22:27:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 32FC320857 for ; Wed, 20 Nov 2019 22:27:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=yadro.com header.i=@yadro.com header.b="ksbB5AXO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726744AbfKTW1q (ORCPT ); Wed, 20 Nov 2019 17:27:46 -0500 Received: from mta-02.yadro.com ([89.207.88.252]:51266 "EHLO mta-01.yadro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726690AbfKTW1o (ORCPT ); Wed, 20 Nov 2019 17:27:44 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 1174A43B0D; Wed, 20 Nov 2019 22:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1574288860; x=1576103261; bh=jloE1NEzU0EsbDq+VlO3WcdFCA4IyqNf6BD qrxCrTgg=; b=ksbB5AXOkU/dzA0Etm+yIu+Awqqry5ZF8vw2vW6GO3H5NhMypQQ pE6I6HUheyao9G1uObrmRdGaRJHTMG7O6n2YNobzVF9qqjjkXhdU+FyIij2F3qaK aYC+Pw4WUc8q1w7Cnvvd10zRahkEVrytyYhM6+cwVCWzfWvqhZD5A/Vw= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rZ8d_zxLz-RI; Thu, 21 Nov 2019 01:27:40 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 2496943E03; Thu, 21 Nov 2019 01:27:38 +0300 (MSK) Received: from localhost (172.17.128.60) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 21 Nov 2019 01:27:37 +0300 From: Roman Bolshakov To: , CC: , Roman Bolshakov , Quinn Tran Subject: [PATCH v2 13/15] scsi: qla2xxx: Add async mode for qla24xx_els_dcmd_iocb Date: Thu, 21 Nov 2019 01:27:21 +0300 Message-ID: <20191120222723.27779-14-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191120222723.27779-1-r.bolshakov@yadro.com> References: <20191120222723.27779-1-r.bolshakov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [172.17.128.60] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org qla24xx_els_dcmd_iocb() performs LOGO and might be invoked in contexts where it is prohibited to sleep. The new wait parameter provides a way to use the function in such context, similarly to qla24xx_els_dcmd2_iocb(). Cc: Quinn Tran Cc: Himanshu Madhani Acked-by: Quinn Tran Signed-off-by: Roman Bolshakov --- drivers/scsi/qla2xxx/qla_attr.c | 2 +- drivers/scsi/qla2xxx/qla_gbl.h | 2 +- drivers/scsi/qla2xxx/qla_iocb.c | 11 +++++++++-- drivers/scsi/qla2xxx/qla_target.c | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 481c05dbea06..35c703ec59ad 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -828,7 +828,7 @@ qla2x00_issue_logo(struct file *filp, struct kobject *kobj, ql_log(ql_log_info, vha, 0x70e4, "%s: %d\n", __func__, type); - qla24xx_els_dcmd_iocb(vha, ELS_DCMD_LOGO, did); + qla24xx_els_dcmd_iocb(vha, ELS_DCMD_LOGO, did, true); return count; } diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 5b163ad85c34..df0f3421e3bb 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -43,7 +43,7 @@ extern void qla2x00_clear_loop_id(fc_port_t *fcport); extern int qla2x00_fabric_login(scsi_qla_host_t *, fc_port_t *, uint16_t *); extern int qla2x00_local_device_login(scsi_qla_host_t *, fc_port_t *); -extern int qla24xx_els_dcmd_iocb(scsi_qla_host_t *, int, port_id_t); +extern int qla24xx_els_dcmd_iocb(scsi_qla_host_t *, int, port_id_t, bool); extern int qla24xx_els_dcmd2_iocb(scsi_qla_host_t *, int, fc_port_t *, bool); extern void qla2x00_els_dcmd2_free(scsi_qla_host_t *vha, struct els_plogi *els_plogi); diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 53ccbd6b71ed..12b37b711ae8 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -2562,7 +2562,7 @@ static void qla2x00_els_dcmd_sp_done(srb_t *sp, int res) int qla24xx_els_dcmd_iocb(scsi_qla_host_t *vha, int els_opcode, - port_id_t remote_did) + port_id_t remote_did, bool wait) { srb_t *sp; fc_port_t *fcport = NULL; @@ -2601,6 +2601,8 @@ qla24xx_els_dcmd_iocb(scsi_qla_host_t *vha, int els_opcode, elsio->timeout = qla2x00_els_dcmd_iocb_timeout; qla2x00_init_timer(sp, ELS_DCMD_TIMEOUT); init_completion(&sp->u.iocb_cmd.u.els_logo.comp); + if (wait) + sp->flags = SRB_WAKEUP_ON_COMP; sp->done = qla2x00_els_dcmd_sp_done; sp->free = qla2x00_els_dcmd_sp_free; @@ -2637,9 +2639,14 @@ qla24xx_els_dcmd_iocb(scsi_qla_host_t *vha, int els_opcode, sp->name, sp->handle, fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa); - wait_for_completion(&elsio->u.els_logo.comp); + if (wait) { + wait_for_completion(&elsio->u.els_logo.comp); + } else { + goto done; + } sp->free(sp); +done: return rval; } diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 68c14143e50e..0f2bc4cd562f 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -932,7 +932,7 @@ qlt_send_first_logo(struct scsi_qla_host *vha, qlt_port_logo_t *logo) mutex_unlock(&vha->vha_tgt.tgt_mutex); - res = qla24xx_els_dcmd_iocb(vha, ELS_DCMD_LOGO, logo->id); + res = qla24xx_els_dcmd_iocb(vha, ELS_DCMD_LOGO, logo->id, true); mutex_lock(&vha->vha_tgt.tgt_mutex); list_del(&logo->list); From patchwork Wed Nov 20 22:27:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Bolshakov X-Patchwork-Id: 11254953 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9CD1514ED for ; Wed, 20 Nov 2019 22:27:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7C97B20857 for ; Wed, 20 Nov 2019 22:27:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=yadro.com header.i=@yadro.com header.b="ldmS6EvB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726725AbfKTW1o (ORCPT ); Wed, 20 Nov 2019 17:27:44 -0500 Received: from mta-02.yadro.com ([89.207.88.252]:51276 "EHLO mta-01.yadro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726698AbfKTW1n (ORCPT ); Wed, 20 Nov 2019 17:27:43 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 26E7A43E03; Wed, 20 Nov 2019 22:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1574288861; x=1576103262; bh=hRumHpSG5+clEN/Z+HJCUlpkwIoz6mPtowh upPpAb4s=; b=ldmS6EvBtVHhBdiV5COHN+bBdOfKgXF/BeMjjolo3LqFe4LBwmn F1jZsg//h2fZhzeowoIAfeFos2wU0Ti4JjgeYz3tIOeioph7CNj5FuxeXjvftFgh wxIu9X0XGFRkTvM1f+QfQpgrE7v7bXU/RgrcOEKjhvfQmqS2oEPChdoM= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EVRsVwlOmfqa; Thu, 21 Nov 2019 01:27:41 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id A2FB643E04; Thu, 21 Nov 2019 01:27:38 +0300 (MSK) Received: from localhost (172.17.128.60) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 21 Nov 2019 01:27:38 +0300 From: Roman Bolshakov To: , CC: , Roman Bolshakov , Quinn Tran , Himanshu Madhani Subject: [PATCH v2 14/15] scsi: qla2xxx: Add debug dump of LOGO payload and ELS IOCB Date: Thu, 21 Nov 2019 01:27:22 +0300 Message-ID: <20191120222723.27779-15-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191120222723.27779-1-r.bolshakov@yadro.com> References: <20191120222723.27779-1-r.bolshakov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [172.17.128.60] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org The change adds a way to debug LOGO ELS, likewise PLOGI. Cc: Quinn Tran Cc: Himanshu Madhani Signed-off-by: Roman Bolshakov Acked-by: Himanshu Madhani Acked-by: Quinn Tran Signed-off-by: Roman Bolshakov --- drivers/scsi/qla2xxx/qla_iocb.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 12b37b711ae8..cd2e0f89e9b5 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -2627,6 +2627,10 @@ qla24xx_els_dcmd_iocb(scsi_qla_host_t *vha, int els_opcode, memcpy(elsio->u.els_logo.els_logo_pyld, &logo_pyld, sizeof(struct els_logo_payload)); + ql_dbg(ql_dbg_disc + ql_dbg_buffer, vha, 0x3075, "LOGO buffer:"); + ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x010a, + elsio->u.els_logo.els_logo_pyld, + sizeof(*elsio->u.els_logo.els_logo_pyld)); rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) { @@ -2704,6 +2708,11 @@ qla24xx_els_logo_iocb(srb_t *sp, struct els_entry_24xx *els_iocb) els_iocb->rx_byte_count = 0; els_iocb->rx_address = 0; els_iocb->rx_len = 0; + ql_dbg(ql_dbg_io + ql_dbg_buffer, vha, 0x3076, + "LOGO ELS IOCB:"); + ql_dump_buffer(ql_log_info, vha, 0x010b, + els_iocb, + sizeof(*els_iocb)); } sp->vha->qla_stats.control_requests++; From patchwork Wed Nov 20 22:27:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Bolshakov X-Patchwork-Id: 11254959 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7C90814ED for ; Wed, 20 Nov 2019 22:27:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5D15720857 for ; Wed, 20 Nov 2019 22:27:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=yadro.com header.i=@yadro.com header.b="k5y/XGk2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726735AbfKTW1p (ORCPT ); Wed, 20 Nov 2019 17:27:45 -0500 Received: from mta-02.yadro.com ([89.207.88.252]:51262 "EHLO mta-01.yadro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726574AbfKTW1p (ORCPT ); Wed, 20 Nov 2019 17:27:45 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 4C80943D79; Wed, 20 Nov 2019 22:27:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1574288862; x=1576103263; bh=eaUqDliENYFOZMUWYYPEKBMKd5OpCyqmsnp TQQ+LTpQ=; b=k5y/XGk2uE+B5dMVKZRAMzISIp8T2WQX7LgVFnuV6FZZczVsuRq PgZKjenREYpTO6ac1RyPnFUVvwIWgywHnVJPDaH/rKpiWuq1wEU4DMV8gE90j9YL dFUvmWJImc6mx5yVoY5KqzaOblb35KaiWU2uPfHI8N85wWgylC/I1vro= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aggEqA3O9LeL; Thu, 21 Nov 2019 01:27:42 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 313DA42F12; Thu, 21 Nov 2019 01:27:39 +0300 (MSK) Received: from localhost (172.17.128.60) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 21 Nov 2019 01:27:38 +0300 From: Roman Bolshakov To: , CC: , Roman Bolshakov , Quinn Tran , Himanshu Madhani Subject: [PATCH v2 15/15] scsi: qla2xxx: Handle ABTS according to FCP spec for logged out ports Date: Thu, 21 Nov 2019 01:27:23 +0300 Message-ID: <20191120222723.27779-16-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191120222723.27779-1-r.bolshakov@yadro.com> References: <20191120222723.27779-1-r.bolshakov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [172.17.128.60] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org Fibre Channel Protocol for SCSI, Fourth Version (FCP-4) 12.3.3, "Target FCP_Port response to Exchange termination" states: When an ABTS-LS is received at the target FCP_Port, it shall abort the designated Exchange and return one of the following responses: a) the target FCP_Port shall discard the ABTS-LS and transmit a LOGO ELS if the Nx_Port issuing the ABTS-LS is not currently logged in (i.e., no N_Port Login exists); However, current implementation tries to send a real BA_RJT in response to ABTS from logged-out ports. The oparation fails because N_Port handle was freed shortly after logout and ABTS Recieved IOCB contains 0xFFFF N_Port handle. Existing implementation doesn't send LOGO at all. The correct way to discard ABTS-LS frame when N_Port handle wasn't found is to set Terminate ABTS Exchange bit in control flags of ABTS Response IOCB. LOGO is sent after that. To avoid a deadlock in qla2x00_start_sp(), hardware_lock should be released. The unlocking should be safe because ABTS Recieved IOCB is not needed after s_id is saved on the stack and qlt_24xx_send_abts_resp() is invoked. Fixes: 2d70c103fd2a ("[SCSI] qla2xxx: Add LLD target-mode infrastructure for >= 24xx series") Cc: Quinn Tran Cc: Himanshu Madhani Signed-off-by: Roman Bolshakov --- drivers/scsi/qla2xxx/qla_target.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 0f2bc4cd562f..331e7adf4b15 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -1800,7 +1800,7 @@ static int qlt_build_abts_resp_iocb(struct qla_tgt_mgmt_cmd *mcmd) */ static void qlt_24xx_send_abts_resp(struct qla_qpair *qpair, struct abts_recv_from_24xx *abts, uint32_t status, - bool ids_reversed) + bool ids_reversed, bool term_exchange) { struct scsi_qla_host *vha = qpair->vha; struct qla_hw_data *ha = vha->hw; @@ -1825,6 +1825,10 @@ static void qlt_24xx_send_abts_resp(struct qla_qpair *qpair, resp->handle = QLA_TGT_SKIP_HANDLE; resp->entry_count = 1; resp->nport_handle = abts->nport_handle; + if (term_exchange) + resp->control_flags = cpu_to_le16(ABTS_CONTR_FLG_TERM_EXCHG); + else + resp->control_flags = 0; resp->vp_index = vha->vp_idx; resp->sof_type = abts->sof_type; resp->exchange_address = abts->exchange_address; @@ -1940,7 +1944,7 @@ static void qlt_24xx_retry_term_exchange(struct scsi_qla_host *vha, qlt_build_abts_resp_iocb(mcmd); else qlt_24xx_send_abts_resp(qpair, - (struct abts_recv_from_24xx *)entry, FCP_TMF_CMPL, true); + (struct abts_recv_from_24xx *)entry, FCP_TMF_CMPL, true, false); } @@ -2134,7 +2138,7 @@ static void qlt_24xx_handle_abts(struct scsi_qla_host *vha, "qla_target(%d): ABTS: Abort Sequence not " "supported\n", vha->vp_idx); qlt_24xx_send_abts_resp(ha->base_qpair, abts, FCP_TMF_REJECTED, - false); + false, false); return; } @@ -2143,7 +2147,7 @@ static void qlt_24xx_handle_abts(struct scsi_qla_host *vha, "qla_target(%d): ABTS: Unknown Exchange " "Address received\n", vha->vp_idx); qlt_24xx_send_abts_resp(ha->base_qpair, abts, FCP_TMF_REJECTED, - false); + false, false); return; } @@ -2163,8 +2167,16 @@ static void qlt_24xx_handle_abts(struct scsi_qla_host *vha, vha->vp_idx); spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); + /* + * According to FCP-4 12.3.3, + * ABTS-LS frame shall be discarded + */ qlt_24xx_send_abts_resp(ha->base_qpair, abts, FCP_TMF_REJECTED, - false); + false, true); + spin_unlock_irqrestore(&ha->hardware_lock, flags); + /* and LOGO ELS transmitted */ + qla24xx_els_dcmd_iocb(vha, ELS_DCMD_LOGO, be_to_port_id(s_id), false); + spin_lock_irqsave(&ha->hardware_lock, flags); return; } spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); @@ -2172,7 +2184,7 @@ static void qlt_24xx_handle_abts(struct scsi_qla_host *vha, if (sess->deleted) { qlt_24xx_send_abts_resp(ha->base_qpair, abts, FCP_TMF_REJECTED, - false); + false, false); return; } @@ -2182,7 +2194,7 @@ static void qlt_24xx_handle_abts(struct scsi_qla_host *vha, "qla_target(%d): __qlt_24xx_handle_abts() failed: %d\n", vha->vp_idx, rc); qlt_24xx_send_abts_resp(ha->base_qpair, abts, FCP_TMF_REJECTED, - false); + false, false); return; } } @@ -6213,7 +6225,7 @@ static void qlt_abort_work(struct qla_tgt *tgt, out_term: spin_lock_irqsave(&ha->hardware_lock, flags); qlt_24xx_send_abts_resp(ha->base_qpair, &prm->abts, - FCP_TMF_REJECTED, false); + FCP_TMF_REJECTED, false, false); spin_unlock_irqrestore(&ha->hardware_lock, flags); }