From patchwork Wed Mar 15 16:48:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 9626205 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 33E8B60244 for ; Wed, 15 Mar 2017 16:51:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2683528669 for ; Wed, 15 Mar 2017 16:51:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B7E32866C; Wed, 15 Mar 2017 16:51:50 +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 C41882866B for ; Wed, 15 Mar 2017 16:51:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753037AbdCOQuc (ORCPT ); Wed, 15 Mar 2017 12:50:32 -0400 Received: from mail-co1nam03on0089.outbound.protection.outlook.com ([104.47.40.89]:46880 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753136AbdCOQtb (ORCPT ); Wed, 15 Mar 2017 12:49:31 -0400 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=x2hw3Ub3xIHgvl6ptH74WPNkLqitKbNHml6FZOj/kf8=; b=Bn0DTKOv5oKM/kK2zZRL4wwyVqNQAQ5UWij2IL0TctjE5q2kTw8RMxWwip3pVdeS9fa0Dm67+JOY7JhU1C0QX17/gbxsQgwDQj2I8rpgkVvzmlNr5m/Tg9M608Xst1r6DEFi97vqA2f6O2NyksVJo+u8WCn0/4qFosg+IvtZYmo= Received: from CO2PR07CA0018.namprd07.prod.outlook.com (10.141.194.156) by SN2PR0701MB718.namprd07.prod.outlook.com (10.160.14.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.933.12; Wed, 15 Mar 2017 16:49:24 +0000 Received: from BL2FFO11FD042.protection.gbl (2a01:111:f400:7c09::172) by CO2PR07CA0018.outlook.office365.com (2a01:111:e400:1414::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.977.11 via Frontend Transport; Wed, 15 Mar 2017 16:49:23 +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 BL2FFO11FD042.mail.protection.outlook.com (10.173.161.138) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.961.10 via Frontend Transport; Wed, 15 Mar 2017 16:49:22 +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; Wed, 15 Mar 2017 09:48:58 -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 v2FGmw74017334; Wed, 15 Mar 2017 09:48:58 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id v2FGmw97017333; Wed, 15 Mar 2017 09:48:58 -0700 From: Himanshu Madhani To: , , CC: , , Subject: [PATCH v4 11/14] qla2xxx: Add DebugFS node to display Port Database Date: Wed, 15 Mar 2017 09:48:53 -0700 Message-ID: <20170315164856.17255-12-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170315164856.17255-1-himanshu.madhani@cavium.com> References: <20170315164856.17255-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)(6009001)(39410400002)(39450400003)(2980300002)(428002)(189002)(199003)(9170700003)(86362001)(2201001)(1076002)(189998001)(76176999)(48376002)(42186005)(50466002)(54906002)(101416001)(8656002)(4326008)(2906002)(5003940100001)(50986999)(107886003)(33646002)(305945005)(36756003)(6666003)(2950100002)(47776003)(8676002)(81166006)(105586002)(50226002)(8936002)(80596001)(356003)(38730400002)(5660300001)(87636001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR0701MB718; H:CAEXCH02.caveonetworks.com; FPR:; SPF:None; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD042; 1:+DqlLwnv4ZsIMPfRWzdpYdiRK9HdpueQpX1+FxqWtlwfQ4gXhGkMSG3Hw/RQEFRDe4SVKlLc1IRIJYApydFAe10niuxbVLcVN4DF9r4MreVwQSfibKRE8894Ea1EiRHJXfl3gPp87Q5UoPUIE3CrSFCdFdhvgYCYnVaaPWnO6mZUCZZHwcT8/m91GqXorkFl4Gh8w76jPgS8NignN+OL8Kf2RhTC2vXte+EyLzr6PVoplKJtUgLQOMv74JROVQPZn7m4IREyJ7A7ce8kk2hMbyDqviykXN0AoCS9mpESIV2LXzkGri9PW/B02/Hoelb+zPmv5ZttZJVv+ZD4yQ989+wDbBSoc2ZB9Ct6xE36cJXUhYuzk1DTAt+H1Yt8jzq4+iN4r5KYNmeovb72XRywnnNHZ3+aTs2UilNDCuehiWQvj4Sd60oZUgkNyU+l4XY15VN6U4h2zytOHAVcfh6kNeZegJGMpj8UUPjCV1h8i89viALaIw9790vBGte1be4B4iuPg9M1tUTRGoU5EzSuS6XZgT6pMWvUwqJmFNLn1oU= X-MS-Office365-Filtering-Correlation-Id: a57a3265-97b0-42bd-73bf-08d46bc33bd5 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:SN2PR0701MB718; X-Microsoft-Exchange-Diagnostics: 1; SN2PR0701MB718; 3:9Abw2iWtX31T+xyf0B2XNidIDb6ssZ/oOOHXJjSiQDq9Pj48M3T3AXJR/Ub+i+VfaO9+l572teIXwCJhrGRdFlAoRG9ZP+AXEwNff86E8/MjWllaYH6EeVBI4dQI9ssBbLNUPNkInN8LrrusfCw65V94q4yWuGfxqz9X6SRw4Mb7TL1dwlsKzYyKRxRTFk6nKGrCYSq8UJsyXjfY9RZR7Bs2XcwNL/xGAvStnVXN4UEs2BPJvPuQDwYbnVur//p3tIrhlxGyeKEm7m4xrdFd8scSWLx5jiSMYa6EAZTL8BPxaKD2Puv23m/7Sj8QgD61p5aY00tW3vygXJZHbom55F8BpQsRfsMXJrQvEGEyWcqrLYex38yPiTzJf8rhhz6X; 25:wXHKDPv2HfTncHzMqTh8rmKep0GCT3zbdc50SP6HxwODKmPFc25bkREZ+32TjHSSoS7iCmx+rt/V5dHEAab7GrBN6EuXJPVwSX7CVWN5vOLEdT3leVHILQ240ObcrZblMG4a49LkfIfKe/Indfbc5dmbKGw9v3sqePPLjzKC4snWtyfCjqniMW24O7pxz1G4iHezMtS/wSGyDiBhhfCuHsUsDjPAfWVroh78QUkWjXp8HqAV8J0XH0UqCqeUYt4VggLphWCFVmXNp5EgejUyOq0YzIFyQVW07Ai8o/A51iql+Ix0gfZm7pOwjy4ZjnZq10U/TykJpU+DtkOX+vye2J9VoxoHVEEIl+0HBvL2nyoryE0A6qmXow449HclNekiNSomYQwQSBL1sZRSw8PdqLYSVj2RnqG6ObRIW04XeFo3xPk3aRStmwp610CO4GZHUBjLjrITKsN4fkKJ4l8BKA== X-Microsoft-Exchange-Diagnostics: 1; SN2PR0701MB718; 31:ugkZ4v7OZrKnuGEi11Hhx3JrmgkRuj4hRtxAZOb8IE0r5VEflxLXJGwf9/Pq9ylWJXZjCbkN2lEK1Nw2pPxymuUmO9TV1aaSM2KflqWkT/RJHxEiK3STcgsSIylpJjQMZp4bskuzRioWTPMw6yPRx8eLmhsYWlnK8OUa5VghaIRZIrCCKEAm6dFYTBH8k+PpCrRIblKFkm2Dz3e2mdctBQ8UrV+Rx0vp2IRGzs4/2d8dn2ObPyvEB+b56WGpBHQjucEUXg2tuj12bgre4AN4DVrZ0BmmHBaZJ4q4tDLh2fA=; 20:JGW2W2iOQrUmF3nEKnw6KBwDA+SSFm2m8ptcY6N9puU3EH3Znce5RP1DgCLiGrr7mKb0lLav+tF8jm1J/NbJcs6i8oBpVCxnUOem2gbjQp8pGGGZ65m7GWS5fnO301HfTeeDJS4NM+ZT6wTkRsqvj6ZfWYww9dvs/js52nRB/e+dIfIc/+0YGzU9KEcN9sh9MsFiJRSfJqAvLLz49ny31Qzqa4MLUCdpRwD6Zqd1IJL2+Gii/qKz1XJgJLoVDfhfbqTOuhiRCbEEiHCGEBZNcvLKE0/F8+5r8wbDGCzCzLx6orafhvbe/5dNGAimHMHITkL18uOnXbYsV5hDIX5M1MyCIThwgv3FFL4LF9dLWh7SaAn8hO7ae5nlFvyaQThU6D7rtkdykazkxcVTIvC2KFHi8hprmrdM1lzJmgxecAi1KJj96YhGzFQHxegoz6wIn2fBdmmvGIShwu6/2ApF8PYjDQxTbU61B6auwCNshC6gSKDuko4j/83kD/WMQlOb X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(13015025)(13017025)(13024025)(13018025)(13023025)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123558025)(20161123562025)(20161123560025)(20161123555025)(20161123564025)(6072148); SRVR:SN2PR0701MB718; BCL:0; PCL:0; RULEID:; SRVR:SN2PR0701MB718; X-Microsoft-Exchange-Diagnostics: 1; SN2PR0701MB718; 4:rKcRDHYhW5uF9xHIf8xjZP8R4bUDh+ALU6evSkSBOnUQfH3yBSRFSFPyQ27d8cwH/fusLPfE54YiOtZ/fKx9TX3JiXzu7eHJ3fOlr7YY+7qQsVYEEkxTKGSO5VLCgLhpGlsbZJ/7mSOXYyzb1SY9iuaV5Q2fLV0jKHU18t78nQ8zQcRLFK9ybizntdEQAmnnQztfTq1XDRblcurGXLlTTeGMHCTW0S9Sy7YeijpjzHRnaLqEPoYZ9tp9e9RKoai7QaelqXvUVIaE0QZ+uWGOWcURiT0DQ5kmmuKYmkgFijmREsQOx+r1WOTPl0srWhwgcYT9PpIYugu5IJWXo+JCjUxhrbW7wr8RlX46eXaLaIr8oqj7uwsstjov3E6325tyRQO+9aEB8FLrWH2eyxCgqQQrdZx9fBKNoSFkBzG/tI659Y2vWAv9ugtIw8TKhIwEx5ryBE8XvV515QyunwLshdAeYkVjIwX7kMx/59at/p/Ihwdk/4qQ6+mo+t/7qT6oQgIlFb00wTXzhnC0Qrn3iqdvKdHkvpeZW8qqEOYAMdPo2/bswoAlJJQDowgW600mQQffBLK9IjFHdFYB5y/45kC69vBUGjnnidVRG1/z4yfoc9xp+cH+H3HEzEjuvRYVCKeZuf7uL2o34p2WEoanrDgMSWKAhib8+uLovYrWb8TmCAlO9+z19Co7epKpl5cOPYQLSQdyIquFmh8CC5D6tQ== X-Forefront-PRVS: 02475B2A01 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR0701MB718; 23:92qqS5D5/14Nq2qquMO2HzU2tIn++n+Mb9+bXXg8?= =?us-ascii?Q?TOrBO104JmUw6CdazZjwngldE/3CvKmYXEYCZ8kA7TSBfIZr/Q7YLcHPoQdD?= =?us-ascii?Q?oWepods6nz07TO+hPWlkuhq+LWsFEFssc7MnUxhk7HzqpVpOZQAKeUQrQIRj?= =?us-ascii?Q?UGmEwzOr0hs4k3OQIAlzXGWYfsiRN2c3RrvFiCNkZin0jrJ/Lj7PI2Zo1PZt?= =?us-ascii?Q?wvsL9zuJTFrRtrpAmOKNDT6LfdPJNpvZLeQ1j3ieret59U02UrCZPeo2P5lQ?= =?us-ascii?Q?OQRKVXKAx/a6QhKREmCbAj7nlwA7JNNXWq2BcW85C4P9ID2sFL2rMovwpcMY?= =?us-ascii?Q?YzXIzJzDk9SoKbGJTJBXdVa5dOkkkfKClw6VOW7vpti/+wYDFfJDfY8Ep67m?= =?us-ascii?Q?ATH02M808RSh9RPpTjjyvvDTIojM69Mm6lplPByugxGfTxzhaYWkAIZUVq8K?= =?us-ascii?Q?+e7DW+696yXsc5CMttxt9zAfHF5966GWxTf/aFOw+hhyjoRklBkSsgI9Ii1h?= =?us-ascii?Q?YeULt4Uji2Ww4JyZG3r0ZJn3xW6/V4wsKmrMMWiusRPN3X4GT1uLeqODv7Ku?= =?us-ascii?Q?YXO9MwqW08RqPody647mKBOgtkv75ZBcWgKp2M0sw83ewbhzL3o4l1kXLGU1?= =?us-ascii?Q?9FhtT5UX6ZwtBq/zzIFnsyBHUkgtz19XPN6QR2opJaWCjHfGB5lDbPTD9EM1?= =?us-ascii?Q?QICfJ+oIckR9WR909JIs5B+KXlsrCMpQHYOU9hCcCnzE4+g7VTALYC80BoU3?= =?us-ascii?Q?wD6PnIAmGXFi+h1kihIqOwIyGd0dWCTNZMH0W7Cd7OJ75+PlmZsVQmz2GpIb?= =?us-ascii?Q?kkZ+3EFcgwvoINCqYSSGRgSdpuS0yeP/ImgQ19xGMEnAK+8+zzrucFzat8Dv?= =?us-ascii?Q?NfU/Hgvh0MEUJLAVPRROx/dCvT109M1UFhw7xIdEhpXAdkF9b5a9ysKd4inm?= =?us-ascii?Q?nmvUPS/eKgMEmYyEVMaA9wyZqXLmgeIID1LTzCaw36Vz8XfvbWuTKVf61rvj?= =?us-ascii?Q?QiU=3D?= X-Microsoft-Exchange-Diagnostics: 1; SN2PR0701MB718; 6:bpivg9ZLMcMAoXkdDQiZwpJXu5EDDlellLus55OjgvYlXdOETbFX8LER1G1QMdHiVKZxdJlxxCk8LBUvAtL9XvOYuJNshmswLIsgd2nfYWFpFKK1zWh5gcrAg81+UouajYzjQDw5PsANPLwk6OR5lfxM+7Ut9krSs5bLwIGDaWa/RaCLgbl52GnPwbtqCY8MW/Ke+UJlUS7yQO5QCjLGFF2Mm3oYCHWyVf+0/hFwBBdl+IIFV2C0lJ44tfiu77D+dIz7NpFmSSBGTjFFAtcAnQEa84bIfK6BZiZEmZtvwiCmaDRPJPqQfBm8ieFKKfbPCqm4KRhQArhIMRLwZGCEd58UNw/0uQJl0Sr8aWWECH6pzfAZdHhB4hx1cnbmwFlodWKWVL8nwi2rANs87bsshw==; 5:dvD0mWSxOgT9M1MhzJDlsIoZMDcFNJsNAEdZI35/6CaNKZP84VgtjMU4twafkkyaY+MdAEosu4AFjbORCWhiXc1cdjyHw+itDROJTL5cvDf/yXZcuyz0JDM+HR+SFYDYXnRKcZpVnzsElF6AC4hIIA==; 24:JmyDGXhY+kpPjCQf24JTnMNNVcuwKN8JTx+ZUwyulRNBdK93AeIbhdvglJEbda/7K2TC1RSfxUvfkmtbyFJP26KIeXyzFTnCJ/g6LOeAdfc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN2PR0701MB718; 7:aYtqAg7/9iQeNYoc3OWFtIEzEmpfWHoSPrOvlplC9DK89go5HvqzkSMLjvgseyX1qMLq3wGwPxDyOENlfGOc1TdKn0wOzOBt/jfyoutNIAUJFY0j3ym9Ihte6GggUa4XszFZAEuStU9ozrxRJeqLuYViVEYg/756j24bZ3lusK933uIyKgdQcngkfvckSFtjrDXxVwqmicn5dNlDXXo1gY+7q7uQhLeTYy9plYHQRfWGLPM0ri9G8Kc1pVhats/2QB6FVsjEO4pblbme8zNoXpZHcULmsYwDzvarL1K9i/4xcb4Pkiz4kutHJmC5l2P5IgH7BhhyYhbZWMQvaALMmA== X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2017 16:49:22.9133 (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: SN2PR0701MB718 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 ae38b7a789b1..089480280558 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -3300,6 +3300,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 3b35905619b0..989e17b0758c 100644 --- a/drivers/scsi/qla2xxx/qla_dfs.c +++ b/drivers/scsi/qla2xxx/qla_dfs.c @@ -19,11 +19,11 @@ qla2x00_dfs_tgt_sess_show(struct seq_file *s, void *unused) 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 @@ qla2x00_dfs_tgt_sess_open(struct inode *inode, struct file *file) 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 const struct file_operations dfs_tgt_sess_ops = { }; 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; @@ -296,6 +367,14 @@ qla2x00_dfs_setup(scsi_qla_host_t *vha) 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) { @@ -326,6 +405,11 @@ qla2x00_dfs_remove(scsi_qla_host_t *vha) 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;