Commit c5daa6a9 authored by adam radford's avatar adam radford Committed by James Bottomley

[SCSI] megaraid_sas: Add throttlequeuedepth module parameter

This allows a user to adjust the queue depth of the adapter when throttled due
to I/O timeout.
Signed-off-by: default avatarAdam Radford <aradford@gmail.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent b5e5ddcd
...@@ -747,6 +747,7 @@ struct megasas_ctrl_info { ...@@ -747,6 +747,7 @@ struct megasas_ctrl_info {
#define MEGASAS_RESET_NOTICE_INTERVAL 5 #define MEGASAS_RESET_NOTICE_INTERVAL 5
#define MEGASAS_IOCTL_CMD 0 #define MEGASAS_IOCTL_CMD 0
#define MEGASAS_DEFAULT_CMD_TIMEOUT 90 #define MEGASAS_DEFAULT_CMD_TIMEOUT 90
#define MEGASAS_THROTTLE_QUEUE_DEPTH 16
/* /*
* FW reports the maximum of number of commands that it can accept (maximum * FW reports the maximum of number of commands that it can accept (maximum
...@@ -1364,6 +1365,7 @@ struct megasas_instance { ...@@ -1364,6 +1365,7 @@ struct megasas_instance {
unsigned long bar; unsigned long bar;
long reset_flags; long reset_flags;
struct mutex reset_mutex; struct mutex reset_mutex;
int throttlequeuedepth;
}; };
enum { enum {
......
...@@ -71,6 +71,11 @@ static int msix_disable; ...@@ -71,6 +71,11 @@ static int msix_disable;
module_param(msix_disable, int, S_IRUGO); module_param(msix_disable, int, S_IRUGO);
MODULE_PARM_DESC(msix_disable, "Disable MSI-X interrupt handling. Default: 0"); MODULE_PARM_DESC(msix_disable, "Disable MSI-X interrupt handling. Default: 0");
static int throttlequeuedepth = MEGASAS_THROTTLE_QUEUE_DEPTH;
module_param(throttlequeuedepth, int, S_IRUGO);
MODULE_PARM_DESC(throttlequeuedepth,
"Adapter queue depth when throttled due to I/O timeout. Default: 16");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_VERSION(MEGASAS_VERSION); MODULE_VERSION(MEGASAS_VERSION);
MODULE_AUTHOR("megaraidlinux@lsi.com"); MODULE_AUTHOR("megaraidlinux@lsi.com");
...@@ -1595,8 +1600,9 @@ megasas_check_and_restore_queue_depth(struct megasas_instance *instance) ...@@ -1595,8 +1600,9 @@ megasas_check_and_restore_queue_depth(struct megasas_instance *instance)
{ {
unsigned long flags; unsigned long flags;
if (instance->flag & MEGASAS_FW_BUSY if (instance->flag & MEGASAS_FW_BUSY
&& time_after(jiffies, instance->last_time + 5 * HZ) && time_after(jiffies, instance->last_time + 5 * HZ)
&& atomic_read(&instance->fw_outstanding) < 17) { && atomic_read(&instance->fw_outstanding) <
instance->throttlequeuedepth + 1) {
spin_lock_irqsave(instance->host->host_lock, flags); spin_lock_irqsave(instance->host->host_lock, flags);
instance->flag &= ~MEGASAS_FW_BUSY; instance->flag &= ~MEGASAS_FW_BUSY;
...@@ -1914,7 +1920,7 @@ blk_eh_timer_return megasas_reset_timer(struct scsi_cmnd *scmd) ...@@ -1914,7 +1920,7 @@ blk_eh_timer_return megasas_reset_timer(struct scsi_cmnd *scmd)
/* FW is busy, throttle IO */ /* FW is busy, throttle IO */
spin_lock_irqsave(instance->host->host_lock, flags); spin_lock_irqsave(instance->host->host_lock, flags);
instance->host->can_queue = 16; instance->host->can_queue = instance->throttlequeuedepth;
instance->last_time = jiffies; instance->last_time = jiffies;
instance->flag |= MEGASAS_FW_BUSY; instance->flag |= MEGASAS_FW_BUSY;
...@@ -3577,6 +3583,24 @@ static int megasas_init_fw(struct megasas_instance *instance) ...@@ -3577,6 +3583,24 @@ static int megasas_init_fw(struct megasas_instance *instance)
kfree(ctrl_info); kfree(ctrl_info);
/* Check for valid throttlequeuedepth module parameter */
if (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0073SKINNY ||
instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0071SKINNY) {
if (throttlequeuedepth > (instance->max_fw_cmds -
MEGASAS_SKINNY_INT_CMDS))
instance->throttlequeuedepth =
MEGASAS_THROTTLE_QUEUE_DEPTH;
else
instance->throttlequeuedepth = throttlequeuedepth;
} else {
if (throttlequeuedepth > (instance->max_fw_cmds -
MEGASAS_INT_CMDS))
instance->throttlequeuedepth =
MEGASAS_THROTTLE_QUEUE_DEPTH;
else
instance->throttlequeuedepth = throttlequeuedepth;
}
/* /*
* Setup tasklet for cmd completion * Setup tasklet for cmd completion
*/ */
......
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