From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757986AbcG0SkU (ORCPT ); Wed, 27 Jul 2016 14:40:20 -0400 Received: from rtits2.realtek.com ([60.250.210.242]:36513 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754303AbcG0SkR (ORCPT ); Wed, 27 Jul 2016 14:40:17 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.56 with qID u6RIeDYY027446, This message is accepted by code: ctloc85258 From: Chunhao Lin To: CC: , , Chunhao Lin Subject: [PATCH net] 8139too:fix system hang when there is a tx timeout event. Date: Thu, 28 Jul 2016 02:39:57 +0800 Message-ID: <1469644797-13334-1-git-send-email-hau@realtek.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.177.169] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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