mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peng Li <lipeng321@huawei.com>
To: <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linuxarm@huawei.com>, <yisen.zhuang@huawei.com>,
	<salil.mehta@huawei.com>, <lipeng321@huawei.com>
Subject: [Patch net 07/10] net: hns: Avoid net reset caused by pause frames storm
Date: Sat, 15 Dec 2018 11:53:26 +0800	[thread overview]
Message-ID: <1544846009-50276-8-git-send-email-lipeng321@huawei.com> (raw)
In-Reply-To: <1544846009-50276-1-git-send-email-lipeng321@huawei.com>

From: Yonglong Liu <liuyonglong@huawei.com>

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 <liuyonglong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
---
 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


  parent reply	other threads:[~2018-12-15  3:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-15  3:53 [Patch net 00/10] net: hns: Code improvements & fixes for HNS driver Peng Li
2018-12-15  3:53 ` [Patch net 01/10] net: hns: Incorrect offset address used for some registers Peng Li
2018-12-15  3:53 ` [Patch net 02/10] net: hns: All ports can not work when insmod hns ko after rmmod Peng Li
2018-12-15  3:53 ` [Patch net 03/10] net: hns: Some registers use wrong address according to the datasheet Peng Li
2018-12-15  3:53 ` [Patch net 04/10] net: hns: Fixed bug that netdev was opened twice Peng Li
2018-12-15  3:53 ` [Patch net 05/10] net: hns: Clean rx fbd when ae stopped Peng Li
2018-12-15  3:53 ` [Patch net 06/10] net: hns: Free irq when exit from abnormal branch Peng Li
2018-12-15  3:53 ` Peng Li [this message]
2018-12-15  3:53 ` [Patch net 08/10] net: hns: Fix ntuple-filters status error Peng Li
2018-12-15  3:53 ` [Patch net 09/10] net: hns: Add mac pcs config when enable|disable mac Peng Li
2018-12-15  3:53 ` [Patch net 10/10] net: hns: Fix ping failed when use net bridge and send multicast Peng Li
2018-12-16 20:07 ` [Patch net 00/10] net: hns: Code improvements & fixes for HNS driver David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1544846009-50276-8-git-send-email-lipeng321@huawei.com \
    --to=lipeng321@huawei.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=salil.mehta@huawei.com \
    --cc=yisen.zhuang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®