[1] share to each RX queue, given budget, is computed as fair as possible.
[2] queues are polled as much as budget approves.
Signed-off-by: Jing Zhang <zj.na...@gmail.com>
---
--- linux-2.6.34/drivers/net/ixgbe/ixgbe_main.c 2010-05-17
05:17:36.000000000 +0800
+++ ixgbe/ixgbe_main_02.c 2010-07-15 21:10:20.000000000 +0800
@@ -1538,6 +1538,9 @@ static int ixgbe_clean_rxtx_many(struct
struct ixgbe_adapter *adapter = q_vector->adapter;
struct ixgbe_ring *ring = NULL;
int work_done = 0, i;
+ int fair_budget;
+ int this_budget;
+ int residual;
long r_idx;
bool tx_clean_complete = true;
@@ -1555,16 +1558,35 @@ static int ixgbe_clean_rxtx_many(struct
/* attempt to distribute budget to each queue fairly, but don't allow
* the budget to go below 1 because we'll exit polling */
- budget /= (q_vector->rxr_count ?: 1);
- budget = max(budget, 1);
+ if (q_vector->rxr_count && budget >= q_vector->rxr_count) {
+ this_budget =
+ fair_budget = budget / q_vector->rxr_count;
+ residual = budget - fair_budget * q_vector->rxr_count;
+ } else {
+ this_budget =
+ fair_budget = 1;
+ residual = 0;
+ }
+ if (residual > 0) {
+ this_budget++;
+ residual--;
+ }
r_idx = find_first_bit(q_vector->rxr_idx, adapter->num_rx_queues);
for (i = 0; i < q_vector->rxr_count; i++) {
+ int this_work = 0;
ring = adapter->rx_ring[r_idx];
#ifdef CONFIG_IXGBE_DCA
if (adapter->flags & IXGBE_FLAG_DCA_ENABLED)
ixgbe_update_rx_dca(adapter, ring);
#endif
- ixgbe_clean_rx_irq(q_vector, ring, &work_done, budget);
+ ixgbe_clean_rx_irq(q_vector, ring, &this_work, this_budget);
+ work_done += this_work;
+ /* take extra works if any */
+ this_budget = fair_budget + this_budget - this_work;
+ if (residual > 0) {
+ this_budget++;
+ residual--;
+ }
r_idx = find_next_bit(q_vector->rxr_idx, adapter->num_rx_queues,
r_idx + 1);
}
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit
http://communities.intel.com/community/wired