diff options
author | adam radford <aradford@gmail.com> | 2010-12-21 13:17:40 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-12-23 00:26:51 -0500 |
commit | 80d9da98b4034edd31f6bacdb96c7489c4460173 (patch) | |
tree | 6577cb9ef6b9ea38fafb289154067f502a85a723 /drivers/scsi/megaraid | |
parent | 46081b166415acb66d4b3150ecefcd9460bb48a1 (diff) |
[SCSI] megaraid_sas: Add MSI-X support and msix_disable module parameter
This patch adds MSI-X support and 'msix_disable' module parameter to
the megaraid_sas driver.
Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/megaraid')
-rw-r--r-- | drivers/scsi/megaraid/megaraid_sas.h | 3 | ||||
-rw-r--r-- | drivers/scsi/megaraid/megaraid_sas_base.c | 41 |
2 files changed, 37 insertions, 7 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 224ec31e5c97..ff9845c72a67 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h | |||
@@ -1335,6 +1335,9 @@ struct megasas_instance { | |||
1335 | 1335 | ||
1336 | struct timer_list io_completion_timer; | 1336 | struct timer_list io_completion_timer; |
1337 | struct list_head internal_reset_pending_q; | 1337 | struct list_head internal_reset_pending_q; |
1338 | |||
1339 | u8 msi_flag; | ||
1340 | struct msix_entry msixentry; | ||
1338 | }; | 1341 | }; |
1339 | 1342 | ||
1340 | enum { | 1343 | enum { |
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index dab29db3b48e..2318183f9a67 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c | |||
@@ -72,6 +72,10 @@ module_param_named(max_sectors, max_sectors, int, 0); | |||
72 | MODULE_PARM_DESC(max_sectors, | 72 | MODULE_PARM_DESC(max_sectors, |
73 | "Maximum number of sectors per IO command"); | 73 | "Maximum number of sectors per IO command"); |
74 | 74 | ||
75 | static int msix_disable; | ||
76 | module_param(msix_disable, int, S_IRUGO); | ||
77 | MODULE_PARM_DESC(msix_disable, "Disable MSI-X interrupt handling. Default: 0"); | ||
78 | |||
75 | MODULE_LICENSE("GPL"); | 79 | MODULE_LICENSE("GPL"); |
76 | MODULE_VERSION(MEGASAS_VERSION); | 80 | MODULE_VERSION(MEGASAS_VERSION); |
77 | MODULE_AUTHOR("megaraidlinux@lsi.com"); | 81 | MODULE_AUTHOR("megaraidlinux@lsi.com"); |
@@ -3863,10 +3867,20 @@ megasas_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
3863 | if (megasas_init_mfi(instance)) | 3867 | if (megasas_init_mfi(instance)) |
3864 | goto fail_init_mfi; | 3868 | goto fail_init_mfi; |
3865 | 3869 | ||
3870 | /* Try to enable MSI-X */ | ||
3871 | if ((instance->pdev->device != PCI_DEVICE_ID_LSI_SAS1078R) && | ||
3872 | (instance->pdev->device != PCI_DEVICE_ID_LSI_SAS1078DE) && | ||
3873 | (instance->pdev->device != PCI_DEVICE_ID_LSI_VERDE_ZCR) && | ||
3874 | !msix_disable && !pci_enable_msix(instance->pdev, | ||
3875 | &instance->msixentry, 1)) | ||
3876 | instance->msi_flag = 1; | ||
3877 | |||
3866 | /* | 3878 | /* |
3867 | * Register IRQ | 3879 | * Register IRQ |
3868 | */ | 3880 | */ |
3869 | if (request_irq(pdev->irq, megasas_isr, IRQF_SHARED, "megasas", instance)) { | 3881 | if (request_irq(instance->msi_flag ? instance->msixentry.vector : |
3882 | pdev->irq, megasas_isr, | ||
3883 | IRQF_SHARED, "megasas", instance)) { | ||
3870 | printk(KERN_DEBUG "megasas: Failed to register IRQ\n"); | 3884 | printk(KERN_DEBUG "megasas: Failed to register IRQ\n"); |
3871 | goto fail_irq; | 3885 | goto fail_irq; |
3872 | } | 3886 | } |
@@ -3911,8 +3925,10 @@ megasas_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
3911 | 3925 | ||
3912 | pci_set_drvdata(pdev, NULL); | 3926 | pci_set_drvdata(pdev, NULL); |
3913 | instance->instancet->disable_intr(instance->reg_set); | 3927 | instance->instancet->disable_intr(instance->reg_set); |
3914 | free_irq(instance->pdev->irq, instance); | 3928 | free_irq(instance->msi_flag ? instance->msixentry.vector : |
3915 | 3929 | instance->pdev->irq, instance); | |
3930 | if (instance->msi_flag) | ||
3931 | pci_disable_msix(instance->pdev); | ||
3916 | megasas_release_mfi(instance); | 3932 | megasas_release_mfi(instance); |
3917 | 3933 | ||
3918 | fail_irq: | 3934 | fail_irq: |
@@ -4053,7 +4069,10 @@ megasas_suspend(struct pci_dev *pdev, pm_message_t state) | |||
4053 | 4069 | ||
4054 | pci_set_drvdata(instance->pdev, instance); | 4070 | pci_set_drvdata(instance->pdev, instance); |
4055 | instance->instancet->disable_intr(instance->reg_set); | 4071 | instance->instancet->disable_intr(instance->reg_set); |
4056 | free_irq(instance->pdev->irq, instance); | 4072 | free_irq(instance->msi_flag ? instance->msixentry.vector : |
4073 | instance->pdev->irq, instance); | ||
4074 | if (instance->msi_flag) | ||
4075 | pci_disable_msix(instance->pdev); | ||
4057 | 4076 | ||
4058 | pci_save_state(pdev); | 4077 | pci_save_state(pdev); |
4059 | pci_disable_device(pdev); | 4078 | pci_disable_device(pdev); |
@@ -4116,11 +4135,16 @@ megasas_resume(struct pci_dev *pdev) | |||
4116 | tasklet_init(&instance->isr_tasklet, megasas_complete_cmd_dpc, | 4135 | tasklet_init(&instance->isr_tasklet, megasas_complete_cmd_dpc, |
4117 | (unsigned long)instance); | 4136 | (unsigned long)instance); |
4118 | 4137 | ||
4138 | /* Now re-enable MSI-X */ | ||
4139 | if (instance->msi_flag) | ||
4140 | pci_enable_msix(instance->pdev, &instance->msixentry, 1); | ||
4141 | |||
4119 | /* | 4142 | /* |
4120 | * Register IRQ | 4143 | * Register IRQ |
4121 | */ | 4144 | */ |
4122 | if (request_irq(pdev->irq, megasas_isr, IRQF_SHARED, | 4145 | if (request_irq(instance->msi_flag ? instance->msixentry.vector : |
4123 | "megasas", instance)) { | 4146 | pdev->irq, megasas_isr, |
4147 | IRQF_SHARED, "megasas", instance)) { | ||
4124 | printk(KERN_ERR "megasas: Failed to register IRQ\n"); | 4148 | printk(KERN_ERR "megasas: Failed to register IRQ\n"); |
4125 | goto fail_irq; | 4149 | goto fail_irq; |
4126 | } | 4150 | } |
@@ -4218,7 +4242,10 @@ static void __devexit megasas_detach_one(struct pci_dev *pdev) | |||
4218 | 4242 | ||
4219 | instance->instancet->disable_intr(instance->reg_set); | 4243 | instance->instancet->disable_intr(instance->reg_set); |
4220 | 4244 | ||
4221 | free_irq(instance->pdev->irq, instance); | 4245 | free_irq(instance->msi_flag ? instance->msixentry.vector : |
4246 | instance->pdev->irq, instance); | ||
4247 | if (instance->msi_flag) | ||
4248 | pci_disable_msix(instance->pdev); | ||
4222 | 4249 | ||
4223 | megasas_release_mfi(instance); | 4250 | megasas_release_mfi(instance); |
4224 | 4251 | ||