From patchwork Tue Sep 11 17:18:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10596009 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B33D914E5 for ; Tue, 11 Sep 2018 17:18:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96CCA29B1F for ; Tue, 11 Sep 2018 17:18:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8AB7329B26; Tue, 11 Sep 2018 17:18:52 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,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 1343D29B1F for ; Tue, 11 Sep 2018 17:18:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728138AbeIKWTI (ORCPT ); Tue, 11 Sep 2018 18:19:08 -0400 Received: from mail-eopbgr690065.outbound.protection.outlook.com ([40.107.69.65]:42688 "EHLO NAM04-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728010AbeIKWTI (ORCPT ); Tue, 11 Sep 2018 18:19:08 -0400 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:X-MS-Exchange-SenderADCheck; bh=HQAUwp1yClEIe509egb4zvjTaVi4cqYIAyoz8x+szQs=; b=UT7HIkOQdoPb7pnoDb6y/CnBEFZCIZHiyR1bs1B8YyqqepJz7Zc6KRtFFzHzFGMZ6pTBiAt3dGnpp5VR3rCYyUOgwxK5ROWuVuBso9GwV3d83dE4BYnX3AgMR2uplBCkyKDQk7B9QUmm9ZHr15phR2t2Sru2+Ah8CEmHMQd03B4= Received: from DM6PR07CA0007.namprd07.prod.outlook.com (2603:10b6:5:94::20) by CY1PR07MB1445.namprd07.prod.outlook.com (2a01:111:e400:50eb::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1101.15; Tue, 11 Sep 2018 17:18:48 +0000 Received: from CO1NAM05FT061.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::205) by DM6PR07CA0007.outlook.office365.com (2603:10b6:5:94::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1122.17 via Frontend Transport; Tue, 11 Sep 2018 17:18:48 +0000 Authentication-Results: spf=pass (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=bestguesspass action=none header.from=cavium.com; Received-SPF: Pass (protection.outlook.com: domain of cavium.com designates 50.232.66.26 as permitted sender) receiver=protection.outlook.com; client-ip=50.232.66.26; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by CO1NAM05FT061.mail.protection.outlook.com (10.152.96.179) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.1164.5 via Frontend Transport; Tue, 11 Sep 2018 17:18:48 +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, 11 Sep 2018 10:18:31 -0700 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 w8BHIUEg029111; Tue, 11 Sep 2018 10:18:30 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id w8BHIU82029110; Tue, 11 Sep 2018 10:18:30 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 15/16] qla2xxx: Fix double increment of switch scan retry count Date: Tue, 11 Sep 2018 10:18:26 -0700 Message-ID: <20180911171827.29016-16-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180911171827.29016-1-himanshu.madhani@cavium.com> References: <20180911171827.29016-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)(39860400002)(136003)(346002)(376002)(2980300002)(438002)(199004)(189003)(2616005)(476003)(486006)(110136005)(80596001)(42186006)(126002)(186003)(54906003)(81156014)(81166006)(106002)(8676002)(69596002)(316002)(50466002)(16586007)(48376002)(26005)(8936002)(11346002)(50226002)(44832011)(76176011)(51416003)(446003)(47776003)(2906002)(4326008)(1076002)(5660300001)(36756003)(87636003)(106466001)(356003)(14444005)(6666003)(478600001)(336012)(305945005)(72206003)(86362001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR07MB1445;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Pass;LANG:en;PTR:50-232-66-26-static.hfc.comcastbusiness.net;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;CO1NAM05FT061;1:eMJaelWBlHZEHrGZARmxq7v6Xnhk9RER+IdLtEQxrKT7l9sOe09nDoruZRKGFXelFz0MKBh33loBEsDXIztKBxWTcWuV3ZRMjwwswkQq8EpZhHcHcR8IX25RaVXGBDXd X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8e0c1b83-444d-44e9-e7be-08d6180aa304 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:CY1PR07MB1445; X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB1445;3:jsLh2vNM/O/uljHOlE7VMWAAe7YCDCVwuwiGNbBkT+9JA5LovoO9P/j2+j5+ACqkcEqVoxEtEwPGnRBRZaY2OWmDqzOXJZK+rW0P+rJBch0z9vL5n8WfJDE6johCIEjqddDDwj6wtl+KuXG+vDFKKtQwcK9PJ+eFtgEEJ96GYmVcYSpZmhs4IwIV4fHwEHsWGNv4tnjymtHN2XICtUOlJxqJ5JrAKzksFPTGhhVqwiW/8GVqCoMQP+Gv3ovXir7j5bIkRQoJJ5GRzFU7VfrcrhsjCqsLs91lvhKVvMUfF+ZixRrXVKUE1gsUHc1+WuSrQtiJvDl224afU3vqOuSMRO/rpQO28G8JYkUa4IRJfCw=;25:rQUas3qD77t03wsogESg3jtst42dXD5dLt3tef/JENQZsAv+lSDZHULz0YQr+PxyHA/34uI0ut6iGYvqxJkuIxlQPLF2l//L88mRUJq6KPZ6IrhAaMJVPNUMAOZzm40VmXADMHVjAIlVpSzBWgjUeC0QzrKtoI9m3Ycsg2FO6SWeyVQusDoP9Fq2w/JS5q2tgo8w8tM7ij0L3REpxlnCJPkCcxd8g0Zi31Wo3uOwETUtpwwGsrKFs0Hcg8ehv86Cgc/UNgbHBZffCg3zvtFMhFWJ6weLbZHD9bgCfKsMwILJVvR0l8wDEusaUhvs+MtRT2elh2wJVhfao+R5Jg/b3A== X-MS-TrafficTypeDiagnostic: CY1PR07MB1445: X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB1445;31:N702sbsd8Mb5nXRuUCdAPu09CwBVzT4GKuy/kOnyi4eSBzG0ftZnp5YA9aFzh/nIeflVkCCRe7L2Recn33o/opIIjJEymi57uoNUmx7cneMgRg4BwbRl9taRAoPlWxCVeW441K+qKOwN/0jvqDRgF3Qna416vvc4QjqfVGZnRqXsTTKha+5EcMEUEBdDV2KAhs2rfl19dXkgnQP3NvCEBvH6XiNg8vlNOQ5vvZunfjs=;20:/gGLQCRNdYifHvMIKNTezswKvUfmeZDJ7sW3tB6ys1bqM2qCmHnE3BRmxHgHkGvDbJTIrrCZl4U2m6cMHYsYBczbYGFf2STgaAh87vhz/RGPoqcZkmOpoaY/p1R+rEhXk2S9qNvkh35llQUnc6Obd8Aa+S5o5WqtbaX2pIlSLC7iblvAWgGsCuohqyEWYxuRpVODZ+fElrEfUtI6J4fWSUx2+2LiEu26f0iiWZxDWJzT5ScNEB+hdYa0AAqZ+ih/A9H9b5MSLasz36NTailGdUqzq2HwJBueurG/pQx1/ur2IowgbQVCRzkv/e6TDJqd6uvYqqbtbwbevHRFhRAx69VsksTGJG7UsPZeLZ7Zo34xrUW2hvEWbfqIL0vs3yoyl9zrTRM+RJqJI8X5CTMjs0jZ+IkAt1aK5YZlCtSgxnyT+5etncW+nrK135jpm0apGyvN7dleFKOy9NVM3b1lRW4gmEQEqmXYNIP97MT9QFgwXqR98m5vQaxBDv/FRFp/ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(163750095850); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231311)(944501410)(52105095)(93006095)(93004095)(149027)(150027)(6041310)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(201708071742011)(7699050);SRVR:CY1PR07MB1445;BCL:0;PCL:0;RULEID:;SRVR:CY1PR07MB1445; X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB1445;4:iMgCjdSLnkXAcsV33ycvij6KfbblrZYmQlzY7IyXXNoQAis7D1Vwj7206hS8BJ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DvbFPttJG12Z6gDHigoYEW/KdfABRq/xYQRhCJtvKGAs5Pe4QqtQ0uNdFSWnM4bLLgknBMAYCP6C6kxpnEh5YDaNgAL5msamTiSw2GJfRIxU7Y1kDZrJtIafjQKPrSoS7jgX3doy7IDEX/WouwK1usr80MaoupNAij8MSt4iNGMnNEJN+LBru/GeDdN78PZHYoNA==;5:Zpz6TaYQLqv4Jbzw+Ri8j8iMOAuFWTbrPqUFbBdDmPHSl9gZLhSI4yYzRIcxbHak2V3O0KzeyAbutYwNyBy2RZOXH5317lO8Qku0WFgfWSjOpnspbqzyOeS96vwBsAER/yfYAET0578xSUeZI5N3+8BTpJIiQbPyWSPLT5BokJE=;7:HVA5WmKyyuFiS93DpcTHrltGMcG3j4HSb0JuutoThabeousLYKViG42UYgBG4dE3w7kpxPUMYI5tZNFo3GxS68fcypDR5nwYj12XDgYorfZllwTrU5HZPKmQ/OD3xPXo6Ict82/VGDdnm0n1BMUXDUYtfvbx+fnZ98vPQ59jbUwnNG8f24pKBV5zDX17KSPvU0SG5c63/uRSw2hQ8qF5/c6fqv+25QpAprfPhR22vDpvlxztHQu8Bqc/QdIvNf0m SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2018 17:18:48.0751 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8e0c1b83-444d-44e9-e7be-08d6180aa304 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: CY1PR07MB1445 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 This patch fixes issue when switch command fails, current code increments retry count twice. This results into less number of retries. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_gs.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c index 84e234c1f302..64ebd790b922 100644 --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -3800,7 +3800,7 @@ static int qla2x00_post_gnnft_gpnft_done_work(struct scsi_qla_host *vha, return qla2x00_post_work(vha, e); } -static int qla2x00_post_nvme_gpnft_done_work(struct scsi_qla_host *vha, +static int qla2x00_post_nvme_gpnft_work(struct scsi_qla_host *vha, srb_t *sp, int cmd) { struct qla_work_evt *e; @@ -3930,6 +3930,7 @@ static void qla2x00_async_gpnft_gnnft_sp_done(void *s, int res) "Async done-%s res %x FC4Type %x\n", sp->name, res, sp->gen2); + del_timer(&sp->u.iocb_cmd.timer); sp->rc = res; if (res) { unsigned long flags; @@ -3945,48 +3946,44 @@ static void qla2x00_async_gpnft_gnnft_sp_done(void *s, int res) if (rc) { /* Cleanup here to prevent memory leak */ qla24xx_sp_unmap(vha, 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); + spin_lock_irqsave(&vha->work_lock, flags); + vha->scan.scan_flags &= ~SF_SCANNING; + vha->scan.scan_retry++; + spin_unlock_irqrestore(&vha->work_lock, flags); - 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, vha, 0xffff, - "Async done-%s rescan failed on all retries.\n", - name); + 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, vha, 0xffff, + "Async done-%s rescan failed on all retries.\n", + name); + } } return; } - if (!res) - qla2x00_find_free_fcp_nvme_slot(vha, sp); + qla2x00_find_free_fcp_nvme_slot(vha, sp); if ((fc4_type == FC4_TYPE_FCP_SCSI) && vha->flags.nvme_enabled && cmd == GNN_FT_CMD) { - del_timer(&sp->u.iocb_cmd.timer); spin_lock_irqsave(&vha->work_lock, flags); vha->scan.scan_flags &= ~SF_SCANNING; spin_unlock_irqrestore(&vha->work_lock, flags); sp->rc = res; - rc = qla2x00_post_nvme_gpnft_done_work(vha, sp, QLA_EVT_GPNFT); + rc = qla2x00_post_nvme_gpnft_work(vha, sp, QLA_EVT_GPNFT); if (rc) { qla24xx_sp_unmap(vha, sp); set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); - return; } return; } if (cmd == GPN_FT_CMD) { - del_timer(&sp->u.iocb_cmd.timer); rc = qla2x00_post_gnnft_gpnft_done_work(vha, sp, QLA_EVT_GPNFT_DONE); } else {