diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2010-11-16 22:27:08 -0500 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2010-11-16 22:27:08 -0500 |
commit | 125601bf03a13e24d3785ccbc3a25ad401c92772 (patch) | |
tree | 3328523f9ce7e721afded93e862baddbc2304430 /drivers/net/ixgbe | |
parent | bf29ee6c4819a86ba0209281550b230889b8ebe6 (diff) |
ixgbe: simplify math and improve stack use of ixgbe_set_itr functions
This change is meant to improve the stack utilization and simplify the math
used in ixgbe_set_itr_msix.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ixgbe')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index f2e81a21186a..3ad754824ffa 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -1617,14 +1617,13 @@ void ixgbe_write_eitr(struct ixgbe_q_vector *q_vector) | |||
1617 | static void ixgbe_set_itr_msix(struct ixgbe_q_vector *q_vector) | 1617 | static void ixgbe_set_itr_msix(struct ixgbe_q_vector *q_vector) |
1618 | { | 1618 | { |
1619 | struct ixgbe_adapter *adapter = q_vector->adapter; | 1619 | struct ixgbe_adapter *adapter = q_vector->adapter; |
1620 | int i, r_idx; | ||
1620 | u32 new_itr; | 1621 | u32 new_itr; |
1621 | u8 current_itr, ret_itr; | 1622 | u8 current_itr, ret_itr; |
1622 | int i, r_idx; | ||
1623 | struct ixgbe_ring *rx_ring, *tx_ring; | ||
1624 | 1623 | ||
1625 | r_idx = find_first_bit(q_vector->txr_idx, adapter->num_tx_queues); | 1624 | r_idx = find_first_bit(q_vector->txr_idx, adapter->num_tx_queues); |
1626 | for (i = 0; i < q_vector->txr_count; i++) { | 1625 | for (i = 0; i < q_vector->txr_count; i++) { |
1627 | tx_ring = adapter->tx_ring[r_idx]; | 1626 | struct ixgbe_ring *tx_ring = adapter->tx_ring[r_idx]; |
1628 | ret_itr = ixgbe_update_itr(adapter, q_vector->eitr, | 1627 | ret_itr = ixgbe_update_itr(adapter, q_vector->eitr, |
1629 | q_vector->tx_itr, | 1628 | q_vector->tx_itr, |
1630 | tx_ring->total_packets, | 1629 | tx_ring->total_packets, |
@@ -1639,7 +1638,7 @@ static void ixgbe_set_itr_msix(struct ixgbe_q_vector *q_vector) | |||
1639 | 1638 | ||
1640 | r_idx = find_first_bit(q_vector->rxr_idx, adapter->num_rx_queues); | 1639 | r_idx = find_first_bit(q_vector->rxr_idx, adapter->num_rx_queues); |
1641 | for (i = 0; i < q_vector->rxr_count; i++) { | 1640 | for (i = 0; i < q_vector->rxr_count; i++) { |
1642 | rx_ring = adapter->rx_ring[r_idx]; | 1641 | struct ixgbe_ring *rx_ring = adapter->rx_ring[r_idx]; |
1643 | ret_itr = ixgbe_update_itr(adapter, q_vector->eitr, | 1642 | ret_itr = ixgbe_update_itr(adapter, q_vector->eitr, |
1644 | q_vector->rx_itr, | 1643 | q_vector->rx_itr, |
1645 | rx_ring->total_packets, | 1644 | rx_ring->total_packets, |
@@ -1670,7 +1669,7 @@ static void ixgbe_set_itr_msix(struct ixgbe_q_vector *q_vector) | |||
1670 | 1669 | ||
1671 | if (new_itr != q_vector->eitr) { | 1670 | if (new_itr != q_vector->eitr) { |
1672 | /* do an exponential smoothing */ | 1671 | /* do an exponential smoothing */ |
1673 | new_itr = ((q_vector->eitr * 90)/100) + ((new_itr * 10)/100); | 1672 | new_itr = ((q_vector->eitr * 9) + new_itr)/10; |
1674 | 1673 | ||
1675 | /* save the algorithm value here, not the smoothed one */ | 1674 | /* save the algorithm value here, not the smoothed one */ |
1676 | q_vector->eitr = new_itr; | 1675 | q_vector->eitr = new_itr; |
@@ -2270,10 +2269,10 @@ out: | |||
2270 | static void ixgbe_set_itr(struct ixgbe_adapter *adapter) | 2269 | static void ixgbe_set_itr(struct ixgbe_adapter *adapter) |
2271 | { | 2270 | { |
2272 | struct ixgbe_q_vector *q_vector = adapter->q_vector[0]; | 2271 | struct ixgbe_q_vector *q_vector = adapter->q_vector[0]; |
2273 | u8 current_itr; | ||
2274 | u32 new_itr = q_vector->eitr; | ||
2275 | struct ixgbe_ring *rx_ring = adapter->rx_ring[0]; | 2272 | struct ixgbe_ring *rx_ring = adapter->rx_ring[0]; |
2276 | struct ixgbe_ring *tx_ring = adapter->tx_ring[0]; | 2273 | struct ixgbe_ring *tx_ring = adapter->tx_ring[0]; |
2274 | u32 new_itr = q_vector->eitr; | ||
2275 | u8 current_itr; | ||
2277 | 2276 | ||
2278 | q_vector->tx_itr = ixgbe_update_itr(adapter, new_itr, | 2277 | q_vector->tx_itr = ixgbe_update_itr(adapter, new_itr, |
2279 | q_vector->tx_itr, | 2278 | q_vector->tx_itr, |
@@ -2303,9 +2302,9 @@ static void ixgbe_set_itr(struct ixgbe_adapter *adapter) | |||
2303 | 2302 | ||
2304 | if (new_itr != q_vector->eitr) { | 2303 | if (new_itr != q_vector->eitr) { |
2305 | /* do an exponential smoothing */ | 2304 | /* do an exponential smoothing */ |
2306 | new_itr = ((q_vector->eitr * 90)/100) + ((new_itr * 10)/100); | 2305 | new_itr = ((q_vector->eitr * 9) + new_itr)/10; |
2307 | 2306 | ||
2308 | /* save the algorithm value here, not the smoothed one */ | 2307 | /* save the algorithm value here */ |
2309 | q_vector->eitr = new_itr; | 2308 | q_vector->eitr = new_itr; |
2310 | 2309 | ||
2311 | ixgbe_write_eitr(q_vector); | 2310 | ixgbe_write_eitr(q_vector); |