From patchwork Thu Dec 28 20:33:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10135877 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 EE89260318 for ; Thu, 28 Dec 2017 20:34:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF8152AD58 for ; Thu, 28 Dec 2017 20:34:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D412A2B88E; Thu, 28 Dec 2017 20:34: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 584F72AD58 for ; Thu, 28 Dec 2017 20:34:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754551AbdL1UeV (ORCPT ); Thu, 28 Dec 2017 15:34:21 -0500 Received: from mail-co1nam03on0089.outbound.protection.outlook.com ([104.47.40.89]:60974 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754128AbdL1UeD (ORCPT ); Thu, 28 Dec 2017 15:34:03 -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=zvIa7I44gnFH8d+tNwCLinRB2N4F590S7x8uSDkOUoY=; b=gGjXsLwNu6aJJJAHL9Dc8FJY6Uun/CvA3tRFyM18auL6Tv/EB2ctkw/RVZ+PgY1U3M/DBcUoCEbCQO+jLA+JS1w98r74jPi0D4NNEdzw+YLbuL7fHCo7+gfjYtgt0a9zs9GXeLUXROcLdzC3HVCxTEHNKh1dtpC6fzaCTWmapTI= Received: from SN4PR0701CA0023.namprd07.prod.outlook.com (2603:10b6:803:28::33) by CY4PR0701MB3809.namprd07.prod.outlook.com (2603:10b6:910:94::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.345.14; Thu, 28 Dec 2017 20:34:02 +0000 Received: from BN1BFFO11FD006.protection.gbl (2a01:111:f400:7c10::1:149) by SN4PR0701CA0023.outlook.office365.com (2603:10b6:803:28::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.366.8 via Frontend Transport; Thu, 28 Dec 2017 20:34:02 +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 BN1BFFO11FD006.mail.protection.outlook.com (10.58.144.69) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.345.12 via Frontend Transport; Thu, 28 Dec 2017 20:33:41 +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; Thu, 28 Dec 2017 12:33:49 -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 vBSKXmIl002864; Thu, 28 Dec 2017 12:33:48 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id vBSKXmG9002863; Thu, 28 Dec 2017 12:33:48 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 15/37] qla2xxx: Tweak resource count dump Date: Thu, 28 Dec 2017 12:33:23 -0800 Message-ID: <20171228203345.2702-16-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171228203345.2702-1-himanshu.madhani@cavium.com> References: <20171228203345.2702-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)(39850400004)(396003)(39380400002)(346002)(376002)(2980300002)(448002)(189003)(199004)(80596001)(87636003)(47776003)(72206003)(81166006)(4326008)(5660300001)(69596002)(8936002)(48376002)(81156014)(76176011)(1076002)(51416003)(2906002)(50226002)(50466002)(42186006)(85326001)(316002)(106466001)(356003)(16586007)(478600001)(305945005)(110136005)(54906003)(2950100002)(86362001)(6666003)(36756003)(8676002)(575784001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR0701MB3809; H:CAEXCH02.caveonetworks.com; FPR:; SPF:PermError; PTR:50-232-66-26-static.hfc.comcastbusiness.net; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD006; 1:xU7R5nyjQvWK3w1o+VC0/r2UGsj8gf7X5J2rjV0FOAuz4BPsD6O6jumMRDBbMSPfi9Xg6IgFCUsXzMI3Xpaeb4yix67sGPfMoP3Bb0CoB3PjPw5YyegRYwzHFLKkY4gc X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 80b492d0-53a2-4754-d87c-08d54e3248de X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:CY4PR0701MB3809; X-Microsoft-Exchange-Diagnostics: 1; CY4PR0701MB3809; 3:dU6AN9vhd1GnWo6MUqBsTVu5b2ET2N0j1qJM+KgHle3cEKb+3Q12oS2zVXdpV7htrOf8cRn0W4mr2bSet/Z+ahheNky9G7ZF6gjjorNzJKPwHY2AY3xEIpWDg55ur8xJxF1ZW74bKv52fpI+H+6I9UH0pf0pbXX9MrWIyetYmZ45rJdmMcbvDMHGdrSF5cLPAOl4ev1S7e8wbcNNSSOAWlleLByptXHyM7fJi4xIgF9eSVkSYXfGlg6YOh5D2RbABCdjGt4VQ/gx2z9z+0nbcivpieAyq3UmtLV2Z9bqus9aNYU8hc+bkccDDnPQfQgRmQqoo7vJOXt6fZBERyPJ1A==; 25:+MzAnQMSoei3rX5GgWM//krDf+RVIcRD90d+VRoWUTfO8tDa74E038ohJuHhq3hLIU1N5XOiQpvBiAmBGO4AH9VOWVrBqDZ+kljkbZ+gc5cVHaha9nIsMGCzWexcrBhEskX9Tr3Dl3szpGlmkwz47zx4FdHy0Pa82F76kBmMMDQy/EOm2GOfCiHtjhVR8/JQcUCEzBgQ1tSTggSI8Z8GNuBgcPv2ybwPsLsmJZkf6FOedSF/PAigxOW/rfZRuEF0+L91q6Z3s+5isTGORU9d+U5u5yf1AHRwmiBLMEEUbiSPAB3BAlN37Gu3k1u24R20U1qgopt4DxP5zSWNzZrHCQ==; 31:7zEgo0xcc/WZx0U3xg+pd2bIpV6fSuUrk516xhHySayuY4fDKxfy51UfmBEnHKMyE5YkZFfKHg8Irh7HK+9YPngtNg7gzU4DPvamHYOydwDP8dPlR/Bi7R+wUlxkveVvvfcRepqnW3WDv/fltbmwuFhTifAF4ays+zL4tBiSzpyc/XHRDJrLiJcdfCttAbWmO2ARfztGxOXbYyi8bk7GSN0fGfuM4XB+8VLz4LFRox0= X-MS-TrafficTypeDiagnostic: CY4PR0701MB3809: X-Microsoft-Exchange-Diagnostics: 1; CY4PR0701MB3809; 20:CLhLXWJFyhErtBdZ0pi2kEePbCcmuy1JJLTmxDiwBkY2WSOKQlJ9ty0XUq64xbQ64QBZauSmiIpBOuHVfN7oIh1YL8ZpcVautb1nDEWNp9xReQ0EDZ0R1N4t5V3DZruHxCQPCb0WgSiMZ241RgFm4uSMNcjMl/eXV8fLlqEvFUhDHkR+YRqYWhgYS5SRh4q3DbsXYgApqGnOF3aCByhAlwh4bR/ocAncJfjuPzOSASAMmMy3xql4OYRPCd0xu2On1Um6X8OY4Dgd3o47P6ojHmI2kTVLifAVRYdBawrSQiGldsLoUR9f4Qas8b5lj732KPM039g/Uq+WSm3PJD7Y8cDPW8nTtiQiqCZHC2D3gCtiDqgIOrUrE6hhxX27Hvo4H3KERU/9qjUSIdHO/2rMWiOo15qwKIKIGmaY2cJupc0mck9gxW2vgbOnItYviBqaLtl1nbjES4KPIAL54iPo6DdMXYXTGLEoi10kDT/psSzxMIAEXdLX36Qd9/EfYjQ/; 4:Ga70G/5XTaCFDMhbmauhH/ZguDIW1maZYd4V2HA6nlw/LwqWCR5kCBpNZuXr+4ieXtNp9rQuYI+Z3KN7VLQ6dtjmpcMpflgTsnn8XkmtZfWl/HflTW9tayBCdWA2sWE39Tyog7R1rHtV5gSNBJKAa8tM4E39hnQLLFPqv3ZtoJrAO+gmkuuEcX4d+eBWihZbsiOxc/6Edq944jKLjpTQlC1zqH0JMY7+raOPXGgPY0YOsLq2uNHsFS6a/XEVyo10NlRUqBMtuoScQ/9MC9gUOA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(3002001)(3231023)(944501075)(93006095)(93001095)(10201501046)(6041268)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(6072148)(201708071742011); SRVR:CY4PR0701MB3809; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY4PR0701MB3809; X-Forefront-PRVS: 05352A48BE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR0701MB3809; 23:g700m5CuSES3yg905S9JT05FHfuBazOAYIhCMYv?= =?us-ascii?Q?jvqPXyyo8p5gbNlNiXcwud1luLxkLiIUEbo8NqtYs2636ZyVxLkhDXB9r0GA?= =?us-ascii?Q?KGS5he4d9edTe5wdAD7z70o8iHk++vOb3J9JC/+hA4Mdi7CCvKlNl3VafJzl?= =?us-ascii?Q?1FPp09S4/3EpCZTB+CB7iLRneSQB65aIMkAE5hjbzhgapUOWRQHEGtLDU2vp?= =?us-ascii?Q?ALTY6UbnvTctlyFPCvJhYT69v3KzfXNbSNULy+bLxN6hSdr7jDRCXD4WIWOq?= =?us-ascii?Q?w8IReaYUrhGmONt81VXGT8Wq7WPtC79zEjUlCDJei7NxIYDm4w9zNzOaQLon?= =?us-ascii?Q?wjDsWf94ScnofHCC/ssp9Dt8IJ5sVrC8nbRywNaxmS8i85rbFFYHeA1bqmyW?= =?us-ascii?Q?xA6iu3/N2k/30jlTBJrxkk+rtV4N70cItWr5+dKjnTbKPbGaiICZr7oZZhuS?= =?us-ascii?Q?97UY+N2nnOFtAsshcbmp7kw4xneqn2gSZhdMe4ELnPqRGWg/DgowECmhRRcE?= =?us-ascii?Q?lctgeFJaOYM/lSl3QByoFlqo8chPorHF8149Z9vaFabo2lyRABIN0WvglARc?= =?us-ascii?Q?7zhu+sBtPKBvr6hCeNubzFxygu/pURg16v2Xl4m3egzb9KMFGcWbgFwyZvhL?= =?us-ascii?Q?KSUiEvqQyH38vPSHWCNuf3dGlNb28K60F7d8tCCK0jCr+XxEpR6pNrGATtzc?= =?us-ascii?Q?Yh9qjzsHsTCHjY7ZBi5Or7ZxQJwLf30FhuF5cHQ3K0fsvivvgGAmMWoHggEP?= =?us-ascii?Q?73GyQUMA49CIs0ZZQzSNc0F1X8luSjtaDedrdQQ+spZpurC+u6uNQEg4cVWE?= =?us-ascii?Q?lM0ORw3JPIsG4P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v4pqVfubmZ60ud4VeKg7PLE62yQB8sNRqjsJrOs7MQS3TIcU+ocHst6/ZqAKvI7cRjHVB5+rB3dhCgRUVlLhJ8wC8rhLUzUTKxP/gMa7D SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2017 20:33:41.7256 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 80b492d0-53a2-4754-d87c-08d54e3248de 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: CY4PR0701MB3809 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 | 32 +++++++++++++++++--------------- drivers/scsi/qla2xxx/qla_gbl.h | 1 + drivers/scsi/qla2xxx/qla_mbx.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c index d231e7156134..ddb53db61fd2 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; - - 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); + uint16_t mb[MAX_IOCB_MB_REG]; + int rc; + + 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 7b61c96502e4..9d7b66abfc10 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 dea2e66be0b1..adc93a505f15 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -17,6 +17,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) @@ -6272,3 +6273,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; +}