aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.h7
-rw-r--r--drivers/scsi/megaraid/megaraid_sas_base.c69
-rw-r--r--drivers/scsi/megaraid/megaraid_sas_fusion.c8
3 files changed, 45 insertions, 39 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
index b8b378dec7ec..793b2b3552ff 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -1082,6 +1082,8 @@ enum MR_SCSI_CMD_TYPE {
1082 */ 1082 */
1083#define MEGASAS_INT_CMDS 32 1083#define MEGASAS_INT_CMDS 32
1084#define MEGASAS_SKINNY_INT_CMDS 5 1084#define MEGASAS_SKINNY_INT_CMDS 5
1085#define MEGASAS_FUSION_INTERNAL_CMDS 5
1086#define MEGASAS_FUSION_IOCTL_CMDS 3
1085 1087
1086#define MEGASAS_MAX_MSIX_QUEUES 128 1088#define MEGASAS_MAX_MSIX_QUEUES 128
1087/* 1089/*
@@ -1687,9 +1689,8 @@ struct megasas_instance {
1687 1689
1688 u16 max_num_sge; 1690 u16 max_num_sge;
1689 u16 max_fw_cmds; 1691 u16 max_fw_cmds;
1690 /* For Fusion its num IOCTL cmds, for others MFI based its
1691 max_fw_cmds */
1692 u16 max_mfi_cmds; 1692 u16 max_mfi_cmds;
1693 u16 max_scsi_cmds;
1693 u32 max_sectors_per_req; 1694 u32 max_sectors_per_req;
1694 struct megasas_aen_event *ev; 1695 struct megasas_aen_event *ev;
1695 1696
@@ -1765,7 +1766,7 @@ struct megasas_instance {
1765 u8 requestorId; 1766 u8 requestorId;
1766 char PlasmaFW111; 1767 char PlasmaFW111;
1767 char mpio; 1768 char mpio;
1768 int throttlequeuedepth; 1769 u16 throttlequeuedepth;
1769 u8 mask_interrupts; 1770 u8 mask_interrupts;
1770 u8 is_imr; 1771 u8 is_imr;
1771}; 1772};
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index d4e9c4e1bf58..bf31dde554ce 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -78,7 +78,7 @@ static int allow_vf_ioctls;
78module_param(allow_vf_ioctls, int, S_IRUGO); 78module_param(allow_vf_ioctls, int, S_IRUGO);
79MODULE_PARM_DESC(allow_vf_ioctls, "Allow ioctls in SR-IOV VF mode. Default: 0"); 79MODULE_PARM_DESC(allow_vf_ioctls, "Allow ioctls in SR-IOV VF mode. Default: 0");
80 80
81static int throttlequeuedepth = MEGASAS_THROTTLE_QUEUE_DEPTH; 81static unsigned int throttlequeuedepth = MEGASAS_THROTTLE_QUEUE_DEPTH;
82module_param(throttlequeuedepth, int, S_IRUGO); 82module_param(throttlequeuedepth, int, S_IRUGO);
83MODULE_PARM_DESC(throttlequeuedepth, 83MODULE_PARM_DESC(throttlequeuedepth,
84 "Adapter queue depth when throttled due to I/O timeout. Default: 16"); 84 "Adapter queue depth when throttled due to I/O timeout. Default: 16");
@@ -1764,6 +1764,7 @@ void
1764megasas_check_and_restore_queue_depth(struct megasas_instance *instance) 1764megasas_check_and_restore_queue_depth(struct megasas_instance *instance)
1765{ 1765{
1766 unsigned long flags; 1766 unsigned long flags;
1767
1767 if (instance->flag & MEGASAS_FW_BUSY 1768 if (instance->flag & MEGASAS_FW_BUSY
1768 && time_after(jiffies, instance->last_time + 5 * HZ) 1769 && time_after(jiffies, instance->last_time + 5 * HZ)
1769 && atomic_read(&instance->fw_outstanding) < 1770 && atomic_read(&instance->fw_outstanding) <
@@ -1771,13 +1772,8 @@ megasas_check_and_restore_queue_depth(struct megasas_instance *instance)
1771 1772
1772 spin_lock_irqsave(instance->host->host_lock, flags); 1773 spin_lock_irqsave(instance->host->host_lock, flags);
1773 instance->flag &= ~MEGASAS_FW_BUSY; 1774 instance->flag &= ~MEGASAS_FW_BUSY;
1774 if (instance->is_imr) {
1775 instance->host->can_queue =
1776 instance->max_fw_cmds - MEGASAS_SKINNY_INT_CMDS;
1777 } else
1778 instance->host->can_queue =
1779 instance->max_fw_cmds - MEGASAS_INT_CMDS;
1780 1775
1776 instance->host->can_queue = instance->max_scsi_cmds;
1781 spin_unlock_irqrestore(instance->host->host_lock, flags); 1777 spin_unlock_irqrestore(instance->host->host_lock, flags);
1782 } 1778 }
1783} 1779}
@@ -4685,23 +4681,38 @@ static int megasas_init_fw(struct megasas_instance *instance)
4685 if (tmp_sectors && (instance->max_sectors_per_req > tmp_sectors)) 4681 if (tmp_sectors && (instance->max_sectors_per_req > tmp_sectors))
4686 instance->max_sectors_per_req = tmp_sectors; 4682 instance->max_sectors_per_req = tmp_sectors;
4687 4683
4688 /* Check for valid throttlequeuedepth module parameter */ 4684 /*
4689 if (instance->is_imr) { 4685 * 1. For fusion adapters, 3 commands for IOCTL and 5 commands
4690 if (throttlequeuedepth > (instance->max_fw_cmds - 4686 * for driver's internal DCMDs.
4691 MEGASAS_SKINNY_INT_CMDS)) 4687 * 2. For MFI skinny adapters, 5 commands for IOCTL + driver's
4692 instance->throttlequeuedepth = 4688 * internal DCMDs.
4693 MEGASAS_THROTTLE_QUEUE_DEPTH; 4689 * 3. For rest of MFI adapters, 27 commands reserved for IOCTLs
4694 else 4690 * and 5 commands for drivers's internal DCMD.
4695 instance->throttlequeuedepth = throttlequeuedepth; 4691 */
4692 if (instance->ctrl_context) {
4693 instance->max_scsi_cmds = instance->max_fw_cmds -
4694 (MEGASAS_FUSION_INTERNAL_CMDS +
4695 MEGASAS_FUSION_IOCTL_CMDS);
4696 sema_init(&instance->ioctl_sem, MEGASAS_FUSION_IOCTL_CMDS);
4697 } else if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0073SKINNY) ||
4698 (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0071SKINNY)) {
4699 instance->max_scsi_cmds = instance->max_fw_cmds -
4700 MEGASAS_SKINNY_INT_CMDS;
4701 sema_init(&instance->ioctl_sem, MEGASAS_SKINNY_INT_CMDS);
4696 } else { 4702 } else {
4697 if (throttlequeuedepth > (instance->max_fw_cmds - 4703 instance->max_scsi_cmds = instance->max_fw_cmds -
4698 MEGASAS_INT_CMDS)) 4704 MEGASAS_INT_CMDS;
4699 instance->throttlequeuedepth = 4705 sema_init(&instance->ioctl_sem, (MEGASAS_INT_CMDS - 5));
4700 MEGASAS_THROTTLE_QUEUE_DEPTH;
4701 else
4702 instance->throttlequeuedepth = throttlequeuedepth;
4703 } 4706 }
4704 4707
4708 /* Check for valid throttlequeuedepth module parameter */
4709 if (throttlequeuedepth &&
4710 throttlequeuedepth <= instance->max_scsi_cmds)
4711 instance->throttlequeuedepth = throttlequeuedepth;
4712 else
4713 instance->throttlequeuedepth =
4714 MEGASAS_THROTTLE_QUEUE_DEPTH;
4715
4705 /* 4716 /*
4706 * Setup tasklet for cmd completion 4717 * Setup tasklet for cmd completion
4707 */ 4718 */
@@ -4996,12 +5007,7 @@ static int megasas_io_attach(struct megasas_instance *instance)
4996 */ 5007 */
4997 host->irq = instance->pdev->irq; 5008 host->irq = instance->pdev->irq;
4998 host->unique_id = instance->unique_id; 5009 host->unique_id = instance->unique_id;
4999 if (instance->is_imr) { 5010 host->can_queue = instance->max_scsi_cmds;
5000 host->can_queue =
5001 instance->max_fw_cmds - MEGASAS_SKINNY_INT_CMDS;
5002 } else
5003 host->can_queue =
5004 instance->max_fw_cmds - MEGASAS_INT_CMDS;
5005 host->this_id = instance->init_id; 5011 host->this_id = instance->init_id;
5006 host->sg_tablesize = instance->max_num_sge; 5012 host->sg_tablesize = instance->max_num_sge;
5007 5013
@@ -5264,12 +5270,10 @@ static int megasas_probe_one(struct pci_dev *pdev,
5264 instance->init_id = MEGASAS_DEFAULT_INIT_ID; 5270 instance->init_id = MEGASAS_DEFAULT_INIT_ID;
5265 instance->ctrl_info = NULL; 5271 instance->ctrl_info = NULL;
5266 5272
5273
5267 if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0073SKINNY) || 5274 if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0073SKINNY) ||
5268 (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0071SKINNY)) { 5275 (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0071SKINNY))
5269 instance->flag_ieee = 1; 5276 instance->flag_ieee = 1;
5270 sema_init(&instance->ioctl_sem, MEGASAS_SKINNY_INT_CMDS);
5271 } else
5272 sema_init(&instance->ioctl_sem, (MEGASAS_INT_CMDS - 5));
5273 5277
5274 megasas_dbg_lvl = 0; 5278 megasas_dbg_lvl = 0;
5275 instance->flag = 0; 5279 instance->flag = 0;
@@ -6264,9 +6268,6 @@ static int megasas_mgmt_ioctl_fw(struct file *file, unsigned long arg)
6264 goto out_kfree_ioc; 6268 goto out_kfree_ioc;
6265 } 6269 }
6266 6270
6267 /*
6268 * We will allow only MEGASAS_INT_CMDS number of parallel ioctl cmds
6269 */
6270 if (down_interruptible(&instance->ioctl_sem)) { 6271 if (down_interruptible(&instance->ioctl_sem)) {
6271 error = -ERESTARTSYS; 6272 error = -ERESTARTSYS;
6272 goto out_kfree_ioc; 6273 goto out_kfree_ioc;
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index df280b1d263f..675b5e7aba94 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -1019,8 +1019,12 @@ megasas_init_adapter_fusion(struct megasas_instance *instance)
1019 * does not exceed max cmds that the FW can support 1019 * does not exceed max cmds that the FW can support
1020 */ 1020 */
1021 instance->max_fw_cmds = instance->max_fw_cmds-1; 1021 instance->max_fw_cmds = instance->max_fw_cmds-1;
1022 /* Only internal cmds (DCMD) need to have MFI frames */ 1022
1023 instance->max_mfi_cmds = MEGASAS_INT_CMDS; 1023 /*
1024 * Only Driver's internal DCMDs and IOCTL DCMDs needs to have MFI frames
1025 */
1026 instance->max_mfi_cmds =
1027 MEGASAS_FUSION_INTERNAL_CMDS + MEGASAS_FUSION_IOCTL_CMDS;
1024 1028
1025 max_cmd = instance->max_fw_cmds; 1029 max_cmd = instance->max_fw_cmds;
1026 1030