From patchwork Mon Mar 11 18:03:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10847965 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 6299013B5 for ; Mon, 11 Mar 2019 18:05:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E642292B1 for ; Mon, 11 Mar 2019 18:05:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 42BCB292C2; Mon, 11 Mar 2019 18:05:55 +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,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 C88E2292B1 for ; Mon, 11 Mar 2019 18:05:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728018AbfCKSFy (ORCPT ); Mon, 11 Mar 2019 14:05:54 -0400 Received: from mail-eopbgr710047.outbound.protection.outlook.com ([40.107.71.47]:31257 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727598AbfCKSFy (ORCPT ); Mon, 11 Mar 2019 14:05:54 -0400 Received: from CO2PR07CA0067.namprd07.prod.outlook.com (2603:10b6:100::35) by SN6PR07MB5376.namprd07.prod.outlook.com (2603:10b6:805:74::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.18; Mon, 11 Mar 2019 18:05:12 +0000 Received: from DM3NAM05FT031.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::200) 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.1686.18 via Frontend Transport; Mon, 11 Mar 2019 18:05:12 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by DM3NAM05FT031.mail.protection.outlook.com (10.152.98.143) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1709.11 via Frontend Transport; Mon, 11 Mar 2019 18:05:11 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Mon, 11 Mar 2019 11:04:04 -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 x2BI43Fb030315; Mon, 11 Mar 2019 11:04:03 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2BI43eW030314; Mon, 11 Mar 2019 11:04:03 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v3 01/14] qla2xxx: Add fw_attr and port_no SysFS node Date: Mon, 11 Mar 2019 11:03:46 -0700 Message-ID: <20190311180359.30276-2-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190311180359.30276-1-hmadhani@marvell.com> References: <20190311180359.30276-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131968011121813468;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(346002)(136003)(396003)(39860400002)(376002)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(446003)(476003)(50466002)(11346002)(8676002)(2616005)(86362001)(126002)(48376002)(5660300002)(4326008)(47776003)(305945005)(2906002)(76176011)(97736004)(486006)(110136005)(81156014)(42186006)(16586007)(81166006)(26826003)(80596001)(85426001)(68736007)(6666004)(51416003)(36906005)(356004)(54906003)(53936002)(26005)(498600001)(336012)(105606002)(106466001)(1076003)(316002)(36756003)(87636003)(50226002)(8936002)(69596002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR07MB5376;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: da567f51-a52f-4d86-f28b-08d6a64c1b17 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:SN6PR07MB5376; X-MS-TrafficTypeDiagnostic: SN6PR07MB5376: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 09730BD177 X-Microsoft-Exchange-Diagnostics: 1;SN6PR07MB5376;23:Lex60OZEHmxo7xz8fk3jBC+Dqo1Ga/5uo3FZg9LIXvwZT0SxdyQk8RAdbjlF7Qn0/dZfdkIlX3Ey5VBnd0d6Fid0YJVgmy9MqFQ0G1/rLQv7+qSiUqhriIqSuaW+9duCgfqQKKXBMmihUV2/JZ26zY4u8lysAP8SXHuEuvV+YKzs+Bc6c6w0XjRUUkgwsa+pYMd0qwWEWegVitI9K89EjRlsMDN/80fwxSGVsT212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nDMXF5YbHJScPacrqb+ncCB6brvbZPM2W3UwztefUNzaHWy212RxaoF0hJNRp1REorFVwMCSzRLcSnsOQj6WNX75ApheNfqihxQpSoY4+f6hg9INNFdlDsAz/3abGnL076KdUcNHNVQc7ccqHtvE8o7brejlZJRpD73VcyajX/3FAULIa4jGhWBpHT+/DFhc30nZcgKuPwHoxfJLsh4crlweuFa97PvYboYgvMTjbm0m0AnCQlu3hrQUE3NJfm4K1OQsX36PsX+78lW7+RSdyMb3StpQoHdMSFQpqsibD2SeFNgG0NnzkEU5Ml5Y7WnbHum6GyzMwaIwqGKgqFAMI0VHSn9ZHa9v1c0uldo1j1os= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2019 18:05:11.8410 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: da567f51-a52f-4d86-f28b-08d6a64c1b17 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB5376 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: Joe Carnuccio This patch adds new SysFS node to display firmware attributes and port number Signed-off-by: Joe Carnuccio Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_attr.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 2eb1ae721a7d..46fcc718337b 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -2162,6 +2162,32 @@ qla2x00_dif_bundle_statistics_show(struct device *dev, ha->dif_bundle_dma_allocs, ha->pool.unusable.count); } +static ssize_t +qla2x00_fw_attr_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + scsi_qla_host_t *vha = shost_priv(class_to_shost(dev)); + struct qla_hw_data *ha = vha->hw; + + if (!IS_QLA27XX(ha)) + return scnprintf(buf, PAGE_SIZE, "\n"); + + return scnprintf(buf, PAGE_SIZE, "%llx\n", + (uint64_t)ha->fw_attributes_ext[1] << 48 | + (uint64_t)ha->fw_attributes_ext[0] << 32 | + (uint64_t)ha->fw_attributes_h << 16 | + (uint64_t)ha->fw_attributes); +} + +static ssize_t +qla2x00_port_no_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + scsi_qla_host_t *vha = shost_priv(class_to_shost(dev)); + + return scnprintf(buf, PAGE_SIZE, "%u\n", vha->hw->port_no); +} + static DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_driver_version_show, NULL); static DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); static DEVICE_ATTR(serial_num, S_IRUGO, qla2x00_serial_num_show, NULL); @@ -2219,6 +2245,8 @@ static DEVICE_ATTR(dif_bundle_statistics, 0444, qla2x00_dif_bundle_statistics_show, NULL); static DEVICE_ATTR(port_speed, 0644, qla2x00_port_speed_show, qla2x00_port_speed_store); +static DEVICE_ATTR(port_no, 0444, qla2x00_port_no_show, NULL); +static DEVICE_ATTR(fw_attr, 0444, qla2x00_fw_attr_show, NULL); struct device_attribute *qla2x00_host_attrs[] = { @@ -2259,6 +2287,8 @@ struct device_attribute *qla2x00_host_attrs[] = { &dev_attr_zio_threshold, &dev_attr_dif_bundle_statistics, &dev_attr_port_speed, + &dev_attr_port_no, + &dev_attr_fw_attr, NULL, /* reserve for qlini_mode */ NULL, /* reserve for ql2xiniexchg */ NULL, /* reserve for ql2xexchoffld */