Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 29bdccbe authored by Anirban Chakraborty's avatar Anirban Chakraborty Committed by James Bottomley
Browse files

[SCSI] qla2xxx: Fix ISP restart bug in multiq code



After restarting ISP the additional queues are not being setup correctly. The
following patch fixes the issue.
Please apply.

Signed-off-by: default avatarAnirban Chakraborty <anirban.chakraborty@qlogic.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent ccbf04f2
Loading
Loading
Loading
Loading
+36 −22
Original line number Original line Diff line number Diff line
@@ -1258,35 +1258,48 @@ qla2x00_init_rings(scsi_qla_host_t *vha)
{
{
	int	rval;
	int	rval;
	unsigned long flags = 0;
	unsigned long flags = 0;
	int cnt;
	int cnt, que;
	struct qla_hw_data *ha = vha->hw;
	struct qla_hw_data *ha = vha->hw;
	struct req_que *req = ha->req_q_map[0];
	struct req_que *req;
	struct rsp_que *rsp = ha->rsp_q_map[0];
	struct rsp_que *rsp;
	struct scsi_qla_host *vp;
	struct mid_init_cb_24xx *mid_init_cb =
	struct mid_init_cb_24xx *mid_init_cb =
	    (struct mid_init_cb_24xx *) ha->init_cb;
	    (struct mid_init_cb_24xx *) ha->init_cb;


	spin_lock_irqsave(&ha->hardware_lock, flags);
	spin_lock_irqsave(&ha->hardware_lock, flags);


	/* Clear outstanding commands array. */
	/* Clear outstanding commands array. */
	for (que = 0; que < ha->max_queues; que++) {
		req = ha->req_q_map[que];
		if (!req)
			continue;
		for (cnt = 0; cnt < MAX_OUTSTANDING_COMMANDS; cnt++)
		for (cnt = 0; cnt < MAX_OUTSTANDING_COMMANDS; cnt++)
			req->outstanding_cmds[cnt] = NULL;
			req->outstanding_cmds[cnt] = NULL;


		req->current_outstanding_cmd = 0;
		req->current_outstanding_cmd = 0;


	/* Clear RSCN queue. */
	vha->rscn_in_ptr = 0;
	vha->rscn_out_ptr = 0;

		/* Initialize firmware. */
		/* Initialize firmware. */
		req->ring_ptr  = req->ring;
		req->ring_ptr  = req->ring;
		req->ring_index    = 0;
		req->ring_index    = 0;
		req->cnt      = req->length;
		req->cnt      = req->length;
	}

	for (que = 0; que < ha->max_queues; que++) {
		rsp = ha->rsp_q_map[que];
		if (!rsp)
			continue;
		rsp->ring_ptr = rsp->ring;
		rsp->ring_ptr = rsp->ring;
		rsp->ring_index    = 0;
		rsp->ring_index    = 0;


		/* Initialize response queue entries */
		/* Initialize response queue entries */
		qla2x00_init_response_q_entries(rsp);
		qla2x00_init_response_q_entries(rsp);
	}


	/* Clear RSCN queue. */
	list_for_each_entry(vp, &ha->vp_list, list) {
		vp->rscn_in_ptr = 0;
		vp->rscn_out_ptr = 0;
	}
	ha->isp_ops->config_rings(vha);
	ha->isp_ops->config_rings(vha);


	spin_unlock_irqrestore(&ha->hardware_lock, flags);
	spin_unlock_irqrestore(&ha->hardware_lock, flags);
@@ -3212,8 +3225,8 @@ qla2x00_loop_resync(scsi_qla_host_t *vha)
	int rval = QLA_SUCCESS;
	int rval = QLA_SUCCESS;
	uint32_t wait_time;
	uint32_t wait_time;
	struct qla_hw_data *ha = vha->hw;
	struct qla_hw_data *ha = vha->hw;
	struct req_que *req = ha->req_q_map[0];
	struct req_que *req = ha->req_q_map[vha->req_ques[0]];
	struct rsp_que *rsp = ha->rsp_q_map[0];
	struct rsp_que *rsp = req->rsp;


	atomic_set(&vha->loop_state, LOOP_UPDATE);
	atomic_set(&vha->loop_state, LOOP_UPDATE);
	clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags);
	clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags);
@@ -3492,6 +3505,7 @@ qla25xx_init_queues(struct qla_hw_data *ha)
		}
		}
		req = ha->req_q_map[i];
		req = ha->req_q_map[i];
		if (req) {
		if (req) {
		/* Clear outstanding commands array. */
			req->options &= ~BIT_0;
			req->options &= ~BIT_0;
			ret = qla25xx_init_req_que(base_vha, req, req->options);
			ret = qla25xx_init_req_que(base_vha, req, req->options);
			if (ret != QLA_SUCCESS)
			if (ret != QLA_SUCCESS)
@@ -3500,7 +3514,7 @@ qla25xx_init_queues(struct qla_hw_data *ha)
						req->id));
						req->id));
			else
			else
				DEBUG2_17(printk(KERN_WARNING
				DEBUG2_17(printk(KERN_WARNING
					"%s Rsp que:%d inited\n", __func__,
					"%s Req que:%d inited\n", __func__,
						req->id));
						req->id));
		}
		}
	}
	}
@@ -4151,8 +4165,8 @@ qla24xx_configure_vhba(scsi_qla_host_t *vha)
	uint16_t mb[MAILBOX_REGISTER_COUNT];
	uint16_t mb[MAILBOX_REGISTER_COUNT];
	struct qla_hw_data *ha = vha->hw;
	struct qla_hw_data *ha = vha->hw;
	struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
	struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
	struct req_que *req = ha->req_q_map[0];
	struct req_que *req = ha->req_q_map[vha->req_ques[0]];
	struct rsp_que *rsp = ha->rsp_q_map[0];
	struct rsp_que *rsp = req->rsp;


	if (!vha->vp_idx)
	if (!vha->vp_idx)
		return -EINVAL;
		return -EINVAL;
+1 −0
Original line number Original line Diff line number Diff line
@@ -629,6 +629,7 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options,
	req->ring_index = 0;
	req->ring_index = 0;
	req->cnt = req->length;
	req->cnt = req->length;
	req->id = que_id;
	req->id = que_id;
	req->max_q_depth = ha->req_q_map[0]->max_q_depth;
	mutex_unlock(&ha->vport_lock);
	mutex_unlock(&ha->vport_lock);


	ret = qla25xx_init_req_que(base_vha, req, options);
	ret = qla25xx_init_req_que(base_vha, req, options);
+3 −4
Original line number Original line Diff line number Diff line
@@ -1158,8 +1158,8 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
	struct req_que *req;
	struct req_que *req;


	spin_lock_irqsave(&ha->hardware_lock, flags);
	spin_lock_irqsave(&ha->hardware_lock, flags);
	for (que = 0; que < QLA_MAX_HOST_QUES; que++) {
	for (que = 0; que < ha->max_queues; que++) {
		req = ha->req_q_map[vha->req_ques[que]];
		req = ha->req_q_map[que];
		if (!req)
		if (!req)
			continue;
			continue;
		for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) {
		for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) {
@@ -1193,7 +1193,7 @@ qla2xxx_slave_configure(struct scsi_device *sdev)
	scsi_qla_host_t *vha = shost_priv(sdev->host);
	scsi_qla_host_t *vha = shost_priv(sdev->host);
	struct qla_hw_data *ha = vha->hw;
	struct qla_hw_data *ha = vha->hw;
	struct fc_rport *rport = starget_to_rport(sdev->sdev_target);
	struct fc_rport *rport = starget_to_rport(sdev->sdev_target);
	struct req_que *req = ha->req_q_map[0];
	struct req_que *req = ha->req_q_map[vha->req_ques[0]];


	if (sdev->tagged_supported)
	if (sdev->tagged_supported)
		scsi_activate_tcq(sdev, req->max_q_depth);
		scsi_activate_tcq(sdev, req->max_q_depth);
@@ -1998,7 +1998,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
	return 0;
	return 0;


probe_failed:
probe_failed:
	qla2x00_free_que(ha, req, rsp);
	qla2x00_free_device(base_vha);
	qla2x00_free_device(base_vha);


	scsi_host_put(base_vha->host);
	scsi_host_put(base_vha->host);