aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2009-03-25 17:59:04 -0400
committerDavid S. Miller <davem@davemloft.net>2009-03-26 04:00:54 -0400
commitccfb342c5cd584f0f3e682280f7152310edf0e39 (patch)
treef24cac7f47fafa9f73afa4f74986086b838b49e3 /drivers/net/e1000
parent37e73df8c3f19f4733c60ec53c104ff6f79ba467 (diff)
e1000: cleanup clean_tx_irq routine so that it completely cleans ring
The tx cleanup routine was stopping after 64 packets and this was causing issues resulting in the ring not being completely cleaned. This change updates the driver to clean the entire ring and if it doesn't it then will retry on the next pass. 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/e1000')
-rw-r--r--drivers/net/e1000/e1000_main.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index e60faabe9024..5c61b921ca71 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3769,7 +3769,7 @@ static int e1000_clean(struct napi_struct *napi, int budget)
3769 adapter->clean_rx(adapter, &adapter->rx_ring[0], 3769 adapter->clean_rx(adapter, &adapter->rx_ring[0],
3770 &work_done, budget); 3770 &work_done, budget);
3771 3771
3772 if (tx_cleaned) 3772 if (!tx_cleaned)
3773 work_done = budget; 3773 work_done = budget;
3774 3774
3775 /* If budget not fully consumed, exit the polling mode */ 3775 /* If budget not fully consumed, exit the polling mode */
@@ -3796,15 +3796,16 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
3796 struct e1000_buffer *buffer_info; 3796 struct e1000_buffer *buffer_info;
3797 unsigned int i, eop; 3797 unsigned int i, eop;
3798 unsigned int count = 0; 3798 unsigned int count = 0;
3799 bool cleaned = false; 3799 bool cleaned;
3800 unsigned int total_tx_bytes=0, total_tx_packets=0; 3800 unsigned int total_tx_bytes=0, total_tx_packets=0;
3801 3801
3802 i = tx_ring->next_to_clean; 3802 i = tx_ring->next_to_clean;
3803 eop = tx_ring->buffer_info[i].next_to_watch; 3803 eop = tx_ring->buffer_info[i].next_to_watch;
3804 eop_desc = E1000_TX_DESC(*tx_ring, eop); 3804 eop_desc = E1000_TX_DESC(*tx_ring, eop);
3805 3805
3806 while (eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) { 3806 while ((eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) &&
3807 for (cleaned = false; !cleaned; ) { 3807 (count < tx_ring->count)) {
3808 for (cleaned = false; !cleaned; count++) {
3808 tx_desc = E1000_TX_DESC(*tx_ring, i); 3809 tx_desc = E1000_TX_DESC(*tx_ring, i);
3809 buffer_info = &tx_ring->buffer_info[i]; 3810 buffer_info = &tx_ring->buffer_info[i];
3810 cleaned = (i == eop); 3811 cleaned = (i == eop);
@@ -3827,10 +3828,6 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
3827 3828
3828 eop = tx_ring->buffer_info[i].next_to_watch; 3829 eop = tx_ring->buffer_info[i].next_to_watch;
3829 eop_desc = E1000_TX_DESC(*tx_ring, eop); 3830 eop_desc = E1000_TX_DESC(*tx_ring, eop);
3830#define E1000_TX_WEIGHT 64
3831 /* weight of a sort for tx, to avoid endless transmit cleanup */
3832 if (count++ == E1000_TX_WEIGHT)
3833 break;
3834 } 3831 }
3835 3832
3836 tx_ring->next_to_clean = i; 3833 tx_ring->next_to_clean = i;
@@ -3852,8 +3849,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
3852 /* Detect a transmit hang in hardware, this serializes the 3849 /* Detect a transmit hang in hardware, this serializes the
3853 * check with the clearing of time_stamp and movement of i */ 3850 * check with the clearing of time_stamp and movement of i */
3854 adapter->detect_tx_hung = false; 3851 adapter->detect_tx_hung = false;
3855 if (tx_ring->buffer_info[eop].time_stamp && 3852 if (tx_ring->buffer_info[i].time_stamp &&
3856 time_after(jiffies, tx_ring->buffer_info[eop].time_stamp + 3853 time_after(jiffies, tx_ring->buffer_info[i].time_stamp +
3857 (adapter->tx_timeout_factor * HZ)) 3854 (adapter->tx_timeout_factor * HZ))
3858 && !(er32(STATUS) & E1000_STATUS_TXOFF)) { 3855 && !(er32(STATUS) & E1000_STATUS_TXOFF)) {
3859 3856
@@ -3875,7 +3872,7 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
3875 readl(hw->hw_addr + tx_ring->tdt), 3872 readl(hw->hw_addr + tx_ring->tdt),
3876 tx_ring->next_to_use, 3873 tx_ring->next_to_use,
3877 tx_ring->next_to_clean, 3874 tx_ring->next_to_clean,
3878 tx_ring->buffer_info[eop].time_stamp, 3875 tx_ring->buffer_info[i].time_stamp,
3879 eop, 3876 eop,
3880 jiffies, 3877 jiffies,
3881 eop_desc->upper.fields.status); 3878 eop_desc->upper.fields.status);
@@ -3886,7 +3883,7 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
3886 adapter->total_tx_packets += total_tx_packets; 3883 adapter->total_tx_packets += total_tx_packets;
3887 adapter->net_stats.tx_bytes += total_tx_bytes; 3884 adapter->net_stats.tx_bytes += total_tx_bytes;
3888 adapter->net_stats.tx_packets += total_tx_packets; 3885 adapter->net_stats.tx_packets += total_tx_packets;
3889 return cleaned; 3886 return (count < tx_ring->count);
3890} 3887}
3891 3888
3892/** 3889/**