aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/mlx4
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@dev.mellanox.co.il>2007-08-07 09:08:28 -0400
committerRoland Dreier <rolandd@cisco.com>2007-10-09 22:59:05 -0400
commit08fb105540f4649eaa25270ec3ada1d35406afcc (patch)
tree5b2032fb7c687c7c0a6b6aba5e695233532b2f66 /drivers/net/mlx4
parent8a68bbe31d51cc75d2acf1c9f5ceff91f7662ea4 (diff)
mlx4_core: 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/net/mlx4')
-rw-r--r--drivers/net/mlx4/main.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c
index 4dc9dc19b716..4b1269435586 100644
--- a/drivers/net/mlx4/main.c
+++ b/drivers/net/mlx4/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
64static int msi_x; 64static int msi_x = 1;
65module_param(msi_x, int, 0444); 65module_param(msi_x, int, 0444);
66MODULE_PARM_DESC(msi_x, "attempt to use MSI-X if nonzero"); 66MODULE_PARM_DESC(msi_x, "attempt to use MSI-X if nonzero");
67 67
@@ -599,13 +599,17 @@ static int __devinit mlx4_setup_hca(struct mlx4_dev *dev)
599 599
600 err = mlx4_NOP(dev); 600 err = mlx4_NOP(dev);
601 if (err) { 601 if (err) {
602 mlx4_err(dev, "NOP command failed to generate interrupt " 602 if (dev->flags & MLX4_FLAG_MSI_X) {
603 "(IRQ %d), aborting.\n", 603 mlx4_warn(dev, "NOP command failed to generate MSI-X "
604 priv->eq_table.eq[MLX4_EQ_ASYNC].irq); 604 "interrupt IRQ %d).\n",
605 if (dev->flags & MLX4_FLAG_MSI_X) 605 priv->eq_table.eq[MLX4_EQ_ASYNC].irq);
606 mlx4_err(dev, "Try again with MSI-X disabled.\n"); 606 mlx4_warn(dev, "Trying again without MSI-X.\n");
607 else 607 } else {
608 mlx4_err(dev, "NOP command failed to generate interrupt "
609 "(IRQ %d), aborting.\n",
610 priv->eq_table.eq[MLX4_EQ_ASYNC].irq);
608 mlx4_err(dev, "BIOS or ACPI interrupt routing problem?\n"); 611 mlx4_err(dev, "BIOS or ACPI interrupt routing problem?\n");
612 }
609 613
610 goto err_cmd_poll; 614 goto err_cmd_poll;
611 } 615 }
@@ -803,8 +807,6 @@ static int __devinit mlx4_init_one(struct pci_dev *pdev,
803 goto err_free_dev; 807 goto err_free_dev;
804 } 808 }
805 809
806 mlx4_enable_msi_x(dev);
807
808 if (mlx4_cmd_init(dev)) { 810 if (mlx4_cmd_init(dev)) {
809 mlx4_err(dev, "Failed to init command interface, aborting.\n"); 811 mlx4_err(dev, "Failed to init command interface, aborting.\n");
810 goto err_free_dev; 812 goto err_free_dev;
@@ -814,7 +816,15 @@ static int __devinit mlx4_init_one(struct pci_dev *pdev,
814 if (err) 816 if (err)
815 goto err_cmd; 817 goto err_cmd;
816 818
819 mlx4_enable_msi_x(dev);
820
817 err = mlx4_setup_hca(dev); 821 err = mlx4_setup_hca(dev);
822 if (err == -EBUSY && (dev->flags & MLX4_FLAG_MSI_X)) {
823 dev->flags &= ~MLX4_FLAG_MSI_X;
824 pci_disable_msix(pdev);
825 err = mlx4_setup_hca(dev);
826 }
827
818 if (err) 828 if (err)
819 goto err_close; 829 goto err_close;
820 830
@@ -838,15 +848,15 @@ err_cleanup:
838 mlx4_cleanup_uar_table(dev); 848 mlx4_cleanup_uar_table(dev);
839 849
840err_close: 850err_close:
851 if (dev->flags & MLX4_FLAG_MSI_X)
852 pci_disable_msix(pdev);
853
841 mlx4_close_hca(dev); 854 mlx4_close_hca(dev);
842 855
843err_cmd: 856err_cmd:
844 mlx4_cmd_cleanup(dev); 857 mlx4_cmd_cleanup(dev);
845 858
846err_free_dev: 859err_free_dev:
847 if (dev->flags & MLX4_FLAG_MSI_X)
848 pci_disable_msix(pdev);
849
850 kfree(priv); 860 kfree(priv);
851 861
852err_release_bar2: 862err_release_bar2: