scsi: qla2xxx: use shadow register for ISP27XX
authorQuinn Tran <quinn.tran@cavium.com>
Wed, 14 Jun 2017 03:47:23 +0000 (20:47 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 28 Jun 2017 01:21:41 +0000 (21:21 -0400)
For ISP27XX, use shadow register to read FW provided REQQ's consumer
index.  The shadow register is dma'ed by firmware.

Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla2xxx/qla_def.h
drivers/scsi/qla2xxx/qla_init.c
drivers/scsi/qla2xxx/qla_os.c
drivers/scsi/qla2xxx/qla_target.c

index dfa001357110eb2cb7476bdd50f46ff3063c3368..b3ba32773db4763203c3cab356f0d273e1178354 100644 (file)
@@ -3266,6 +3266,7 @@ struct qla_qpair {
        uint32_t fw_started:1;
        uint32_t enable_class_2:1;
        uint32_t enable_explicit_conf:1;
+       uint32_t use_shadow_reg:1;
 
        uint16_t id;                    /* qp number used with FW */
        uint16_t vp_idx;                /* vport ID */
index 3e5f193480f005d9ac1fdc3e507295f69527012e..62c856cad7ec9ba539b9979230d1492037c22dfc 100644 (file)
@@ -7614,6 +7614,7 @@ struct qla_qpair *qla2xxx_create_qpair(struct scsi_qla_host *vha, int qos,
                qpair->vha = vha;
                qpair->qp_lock_ptr = &qpair->qp_lock;
                spin_lock_init(&qpair->qp_lock);
+               qpair->use_shadow_reg = IS_SHADOW_REG_CAPABLE(ha) ? 1 : 0;
 
                /* Assign available que pair id */
                mutex_lock(&ha->mq_lock);
index 44be2c8237fd5378a1f5e2b0c412dc791e045883..1d66954b7e5a8efd3ac692f7a81838dd40049de2 100644 (file)
@@ -384,6 +384,7 @@ static int qla2x00_alloc_queues(struct qla_hw_data *ha, struct req_que *req,
        ha->base_qpair->rsp = rsp;
        ha->base_qpair->vha = vha;
        ha->base_qpair->qp_lock_ptr = &ha->hardware_lock;
+       ha->base_qpair->use_shadow_reg = IS_SHADOW_REG_CAPABLE(ha) ? 1 : 0;
        /* 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);
index 7e6c575e3e292efffd0ba7e06f5fee823ed94b29..1d8b5f14a69cf3a62c132edcf9f3599b76e18d0d 100644 (file)
@@ -2288,7 +2288,8 @@ static int qlt_check_reserve_free_req(struct qla_qpair *qpair,
        struct req_que *req = qpair->req;
 
        if (req->cnt < (req_cnt + 2)) {
-               cnt = (uint16_t)RD_REG_DWORD(req->req_q_out);
+               cnt = (uint16_t)(qpair->use_shadow_reg ? *req->out_ptr :
+                   RD_REG_DWORD_RELAXED(req->req_q_out));
 
                if  (req->ring_index < cnt)
                        req->cnt = cnt - req->ring_index;