Skip to content

Commit 9e56054

Browse files
tyreldmartinkpetersen
authored andcommitted
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: Tyrel Datwyler <tyreld@linux.ibm.com> Link: https://lore.kernel.org/r/20230921225435.3537728-8-tyreld@linux.ibm.com Reviewed-by: Brian King <brking@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent d3558ca commit 9e56054

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

drivers/scsi/ibmvscsi/ibmvfc.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,7 +1489,7 @@ static void ibmvfc_set_login_info(struct ibmvfc_host *vhost)
14891489
max_cmds = scsi_qdepth + IBMVFC_NUM_INTERNAL_REQ;
14901490
if (mq_enabled)
14911491
max_cmds += (scsi_qdepth + IBMVFC_NUM_INTERNAL_SUBQ_REQ) *
1492-
vhost->client_scsi_channels;
1492+
vhost->scsi_scrqs.desired_queues;
14931493

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

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

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

35993601
spin_lock_irqsave(shost->host_lock, flags);
36003602
channels = simple_strtoul(buf, NULL, 10);
3601-
vhost->client_scsi_channels = min(channels, nr_scsi_hw_queues);
3603+
scsi->desired_queues = min(channels, shost->nr_hw_queues);
36023604
ibmvfc_hard_reset_host(vhost);
36033605
spin_unlock_irqrestore(shost->host_lock, flags);
36043606
return strlen(buf);
@@ -5066,7 +5068,7 @@ static void ibmvfc_channel_setup(struct ibmvfc_host *vhost)
50665068
struct ibmvfc_event *evt = ibmvfc_get_reserved_event(&vhost->crq);
50675069
struct ibmvfc_channels *scrqs = &vhost->scsi_scrqs;
50685070
unsigned int num_channels =
5069-
min(vhost->client_scsi_channels, vhost->max_vios_scsi_channels);
5071+
min(scrqs->desired_queues, vhost->max_vios_scsi_channels);
50705072
int level = IBMVFC_DEFAULT_LOG_LEVEL;
50715073
int i;
50725074

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

62926294
vhost->mq_enabled = mq_enabled;
6293-
vhost->client_scsi_channels = min(shost->nr_hw_queues, nr_scsi_channels);
6295+
vhost->scsi_scrqs.desired_queues = min(shost->nr_hw_queues, nr_scsi_channels);
6296+
vhost->scsi_scrqs.max_queues = shost->nr_hw_queues;
62946297
vhost->using_channels = 0;
62956298
vhost->do_enquiry = 1;
62966299
vhost->scan_timeout = 0;

drivers/scsi/ibmvscsi/ibmvfc.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,8 @@ struct ibmvfc_queue {
818818
struct ibmvfc_channels {
819819
struct ibmvfc_queue *scrqs;
820820
unsigned int active_queues;
821+
unsigned int desired_queues;
822+
unsigned int max_queues;
821823
};
822824

823825
enum ibmvfc_host_action {
@@ -876,8 +878,7 @@ struct ibmvfc_host {
876878
int log_level;
877879
struct ibmvfc_discover_targets_entry *disc_buf;
878880
struct mutex passthru_mutex;
879-
int max_vios_scsi_channels;
880-
int client_scsi_channels;
881+
unsigned int max_vios_scsi_channels;
881882
int task_set;
882883
int init_retries;
883884
int discovery_threads;

0 commit comments

Comments
 (0)