net: hibmcge: Add reset supported in this module
authorJijie Shao <shaojijie@huawei.com>
Mon, 16 Dec 2024 04:05:31 +0000 (12:05 +0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 18 Dec 2024 04:01:39 +0000 (20:01 -0800)
commit3f5a61f6d504f55ed1a36cce044d5123d508721f
tree50e8f7bee3de6bc86dfc977f61d7d99e7cf1c6fb
parent3a03763f38769707a4dd0ca44474806fed3a7f81
net: hibmcge: Add reset supported in this module

Sometimes, if the port doesn't work, we can try to fix it by resetting it.

This patch supports reset triggered by ethtool or FLR of PCIe, For example:
 ethtool --reset eth0 dedicated
 echo 1 > /sys/bus/pci/devices/0000\:83\:00.1/reset

We hope that the reset can be performed only when the port is down,
and the port cannot be up during the reset.
Therefore, the entire reset process is protected by the rtnl lock.

After the reset is complete, the hardware registers are restored
to their default values. Therefore, some rebuild operations are
required to rewrite the user configuration to the registers.

Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20241216040532.1566229-7-shaojijie@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/hisilicon/hibmcge/Makefile
drivers/net/ethernet/hisilicon/hibmcge/hbg_common.h
drivers/net/ethernet/hisilicon/hibmcge/hbg_debugfs.c
drivers/net/ethernet/hisilicon/hibmcge/hbg_err.c [new file with mode: 0644]
drivers/net/ethernet/hisilicon/hibmcge/hbg_err.h [new file with mode: 0644]
drivers/net/ethernet/hisilicon/hibmcge/hbg_ethtool.c
drivers/net/ethernet/hisilicon/hibmcge/hbg_hw.c
drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c