linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Yonglong Liu <liuyonglong@huawei.com>,
	Peng Li <lipeng321@huawei.com>,
	"David S . Miller" <davem@davemloft.net>,
	Sasha Levin <sashal@kernel.org>,
	netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 4.9 26/35] net: hns: Avoid net reset caused by pause frames storm
Date: Wed, 26 Dec 2018 17:41:33 -0500	[thread overview]
Message-ID: <20181226224142.150866-26-sashal@kernel.org> (raw)
In-Reply-To: <20181226224142.150866-1-sashal@kernel.org>

From: Yonglong Liu <liuyonglong@huawei.com>

[ Upstream commit a57275d35576fdd89d8c771eedf1e7cf97e0dfa6 ]

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 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 63a14edd6a19..7ffbd70824d9 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
@@ -1407,11 +1407,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,
@@ -1745,11 +1753,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);
 }
 
-- 
2.19.1


  parent reply	other threads:[~2018-12-26 22:54 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-26 22:41 [PATCH AUTOSEL 4.9 01/35] pinctrl: meson: fix pull enable register calculation Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 02/35] powerpc: Fix COFF zImage booting on old powermacs Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 03/35] ARM: imx: update the cpu power up timing setting on i.mx6sx Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 04/35] ARM: dts: imx7d-nitrogen7: Fix the description of the Wifi clock Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 05/35] Input: restore EV_ABS ABS_RESERVED Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 06/35] checkstack.pl: fix for aarch64 Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 07/35] xfrm: Fix bucket count reported to userspace Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 08/35] netfilter: seqadj: re-load tcp header pointer after possible head reallocation Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 09/35] scsi: bnx2fc: Fix NULL dereference in error handling Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 10/35] Input: omap-keypad - fix idle configuration to not block SoC idle states Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 11/35] USB: hso: Fix OOB memory access in hso_probe/hso_get_config_data Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 12/35] netfilter: ipset: do not call ipset_nest_end after nla_nest_cancel Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 13/35] bnx2x: Clear fip MAC when fcoe offload support is disabled Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 14/35] bnx2x: Remove configured vlans as part of unload sequence Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 15/35] bnx2x: Send update-svid ramrod with retry/poll flags enabled Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 16/35] scsi: target: iscsi: cxgbit: fix csk leak Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 17/35] scsi: target: iscsi: cxgbit: add missing spin_lock_init() Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 18/35] drivers: net: xgene: Remove unnecessary forward declarations Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 19/35] w90p910_ether: remove incorrect __init annotation Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 20/35] net: hns: Incorrect offset address used for some registers Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 21/35] net: hns: All ports can not work when insmod hns ko after rmmod Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 22/35] net: hns: Some registers use wrong address according to the datasheet Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 23/35] net: hns: Fixed bug that netdev was opened twice Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 24/35] net: hns: Clean rx fbd when ae stopped Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 25/35] net: hns: Free irq when exit from abnormal branch Sasha Levin
2018-12-26 22:41 ` Sasha Levin [this message]
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 27/35] net: hns: Fix ntuple-filters status error Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 28/35] net: hns: Add mac pcs config when enable|disable mac Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 29/35] SUNRPC: Fix a race with XPRT_CONNECTING Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 30/35] x86/mtrr: Don't copy uninitialized gentry fields back to userspace Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 31/35] lan78xx: Resolve issue with changing MAC address Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 32/35] xen/netfront: tolerate frags with no data Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 33/35] vxge: ensure data0 is initialized in when fetching firmware version information Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 34/35] net: netxen: fix a missing check and an uninitialized use Sasha Levin
2018-12-26 22:41 ` [PATCH AUTOSEL 4.9 35/35] serial/sunsu: fix refcount leak Sasha Levin

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=20181226224142.150866-26-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lipeng321@huawei.com \
    --cc=liuyonglong@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).