netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Michael Wang <wangyun@linux.vnet.ibm.com>,
	netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com,
	Flavio Leitner <fbl@redhat.com>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 1/6] e1000e: Avoid wrong check on TX hang
Date: Sat,  3 Dec 2011 03:44:26 -0800	[thread overview]
Message-ID: <1322912671-6903-2-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1322912671-6903-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Michael Wang <wangyun@linux.vnet.ibm.com>

Descriptors may not be write-back while checking TX hang with flag
FLAG2_DMA_BURST on.
So when we detect hang, we just flush the descriptor and detect
again for once.

Signed-off-by: Michael Wang <wangyun@linux.vnet.ibm.com>
Signed-off-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/e1000e/e1000.h  |    1 +
 drivers/net/ethernet/intel/e1000e/netdev.c |   23 ++++++++++++++++++++---
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h
index 9fe18d1..f478a22 100644
--- a/drivers/net/ethernet/intel/e1000e/e1000.h
+++ b/drivers/net/ethernet/intel/e1000e/e1000.h
@@ -309,6 +309,7 @@ struct e1000_adapter {
 	u32 txd_cmd;
 
 	bool detect_tx_hung;
+	bool tx_hang_recheck;
 	u8 tx_timeout_factor;
 
 	u32 tx_int_delay;
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index c6e9763..3c12e6a 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -1014,6 +1014,7 @@ static void e1000_print_hw_hang(struct work_struct *work)
 	struct e1000_adapter *adapter = container_of(work,
 	                                             struct e1000_adapter,
 	                                             print_hang_task);
+	struct net_device *netdev = adapter->netdev;
 	struct e1000_ring *tx_ring = adapter->tx_ring;
 	unsigned int i = tx_ring->next_to_clean;
 	unsigned int eop = tx_ring->buffer_info[i].next_to_watch;
@@ -1025,6 +1026,21 @@ static void e1000_print_hw_hang(struct work_struct *work)
 	if (test_bit(__E1000_DOWN, &adapter->state))
 		return;
 
+	if ((!adapter->tx_hang_recheck) &&
+	    (adapter->flags2 & FLAG2_DMA_BURST)) {
+		/* May be block on write-back, flush and detect again
+		 * flush pending descriptor writebacks to memory
+		 */
+		ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD);
+		/* execute the writes immediately */
+		e1e_flush();
+		adapter->tx_hang_recheck = 1;
+		return;
+	}
+	/* Real hang detected */
+	adapter->tx_hang_recheck = 0;
+	netif_stop_queue(netdev);
+
 	e1e_rphy(hw, PHY_STATUS, &phy_status);
 	e1e_rphy(hw, PHY_1000T_STATUS, &phy_1000t_status);
 	e1e_rphy(hw, PHY_EXT_STATUS, &phy_ext_status);
@@ -1145,10 +1161,10 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
 		if (tx_ring->buffer_info[i].time_stamp &&
 		    time_after(jiffies, tx_ring->buffer_info[i].time_stamp
 			       + (adapter->tx_timeout_factor * HZ)) &&
-		    !(er32(STATUS) & E1000_STATUS_TXOFF)) {
+		    !(er32(STATUS) & E1000_STATUS_TXOFF))
 			schedule_work(&adapter->print_hang_task);
-			netif_stop_queue(netdev);
-		}
+		else
+			adapter->tx_hang_recheck = 0;
 	}
 	adapter->total_tx_bytes += total_tx_bytes;
 	adapter->total_tx_packets += total_tx_packets;
@@ -3838,6 +3854,7 @@ static int e1000_open(struct net_device *netdev)
 
 	e1000_irq_enable(adapter);
 
+	adapter->tx_hang_recheck = 0;
 	netif_start_queue(netdev);
 
 	adapter->idle_check = true;
-- 
1.7.6.4

  reply	other threads:[~2011-12-03 11:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-03 11:44 [net-next 0/6][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2011-12-03 11:44 ` Jeff Kirsher [this message]
2011-12-04  3:26   ` [net-next 1/6] e1000e: Avoid wrong check on TX hang David Miller
2011-12-04  7:28     ` Jeff Kirsher
2011-12-05  1:05       ` Michael Wang
2011-12-05  6:25         ` Jeff Kirsher
2011-12-05  7:15           ` Michael Wang
2011-12-05  8:02             ` Jeff Kirsher
2011-12-05  8:18               ` Michael Wang
2011-12-05  8:24                 ` Jeff Kirsher
2011-12-03 11:44 ` [net-next 2/6] e1000e: hitting BUG_ON() from napi_enable Jeff Kirsher
2011-12-03 11:44 ` [net-next 3/6] igb: Update DMA Coalescing threshold calculation Jeff Kirsher
2011-12-03 11:44 ` [net-next 4/6] ixgbe: DCBnl set_all, order of operations fix Jeff Kirsher
2011-12-03 11:44 ` [net-next 5/6] ixgbe: DCB: IEEE transitions may fail to reprogram hardware Jeff Kirsher
2011-12-03 11:44 ` [net-next 6/6] ixgbe: Remove function prototype for non-existent function Jeff Kirsher
  -- strict thread matches above, loose matches on Subject: below --
2011-12-05  8:20 [net-next 0/6 v2][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2011-12-05  8:20 ` [net-next 1/6] e1000e: Avoid wrong check on TX hang Jeff Kirsher
2011-12-05  8:37   ` Michael Wang
2011-12-05 13:49     ` Flavio Leitner

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=1322912671-6903-2-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=davem@davemloft.net \
    --cc=fbl@redhat.com \
    --cc=gospo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=sassmann@redhat.com \
    --cc=wangyun@linux.vnet.ibm.com \
    /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;
as well as URLs for NNTP newsgroup(s).