Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=017aadc4b505ad3ec2acc4e6ba96d63ae1c997a5
Commit:     017aadc4b505ad3ec2acc4e6ba96d63ae1c997a5
Parent:     08fb105540f4649eaa25270ec3ada1d35406afcc
Author:     Michael S. Tsirkin <[EMAIL PROTECTED]>
AuthorDate: Tue Aug 7 16:10:34 2007 +0300
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Oct 9 19:59:06 2007 -0700

    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 <[EMAIL PROTECTED]>
    Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 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 76fed75..04c1520 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");
 
 #ifdef CONFIG_PCI_MSI
 
-static int msi_x = 0;
+static int msi_x = 1;
 module_param(msi_x, int, 0444);
 MODULE_PARM_DESC(msi_x, "attempt to use MSI-X if nonzero");
 
@@ -833,14 +833,19 @@ static int mthca_setup_hca(struct mthca_dev *dev)
 
        err = mthca_NOP(dev, &status);
        if (err || status) {
-               mthca_err(dev, "NOP command failed to generate interrupt (IRQ 
%d), aborting.\n",
-                         dev->mthca_flags & MTHCA_FLAG_MSI_X ?
-                         dev->eq_table.eq[MTHCA_EQ_CMD].msi_x_vector :
-                         dev->pdev->irq);
-               if (dev->mthca_flags & (MTHCA_FLAG_MSI | MTHCA_FLAG_MSI_X))
-                       mthca_err(dev, "Try again with MSI/MSI-X disabled.\n");
-               else
+               if (dev->mthca_flags & (MTHCA_FLAG_MSI | MTHCA_FLAG_MSI_X)) {
+                       mthca_warn(dev, "NOP command failed to generate 
interrupt "
+                                  "(IRQ %d).\n",
+                                  dev->mthca_flags & MTHCA_FLAG_MSI_X ?
+                                  dev->eq_table.eq[MTHCA_EQ_CMD].msi_x_vector :
+                                  dev->pdev->irq);
+                       mthca_warn(dev, "Trying again with MSI/MSI-X 
disabled.\n");
+               } else {
+                       mthca_err(dev, "NOP command failed to generate 
interrupt "
+                                 "(IRQ %d), aborting.\n",
+                                 dev->pdev->irq);
                        mthca_err(dev, "BIOS or ACPI interrupt routing 
problem?\n");
+               }
 
                goto err_cmd_poll;
        }
@@ -1115,24 +1120,6 @@ static int __mthca_init_one(struct pci_dev *pdev, int 
hca_type)
                goto err_free_dev;
        }
 
-       if (msi_x && !mthca_enable_msi_x(mdev))
-               mdev->mthca_flags |= MTHCA_FLAG_MSI_X;
-       else if (msi) {
-               static int warned;
-
-               if (!warned) {
-                       printk(KERN_WARNING PFX "WARNING: MSI support will be "
-                              "removed from the ib_mthca driver in January 
2008.\n");
-                       printk(KERN_WARNING "    If you are using MSI and 
cannot "
-                              "switch to MSI-X, please tell "
-                              "<[EMAIL PROTECTED]>.\n");
-                       ++warned;
-               }
-
-               if (!pci_enable_msi(pdev))
-                       mdev->mthca_flags |= MTHCA_FLAG_MSI;
-       }
-
        if (mthca_cmd_init(mdev)) {
                mthca_err(mdev, "Failed to init command interface, 
aborting.\n");
                goto err_free_dev;
@@ -1156,7 +1143,35 @@ static int __mthca_init_one(struct pci_dev *pdev, int 
hca_type)
                mthca_warn(mdev, "If you have problems, try updating your HCA 
FW.\n");
        }
 
+       if (msi_x && !mthca_enable_msi_x(mdev))
+               mdev->mthca_flags |= MTHCA_FLAG_MSI_X;
+       else if (msi) {
+               static int warned;
+
+               if (!warned) {
+                       printk(KERN_WARNING PFX "WARNING: MSI support will be "
+                              "removed from the ib_mthca driver in January 
2008.\n");
+                       printk(KERN_WARNING "    If you are using MSI and 
cannot "
+                              "switch to MSI-X, please tell "
+                              "<[EMAIL PROTECTED]>.\n");
+                       ++warned;
+               }
+
+               if (!pci_enable_msi(pdev))
+                       mdev->mthca_flags |= MTHCA_FLAG_MSI;
+       }
+
        err = mthca_setup_hca(mdev);
+       if (err == -EBUSY && (mdev->mthca_flags & (MTHCA_FLAG_MSI | 
MTHCA_FLAG_MSI_X))) {
+               if (mdev->mthca_flags & MTHCA_FLAG_MSI_X)
+                       pci_disable_msix(pdev);
+               if (mdev->mthca_flags & MTHCA_FLAG_MSI)
+                       pci_disable_msi(pdev);
+               mdev->mthca_flags &= ~(MTHCA_FLAG_MSI_X | MTHCA_FLAG_MSI);
+
+               err = mthca_setup_hca(mdev);
+       }
+
        if (err)
                goto err_close;
 
@@ -1192,17 +1207,17 @@ err_cleanup:
        mthca_cleanup_uar_table(mdev);
 
 err_close:
+       if (mdev->mthca_flags & MTHCA_FLAG_MSI_X)
+               pci_disable_msix(pdev);
+       if (mdev->mthca_flags & MTHCA_FLAG_MSI)
+               pci_disable_msi(pdev);
+
        mthca_close_hca(mdev);
 
 err_cmd:
        mthca_cmd_cleanup(mdev);
 
 err_free_dev:
-       if (mdev->mthca_flags & MTHCA_FLAG_MSI_X)
-               pci_disable_msix(pdev);
-       if (mdev->mthca_flags & MTHCA_FLAG_MSI)
-               pci_disable_msi(pdev);
-
        ib_dealloc_device(&mdev->ib_dev);
 
 err_free_res:
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to