Re: [PATCH 03/20] qla2xxx: Enable Target counters in DebugFS.

2015-12-08 Thread Hannes Reinecke
On 12/08/2015 01:48 AM, Himanshu Madhani wrote:
> Following counters are added in target mode to help debugging efforts.
> 
> Target Counters
> 
> qla_core_sbt_cmd = 0
> qla_core_ret_sta_ctio = 0
> qla_core_ret_ctio = 0
> core_qla_que_buf = 0
> core_qla_snd_status = 0
> core_qla_free_cmd = 0
> num alloc iocb failed = 0
> num term exchange sent = 0
> num Q full sent = 0
> 
> Signed-off-by: Himanshu Madhani 
> Signed-off-by: Giridhar Malavali 
> ---
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes Reinecke   zSeries & Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/20] qla2xxx: Enable Target counters in DebugFS.

2015-12-07 Thread Himanshu Madhani
Following counters are added in target mode to help debugging efforts.

Target Counters

qla_core_sbt_cmd = 0
qla_core_ret_sta_ctio = 0
qla_core_ret_ctio = 0
core_qla_que_buf = 0
core_qla_snd_status = 0
core_qla_free_cmd = 0
num alloc iocb failed = 0
num term exchange sent = 0
num Q full sent = 0

Signed-off-by: Himanshu Madhani 
Signed-off-by: Giridhar Malavali 
---
 drivers/scsi/qla2xxx/qla_dbg.c |2 +-
 drivers/scsi/qla2xxx/qla_def.h |   15 +
 drivers/scsi/qla2xxx/qla_dfs.c |   56 
 drivers/scsi/qla2xxx/qla_iocb.c|1 +
 drivers/scsi/qla2xxx/qla_target.c  |7 
 drivers/scsi/qla2xxx/tcm_qla2xxx.c |4 ++
 6 files changed, 84 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index e25f5ac..07451bb 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -60,7 +60,7 @@
  * |  || 0xb13c-0xb140  |
  * |  || 0xb149
|
  * | MultiQ   |   0xc00c   |   |
- * | Misc |   0xd300   | 0xd031-0xd0ff |
+ * | Misc |   0xd301   | 0xd031-0xd0ff |
  * |  || 0xd101-0xd1fe |
  * |  || 0xd214-0xd2fe |
  * | Target Mode |   0xe080   ||
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index be9a674..1d2a51a 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -3342,6 +3342,8 @@ struct qla_hw_data {
uint32_tchain_offset;
struct dentry *dfs_dir;
struct dentry *dfs_fce;
+   struct dentry *dfs_tgt_counters;
+
dma_addr_t  fce_dma;
void*fce;
uint32_tfce_bufs;
@@ -3499,6 +3501,18 @@ struct qla_hw_data {
int allow_cna_fw_dump;
 };
 
+struct qla_tgt_counters {
+   uint64_t qla_core_sbt_cmd;
+   uint64_t core_qla_que_buf;
+   uint64_t qla_core_ret_ctio;
+   uint64_t core_qla_snd_status;
+   uint64_t qla_core_ret_sta_ctio;
+   uint64_t core_qla_free_cmd;
+   uint64_t num_q_full_sent;
+   uint64_t num_alloc_iocb_failed;
+   uint64_t num_term_xchg_sent;
+};
+
 /*
  * Qlogic scsi host structure
  */
@@ -3651,6 +3665,7 @@ typedef struct scsi_qla_host {
 
atomic_tvref_count;
struct qla8044_reset_template reset_tmplt;
+   struct qla_tgt_counters tgt_counters;
 } scsi_qla_host_t;
 
 #define SET_VP_IDX 1
diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c
index 15cf074..449541f 100644
--- a/drivers/scsi/qla2xxx/qla_dfs.c
+++ b/drivers/scsi/qla2xxx/qla_dfs.c
@@ -13,6 +13,48 @@ static struct dentry *qla2x00_dfs_root;
 static atomic_t qla2x00_dfs_root_count;
 
 static int
+qla_dfs_tgt_counters_show(struct seq_file *s, void *unused)
+{
+   struct scsi_qla_host *vha = s->private;
+
+   seq_puts(s, "Target Counters\n");
+   seq_printf(s, "qla_core_sbt_cmd = %lld\n",
+   vha->tgt_counters.qla_core_sbt_cmd);
+   seq_printf(s, "qla_core_ret_sta_ctio = %lld\n",
+   vha->tgt_counters.qla_core_ret_sta_ctio);
+   seq_printf(s, "qla_core_ret_ctio = %lld\n",
+   vha->tgt_counters.qla_core_ret_ctio);
+   seq_printf(s, "core_qla_que_buf = %lld\n",
+   vha->tgt_counters.core_qla_que_buf);
+   seq_printf(s, "core_qla_snd_status = %lld\n",
+   vha->tgt_counters.core_qla_snd_status);
+   seq_printf(s, "core_qla_free_cmd = %lld\n",
+   vha->tgt_counters.core_qla_free_cmd);
+   seq_printf(s, "num alloc iocb failed = %lld\n",
+   vha->tgt_counters.num_alloc_iocb_failed);
+   seq_printf(s, "num term exchange sent = %lld\n",
+   vha->tgt_counters.num_term_xchg_sent);
+   seq_printf(s, "num Q full sent = %lld\n",
+   vha->tgt_counters.num_q_full_sent);
+
+   return 0;
+}
+
+static int
+qla_dfs_tgt_counters_open(struct inode *inode, struct file *file)
+{
+   struct scsi_qla_host *vha = inode->i_private;
+   return single_open(file, qla_dfs_tgt_counters_show, vha);
+}
+
+static const struct file_operations dfs_tgt_counters_ops = {
+   .open   = qla_dfs_tgt_counters_open,
+   .read   = seq_read,
+   .llseek = seq_lseek,
+   .release= single_release,
+};
+
+static int
 qla2x00_dfs_fce_show(struct seq_file *s, void *unused)
 {
scsi_qla_host_t *vha = s->private;
@@ -146,6 +188,14 @@ create_dir:
atomic_inc(_dfs_root_count);
 
 create_nodes:
+   ha->dfs_tgt_counters = debugfs_create_file("tgt_counters", S_IRUSR,
+   ha->dfs_dir, vha,