* [PATCH net] 8139too:fix system hang when there is a tx timeout event.
@ 2016-07-27 18:39 Chunhao Lin
2016-07-31 3:37 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Chunhao Lin @ 2016-07-27 18:39 UTC (permalink / raw)
To: netdev; +Cc: nic_swsd, linux-kernel, Chunhao Lin
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..0d77f3c 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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] 8139too:fix system hang when there is a tx timeout event.
2016-07-27 18:39 [PATCH net] 8139too:fix system hang when there is a tx timeout event Chunhao Lin
@ 2016-07-31 3:37 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-07-31 3:37 UTC (permalink / raw)
To: hau; +Cc: netdev, nic_swsd, linux-kernel
From: Chunhao Lin <hau@realtek.com>
Date: Thu, 28 Jul 2016 02:39:57 +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>
First, please always place a space after the subsystem prefix in your Subject
lines "8139too: ".
> @@ -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);
> +
Get rid of these spaces in these function calls before the openning parenthesis.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-07-31 3:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-27 18:39 [PATCH net] 8139too:fix system hang when there is a tx timeout event Chunhao Lin
2016-07-31 3:37 ` David Miller
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).