From patchwork Thu Jun 7 05:19:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10451145 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 2F46160467 for ; Thu, 7 Jun 2018 05:19:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 201D529653 for ; Thu, 7 Jun 2018 05:19:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 14B262973D; Thu, 7 Jun 2018 05:19:46 +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 7A71F29653 for ; Thu, 7 Jun 2018 05:19:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752562AbeFGFTo (ORCPT ); Thu, 7 Jun 2018 01:19:44 -0400 Received: from mail-dm3nam03on0074.outbound.protection.outlook.com ([104.47.41.74]:4128 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751607AbeFGFTh (ORCPT ); Thu, 7 Jun 2018 01:19:37 -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=YbNUKzXuYSw2HEuhDn66CQtc5SUUEffLCEiEi3Dz/zE=; b=GYPBAmqgVooWOOLH0FOUJB6h3BA0fltsrl7+XSDl7EYr231CepV0VVe3POwfWH7T/cqUadS3IqUh2QZHwLxFSe/1OflfPF3tinXvTbpX2rWj/VGF/ztLZlyEHk8HuDApwtp7vwmM3E922bSg3c5WFpDHhQz+Ii+QMvXqNB4e/GY= Received: from DM5PR07CA0105.namprd07.prod.outlook.com (2603:10b6:4:ae::34) by CY1PR07MB1512.namprd07.prod.outlook.com (2a01:111:e400:50ed::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.13; Thu, 7 Jun 2018 05:19:35 +0000 Received: from CO1NAM05FT060.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::202) by DM5PR07CA0105.outlook.office365.com (2603:10b6:4:ae::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.841.15 via Frontend Transport; Thu, 7 Jun 2018 05:19:34 +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 CO1NAM05FT060.mail.protection.outlook.com (10.152.96.178) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.841.6 via Frontend Transport; Thu, 7 Jun 2018 05:19:34 +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; Wed, 6 Jun 2018 22:19:28 -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 w575JRYP027991; Wed, 6 Jun 2018 22:19:27 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id w575JR28027990; Wed, 6 Jun 2018 22:19:27 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 04/12] qla2xxx: Prevent SysFS access when chip is down Date: Wed, 6 Jun 2018 22:19:18 -0700 Message-ID: <20180607051926.27940-5-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180607051926.27940-1-himanshu.madhani@cavium.com> References: <20180607051926.27940-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)(376002)(39860400002)(346002)(396003)(39380400002)(2980300002)(438002)(199004)(189003)(110136005)(42186006)(16586007)(54906003)(316002)(5660300001)(106002)(50466002)(48376002)(6666003)(356003)(305945005)(69596002)(80596001)(81166006)(8936002)(50226002)(81156014)(8676002)(106466001)(36756003)(4326008)(72206003)(87636003)(478600001)(1076002)(59450400001)(26005)(76176011)(51416003)(486006)(336012)(47776003)(44832011)(11346002)(446003)(2906002)(126002)(86362001)(575784001)(2616005)(186003)(476003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB1512; 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; CO1NAM05FT060; 1:Axt8bVzqRbBcRwrnIDucsB8G9JJ2m0R5KtfNHHd1J+bdj2XpDzS9ae27Hzv51RtVZ62eZKfJb2xZ+7bxZAC/hi8poojj1DkzygWl6n7tlqO9gYDnDOGkyxk56YnhiWXB X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4608076)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060); SRVR:CY1PR07MB1512; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB1512; 3:2c42yRwcTefqJbyqQ+zoBY5P1Nxl4jmiLK+GtXV8DHld/RanI9vBuNWZupkbtvsGtDXWt7SfTOH/o6i8XqwtSaQPBR0p59R0vJj9hpTHWJSse1S9AfZ68t/HFeRlstYxISzBZb5T7RVwu7tp91agwaiT3dTmDMcgFD7x8XKEelunrMaxlkQanR51hAm94GYQvUn72lLi8FAGphK8L0++f86E6VtHR/IJiVUw5JjhH4Dno0ycpcMrMgTtc/qp3spVmVpAPsx45vwBto/FaaGdA5dmodkeiPeItYScPzIR+xvf3xcfigOrpzFATl3MG5ZnHn9nUjYDivRaD7qBo4Rp4RVFimLO1/iaKkahqPNCh1Q=; 25:CGWZsMPiO1o1uNm09Qt9ZJTgfYtrLEtyGFuKRhpwu7WYjtcnaUb6sWhbiP72z8TWyvDHxL1vlRCZCIUdTZ7e/l5p3GDyMqeQ1HsoPSFc3UeYQMx1H3/XBoV3bcnREAd0N11KRd6zJ+rDR8teMXwrtqyARGVWN4mgBsbtcFaE449skjKRJpR/Yo9H3n6o5p0A1Y7fIO8VCFxHcxrLEpNZ9u7UVGSdTl2X79UgnL0qIpcsSsE57NUD5xCLSZ5bKQUjWWxikpjLglr64VFGYytnCTSafywFGXRpXaUz5wovdvi2keUA58wTOZ83/RHqJy6UKMIg+XyyDeKd8X22BnnsCQ== X-MS-TrafficTypeDiagnostic: CY1PR07MB1512: X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB1512; 31:NF5CyzFpk1s1NxKhzD9MIcpqzKF59fp+rnhSQC8RsvQhkCuMb9H+d+KEswVEY2zl5RR/afZKL1autUgMxLnLU7T4L9ZPnPEU+pqueiky1f5ru4KmppvLJ1Lh1J3oxY7CHouXmYwSc+FSDRkEbLwIvjWyIoom/o0B3vsJIxghZCsGHnko4Z7MDBcE3TJrHiikC/Twa/N/zNuZL8D810e5GOMomK+pC8dV/IzGi4LNylA=; 20:VWH0hqUXaVpZftLkaVaWn7cAUh/o2YSeyMxL9Pmk+8OBY2TyeJUMqdMWbfJ+giqIbUobOu193G7pgYLIxlJkQWauNxGl5RNqEsu8AAWfmYXSK2cCa+9A3A4nk+sHsABfJU5CFZ69HdBwBMoYwJeWksDGYd6q5CTBLn55/mMACiErwXXryiVZkghXC37IE3/F4udffHxES5ZcsFdevCyx+q0cJbeZabzNUVs/8iOj6ZKXRVWnShOfAGsFGjx0o5peJaGW9puDzMGFiQOcWEXbOjohN9N32jRYJALe3jGtMQCoVcl7iFZOnZoMI8IjytNHjHeSKR+Vv48ZFj/4vfsY1/zfwRYjxaQG3HB+TdAMTIvH5AE2XHp8qNPMf5vQh3sRZJZ8NG+ulH6vaqFxTh2J8bB4q6huKOO2gCOdgRuzRYdf16suzUHeYQ5b0g9GzrzyLb81G1s8VrUXFm68faURKtnLGNScdrR5iGxe1NIMVv5ei4UseIDlQyiNShXF7kVD X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93004095)(3231254)(944501410)(52105095)(10201501046)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:CY1PR07MB1512; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB1512; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB1512; 4:E+fMdM9liO9BigGd9jQr48YAiKXamld7UAm2YG5eNBJQJ3p/Dmubl/JbviMz0qBbr+QryyuvaImNQqP9y3+Ri+W0+49pDk7dSuKU2J43bUSoC+DxFoEa/VOLMBoiR8lOtYcriAiqjj3cxhglUW9l96woYyu5Bi84TUcff2SBfXmHhk7NtGhGTwrVAupjDkNAekRkeLwCSBchqX9Vn2KikZcgCFreg/+/aIq4OHGqqwMu8MlISNfcvRzPr734NZWktQd4z4IsBRTipxO85qcQNQ== X-Forefront-PRVS: 06968FD8C4 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB1512; 23:pWSKuKS6Gw3PS7+E8nYC+i5N5XFlkbfuIZrbc2Fkq?= =?us-ascii?Q?hB9HOrdfQmg4D1k57fbQUID9819EYqC6uMXqAGHk0pwE/8dZaSyVpoymRsD3?= =?us-ascii?Q?2IV59DyDgO1r36qXZJxA8Anc5FZWsn5g67oHIDJVy6XupQWACFsWMAALG8AL?= =?us-ascii?Q?mMUrjk1Y1QPsprAWuyVbo/uNsEno5fxM/w+iqD3h6iEyYnABhI4vYtA7+mvP?= =?us-ascii?Q?OKDgQJly/rl7bbPeRk2oVm1Rb3iVg/h6/yAcOItZrnqiLQUHX0TGf0ya2J6B?= =?us-ascii?Q?MFGowHDr79uNpc118L2qhxw/is2r8UrhKRY+0hDRORAINkhknzz64hsZRy5T?= =?us-ascii?Q?5PB4bCrOrPEfMcthwasgGdLW2iVT/Hj6HqnDOWDKdurXKpRjwECFAXQNf0q0?= =?us-ascii?Q?0WH9cpPZ52YPJTmRX5oFSqleQ/z/VQqYlr6Zh9R6+k7EOedajnTgyg5n8SvU?= =?us-ascii?Q?UhMpge+0DN7494y4Wjg2fiVWFwFUq/MtFcXNMmGZnplT3mWUuw1hdE55Yp/G?= =?us-ascii?Q?KtRWC48WEPEBNOqfj62z2iA4FRtBv8f7n0P60YClL3GQ0iBUYqhukvuYtxwz?= =?us-ascii?Q?TTlq8PcfkL3wj0qRxjvdqOlkMRQbFVy24/HNRBEUtFZ8ejKc053p0uilAkFT?= =?us-ascii?Q?icCoU0ZgEufevCVEi90Z2HPtnTiWd+yO6WrvEb6G2vvBFMdqdEpSKtidUCZ3?= =?us-ascii?Q?KMUhLOhCdxNuF18SVv0czb6k/FGOF6sSwkqRyy1f2h90owdPDY6tKbEPu+R4?= =?us-ascii?Q?vpQ1fe/mH8EWbAveiU9P8W61vDmgZuYEECAIgpgCZj1RGjYNh7RsDWxuKAF3?= =?us-ascii?Q?e7NZZYKiqN80H0m6qOAsTOvrzWGzXwI78ZC5BfwknpQiyWp4ICTKmSz6+xfQ?= =?us-ascii?Q?JndSwxcoaxp56wgfIvCg4i8V/I9jRL9IoCHRM6d2XEnKIoJi6IQdLLeM2CoC?= =?us-ascii?Q?qWSA8flsqcbHYBdsclpHZo0TWW/tyyQYfMxzPFE+y35GZvzMa8lQKfyZ8iY6?= =?us-ascii?Q?bfcrQvrmsEU+hOlLTJIPCn0Zr8KVB4e7PNjAz13QaRLvYIg9Mv8XD22fkMSe?= =?us-ascii?Q?Q/IgDqSV3td9QjJJUx6yUQ+Zo5tDK9EDkerz4iandAADEFHwGVkP+Y68coQ8?= =?us-ascii?Q?z00N6+OOzLnCF2M19UtbG9bUUkusTM5K/JtgcsdFuVE8/6dWjYhbrFNhWAYT?= =?us-ascii?Q?DMF2HBHdwnf3pg=3D?= X-Microsoft-Antispam-Message-Info: Rnlfx8eptBKImczh4ZMHUolQY/jk7bpWTHmD6o0G6UNRT2GSxoKf+G9pNYa7ZPbz9M+iIynC1w0ZlGGWoPTEPzG/xDgAnHjDRD6URAZQRNE4xm9v8QHB+yn1dSF+M+/Mbvm4TadB1UyO9hXZvbKMzZcO40adD/P2w6E9snMKfA499ZQjGNGY/P3krV8ftOhq X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB1512; 6:Os3pG9FgUZYlrkZ/Cti8cUhM1paDIooi4FUTingp2GSKWTOBLKTBClkPS1FmPAsJQ/oRAp2qhfE2h5fYNsuWabw6zGAEbq3z0dkRquJZ4OsSZ1goBZJNitVkufy7j60B2YT/G3JfFbiaEFuz1REm4OLkskuuYHio35UNNAfffpWnY4+ceub4wgzZ+8M68ubEc4xagasPgp7WCYCZnhJiF/kZ7CxYwSrp40h+g+6mc+UCb8OLBBodYnXA1Q3lNtY1bbo6ncQ9M3tbJmY80IaBVke0E+0N7jL1mz0h20uibcRfMZ0Ccvln3D0FOzwRuzB3LQxzokANtA8qEQO0FZgM8Jf2MEE45Bzd47M7m1p9A+kOiKuNx5Vgm6zGykw7bl7nFBMcp9rDN2iqE5jjKQyyOXfIv6BSGk/rwKqkXlT7OsAEneE9QGdoe/H0JTJSU6vFl3nkLKzYIV+EvsdBv57EXQ==; 5:HQCNmQ8JayDb5xiUcZRqXeZOF+o7xelj6JrQ1GHLNtZ42tAr2c+N1fo9GAhSLU+BYOxHEJgO3Ij86hj9lOysr9rlaqqB2zQLDplG8JsBqyc3gSgQ7sk296OKB9AgPvortu4ZJ0GF5+iyzLdPn3BEaA3hhC0qzFrZrNzQl9jR1FI=; 24:S1gt6FB0kh7oLcbmWhx0QmtSdTNSj3uIztqAm+luWLMFRZSFLHNI3YZfz/cQgiSUCZJwUvPupcpuxhK0ccAW6eXSjpJMKeWEZ6Bl6EiqQ80= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB1512; 7:zyHgDTvUKTEt6JBkbBDMWp5d3hm6+GJ0PBdXp9ay50TlhW9Kg8kNEJH46DZuHDbT2r4CuvjaawXH+092g1R4zZ9qNV4TEi8of9X47sJpI/oXMgVOEhMUh2aiekwtC2dMaLswLU2JSKK/PE27aPuZEd/nEmWOVZaqau6QiaZqQ+ZFWZR/ixtNoNV0vpI3sWVgh3HuCrPr9pDE4DwZF28uN6BNydcRRtXCOMFUCGdltyUyu0DFZwJ0SxgEfn8ps2mv X-MS-Office365-Filtering-Correlation-Id: 1521ec28-fdb4-46e5-f1b7-08d5cc3641d7 X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2018 05:19:34.5264 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1521ec28-fdb4-46e5-f1b7-08d5cc3641d7 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: CY1PR07MB1512 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 Prevent user from sending commands through SysFS while FW is not running or reset is in progress. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_attr.c | 33 +++++++++++++++++++++++++++------ drivers/scsi/qla2xxx/qla_init.c | 2 +- drivers/scsi/qla2xxx/qla_inline.h | 6 ++++++ 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 89a4999fa631..cc04caf83bd3 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -518,6 +518,9 @@ qla2x00_sysfs_write_vpd(struct file *filp, struct kobject *kobj, if (unlikely(pci_channel_offline(ha->pdev))) return 0; + if (qla2x00_chip_is_down(vha)) + return 0; + if (!capable(CAP_SYS_ADMIN) || off != 0 || count != ha->vpd_size || !ha->isp_ops->write_nvram) return 0; @@ -570,7 +573,7 @@ qla2x00_sysfs_read_sfp(struct file *filp, struct kobject *kobj, if (!capable(CAP_SYS_ADMIN) || off != 0 || count < SFP_DEV_SIZE) return 0; - if (qla2x00_reset_active(vha)) + if (qla2x00_chip_is_down(vha)) return 0; rval = qla2x00_read_sfp_dev(vha, buf, count); @@ -733,6 +736,15 @@ qla2x00_issue_logo(struct file *filp, struct kobject *kobj, int type; port_id_t did; + if (!capable(CAP_SYS_ADMIN)) + return 0; + + if (unlikely(pci_channel_offline(vha->hw->pdev))) + return 0; + + if (qla2x00_chip_is_down(vha)) + return 0; + type = simple_strtol(buf, NULL, 10); did.b.domain = (type & 0x00ff0000) >> 16; @@ -771,6 +783,12 @@ qla2x00_sysfs_read_xgmac_stats(struct file *filp, struct kobject *kobj, if (!capable(CAP_SYS_ADMIN) || off != 0 || count > XGMAC_DATA_SIZE) return 0; + if (unlikely(pci_channel_offline(ha->pdev))) + return 0; + + if (qla2x00_chip_is_down(vha)) + return 0; + if (ha->xgmac_data) goto do_read; @@ -825,6 +843,9 @@ qla2x00_sysfs_read_dcbx_tlv(struct file *filp, struct kobject *kobj, if (ha->dcbx_tlv) goto do_read; + if (qla2x00_chip_is_down(vha)) + return 0; + ha->dcbx_tlv = dma_alloc_coherent(&ha->pdev->dev, DCBX_TLV_DATA_SIZE, &ha->dcbx_tlv_dma, GFP_KERNEL); if (!ha->dcbx_tlv) { @@ -1036,7 +1057,7 @@ qla2x00_link_state_show(struct device *dev, struct device_attribute *attr, vha->device_flags & DFLG_NO_CABLE) len = scnprintf(buf, PAGE_SIZE, "Link Down\n"); else if (atomic_read(&vha->loop_state) != LOOP_READY || - qla2x00_reset_active(vha)) + qla2x00_chip_is_down(vha)) len = scnprintf(buf, PAGE_SIZE, "Unknown Link State\n"); else { len = scnprintf(buf, PAGE_SIZE, "Link Up - "); @@ -1163,7 +1184,7 @@ qla2x00_beacon_store(struct device *dev, struct device_attribute *attr, if (IS_QLA2100(ha) || IS_QLA2200(ha)) return -EPERM; - if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) { + if (qla2x00_chip_is_down(vha)) { ql_log(ql_log_warn, vha, 0x707a, "Abort ISP active -- ignoring beacon request.\n"); return -EBUSY; @@ -1350,7 +1371,7 @@ qla2x00_thermal_temp_show(struct device *dev, scsi_qla_host_t *vha = shost_priv(class_to_shost(dev)); uint16_t temp = 0; - if (qla2x00_reset_active(vha)) { + if (qla2x00_chip_is_down(vha)) { ql_log(ql_log_warn, vha, 0x70dc, "ISP reset active.\n"); goto done; } @@ -1381,7 +1402,7 @@ qla2x00_fw_state_show(struct device *dev, struct device_attribute *attr, return scnprintf(buf, PAGE_SIZE, "0x%x\n", pstate); } - if (qla2x00_reset_active(vha)) + if (qla2x00_chip_is_down(vha)) ql_log(ql_log_warn, vha, 0x707c, "ISP reset active.\n"); else if (!vha->hw->flags.eeh_busy) @@ -1840,7 +1861,7 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost) if (unlikely(pci_channel_offline(ha->pdev))) goto done; - if (qla2x00_reset_active(vha)) + if (qla2x00_chip_is_down(vha)) goto done; stats = dma_zalloc_coherent(&ha->pdev->dev, sizeof(*stats), diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index c58a6886fc43..0fae17d1aaea 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -7129,7 +7129,7 @@ uint8_t qla27xx_find_valid_image(struct scsi_qla_host *vha) ha->active_image = QLA27XX_SECONDARY_IMAGE; } - ql_dbg(ql_dbg_init, vha, 0x018f, "%s image\n", + ql_dbg(ql_dbg_init + ql_dbg_verbose, vha, 0x018f, "%s image\n", ha->active_image == 0 ? "default bootld and fw" : ha->active_image == 1 ? "primary" : ha->active_image == 2 ? "secondary" : diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h index 37ae0f6d8ae5..2fb1b58c7eef 100644 --- a/drivers/scsi/qla2xxx/qla_inline.h +++ b/drivers/scsi/qla2xxx/qla_inline.h @@ -204,6 +204,12 @@ qla2x00_reset_active(scsi_qla_host_t *vha) test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags); } +static inline int +qla2x00_chip_is_down(scsi_qla_host_t *vha) +{ + return (qla2x00_reset_active(vha) || !vha->hw->flags.fw_started); +} + static inline srb_t * qla2xxx_get_qpair_sp(struct qla_qpair *qpair, fc_port_t *fcport, gfp_t flag) {