Skip to content

Commit bb01163

Browse files
Justin Teemartinkpetersen
authored andcommitted
scsi: lpfc: Update lpfc_ramp_down_queue_handler() logic
Typically when an out of resource CQE status is detected, the lpfc_ramp_down_queue_handler() logic is called to help reduce I/O load by reducing an sdev's queue_depth. However, the current lpfc_rampdown_queue_depth() logic does not help reduce queue_depth. num_cmd_success is never updated and is always zero, which means new_queue_depth will always be set to sdev->queue_depth. So, new_queue_depth = sdev->queue_depth - new_queue_depth always sets new_queue_depth to zero. And, scsi_change_queue_depth(sdev, 0) is essentially a no-op. Change the lpfc_ramp_down_queue_handler() logic to set new_queue_depth equal to sdev->queue_depth subtracted from number of times num_rsrc_err was incremented. If num_rsrc_err is >= sdev->queue_depth, then set new_queue_depth equal to 1. Eventually, the frequency of Good_Status frames will signal SCSI upper layer to auto increase the queue_depth back to the driver default of 64 via scsi_handle_queue_ramp_up(). Signed-off-by: Justin Tee <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 4623713 commit bb01163

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

drivers/scsi/lpfc/lpfc.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,6 @@ struct lpfc_hba {
13331333
struct timer_list fabric_block_timer;
13341334
unsigned long bit_flags;
13351335
atomic_t num_rsrc_err;
1336-
atomic_t num_cmd_success;
13371336
unsigned long last_rsrc_error_time;
13381337
unsigned long last_ramp_down_time;
13391338
#ifdef CONFIG_SCSI_LPFC_DEBUG_FS

drivers/scsi/lpfc/lpfc_scsi.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,10 @@ lpfc_ramp_down_queue_handler(struct lpfc_hba *phba)
167167
struct Scsi_Host *shost;
168168
struct scsi_device *sdev;
169169
unsigned long new_queue_depth;
170-
unsigned long num_rsrc_err, num_cmd_success;
170+
unsigned long num_rsrc_err;
171171
int i;
172172

173173
num_rsrc_err = atomic_read(&phba->num_rsrc_err);
174-
num_cmd_success = atomic_read(&phba->num_cmd_success);
175174

176175
/*
177176
* The error and success command counters are global per
@@ -186,20 +185,16 @@ lpfc_ramp_down_queue_handler(struct lpfc_hba *phba)
186185
for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) {
187186
shost = lpfc_shost_from_vport(vports[i]);
188187
shost_for_each_device(sdev, shost) {
189-
new_queue_depth =
190-
sdev->queue_depth * num_rsrc_err /
191-
(num_rsrc_err + num_cmd_success);
192-
if (!new_queue_depth)
193-
new_queue_depth = sdev->queue_depth - 1;
188+
if (num_rsrc_err >= sdev->queue_depth)
189+
new_queue_depth = 1;
194190
else
195191
new_queue_depth = sdev->queue_depth -
196-
new_queue_depth;
192+
num_rsrc_err;
197193
scsi_change_queue_depth(sdev, new_queue_depth);
198194
}
199195
}
200196
lpfc_destroy_vport_work_array(phba, vports);
201197
atomic_set(&phba->num_rsrc_err, 0);
202-
atomic_set(&phba->num_cmd_success, 0);
203198
}
204199

205200
/**

0 commit comments

Comments
 (0)