Skip to content

Commit 94d83e3

Browse files
Quinn Tranmartinkpetersen
authored andcommitted
scsi: qla2xxx: Tweak resource count dump
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>
1 parent 82abdca commit 94d83e3

File tree

3 files changed

+48
-15
lines changed

3 files changed

+48
-15
lines changed

drivers/scsi/qla2xxx/qla_dfs.c

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -127,21 +127,23 @@ static int
127127
qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused)
128128
{
129129
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);
130+
uint16_t mb[MAX_IOCB_MB_REG];
131+
int rc;
132+
133+
rc = qla24xx_res_count_wait(vha, mb, SIZEOF_IOCB_MB_REG);
134+
if (rc != QLA_SUCCESS) {
135+
seq_printf(s, "Mailbox Command failed %d, mb %#x", rc, mb[0]);
136+
} else {
137+
seq_puts(s, "FW Resource count\n\n");
138+
seq_printf(s, "Original TGT exchg count[%d]\n", mb[1]);
139+
seq_printf(s, "current TGT exchg count[%d]\n", mb[2]);
140+
seq_printf(s, "original Initiator Exchange count[%d]\n", mb[3]);
141+
seq_printf(s, "Current Initiator Exchange count[%d]\n", mb[6]);
142+
seq_printf(s, "Original IOCB count[%d]\n", mb[7]);
143+
seq_printf(s, "Current IOCB count[%d]\n", mb[10]);
144+
seq_printf(s, "MAX VP count[%d]\n", mb[11]);
145+
seq_printf(s, "MAX FCF count[%d]\n", mb[12]);
146+
}
145147

146148
return 0;
147149
}

drivers/scsi/qla2xxx/qla_gbl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,7 @@ int qla24xx_get_port_login_templ(scsi_qla_host_t *, dma_addr_t,
504504

505505
extern int qla27xx_get_zio_threshold(scsi_qla_host_t *, uint16_t *);
506506
extern int qla27xx_set_zio_threshold(scsi_qla_host_t *, uint16_t);
507+
int qla24xx_res_count_wait(struct scsi_qla_host *, uint16_t *, int);
507508

508509
/*
509510
* Global Function Prototypes in qla_isr.c source file.

drivers/scsi/qla2xxx/qla_mbx.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ static struct mb_cmd_name {
1717
{MBC_GET_PORT_DATABASE, "GPDB"},
1818
{MBC_GET_ID_LIST, "GIDList"},
1919
{MBC_GET_LINK_PRIV_STATS, "Stats"},
20+
{MBC_GET_RESOURCE_COUNTS, "ResCnt"},
2021
};
2122

2223
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)
62726273

62736274
return rval;
62746275
}
6276+
6277+
int qla24xx_res_count_wait(struct scsi_qla_host *vha,
6278+
uint16_t *out_mb, int out_mb_sz)
6279+
{
6280+
int rval = QLA_FUNCTION_FAILED;
6281+
mbx_cmd_t mc;
6282+
6283+
if (!vha->hw->flags.fw_started)
6284+
goto done;
6285+
6286+
memset(&mc, 0, sizeof(mc));
6287+
mc.mb[0] = MBC_GET_RESOURCE_COUNTS;
6288+
6289+
rval = qla24xx_send_mb_cmd(vha, &mc);
6290+
if (rval != QLA_SUCCESS) {
6291+
ql_dbg(ql_dbg_mbx, vha, 0xffff,
6292+
"%s: fail\n", __func__);
6293+
} else {
6294+
if (out_mb_sz <= SIZEOF_IOCB_MB_REG)
6295+
memcpy(out_mb, mc.mb, out_mb_sz);
6296+
else
6297+
memcpy(out_mb, mc.mb, SIZEOF_IOCB_MB_REG);
6298+
6299+
ql_dbg(ql_dbg_mbx, vha, 0xffff,
6300+
"%s: done\n", __func__);
6301+
}
6302+
done:
6303+
return rval;
6304+
}

0 commit comments

Comments
 (0)