Commit 94d83e36 authored by Quinn Tran's avatar Quinn Tran Committed by Martin K. Petersen

scsi: qla2xxx: Tweak resource count dump

Fetch actual data from firmware instead of static data
at chip reset time.
Signed-off-by: default avatarQuinn Tran <quinn.tran@qlogic.com>
Signed-off-by: default avatarHimanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 82abdcaf
...@@ -127,21 +127,23 @@ static int ...@@ -127,21 +127,23 @@ static int
qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused) qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused)
{ {
struct scsi_qla_host *vha = s->private; struct scsi_qla_host *vha = s->private;
struct qla_hw_data *ha = vha->hw; 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_puts(s, "FW Resource count\n\n");
seq_printf(s, "Original TGT exchg count[%d]\n", seq_printf(s, "Original TGT exchg count[%d]\n", mb[1]);
ha->orig_fw_tgt_xcb_count); seq_printf(s, "current TGT exchg count[%d]\n", mb[2]);
seq_printf(s, "current TGT exchg count[%d]\n", seq_printf(s, "original Initiator Exchange count[%d]\n", mb[3]);
ha->cur_fw_tgt_xcb_count); seq_printf(s, "Current Initiator Exchange count[%d]\n", mb[6]);
seq_printf(s, "original Initiator Exchange count[%d]\n", seq_printf(s, "Original IOCB count[%d]\n", mb[7]);
ha->orig_fw_xcb_count); seq_printf(s, "Current IOCB count[%d]\n", mb[10]);
seq_printf(s, "Current Initiator Exchange count[%d]\n", seq_printf(s, "MAX VP count[%d]\n", mb[11]);
ha->cur_fw_xcb_count); seq_printf(s, "MAX FCF count[%d]\n", mb[12]);
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);
return 0; return 0;
} }
......
...@@ -504,6 +504,7 @@ int qla24xx_get_port_login_templ(scsi_qla_host_t *, dma_addr_t, ...@@ -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_get_zio_threshold(scsi_qla_host_t *, uint16_t *);
extern int qla27xx_set_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. * Global Function Prototypes in qla_isr.c source file.
......
...@@ -17,6 +17,7 @@ static struct mb_cmd_name { ...@@ -17,6 +17,7 @@ static struct mb_cmd_name {
{MBC_GET_PORT_DATABASE, "GPDB"}, {MBC_GET_PORT_DATABASE, "GPDB"},
{MBC_GET_ID_LIST, "GIDList"}, {MBC_GET_ID_LIST, "GIDList"},
{MBC_GET_LINK_PRIV_STATS, "Stats"}, {MBC_GET_LINK_PRIV_STATS, "Stats"},
{MBC_GET_RESOURCE_COUNTS, "ResCnt"},
}; };
static const char *mb_to_str(uint16_t cmd) 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) ...@@ -6272,3 +6273,32 @@ qla2x00_read_sfp_dev(struct scsi_qla_host *vha, char *buf, int count)
return rval; 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;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment