Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Junxian Huang and committed by
Leon Romanovsky
d70f30ce e72d274f

+20
+20
drivers/infiniband/hw/hns/hns_roce_bond.c
··· 160 160 bond_grp->active_slave_map = active_slave_map; 161 161 } 162 162 163 + static int hns_roce_recover_bond(struct hns_roce_bond_group *bond_grp, 164 + struct hns_roce_dev *hr_dev) 165 + { 166 + bond_grp->main_hr_dev = hr_dev; 167 + hns_roce_bond_get_active_slave(bond_grp); 168 + 169 + return hns_roce_cmd_bond(bond_grp, HNS_ROCE_SET_BOND); 170 + } 171 + 163 172 static void hns_roce_slave_uninit(struct hns_roce_bond_group *bond_grp, 164 173 u8 func_idx) 165 174 { ··· 927 918 int hns_roce_bond_init(struct hns_roce_dev *hr_dev) 928 919 { 929 920 struct net_device *net_dev = get_hr_netdev(hr_dev, 0); 921 + struct hns_roce_v2_priv *priv = hr_dev->priv; 930 922 struct hns_roce_bond_group *bond_grp; 931 923 u8 bus_num = get_hr_bus_num(hr_dev); 924 + int ret; 932 925 933 926 bond_grp = hns_roce_get_bond_grp(net_dev, bus_num); 927 + 928 + if (priv->handle->rinfo.reset_state == HNS_ROCE_STATE_RST_INIT) { 929 + ret = hns_roce_recover_bond(bond_grp, hr_dev); 930 + if (ret) { 931 + dev_err(hr_dev->dev, 932 + "failed to recover RoCE bond, ret = %d.\n", ret); 933 + return ret; 934 + } 935 + } 934 936 935 937 return hns_roce_set_bond_netdev(bond_grp, hr_dev); 936 938 }