Commit 443cc4b4 authored by Tyrel Datwyler's avatar Tyrel Datwyler Committed by Martin K. Petersen

scsi: ibmvfc: Simplify handling of sub-CRQ initialization

If ibmvfc_init_sub_crqs() fails ibmvfc_probe() simply parrots registration
failure reported elsewhere, and futher vhost->scsi_scrq.scrq == NULL is
indication enough to the driver that it has no sub-CRQs available. The
mq_enabled check can also be moved into ibmvfc_init_sub_crqs() such that
each caller doesn't have to gate the call with a mq_enabled check. Finally,
in the case of sub-CRQ setup failure setting do_enquiry can be turned off
to putting the driver into single queue fallback mode.

The aforementioned changes also simplify the next patch in the series that
fixes a hard reset issue, by tying a sub-CRQ setup failure and do_enquiry
logic into ibmvfc_init_sub_crqs().

Link: https://lore.kernel.org/r/20210302230543.9905-2-tyreld@linux.ibm.comReviewed-by: default avatarBrian King <brking@linux.ibm.com>
Signed-off-by: default avatarTyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent f69d02e3
...@@ -5707,17 +5707,21 @@ static void ibmvfc_deregister_scsi_channel(struct ibmvfc_host *vhost, int index) ...@@ -5707,17 +5707,21 @@ static void ibmvfc_deregister_scsi_channel(struct ibmvfc_host *vhost, int index)
LEAVE; LEAVE;
} }
static int ibmvfc_init_sub_crqs(struct ibmvfc_host *vhost) static void ibmvfc_init_sub_crqs(struct ibmvfc_host *vhost)
{ {
int i, j; int i, j;
ENTER; ENTER;
if (!vhost->mq_enabled)
return;
vhost->scsi_scrqs.scrqs = kcalloc(nr_scsi_hw_queues, vhost->scsi_scrqs.scrqs = kcalloc(nr_scsi_hw_queues,
sizeof(*vhost->scsi_scrqs.scrqs), sizeof(*vhost->scsi_scrqs.scrqs),
GFP_KERNEL); GFP_KERNEL);
if (!vhost->scsi_scrqs.scrqs) if (!vhost->scsi_scrqs.scrqs) {
return -1; vhost->do_enquiry = 0;
return;
}
for (i = 0; i < nr_scsi_hw_queues; i++) { for (i = 0; i < nr_scsi_hw_queues; i++) {
if (ibmvfc_register_scsi_channel(vhost, i)) { if (ibmvfc_register_scsi_channel(vhost, i)) {
...@@ -5726,13 +5730,12 @@ static int ibmvfc_init_sub_crqs(struct ibmvfc_host *vhost) ...@@ -5726,13 +5730,12 @@ static int ibmvfc_init_sub_crqs(struct ibmvfc_host *vhost)
kfree(vhost->scsi_scrqs.scrqs); kfree(vhost->scsi_scrqs.scrqs);
vhost->scsi_scrqs.scrqs = NULL; vhost->scsi_scrqs.scrqs = NULL;
vhost->scsi_scrqs.active_queues = 0; vhost->scsi_scrqs.active_queues = 0;
LEAVE; vhost->do_enquiry = 0;
return -1; break;
} }
} }
LEAVE; LEAVE;
return 0;
} }
static void ibmvfc_release_sub_crqs(struct ibmvfc_host *vhost) static void ibmvfc_release_sub_crqs(struct ibmvfc_host *vhost)
...@@ -5999,11 +6002,7 @@ static int ibmvfc_probe(struct vio_dev *vdev, const struct vio_device_id *id) ...@@ -5999,11 +6002,7 @@ static int ibmvfc_probe(struct vio_dev *vdev, const struct vio_device_id *id)
goto remove_shost; goto remove_shost;
} }
if (vhost->mq_enabled) { ibmvfc_init_sub_crqs(vhost);
rc = ibmvfc_init_sub_crqs(vhost);
if (rc)
dev_warn(dev, "Failed to allocate Sub-CRQs. rc=%d\n", rc);
}
if (shost_to_fc_host(shost)->rqst_q) if (shost_to_fc_host(shost)->rqst_q)
blk_queue_max_segments(shost_to_fc_host(shost)->rqst_q, 1); blk_queue_max_segments(shost_to_fc_host(shost)->rqst_q, 1);
......
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