From patchwork Wed Dec 20 06:56:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10125121 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 142C86019C for ; Wed, 20 Dec 2017 06:58:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C42529649 for ; Wed, 20 Dec 2017 06:58:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 011B42964F; Wed, 20 Dec 2017 06:58:10 +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,DKIM_SIGNED, DKIM_VALID,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 7FA7829649 for ; Wed, 20 Dec 2017 06:58:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932548AbdLTG6I (ORCPT ); Wed, 20 Dec 2017 01:58:08 -0500 Received: from mail-sn1nam01on0057.outbound.protection.outlook.com ([104.47.32.57]:8134 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932474AbdLTG5o (ORCPT ); Wed, 20 Dec 2017 01:57:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=wB3+UXIXTdp/7MkpodtLzt9+R7/5PYLIIX5HEU+dDCc=; b=WzTp1JEzap9umgjl8w5W705zWDmxmJRDFzFzFMku7olcZQ8Z2sVENO1TOweYs+kOLonOkUd+byBV48NRJXUf+dFkdvecwQULZ1JCiLBSB8RD47bWg0pxxKQF/BZR1PhqqfKiU8ak5V+d94O4QiK0NWlHm+VjWg2lFwhKHyePvH4= Received: from CO2PR07CA0067.namprd07.prod.outlook.com (2603:10b6:100::35) by SN4PR0701MB3821.namprd07.prod.outlook.com (2603:10b6:803:4e::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.323.15; Wed, 20 Dec 2017 06:57:27 +0000 Received: from BN1AFFO11FD043.protection.gbl (2a01:111:f400:7c10::176) by CO2PR07CA0067.outlook.office365.com (2603:10b6:100::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.323.15 via Frontend Transport; Wed, 20 Dec 2017 06:57:26 +0000 Authentication-Results: spf=permerror (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=cavium.com; Received-SPF: PermError (protection.outlook.com: domain of cavium.com used an invalid SPF mechanism) Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by BN1AFFO11FD043.mail.protection.outlook.com (10.58.52.190) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.302.6 via Frontend Transport; Wed, 20 Dec 2017 06:57:13 +0000 Received: from dut1171.mv.qlogic.com (172.29.51.171) by CAEXCH02.caveonetworks.com (10.17.4.29) with Microsoft SMTP Server id 14.2.347.0; Tue, 19 Dec 2017 22:56:51 -0800 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id vBK6uq0r021686; Tue, 19 Dec 2017 22:56:52 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id vBK6uqB0021685; Tue, 19 Dec 2017 22:56:52 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH 35/43] qla2xxx: Add retry limit for fabric scan logic Date: Tue, 19 Dec 2017 22:56:36 -0800 Message-ID: <20171220065644.21511-36-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171220065644.21511-1-himanshu.madhani@cavium.com> References: <20171220065644.21511-1-himanshu.madhani@cavium.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:50.232.66.26; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(346002)(396003)(39860400002)(376002)(39380400002)(2980300002)(448002)(189003)(199004)(72206003)(16586007)(81166006)(86362001)(54906003)(81156014)(8676002)(51416003)(106466001)(48376002)(76176011)(1076002)(69596002)(478600001)(85326001)(50466002)(42186006)(36756003)(110136005)(87636003)(316002)(4326008)(50226002)(80596001)(8936002)(356003)(47776003)(305945005)(6666003)(2950100002)(5660300001)(2906002)(59450400001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN4PR0701MB3821; H:CAEXCH02.caveonetworks.com; FPR:; SPF:PermError; PTR:50-232-66-26-static.hfc.comcastbusiness.net; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD043; 1:h7ld4rS4LQJZC9ASBUKEbsN5MTRfgvrcS6AJ015uQZX4IgbNRUXnxXxMKzfDS2S9l7Zn1OutmXs7891uc2uKeDlnawWSFSnetDWtPk11JyO6yMhqyca4v6ShoH4ddRzP X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9b2b7324-087b-4690-fdea-08d54776e60e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:SN4PR0701MB3821; X-Micro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2E4+eUfPzI/fdbzq4NG4M6VZ1gh4a3uxHIss0ly4hScdGLSQMccrvXsJI3OF6HFxK1OpL13zIxx3Q+QOrpY4w1PW5ZtKsMHlaH5qWf8oPxuieWb/Su2tAxr1VKRsMM7JELRyEw/lkr0eEJmZ77UhomUuHz4Pto/6aFQkHB9VvC3Wt7NbQpxoHH/bwgHvWYbYbNY2Uwjbe2VBDyUqQIR9wA6FuV1D98tswOA6Ix8YKzjv7+6ZwtQlKYvfpNTbCcQQy/DzhlpHgyXUiW7ajVWOVJcyeyw1HzZY6wAYLNCeU5E9exgjnKOfygnEEjbmYu7GdglopwUan2vrwbUwN+CDOCZFjsOBwa1iQznMObvhf56yD/NqLl2onIqvUNxo5GXvKYWFZlO2fbw6KYJqS2lcRC+t8XH6OxDSvXzk70xHTpsRe6mTldTXUdFCRi7AZ7DzemCiWa1DV9P4JAWjuSgbvpNM3/6lVSjWGkqHDJCSsSR5vXFU3I3tncZ84y2fe9 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(3231023)(10201501046)(3002001)(93006095)(93001095)(6041268)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:SN4PR0701MB3821; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:SN4PR0701MB3821; X-Microsoft-Exchange-Diagnostics: 1; SN4PR0701MB3821; 4:4U7AvjycCiN4oB9GQViRtv2sA4kJBwZDLqWQPBAWVlBgZtPr32LtAw9PfXlLsYdGKVeBKXT4yqnomrz/k87hJbqFN0v0Qug+kJvYQP9EANOp6JqG8Qz7hrDQrbO+SEyCgNCu1GnhV5KvPZyCt02G2JLMkIj3YRx1iOpjMBvXceLUedWCLpSLmG8FDqx5oTZOyPEjSex7Fl41NVLprTZriVkPvLrsOFT9/LHAV36Kj57JQrZFFZNaa9U3ZrRnh/AULfHOK0auotrVKmZCoXPqtA== X-Forefront-PRVS: 0527DFA348 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN4PR0701MB3821; 23:9GWmC30hkF3uIPm9MQdUH+mOx26vsyJLwnk3+G9?= =?us-ascii?Q?OKzVplR1aajuDXCBISRnhUNRFWSYAAif8+603ltEUiByay3muLxDv/lNf73r?= =?us-ascii?Q?3UKtbhp+t5csC9hkHaxeahEOvxV+mEZm7m3r84l1Zelerc+VWsWH+PJLTlaw?= =?us-ascii?Q?PCsGKO0KyQvLYSsw2hylzbYimG2kZQcQ46wrBHZIvtKxVGW/InaT00ZDd8Y+?= =?us-ascii?Q?SM9Ts6x8QdUlFcWbWTbRY806slJNA8y9KICQY48TIbuKufceNBaBovwrB27k?= =?us-ascii?Q?C6ogo18DVVdToMTnFPXY42+bMEcVTfzvrH5sKhsN2e7Quu0koB07Dk6i3fUB?= =?us-ascii?Q?zbknLjMWfLPcYEQIxi6/3g0e7B6Cli6Qm7qvnqXuY0T09+9bYObsK603ofQ5?= =?us-ascii?Q?ocmQmJJkPscLRgjh7saZdD7JSHRTiZ1s4YMOpMOMDVu0Qb8TLDGEWHdozqPF?= =?us-ascii?Q?ZhoTF7x5ecMAuZFaQurXQQ/Euij26+fcBWgz1gApDl3uQvBOn/dIF4KlehUI?= =?us-ascii?Q?6iT1VuNrUywSav5qaYijs2PO6yJJztIHjtpHMfOwq+p4wC7bZRLtNyCdUgVe?= =?us-ascii?Q?hz3P2nCfdYXAPobptjuGyGW9WDX2HCW7bOqtK9Uty/OCRPM/rRKxuaH+5YY1?= =?us-ascii?Q?xlfq+48SMU0+tGLrkLOsNp/dEZKjHmpFdl6DljwWP2kHAOdSsLcsTRNg8rzQ?= =?us-ascii?Q?SSj8cRQTZSPXbFw6t3pxKgCTlLAPpM8q3d43DsQ3bzqO2HqYQFXF2v/jQlTr?= =?us-ascii?Q?g/uy1RerLIGjbKNoQUDA60CG+BN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OaaoddoIExgb9ESUOfkQa2yd1TkQmUTHuq+qGpb46NqQFtMdKeKECih4ktJDzuGun5HNyOyrTLY2p5WcvFWn/CQ+MEDdAJ2KutSgiinws23yhVojP/4h0do20S/0sCmpiWT0Yvq5E2/YYHSwjYT3KyVf57h81KBA0kgnkfC11bbfLB3d25Qswj SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2017 06:57:13.0816 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b2b7324-087b-4690-fdea-08d54776e60e X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=711e4ccf-2e9b-4bcf-a551-4094005b6194; Ip=[50.232.66.26]; Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR0701MB3821 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Quinn Tran Switch scan is assumed to succeed most of the time. If the scan failed, then scan is limit 5 retries. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_def.h | 2 ++ drivers/scsi/qla2xxx/qla_gs.c | 33 ++++++++++++++++++++------------- drivers/scsi/qla2xxx/qla_isr.c | 1 + 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index f061483475ce..3811ccd1c60b 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -3036,6 +3036,8 @@ struct fab_scan_rp { struct fab_scan { struct fab_scan_rp *l; u32 size; + u16 scan_retry; +#define MAX_SCAN_RETRIES 5 enum scan_flags_t scan_flags; struct delayed_work scan_work; }; diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c index 903f924f6273..8256b65e9e7a 100644 --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -3924,13 +3924,17 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp) rc = sp->rc; if (rc) { - ql_dbg(ql_dbg_disc, vha, 0xffff, - "GPNFT failed. FC4type %x. Rescanning.\n", - fc4type); - set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); - set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); + vha->scan.scan_retry++; + if (vha->scan.scan_retry < MAX_SCAN_RETRIES) { + set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); + set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); + } else { + ql_dbg(ql_dbg_disc, vha, 0xffff, + "Fabric scan failed on all retries.\n"); + } goto out; } + vha->scan.scan_retry = 0; list_for_each_entry(fcport, &vha->vp_fcports, list) fcport->scan_state = QLA_FCPORT_SCAN; @@ -4013,7 +4017,6 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp) out: qla24xx_sp_unmap(vha, sp); - spin_lock_irqsave(&vha->work_lock, flags); vha->scan.scan_flags &= ~SF_SCANNING; spin_unlock_irqrestore(&vha->work_lock, flags); @@ -4041,16 +4044,20 @@ static void qla2x00_async_gpnft_gnnft_sp_done(void *s, int res) if (res) { unsigned long flags; - ql_dbg(ql_dbg_disc, sp->vha, 0xffff, - "Async done-%s timed out.\n", - sp->name); sp->free(sp); spin_lock_irqsave(&vha->work_lock, flags); vha->scan.scan_flags &= ~SF_SCANNING; - spin_unlock_irqrestore(&vha->work_lock, flags); - set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); - set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); - qla2xxx_wake_dpc(vha); + vha->scan.scan_retry++; + + if (vha->scan.scan_retry < MAX_SCAN_RETRIES) { + set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); + set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); + qla2xxx_wake_dpc(vha); + } else { + ql_dbg(ql_dbg_disc, sp->vha, 0xffff, + "Async done-%s rescan failed on all retries\n", + sp->name); + } return; } diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index f02c98b3e8a7..6974657dd8c6 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -1059,6 +1059,7 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb) * Mark all devices as missing so we will login again. */ atomic_set(&vha->loop_state, LOOP_UP); + vha->scan.scan_retry = 0; set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags);