static int ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter,
int vectors)
{
- int vector_threshold;
+ int i, vector_threshold;
/* We'll want at least 2 (vector_threshold):
* 1) TxQ[0] + RxQ[0] handler
* Right now, we simply care about how many we'll get; we'll
* set them up later while requesting irq's.
*/
+ adapter->msix_entries = kcalloc(vectors,
+ sizeof(struct msix_entry),
+ GFP_KERNEL);
+ if (!adapter->msix_entries)
+ return -ENOMEM;
+
+ for (i = 0; i < vectors; i++)
+ adapter->msix_entries[i].entry = i;
+
vectors = pci_enable_msix_range(adapter->pdev, adapter->msix_entries,
vector_threshold, vectors);
static void ixgbe_set_interrupt_capability(struct ixgbe_adapter *adapter)
{
struct ixgbe_hw *hw = &adapter->hw;
- int vector, v_budget, err;
+ int v_budget, err;
/*
* It's easy to be greedy for MSI-X vectors, but it really
/* A failure in MSI-X entry allocation isn't fatal, but it does
* mean we disable MSI-X capabilities of the adapter. */
- adapter->msix_entries = kcalloc(v_budget,
- sizeof(struct msix_entry), GFP_KERNEL);
- if (adapter->msix_entries) {
- for (vector = 0; vector < v_budget; vector++)
- adapter->msix_entries[vector].entry = vector;
-
- if (!ixgbe_acquire_msix_vectors(adapter, v_budget))
- return;
- }
+ if (!ixgbe_acquire_msix_vectors(adapter, v_budget))
+ return;
/* At this point, we do not have MSI-X capabilities. We need to
* reconfigure or disable various features which require MSI-X