aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJacob Keller <jacob.e.keller@intel.com>2014-09-03 04:12:55 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2014-09-18 06:39:57 -0400
commitd7de3c6e8154c0d0398127bcc09977e260fdff55 (patch)
tree79b22e596b2e2bd7b945d70d2d5d84648205e62b /drivers/net
parent493043e5273b93b9f9a674cd554bb3757a800f10 (diff)
ixgbe: return integer from ixgbe_acquire_msix_vectors
Similar to how ixgbevf handles acquiring MSI-X vectors, we can return an error code instead of relying on the flag being set. This makes it more clear that we have failed to setup MSI-X mode, and also will make it easier to consolidate MSI-X related code all into the single function. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
index 5d085d5ed6b7..2a388944989b 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
@@ -696,8 +696,8 @@ static void ixgbe_set_num_queues(struct ixgbe_adapter *adapter)
696 ixgbe_set_rss_queues(adapter); 696 ixgbe_set_rss_queues(adapter);
697} 697}
698 698
699static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter, 699static int ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter,
700 int vectors) 700 int vectors)
701{ 701{
702 int vector_threshold; 702 int vector_threshold;
703 703
@@ -726,16 +726,22 @@ static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter,
726 adapter->flags &= ~IXGBE_FLAG_MSIX_ENABLED; 726 adapter->flags &= ~IXGBE_FLAG_MSIX_ENABLED;
727 kfree(adapter->msix_entries); 727 kfree(adapter->msix_entries);
728 adapter->msix_entries = NULL; 728 adapter->msix_entries = NULL;
729 } else { 729
730 adapter->flags |= IXGBE_FLAG_MSIX_ENABLED; /* Woot! */ 730 return vectors;
731 /*
732 * Adjust for only the vectors we'll use, which is minimum
733 * of max_msix_q_vectors + NON_Q_VECTORS, or the number of
734 * vectors we were allocated.
735 */
736 vectors -= NON_Q_VECTORS;
737 adapter->num_q_vectors = min(vectors, adapter->max_q_vectors);
738 } 731 }
732
733 /* we successfully allocated some number of vectors within our
734 * requested range.
735 */
736 adapter->flags |= IXGBE_FLAG_MSIX_ENABLED;
737
738 /* Adjust for only the vectors we'll use, which is minimum
739 * of max_q_vectors, or the number of vectors we were allocated.
740 */
741 vectors -= NON_Q_VECTORS;
742 adapter->num_q_vectors = min_t(int, vectors, adapter->max_q_vectors);
743
744 return 0;
739} 745}
740 746
741static void ixgbe_add_ring(struct ixgbe_ring *ring, 747static void ixgbe_add_ring(struct ixgbe_ring *ring,
@@ -1085,9 +1091,7 @@ static void ixgbe_set_interrupt_capability(struct ixgbe_adapter *adapter)
1085 for (vector = 0; vector < v_budget; vector++) 1091 for (vector = 0; vector < v_budget; vector++)
1086 adapter->msix_entries[vector].entry = vector; 1092 adapter->msix_entries[vector].entry = vector;
1087 1093
1088 ixgbe_acquire_msix_vectors(adapter, v_budget); 1094 if (!ixgbe_acquire_msix_vectors(adapter, v_budget))
1089
1090 if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED)
1091 return; 1095 return;
1092 } 1096 }
1093 1097