Commit 85d6de79 authored by Hao Chen's avatar Hao Chen Committed by Jiantao Xiao
Browse files

net: hns3: add support modified tx timeout

driver inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I97T47


CVE: NA

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

The patch provides a customized interface to modify the tx timeout.

Signed-off-by: default avatarHao Chen <chenhao418@huawei.com>
Signed-off-by: default avatarJiantao Xiao <xiaojiantao1@h-partners.com>
parent 96debf1b
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -389,3 +389,17 @@ int nic_get_port_num_per_chip(struct net_device *ndev, u32 *port_num)
	return nic_get_port_num_of_die(ndev, port_num);
}
EXPORT_SYMBOL(nic_get_port_num_per_chip);

int nic_set_tx_timeout(struct net_device *ndev, int tx_timeout)
{
	if (nic_netdev_match_check(ndev))
		return -ENODEV;

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

	ndev->watchdog_timeo = tx_timeout * HZ;

	return 0;
}
EXPORT_SYMBOL(nic_set_tx_timeout);
+2 −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 600

int nic_netdev_match_check(struct net_device *netdev);
void nic_chip_recover_handler(struct net_device *ndev,
@@ -35,4 +36,5 @@ int nic_get_chip_num(struct net_device *ndev, u32 *chip_num);
int nic_get_io_die_num(struct net_device *ndev, u32 *io_die_num);
int nic_get_port_num_of_die(struct net_device *ndev, u32 *port_num);
int nic_get_port_num_per_chip(struct net_device *ndev, u32 *port_num);
int nic_set_tx_timeout(struct net_device *ndev, int tx_timeout);
#endif