From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, gospo@redhat.com,
Jesse Brandeburg <jesse.brandeburg@intel.com>,
Don Skidmore <donald.c.skidmore@intel.com>,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-2.6 PATCH 06/13] e1000: fix tx waking queue after queue stopped during shutdown
Date: Fri, 25 Sep 2009 15:18:07 -0700 [thread overview]
Message-ID: <20090925221807.26715.3976.stgit@localhost.localdomain> (raw)
In-Reply-To: <20090925221613.26715.66796.stgit@localhost.localdomain>
From: Jesse Brandeburg <jesse.brandeburg@intel.com>
This fix closes a race where the adapter can be shutting down while
hard_start_xmit is being called and interrupts are being handled.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Don Skidmore <donald.c.skidmore@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/e1000/e1000_main.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 11508af..8c64363 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -2733,8 +2733,9 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
size -= 4;
buffer_info->length = size;
- buffer_info->dma = skb_shinfo(skb)->dma_head + offset;
+ /* set time_stamp *before* dma to help avoid a possible race */
buffer_info->time_stamp = jiffies;
+ buffer_info->dma = skb_shinfo(skb)->dma_head + offset;
buffer_info->next_to_watch = i;
len -= size;
@@ -2774,8 +2775,8 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
size -= 4;
buffer_info->length = size;
- buffer_info->dma = map[f] + offset;
buffer_info->time_stamp = jiffies;
+ buffer_info->dma = map[f] + offset;
buffer_info->next_to_watch = i;
len -= size;
@@ -3459,7 +3460,9 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
* sees the new next_to_clean.
*/
smp_mb();
- if (netif_queue_stopped(netdev)) {
+
+ if (netif_queue_stopped(netdev) &&
+ !(test_bit(__E1000_DOWN, &adapter->flags))) {
netif_wake_queue(netdev);
++adapter->restart_queue;
}
@@ -3469,8 +3472,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
/* Detect a transmit hang in hardware, this serializes the
* check with the clearing of time_stamp and movement of i */
adapter->detect_tx_hung = false;
- if (tx_ring->buffer_info[i].time_stamp &&
- time_after(jiffies, tx_ring->buffer_info[i].time_stamp +
+ if (tx_ring->buffer_info[eop].time_stamp &&
+ time_after(jiffies, tx_ring->buffer_info[eop].time_stamp +
(adapter->tx_timeout_factor * HZ))
&& !(er32(STATUS) & E1000_STATUS_TXOFF)) {
@@ -3492,7 +3495,7 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
readl(hw->hw_addr + tx_ring->tdt),
tx_ring->next_to_use,
tx_ring->next_to_clean,
- tx_ring->buffer_info[i].time_stamp,
+ tx_ring->buffer_info[eop].time_stamp,
eop,
jiffies,
eop_desc->upper.fields.status);
next prev parent reply other threads:[~2009-09-25 22:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-25 22:16 [net-2.6 PATCH 01/13] e1000: drop dead pcie code from e1000 Jeff Kirsher
2009-09-25 22:16 ` [net-2.6 PATCH 02/13] e1000: remove unused functions Jeff Kirsher
2009-09-25 22:17 ` [net-2.6 PATCH 03/13] e1000: use netif_tx_disable Jeff Kirsher
2009-09-25 22:17 ` [net-2.6 PATCH 04/13] e1000: stop timers at appropriate times Jeff Kirsher
2009-09-25 22:17 ` [net-2.6 PATCH 05/13] e1000: test link state conclusively Jeff Kirsher
2009-09-25 22:18 ` Jeff Kirsher [this message]
2009-09-25 22:18 ` [net-2.6 PATCH 07/13] e1000: two workarounds were incomplete, fix them Jeff Kirsher
2009-09-25 22:19 ` [net-2.6 PATCH 08/13] e1000: remove races when changing mtu Jeff Kirsher
2009-09-25 22:19 ` [net-2.6 PATCH 09/13] e1000: drop redunant line of code, cleanup Jeff Kirsher
2009-09-25 22:20 ` [net-2.6 PATCH 11/13] e1000: drop unused functionality for eeprom write/read Jeff Kirsher
2009-09-25 22:20 ` [net-2.6 PATCH 12/13] e1000: fix namespacecheck warnings Jeff Kirsher
2009-09-25 22:20 ` [net-2.6 PATCH 13/13] e1000: cleanup unused prototype Jeff Kirsher
2009-09-27 3:18 ` [net-2.6 PATCH 01/13] e1000: drop dead pcie code from e1000 David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090925221807.26715.3976.stgit@localhost.localdomain \
--to=jeffrey.t.kirsher@intel.com \
--cc=davem@davemloft.net \
--cc=donald.c.skidmore@intel.com \
--cc=gospo@redhat.com \
--cc=jesse.brandeburg@intel.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox