From patchwork Wed Jul 18 21:26:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10533297 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 1DDA16053F for ; Wed, 18 Jul 2018 21:27:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C3FA2982F for ; Wed, 18 Jul 2018 21:27:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0018829837; Wed, 18 Jul 2018 21:27:07 +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 5DFBB29823 for ; Wed, 18 Jul 2018 21:27:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730252AbeGRWGw (ORCPT ); Wed, 18 Jul 2018 18:06:52 -0400 Received: from mail-bl2nam02on0046.outbound.protection.outlook.com ([104.47.38.46]:25169 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729973AbeGRWGw (ORCPT ); Wed, 18 Jul 2018 18:06:52 -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=J8QjJlRl/ALX/gGOovl5CAKQOQmTetDTyGTVUncLVME/gzxi5hIGZ00i0BJYp7fZx33mklJnBdQR4bDrtBwEMHM7GSr4luoJvwqQSxC71mAA9+TajejgoeumvkLwRRtL0aN8gi9lNs+IfV7Uy0vqLAM/v8I+1icmI7dTvTHJ3uc= Received: from DM6PR07CA0001.namprd07.prod.outlook.com (2603:10b6:5:94::14) by BN3PR0701MB1379.namprd07.prod.outlook.com (2a01:111:e400:4018::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.952.18; Wed, 18 Jul 2018 21:27:02 +0000 Received: from DM3NAM05FT028.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::203) by DM6PR07CA0001.outlook.office365.com (2603:10b6:5:94::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.973.16 via Frontend Transport; Wed, 18 Jul 2018 21:27:02 +0000 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 DM3NAM05FT028.mail.protection.outlook.com (10.152.98.139) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.995.0 via Frontend Transport; Wed, 18 Jul 2018 21:27:01 +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, 18 Jul 2018 14:26:55 -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 w6ILQtvB013376; Wed, 18 Jul 2018 14:26:55 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id w6ILQt6v013375; Wed, 18 Jul 2018 14:26:55 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 04/12] qla2xxx: Prevent SysFS access when chip is down Date: Wed, 18 Jul 2018 14:26:46 -0700 Message-ID: <20180718212654.13325-5-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180718212654.13325-1-himanshu.madhani@cavium.com> References: <20180718212654.13325-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)(39860400002)(136003)(2980300002)(438002)(189003)(199004)(106002)(44832011)(87636003)(110136005)(47776003)(106466001)(8676002)(6346003)(4326008)(72206003)(76176011)(54906003)(80596001)(26005)(478600001)(2616005)(486006)(126002)(575784001)(86362001)(50466002)(336012)(48376002)(446003)(11346002)(476003)(51416003)(5660300001)(81166006)(69596002)(36756003)(81156014)(316002)(14444005)(42186006)(16586007)(50226002)(6666003)(2906002)(1076002)(356003)(8936002)(186003)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0701MB1379; H:CAEXCH02.caveonetworks.com; FPR:; SPF:Pass; LANG:en; PTR:50-232-66-26-static.hfc.comcastbusiness.net; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM05FT028; 1:T2yjRqyh1qUXgFWqUhivC70zkgSBnhXQ9yEDh3ElaWvLNO5LZp7PhDIUxcpaZn5kFPjPDlH4X14bDGc+rtCrbDdezSGS42Nat5GkmRqmzoA+PDB6m7BEgz3dQ2NToT2t X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5ea4b188-8571-4a0e-91f2-08d5ecf5338a X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600067)(711020)(4608076)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060); SRVR:BN3PR0701MB1379; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1379; 3:hOsw2Ok0AiGCpHzLCeEId6keWBt19lAzwh7l6kQtlKzP/U9OojekYn0ik/GmjANjLs1wf2+Q0OPSpw2ggzcqgyDdhYJk+w0bef0Twn/7PUYYb3gscCj+I8JU3Be9bhRDyBBy4dTdx2Xy2ktlj7a7h+EZTPaMvqEuuveM3A3Gk7bQx8MwZfCEnz0uXiyY8bbrYuj9YJ4GrRcym2qDWJc1PPyA6FvfU0IzdXHxSvxQMh/pglCrCJ0MGCYPenxT80hSWevjS3q7Ef+N6BsA6JD1ZJcR1vHSTwhkhvzHqOLIdIc/dWcmf8d/pozmhL7ObvTQy0TeKwwAwF2RE43K3epL+tPJENSCFizRtN7+b65qW7Y=; 25:cXFDT0cii12tTY9gVb5vQHuX+JhpM8VDNfcRNe5bz61CZTbRLPWqN1xBz+HxlH5NFeu0U/EVk032OXmmxoqaXJzMii832qSOW/I0l950pz2vtOp+z6uU80Pl31mTHtEk/DnZcASP3RILYB3lIfhNU4f5OPXv/NBdNPddgdD01WcsYj75pp0dEzkmncQLturx9Xq+6CODuu9qM1JYcjkEMxaDgeuc2y4WkkU+V8qgYdUu1ju42J2yOT1FrfKZ7pQEdO0b6MMVuW1nsLDZjTEbprGXeOG6gbe7HZjiIvEPVro4n/58lA9jpY0b09DCrPmYqtt3My1/YUvfxXpKLzgJXQ== X-MS-TrafficTypeDiagnostic: BN3PR0701MB1379: X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1379; 31:U6YPmT6urGhlF02P2VdPTYIGxWAotiaJbvTkufK+qGzz+E287731nHbmmgMWjcyq0B5ZMVfuRk7JnJytCnR9/u8+FZLSJ1hDqbmCQfzLX4r930tBVBPMQ6F5EUGZDn4yHfx+eqbdzszgdjlEE+Shr5+KN8WZLe1KE7Q9YkftwGlJF9KUlXXz1Aq83llzgXKNL1UF/AB+hBYxg3Rbs5GsSD8PWIq22rAdP3exFJ7/rWw=; 20:egq7zY1HTCK3qFdFgFncZj7LNlifs8x+E/QJMXf0wvgXmNqlA7HwuMauGqo7V0MuXqngzZjdUz0sT35/kL6xtkJffVrq1txIEh8OMBDJO7JEPdhx8fe3ljqkAy3xoVhGxb4iYNnWwOoJa+UNbaGGP2FoKCjP9WB9bZGFjVYLEfi3s/AQOoPEDchhZ5SpbyD8vpjVLDSCz0bt1tABCLETEy/6u3i51etUHy7s7EwQ5fuQGmq8+poMY61sTwv1wuC8iTewfKA9w1AYcTjKAHSqyEDQ0iUuk4Io1eEYrCkGK8DXqg/Rgfx6eZzgN110HfvF4D5pMU9VZPMEak37yupC0ydGCR/POKL1cLiovDPkMa8uVOFUArGv3i+alvtj3CSO84O6PqYUsPmEITLPzn1AuMkWmDelFYaj2eNXY7EbkcpA/VFPbfIhtpv1h9sL6+EKEaO4K6rxaO9XxsW7TiMO2FHj2dn2BKFKPAY/59D9FakuLMS3U8y/kKZtJ+eHMpuc 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)(3231311)(944501410)(52105095)(10201501046)(93006095)(93004095)(3002001)(149027)(150027)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:BN3PR0701MB1379; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0701MB1379; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1379; 4:s6Ga8YgocHagwGi1Kl6lkoCNDIt5zHnAJSOwDkr/GMiTYxpJ42PmVM2JnI9wEuhm/lCgKxxJFw4EDWNUO+thO5cc2uIeQ7WKivURhMncE5LBornnJv8Jl0hAMeFvD7uu/MHxchA6KANRGUnwLRU2JDWAs5dNnMMJP7rujleeyqSrqKfG9TqA1Tn6FuEc4G9Qhxr9WSrzr/EEYtv+fCuyJXDJGUE5lGgn2OGO8SRO1Mm+GcCtj59Ygoj7EjaDANHzvZI2QQG7Ny2g7OWDhkrcPw== X-Forefront-PRVS: 0737B96801 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR0701MB1379; 23:0oN4dfErKqwVLeN5kcvpjuR6imY0M65MimonwiL?= =?us-ascii?Q?GgWtzaeMVobYApaix+S6CTuAceLOC6FcoXuqTEYJnVMhgVXQH1OigTbTLKh6?= =?us-ascii?Q?GOLQH3zwcTLE2r2Fr56TFChStTAEe0klpqW+7HXjVZ2G9gjyTxMXV9BhejpZ?= =?us-ascii?Q?bxqLaxlrJUCJjgcNRPmZ8Q6W8F8J10CFTv+UTO3YvZS+GSD88MnwgBJ46ulu?= =?us-ascii?Q?L3CHZs2LmQsich4hlKvthdK6Kzr46n0ckDG8mkS+jSTb1K/8bsexts4FXvcC?= =?us-ascii?Q?69mdF4QkN/RaOxNQziopzluAYQvRoD5Ax8oVDVhbHvJrZ7u+J/RoEj4cVZSs?= =?us-ascii?Q?LFujX++7plNgNN7uYL6T8SGyNn1OkEl/8G7MqbWLpodYuHssKqsltM0Vs/T/?= =?us-ascii?Q?3RN33BExKB/B95u5sfyRifbloKGPcmIy0JFCG4LvQBqKuKZ4mM62v6UTz6dk?= =?us-ascii?Q?93YkxUVtnrC08bxvS+62U2z1HaKUDi/YuUWaBkIWblhsL6o/5GPxStQF2Gma?= =?us-ascii?Q?EUHBTwf1YiejY4TWemj7wsn8H2eof9/CYe8WW/jwPVU+VH7rpAg5l09fbu2g?= =?us-ascii?Q?z25SQut7QoOI0PdLgmDoIMztWMLVQ9cgPm9H3mQyg3VrYdRRhJag0ezcoB0c?= =?us-ascii?Q?c8y5f7JgtsmSRCUAS97veBHBZGsu4Yv6wTmHoGEOC3Q+mr35SkQn+ojVrCCf?= =?us-ascii?Q?RxK85gmc3CeJNUFZVzBYFzEn7koMmQeO8t9eW4ZrK6cGsW8Ozp9S5/8md/PA?= =?us-ascii?Q?qZck1Q1+Z9EPLC+gjBJXh0S2IUVAHnYSsO2fr9uVD8ogyQl4RHBBOqtms7YF?= =?us-ascii?Q?rh1dEqcBidgCfxv41QVusSWW65Csmip173FZrHGo5kUOna9XFIkes9iym5ha?= =?us-ascii?Q?ly2pTEkacrpqTLS2Y0xBLd9u7hOTIRM66l3ia5Tk+5BFAmdztRneLxA6TnrS?= =?us-ascii?Q?Q2fq7ei0rkRBDFtLlYOHigsmB8GlAL5GPwq3dX5erIPBjshHwLAQv0T4ekgX?= =?us-ascii?Q?SP3+3cAloSIBXhc391HbNu+5HHxQArj32nUSwPRZNQxfuKVudaVPH5sVZd9Q?= =?us-ascii?Q?jOlQgiWlX/MqXIQAFWlkRvx+P9luqvWcpYzSBJVNOKM3/hLS0ic3XlxyMjk1?= =?us-ascii?Q?VAfqG1fZ9ie1Wm8hkwQJDIKiLyQEFt9HfjbGImRkYCLYyKNYdgnekCgMExgo?= =?us-ascii?Q?0qGEsJpvHs47x2fo=3D?= X-Microsoft-Antispam-Message-Info: wAP7biYJkhSwHq78joQImXPcnHl/2wK8DnPUXQ/yJEdWYUxKjvnyL+djSnx//IU6YNBPg/w32A2TWP0Qr0Riv/y+E9Wy7a/1TuYxQ8sd63kj8zZfuiN2bO0P7FNXFZnLFklT3xYOm53OM5qXg3dUcGqKARcswGMUljQhQ8IhsQ6APxAY5MzwXW45kD88zhxQcgJ0xfYh/88Bbe5G+O11/2jmU5bo/TcoFlXmI0aJldCQkK2eIY/oYeOLjtHLQWxGlowxIbNK6lduNrziaz0XCpsLcSP1bieuvaZX3EH65OHac1ZAukPn92P73xjyrNFQZ8UUPqDEMqEg1MM0H+VH7erOuau92RdpdwXI/j4IPpE= X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1379; 6:BVHlzU4lvn8f7qYR7QsMFI1oeYP2cBIwYaVtS9QzUGjei3Ee7yGeN8hr1yIGof8JjzGgai0Y8LoMFyq/VERj7E5MbIbA9pnHjS+ZZvDpsQHpDPX7dC8DJxNOUX7RpC5AtMaeEhREH6CjC3g0QRHQIqCWM1UTBaAWnVynFY+eH+vqow8a0gpTVGuvQ8u5vjqOPCITVHQsK0TAqPjrybpniaCV54L6J09kFPxSegjTxN4SaURJBfMpfGdyeAHtGtex83+5haM850V0m/KBO7bQr/l5QLX986kYAnN1n7VPB7Yo2WSRJf3yKnPXT8fri3jCp+jzZng+d14FzdXBLX4ICWAzLFkvgTGCMwe/MwQX39Zesewvez50mNcRS8Oya3dK064fNz7mRLHjD2ZTYUTmXwFx/YzGvGslH7KLcx+66D3K7IM+7XgZ33TBM87xEnXLCoYsPLBvoXVmHf7Xb0GDSQ==; 5:ciuHrqnvJBAPUqubS5dsfYe1J/Ezmh2oROp3pmxUHiSPmQ4G15ldcehAIZ6fw7tVofMia1uEQ9utgsNRun6dAjOEDBRVlCbgeOzfPGPo1VQMJx5Tgzau/hPcWQ+Gh8WMZ65D5lB1UD9YZwqkUQupGoV8aqfUxJdP8Yn58aPyM+E=; 24:hPqJZVWzJq/aJq2kimqWoeEtBhfZ0xbMPSMLN+NZQ0SCpM5TA4yrkx0XiM8SAOE/n9mIdNtseeXi58okFnwVFL4XkZGxD+QS9475FVAMInE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1379; 7:3ztVu2CBal1grXuK9S5YVEJPkI0GVffiFPMq87CRpmyGhF7T7kywnOxhp3B1BfDh2v+P/jgsTSrywDIpHvo65dmy0gXKZuRLsG2whacg2vhoex9l4NhiQ3HdDfOFJuaeAsTd+pWWDSZzsP8Ptnixs7xzz2MsAJd42T2plBdaHkF8wzCq4Afy+NEift1Ybr4qP/tc/8fG/a9++tfgcfCvvBernI3UbZx2Slo2jBEPujimAUOQCkOHTTbo6JvwaFZ4 X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2018 21:27:01.5686 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5ea4b188-8571-4a0e-91f2-08d5ecf5338a 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: BN3PR0701MB1379 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) {