diff options
author | Divy Le Ray <divy@chelsio.com> | 2009-01-19 00:29:40 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-21 17:34:03 -0500 |
commit | 5cda9364f1fbc330f0d82f534505a8e375d0a66c (patch) | |
tree | e4c33d95c12b69ac562ebcd1ce1d4ab8e27328be /drivers/net/cxgb3/cxgb3_main.c | |
parent | c405b828161286729b6a5a729159114dca122923 (diff) |
cxgb3: ease msi-x settings conditions
The driver currently drops to line interrupt mode
if it did not get all the msi-x vectors it requested.
Allow msi-x settings when a minimal amount of vectors
is provided.
Signed-off-by: Divy Le Ray <divy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cxgb3/cxgb3_main.c')
-rw-r--r-- | drivers/net/cxgb3/cxgb3_main.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c index 0089746b8d02..52131bd4cc70 100644 --- a/drivers/net/cxgb3/cxgb3_main.c +++ b/drivers/net/cxgb3/cxgb3_main.c | |||
@@ -338,7 +338,7 @@ static void free_irq_resources(struct adapter *adapter) | |||
338 | 338 | ||
339 | free_irq(adapter->msix_info[0].vec, adapter); | 339 | free_irq(adapter->msix_info[0].vec, adapter); |
340 | for_each_port(adapter, i) | 340 | for_each_port(adapter, i) |
341 | n += adap2pinfo(adapter, i)->nqsets; | 341 | n += adap2pinfo(adapter, i)->nqsets; |
342 | 342 | ||
343 | for (i = 0; i < n; ++i) | 343 | for (i = 0; i < n; ++i) |
344 | free_irq(adapter->msix_info[i + 1].vec, | 344 | free_irq(adapter->msix_info[i + 1].vec, |
@@ -2752,7 +2752,7 @@ static void set_nqsets(struct adapter *adap) | |||
2752 | int i, j = 0; | 2752 | int i, j = 0; |
2753 | int num_cpus = num_online_cpus(); | 2753 | int num_cpus = num_online_cpus(); |
2754 | int hwports = adap->params.nports; | 2754 | int hwports = adap->params.nports; |
2755 | int nqsets = SGE_QSETS; | 2755 | int nqsets = adap->msix_nvectors - 1; |
2756 | 2756 | ||
2757 | if (adap->params.rev > 0 && adap->flags & USING_MSIX) { | 2757 | if (adap->params.rev > 0 && adap->flags & USING_MSIX) { |
2758 | if (hwports == 2 && | 2758 | if (hwports == 2 && |
@@ -2781,18 +2781,25 @@ static void set_nqsets(struct adapter *adap) | |||
2781 | static int __devinit cxgb_enable_msix(struct adapter *adap) | 2781 | static int __devinit cxgb_enable_msix(struct adapter *adap) |
2782 | { | 2782 | { |
2783 | struct msix_entry entries[SGE_QSETS + 1]; | 2783 | struct msix_entry entries[SGE_QSETS + 1]; |
2784 | int vectors; | ||
2784 | int i, err; | 2785 | int i, err; |
2785 | 2786 | ||
2786 | for (i = 0; i < ARRAY_SIZE(entries); ++i) | 2787 | vectors = ARRAY_SIZE(entries); |
2788 | for (i = 0; i < vectors; ++i) | ||
2787 | entries[i].entry = i; | 2789 | entries[i].entry = i; |
2788 | 2790 | ||
2789 | err = pci_enable_msix(adap->pdev, entries, ARRAY_SIZE(entries)); | 2791 | while ((err = pci_enable_msix(adap->pdev, entries, vectors)) > 0) |
2792 | vectors = err; | ||
2793 | |||
2794 | if (!err && vectors < (adap->params.nports + 1)) | ||
2795 | err = -1; | ||
2796 | |||
2790 | if (!err) { | 2797 | if (!err) { |
2791 | for (i = 0; i < ARRAY_SIZE(entries); ++i) | 2798 | for (i = 0; i < vectors; ++i) |
2792 | adap->msix_info[i].vec = entries[i].vector; | 2799 | adap->msix_info[i].vec = entries[i].vector; |
2793 | } else if (err > 0) | 2800 | adap->msix_nvectors = vectors; |
2794 | dev_info(&adap->pdev->dev, | 2801 | } |
2795 | "only %d MSI-X vectors left, not using MSI-X\n", err); | 2802 | |
2796 | return err; | 2803 | return err; |
2797 | } | 2804 | } |
2798 | 2805 | ||