mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-12 20:35:23 +02:00
scsi: lpfc: Update lpfc_ramp_down_queue_handler() logic
[ Upstream commit bb01163143
]
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 <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20240305200503.57317-5-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
5e60791649
commit
4aba3ca53b
|
@ -1325,7 +1325,6 @@ struct lpfc_hba {
|
||||||
struct timer_list fabric_block_timer;
|
struct timer_list fabric_block_timer;
|
||||||
unsigned long bit_flags;
|
unsigned long bit_flags;
|
||||||
atomic_t num_rsrc_err;
|
atomic_t num_rsrc_err;
|
||||||
atomic_t num_cmd_success;
|
|
||||||
unsigned long last_rsrc_error_time;
|
unsigned long last_rsrc_error_time;
|
||||||
unsigned long last_ramp_down_time;
|
unsigned long last_ramp_down_time;
|
||||||
#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
|
#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
|
||||||
|
|
|
@ -167,11 +167,10 @@ lpfc_ramp_down_queue_handler(struct lpfc_hba *phba)
|
||||||
struct Scsi_Host *shost;
|
struct Scsi_Host *shost;
|
||||||
struct scsi_device *sdev;
|
struct scsi_device *sdev;
|
||||||
unsigned long new_queue_depth;
|
unsigned long new_queue_depth;
|
||||||
unsigned long num_rsrc_err, num_cmd_success;
|
unsigned long num_rsrc_err;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
num_rsrc_err = atomic_read(&phba->num_rsrc_err);
|
num_rsrc_err = atomic_read(&phba->num_rsrc_err);
|
||||||
num_cmd_success = atomic_read(&phba->num_cmd_success);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The error and success command counters are global per
|
* The error and success command counters are global per
|
||||||
|
@ -186,20 +185,16 @@ lpfc_ramp_down_queue_handler(struct lpfc_hba *phba)
|
||||||
for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) {
|
for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) {
|
||||||
shost = lpfc_shost_from_vport(vports[i]);
|
shost = lpfc_shost_from_vport(vports[i]);
|
||||||
shost_for_each_device(sdev, shost) {
|
shost_for_each_device(sdev, shost) {
|
||||||
new_queue_depth =
|
if (num_rsrc_err >= sdev->queue_depth)
|
||||||
sdev->queue_depth * num_rsrc_err /
|
new_queue_depth = 1;
|
||||||
(num_rsrc_err + num_cmd_success);
|
|
||||||
if (!new_queue_depth)
|
|
||||||
new_queue_depth = sdev->queue_depth - 1;
|
|
||||||
else
|
else
|
||||||
new_queue_depth = sdev->queue_depth -
|
new_queue_depth = sdev->queue_depth -
|
||||||
new_queue_depth;
|
num_rsrc_err;
|
||||||
scsi_change_queue_depth(sdev, new_queue_depth);
|
scsi_change_queue_depth(sdev, new_queue_depth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lpfc_destroy_vport_work_array(phba, vports);
|
lpfc_destroy_vport_work_array(phba, vports);
|
||||||
atomic_set(&phba->num_rsrc_err, 0);
|
atomic_set(&phba->num_rsrc_err, 0);
|
||||||
atomic_set(&phba->num_cmd_success, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user