RDMA/hns: Support reset recovery for bond

Re-set bond configuration to HW after HW reset.

Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Link: https://patch.msgid.link/20251112093510.3696363-9-huangjunxian6@hisilicon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
This commit is contained in:
Junxian Huang 2025-11-12 17:35:10 +08:00 committed by Leon Romanovsky
parent e72d274f8f
commit d70f30cef2
1 changed files with 20 additions and 0 deletions

View File

@ -160,6 +160,15 @@ static void hns_roce_bond_get_active_slave(struct hns_roce_bond_group *bond_grp)
bond_grp->active_slave_map = active_slave_map; bond_grp->active_slave_map = active_slave_map;
} }
static int hns_roce_recover_bond(struct hns_roce_bond_group *bond_grp,
struct hns_roce_dev *hr_dev)
{
bond_grp->main_hr_dev = hr_dev;
hns_roce_bond_get_active_slave(bond_grp);
return hns_roce_cmd_bond(bond_grp, HNS_ROCE_SET_BOND);
}
static void hns_roce_slave_uninit(struct hns_roce_bond_group *bond_grp, static void hns_roce_slave_uninit(struct hns_roce_bond_group *bond_grp,
u8 func_idx) u8 func_idx)
{ {
@ -918,11 +927,22 @@ void hns_roce_dealloc_bond_grp(void)
int hns_roce_bond_init(struct hns_roce_dev *hr_dev) int hns_roce_bond_init(struct hns_roce_dev *hr_dev)
{ {
struct net_device *net_dev = get_hr_netdev(hr_dev, 0); struct net_device *net_dev = get_hr_netdev(hr_dev, 0);
struct hns_roce_v2_priv *priv = hr_dev->priv;
struct hns_roce_bond_group *bond_grp; struct hns_roce_bond_group *bond_grp;
u8 bus_num = get_hr_bus_num(hr_dev); u8 bus_num = get_hr_bus_num(hr_dev);
int ret;
bond_grp = hns_roce_get_bond_grp(net_dev, bus_num); bond_grp = hns_roce_get_bond_grp(net_dev, bus_num);
if (priv->handle->rinfo.reset_state == HNS_ROCE_STATE_RST_INIT) {
ret = hns_roce_recover_bond(bond_grp, hr_dev);
if (ret) {
dev_err(hr_dev->dev,
"failed to recover RoCE bond, ret = %d.\n", ret);
return ret;
}
}
return hns_roce_set_bond_netdev(bond_grp, hr_dev); return hns_roce_set_bond_netdev(bond_grp, hr_dev);
} }