^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * QLogic Fibre Channel HBA Driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (c) 2003-2014 QLogic Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include "qla_def.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/debugfs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/seq_file.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) static struct dentry *qla2x00_dfs_root;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) static atomic_t qla2x00_dfs_root_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define QLA_DFS_RPORT_DEVLOSS_TMO 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) qla_dfs_rport_get(struct fc_port *fp, int attr_id, u64 *val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) switch (attr_id) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) case QLA_DFS_RPORT_DEVLOSS_TMO:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) /* Only supported for FC-NVMe devices that are registered. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) if (!(fp->nvme_flag & NVME_FLAG_REGISTERED))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) return -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) *val = fp->nvme_remote_port->dev_loss_tmo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) qla_dfs_rport_set(struct fc_port *fp, int attr_id, u64 val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) switch (attr_id) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) case QLA_DFS_RPORT_DEVLOSS_TMO:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) /* Only supported for FC-NVMe devices that are registered. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) if (!(fp->nvme_flag & NVME_FLAG_REGISTERED))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) return -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #if (IS_ENABLED(CONFIG_NVME_FC))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) return nvme_fc_set_remoteport_devloss(fp->nvme_remote_port,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #else /* CONFIG_NVME_FC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #endif /* CONFIG_NVME_FC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #define DEFINE_QLA_DFS_RPORT_RW_ATTR(_attr_id, _attr) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) static int qla_dfs_rport_##_attr##_get(void *data, u64 *val) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) struct fc_port *fp = data; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) return qla_dfs_rport_get(fp, _attr_id, val); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) } \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) static int qla_dfs_rport_##_attr##_set(void *data, u64 val) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) struct fc_port *fp = data; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) return qla_dfs_rport_set(fp, _attr_id, val); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) } \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) DEFINE_DEBUGFS_ATTRIBUTE(qla_dfs_rport_##_attr##_fops, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) qla_dfs_rport_##_attr##_get, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) qla_dfs_rport_##_attr##_set, "%llu\n")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) * Wrapper for getting fc_port fields.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) * _attr : Attribute name.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) * _get_val : Accessor macro to retrieve the value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) #define DEFINE_QLA_DFS_RPORT_FIELD_GET(_attr, _get_val) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) static int qla_dfs_rport_field_##_attr##_get(void *data, u64 *val) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) struct fc_port *fp = data; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) *val = _get_val; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) return 0; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) } \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) DEFINE_DEBUGFS_ATTRIBUTE(qla_dfs_rport_field_##_attr##_fops, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) qla_dfs_rport_field_##_attr##_get, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) NULL, "%llu\n")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) #define DEFINE_QLA_DFS_RPORT_ACCESS(_attr, _get_val) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) DEFINE_QLA_DFS_RPORT_FIELD_GET(_attr, _get_val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) #define DEFINE_QLA_DFS_RPORT_FIELD(_attr) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) DEFINE_QLA_DFS_RPORT_FIELD_GET(_attr, fp->_attr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) DEFINE_QLA_DFS_RPORT_RW_ATTR(QLA_DFS_RPORT_DEVLOSS_TMO, dev_loss_tmo);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) DEFINE_QLA_DFS_RPORT_FIELD(disc_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) DEFINE_QLA_DFS_RPORT_FIELD(scan_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) DEFINE_QLA_DFS_RPORT_FIELD(fw_login_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) DEFINE_QLA_DFS_RPORT_FIELD(login_pause);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) DEFINE_QLA_DFS_RPORT_FIELD(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) DEFINE_QLA_DFS_RPORT_FIELD(nvme_flag);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) DEFINE_QLA_DFS_RPORT_FIELD(last_rscn_gen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) DEFINE_QLA_DFS_RPORT_FIELD(rscn_gen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) DEFINE_QLA_DFS_RPORT_FIELD(login_gen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) DEFINE_QLA_DFS_RPORT_FIELD(loop_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) DEFINE_QLA_DFS_RPORT_FIELD_GET(port_id, fp->d_id.b24);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) DEFINE_QLA_DFS_RPORT_FIELD_GET(sess_kref, kref_read(&fp->sess_kref));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) qla2x00_dfs_create_rport(scsi_qla_host_t *vha, struct fc_port *fp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) char wwn[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) #define QLA_CREATE_RPORT_FIELD_ATTR(_attr) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) debugfs_create_file(#_attr, 0400, fp->dfs_rport_dir, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) fp, &qla_dfs_rport_field_##_attr##_fops)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) if (!vha->dfs_rport_root || fp->dfs_rport_dir)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) sprintf(wwn, "pn-%016llx", wwn_to_u64(fp->port_name));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) fp->dfs_rport_dir = debugfs_create_dir(wwn, vha->dfs_rport_root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) if (!fp->dfs_rport_dir)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) if (NVME_TARGET(vha->hw, fp))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) debugfs_create_file("dev_loss_tmo", 0600, fp->dfs_rport_dir,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) fp, &qla_dfs_rport_dev_loss_tmo_fops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) QLA_CREATE_RPORT_FIELD_ATTR(disc_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) QLA_CREATE_RPORT_FIELD_ATTR(scan_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) QLA_CREATE_RPORT_FIELD_ATTR(fw_login_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) QLA_CREATE_RPORT_FIELD_ATTR(login_pause);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) QLA_CREATE_RPORT_FIELD_ATTR(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) QLA_CREATE_RPORT_FIELD_ATTR(nvme_flag);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) QLA_CREATE_RPORT_FIELD_ATTR(last_rscn_gen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) QLA_CREATE_RPORT_FIELD_ATTR(rscn_gen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) QLA_CREATE_RPORT_FIELD_ATTR(login_gen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) QLA_CREATE_RPORT_FIELD_ATTR(loop_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) QLA_CREATE_RPORT_FIELD_ATTR(port_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) QLA_CREATE_RPORT_FIELD_ATTR(sess_kref);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) qla2x00_dfs_remove_rport(scsi_qla_host_t *vha, struct fc_port *fp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) if (!vha->dfs_rport_root || !fp->dfs_rport_dir)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) debugfs_remove_recursive(fp->dfs_rport_dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) fp->dfs_rport_dir = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) qla2x00_dfs_tgt_sess_show(struct seq_file *s, void *unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) scsi_qla_host_t *vha = s->private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) struct qla_hw_data *ha = vha->hw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) struct fc_port *sess = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) struct qla_tgt *tgt = vha->vha_tgt.qla_tgt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) seq_printf(s, "%s\n", vha->host_str);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) if (tgt) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) seq_puts(s, "Port ID Port Name Handle\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) spin_lock_irqsave(&ha->tgt.sess_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) list_for_each_entry(sess, &vha->vp_fcports, list)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) seq_printf(s, "%02x:%02x:%02x %8phC %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) sess->d_id.b.domain, sess->d_id.b.area,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) sess->d_id.b.al_pa, sess->port_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) sess->loop_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) spin_unlock_irqrestore(&ha->tgt.sess_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) DEFINE_SHOW_ATTRIBUTE(qla2x00_dfs_tgt_sess);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) qla2x00_dfs_tgt_port_database_show(struct seq_file *s, void *unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) scsi_qla_host_t *vha = s->private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) struct qla_hw_data *ha = vha->hw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) struct gid_list_info *gid_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) dma_addr_t gid_list_dma;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) fc_port_t fc_port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) char *id_iter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) int rc, i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) uint16_t entries, loop_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) seq_printf(s, "%s\n", vha->host_str);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) gid_list = dma_alloc_coherent(&ha->pdev->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) qla2x00_gid_list_size(ha),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) &gid_list_dma, GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) if (!gid_list) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) ql_dbg(ql_dbg_user, vha, 0x7018,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) "DMA allocation failed for %u\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) qla2x00_gid_list_size(ha));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) rc = qla24xx_gidlist_wait(vha, gid_list, gid_list_dma,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) &entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) if (rc != QLA_SUCCESS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) goto out_free_id_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) id_iter = (char *)gid_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) seq_puts(s, "Port Name Port ID Loop ID\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) for (i = 0; i < entries; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) struct gid_list_info *gid =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) (struct gid_list_info *)id_iter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) loop_id = le16_to_cpu(gid->loop_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) memset(&fc_port, 0, sizeof(fc_port_t));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) fc_port.loop_id = loop_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) rc = qla24xx_gpdb_wait(vha, &fc_port, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) seq_printf(s, "%8phC %02x%02x%02x %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) fc_port.port_name, fc_port.d_id.b.domain,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) fc_port.d_id.b.area, fc_port.d_id.b.al_pa,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) fc_port.loop_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) id_iter += ha->gid_list_info_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) out_free_id_list:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) gid_list, gid_list_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) DEFINE_SHOW_ATTRIBUTE(qla2x00_dfs_tgt_port_database);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) struct scsi_qla_host *vha = s->private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) uint16_t mb[MAX_IOCB_MB_REG];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) struct qla_hw_data *ha = vha->hw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) u16 iocbs_used, i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) rc = qla24xx_res_count_wait(vha, mb, SIZEOF_IOCB_MB_REG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) if (rc != QLA_SUCCESS) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) seq_printf(s, "Mailbox Command failed %d, mb %#x", rc, mb[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) seq_puts(s, "FW Resource count\n\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) seq_printf(s, "Original TGT exchg count[%d]\n", mb[1]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) seq_printf(s, "Current TGT exchg count[%d]\n", mb[2]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) seq_printf(s, "Current Initiator Exchange count[%d]\n", mb[3]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) seq_printf(s, "Original Initiator Exchange count[%d]\n", mb[6]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) seq_printf(s, "Current IOCB count[%d]\n", mb[7]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) seq_printf(s, "Original IOCB count[%d]\n", mb[10]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) seq_printf(s, "MAX VP count[%d]\n", mb[11]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) seq_printf(s, "MAX FCF count[%d]\n", mb[12]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) seq_printf(s, "Current free pageable XCB buffer cnt[%d]\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) mb[20]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) seq_printf(s, "Original Initiator fast XCB buffer cnt[%d]\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) mb[21]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) seq_printf(s, "Current free Initiator fast XCB buffer cnt[%d]\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) mb[22]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) seq_printf(s, "Original Target fast XCB buffer cnt[%d]\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) mb[23]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) if (ql2xenforce_iocb_limit) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) /* lock is not require. It's an estimate. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) iocbs_used = ha->base_qpair->fwres.iocbs_used;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) for (i = 0; i < ha->max_qpairs; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) if (ha->queue_pair_map[i])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) iocbs_used += ha->queue_pair_map[i]->fwres.iocbs_used;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) seq_printf(s, "Driver: estimate iocb used [%d] high water limit [%d]\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) iocbs_used, ha->base_qpair->fwres.iocbs_limit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) DEFINE_SHOW_ATTRIBUTE(qla_dfs_fw_resource_cnt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) qla_dfs_tgt_counters_show(struct seq_file *s, void *unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) struct scsi_qla_host *vha = s->private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) struct qla_qpair *qpair = vha->hw->base_qpair;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) uint64_t qla_core_sbt_cmd, core_qla_que_buf, qla_core_ret_ctio,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) core_qla_snd_status, qla_core_ret_sta_ctio, core_qla_free_cmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) num_q_full_sent, num_alloc_iocb_failed, num_term_xchg_sent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) u16 i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) qla_core_sbt_cmd = qpair->tgt_counters.qla_core_sbt_cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) core_qla_que_buf = qpair->tgt_counters.core_qla_que_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) qla_core_ret_ctio = qpair->tgt_counters.qla_core_ret_ctio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) core_qla_snd_status = qpair->tgt_counters.core_qla_snd_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) qla_core_ret_sta_ctio = qpair->tgt_counters.qla_core_ret_sta_ctio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) core_qla_free_cmd = qpair->tgt_counters.core_qla_free_cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) num_q_full_sent = qpair->tgt_counters.num_q_full_sent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) num_alloc_iocb_failed = qpair->tgt_counters.num_alloc_iocb_failed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) num_term_xchg_sent = qpair->tgt_counters.num_term_xchg_sent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) for (i = 0; i < vha->hw->max_qpairs; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) qpair = vha->hw->queue_pair_map[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) if (!qpair)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) qla_core_sbt_cmd += qpair->tgt_counters.qla_core_sbt_cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) core_qla_que_buf += qpair->tgt_counters.core_qla_que_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) qla_core_ret_ctio += qpair->tgt_counters.qla_core_ret_ctio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) core_qla_snd_status += qpair->tgt_counters.core_qla_snd_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) qla_core_ret_sta_ctio +=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) qpair->tgt_counters.qla_core_ret_sta_ctio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) core_qla_free_cmd += qpair->tgt_counters.core_qla_free_cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) num_q_full_sent += qpair->tgt_counters.num_q_full_sent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) num_alloc_iocb_failed +=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) qpair->tgt_counters.num_alloc_iocb_failed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) num_term_xchg_sent += qpair->tgt_counters.num_term_xchg_sent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) seq_puts(s, "Target Counters\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) seq_printf(s, "qla_core_sbt_cmd = %lld\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) qla_core_sbt_cmd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) seq_printf(s, "qla_core_ret_sta_ctio = %lld\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) qla_core_ret_sta_ctio);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) seq_printf(s, "qla_core_ret_ctio = %lld\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) qla_core_ret_ctio);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) seq_printf(s, "core_qla_que_buf = %lld\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) core_qla_que_buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) seq_printf(s, "core_qla_snd_status = %lld\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) core_qla_snd_status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) seq_printf(s, "core_qla_free_cmd = %lld\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) core_qla_free_cmd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) seq_printf(s, "num alloc iocb failed = %lld\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) num_alloc_iocb_failed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) seq_printf(s, "num term exchange sent = %lld\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) num_term_xchg_sent);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) seq_printf(s, "num Q full sent = %lld\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) num_q_full_sent);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) /* DIF stats */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) seq_printf(s, "DIF Inp Bytes = %lld\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) vha->qla_stats.qla_dif_stats.dif_input_bytes);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) seq_printf(s, "DIF Outp Bytes = %lld\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) vha->qla_stats.qla_dif_stats.dif_output_bytes);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) seq_printf(s, "DIF Inp Req = %lld\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) vha->qla_stats.qla_dif_stats.dif_input_requests);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) seq_printf(s, "DIF Outp Req = %lld\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) vha->qla_stats.qla_dif_stats.dif_output_requests);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) seq_printf(s, "DIF Guard err = %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) vha->qla_stats.qla_dif_stats.dif_guard_err);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) seq_printf(s, "DIF Ref tag err = %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) vha->qla_stats.qla_dif_stats.dif_ref_tag_err);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) seq_printf(s, "DIF App tag err = %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) vha->qla_stats.qla_dif_stats.dif_app_tag_err);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) DEFINE_SHOW_ATTRIBUTE(qla_dfs_tgt_counters);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) qla2x00_dfs_fce_show(struct seq_file *s, void *unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) scsi_qla_host_t *vha = s->private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) uint32_t cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) uint32_t *fce;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) uint64_t fce_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) struct qla_hw_data *ha = vha->hw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) mutex_lock(&ha->fce_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) seq_puts(s, "FCE Trace Buffer\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) seq_printf(s, "In Pointer = %llx\n\n", (unsigned long long)ha->fce_wr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) seq_printf(s, "Base = %llx\n\n", (unsigned long long) ha->fce_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) seq_puts(s, "FCE Enable Registers\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) seq_printf(s, "%08x %08x %08x %08x %08x %08x\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) ha->fce_mb[0], ha->fce_mb[2], ha->fce_mb[3], ha->fce_mb[4],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) ha->fce_mb[5], ha->fce_mb[6]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) fce = (uint32_t *) ha->fce;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) fce_start = (unsigned long long) ha->fce_dma;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) for (cnt = 0; cnt < fce_calc_size(ha->fce_bufs) / 4; cnt++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) if (cnt % 8 == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) seq_printf(s, "\n%llx: ",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) (unsigned long long)((cnt * 4) + fce_start));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) seq_putc(s, ' ');
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) seq_printf(s, "%08x", *fce++);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) seq_puts(s, "\nEnd\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) mutex_unlock(&ha->fce_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) qla2x00_dfs_fce_open(struct inode *inode, struct file *file)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) scsi_qla_host_t *vha = inode->i_private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) struct qla_hw_data *ha = vha->hw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) int rval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) if (!ha->flags.fce_enabled)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) mutex_lock(&ha->fce_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) /* Pause tracing to flush FCE buffers. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) rval = qla2x00_disable_fce_trace(vha, &ha->fce_wr, &ha->fce_rd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) if (rval)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) ql_dbg(ql_dbg_user, vha, 0x705c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) "DebugFS: Unable to disable FCE (%d).\n", rval);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) ha->flags.fce_enabled = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) mutex_unlock(&ha->fce_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) return single_open(file, qla2x00_dfs_fce_show, vha);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) qla2x00_dfs_fce_release(struct inode *inode, struct file *file)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) scsi_qla_host_t *vha = inode->i_private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) struct qla_hw_data *ha = vha->hw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) int rval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) if (ha->flags.fce_enabled)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) mutex_lock(&ha->fce_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) /* Re-enable FCE tracing. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) ha->flags.fce_enabled = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) memset(ha->fce, 0, fce_calc_size(ha->fce_bufs));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) rval = qla2x00_enable_fce_trace(vha, ha->fce_dma, ha->fce_bufs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) ha->fce_mb, &ha->fce_bufs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) if (rval) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) ql_dbg(ql_dbg_user, vha, 0x700d,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) "DebugFS: Unable to reinitialize FCE (%d).\n", rval);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) ha->flags.fce_enabled = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) mutex_unlock(&ha->fce_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) return single_release(inode, file);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) static const struct file_operations dfs_fce_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) .open = qla2x00_dfs_fce_open,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) .read = seq_read,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) .llseek = seq_lseek,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) .release = qla2x00_dfs_fce_release,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) qla_dfs_naqp_show(struct seq_file *s, void *unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) struct scsi_qla_host *vha = s->private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) struct qla_hw_data *ha = vha->hw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) seq_printf(s, "%d\n", ha->tgt.num_act_qpairs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) qla_dfs_naqp_open(struct inode *inode, struct file *file)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) struct scsi_qla_host *vha = inode->i_private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) return single_open(file, qla_dfs_naqp_show, vha);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) static ssize_t
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) qla_dfs_naqp_write(struct file *file, const char __user *buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) size_t count, loff_t *pos)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) struct seq_file *s = file->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) struct scsi_qla_host *vha = s->private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) struct qla_hw_data *ha = vha->hw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) char *buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) int rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) unsigned long num_act_qp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) if (!(IS_QLA27XX(ha) || IS_QLA83XX(ha) || IS_QLA28XX(ha))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) pr_err("host%ld: this adapter does not support Multi Q.",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) vha->host_no);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) if (!vha->flags.qpairs_available) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) pr_err("host%ld: Driver is not setup with Multi Q.",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) vha->host_no);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) buf = memdup_user_nul(buffer, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) if (IS_ERR(buf)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) pr_err("host%ld: fail to copy user buffer.",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) vha->host_no);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) return PTR_ERR(buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) num_act_qp = simple_strtoul(buf, NULL, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) if (num_act_qp >= vha->hw->max_qpairs) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) pr_err("User set invalid number of qpairs %lu. Max = %d",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) num_act_qp, vha->hw->max_qpairs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) rc = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) goto out_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) if (num_act_qp != ha->tgt.num_act_qpairs) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) ha->tgt.num_act_qpairs = num_act_qp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) qlt_clr_qp_table(vha);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) rc = count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) out_free:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) kfree(buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) static const struct file_operations dfs_naqp_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) .open = qla_dfs_naqp_open,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) .read = seq_read,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) .llseek = seq_lseek,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) .release = single_release,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) .write = qla_dfs_naqp_write,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) qla2x00_dfs_setup(scsi_qla_host_t *vha)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) struct qla_hw_data *ha = vha->hw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) if (!IS_QLA25XX(ha) && !IS_QLA81XX(ha) && !IS_QLA83XX(ha) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) !IS_QLA27XX(ha) && !IS_QLA28XX(ha))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) if (!ha->fce)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) if (qla2x00_dfs_root)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) goto create_dir;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) atomic_set(&qla2x00_dfs_root_count, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) qla2x00_dfs_root = debugfs_create_dir(QLA2XXX_DRIVER_NAME, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) create_dir:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) if (ha->dfs_dir)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) goto create_nodes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) mutex_init(&ha->fce_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) ha->dfs_dir = debugfs_create_dir(vha->host_str, qla2x00_dfs_root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) atomic_inc(&qla2x00_dfs_root_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) create_nodes:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) ha->dfs_fw_resource_cnt = debugfs_create_file("fw_resource_count",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) S_IRUSR, ha->dfs_dir, vha, &qla_dfs_fw_resource_cnt_fops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) ha->dfs_tgt_counters = debugfs_create_file("tgt_counters", S_IRUSR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) ha->dfs_dir, vha, &qla_dfs_tgt_counters_fops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) ha->tgt.dfs_tgt_port_database = debugfs_create_file("tgt_port_database",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) S_IRUSR, ha->dfs_dir, vha, &qla2x00_dfs_tgt_port_database_fops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) ha->dfs_fce = debugfs_create_file("fce", S_IRUSR, ha->dfs_dir, vha,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) &dfs_fce_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) ha->tgt.dfs_tgt_sess = debugfs_create_file("tgt_sess",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) S_IRUSR, ha->dfs_dir, vha, &qla2x00_dfs_tgt_sess_fops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) if (IS_QLA27XX(ha) || IS_QLA83XX(ha) || IS_QLA28XX(ha)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) ha->tgt.dfs_naqp = debugfs_create_file("naqp",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) 0400, ha->dfs_dir, vha, &dfs_naqp_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) if (!ha->tgt.dfs_naqp) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) ql_log(ql_log_warn, vha, 0xd011,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) "Unable to create debugFS naqp node.\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) vha->dfs_rport_root = debugfs_create_dir("rports", ha->dfs_dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) if (!vha->dfs_rport_root) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) ql_log(ql_log_warn, vha, 0xd012,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) "Unable to create debugFS rports node.\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) qla2x00_dfs_remove(scsi_qla_host_t *vha)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) struct qla_hw_data *ha = vha->hw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) if (ha->tgt.dfs_naqp) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) debugfs_remove(ha->tgt.dfs_naqp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) ha->tgt.dfs_naqp = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) if (ha->tgt.dfs_tgt_sess) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) debugfs_remove(ha->tgt.dfs_tgt_sess);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) ha->tgt.dfs_tgt_sess = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) if (ha->tgt.dfs_tgt_port_database) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) debugfs_remove(ha->tgt.dfs_tgt_port_database);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) ha->tgt.dfs_tgt_port_database = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) if (ha->dfs_fw_resource_cnt) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) debugfs_remove(ha->dfs_fw_resource_cnt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) ha->dfs_fw_resource_cnt = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) if (ha->dfs_tgt_counters) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) debugfs_remove(ha->dfs_tgt_counters);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) ha->dfs_tgt_counters = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) if (ha->dfs_fce) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) debugfs_remove(ha->dfs_fce);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) ha->dfs_fce = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) if (vha->dfs_rport_root) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) debugfs_remove_recursive(vha->dfs_rport_root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) vha->dfs_rport_root = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) if (ha->dfs_dir) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) debugfs_remove(ha->dfs_dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) ha->dfs_dir = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) atomic_dec(&qla2x00_dfs_root_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) if (atomic_read(&qla2x00_dfs_root_count) == 0 &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) qla2x00_dfs_root) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) debugfs_remove(qla2x00_dfs_root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) qla2x00_dfs_root = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) }