ixgbevf: make sure probe fails on MSI-X enable error

This driver cannot work without MSI-X interrupts
so there is no mechanism to fall back to.

Signed-off-by: Jakub Kicinski <jakub.kicinski@intel.com>
Acked-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jakub Kicinski 2012-11-13 04:03:16 +00:00 committed by David S. Miller
parent f7c405618c
commit e45dd5fe65

View File

@ -1721,8 +1721,8 @@ void ixgbevf_reset(struct ixgbevf_adapter *adapter)
} }
} }
static void ixgbevf_acquire_msix_vectors(struct ixgbevf_adapter *adapter, static int ixgbevf_acquire_msix_vectors(struct ixgbevf_adapter *adapter,
int vectors) int vectors)
{ {
int err, vector_threshold; int err, vector_threshold;
@ -1740,21 +1740,18 @@ static void ixgbevf_acquire_msix_vectors(struct ixgbevf_adapter *adapter,
while (vectors >= vector_threshold) { while (vectors >= vector_threshold) {
err = pci_enable_msix(adapter->pdev, adapter->msix_entries, err = pci_enable_msix(adapter->pdev, adapter->msix_entries,
vectors); vectors);
if (!err) /* Success in acquiring all requested vectors. */ if (!err || err < 0) /* Success or a nasty failure. */
break; break;
else if (err < 0)
vectors = 0; /* Nasty failure, quit now */
else /* err == number of vectors we should try again with */ else /* err == number of vectors we should try again with */
vectors = err; vectors = err;
} }
if (vectors < vector_threshold) { if (vectors < vector_threshold)
/* Can't allocate enough MSI-X interrupts? Oh well. err = -ENOMEM;
* This just means we'll go with either a single MSI
* vector or fall back to legacy interrupts. if (err) {
*/ dev_err(&adapter->pdev->dev,
hw_dbg(&adapter->hw, "Unable to allocate MSI-X interrupts\n");
"Unable to allocate MSI-X interrupts\n");
kfree(adapter->msix_entries); kfree(adapter->msix_entries);
adapter->msix_entries = NULL; adapter->msix_entries = NULL;
} else { } else {
@ -1765,6 +1762,7 @@ static void ixgbevf_acquire_msix_vectors(struct ixgbevf_adapter *adapter,
*/ */
adapter->num_msix_vectors = vectors; adapter->num_msix_vectors = vectors;
} }
return err;
} }
/** /**
@ -1868,7 +1866,9 @@ static int ixgbevf_set_interrupt_capability(struct ixgbevf_adapter *adapter)
for (vector = 0; vector < v_budget; vector++) for (vector = 0; vector < v_budget; vector++)
adapter->msix_entries[vector].entry = vector; adapter->msix_entries[vector].entry = vector;
ixgbevf_acquire_msix_vectors(adapter, v_budget); err = ixgbevf_acquire_msix_vectors(adapter, v_budget);
if (err)
goto out;
err = netif_set_real_num_tx_queues(netdev, adapter->num_tx_queues); err = netif_set_real_num_tx_queues(netdev, adapter->num_tx_queues);
if (err) if (err)