Skip to content

Commit

Permalink
8139too: fix system hang when there is a tx timeout event.
Browse files Browse the repository at this point in the history
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Chun-Hao Lin authored and David S. Miller committed Aug 2, 2016
1 parent 1b4985b commit 0a2f0d2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions drivers/net/ethernet/realtek/8139too.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 0a2f0d2

Please sign in to comment.