Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1452991 > unrolled thread

[PATCH net v2] 8139too: fix system hang when there is a tx timeout event.

Started byChunhao Lin <hau@realtek.com>
First post2016-08-01 07:50 +0200
Last post2016-08-02 06:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH net v2] 8139too: fix system hang when there is a tx timeout event. Chunhao Lin <hau@realtek.com> - 2016-08-01 07:50 +0200
    Re: [PATCH net v2] 8139too: fix system hang when there is a tx  timeout event. David Miller <davem@davemloft.net> - 2016-08-02 06:50 +0200

#1452991 — [PATCH net v2] 8139too: fix system hang when there is a tx timeout event.

FromChunhao Lin <hau@realtek.com>
Date2016-08-01 07:50 +0200
Subject[PATCH net v2] 8139too: fix system hang when there is a tx timeout event.
Message-ID<s1egV-2c1-3@gated-at.bofh.it>
If tx timeout event occur, kernel will call rtl8139_tx_timeout_task() to reset
hardware. But in this function, driver does not stop tx and rx function before
reset hardware, that will cause system hang.

In this patch, add stop tx and rx function before reset hardware.

Signed-off-by: Chunhao Lin <hau@realtek.com>
---
 drivers/net/ethernet/realtek/8139too.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/realtek/8139too.c b/drivers/net/ethernet/realtek/8139too.c
index ef668d3..da4c2d8 100644
--- a/drivers/net/ethernet/realtek/8139too.c
+++ b/drivers/net/ethernet/realtek/8139too.c
@@ -1667,6 +1667,10 @@ static void rtl8139_tx_timeout_task (struct work_struct *work)
 	int i;
 	u8 tmp8;
 
+	napi_disable(&tp->napi);
+	netif_stop_queue(dev);
+	synchronize_sched();
+
 	netdev_dbg(dev, "Transmit timeout, status %02x %04x %04x media %02x\n",
 		   RTL_R8(ChipCmd), RTL_R16(IntrStatus),
 		   RTL_R16(IntrMask), RTL_R8(MediaStatus));
@@ -1696,10 +1700,10 @@ static void rtl8139_tx_timeout_task (struct work_struct *work)
 	spin_unlock_irq(&tp->lock);
 
 	/* ...and finally, reset everything */
-	if (netif_running(dev)) {
-		rtl8139_hw_start (dev);
-		netif_wake_queue (dev);
-	}
+	napi_enable(&tp->napi);
+	rtl8139_hw_start(dev);
+	netif_wake_queue(dev);
+
 	spin_unlock_bh(&tp->rx_lock);
 }
 
-- 
1.9.1

[toc] | [next] | [standalone]


#1453588 — Re: [PATCH net v2] 8139too: fix system hang when there is a tx timeout event.

FromDavid Miller <davem@davemloft.net>
Date2016-08-02 06:50 +0200
SubjectRe: [PATCH net v2] 8139too: fix system hang when there is a tx timeout event.
Message-ID<s1zOp-7Xz-3@gated-at.bofh.it>
In reply to#1452991
From: Chunhao Lin <hau@realtek.com>
Date: Mon, 1 Aug 2016 13:45:30 +0800

> If tx timeout event occur, kernel will call rtl8139_tx_timeout_task() to reset
> hardware. But in this function, driver does not stop tx and rx function before
> reset hardware, that will cause system hang.
> 
> In this patch, add stop tx and rx function before reset hardware.
> 
> Signed-off-by: Chunhao Lin <hau@realtek.com>

Applied, thanks.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web