]> git.baikalelectronics.ru Git - kernel.git/commitdiff
scsi: qla2xxx: Tweak resource count dump
authorQuinn Tran <quinn.tran@qlogic.com>
Thu, 28 Dec 2017 20:33:23 +0000 (12:33 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 4 Jan 2018 04:41:06 +0000 (23:41 -0500)
Fetch actual data from firmware instead of static data
at chip reset time.

Signed-off-by: Quinn Tran <quinn.tran@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla2xxx/qla_dfs.c
drivers/scsi/qla2xxx/qla_gbl.h
drivers/scsi/qla2xxx/qla_mbx.c

index d231e71561347ebb5d11c9a45ec757b8410f1f76..ddb53db61fd28bfaf61c0271bb859d0bf960280e 100644 (file)
@@ -127,21 +127,23 @@ static int
 qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused)
 {
        struct scsi_qla_host *vha = s->private;
-       struct qla_hw_data *ha = vha->hw;
-
-       seq_puts(s, "FW Resource count\n\n");
-       seq_printf(s, "Original TGT exchg count[%d]\n",
-           ha->orig_fw_tgt_xcb_count);
-       seq_printf(s, "current TGT exchg count[%d]\n",
-           ha->cur_fw_tgt_xcb_count);
-       seq_printf(s, "original Initiator Exchange count[%d]\n",
-           ha->orig_fw_xcb_count);
-       seq_printf(s, "Current Initiator Exchange count[%d]\n",
-           ha->cur_fw_xcb_count);
-       seq_printf(s, "Original IOCB count[%d]\n", ha->orig_fw_iocb_count);
-       seq_printf(s, "Current IOCB count[%d]\n", ha->cur_fw_iocb_count);
-       seq_printf(s, "MAX VP count[%d]\n", ha->max_npiv_vports);
-       seq_printf(s, "MAX FCF count[%d]\n", ha->fw_max_fcf_count);
+       uint16_t mb[MAX_IOCB_MB_REG];
+       int rc;
+
+       rc = qla24xx_res_count_wait(vha, mb, SIZEOF_IOCB_MB_REG);
+       if (rc != QLA_SUCCESS) {
+               seq_printf(s, "Mailbox Command failed %d, mb %#x", rc, mb[0]);
+       } else {
+               seq_puts(s, "FW Resource count\n\n");
+               seq_printf(s, "Original TGT exchg count[%d]\n", mb[1]);
+               seq_printf(s, "current TGT exchg count[%d]\n", mb[2]);
+               seq_printf(s, "original Initiator Exchange count[%d]\n", mb[3]);
+               seq_printf(s, "Current Initiator Exchange count[%d]\n", mb[6]);
+               seq_printf(s, "Original IOCB count[%d]\n", mb[7]);
+               seq_printf(s, "Current IOCB count[%d]\n", mb[10]);
+               seq_printf(s, "MAX VP count[%d]\n", mb[11]);
+               seq_printf(s, "MAX FCF count[%d]\n", mb[12]);
+       }
 
        return 0;
 }
index 7b61c96502e4195c857e4df4a283f97dcd139763..9d7b66abfc10e5cbaa4cde41f019f4f71532bdfa 100644 (file)
@@ -504,6 +504,7 @@ int qla24xx_get_port_login_templ(scsi_qla_host_t *, dma_addr_t,
 
 extern int qla27xx_get_zio_threshold(scsi_qla_host_t *, uint16_t *);
 extern int qla27xx_set_zio_threshold(scsi_qla_host_t *, uint16_t);
+int qla24xx_res_count_wait(struct scsi_qla_host *, uint16_t *, int);
 
 /*
  * Global Function Prototypes in qla_isr.c source file.
index dea2e66be0b1cf61ff6294b33a1a7348bc3d9a49..adc93a505f1595f904e4673fb21da29f5706e1af 100644 (file)
@@ -17,6 +17,7 @@ static struct mb_cmd_name {
        {MBC_GET_PORT_DATABASE,         "GPDB"},
        {MBC_GET_ID_LIST,               "GIDList"},
        {MBC_GET_LINK_PRIV_STATS,       "Stats"},
+       {MBC_GET_RESOURCE_COUNTS,       "ResCnt"},
 };
 
 static const char *mb_to_str(uint16_t cmd)
@@ -6272,3 +6273,32 @@ qla2x00_read_sfp_dev(struct scsi_qla_host *vha, char *buf, int count)
 
        return rval;
 }
+
+int qla24xx_res_count_wait(struct scsi_qla_host *vha,
+    uint16_t *out_mb, int out_mb_sz)
+{
+       int rval = QLA_FUNCTION_FAILED;
+       mbx_cmd_t mc;
+
+       if (!vha->hw->flags.fw_started)
+               goto done;
+
+       memset(&mc, 0, sizeof(mc));
+       mc.mb[0] = MBC_GET_RESOURCE_COUNTS;
+
+       rval = qla24xx_send_mb_cmd(vha, &mc);
+       if (rval != QLA_SUCCESS) {
+               ql_dbg(ql_dbg_mbx, vha, 0xffff,
+                       "%s:  fail\n", __func__);
+       } else {
+               if (out_mb_sz <= SIZEOF_IOCB_MB_REG)
+                       memcpy(out_mb, mc.mb, out_mb_sz);
+               else
+                       memcpy(out_mb, mc.mb, SIZEOF_IOCB_MB_REG);
+
+               ql_dbg(ql_dbg_mbx, vha, 0xffff,
+                       "%s:  done\n", __func__);
+       }
+done:
+       return rval;
+}