]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mlx4_core: use msi_x module param to limit num of MSI-X irqs
authorMoshe Lazer <moshel@mellanox.com>
Tue, 5 Mar 2013 12:08:47 +0000 (14:08 +0200)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 7 Jul 2015 21:45:10 +0000 (14:45 -0700)
The msi_x module param usage is:
0 - don't use MSI-X
1 - use MSI-X (driver decide the num of MSI-X irqs)
>1 - limit number of MSI-X irqs to msi_x
In case of SRIOV the msi_x>1 treated as msi_x==1

Signed-off-by: Moshe Lazer <moshel@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
drivers/net/ethernet/mellanox/mlx4/main.c

index 1951b2c4ec0f73d47f20dd1ec145a69c0fc8f769..7b723b9ed2995ca81dd4d98ebf2adbe04cb522e4 100644 (file)
@@ -69,7 +69,7 @@ MODULE_PARM_DESC(debug_level, "Enable debug tracing if > 0");
 
 static int msi_x = 1;
 module_param(msi_x, int, 0444);
-MODULE_PARM_DESC(msi_x, "attempt to use MSI-X if nonzero");
+MODULE_PARM_DESC(msi_x, "0 - don't use MSI-X, 1 - use MSI-X, >1 - limit number of MSI-X irqs to msi_x (non-SRIOV only)");
 
 #else /* CONFIG_PCI_MSI */
 
@@ -2593,6 +2593,9 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev)
                nreq = min_t(int, dev->caps.num_eqs - dev->caps.reserved_eqs,
                             nreq);
 
+               if (msi_x > 1 && !mlx4_is_mfunc(dev))
+                       nreq = min_t(int, nreq, msi_x);
+
                entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL);
                if (!entries)
                        goto no_msi;
@@ -3782,6 +3785,11 @@ static struct pci_driver mlx4_driver = {
 
 static int __init mlx4_verify_params(void)
 {
+       if (msi_x < 0) {
+               pr_warn("mlx4_core: bad msi_x: %d\n", msi_x);
+               return -1;
+       }
+
        if ((log_num_mac < 0) || (log_num_mac > 7)) {
                pr_warn("mlx4_core: bad num_mac: %d\n", log_num_mac);
                return -1;