Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp271275imu; Fri, 14 Dec 2018 19:19:41 -0800 (PST) X-Google-Smtp-Source: AFSGD/WSNKLt5ArYfrKSjQ/SIfDeSPQPFLJNsEwe01euMk0V/u+7IMzcRkKQbnk5QJdH6CHGU9tP X-Received: by 2002:a65:584e:: with SMTP id s14mr1704296pgr.142.1544843980967; Fri, 14 Dec 2018 19:19:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544843980; cv=none; d=google.com; s=arc-20160816; b=SLfc5I6XApjr8xz3sDAiQ9YruL6vZo/XcPnrwc6gqxTSPgxI9DICP8bRZhoPYUiQH8 eMrYbLtiXNxyNrfNZQOnPSDMwg1LfQgfFi+nsmMudKV87dC9efWZbl9Z3UpNYpot/OX+ TZT4uyWdgXSyJLP5qgs0Y4lrufvDJXuN0mDqbyJPvGsxaihi2TVWW/sYdDxaIXwwYjMF G2DRpXTmAwzG+RO2VNj4Whhlzeesb48UYG19IegBQeCB90gHh/9GINqJoUegW0sWJtpS b24YjQtKf6jYdFdfRIRceU7H93HR+iakGTDmNgf/thIv50giEPaRuT4UyvYTcUao+9vN vXhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=TPwTLamBEAwlyJ1dqr/Ik+JidJTbZlLmlVYxNLp+2Dk=; b=RBP5r3b4Y0Ar5ttNNGjeu7wp54eZS6N9q46F4DnxT8aKoqnIiY2OKAZPreGke2CO79 hdCrDCRxYPcn/b9uZ1efK4Hl3IV/GTBzfIwUjcec/AWxuVuxP+sZjqDzypnskYBHwDDV b4TpTlo+CAgZUqUD0lmwaNAKPh4NuYKHdT3ZLh/3ld0SQFpNbbgUuQjR9IbwbgegN5H0 Q3k1xVxFAFrzCkxGgM51kE0iaIRrHa1R0i/k2VpX7vlowZs8h5fyjcAsGrYFz9/xfYUz JOoXfxSPDuv3FV0EwKL6R4NgIFPyUEpsYyKBUJyZsDdaaTHQ0JIulyaW8aCFBO4iHvq3 y4pw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c191si5829590pfg.72.2018.12.14.19.19.11; Fri, 14 Dec 2018 19:19:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730509AbeLODSD (ORCPT + 99 others); Fri, 14 Dec 2018 22:18:03 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:16135 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729908AbeLODRe (ORCPT ); Fri, 14 Dec 2018 22:17:34 -0500 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 0541CCE646CEC; Sat, 15 Dec 2018 11:17:30 +0800 (CST) Received: from linux-ioko.site (10.71.200.31) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.408.0; Sat, 15 Dec 2018 11:17:23 +0800 From: Peng Li To: CC: , , , , , Subject: [Patch net 07/10] net: hns: Avoid net reset caused by pause frames storm Date: Sat, 15 Dec 2018 11:53:26 +0800 Message-ID: <1544846009-50276-8-git-send-email-lipeng321@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1544846009-50276-1-git-send-email-lipeng321@huawei.com> References: <1544846009-50276-1-git-send-email-lipeng321@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.71.200.31] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yonglong Liu There will be a large number of MAC pause frames on the net, which caused tx timeout of net device. And then the net device was reset to try to recover it. So that is not useful, and will cause some other problems. So need doubled ndev->watchdog_timeo if device watchdog occurred until watchdog_timeo up to 40s and then try resetting to recover it. When collecting dfx information such as hardware registers when tx timeout. Some registers for count were cleared when read. So need move this task before update net state which also read the count registers. Signed-off-by: Yonglong Liu Signed-off-by: Peng Li --- drivers/net/ethernet/hisilicon/hns/hns_enet.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c index 03d959c..8a53c82 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c @@ -1509,11 +1509,19 @@ static int hns_nic_net_stop(struct net_device *ndev) } static void hns_tx_timeout_reset(struct hns_nic_priv *priv); +#define HNS_TX_TIMEO_LIMIT (40 * HZ) static void hns_nic_net_timeout(struct net_device *ndev) { struct hns_nic_priv *priv = netdev_priv(ndev); - hns_tx_timeout_reset(priv); + if (ndev->watchdog_timeo < HNS_TX_TIMEO_LIMIT) { + ndev->watchdog_timeo *= 2; + netdev_info(ndev, "watchdog_timo changed to %d.\n", + ndev->watchdog_timeo); + } else { + ndev->watchdog_timeo = HNS_NIC_TX_TIMEOUT; + hns_tx_timeout_reset(priv); + } } static int hns_nic_do_ioctl(struct net_device *netdev, struct ifreq *ifr, @@ -2076,11 +2084,11 @@ static void hns_nic_service_task(struct work_struct *work) = container_of(work, struct hns_nic_priv, service_task); struct hnae_handle *h = priv->ae_handle; + hns_nic_reset_subtask(priv); hns_nic_update_link_status(priv->netdev); h->dev->ops->update_led_status(h); hns_nic_update_stats(priv->netdev); - hns_nic_reset_subtask(priv); hns_nic_service_event_complete(priv); } -- 1.9.1