[ofa-general] [PATCHv3 for-2.6.24] IB/mlx4: enable MSI-X by default

Michael S. Tsirkin mst at dev.mellanox.co.il
Tue Aug 7 06:08:28 PDT 2007


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 msi_x module
option in the future.

Signed-off-by: Michael S. Tsirkin <mst at dev.mellanox.co.il>

---

Index: linux-2.6/drivers/net/mlx4/main.c
===================================================================
--- linux-2.6.orig/drivers/net/mlx4/main.c	2007-08-07 16:05:24.000000000 +0300
+++ linux-2.6/drivers/net/mlx4/main.c	2007-08-07 16:06:23.000000000 +0300
@@ -61,7 +61,7 @@ MODULE_PARM_DESC(debug_level, "Enable de
 
 #ifdef CONFIG_PCI_MSI
 
-static int msi_x;
+static int msi_x = 1;
 module_param(msi_x, int, 0444);
 MODULE_PARM_DESC(msi_x, "attempt to use MSI-X if nonzero");
 
@@ -603,7 +603,7 @@ static int __devinit mlx4_setup_hca(stru
 			 "(IRQ %d), aborting.\n",
 			 priv->eq_table.eq[MLX4_EQ_ASYNC].irq);
 		if (dev->flags & MLX4_FLAG_MSI_X)
-			mlx4_err(dev, "Try again with MSI-X disabled.\n");
+			mlx4_warn(dev, "Trying again with MSI-X disabled.\n");
 		else
 			mlx4_err(dev, "BIOS or ACPI interrupt routing problem?\n");
 
@@ -803,8 +803,6 @@ static int __devinit mlx4_init_one(struc
 		goto err_free_dev;
 	}
 
-	mlx4_enable_msi_x(dev);
-
 	if (mlx4_cmd_init(dev)) {
 		mlx4_err(dev, "Failed to init command interface, aborting.\n");
 		goto err_free_dev;
@@ -814,7 +812,16 @@ static int __devinit mlx4_init_one(struc
 	if (err)
 		goto err_cmd;
 
+	mlx4_enable_msi_x(dev);
+
 	err = mlx4_setup_hca(dev);
+	if (err == -EBUSY && (dev->flags & MLX4_FLAG_MSI_X)) {
+		mlx4_warn(dev, "Trying again with MSI/MSI-X disabled.\n");
+		dev->flags &= ~MLX4_FLAG_MSI_X;
+		pci_disable_msix(pdev);
+		err = mlx4_setup_hca(dev);
+	}
+
 	if (err)
 		goto err_close;
 
@@ -838,15 +845,15 @@ err_cleanup:
 	mlx4_cleanup_uar_table(dev);
 
 err_close:
+	if (dev->flags & MLX4_FLAG_MSI_X)
+		pci_disable_msix(pdev);
+
 	mlx4_close_hca(dev);
 
 err_cmd:
 	mlx4_cmd_cleanup(dev);
 
 err_free_dev:
-	if (dev->flags & MLX4_FLAG_MSI_X)
-		pci_disable_msix(pdev);
-
 	kfree(priv);
 
 err_release_bar2:

-- 
MST



More information about the general mailing list