Commit 9e560540 authored by Tyrel Datwyler's avatar Tyrel Datwyler Committed by Martin K. Petersen
Browse files

scsi: ibmvfc: Track max and desired queue size in ibmvfc_channels



Add fields for desired and max number of queues to ibmvfc_channels. With
support for NVMeoF protocol coming these sorts of values should be tracked
in the protocol specific channel struct instead of the overarching host
adapter.

Signed-off-by: default avatarTyrel Datwyler <tyreld@linux.ibm.com>
Link: https://lore.kernel.org/r/20230921225435.3537728-8-tyreld@linux.ibm.com


Reviewed-by: default avatarBrian King <brking@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent d3558ca8
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -1489,7 +1489,7 @@ static void ibmvfc_set_login_info(struct ibmvfc_host *vhost)
	max_cmds = scsi_qdepth + IBMVFC_NUM_INTERNAL_REQ;
	if (mq_enabled)
		max_cmds += (scsi_qdepth + IBMVFC_NUM_INTERNAL_SUBQ_REQ) *
			vhost->client_scsi_channels;
			vhost->scsi_scrqs.desired_queues;

	memset(login_info, 0, sizeof(*login_info));

@@ -3578,11 +3578,12 @@ static ssize_t ibmvfc_show_scsi_channels(struct device *dev,
{
	struct Scsi_Host *shost = class_to_shost(dev);
	struct ibmvfc_host *vhost = shost_priv(shost);
	struct ibmvfc_channels *scsi = &vhost->scsi_scrqs;
	unsigned long flags = 0;
	int len;

	spin_lock_irqsave(shost->host_lock, flags);
	len = snprintf(buf, PAGE_SIZE, "%d\n", vhost->client_scsi_channels);
	len = snprintf(buf, PAGE_SIZE, "%d\n", scsi->desired_queues);
	spin_unlock_irqrestore(shost->host_lock, flags);
	return len;
}
@@ -3593,12 +3594,13 @@ static ssize_t ibmvfc_store_scsi_channels(struct device *dev,
{
	struct Scsi_Host *shost = class_to_shost(dev);
	struct ibmvfc_host *vhost = shost_priv(shost);
	struct ibmvfc_channels *scsi = &vhost->scsi_scrqs;
	unsigned long flags = 0;
	unsigned int channels;

	spin_lock_irqsave(shost->host_lock, flags);
	channels = simple_strtoul(buf, NULL, 10);
	vhost->client_scsi_channels = min(channels, nr_scsi_hw_queues);
	scsi->desired_queues = min(channels, shost->nr_hw_queues);
	ibmvfc_hard_reset_host(vhost);
	spin_unlock_irqrestore(shost->host_lock, flags);
	return strlen(buf);
@@ -5066,7 +5068,7 @@ static void ibmvfc_channel_setup(struct ibmvfc_host *vhost)
	struct ibmvfc_event *evt = ibmvfc_get_reserved_event(&vhost->crq);
	struct ibmvfc_channels *scrqs = &vhost->scsi_scrqs;
	unsigned int num_channels =
		min(vhost->client_scsi_channels, vhost->max_vios_scsi_channels);
		min(scrqs->desired_queues, vhost->max_vios_scsi_channels);
	int level = IBMVFC_DEFAULT_LOG_LEVEL;
	int i;

@@ -6290,7 +6292,8 @@ static int ibmvfc_probe(struct vio_dev *vdev, const struct vio_device_id *id)
	vhost->task_set = 1;

	vhost->mq_enabled = mq_enabled;
	vhost->client_scsi_channels = min(shost->nr_hw_queues, nr_scsi_channels);
	vhost->scsi_scrqs.desired_queues = min(shost->nr_hw_queues, nr_scsi_channels);
	vhost->scsi_scrqs.max_queues = shost->nr_hw_queues;
	vhost->using_channels = 0;
	vhost->do_enquiry = 1;
	vhost->scan_timeout = 0;
+3 −2
Original line number Diff line number Diff line
@@ -818,6 +818,8 @@ struct ibmvfc_queue {
struct ibmvfc_channels {
	struct ibmvfc_queue *scrqs;
	unsigned int active_queues;
	unsigned int desired_queues;
	unsigned int max_queues;
};

enum ibmvfc_host_action {
@@ -876,8 +878,7 @@ struct ibmvfc_host {
	int log_level;
	struct ibmvfc_discover_targets_entry *disc_buf;
	struct mutex passthru_mutex;
	int max_vios_scsi_channels;
	int client_scsi_channels;
	unsigned int max_vios_scsi_channels;
	int task_set;
	int init_retries;
	int discovery_threads;