Commit 5cda9364 authored by Divy Le Ray's avatar Divy Le Ray Committed by David S. Miller

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: default avatarDivy Le Ray <divy@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c405b828
...@@ -230,6 +230,7 @@ struct adapter { ...@@ -230,6 +230,7 @@ struct adapter {
unsigned int slow_intr_mask; unsigned int slow_intr_mask;
unsigned long irq_stats[IRQ_NUM_STATS]; unsigned long irq_stats[IRQ_NUM_STATS];
int msix_nvectors;
struct { struct {
unsigned short vec; unsigned short vec;
char desc[22]; char desc[22];
......
...@@ -2752,7 +2752,7 @@ static void set_nqsets(struct adapter *adap) ...@@ -2752,7 +2752,7 @@ static void set_nqsets(struct adapter *adap)
int i, j = 0; int i, j = 0;
int num_cpus = num_online_cpus(); int num_cpus = num_online_cpus();
int hwports = adap->params.nports; int hwports = adap->params.nports;
int nqsets = SGE_QSETS; int nqsets = adap->msix_nvectors - 1;
if (adap->params.rev > 0 && adap->flags & USING_MSIX) { if (adap->params.rev > 0 && adap->flags & USING_MSIX) {
if (hwports == 2 && if (hwports == 2 &&
...@@ -2781,18 +2781,25 @@ static void set_nqsets(struct adapter *adap) ...@@ -2781,18 +2781,25 @@ static void set_nqsets(struct adapter *adap)
static int __devinit cxgb_enable_msix(struct adapter *adap) static int __devinit cxgb_enable_msix(struct adapter *adap)
{ {
struct msix_entry entries[SGE_QSETS + 1]; struct msix_entry entries[SGE_QSETS + 1];
int vectors;
int i, err; int i, err;
for (i = 0; i < ARRAY_SIZE(entries); ++i) vectors = ARRAY_SIZE(entries);
for (i = 0; i < vectors; ++i)
entries[i].entry = i; entries[i].entry = i;
err = pci_enable_msix(adap->pdev, entries, ARRAY_SIZE(entries)); while ((err = pci_enable_msix(adap->pdev, entries, vectors)) > 0)
vectors = err;
if (!err && vectors < (adap->params.nports + 1))
err = -1;
if (!err) { if (!err) {
for (i = 0; i < ARRAY_SIZE(entries); ++i) for (i = 0; i < vectors; ++i)
adap->msix_info[i].vec = entries[i].vector; adap->msix_info[i].vec = entries[i].vector;
} else if (err > 0) adap->msix_nvectors = vectors;
dev_info(&adap->pdev->dev, }
"only %d MSI-X vectors left, not using MSI-X\n", err);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment