Commit 4b60c827 authored by Quinn Tran's avatar Quinn Tran Committed by Martin K. Petersen

scsi: qla2xxx: Add fw_started flags to qpair

Add fw_started flag to qpair to reduce cache thrash.  This reduce access
to qla_hw_data structure by each qpair.
Signed-off-by: default avatarQuinn Tran <quinn.tran@cavium.com>
Signed-off-by: default avatarHimanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 09620eeb
...@@ -3262,6 +3262,7 @@ struct qla_qpair { ...@@ -3262,6 +3262,7 @@ struct qla_qpair {
/* move vha->flags.difdix_supported here */ /* move vha->flags.difdix_supported here */
uint32_t difdix_supported:1; uint32_t difdix_supported:1;
uint32_t delete_in_progress:1; uint32_t delete_in_progress:1;
uint32_t fw_started:1;
uint16_t id; /* qp number used with FW */ uint16_t id; /* qp number used with FW */
uint16_t vp_idx; /* vport ID */ uint16_t vp_idx; /* vport ID */
...@@ -4183,6 +4184,26 @@ struct qla2_sgx { ...@@ -4183,6 +4184,26 @@ struct qla2_sgx {
srb_t *sp; srb_t *sp;
}; };
#define QLA_FW_STARTED(_ha) { \
int i; \
_ha->flags.fw_started = 1; \
_ha->base_qpair->fw_started = 1; \
for (i = 0; i < _ha->max_qpairs; i++) { \
if (_ha->queue_pair_map[i]) \
_ha->queue_pair_map[i]->fw_started = 1; \
} \
}
#define QLA_FW_STOPPED(_ha) { \
int i; \
_ha->flags.fw_started = 0; \
_ha->base_qpair->fw_started = 0; \
for (i = 0; i < _ha->max_qpairs; i++) { \
if (_ha->queue_pair_map[i]) \
_ha->queue_pair_map[i]->fw_started = 0; \
} \
}
/* /*
* Macros to help code, maintain, etc. * Macros to help code, maintain, etc.
*/ */
......
...@@ -3207,7 +3207,7 @@ qla2x00_init_rings(scsi_qla_host_t *vha) ...@@ -3207,7 +3207,7 @@ qla2x00_init_rings(scsi_qla_host_t *vha)
} else { } else {
ql_dbg(ql_dbg_init, vha, 0x00d3, ql_dbg(ql_dbg_init, vha, 0x00d3,
"Init Firmware -- success.\n"); "Init Firmware -- success.\n");
ha->flags.fw_started = 1; QLA_FW_STARTED(ha);
} }
return (rval); return (rval);
...@@ -6841,7 +6841,7 @@ qla2x00_try_to_stop_firmware(scsi_qla_host_t *vha) ...@@ -6841,7 +6841,7 @@ qla2x00_try_to_stop_firmware(scsi_qla_host_t *vha)
ret = qla2x00_stop_firmware(vha); ret = qla2x00_stop_firmware(vha);
} }
ha->flags.fw_started = 0; QLA_FW_STOPPED(ha);
ha->flags.fw_init_done = 0; ha->flags.fw_init_done = 0;
} }
......
...@@ -710,7 +710,7 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb) ...@@ -710,7 +710,7 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb)
ha->isp_ops->fw_dump(vha, 1); ha->isp_ops->fw_dump(vha, 1);
ha->flags.fw_init_done = 0; ha->flags.fw_init_done = 0;
ha->flags.fw_started = 0; QLA_FW_STOPPED(ha);
if (IS_FWI2_CAPABLE(ha)) { if (IS_FWI2_CAPABLE(ha)) {
if (mb[1] == 0 && mb[2] == 0) { if (mb[1] == 0 && mb[2] == 0) {
......
...@@ -3086,7 +3086,7 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type, ...@@ -3086,7 +3086,7 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type,
else else
vha->tgt_counters.core_qla_que_buf++; vha->tgt_counters.core_qla_que_buf++;
if (!ha->flags.fw_started || cmd->reset_count != ha->chip_reset) { if (!qpair->fw_started || cmd->reset_count != vha->hw->chip_reset) {
/* /*
* Either the port is not online or this request was from * Either the port is not online or this request was from
* previous life, just abort the processing. * previous life, just abort the processing.
...@@ -3096,7 +3096,7 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type, ...@@ -3096,7 +3096,7 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type,
ql_dbg(ql_dbg_async, vha, 0xe101, ql_dbg(ql_dbg_async, vha, 0xe101,
"RESET-RSP online/active/old-count/new-count = %d/%d/%d/%d.\n", "RESET-RSP online/active/old-count/new-count = %d/%d/%d/%d.\n",
vha->flags.online, qla2x00_reset_active(vha), vha->flags.online, qla2x00_reset_active(vha),
cmd->reset_count, ha->chip_reset); cmd->reset_count, vha->hw->chip_reset);
spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); spin_unlock_irqrestore(qpair->qp_lock_ptr, flags);
return 0; return 0;
} }
...@@ -3206,7 +3206,6 @@ int qlt_rdy_to_xfer(struct qla_tgt_cmd *cmd) ...@@ -3206,7 +3206,6 @@ int qlt_rdy_to_xfer(struct qla_tgt_cmd *cmd)
{ {
struct ctio7_to_24xx *pkt; struct ctio7_to_24xx *pkt;
struct scsi_qla_host *vha = cmd->vha; struct scsi_qla_host *vha = cmd->vha;
struct qla_hw_data *ha = vha->hw;
struct qla_tgt *tgt = cmd->tgt; struct qla_tgt *tgt = cmd->tgt;
struct qla_tgt_prm prm; struct qla_tgt_prm prm;
unsigned long flags = 0; unsigned long flags = 0;
...@@ -3223,7 +3222,7 @@ int qlt_rdy_to_xfer(struct qla_tgt_cmd *cmd) ...@@ -3223,7 +3222,7 @@ int qlt_rdy_to_xfer(struct qla_tgt_cmd *cmd)
if (qlt_pci_map_calc_cnt(&prm) != 0) if (qlt_pci_map_calc_cnt(&prm) != 0)
return -EAGAIN; return -EAGAIN;
if (!ha->flags.fw_started || (cmd->reset_count != ha->chip_reset) || if (!qpair->fw_started || (cmd->reset_count != vha->hw->chip_reset) ||
(cmd->sess && cmd->sess->deleted)) { (cmd->sess && cmd->sess->deleted)) {
/* /*
* Either the port is not online or this request was from * Either the port is not online or this request was from
...@@ -3234,7 +3233,7 @@ int qlt_rdy_to_xfer(struct qla_tgt_cmd *cmd) ...@@ -3234,7 +3233,7 @@ int qlt_rdy_to_xfer(struct qla_tgt_cmd *cmd)
ql_dbg(ql_dbg_async, vha, 0xe102, ql_dbg(ql_dbg_async, vha, 0xe102,
"RESET-XFR online/active/old-count/new-count = %d/%d/%d/%d.\n", "RESET-XFR online/active/old-count/new-count = %d/%d/%d/%d.\n",
vha->flags.online, qla2x00_reset_active(vha), vha->flags.online, qla2x00_reset_active(vha),
cmd->reset_count, ha->chip_reset); cmd->reset_count, vha->hw->chip_reset);
return 0; return 0;
} }
......
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