From patchwork Fri Feb 24 21:37:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 9591227 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 2CC34601AE for ; Fri, 24 Feb 2017 21:38:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CC662894F for ; Fri, 24 Feb 2017 21:38:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1193128966; Fri, 24 Feb 2017 21:38:23 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 DABD22894F for ; Fri, 24 Feb 2017 21:38:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751346AbdBXViU (ORCPT ); Fri, 24 Feb 2017 16:38:20 -0500 Received: from mail-sn1nam01on0069.outbound.protection.outlook.com ([104.47.32.69]:52607 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751163AbdBXViR (ORCPT ); Fri, 24 Feb 2017 16:38:17 -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=PWOreMf+AeuocKpkJ6nLrjQhR7MUIu/Li+GrQqNfIgU=; b=Ws34xLPOYHBoIhMuiWrpjmCEf/lu7mPGmuGWSTJykCwLyC+RXRjZtFvTxc38RLSZrmeuzduXsE+A9Q5qbdevmBkh54uhB4cokTTf7EZzpddMrROjbbO5DbGbDxGCJM0l+8mfEOh+HfiYJpg5r1TpJUW0rjJd/1ybosUCGyl4Hx4= Received: from BY2PR07CA0023.namprd07.prod.outlook.com (10.166.107.18) by DM2PR07MB639.namprd07.prod.outlook.com (10.141.178.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.919.13; Fri, 24 Feb 2017 21:37:56 +0000 Received: from BY2FFO11OLC016.protection.gbl (2a01:111:f400:7c0c::184) by BY2PR07CA0023.outlook.office365.com (2a01:111:e400:7bff::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16 via Frontend Transport; Fri, 24 Feb 2017 21:37:55 +0000 Authentication-Results: spf=none (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; linux-iscsi.org; dkim=none (message not signed) header.d=none; linux-iscsi.org; dmarc=none action=none header.from=cavium.com; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by BY2FFO11OLC016.mail.protection.outlook.com (10.1.15.61) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.919.10 via Frontend Transport; Fri, 24 Feb 2017 21:37:54 +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.309.2; Fri, 24 Feb 2017 13:37:45 -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 v1OLbiiS003844; Fri, 24 Feb 2017 13:37:44 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id v1OLbier003843; Fri, 24 Feb 2017 13:37:44 -0800 From: Himanshu Madhani To: , , CC: , , Subject: [PATCH v3 05/14] qla2xxx: Add DebugFS node to display Port Database Date: Fri, 24 Feb 2017 13:37:34 -0800 Message-ID: <1487972263-3795-6-git-send-email-himanshu.madhani@cavium.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487972263-3795-1-git-send-email-himanshu.madhani@cavium.com> References: <1487972263-3795-1-git-send-email-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)(6009001)(7916002)(39450400003)(2980300002)(428002)(189002)(199003)(92566002)(101416001)(36756003)(189998001)(50466002)(48376002)(50986999)(76176999)(1691005)(106466001)(105586002)(2950100002)(42186005)(107886003)(38730400002)(4720700003)(8676002)(86362001)(2906002)(2201001)(47776003)(5660300001)(33646002)(8936002)(81156014)(81166006)(50226002)(5003940100001)(8656002)(54906002)(356003)(305945005)(80596001)(4326007)(626004)(69596002)(6666003)(87636001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR07MB639; H:CAEXCH02.caveonetworks.com; FPR:; SPF:None; PTR:50-232-66-26-static.hfc.comcastbusiness.net; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC016; 1:exdyH+aC97DpGS8QE9TbwqDKG2dV5LuLeXr1YlzNGwu+HnyvEEl6ZLjdJxyMuUi00yfuecUuMvpmNrHXaPc82OTjSH8Q5W9wBzp9HPfYLDnwUBSGVO7gYt2ZDhQF4BUWBs6bReoD4EpEL03R7DyABX0opkFXM0ecJ2XwFmPaSno9brmpmBgXx61yFsKYrTXFopZGv8NZKzNK8eXEZmv4bGeTmd9dYpV1+2E15SUgu7WFqLkXSsPTxIn1a9N6bXseoj537VPGLazYgD9UhDyb4YD5dNZ5+ayG/S2egpWcnlYd9RgczGWxsP3uJhuasNJwQ2gFrogR6lQkh1NjnjwF7ANf7kIR/PHTbmqod3WPxdColgqHc7rzISZv/7Zy2IFPxhDmWPyH/WjKI8Cncb46OktRnsBR5c1xMTczrOxkCRjOBY7YGcJ81bocO5YiIl6myrTSxblFZoqtaGqLgIduIum7v9rRQFdGkHvAjFPO+1QoJEbTFYI1oIXFiV2FEouPfBrnnHftqmqTjgE8+iDNKSpupAiREwhZZxxAIIbVvbw= X-MS-Office365-Filtering-Correlation-Id: 7a8ad41e-d452-4dbe-e68e-08d45cfd64b3 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:DM2PR07MB639; X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB639; 3:tP66TvZSmIC8R0/nL51DxViNovoEItm9fVigtuhqu3kyFRNoW15RinlxW634yykOrdmRJPwBhRVBKJF5qTLxZh8YswJ6R2X3LDpiix/2WGjtfEvjNwWCdEDqWhhA7lN/CxLQHam59aTvw9y3GDMe3w7Jdp/YZkcmhk28G2qawJZQMkNNdchCJqlhrhriVZdKlQmkGamwKjHdsHhir5+3EqKgH9I93rKn3VRGUUU/ZTVWC6D2kHFMAy6k6hMMrC56FhDGQ+M/lNo8V8ZDAEzoNm8LOJpRX/qNRTN3wpNNIw5bCWBrK2Z0t52nmYeYrcVSudlARbqllGIbwCgfz3fEelBI1h7ZFdUXIZkAdt86ib1Wf9tf/yOiQl+cDAAqFjih; 25:tsbcnFK1NuaSyutoJCLpcyLHWLrdiYZjkTU0pLqXyMs850fkOCzyMLcKmCY/QfZlsA1j5l1Jo6SZHEJaS4RDk5Du9Rp1gafCfT91cmQ45YQ5ObOKAHtVvMZkGs33FbL3rboDy1gewQlGga6w60shXHUnnIRPl6VUjmjqBlBcoaYt4p8fkKoODiL2EoRigbwepLq3CL1hc4XL+rwKbzlyXbC1dyYa6+Xg5MNmUwFUHkNxFYFr364PUK7f+yo2NpTqlM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ange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(13017025)(13018025)(13023025)(13024025)(8121501046)(5005006)(13015025)(10201501046)(3002001)(6041248)(20161123564025)(20161123562025)(20161123560025)(20161123558025)(20161123555025)(6072148); SRVR:DM2PR07MB639; BCL:0; PCL:0; RULEID:; SRVR:DM2PR07MB639; X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB639; 4:dbd1Ho+lhYA1iSYF3Oe5m9jdm7Rbh4eSrFK1awAS+EGx38eGaZb76WFpvkv9C55Ca5gLx4ay8+CNrE0lyRnT9jGrb5qS02QN8dDfTGppnvn948ufHRAIfwgxegl53F5pe7ovgvDNYKG7PGUV4UbCr38QkirbZWJXDXA9eN9B8N2nzAohDJdUEVXbf6C+q3xrebz9IHDgKyYfIjE+HZGkl6nbhytaOlMaJ85oZ1h/3eQUp4peLdY5Tww4v23rhEiivoprWNRE2uOhGBzx3FNehtwGeuOF3v9I4lq5vVcjooK09tfilaGNTr6iNU071gKP2ND+59bJCd+AfygRa1FlVOYykXOV1sed/R1r5P0klNKkTnigfSEOkYwG+Wfk7bDpccRVp7s3CpryeTJQa3DD7Yge1JHsHJrReV9U/Xvc2qYDbL76r8QhoZVhKJDR5dg2nqWQpBp8ZtRVifaVZubVcPnGXTcDIz+d73fITL81QdoDSZw0HTdNvKktew85atxqRXQ5Eteu24M3Rv0FxFhOt9Ffe8dQUK+4qyMU61V2X1nYVuxFFtcWPDjEDGcqYKEb4pZ+lv+C1gJqT6FYcf1fYTXurr1USei8tGE3VPT1baoqUU6xYe5Xz3KrdmF28H0dWtsrIdpc9/JCam89uBPI+kilAuvgV76XIn59kXVQ5XmRIuOP7/PT6zIsuPizltzC+0F+u+APYcNVcjjuakP0BA== X-Forefront-PRVS: 0228DDDDD7 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR07MB639; 23:Cy/ihoiBOUmzENLFap0S9ljnmsQS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skw6SwFU0X7Bb93UrRpQ8j+rOGqwlKUAxCnYgXf7SDEy/F+c5zHzGeMuahz7jtssS6XXqeS1Xs75rOG3uD5qzXric+OVdZV3kQqFmI6NVglh1DXJcX9ivpqmbQo+5eLavmr+W/DkR6Chde3B6WDcjHYCCz4LsYz9irj0zqo2EDpEzhrABS9Z4epKk95R1SO7JK1Cr1ugpueO1gbS4YioSTlwl2eoup6R77t7dNnnDnadNAFIXvHCQBZ1Mr7TzTu8UHIaRIx+P12TEHxITfexQTNjeoFZtayG4sTyTTexhETWGAnKgsZfqEfB/ZfDrRGP9Ad6axyYQe0fdY+Q== X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2017 21:37:54.9891 (UTC) 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: DM2PR07MB639 Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Himanshu Madhani Signed-off-by: Giridhar Malavali --- drivers/scsi/qla2xxx/qla_def.h | 2 + drivers/scsi/qla2xxx/qla_dfs.c | 92 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 90 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 111861c..1fcd829 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -3278,6 +3278,8 @@ struct qlt_hw_data { uint8_t tgt_node_name[WWN_SIZE]; struct dentry *dfs_tgt_sess; + struct dentry *dfs_tgt_port_database; + struct list_head q_full_list; uint32_t num_pend_cmds; uint32_t num_qfull_cmds_alloc; diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c index b48cce6..0fb33e6 100644 --- a/drivers/scsi/qla2xxx/qla_dfs.c +++ b/drivers/scsi/qla2xxx/qla_dfs.c @@ -19,11 +19,11 @@ struct qla_hw_data *ha = vha->hw; unsigned long flags; struct fc_port *sess = NULL; - struct qla_tgt *tgt= vha->vha_tgt.qla_tgt; + struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; - seq_printf(s, "%s\n",vha->host_str); + seq_printf(s, "%s\n", vha->host_str); if (tgt) { - seq_printf(s, "Port ID Port Name Handle\n"); + seq_puts(s, "Port ID Port Name Handle\n"); spin_lock_irqsave(&ha->tgt.sess_lock, flags); list_for_each_entry(sess, &vha->vp_fcports, list) @@ -44,7 +44,6 @@ return single_open(file, qla2x00_dfs_tgt_sess_show, vha); } - static const struct file_operations dfs_tgt_sess_ops = { .open = qla2x00_dfs_tgt_sess_open, .read = seq_read, @@ -53,6 +52,78 @@ }; static int +qla2x00_dfs_tgt_port_database_show(struct seq_file *s, void *unused) +{ + scsi_qla_host_t *vha = s->private; + struct qla_hw_data *ha = vha->hw; + struct gid_list_info *gid_list; + dma_addr_t gid_list_dma; + fc_port_t fc_port; + char *id_iter; + int rc, i; + uint16_t entries, loop_id; + struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; + + seq_printf(s, "%s\n", vha->host_str); + if (tgt) { + gid_list = dma_alloc_coherent(&ha->pdev->dev, + qla2x00_gid_list_size(ha), + &gid_list_dma, GFP_KERNEL); + if (!gid_list) { + ql_dbg(ql_dbg_user, vha, 0x705c, + "DMA allocation failed for %u\n", + qla2x00_gid_list_size(ha)); + return 0; + } + + rc = qla24xx_gidlist_wait(vha, gid_list, gid_list_dma, + &entries); + if (rc != QLA_SUCCESS) + goto out_free_id_list; + + id_iter = (char *)gid_list; + + seq_puts(s, "Port Name Port ID Loop ID\n"); + + for (i = 0; i < entries; i++) { + struct gid_list_info *gid = + (struct gid_list_info *)id_iter; + loop_id = le16_to_cpu(gid->loop_id); + memset(&fc_port, 0, sizeof(fc_port_t)); + + fc_port.loop_id = loop_id; + + rc = qla24xx_gpdb_wait(vha, &fc_port, 0); + seq_printf(s, "%8phC %02x%02x%02x %d\n", + fc_port.port_name, fc_port.d_id.b.domain, + fc_port.d_id.b.area, fc_port.d_id.b.al_pa, + fc_port.loop_id); + id_iter += ha->gid_list_info_size; + } +out_free_id_list: + dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha), + gid_list, gid_list_dma); + } + + return 0; +} + +static int +qla2x00_dfs_tgt_port_database_open(struct inode *inode, struct file *file) +{ + scsi_qla_host_t *vha = inode->i_private; + + return single_open(file, qla2x00_dfs_tgt_port_database_show, vha); +} + +static const struct file_operations dfs_tgt_port_database_ops = { + .open = qla2x00_dfs_tgt_port_database_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static int qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused) { struct scsi_qla_host *vha = s->private; @@ -281,6 +352,14 @@ goto out; } + ha->tgt.dfs_tgt_port_database = debugfs_create_file("tgt_port_database", + S_IRUSR, ha->dfs_dir, vha, &dfs_tgt_port_database_ops); + if (!ha->tgt.dfs_tgt_port_database) { + ql_log(ql_log_warn, vha, 0xffff, + "Unable to create debugFS tgt_port_database node.\n"); + goto out; + } + ha->dfs_fce = debugfs_create_file("fce", S_IRUSR, ha->dfs_dir, vha, &dfs_fce_ops); if (!ha->dfs_fce) { @@ -311,6 +390,11 @@ ha->tgt.dfs_tgt_sess = NULL; } + if (ha->tgt.dfs_tgt_port_database) { + debugfs_remove(ha->tgt.dfs_tgt_port_database); + ha->tgt.dfs_tgt_port_database = NULL; + } + if (ha->dfs_fw_resource_cnt) { debugfs_remove(ha->dfs_fw_resource_cnt); ha->dfs_fw_resource_cnt = NULL;