Commit 1b4b5ee0 authored by Hao Chen's avatar Hao Chen Committed by Jiantao Xiao
Browse files

net: hns3: fix setting wrong tx_timeout value issue

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7OL9R


CVE: NA

----------------------------------------------------------------------

When user set tx_timeout, hns3 driver should set tx_timeout * HZ to
ndev->watchdog_timeo but tx_timeout.

So, change it to be correct.

Fixes: dd347d0d (net: hns3: add support modified tx timeout)
Signed-off-by: default avatarHao Chen <chenhao418@huawei.com>
Signed-off-by: default avatarJijie Shao <shaojijie@huawei.com>
parent 7e3bc7dc
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -392,13 +392,15 @@ EXPORT_SYMBOL(nic_get_port_num_per_chip);

int nic_set_tx_timeout(struct net_device *ndev, int tx_timeout)
{
	int watchdog_timeo = tx_timeout * HZ;

	if (nic_netdev_match_check(ndev))
		return -ENODEV;

	if (tx_timeout <= 0)
	if (watchdog_timeo <= 0 || watchdog_timeo > HNS3_MAX_TX_TIMEOUT)
		return -EINVAL;

	ndev->watchdog_timeo = tx_timeout;
	ndev->watchdog_timeo = watchdog_timeo;

	return 0;
}
+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
#define HNS3_PFC_STORM_PARA_ENABLE 1
#define HNS3_PFC_STORM_PARA_PERIOD_MIN 5
#define HNS3_PFC_STORM_PARA_PERIOD_MAX 2000
#define HNS3_MAX_TX_TIMEOUT (10 * 60 * HZ)

#define nic_set_8211_phy_reg nic_set_phy_reg
#define nic_get_8211_phy_reg nic_get_phy_reg