Commit 7c3f8fd1 authored by Quinn Tran's avatar Quinn Tran Committed by Martin K. Petersen

scsi: qla2xxx: move fields from qla_hw_data to qla_qpair

- Move chip_reset, enable_class_2 fields from qla_hw_data to qla_qpair
  to reduce cache thrash for target MQ.
- Optimizations to reduce unnecessary memory load for good path io.
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 4b60c827
......@@ -2289,7 +2289,7 @@ qla2x00_init_host_attr(scsi_qla_host_t *vha)
fc_host_dev_loss_tmo(vha->host) = ha->port_down_retry_count;
fc_host_node_name(vha->host) = wwn_to_u64(vha->node_name);
fc_host_port_name(vha->host) = wwn_to_u64(vha->port_name);
fc_host_supported_classes(vha->host) = ha->tgt.enable_class_2 ?
fc_host_supported_classes(vha->host) = ha->base_qpair->enable_class_2 ?
(FC_COS_CLASS2|FC_COS_CLASS3) : FC_COS_CLASS3;
fc_host_max_npiv_vports(vha->host) = ha->max_npiv_vports;
fc_host_npiv_vports_inuse(vha->host) = ha->cur_vport_count;
......
......@@ -3252,6 +3252,7 @@ struct qla_qpair {
*/
spinlock_t *qp_lock_ptr;
struct scsi_qla_host *vha;
u32 chip_reset;
/* distill these fields down to 'online=0/1'
* ha->flags.eeh_busy
......@@ -3263,6 +3264,8 @@ struct qla_qpair {
uint32_t difdix_supported:1;
uint32_t delete_in_progress:1;
uint32_t fw_started:1;
uint32_t enable_class_2:1;
uint32_t enable_explicit_conf:1;
uint16_t id; /* qp number used with FW */
uint16_t vp_idx; /* vport ID */
......@@ -3296,8 +3299,6 @@ struct scsi_qlt_host {
struct qlt_hw_data {
/* Protected by hw lock */
uint32_t enable_class_2:1;
uint32_t enable_explicit_conf:1;
uint32_t node_name_set:1;
dma_addr_t atio_dma; /* Physical address. */
......@@ -3954,7 +3955,6 @@ struct qla_hw_data {
struct work_struct board_disable;
struct mr_data_fx00 mr;
uint32_t chip_reset;
struct qlt_hw_data tgt;
int allow_cna_fw_dump;
......@@ -4247,6 +4247,25 @@ struct qla2_sgx {
#define QLA_QPAIR_MARK_NOT_BUSY(__qpair) \
atomic_dec(&__qpair->ref_count); \
#define QLA_ENA_CONF(_ha) {\
int i;\
_ha->base_qpair->enable_explicit_conf = 1; \
for (i = 0; i < _ha->max_qpairs; i++) { \
if (_ha->queue_pair_map[i]) \
_ha->queue_pair_map[i]->enable_explicit_conf = 1; \
} \
}
#define QLA_DIS_CONF(_ha) {\
int i;\
_ha->base_qpair->enable_explicit_conf = 0; \
for (i = 0; i < _ha->max_qpairs; i++) { \
if (_ha->queue_pair_map[i]) \
_ha->queue_pair_map[i]->enable_explicit_conf = 0; \
} \
}
/*
* qla2x00 local function return status codes
*/
......
......@@ -1322,7 +1322,7 @@ qla24xx_handle_plogi_done_event(struct scsi_qla_host *vha, struct event_arg *ea)
ql_dbg(ql_dbg_disc, vha, 0x20ea,
"%s %d %8phC post gpdb\n",
__func__, __LINE__, ea->fcport->port_name);
ea->fcport->chip_reset = vha->hw->chip_reset;
ea->fcport->chip_reset = vha->hw->base_qpair->chip_reset;
ea->fcport->logout_on_delete = 1;
qla24xx_post_gpdb_work(vha, ea->fcport, 0);
break;
......@@ -5524,6 +5524,7 @@ qla2x00_abort_isp_cleanup(scsi_qla_host_t *vha)
struct scsi_qla_host *vp;
unsigned long flags;
fc_port_t *fcport;
u16 i;
/* For ISP82XX, driver waits for completion of the commands.
* online flag should be set.
......@@ -5549,7 +5550,12 @@ qla2x00_abort_isp_cleanup(scsi_qla_host_t *vha)
ha->current_topology = 0;
ha->flags.fw_started = 0;
ha->flags.fw_init_done = 0;
ha->chip_reset++;
ha->base_qpair->chip_reset++;
for (i = 0; i < ha->max_qpairs; i++) {
if (ha->queue_pair_map[i])
ha->queue_pair_map[i]->chip_reset =
ha->base_qpair->chip_reset;
}
atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
if (atomic_read(&vha->loop_state) != LOOP_DOWN) {
......@@ -7624,6 +7630,10 @@ struct qla_qpair *qla2xxx_create_qpair(struct scsi_qla_host *vha, int qos,
qpair->id = qpair_id;
qpair->vp_idx = vp_idx;
INIT_LIST_HEAD(&qpair->hints_list);
qpair->chip_reset = ha->base_qpair->chip_reset;
qpair->enable_class_2 = ha->base_qpair->enable_class_2;
qpair->enable_explicit_conf =
ha->base_qpair->enable_explicit_conf;
for (i = 0; i < ha->msix_count; i++) {
msix = &ha->msix_entries[i];
......
......@@ -387,6 +387,7 @@ static int qla2x00_alloc_queues(struct qla_hw_data *ha, struct req_que *req,
/* init qpair to this cpu. Will adjust at run time. */
ha->base_qpair->msix = &ha->msix_entries[QLA_MSIX_RSP_Q];
INIT_LIST_HEAD(&ha->base_qpair->hints_list);
ha->base_qpair->enable_class_2 = ql2xenableclass2;
qla_cpu_update(rsp->qpair, smp_processor_id());
if (ql2xmqsupport && ha->max_qpairs) {
......@@ -2708,7 +2709,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
ql_dbg_pci(ql_dbg_init, pdev, 0x000a,
"Memory allocated for ha=%p.\n", ha);
ha->pdev = pdev;
ha->tgt.enable_class_2 = ql2xenableclass2;
INIT_LIST_HEAD(&ha->tgt.q_full_list);
spin_lock_init(&ha->tgt.q_full_lock);
spin_lock_init(&ha->tgt.sess_lock);
......
This diff is collapsed.
......@@ -881,6 +881,7 @@ struct qla_tgt_cmd {
struct se_cmd se_cmd;
struct fc_port *sess;
struct qla_qpair *qpair;
uint32_t reset_count;
int state;
struct work_struct work;
/* Sense buffer that will be mapped into outgoing status */
......@@ -906,7 +907,6 @@ struct qla_tgt_cmd {
int offset;
u64 unpacked_lun;
enum dma_data_direction dma_data_direction;
uint32_t reset_count;
uint16_t loop_id; /* to save extra sess dereferences */
struct qla_tgt *tgt; /* to save extra sess dereferences */
......@@ -980,7 +980,6 @@ struct qla_tgt_prm {
int seg_cnt;
int req_cnt;
uint16_t rq_result;
uint16_t scsi_status;
int sense_buffer_len;
int residual;
int add_status_pkt;
......
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