From patchwork Thu Dec 28 20:33:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10135897 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 EF63A60318 for ; Thu, 28 Dec 2017 20:34:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1AAC2B3EB for ; Thu, 28 Dec 2017 20:34:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5AD02B88E; Thu, 28 Dec 2017 20:34:47 +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 3DF5C2B3EB for ; Thu, 28 Dec 2017 20:34:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755351AbdL1Uep (ORCPT ); Thu, 28 Dec 2017 15:34:45 -0500 Received: from mail-by2nam01on0044.outbound.protection.outlook.com ([104.47.34.44]:64224 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754055AbdL1Ueb (ORCPT ); Thu, 28 Dec 2017 15:34:31 -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=5EI5zB5f2703T4WRwjIxxMbxWuMbTqMI12dZLzaAKBA=; b=VP5CrPAXx0WrWywLfuGc9bnJeMM6uLv0upigQeOd9EERqS4R7gA4dm5Ph6yQb9tVxZXFltRuVQK8dwnxDQs/Z9VKXUjO5kyeONLzMbVQ13BgwHxn8l2druvLIKPhnJamElXMChkbd9IGUznEf33v0boYsfNsJ5jfGdbKKJIC/Qg= Received: from BY2PR07CA0097.namprd07.prod.outlook.com (10.166.107.50) by SN4PR0701MB3824.namprd07.prod.outlook.com (10.167.150.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.323.15; Thu, 28 Dec 2017 20:34:29 +0000 Received: from BN1BFFO11FD044.protection.gbl (2a01:111:f400:7c10::1:156) by BY2PR07CA0097.outlook.office365.com (2a01:111:e400:7bff::50) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.366.8 via Frontend Transport; Thu, 28 Dec 2017 20:34:29 +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 BN1BFFO11FD044.mail.protection.outlook.com (10.58.144.107) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.345.12 via Frontend Transport; Thu, 28 Dec 2017 20:34:08 +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; Thu, 28 Dec 2017 12:33: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 vBSKXpBM002950; Thu, 28 Dec 2017 12:33:51 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id vBSKXpG6002949; Thu, 28 Dec 2017 12:33:51 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 31/37] qla2xxx: Add retry limit for fabric scan logic Date: Thu, 28 Dec 2017 12:33:39 -0800 Message-ID: <20171228203345.2702-32-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171228203345.2702-1-himanshu.madhani@cavium.com> References: <20171228203345.2702-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)(396003)(346002)(376002)(39850400004)(39380400002)(2980300002)(448002)(189003)(199004)(54906003)(305945005)(6666003)(47776003)(356003)(5660300001)(76176011)(50226002)(1076002)(69596002)(16586007)(87636003)(51416003)(478600001)(42186006)(80596001)(4326008)(2950100002)(72206003)(110136005)(8936002)(2906002)(8676002)(106466001)(36756003)(59450400001)(50466002)(48376002)(85326001)(86362001)(81166006)(81156014)(316002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN4PR0701MB3824; 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; BN1BFFO11FD044; 1:VT+sfKlwznaQRfJnTTKl7Ykrba/My+BZ31tOd8sh1RZNslpXlj9pv73TLp9zJr/DyURKgpB8yDwSgyPGEL4vV1Cu8ZS1uoO7h69fP/ycTL2gi53UaEXHq5kRGI3Y6IDB X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c7150410-acb8-4037-00de-08d54e3258e0 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:SN4PR0701MB3824; X-Microsoft-Exchange-Diagnostics: 1; SN4PR0701MB3824; 3:ci43X8vVyucQBlpdmroJuQTa0Bty9siKaPEHqJoPrKeIMIjvE7VU2dmTnyOtY/zTjVz43XsenuJFtopZsc68vhruzqX1mjMFAcNYD7HuBx00UpknBBNbuR4aGC1ijgd7Uiu5gskaN/o+EIpxEbscxwj0vKP4gcYMcQrQmCjI4XHll8QjfHtNWoLbYo6mG+zGU8HX+mP9pq7FinLq0GRrJ6PEls3s+w7Tnz3n/OMisFlpjSQxmC5fDDKAOIFhkyzWV88dS2NmD+Ae3iM/GPT1I/iGznC7+T5EU3qyuU8f7vuzPgfVEm84ABLk2fcHVvijgR5gVTLajAyFJHLO1/wl+w==; 25:77kEd8hzQWu6LlL1xOZ7wlIbtjYTraZYg4B2pUlZ4sr8SUIh/e7RQBKtLyigN+sz56njvKER1g5WBDQmO3u7nzBW8++H7tYzxltpVPG2RWs73RvzYB/kpEYBg1xnlPKBZvHzNb4THGMwwUMk8QV2Pg8b9C1CnwNBDNMmXTbkY9lkZa4uu1Y6zGUe98oYu4qo8AgCqfAlG+VyBp0SOCe65/rKLGQ8fZeexUvV2bvpuxra2OCzJBr8/lM5rbfa151bq3GDbju8uFbPmdiT/aOkSb150Oj1SnVJFbT/at0eMtXRX3dGmcs7hgyfKt8agTEOmVqMv3mE7lXif0Z4h3NQZA==; 31:cC9qKjNzlvKlL6eAgI+cac0qXGhN9DOkRmY3jQGQ6BTOPYcqVDB98jI5AYlYnal8vDT6FsVSD0uNzhAkLE3Y65E5MT6/+gUOoqtIyitKBHoPDEVzJ+768RZHGY1H7BJQuFaP389VY26ZQMWMhAIRsGpAWot5pmyvqy5ZlRkQPD2cMpZKFhcvKukjVDCaX3SrYTbZtC/uCjG8A6K/1yPfks8P+cCBnQYvnejqI+6SJQY= X-MS-TrafficTypeDiagnostic: SN4PR0701MB3824: X-Microsoft-Exchange-Diagnostics: 1; SN4PR0701MB3824; 20:5S6H6N9FUS1J5n8dvotWnjuj3fTgV3ISB+5Q1+pk+uc+d3oaFir9Iet6f4QiqEH7X35fsi7swixDWCkhmUcr1WdYYIpPLAB8VIegY4/M8N7NoK31ptIZ5eeJEkShIAKTSaJiFK3ncCxZAtAi8VTrtJyDapR9wBDqE+qoWHPuFXReIBQWaCKLAhU4ELt4Z/xxkcEgcrjCknkmGVu6EFg9QoKGSr/84S0aOPiyDTYgx2udyrCVPZdSQ2AqgDGhHqEfHyHZxIPe+jSmBoyafBA3niUyyZ0c7vhG4rJmKzU6XUIGxy7H6DP/KM+xu218sJ4Vtt1rFsJYD1RX+vReIlJOlrDOk/nqm8PxSr0sVeOe8UUzKR24VcbLxxuNKVjnHzJxfMWW43pfjeHa3FPfblicvbIK9j5U78GLHvsPbWIyB8SKL3ngRfwDKgxGogdWbxfVUe3Bt6GMT9nsQNtZkbMaqOVLAdxHyz3jfjQGV2wOUtrnk2FdqH1SaagY5R1bjxZW; 4:D0OGlygGJOd/xAUxU1fvcTMxaOLZvr5jK5cQjAY2gMvVP0Yos7jDNRcnyiFDTF1bdb8rjezawf2cF8OkQNST0PUq+5M5KVkms84ug3pBYMspDE+LHYCXoa4Wv0AOWJiLykIm2IcE8fGVqexH8Iw8rzApweddUkop2OQgn1pg2QDsoDqGNFCuSGcwMF4PbU5egfxEAkPNSgHfIX0KRo9Xbz7K3mH7hSqmst/pm23RB4j45OaTpxshkq/GffdaNfRw2jjCxDQBDxSBcWfi+UYT3w== 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)(93006095)(93001095)(3231023)(944501075)(10201501046)(3002001)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123560045)(20161123562045)(6072148)(201708071742011); SRVR:SN4PR0701MB3824; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:SN4PR0701MB3824; X-Forefront-PRVS: 05352A48BE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN4PR0701MB3824; 23:NgSR1hzYb/iy+hEcKVT0JZUTtvAgon+dYiyiSRW?= =?us-ascii?Q?0MEbHh7CBdZ8EZ7H4xWpgH63MVGWEM1JR/J601u07gSKYI2cGpUteUUyhA5v?= =?us-ascii?Q?BnCZWl8k2i9bqtbXYVeqOAD38I84mDjd/C/ZHuymRNhGKiKSa5ejrKONQTED?= =?us-ascii?Q?gDnYyVcP0d0w5xp8HJ0E0bYja4WFeL+LVJ0r95d3Jekgaz046MqILke6doY/?= =?us-ascii?Q?bYBQdjWNC6i0KB8mRbYohXQcJIOKibwAf3hTFKIpAlg7BiZ62eDwo4BMn/mL?= =?us-ascii?Q?W7oc5EHMKCuPgt858JO9WHtDS+X+Dij+FS8Ck2mie2jcjzw2BUsKlcJJhVyB?= =?us-ascii?Q?XmIELHRfJla6w+L6zmBUfiqd3smRSnObAsYajmDfXQ32LEAXQJz8TJ++GQkn?= =?us-ascii?Q?fOCnWcbClhEHnY/+Ky5LH539KoJ7/TkYLtMWeu3WhJcdw7OYwRwqOFaG2VAb?= =?us-ascii?Q?PaOMsjpxUFRCVP4M7k3nReWXpyenI+W9LJUbTNoJuLVA8lcL47D38x1zeGms?= =?us-ascii?Q?8f5z7Aqo9Xe9xywEpsyVw4jwprRHjaYHayz6Vqv/wNx0iHhEy5Fa7RW04gSn?= =?us-ascii?Q?/X9XSpvdWkfcS9VJCgn6znAf9VZCR/Kd1e2PJ5O/W9WZjPZebODkvXEg8f/A?= =?us-ascii?Q?bqlPmu+YJC6ZnSObGrIDw/r4rk8XzyQ2zoRn7ywgwVv8zK22BW46oHYhC//A?= =?us-ascii?Q?IQt5ShNMFVXp+YntP1qct7e+Ze4RDSg1Ds7qssozLtirIgRoKLlqP+IH3xVB?= =?us-ascii?Q?aJpsu/SQ6HURLOzBM/VOzdpgvJnqUloK3RlRd9IVS4zXAMHXnNfRrcpyOBFF?= =?us-ascii?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2+oOelvkhuBqldfxERgBgTvcltcLoeM5bd0HHB2FfZA5iMv/3pvyHfrRweGekJ8FhRWReDzpQLntSmq+7uoXOPuSOJyK210dM23O1YwbeZdJwD0p6Szb9VzSMdHvOqLM0cY0B3AJRTa709V8 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2017 20:34:08.5767 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c7150410-acb8-4037-00de-08d54e3258e0 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: SN4PR0701MB3824 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 | 32 ++++++++++++++++++++------------ drivers/scsi/qla2xxx/qla_isr.c | 1 + 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 0d20f5f8d7ab..99d2afa520c2 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -2986,6 +2986,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 963ebcb7cf2c..8e09f6f16643 100644 --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -3875,13 +3875,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; @@ -3964,7 +3968,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); @@ -3992,16 +3995,21 @@ 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; + vha->scan.scan_retry++; 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); + + 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 67434b9ee7de..a37a2a474a50 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);