aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000e
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2009-03-25 18:05:03 -0400
committerDavid S. Miller <davem@davemloft.net>2009-03-26 04:09:58 -0400
commit12d04a3c12b420f23398b4d650127642469a60a6 (patch)
tree5ea1b54b9631138368a1819043da2d7eb18a810e /drivers/net/e1000e
parent7249dee5bdbe96302b5ff0d9a7701cf3dc8cffe8 (diff)
e1000e: commonize tx cleanup routine to match e1000 & igb
This change updates the e1000e tx cleanup routine to more closely match what already exists in igb and e1000. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/e1000e')
-rw-r--r--drivers/net/e1000e/netdev.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 15424bad5694..17974121912d 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -621,15 +621,16 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
621 struct e1000_buffer *buffer_info; 621 struct e1000_buffer *buffer_info;
622 unsigned int i, eop; 622 unsigned int i, eop;
623 unsigned int count = 0; 623 unsigned int count = 0;
624 bool cleaned = 0; 624 bool cleaned;
625 unsigned int total_tx_bytes = 0, total_tx_packets = 0; 625 unsigned int total_tx_bytes = 0, total_tx_packets = 0;
626 626
627 i = tx_ring->next_to_clean; 627 i = tx_ring->next_to_clean;
628 eop = tx_ring->buffer_info[i].next_to_watch; 628 eop = tx_ring->buffer_info[i].next_to_watch;
629 eop_desc = E1000_TX_DESC(*tx_ring, eop); 629 eop_desc = E1000_TX_DESC(*tx_ring, eop);
630 630
631 while (eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) { 631 while ((eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) &&
632 for (cleaned = 0; !cleaned; ) { 632 (count < tx_ring->count)) {
633 for (cleaned = 0; !cleaned; count++) {
633 tx_desc = E1000_TX_DESC(*tx_ring, i); 634 tx_desc = E1000_TX_DESC(*tx_ring, i);
634 buffer_info = &tx_ring->buffer_info[i]; 635 buffer_info = &tx_ring->buffer_info[i];
635 cleaned = (i == eop); 636 cleaned = (i == eop);
@@ -655,10 +656,6 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
655 656
656 eop = tx_ring->buffer_info[i].next_to_watch; 657 eop = tx_ring->buffer_info[i].next_to_watch;
657 eop_desc = E1000_TX_DESC(*tx_ring, eop); 658 eop_desc = E1000_TX_DESC(*tx_ring, eop);
658#define E1000_TX_WEIGHT 64
659 /* weight of a sort for tx, to avoid endless transmit cleanup */
660 if (count++ == E1000_TX_WEIGHT)
661 break;
662 } 659 }
663 660
664 tx_ring->next_to_clean = i; 661 tx_ring->next_to_clean = i;
@@ -682,8 +679,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
682 /* Detect a transmit hang in hardware, this serializes the 679 /* Detect a transmit hang in hardware, this serializes the
683 * check with the clearing of time_stamp and movement of i */ 680 * check with the clearing of time_stamp and movement of i */
684 adapter->detect_tx_hung = 0; 681 adapter->detect_tx_hung = 0;
685 if (tx_ring->buffer_info[eop].time_stamp && 682 if (tx_ring->buffer_info[i].time_stamp &&
686 time_after(jiffies, tx_ring->buffer_info[eop].time_stamp 683 time_after(jiffies, tx_ring->buffer_info[i].time_stamp
687 + (adapter->tx_timeout_factor * HZ)) 684 + (adapter->tx_timeout_factor * HZ))
688 && !(er32(STATUS) & E1000_STATUS_TXOFF)) { 685 && !(er32(STATUS) & E1000_STATUS_TXOFF)) {
689 e1000_print_tx_hang(adapter); 686 e1000_print_tx_hang(adapter);
@@ -694,7 +691,7 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
694 adapter->total_tx_packets += total_tx_packets; 691 adapter->total_tx_packets += total_tx_packets;
695 adapter->net_stats.tx_bytes += total_tx_bytes; 692 adapter->net_stats.tx_bytes += total_tx_bytes;
696 adapter->net_stats.tx_packets += total_tx_packets; 693 adapter->net_stats.tx_packets += total_tx_packets;
697 return cleaned; 694 return (count < tx_ring->count);
698} 695}
699 696
700/** 697/**
@@ -2010,7 +2007,7 @@ static int e1000_clean(struct napi_struct *napi, int budget)
2010clean_rx: 2007clean_rx:
2011 adapter->clean_rx(adapter, &work_done, budget); 2008 adapter->clean_rx(adapter, &work_done, budget);
2012 2009
2013 if (tx_cleaned) 2010 if (!tx_cleaned)
2014 work_done = budget; 2011 work_done = budget;
2015 2012
2016 /* If budget not fully consumed, exit the polling mode */ 2013 /* If budget not fully consumed, exit the polling mode */