From patchwork Wed Dec 20 06:56:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10125077 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 50F6E6019C for ; Wed, 20 Dec 2017 06:57:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 47D3529649 for ; Wed, 20 Dec 2017 06:57:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3CE142964F; Wed, 20 Dec 2017 06:57:30 +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 BCCDE29649 for ; Wed, 20 Dec 2017 06:57:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932498AbdLTG51 (ORCPT ); Wed, 20 Dec 2017 01:57:27 -0500 Received: from mail-bl2nam02on0078.outbound.protection.outlook.com ([104.47.38.78]:2080 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932425AbdLTG5N (ORCPT ); Wed, 20 Dec 2017 01:57:13 -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=wSv2lUDGnM1auDbw2oR5nd4z/rtacy57k/Xzq37lyHA=; b=jlIWwnMCgGDPlFEE7MgOUXSxm7Q57SqJNAQVEZ94St82MWEc6b1V6Shb6AGPL7gYSV8W/lrszsX5IufFhZzt92oinfjYxM4Xq4pUTqp1kMppaPIoPmZQxeANLSxRykKEzhO8HHKKkbIKecctIPj6Dlj8QApRweo0tuTfORAyuz8= Received: from CO2PR07CA0067.namprd07.prod.outlook.com (2603:10b6:100::35) by MWHPR0701MB3817.namprd07.prod.outlook.com (2603:10b6:301:7f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.323.15; Wed, 20 Dec 2017 06:57:11 +0000 Received: from BN1AFFO11FD043.protection.gbl (2a01:111:f400:7c10::176) 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.323.15 via Frontend Transport; Wed, 20 Dec 2017 06:57:11 +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 BN1AFFO11FD043.mail.protection.outlook.com (10.58.52.190) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.302.6 via Frontend Transport; Wed, 20 Dec 2017 06:56:57 +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, 19 Dec 2017 22:56:48 -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 vBK6umni021618; Tue, 19 Dec 2017 22:56:48 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id vBK6um2A021617; Tue, 19 Dec 2017 22:56:48 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH 18/43] qla2xxx: Tweak resource count dump Date: Tue, 19 Dec 2017 22:56:19 -0800 Message-ID: <20171220065644.21511-19-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171220065644.21511-1-himanshu.madhani@cavium.com> References: <20171220065644.21511-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)(39860400002)(346002)(396003)(39380400002)(376002)(2980300002)(448002)(199004)(189003)(87636003)(48376002)(72206003)(80596001)(1076002)(478600001)(85326001)(47776003)(51416003)(2950100002)(6666003)(356003)(2906002)(76176011)(8676002)(50226002)(81156014)(81166006)(4326008)(8936002)(86362001)(5660300001)(36756003)(110136005)(16586007)(69596002)(54906003)(50466002)(316002)(106466001)(42186006)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR0701MB3817; H:CAEXCH02.caveonetworks.com; FPR:; SPF:PermError; PTR:50-232-66-26-static.hfc.comcastbusiness.net; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD043; 1:If1gAOXdGx8D9z3dOp6rBEBArF8DN9Pp3y7pdPfILtdPjFDgHn5UDI/BBKUyyXzY+68iDyG97ZBDph1ygYUEc3uR3GbXxzLnrwB4oc70WFUQeVBkV0Uw4d25PM2W51CP X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7d97ed13-6ce7-4896-c30a-08d54776dcc9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:MWHPR0701MB3817; X-Microsoft-Exch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M0SKlRFPnR8L27l+k0wNV3xFxwbMg0Mmp6JIcbMNsgurxua/mxJNctFxCmWI/SScHsRwo06+GIfuyzEhsoNKTV3a5Ou61Ck3vqy48Y9E8VBz2Mksex09gbLXg3IDWkbNsd8CVT4s1ZmnSfUB1eXq5gtQjEI4piMSPARIzK1iugQehybbyMT+pjBSFXepmGT9GVczeQXLimBhsNqmkVIJzQMCtFgr6Tvg0eH/Np4X9PrNdOwPTpkXJkSEXc0zt3T6pmdu8KcuePoOCNwhrvgv3ij29GlYgrAXsoPGKTsh1tTXYm3aUC5ILhSmwixEArBQVz0u0epqlAKE749dNFDBx8Z2JnhhXwuDLu5BamMSWpljGuybEv6Ovi5OE2Nc1dmDMAVrVREO1st+J86uaX2al3C6FvfTGTSQCca6yTnLJURa96Sen1HH8dXbK9ZQ0EOHcg6H8aPeXDBR39DUAnNF/w+kn5wwZjg2n6di7fqtA X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(93006095)(93001095)(10201501046)(3002001)(6041268)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:MWHPR0701MB3817; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:MWHPR0701MB3817; X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3817; 4:VGiriYcKKB1wagNZJoB2F1baTJfSLdS2emx1fVcDu90uwDkYEQBf06zlyK1iqlGsrdtX9Y/BQzjPU2Jy+Z9xqXScKomoP0gncVaHccUozyUmz9DXYcK6n916T27w8TTgFepgcxpLonsNQzopQgyziiUS3snImPy/arXorCG/4EfGBZQWBNLCCwonXvSymO4gdW8LoktnvoZ9tzNjgb+WLHevxUCL++QzE4oogWXnl/iDpzR4vsFFOwegfOpuFwFs7tEBLcPiEHup+hTfXAnIeQ== X-Forefront-PRVS: 0527DFA348 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR0701MB3817; 23:hoKDemA6g8GCBk6s2Pe9ENz6CfbY6+IHpP+hNAq?= =?us-ascii?Q?AN62nmxNgEKdbxthdoTlU5cj810bkCtWa33WV9cTf643pdvmj8C6+4V+4UcJ?= =?us-ascii?Q?qPVDxSEbbaEqyemkhoItLQctJ4wUMMayih8n02TlUNGcBUdYmBdpllyUrpzx?= =?us-ascii?Q?OyyMHeKKMXHgPZ7P8iGVhW/rYomo1pG0aamEiptg5/z8O2iJerZ97p9B63T5?= =?us-ascii?Q?vtNkUppFhHezMJl7EAH1GUO6Bj9AZNdvJxO4nH9nkz5vQUcRX+ffacnAaSdK?= =?us-ascii?Q?dM7nr7W4AN+iJDFXpMBtRXZb65xzFWUb2dOunwQZ51or5vNFGxR5YvK5Myw2?= =?us-ascii?Q?s/hDCaEpI4N4xTdKdpUF1JOF496yPdaEOAzCLTBnQ+fdmX+9ogqW8LzTD+q/?= =?us-ascii?Q?Jg/PVZouPvaoTr4WA64ISi9aICp2Q2FByCIrLOBWfts1IgaB2/7SeLqTeP5y?= =?us-ascii?Q?M7LeyrGZs1TLz4bX7R+HPdAJkNxUD6c1FREWRwfnEknZYzdVswlnOnrVChf/?= =?us-ascii?Q?qfrCT2orsCemwy/zk90b7mftX5CV+RuoTSqf6B81+tgp089jhZP0PcKyoNl7?= =?us-ascii?Q?dz020IKu4jaMv9EqZbi2Zt7xoM+bADYYTvLHcHzB308iNFHaaYW/2rR0A1Kr?= =?us-ascii?Q?FoBUp1ye5X8T+9EBCgUSzbHS1hEuz+jMcvoCtXilGmXMHvkUMwgyH0C8F5u8?= =?us-ascii?Q?3gDxFFq5uERCwfeJvhd1C9t0AO67O4a/BPQIvdNj9V7uLC5TOGN/GBoK46xU?= =?us-ascii?Q?AWbtqjZtk5Yz4vfVxz7BsyniGK2hMCg+G8V16TEzTV4MMpIs8D/GGfGohCTD?= =?us-ascii?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KTsrMTejO9qxReLjDkNZ61dcA0Uvu5E88FWrbPbS5gQOZAhWSvgnsHJjlIv0+f3lytLFk2BrY/YhFT6wYUqWl6h4MtSNLmKdOBV SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2017 06:56:57.5284 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7d97ed13-6ce7-4896-c30a-08d54776dcc9 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: MWHPR0701MB3817 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 Fetch actual data from firmware instead of static data at chip reset time. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_dfs.c | 30 ++++++++++++++++-------------- drivers/scsi/qla2xxx/qla_gbl.h | 1 + drivers/scsi/qla2xxx/qla_mbx.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c index 87a18a00d509..4f0415e158cb 100644 --- a/drivers/scsi/qla2xxx/qla_dfs.c +++ b/drivers/scsi/qla2xxx/qla_dfs.c @@ -127,21 +127,23 @@ static int qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused) { struct scsi_qla_host *vha = s->private; - struct qla_hw_data *ha = vha->hw; + uint16_t mb[MAX_IOCB_MB_REG]; + int rc; - seq_puts(s, "FW Resource count\n\n"); - seq_printf(s, "Original TGT exchg count[%d]\n", - ha->orig_fw_tgt_xcb_count); - seq_printf(s, "current TGT exchg count[%d]\n", - ha->cur_fw_tgt_xcb_count); - seq_printf(s, "original Initiator Exchange count[%d]\n", - ha->orig_fw_xcb_count); - seq_printf(s, "Current Initiator Exchange count[%d]\n", - ha->cur_fw_xcb_count); - seq_printf(s, "Original IOCB count[%d]\n", ha->orig_fw_iocb_count); - seq_printf(s, "Current IOCB count[%d]\n", ha->cur_fw_iocb_count); - seq_printf(s, "MAX VP count[%d]\n", ha->max_npiv_vports); - seq_printf(s, "MAX FCF count[%d]\n", ha->fw_max_fcf_count); + rc = qla24xx_res_count_wait(vha, mb, SIZEOF_IOCB_MB_REG); + if (rc != QLA_SUCCESS) { + seq_printf(s, "Mailbox Command failed %d, mb %#x", rc, mb[0]); + } else { + seq_puts(s, "FW Resource count\n\n"); + seq_printf(s, "Original TGT exchg count[%d]\n", mb[1]); + seq_printf(s, "current TGT exchg count[%d]\n", mb[2]); + seq_printf(s, "original Initiator Exchange count[%d]\n", mb[3]); + seq_printf(s, "Current Initiator Exchange count[%d]\n", mb[6]); + seq_printf(s, "Original IOCB count[%d]\n", mb[7]); + seq_printf(s, "Current IOCB count[%d]\n", mb[10]); + seq_printf(s, "MAX VP count[%d]\n", mb[11]); + seq_printf(s, "MAX FCF count[%d]\n", mb[12]); + } return 0; } diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index ea8f24e07409..2e0907994579 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -504,6 +504,7 @@ int qla24xx_get_port_login_templ(scsi_qla_host_t *, dma_addr_t, extern int qla27xx_get_zio_threshold(scsi_qla_host_t *, uint16_t *); extern int qla27xx_set_zio_threshold(scsi_qla_host_t *, uint16_t); +int qla24xx_res_count_wait(struct scsi_qla_host *, uint16_t *, int); /* * Global Function Prototypes in qla_isr.c source file. diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 956d121cc396..0c8ad7b31294 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -18,6 +18,7 @@ static struct mb_cmd_name { {MBC_GET_PORT_DATABASE, "GPDB"}, {MBC_GET_ID_LIST, "GIDList"}, {MBC_GET_LINK_PRIV_STATS, "Stats"}, + {MBC_GET_RESOURCE_COUNTS, "ResCnt"}, }; static const char *mb_to_str(uint16_t cmd) @@ -6273,3 +6274,32 @@ qla2x00_read_sfp_dev(struct scsi_qla_host *vha, char *buf, int count) return rval; } + +int qla24xx_res_count_wait(struct scsi_qla_host *vha, + uint16_t *out_mb, int out_mb_sz) +{ + int rval = QLA_FUNCTION_FAILED; + mbx_cmd_t mc; + + if (!vha->hw->flags.fw_started) + goto done; + + memset(&mc, 0, sizeof(mc)); + mc.mb[0] = MBC_GET_RESOURCE_COUNTS; + + rval = qla24xx_send_mb_cmd(vha, &mc); + if (rval != QLA_SUCCESS) { + ql_dbg(ql_dbg_mbx, vha, 0xffff, + "%s: fail\n", __func__); + } else { + if (out_mb_sz <= SIZEOF_IOCB_MB_REG) + memcpy(out_mb, mc.mb, out_mb_sz); + else + memcpy(out_mb, mc.mb, SIZEOF_IOCB_MB_REG); + + ql_dbg(ql_dbg_mbx, vha, 0xffff, + "%s: done\n", __func__); + } +done: + return rval; +}