diff mbox

e1000e: fix logical error in flush_desc_rings

Message ID 1429719917-25985-1-git-send-email-yanirx.lubetkin@intel.com
State Accepted
Delegated to: Jeff Kirsher
Headers show

Commit Message

Yanir Lubetkin April 22, 2015, 4:25 p.m. UTC
the condition under which the flush should occur was reversed.
The fix should be applied before any HW reset (unless followed by bus reset)
and before any power state transition from D0.
if E1000_FEXTNVM7_NEED_DESCRING_FLUSH bit is set in FEXTNVM7 and TDLEN > 0
the tx ring should be flushed. (fixes ~95% of the hang states).
if the E1000_FEXTNVM7_NEED_DESCRING_FLUSH did not clear, we should also
flush the RX ring. Bug was caught by Alexander Duyck during a code review
when examining this fix.

Signed-off-by: Yanir Lubetkin <yanirx.lubetkin@intel.com>
---
 drivers/net/ethernet/intel/e1000e/netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Brown, Aaron F May 12, 2015, 1:08 a.m. UTC | #1
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces@lists.osuosl.org] On
> Behalf Of Yanir Lubetkin
> Sent: Wednesday, April 22, 2015 9:25 AM
> To: intel-wired-lan@lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH] e1000e: fix logical error in
> flush_desc_rings
> 
> the condition under which the flush should occur was reversed.
> The fix should be applied before any HW reset (unless followed by bus
> reset)
> and before any power state transition from D0.
> if E1000_FEXTNVM7_NEED_DESCRING_FLUSH bit is set in FEXTNVM7 and TDLEN > 0
> the tx ring should be flushed. (fixes ~95% of the hang states).
> if the E1000_FEXTNVM7_NEED_DESCRING_FLUSH did not clear, we should also
> flush the RX ring. Bug was caught by Alexander Duyck during a code review
> when examining this fix.
> 
> Signed-off-by: Yanir Lubetkin <yanirx.lubetkin@intel.com>
> ---
>  drivers/net/ethernet/intel/e1000e/netdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Tested-by: Aaron Brown <aaron.f.brown@intel.com>
diff mbox

Patch

diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 76b1a90..de8caf4 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -3878,7 +3878,7 @@  static void e1000_flush_desc_rings(struct e1000_adapter *adapter)
 	/* do nothing if we're not in faulty state, or if the queue is empty */
 	tdlen = er32(TDLEN(0));
 	hang_state = er32(FEXTNVM7);
-	if ((hang_state & E1000_FEXTNVM7_NEED_DESCRING_FLUSH) || tdlen)
+	if (!(hang_state & E1000_FEXTNVM7_NEED_DESCRING_FLUSH) || !tdlen)
 		return;
 	e1000_flush_tx_ring(adapter);
 	/* recheck, maybe the fault is caused by the rx ring */