From patchwork Fri Feb 3 22:40:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 9555223 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 19C6C602B7 for ; Fri, 3 Feb 2017 22:42:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0593E27F9F for ; Fri, 3 Feb 2017 22:42:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE8732815E; Fri, 3 Feb 2017 22:42:01 +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=unavailable 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 782B827F9F for ; Fri, 3 Feb 2017 22:42:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753040AbdBCWl6 (ORCPT ); Fri, 3 Feb 2017 17:41:58 -0500 Received: from mail-bn3nam01on0042.outbound.protection.outlook.com ([104.47.33.42]:14259 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753011AbdBCWlt (ORCPT ); Fri, 3 Feb 2017 17:41:49 -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=JdPbmU9k1vj4HpaEnX1Q+egdABaArTyyNiYVoaW2Xa8=; b=CIC0EtHShLca8MdAizgahvUEqEh8Vj9iHlWDImhoSHORMSPLSE5nFjNR8a86q1MYONtFpzXnwFD7DMkQdN2SkaSPB0+mkromjqSuEdLA/7LibmcacaF8nmfxUb1C0xt8gRJddbO9nd3Hsza2q4boK4M6Q8X8QMT82B9TOmcZKkY= Received: from BN6PR07CA0017.namprd07.prod.outlook.com (10.173.33.155) by BY2PR0701MB2085.namprd07.prod.outlook.com (10.163.156.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.874.12; Fri, 3 Feb 2017 22:41:36 +0000 Received: from BN1BFFO11FD023.protection.gbl (2a01:111:f400:7c10::1:128) by BN6PR07CA0017.outlook.office365.com (2603:10b6:404:3a::27) 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, 3 Feb 2017 22:41:36 +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 BN1BFFO11FD023.mail.protection.outlook.com (10.58.144.86) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.888.7 via Frontend Transport; Fri, 3 Feb 2017 22:41:35 +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, 3 Feb 2017 14:41:25 -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 v13MfBMO002356; Fri, 3 Feb 2017 14:41:11 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id v13MfB2L002355; Fri, 3 Feb 2017 14:41:11 -0800 From: Himanshu Madhani To: , , , CC: , , Subject: [PATCH v2 05/14] qla2xxx: Add DebugFS node to display Port Database Date: Fri, 3 Feb 2017 14:40:46 -0800 Message-ID: <1486161655-2307-6-git-send-email-himanshu.madhani@cavium.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1486161655-2307-1-git-send-email-himanshu.madhani@cavium.com> References: <1486161655-2307-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)(199003)(189002)(2906002)(106466001)(305945005)(86362001)(92566002)(5660300001)(356003)(8656002)(69596002)(2950100002)(2201001)(50466002)(626004)(105586002)(33646002)(48376002)(47776003)(4720700003)(6666003)(50986999)(4001430100002)(76176999)(8936002)(101416001)(42186005)(81156014)(8676002)(38730400001)(1691005)(189998001)(36756003)(80596001)(5003940100001)(107886002)(54906002)(50226002)(4326007)(5001770100001)(81166006)(87636001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0701MB2085; H:CAEXCH02.caveonetworks.com; FPR:; SPF:None; PTR:50-232-66-26-static.hfc.comcastbusiness.net; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD023; 1:bbUViGqCDaNKSlmoWGuNNigyAiuxGVfxUSV6NTBHsT0OkWCaF5iQwhzmhXlnb4VSIseDq0A0KSVwKhEwHnE4tRqTMPXTa1bToP2M3/5bISHr6tTH4QBgSNz5dGtfYw1oZRM9HYWlPj/SCwy9p1PTyLNjOO56bqJkiuljTmUi5qSbNjHhQvKmTvKJy5xekKBaISFqnKPvYAUAxjjOhV59YECHdM74HVGF4sSKGbaMd7QbjesQKQGg3AOc9uzNPebTjBEr4FDql2/MNQjjrxtC89JKHiserNCzszyyqrANT6lmGA/Y2x6i8LK8KKP5Q8FJXW3xO6ab/8jS+94BYjov1PUAslrqA5MaN3hd4OXXHlk9a5Y3Qw+FWEwesSyhR1mAR2m0IbaMTDTPmqbCNblDfc50YI2LsWKKvt2yLh65CMacOKgciA16ulVB6RbKOsXBQNmcluMUNGwu+3e2coDZY6pYGNM0uuH8CbXdrZM4cR46iAV78yebJl2qBDDSgHCCSNhE7znBlJhhG3foAEKcwjVG1hJEIqMHyXqSIegRjk4= X-MS-Office365-Filtering-Correlation-Id: 3ea41a66-8dd7-4707-a4d5-08d44c85cf83 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BY2PR0701MB2085; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0701MB2085; 3:f9bt2HZ2+v9SAXf6Jn+mu1IG64OY1u6Oq7cvfftDBVh7lEKExyCWHHB5QihmcDW/PbrPLw2ATAt87LtYNlepjPyE7FqEgTYiav8Hk7Vum5tcL4ca9xwJt1yGBO6ZcHoOxPkFEAoO1ebV8MCfFhLvaBh4dF8cI72dmcu5gBOiPB2Vs/wB7iKwJXxo4iNO73Ifkb7mOYBIHEY4KauNKb9CwfuVDGe2vFRWTs+dyEmIFR/skXKbdkxJHPL3HNSb1++Z2Du/qBXXCGrAqSWp8mXuZ9yWNI5p0HpoMoOLvMFcJML91soPY54ebWUIg05i2FnyHhbBcN7kfKp3CWHjzEVwR50zG7PD/kiyFTq4FIn5Z3Nd8CL0i1/Ad8BbPfTbcbN7; 25:uwmJoNmMshOlFlhqQ1MazOo/znDvZ2cs4NVrOh0h2uJUtbeqv5gywWlOGs6bJ9R2odS9LQP3ajCmuJcraVWS7WEapxuIbJEfF2Sj+q+ScbIhRxj+ILXHKJ44ygXpMt4IVh73cyGfpgBKgKdeDFGUzCCiAN20kXaEd1BLhRI21I2oqm9lzbLMmyVsWbUlzFW5zrHX4ZCPx7de7cJsF7Ahn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pmvfW3J/SVV1NtLOmgsGXUQ7/GLHlY4XWSd1N4Xln7RH9+6mpB+7WnI1fTEpq0VSk7DD0 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(13024025)(13015025)(13023025)(13017025)(5005006)(13018025)(8121501046)(3002001)(10201501046)(6041248)(20161123558025)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(6072148); SRVR:BY2PR0701MB2085; BCL:0; PCL:0; RULEID:; SRVR:BY2PR0701MB2085; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0701MB2085; 4:szudCuRDaD/9JFgr9d5vILUbj/GsAQ7DS7yFgSxKy5V+WzVlBdld96k6BgZAwq7M7EDuZJXEFSXLFhuIqimNMgOQYqhz4jjTuI2PaAWIw7XsmrxQN4TcbQfaKBracqLd+CIUhiv6mj4Q0qRzrWSkrMhRkj2d80uIKvMUboPgZutZofNMNoY+Zoixyf+WHOnuW88QyGti2djB63AsMDj4h041d19tAzW7aKs2evPBfJm36LNaVEyjAFKjKHBWlZIbHV0d6MSdZErOCk1Bn/CpWFn6Tj9GTvpmfcfj1hTlB6QlB2pvbUHw+VBg6UGnKpnYiKUjbjBcRrPkqWT5+C58ZVaktL1h7X9z3Po4J6SqdM+YrPxZFFmcuROLR2Zwm2oONmVvxn4WvxEfWRZMDH2pA0HFYd6nNzgk+SJPbbC4rxddoH+w/Q4tHIJ8JWt3s+6Kui7gmHGrq6WLrDHKWhlRTtsZBQTTKWfCoW6hJ6HGRmnj9y+B+cQlsDQmTU/N4UQP7mCiaWh3Tn2KulAa+GzSVxnaQTKKxJgxQ15ZBXuq6siLuS0sj9APF636FiwgQJMw5pBAcNM4vHFCEsS70HpvWcFINxP1ZYREx6wgLjdfGO1BPRmUdpJssjLRpQ6lWCONbYXh2HSLe3thQRUytoFAKVlWmomL2M7waxSPtxAA44gMzfNF5FTEY+VHY5HaUdtQyTQsgwuZaN1SljRgrDLoBg== X-Forefront-PRVS: 02070414A1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0701MB2085; 23:p3/cMSvAYbxUYym0wTq9og39mXKQzxwXZMFXeUs?= =?us-ascii?Q?72OHsIpZkyMleRARtZsD8U/coANgRlQZ8UGEvxkvQII1C1eo+8cNAsbNNDKk?= =?us-ascii?Q?gYORmNrOKIcb/bBsxnZNTM7QK/hke+BeyBY/mavz6N8A8uEBw+Q4W8JAvcDe?= =?us-ascii?Q?Lt++0dAt8LQTVO9PgZRW0g8qiN2ocQqiEBxLZi3NXkPiAaznIi82z3bZ6MdL?= =?us-ascii?Q?J1nMPx4CSbi6qv6ZROAWk9agp77WZlqxkIUDiOn9GuJbfksx2pmDo5Sw5Nvk?= =?us-ascii?Q?ukqUeKoy1zZ8kJH+X9aFrx+CazG6kNBtHu1gKjb8yykSoyLs6h6viPJLyxBz?= =?us-ascii?Q?Zifpr0Nb3R5TBLnV9MuCq/OhRGGjjlZuAfh9/QJCtLIEWS1zVHOvTJ2oFP/O?= =?us-ascii?Q?tyrBbCw+2SRkPWzQx81U6t8efk1L2SkhxCncdErWytyGSM1oHBEL5+wNxVIs?= =?us-ascii?Q?D8iZxNukxG+4AjRVkd5+1fmLn7VicbOT/N9VydFyEnVOWzyCXDXX9YE/8DnG?= =?us-ascii?Q?M3EPjNJEHAlg3QCJ/D4rsePCrEVt4aTU1niGGFMd5/U3UyeGa9746MJBhR93?= =?us-ascii?Q?2l/jYEhlwxDBAJhBIIiHOhJLffjy3wmfLQ8BiJfckhTUmQ2iGSX6xb3zXmEB?= =?us-ascii?Q?uz1q2S1PW3Y/EcDO/5qwBzoqCPprpgULgumi39vjXwPv5lc7UKyT6dqDjA0+?= =?us-ascii?Q?zOd0F8/U8WJ8uPD6XZkjCx8t9DKC8kjYnLOuyWZALex4IaWaQfQClG49c/5b?= =?us-ascii?Q?EkiBO9WVn+kGWHJ3I2Mf3Sao13s085wj7mhzR0um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k0XsfJmkKkGjSK57pDmTBEcUY=; 24:q1jvL75bB7gQ0DKuFE01Bnl2Xe2Mq3PpfMCV6ApJ3yGyoy0+kUo8KRQB/PUPTJw3NjDRefw/VnMaplIbFRYPw6PvXZaZRVYwA1yiIT7awI8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR0701MB2085; 7:Y7yR/TO/Snhq3qOLLsNAEWPffaTiqosjCNMT4XPfmr9WndkLaqaRqp3UJkdDK2Ul9Js625YbJWRx1Xmu+pXOghtzRNIcbuOYOxiMkoFHz4CjBBHVt6XI9ltuYG0XjYc4fQ4SEuz0hnXQsWLWAJr2hopz+lqRR2Nghvv7L4Hr9Og/3GEhWjLwG7wckvEwmtbTVbFhXoGEpbL8Dz7No+j52Js2L1dHdn4LcLaJft0XVxd8iMNatFQWNyju/TRUjNxe1t+FLuvwtMJBxuSvs4xb8ilT4aMhWANJNAFkXQ9TS6zBtO3CHVoL8ubOH4NfeM1dmTttiL/VFf0u3p3TPx/gNVoGTa/px49RV2rsBkSjrkXR+26kF6TfWrQB2pe74z5/BeVxHwidtC4diJlM6i5KwOwcOl6mdclvHNLHfGHtYpKUk79dLkYym7hnWCCuwzDYeCT062G/uZIaOGotvcbQD/a6BTyGAyXfytd8/KaDvBMJk46nbWwsdZ5DWMk7D7nG1ielzooE59/VB/htnmnzAg== X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2017 22:41:35.8523 (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: BY2PR0701MB2085 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 f92977b..8bc1111 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;