blob: 63d7374dce779565e76fb4ebb521c7cb1af012c6 [file] [log] [blame]
Andrew Vasquezdf613b92008-01-17 09:02:17 -08001/*
2 * QLogic Fibre Channel HBA Driver
Armen Baloyanbd21eaf2014-04-11 16:54:24 -04003 * Copyright (c) 2003-2014 QLogic Corporation
Andrew Vasquezdf613b92008-01-17 09:02:17 -08004 *
5 * See LICENSE.qla2xxx for copyright and licensing details.
6 */
7#include "qla_def.h"
8
9#include <linux/debugfs.h>
10#include <linux/seq_file.h>
11
12static struct dentry *qla2x00_dfs_root;
13static atomic_t qla2x00_dfs_root_count;
14
15static int
Quinn Tran36c78452016-02-04 11:45:18 -050016qla2x00_dfs_tgt_sess_show(struct seq_file *s, void *unused)
17{
18 scsi_qla_host_t *vha = s->private;
19 struct qla_hw_data *ha = vha->hw;
20 unsigned long flags;
Quinn Tran5d964832017-01-19 22:27:59 -080021 struct fc_port *sess = NULL;
Himanshu Madhanic4234372017-03-15 09:48:53 -070022 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt;
Quinn Tran36c78452016-02-04 11:45:18 -050023
Himanshu Madhanic4234372017-03-15 09:48:53 -070024 seq_printf(s, "%s\n", vha->host_str);
Quinn Tran36c78452016-02-04 11:45:18 -050025 if (tgt) {
Himanshu Madhanic4234372017-03-15 09:48:53 -070026 seq_puts(s, "Port ID Port Name Handle\n");
Quinn Tran36c78452016-02-04 11:45:18 -050027
28 spin_lock_irqsave(&ha->tgt.sess_lock, flags);
Quinn Tran5d964832017-01-19 22:27:59 -080029 list_for_each_entry(sess, &vha->vp_fcports, list)
Quinn Tran36c78452016-02-04 11:45:18 -050030 seq_printf(s, "%02x:%02x:%02x %8phC %d\n",
Quinn Tran37cacc02017-01-19 22:27:58 -080031 sess->d_id.b.domain, sess->d_id.b.area,
32 sess->d_id.b.al_pa, sess->port_name,
33 sess->loop_id);
Quinn Tran36c78452016-02-04 11:45:18 -050034 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags);
35 }
36
37 return 0;
38}
39
40static int
41qla2x00_dfs_tgt_sess_open(struct inode *inode, struct file *file)
42{
43 scsi_qla_host_t *vha = inode->i_private;
44 return single_open(file, qla2x00_dfs_tgt_sess_show, vha);
45}
46
Quinn Tran36c78452016-02-04 11:45:18 -050047static const struct file_operations dfs_tgt_sess_ops = {
48 .open = qla2x00_dfs_tgt_sess_open,
49 .read = seq_read,
50 .llseek = seq_lseek,
51 .release = single_release,
52};
53
54static int
Himanshu Madhanic4234372017-03-15 09:48:53 -070055qla2x00_dfs_tgt_port_database_show(struct seq_file *s, void *unused)
56{
57 scsi_qla_host_t *vha = s->private;
58 struct qla_hw_data *ha = vha->hw;
59 struct gid_list_info *gid_list;
60 dma_addr_t gid_list_dma;
61 fc_port_t fc_port;
62 char *id_iter;
63 int rc, i;
64 uint16_t entries, loop_id;
65 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt;
66
67 seq_printf(s, "%s\n", vha->host_str);
68 if (tgt) {
69 gid_list = dma_alloc_coherent(&ha->pdev->dev,
70 qla2x00_gid_list_size(ha),
71 &gid_list_dma, GFP_KERNEL);
72 if (!gid_list) {
Quinn Tran83548fe2017-06-02 09:12:01 -070073 ql_dbg(ql_dbg_user, vha, 0x7018,
Himanshu Madhanic4234372017-03-15 09:48:53 -070074 "DMA allocation failed for %u\n",
75 qla2x00_gid_list_size(ha));
76 return 0;
77 }
78
79 rc = qla24xx_gidlist_wait(vha, gid_list, gid_list_dma,
80 &entries);
81 if (rc != QLA_SUCCESS)
82 goto out_free_id_list;
83
84 id_iter = (char *)gid_list;
85
86 seq_puts(s, "Port Name Port ID Loop ID\n");
87
88 for (i = 0; i < entries; i++) {
89 struct gid_list_info *gid =
90 (struct gid_list_info *)id_iter;
91 loop_id = le16_to_cpu(gid->loop_id);
92 memset(&fc_port, 0, sizeof(fc_port_t));
93
94 fc_port.loop_id = loop_id;
95
96 rc = qla24xx_gpdb_wait(vha, &fc_port, 0);
97 seq_printf(s, "%8phC %02x%02x%02x %d\n",
98 fc_port.port_name, fc_port.d_id.b.domain,
99 fc_port.d_id.b.area, fc_port.d_id.b.al_pa,
100 fc_port.loop_id);
101 id_iter += ha->gid_list_info_size;
102 }
103out_free_id_list:
104 dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha),
105 gid_list, gid_list_dma);
106 }
107
108 return 0;
109}
110
111static int
112qla2x00_dfs_tgt_port_database_open(struct inode *inode, struct file *file)
113{
114 scsi_qla_host_t *vha = inode->i_private;
115
116 return single_open(file, qla2x00_dfs_tgt_port_database_show, vha);
117}
118
119static const struct file_operations dfs_tgt_port_database_ops = {
120 .open = qla2x00_dfs_tgt_port_database_open,
121 .read = seq_read,
122 .llseek = seq_lseek,
123 .release = single_release,
124};
125
126static int
Quinn Tran03e8c682015-12-17 14:56:59 -0500127qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused)
128{
129 struct scsi_qla_host *vha = s->private;
130 struct qla_hw_data *ha = vha->hw;
131
132 seq_puts(s, "FW Resource count\n\n");
133 seq_printf(s, "Original TGT exchg count[%d]\n",
134 ha->orig_fw_tgt_xcb_count);
135 seq_printf(s, "current TGT exchg count[%d]\n",
136 ha->cur_fw_tgt_xcb_count);
137 seq_printf(s, "original Initiator Exchange count[%d]\n",
138 ha->orig_fw_xcb_count);
139 seq_printf(s, "Current Initiator Exchange count[%d]\n",
140 ha->cur_fw_xcb_count);
141 seq_printf(s, "Original IOCB count[%d]\n", ha->orig_fw_iocb_count);
142 seq_printf(s, "Current IOCB count[%d]\n", ha->cur_fw_iocb_count);
143 seq_printf(s, "MAX VP count[%d]\n", ha->max_npiv_vports);
144 seq_printf(s, "MAX FCF count[%d]\n", ha->fw_max_fcf_count);
145
146 return 0;
147}
148
149static int
150qla_dfs_fw_resource_cnt_open(struct inode *inode, struct file *file)
151{
152 struct scsi_qla_host *vha = inode->i_private;
153 return single_open(file, qla_dfs_fw_resource_cnt_show, vha);
154}
155
156static const struct file_operations dfs_fw_resource_cnt_ops = {
157 .open = qla_dfs_fw_resource_cnt_open,
158 .read = seq_read,
159 .llseek = seq_lseek,
160 .release = single_release,
161};
162
163static int
Himanshu Madhanice1025c2015-12-17 14:56:58 -0500164qla_dfs_tgt_counters_show(struct seq_file *s, void *unused)
165{
166 struct scsi_qla_host *vha = s->private;
167
168 seq_puts(s, "Target Counters\n");
169 seq_printf(s, "qla_core_sbt_cmd = %lld\n",
170 vha->tgt_counters.qla_core_sbt_cmd);
171 seq_printf(s, "qla_core_ret_sta_ctio = %lld\n",
172 vha->tgt_counters.qla_core_ret_sta_ctio);
173 seq_printf(s, "qla_core_ret_ctio = %lld\n",
174 vha->tgt_counters.qla_core_ret_ctio);
175 seq_printf(s, "core_qla_que_buf = %lld\n",
176 vha->tgt_counters.core_qla_que_buf);
177 seq_printf(s, "core_qla_snd_status = %lld\n",
178 vha->tgt_counters.core_qla_snd_status);
179 seq_printf(s, "core_qla_free_cmd = %lld\n",
180 vha->tgt_counters.core_qla_free_cmd);
181 seq_printf(s, "num alloc iocb failed = %lld\n",
182 vha->tgt_counters.num_alloc_iocb_failed);
183 seq_printf(s, "num term exchange sent = %lld\n",
184 vha->tgt_counters.num_term_xchg_sent);
185 seq_printf(s, "num Q full sent = %lld\n",
186 vha->tgt_counters.num_q_full_sent);
187
Anil Gurumurthy54b99932017-03-15 09:48:50 -0700188 /* DIF stats */
189 seq_printf(s, "DIF Inp Bytes = %lld\n",
190 vha->qla_stats.qla_dif_stats.dif_input_bytes);
191 seq_printf(s, "DIF Outp Bytes = %lld\n",
192 vha->qla_stats.qla_dif_stats.dif_output_bytes);
193 seq_printf(s, "DIF Inp Req = %lld\n",
194 vha->qla_stats.qla_dif_stats.dif_input_requests);
195 seq_printf(s, "DIF Outp Req = %lld\n",
196 vha->qla_stats.qla_dif_stats.dif_output_requests);
197 seq_printf(s, "DIF Guard err = %d\n",
198 vha->qla_stats.qla_dif_stats.dif_guard_err);
199 seq_printf(s, "DIF Ref tag err = %d\n",
200 vha->qla_stats.qla_dif_stats.dif_ref_tag_err);
201 seq_printf(s, "DIF App tag err = %d\n",
202 vha->qla_stats.qla_dif_stats.dif_app_tag_err);
Himanshu Madhanice1025c2015-12-17 14:56:58 -0500203 return 0;
204}
205
206static int
207qla_dfs_tgt_counters_open(struct inode *inode, struct file *file)
208{
209 struct scsi_qla_host *vha = inode->i_private;
210 return single_open(file, qla_dfs_tgt_counters_show, vha);
211}
212
213static const struct file_operations dfs_tgt_counters_ops = {
214 .open = qla_dfs_tgt_counters_open,
215 .read = seq_read,
216 .llseek = seq_lseek,
217 .release = single_release,
218};
219
220static int
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800221qla2x00_dfs_fce_show(struct seq_file *s, void *unused)
222{
Anirban Chakraborty7b867cf2008-11-06 10:40:19 -0800223 scsi_qla_host_t *vha = s->private;
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800224 uint32_t cnt;
225 uint32_t *fce;
226 uint64_t fce_start;
Anirban Chakraborty7b867cf2008-11-06 10:40:19 -0800227 struct qla_hw_data *ha = vha->hw;
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800228
229 mutex_lock(&ha->fce_mutex);
230
Rasmus Villemoes91c40f22014-12-03 00:10:52 +0100231 seq_puts(s, "FCE Trace Buffer\n");
FUJITA Tomonori279e7f52008-02-16 15:24:41 +0900232 seq_printf(s, "In Pointer = %llx\n\n", (unsigned long long)ha->fce_wr);
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800233 seq_printf(s, "Base = %llx\n\n", (unsigned long long) ha->fce_dma);
Rasmus Villemoes91c40f22014-12-03 00:10:52 +0100234 seq_puts(s, "FCE Enable Registers\n");
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800235 seq_printf(s, "%08x %08x %08x %08x %08x %08x\n",
236 ha->fce_mb[0], ha->fce_mb[2], ha->fce_mb[3], ha->fce_mb[4],
237 ha->fce_mb[5], ha->fce_mb[6]);
238
239 fce = (uint32_t *) ha->fce;
240 fce_start = (unsigned long long) ha->fce_dma;
241 for (cnt = 0; cnt < fce_calc_size(ha->fce_bufs) / 4; cnt++) {
242 if (cnt % 8 == 0)
243 seq_printf(s, "\n%llx: ",
244 (unsigned long long)((cnt * 4) + fce_start));
245 else
Rasmus Villemoesf50332f2014-12-03 00:10:54 +0100246 seq_putc(s, ' ');
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800247 seq_printf(s, "%08x", *fce++);
248 }
249
Rasmus Villemoes91c40f22014-12-03 00:10:52 +0100250 seq_puts(s, "\nEnd\n");
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800251
252 mutex_unlock(&ha->fce_mutex);
253
254 return 0;
255}
256
257static int
258qla2x00_dfs_fce_open(struct inode *inode, struct file *file)
259{
Anirban Chakraborty7b867cf2008-11-06 10:40:19 -0800260 scsi_qla_host_t *vha = inode->i_private;
261 struct qla_hw_data *ha = vha->hw;
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800262 int rval;
263
264 if (!ha->flags.fce_enabled)
265 goto out;
266
267 mutex_lock(&ha->fce_mutex);
268
269 /* Pause tracing to flush FCE buffers. */
Anirban Chakraborty7b867cf2008-11-06 10:40:19 -0800270 rval = qla2x00_disable_fce_trace(vha, &ha->fce_wr, &ha->fce_rd);
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800271 if (rval)
Saurav Kashyap7c3df132011-07-14 12:00:13 -0700272 ql_dbg(ql_dbg_user, vha, 0x705c,
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800273 "DebugFS: Unable to disable FCE (%d).\n", rval);
274
275 ha->flags.fce_enabled = 0;
276
277 mutex_unlock(&ha->fce_mutex);
278out:
Giridhar Malavali94279ed2009-03-24 09:07:57 -0700279 return single_open(file, qla2x00_dfs_fce_show, vha);
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800280}
281
282static int
283qla2x00_dfs_fce_release(struct inode *inode, struct file *file)
284{
Anirban Chakraborty7b867cf2008-11-06 10:40:19 -0800285 scsi_qla_host_t *vha = inode->i_private;
286 struct qla_hw_data *ha = vha->hw;
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800287 int rval;
288
289 if (ha->flags.fce_enabled)
290 goto out;
291
292 mutex_lock(&ha->fce_mutex);
293
294 /* Re-enable FCE tracing. */
295 ha->flags.fce_enabled = 1;
296 memset(ha->fce, 0, fce_calc_size(ha->fce_bufs));
Anirban Chakraborty7b867cf2008-11-06 10:40:19 -0800297 rval = qla2x00_enable_fce_trace(vha, ha->fce_dma, ha->fce_bufs,
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800298 ha->fce_mb, &ha->fce_bufs);
299 if (rval) {
Saurav Kashyap7c3df132011-07-14 12:00:13 -0700300 ql_dbg(ql_dbg_user, vha, 0x700d,
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800301 "DebugFS: Unable to reinitialize FCE (%d).\n", rval);
302 ha->flags.fce_enabled = 0;
303 }
304
305 mutex_unlock(&ha->fce_mutex);
306out:
307 return single_release(inode, file);
308}
309
310static const struct file_operations dfs_fce_ops = {
311 .open = qla2x00_dfs_fce_open,
312 .read = seq_read,
313 .llseek = seq_lseek,
314 .release = qla2x00_dfs_fce_release,
315};
316
Quinn Tran09620eeb2017-06-13 20:47:20 -0700317static int
318qla_dfs_naqp_show(struct seq_file *s, void *unused)
319{
320 struct scsi_qla_host *vha = s->private;
321 struct qla_hw_data *ha = vha->hw;
322
323 seq_printf(s, "%d\n", ha->tgt.num_act_qpairs);
324 return 0;
325}
326
327static int
328qla_dfs_naqp_open(struct inode *inode, struct file *file)
329{
330 struct scsi_qla_host *vha = inode->i_private;
331
332 return single_open(file, qla_dfs_naqp_show, vha);
333}
334
335static ssize_t
336qla_dfs_naqp_write(struct file *file, const char __user *buffer,
337 size_t count, loff_t *pos)
338{
339 struct seq_file *s = file->private_data;
340 struct scsi_qla_host *vha = s->private;
341 struct qla_hw_data *ha = vha->hw;
342 char *buf;
343 int rc = 0;
344 unsigned long num_act_qp;
345
346 if (!(IS_QLA27XX(ha) || IS_QLA83XX(ha))) {
347 pr_err("host%ld: this adapter does not support Multi Q.",
348 vha->host_no);
349 return -EINVAL;
350 }
351
352 if (!vha->flags.qpairs_available) {
353 pr_err("host%ld: Driver is not setup with Multi Q.",
354 vha->host_no);
355 return -EINVAL;
356 }
357 buf = memdup_user_nul(buffer, count);
358 if (IS_ERR(buf)) {
359 pr_err("host%ld: fail to copy user buffer.",
360 vha->host_no);
361 return PTR_ERR(buf);
362 }
363
364 num_act_qp = simple_strtoul(buf, NULL, 0);
365
366 if (num_act_qp >= vha->hw->max_qpairs) {
367 pr_err("User set invalid number of qpairs %lu. Max = %d",
368 num_act_qp, vha->hw->max_qpairs);
369 rc = -EINVAL;
370 goto out_free;
371 }
372
373 if (num_act_qp != ha->tgt.num_act_qpairs) {
374 ha->tgt.num_act_qpairs = num_act_qp;
375 qlt_clr_qp_table(vha);
376 }
377 rc = count;
378out_free:
379 kfree(buf);
380 return rc;
381}
382
383static const struct file_operations dfs_naqp_ops = {
384 .open = qla_dfs_naqp_open,
385 .read = seq_read,
386 .llseek = seq_lseek,
387 .release = single_release,
388 .write = qla_dfs_naqp_write,
389};
390
391
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800392int
Anirban Chakraborty7b867cf2008-11-06 10:40:19 -0800393qla2x00_dfs_setup(scsi_qla_host_t *vha)
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800394{
Anirban Chakraborty7b867cf2008-11-06 10:40:19 -0800395 struct qla_hw_data *ha = vha->hw;
Andrew Vasquez3a03eb72009-01-05 11:18:11 -0800396
Chad Dupuisf73cb692014-02-26 04:15:06 -0500397 if (!IS_QLA25XX(ha) && !IS_QLA81XX(ha) && !IS_QLA83XX(ha) &&
398 !IS_QLA27XX(ha))
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800399 goto out;
400 if (!ha->fce)
401 goto out;
402
403 if (qla2x00_dfs_root)
404 goto create_dir;
405
406 atomic_set(&qla2x00_dfs_root_count, 0);
407 qla2x00_dfs_root = debugfs_create_dir(QLA2XXX_DRIVER_NAME, NULL);
408 if (!qla2x00_dfs_root) {
Saurav Kashyap7c3df132011-07-14 12:00:13 -0700409 ql_log(ql_log_warn, vha, 0x00f7,
410 "Unable to create debugfs root directory.\n");
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800411 goto out;
412 }
413
414create_dir:
415 if (ha->dfs_dir)
416 goto create_nodes;
417
418 mutex_init(&ha->fce_mutex);
Anirban Chakraborty7b867cf2008-11-06 10:40:19 -0800419 ha->dfs_dir = debugfs_create_dir(vha->host_str, qla2x00_dfs_root);
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800420 if (!ha->dfs_dir) {
Saurav Kashyap7c3df132011-07-14 12:00:13 -0700421 ql_log(ql_log_warn, vha, 0x00f8,
422 "Unable to create debugfs ha directory.\n");
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800423 goto out;
424 }
425
426 atomic_inc(&qla2x00_dfs_root_count);
427
428create_nodes:
Quinn Tran03e8c682015-12-17 14:56:59 -0500429 ha->dfs_fw_resource_cnt = debugfs_create_file("fw_resource_count",
430 S_IRUSR, ha->dfs_dir, vha, &dfs_fw_resource_cnt_ops);
431 if (!ha->dfs_fw_resource_cnt) {
432 ql_log(ql_log_warn, vha, 0x00fd,
433 "Unable to create debugFS fw_resource_count node.\n");
434 goto out;
435 }
436
Himanshu Madhanice1025c2015-12-17 14:56:58 -0500437 ha->dfs_tgt_counters = debugfs_create_file("tgt_counters", S_IRUSR,
438 ha->dfs_dir, vha, &dfs_tgt_counters_ops);
439 if (!ha->dfs_tgt_counters) {
440 ql_log(ql_log_warn, vha, 0xd301,
441 "Unable to create debugFS tgt_counters node.\n");
442 goto out;
443 }
444
Himanshu Madhanic4234372017-03-15 09:48:53 -0700445 ha->tgt.dfs_tgt_port_database = debugfs_create_file("tgt_port_database",
446 S_IRUSR, ha->dfs_dir, vha, &dfs_tgt_port_database_ops);
447 if (!ha->tgt.dfs_tgt_port_database) {
Quinn Tran83548fe2017-06-02 09:12:01 -0700448 ql_log(ql_log_warn, vha, 0xd03f,
Himanshu Madhanic4234372017-03-15 09:48:53 -0700449 "Unable to create debugFS tgt_port_database node.\n");
450 goto out;
451 }
452
Giridhar Malavali94279ed2009-03-24 09:07:57 -0700453 ha->dfs_fce = debugfs_create_file("fce", S_IRUSR, ha->dfs_dir, vha,
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800454 &dfs_fce_ops);
455 if (!ha->dfs_fce) {
Saurav Kashyap7c3df132011-07-14 12:00:13 -0700456 ql_log(ql_log_warn, vha, 0x00f9,
457 "Unable to create debugfs fce node.\n");
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800458 goto out;
459 }
Quinn Tran36c78452016-02-04 11:45:18 -0500460
461 ha->tgt.dfs_tgt_sess = debugfs_create_file("tgt_sess",
462 S_IRUSR, ha->dfs_dir, vha, &dfs_tgt_sess_ops);
463 if (!ha->tgt.dfs_tgt_sess) {
Quinn Tran83548fe2017-06-02 09:12:01 -0700464 ql_log(ql_log_warn, vha, 0xd040,
465 "Unable to create debugFS tgt_sess node.\n");
Quinn Tran36c78452016-02-04 11:45:18 -0500466 goto out;
467 }
468
Quinn Tran09620eeb2017-06-13 20:47:20 -0700469 if (IS_QLA27XX(ha) || IS_QLA83XX(ha)) {
470 ha->tgt.dfs_naqp = debugfs_create_file("naqp",
471 0400, ha->dfs_dir, vha, &dfs_naqp_ops);
472 if (!ha->tgt.dfs_naqp) {
473 ql_log(ql_log_warn, vha, 0xd011,
474 "Unable to create debugFS naqp node.\n");
475 goto out;
476 }
477 }
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800478out:
479 return 0;
480}
481
482int
Anirban Chakraborty7b867cf2008-11-06 10:40:19 -0800483qla2x00_dfs_remove(scsi_qla_host_t *vha)
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800484{
Anirban Chakraborty7b867cf2008-11-06 10:40:19 -0800485 struct qla_hw_data *ha = vha->hw;
Himanshu Madhanice1025c2015-12-17 14:56:58 -0500486
Quinn Tran09620eeb2017-06-13 20:47:20 -0700487 if (ha->tgt.dfs_naqp) {
488 debugfs_remove(ha->tgt.dfs_naqp);
489 ha->tgt.dfs_naqp = NULL;
490 }
491
Quinn Tran36c78452016-02-04 11:45:18 -0500492 if (ha->tgt.dfs_tgt_sess) {
493 debugfs_remove(ha->tgt.dfs_tgt_sess);
494 ha->tgt.dfs_tgt_sess = NULL;
495 }
496
Himanshu Madhanic4234372017-03-15 09:48:53 -0700497 if (ha->tgt.dfs_tgt_port_database) {
498 debugfs_remove(ha->tgt.dfs_tgt_port_database);
499 ha->tgt.dfs_tgt_port_database = NULL;
500 }
501
Quinn Tran03e8c682015-12-17 14:56:59 -0500502 if (ha->dfs_fw_resource_cnt) {
503 debugfs_remove(ha->dfs_fw_resource_cnt);
504 ha->dfs_fw_resource_cnt = NULL;
505 }
506
Himanshu Madhanice1025c2015-12-17 14:56:58 -0500507 if (ha->dfs_tgt_counters) {
508 debugfs_remove(ha->dfs_tgt_counters);
509 ha->dfs_tgt_counters = NULL;
510 }
511
Andrew Vasquezdf613b92008-01-17 09:02:17 -0800512 if (ha->dfs_fce) {
513 debugfs_remove(ha->dfs_fce);
514 ha->dfs_fce = NULL;
515 }
516
517 if (ha->dfs_dir) {
518 debugfs_remove(ha->dfs_dir);
519 ha->dfs_dir = NULL;
520 atomic_dec(&qla2x00_dfs_root_count);
521 }
522
523 if (atomic_read(&qla2x00_dfs_root_count) == 0 &&
524 qla2x00_dfs_root) {
525 debugfs_remove(qla2x00_dfs_root);
526 qla2x00_dfs_root = NULL;
527 }
528
529 return 0;
530}