diff options
author | Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> | 2009-02-01 04:18:58 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-02-01 04:18:58 -0500 |
commit | eb7f139ce523bfe03b1628c66d3e1d50f3c07196 (patch) | |
tree | d41b641e1a94911aaddc22b63d3d470f6cfd3ef1 | |
parent | 2f21bdd3542838dc5513a585a32aa13f01b019e7 (diff) |
ixgbe: Refactor MSI-X allocation mechanism
Our current MSI-X allocation mechanism does not support new hardware
at all. It also isn't getting the actual number of supported MSI-X vectors
from the device.
This patch allows the number of MSI-X vectors to be specific to a device,
plus it gets the number of MSI-X vectors available from PCIe configuration
space.
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ixgbe/ixgbe.h | 9 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_82598.c | 22 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 9 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_type.h | 5 |
4 files changed, 42 insertions, 3 deletions
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h index 6ac361a4b8ad..341d8b555f17 100644 --- a/drivers/net/ixgbe/ixgbe.h +++ b/drivers/net/ixgbe/ixgbe.h | |||
@@ -204,9 +204,13 @@ struct ixgbe_q_vector { | |||
204 | #define OTHER_VECTOR 1 | 204 | #define OTHER_VECTOR 1 |
205 | #define NON_Q_VECTORS (OTHER_VECTOR) | 205 | #define NON_Q_VECTORS (OTHER_VECTOR) |
206 | 206 | ||
207 | #define MAX_MSIX_Q_VECTORS 16 | 207 | #define MAX_MSIX_VECTORS_82598 18 |
208 | #define MAX_MSIX_Q_VECTORS_82598 16 | ||
209 | |||
210 | #define MAX_MSIX_Q_VECTORS MAX_MSIX_Q_VECTORS_82598 | ||
211 | #define MAX_MSIX_COUNT MAX_MSIX_VECTORS_82598 | ||
212 | |||
208 | #define MIN_MSIX_Q_VECTORS 2 | 213 | #define MIN_MSIX_Q_VECTORS 2 |
209 | #define MAX_MSIX_COUNT (MAX_MSIX_Q_VECTORS + NON_Q_VECTORS) | ||
210 | #define MIN_MSIX_COUNT (MIN_MSIX_Q_VECTORS + NON_Q_VECTORS) | 214 | #define MIN_MSIX_COUNT (MIN_MSIX_Q_VECTORS + NON_Q_VECTORS) |
211 | 215 | ||
212 | /* board specific private data structure */ | 216 | /* board specific private data structure */ |
@@ -244,6 +248,7 @@ struct ixgbe_adapter { | |||
244 | u64 hw_csum_rx_good; | 248 | u64 hw_csum_rx_good; |
245 | u64 non_eop_descs; | 249 | u64 non_eop_descs; |
246 | int num_msix_vectors; | 250 | int num_msix_vectors; |
251 | int max_msix_q_vectors; /* true count of q_vectors for device */ | ||
247 | struct ixgbe_ring_feature ring_feature[3]; | 252 | struct ixgbe_ring_feature ring_feature[3]; |
248 | struct msix_entry *msix_entries; | 253 | struct msix_entry *msix_entries; |
249 | 254 | ||
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c index dffe7f062c87..7fb4b86f8693 100644 --- a/drivers/net/ixgbe/ixgbe_82598.c +++ b/drivers/net/ixgbe/ixgbe_82598.c | |||
@@ -50,6 +50,27 @@ static s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset, | |||
50 | u8 *eeprom_data); | 50 | u8 *eeprom_data); |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * ixgbe_get_pcie_msix_count_82598 - Gets MSI-X vector count | ||
54 | * @hw: pointer to hardware structure | ||
55 | * | ||
56 | * Read PCIe configuration space, and get the MSI-X vector count from | ||
57 | * the capabilities table. | ||
58 | **/ | ||
59 | u16 ixgbe_get_pcie_msix_count_82598(struct ixgbe_hw *hw) | ||
60 | { | ||
61 | struct ixgbe_adapter *adapter = hw->back; | ||
62 | u16 msix_count; | ||
63 | pci_read_config_word(adapter->pdev, IXGBE_PCIE_MSIX_82598_CAPS, | ||
64 | &msix_count); | ||
65 | msix_count &= IXGBE_PCIE_MSIX_TBL_SZ_MASK; | ||
66 | |||
67 | /* MSI-X count is zero-based in HW, so increment to give proper value */ | ||
68 | msix_count++; | ||
69 | |||
70 | return msix_count; | ||
71 | } | ||
72 | |||
73 | /** | ||
53 | */ | 74 | */ |
54 | static s32 ixgbe_get_invariants_82598(struct ixgbe_hw *hw) | 75 | static s32 ixgbe_get_invariants_82598(struct ixgbe_hw *hw) |
55 | { | 76 | { |
@@ -106,6 +127,7 @@ static s32 ixgbe_get_invariants_82598(struct ixgbe_hw *hw) | |||
106 | mac->num_rar_entries = IXGBE_82598_RAR_ENTRIES; | 127 | mac->num_rar_entries = IXGBE_82598_RAR_ENTRIES; |
107 | mac->max_rx_queues = IXGBE_82598_MAX_RX_QUEUES; | 128 | mac->max_rx_queues = IXGBE_82598_MAX_RX_QUEUES; |
108 | mac->max_tx_queues = IXGBE_82598_MAX_TX_QUEUES; | 129 | mac->max_tx_queues = IXGBE_82598_MAX_TX_QUEUES; |
130 | mac->max_msix_vectors = ixgbe_get_pcie_msix_count_82598(hw); | ||
109 | 131 | ||
110 | out: | 132 | out: |
111 | return ret_val; | 133 | return ret_val; |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 82afc606c238..7bbafa3ebbe3 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -2421,7 +2421,13 @@ static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter, | |||
2421 | ixgbe_set_num_queues(adapter); | 2421 | ixgbe_set_num_queues(adapter); |
2422 | } else { | 2422 | } else { |
2423 | adapter->flags |= IXGBE_FLAG_MSIX_ENABLED; /* Woot! */ | 2423 | adapter->flags |= IXGBE_FLAG_MSIX_ENABLED; /* Woot! */ |
2424 | adapter->num_msix_vectors = vectors; | 2424 | /* |
2425 | * Adjust for only the vectors we'll use, which is minimum | ||
2426 | * of max_msix_q_vectors + NON_Q_VECTORS, or the number of | ||
2427 | * vectors we were allocated. | ||
2428 | */ | ||
2429 | adapter->num_msix_vectors = min(vectors, | ||
2430 | adapter->max_msix_q_vectors + NON_Q_VECTORS); | ||
2425 | } | 2431 | } |
2426 | } | 2432 | } |
2427 | 2433 | ||
@@ -2746,6 +2752,7 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter) | |||
2746 | adapter->ring_feature[RING_F_RSS].indices = rss; | 2752 | adapter->ring_feature[RING_F_RSS].indices = rss; |
2747 | adapter->flags |= IXGBE_FLAG_RSS_ENABLED; | 2753 | adapter->flags |= IXGBE_FLAG_RSS_ENABLED; |
2748 | adapter->ring_feature[RING_F_DCB].indices = IXGBE_MAX_DCB_INDICES; | 2754 | adapter->ring_feature[RING_F_DCB].indices = IXGBE_MAX_DCB_INDICES; |
2755 | adapter->max_msix_q_vectors = MAX_MSIX_Q_VECTORS_82598; | ||
2749 | 2756 | ||
2750 | #ifdef CONFIG_IXGBE_DCB | 2757 | #ifdef CONFIG_IXGBE_DCB |
2751 | /* Configure DCB traffic classes */ | 2758 | /* Configure DCB traffic classes */ |
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h index 883ff821153d..0d1d1d20affa 100644 --- a/drivers/net/ixgbe/ixgbe_type.h +++ b/drivers/net/ixgbe/ixgbe_type.h | |||
@@ -821,6 +821,10 @@ | |||
821 | #define IXGBE_FW_PTR 0x0F | 821 | #define IXGBE_FW_PTR 0x0F |
822 | #define IXGBE_PBANUM0_PTR 0x15 | 822 | #define IXGBE_PBANUM0_PTR 0x15 |
823 | #define IXGBE_PBANUM1_PTR 0x16 | 823 | #define IXGBE_PBANUM1_PTR 0x16 |
824 | #define IXGBE_PCIE_MSIX_82598_CAPS 0x62 | ||
825 | |||
826 | /* MSI-X capability fields masks */ | ||
827 | #define IXGBE_PCIE_MSIX_TBL_SZ_MASK 0x7FF | ||
824 | 828 | ||
825 | /* Legacy EEPROM word offsets */ | 829 | /* Legacy EEPROM word offsets */ |
826 | #define IXGBE_ISCSI_BOOT_CAPS 0x0033 | 830 | #define IXGBE_ISCSI_BOOT_CAPS 0x0033 |
@@ -1451,6 +1455,7 @@ struct ixgbe_mac_info { | |||
1451 | u32 num_rar_entries; | 1455 | u32 num_rar_entries; |
1452 | u32 max_tx_queues; | 1456 | u32 max_tx_queues; |
1453 | u32 max_rx_queues; | 1457 | u32 max_rx_queues; |
1458 | u32 max_msix_vectors; | ||
1454 | u32 link_attach_type; | 1459 | u32 link_attach_type; |
1455 | u32 link_mode_select; | 1460 | u32 link_mode_select; |
1456 | bool link_settings_loaded; | 1461 | bool link_settings_loaded; |