diff options
author | Jesse Brandeburg <jesse.brandeburg@intel.com> | 2008-09-11 22:58:14 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-09-24 18:54:54 -0400 |
commit | 30efa5a363d18f1c284455879cb67fb1bf547bdc (patch) | |
tree | 114f01ea6cf674bd14354e706d32a1ad47877ade /drivers/net/ixgbe/ixgbe_main.c | |
parent | 3d3d6d3cc2ad1e77516f3ad3f79d5988ebc361cf (diff) |
ixgbe: fix initial interrupt throttle settings
ixgbe was incorrectly setting the throttle rate setting for all tx
queues and the driver has been refreshed to better handle a dynamic
interrupt mode as well as multiple queues.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_main.c')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 80 |
1 files changed, 45 insertions, 35 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 0269115593e3..ef965c996848 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -744,12 +744,12 @@ static void ixgbe_configure_msix(struct ixgbe_adapter *adapter) | |||
744 | r_idx + 1); | 744 | r_idx + 1); |
745 | } | 745 | } |
746 | 746 | ||
747 | /* if this is a tx only vector use half the irq (tx) rate */ | 747 | /* if this is a tx only vector halve the interrupt rate */ |
748 | if (q_vector->txr_count && !q_vector->rxr_count) | 748 | if (q_vector->txr_count && !q_vector->rxr_count) |
749 | q_vector->eitr = adapter->tx_eitr; | 749 | q_vector->eitr = (adapter->eitr_param >> 1); |
750 | else | 750 | else |
751 | /* rx only or mixed */ | 751 | /* rx only */ |
752 | q_vector->eitr = adapter->rx_eitr; | 752 | q_vector->eitr = adapter->eitr_param; |
753 | 753 | ||
754 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_EITR(v_idx), | 754 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_EITR(v_idx), |
755 | EITR_INTS_PER_SEC_TO_REG(q_vector->eitr)); | 755 | EITR_INTS_PER_SEC_TO_REG(q_vector->eitr)); |
@@ -845,13 +845,13 @@ static void ixgbe_set_itr_msix(struct ixgbe_q_vector *q_vector) | |||
845 | for (i = 0; i < q_vector->txr_count; i++) { | 845 | for (i = 0; i < q_vector->txr_count; i++) { |
846 | tx_ring = &(adapter->tx_ring[r_idx]); | 846 | tx_ring = &(adapter->tx_ring[r_idx]); |
847 | ret_itr = ixgbe_update_itr(adapter, q_vector->eitr, | 847 | ret_itr = ixgbe_update_itr(adapter, q_vector->eitr, |
848 | q_vector->tx_eitr, | 848 | q_vector->tx_itr, |
849 | tx_ring->total_packets, | 849 | tx_ring->total_packets, |
850 | tx_ring->total_bytes); | 850 | tx_ring->total_bytes); |
851 | /* if the result for this queue would decrease interrupt | 851 | /* if the result for this queue would decrease interrupt |
852 | * rate for this vector then use that result */ | 852 | * rate for this vector then use that result */ |
853 | q_vector->tx_eitr = ((q_vector->tx_eitr > ret_itr) ? | 853 | q_vector->tx_itr = ((q_vector->tx_itr > ret_itr) ? |
854 | q_vector->tx_eitr - 1 : ret_itr); | 854 | q_vector->tx_itr - 1 : ret_itr); |
855 | r_idx = find_next_bit(q_vector->txr_idx, adapter->num_tx_queues, | 855 | r_idx = find_next_bit(q_vector->txr_idx, adapter->num_tx_queues, |
856 | r_idx + 1); | 856 | r_idx + 1); |
857 | } | 857 | } |
@@ -860,18 +860,18 @@ static void ixgbe_set_itr_msix(struct ixgbe_q_vector *q_vector) | |||
860 | for (i = 0; i < q_vector->rxr_count; i++) { | 860 | for (i = 0; i < q_vector->rxr_count; i++) { |
861 | rx_ring = &(adapter->rx_ring[r_idx]); | 861 | rx_ring = &(adapter->rx_ring[r_idx]); |
862 | ret_itr = ixgbe_update_itr(adapter, q_vector->eitr, | 862 | ret_itr = ixgbe_update_itr(adapter, q_vector->eitr, |
863 | q_vector->rx_eitr, | 863 | q_vector->rx_itr, |
864 | rx_ring->total_packets, | 864 | rx_ring->total_packets, |
865 | rx_ring->total_bytes); | 865 | rx_ring->total_bytes); |
866 | /* if the result for this queue would decrease interrupt | 866 | /* if the result for this queue would decrease interrupt |
867 | * rate for this vector then use that result */ | 867 | * rate for this vector then use that result */ |
868 | q_vector->rx_eitr = ((q_vector->rx_eitr > ret_itr) ? | 868 | q_vector->rx_itr = ((q_vector->rx_itr > ret_itr) ? |
869 | q_vector->rx_eitr - 1 : ret_itr); | 869 | q_vector->rx_itr - 1 : ret_itr); |
870 | r_idx = find_next_bit(q_vector->rxr_idx, adapter->num_rx_queues, | 870 | r_idx = find_next_bit(q_vector->rxr_idx, adapter->num_rx_queues, |
871 | r_idx + 1); | 871 | r_idx + 1); |
872 | } | 872 | } |
873 | 873 | ||
874 | current_itr = max(q_vector->rx_eitr, q_vector->tx_eitr); | 874 | current_itr = max(q_vector->rx_itr, q_vector->tx_itr); |
875 | 875 | ||
876 | switch (current_itr) { | 876 | switch (current_itr) { |
877 | /* counts and packets in update_itr are dependent on these numbers */ | 877 | /* counts and packets in update_itr are dependent on these numbers */ |
@@ -970,16 +970,24 @@ static irqreturn_t ixgbe_msix_clean_rx(int irq, void *data) | |||
970 | struct ixgbe_adapter *adapter = q_vector->adapter; | 970 | struct ixgbe_adapter *adapter = q_vector->adapter; |
971 | struct ixgbe_ring *rx_ring; | 971 | struct ixgbe_ring *rx_ring; |
972 | int r_idx; | 972 | int r_idx; |
973 | int i; | ||
973 | 974 | ||
974 | r_idx = find_first_bit(q_vector->rxr_idx, adapter->num_rx_queues); | 975 | r_idx = find_first_bit(q_vector->rxr_idx, adapter->num_rx_queues); |
976 | for (i = 0; i < q_vector->rxr_count; i++) { | ||
977 | rx_ring = &(adapter->rx_ring[r_idx]); | ||
978 | rx_ring->total_bytes = 0; | ||
979 | rx_ring->total_packets = 0; | ||
980 | r_idx = find_next_bit(q_vector->rxr_idx, adapter->num_rx_queues, | ||
981 | r_idx + 1); | ||
982 | } | ||
983 | |||
975 | if (!q_vector->rxr_count) | 984 | if (!q_vector->rxr_count) |
976 | return IRQ_HANDLED; | 985 | return IRQ_HANDLED; |
977 | 986 | ||
987 | r_idx = find_first_bit(q_vector->rxr_idx, adapter->num_rx_queues); | ||
978 | rx_ring = &(adapter->rx_ring[r_idx]); | 988 | rx_ring = &(adapter->rx_ring[r_idx]); |
979 | /* disable interrupts on this vector only */ | 989 | /* disable interrupts on this vector only */ |
980 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, rx_ring->v_idx); | 990 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, rx_ring->v_idx); |
981 | rx_ring->total_bytes = 0; | ||
982 | rx_ring->total_packets = 0; | ||
983 | netif_rx_schedule(adapter->netdev, &q_vector->napi); | 991 | netif_rx_schedule(adapter->netdev, &q_vector->napi); |
984 | 992 | ||
985 | return IRQ_HANDLED; | 993 | return IRQ_HANDLED; |
@@ -1020,7 +1028,7 @@ static int ixgbe_clean_rxonly(struct napi_struct *napi, int budget) | |||
1020 | /* If all Rx work done, exit the polling mode */ | 1028 | /* If all Rx work done, exit the polling mode */ |
1021 | if (work_done < budget) { | 1029 | if (work_done < budget) { |
1022 | netif_rx_complete(adapter->netdev, napi); | 1030 | netif_rx_complete(adapter->netdev, napi); |
1023 | if (adapter->rx_eitr < IXGBE_MIN_ITR_USECS) | 1031 | if (adapter->itr_setting & 3) |
1024 | ixgbe_set_itr_msix(q_vector); | 1032 | ixgbe_set_itr_msix(q_vector); |
1025 | if (!test_bit(__IXGBE_DOWN, &adapter->state)) | 1033 | if (!test_bit(__IXGBE_DOWN, &adapter->state)) |
1026 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, rx_ring->v_idx); | 1034 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, rx_ring->v_idx); |
@@ -1187,16 +1195,16 @@ static void ixgbe_set_itr(struct ixgbe_adapter *adapter) | |||
1187 | struct ixgbe_ring *rx_ring = &adapter->rx_ring[0]; | 1195 | struct ixgbe_ring *rx_ring = &adapter->rx_ring[0]; |
1188 | struct ixgbe_ring *tx_ring = &adapter->tx_ring[0]; | 1196 | struct ixgbe_ring *tx_ring = &adapter->tx_ring[0]; |
1189 | 1197 | ||
1190 | q_vector->tx_eitr = ixgbe_update_itr(adapter, new_itr, | 1198 | q_vector->tx_itr = ixgbe_update_itr(adapter, new_itr, |
1191 | q_vector->tx_eitr, | 1199 | q_vector->tx_itr, |
1192 | tx_ring->total_packets, | 1200 | tx_ring->total_packets, |
1193 | tx_ring->total_bytes); | 1201 | tx_ring->total_bytes); |
1194 | q_vector->rx_eitr = ixgbe_update_itr(adapter, new_itr, | 1202 | q_vector->rx_itr = ixgbe_update_itr(adapter, new_itr, |
1195 | q_vector->rx_eitr, | 1203 | q_vector->rx_itr, |
1196 | rx_ring->total_packets, | 1204 | rx_ring->total_packets, |
1197 | rx_ring->total_bytes); | 1205 | rx_ring->total_bytes); |
1198 | 1206 | ||
1199 | current_itr = max(q_vector->rx_eitr, q_vector->tx_eitr); | 1207 | current_itr = max(q_vector->rx_itr, q_vector->tx_itr); |
1200 | 1208 | ||
1201 | switch (current_itr) { | 1209 | switch (current_itr) { |
1202 | /* counts and packets in update_itr are dependent on these numbers */ | 1210 | /* counts and packets in update_itr are dependent on these numbers */ |
@@ -1371,7 +1379,7 @@ static void ixgbe_configure_msi_and_legacy(struct ixgbe_adapter *adapter) | |||
1371 | struct ixgbe_hw *hw = &adapter->hw; | 1379 | struct ixgbe_hw *hw = &adapter->hw; |
1372 | 1380 | ||
1373 | IXGBE_WRITE_REG(hw, IXGBE_EITR(0), | 1381 | IXGBE_WRITE_REG(hw, IXGBE_EITR(0), |
1374 | EITR_INTS_PER_SEC_TO_REG(adapter->rx_eitr)); | 1382 | EITR_INTS_PER_SEC_TO_REG(adapter->eitr_param)); |
1375 | 1383 | ||
1376 | ixgbe_set_ivar(adapter, IXGBE_IVAR_RX_QUEUE(0), 0); | 1384 | ixgbe_set_ivar(adapter, IXGBE_IVAR_RX_QUEUE(0), 0); |
1377 | ixgbe_set_ivar(adapter, IXGBE_IVAR_TX_QUEUE(0), 0); | 1385 | ixgbe_set_ivar(adapter, IXGBE_IVAR_TX_QUEUE(0), 0); |
@@ -2209,7 +2217,7 @@ static int ixgbe_poll(struct napi_struct *napi, int budget) | |||
2209 | /* If budget not fully consumed, exit the polling mode */ | 2217 | /* If budget not fully consumed, exit the polling mode */ |
2210 | if (work_done < budget) { | 2218 | if (work_done < budget) { |
2211 | netif_rx_complete(adapter->netdev, napi); | 2219 | netif_rx_complete(adapter->netdev, napi); |
2212 | if (adapter->rx_eitr < IXGBE_MIN_ITR_USECS) | 2220 | if (adapter->itr_setting & 3) |
2213 | ixgbe_set_itr(adapter); | 2221 | ixgbe_set_itr(adapter); |
2214 | if (!test_bit(__IXGBE_DOWN, &adapter->state)) | 2222 | if (!test_bit(__IXGBE_DOWN, &adapter->state)) |
2215 | ixgbe_irq_enable(adapter); | 2223 | ixgbe_irq_enable(adapter); |
@@ -2421,12 +2429,6 @@ static int __devinit ixgbe_set_interrupt_capability(struct ixgbe_adapter | |||
2421 | int vector, v_budget; | 2429 | int vector, v_budget; |
2422 | 2430 | ||
2423 | /* | 2431 | /* |
2424 | * Set the default interrupt throttle rate. | ||
2425 | */ | ||
2426 | adapter->rx_eitr = (1000000 / IXGBE_DEFAULT_ITR_RX_USECS); | ||
2427 | adapter->tx_eitr = (1000000 / IXGBE_DEFAULT_ITR_TX_USECS); | ||
2428 | |||
2429 | /* | ||
2430 | * It's easy to be greedy for MSI-X vectors, but it really | 2432 | * It's easy to be greedy for MSI-X vectors, but it really |
2431 | * doesn't do us much good if we have a lot more vectors | 2433 | * doesn't do us much good if we have a lot more vectors |
2432 | * than CPU's. So let's be conservative and only ask for | 2434 | * than CPU's. So let's be conservative and only ask for |
@@ -2567,10 +2569,6 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter) | |||
2567 | adapter->ring_feature[RING_F_RSS].indices = rss; | 2569 | adapter->ring_feature[RING_F_RSS].indices = rss; |
2568 | adapter->flags |= IXGBE_FLAG_RSS_ENABLED; | 2570 | adapter->flags |= IXGBE_FLAG_RSS_ENABLED; |
2569 | 2571 | ||
2570 | /* Enable Dynamic interrupt throttling by default */ | ||
2571 | adapter->rx_eitr = 1; | ||
2572 | adapter->tx_eitr = 1; | ||
2573 | |||
2574 | /* default flow control settings */ | 2572 | /* default flow control settings */ |
2575 | hw->fc.original_type = ixgbe_fc_none; | 2573 | hw->fc.original_type = ixgbe_fc_none; |
2576 | hw->fc.type = ixgbe_fc_none; | 2574 | hw->fc.type = ixgbe_fc_none; |
@@ -2591,6 +2589,18 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter) | |||
2591 | return -EIO; | 2589 | return -EIO; |
2592 | } | 2590 | } |
2593 | 2591 | ||
2592 | /* enable itr by default in dynamic mode */ | ||
2593 | adapter->itr_setting = 1; | ||
2594 | adapter->eitr_param = 20000; | ||
2595 | |||
2596 | /* set defaults for eitr in MegaBytes */ | ||
2597 | adapter->eitr_low = 10; | ||
2598 | adapter->eitr_high = 20; | ||
2599 | |||
2600 | /* set default ring sizes */ | ||
2601 | adapter->tx_ring_count = IXGBE_DEFAULT_TXD; | ||
2602 | adapter->rx_ring_count = IXGBE_DEFAULT_RXD; | ||
2603 | |||
2594 | /* initialize eeprom parameters */ | 2604 | /* initialize eeprom parameters */ |
2595 | if (ixgbe_init_eeprom(hw)) { | 2605 | if (ixgbe_init_eeprom(hw)) { |
2596 | dev_err(&pdev->dev, "EEPROM initialization failed\n"); | 2606 | dev_err(&pdev->dev, "EEPROM initialization failed\n"); |