diff options
author | Michael S. Tsirkin <mst@dev.mellanox.co.il> | 2007-08-07 09:10:34 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-10-09 22:59:06 -0400 |
commit | 017aadc4b505ad3ec2acc4e6ba96d63ae1c997a5 (patch) | |
tree | 40ba779d2a173bcbc9287622d214afd3f7c984d5 /drivers/infiniband | |
parent | 08fb105540f4649eaa25270ec3ada1d35406afcc (diff) |
IB/mthca: Enable MSI-X by default
Recover from MSI-X errors by automatically falling back on regular
interrupt, instead of asking the user to do this manually. This makes
it possible to enable MSI-X by default, and will make it possible to
get rid of the msi_x module option in the future.
Signed-off-by: Michael S. Tsirkin <mst@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_main.c | 77 |
1 files changed, 46 insertions, 31 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c index 76fed7545c53..04c1520524cd 100644 --- a/drivers/infiniband/hw/mthca/mthca_main.c +++ b/drivers/infiniband/hw/mthca/mthca_main.c | |||
@@ -61,7 +61,7 @@ MODULE_PARM_DESC(debug_level, "Enable debug tracing if > 0"); | |||
61 | 61 | ||
62 | #ifdef CONFIG_PCI_MSI | 62 | #ifdef CONFIG_PCI_MSI |
63 | 63 | ||
64 | static int msi_x = 0; | 64 | static int msi_x = 1; |
65 | module_param(msi_x, int, 0444); | 65 | module_param(msi_x, int, 0444); |
66 | MODULE_PARM_DESC(msi_x, "attempt to use MSI-X if nonzero"); | 66 | MODULE_PARM_DESC(msi_x, "attempt to use MSI-X if nonzero"); |
67 | 67 | ||
@@ -833,14 +833,19 @@ static int mthca_setup_hca(struct mthca_dev *dev) | |||
833 | 833 | ||
834 | err = mthca_NOP(dev, &status); | 834 | err = mthca_NOP(dev, &status); |
835 | if (err || status) { | 835 | if (err || status) { |
836 | mthca_err(dev, "NOP command failed to generate interrupt (IRQ %d), aborting.\n", | 836 | if (dev->mthca_flags & (MTHCA_FLAG_MSI | MTHCA_FLAG_MSI_X)) { |
837 | dev->mthca_flags & MTHCA_FLAG_MSI_X ? | 837 | mthca_warn(dev, "NOP command failed to generate interrupt " |
838 | dev->eq_table.eq[MTHCA_EQ_CMD].msi_x_vector : | 838 | "(IRQ %d).\n", |
839 | dev->pdev->irq); | 839 | dev->mthca_flags & MTHCA_FLAG_MSI_X ? |
840 | if (dev->mthca_flags & (MTHCA_FLAG_MSI | MTHCA_FLAG_MSI_X)) | 840 | dev->eq_table.eq[MTHCA_EQ_CMD].msi_x_vector : |
841 | mthca_err(dev, "Try again with MSI/MSI-X disabled.\n"); | 841 | dev->pdev->irq); |
842 | else | 842 | mthca_warn(dev, "Trying again with MSI/MSI-X disabled.\n"); |
843 | } else { | ||
844 | mthca_err(dev, "NOP command failed to generate interrupt " | ||
845 | "(IRQ %d), aborting.\n", | ||
846 | dev->pdev->irq); | ||
843 | mthca_err(dev, "BIOS or ACPI interrupt routing problem?\n"); | 847 | mthca_err(dev, "BIOS or ACPI interrupt routing problem?\n"); |
848 | } | ||
844 | 849 | ||
845 | goto err_cmd_poll; | 850 | goto err_cmd_poll; |
846 | } | 851 | } |
@@ -1115,24 +1120,6 @@ static int __mthca_init_one(struct pci_dev *pdev, int hca_type) | |||
1115 | goto err_free_dev; | 1120 | goto err_free_dev; |
1116 | } | 1121 | } |
1117 | 1122 | ||
1118 | if (msi_x && !mthca_enable_msi_x(mdev)) | ||
1119 | mdev->mthca_flags |= MTHCA_FLAG_MSI_X; | ||
1120 | else if (msi) { | ||
1121 | static int warned; | ||
1122 | |||
1123 | if (!warned) { | ||
1124 | printk(KERN_WARNING PFX "WARNING: MSI support will be " | ||
1125 | "removed from the ib_mthca driver in January 2008.\n"); | ||
1126 | printk(KERN_WARNING " If you are using MSI and cannot " | ||
1127 | "switch to MSI-X, please tell " | ||
1128 | "<general@lists.openfabrics.org>.\n"); | ||
1129 | ++warned; | ||
1130 | } | ||
1131 | |||
1132 | if (!pci_enable_msi(pdev)) | ||
1133 | mdev->mthca_flags |= MTHCA_FLAG_MSI; | ||
1134 | } | ||
1135 | |||
1136 | if (mthca_cmd_init(mdev)) { | 1123 | if (mthca_cmd_init(mdev)) { |
1137 | mthca_err(mdev, "Failed to init command interface, aborting.\n"); | 1124 | mthca_err(mdev, "Failed to init command interface, aborting.\n"); |
1138 | goto err_free_dev; | 1125 | goto err_free_dev; |
@@ -1156,7 +1143,35 @@ static int __mthca_init_one(struct pci_dev *pdev, int hca_type) | |||
1156 | mthca_warn(mdev, "If you have problems, try updating your HCA FW.\n"); | 1143 | mthca_warn(mdev, "If you have problems, try updating your HCA FW.\n"); |
1157 | } | 1144 | } |
1158 | 1145 | ||
1146 | if (msi_x && !mthca_enable_msi_x(mdev)) | ||
1147 | mdev->mthca_flags |= MTHCA_FLAG_MSI_X; | ||
1148 | else if (msi) { | ||
1149 | static int warned; | ||
1150 | |||
1151 | if (!warned) { | ||
1152 | printk(KERN_WARNING PFX "WARNING: MSI support will be " | ||
1153 | "removed from the ib_mthca driver in January 2008.\n"); | ||
1154 | printk(KERN_WARNING " If you are using MSI and cannot " | ||
1155 | "switch to MSI-X, please tell " | ||
1156 | "<general@lists.openfabrics.org>.\n"); | ||
1157 | ++warned; | ||
1158 | } | ||
1159 | |||
1160 | if (!pci_enable_msi(pdev)) | ||
1161 | mdev->mthca_flags |= MTHCA_FLAG_MSI; | ||
1162 | } | ||
1163 | |||
1159 | err = mthca_setup_hca(mdev); | 1164 | err = mthca_setup_hca(mdev); |
1165 | if (err == -EBUSY && (mdev->mthca_flags & (MTHCA_FLAG_MSI | MTHCA_FLAG_MSI_X))) { | ||
1166 | if (mdev->mthca_flags & MTHCA_FLAG_MSI_X) | ||
1167 | pci_disable_msix(pdev); | ||
1168 | if (mdev->mthca_flags & MTHCA_FLAG_MSI) | ||
1169 | pci_disable_msi(pdev); | ||
1170 | mdev->mthca_flags &= ~(MTHCA_FLAG_MSI_X | MTHCA_FLAG_MSI); | ||
1171 | |||
1172 | err = mthca_setup_hca(mdev); | ||
1173 | } | ||
1174 | |||
1160 | if (err) | 1175 | if (err) |
1161 | goto err_close; | 1176 | goto err_close; |
1162 | 1177 | ||
@@ -1192,17 +1207,17 @@ err_cleanup: | |||
1192 | mthca_cleanup_uar_table(mdev); | 1207 | mthca_cleanup_uar_table(mdev); |
1193 | 1208 | ||
1194 | err_close: | 1209 | err_close: |
1210 | if (mdev->mthca_flags & MTHCA_FLAG_MSI_X) | ||
1211 | pci_disable_msix(pdev); | ||
1212 | if (mdev->mthca_flags & MTHCA_FLAG_MSI) | ||
1213 | pci_disable_msi(pdev); | ||
1214 | |||
1195 | mthca_close_hca(mdev); | 1215 | mthca_close_hca(mdev); |
1196 | 1216 | ||
1197 | err_cmd: | 1217 | err_cmd: |
1198 | mthca_cmd_cleanup(mdev); | 1218 | mthca_cmd_cleanup(mdev); |
1199 | 1219 | ||
1200 | err_free_dev: | 1220 | err_free_dev: |
1201 | if (mdev->mthca_flags & MTHCA_FLAG_MSI_X) | ||
1202 | pci_disable_msix(pdev); | ||
1203 | if (mdev->mthca_flags & MTHCA_FLAG_MSI) | ||
1204 | pci_disable_msi(pdev); | ||
1205 | |||
1206 | ib_dealloc_device(&mdev->ib_dev); | 1221 | ib_dealloc_device(&mdev->ib_dev); |
1207 | 1222 | ||
1208 | err_free_res: | 1223 | err_free_res: |