Commit a7bb852c authored by Junxian Huang's avatar Junxian Huang Committed by Chengchang Tang
Browse files

RDMA/hns: Fix bonding failure due to wrong reset_state

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



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

When roce driver is removed during reset, the reset flow of roce may
not be fully completed. This may lead to the reset_state of roce
handler stored in nic driver remaining in a middle state, such as
HNS_ROCE_STATE_RST_DOWN or HNS_ROCE_STATE_RST_UNINIT.

The reset_state won't be cleared even if roce driver is re-inited.
This cause that roce bonding which currently relies on reset_state
fails in this case.

Replace the reset detection for bonding with nic APIs (.ae_dev_resetting()
and .get_hw_reset_stat()), just like the reset detection elsewhere in
roce driver.

Fixes: b927e306 ("RDMA/hns: Fix the concurrency error between bond and reset.")
Signed-off-by: default avatarJunxian Huang <huangjunxian6@hisilicon.com>
Signed-off-by: default avatarXinghai Cen <cenxinghai@h-partners.com>
parent f5a62ec8
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -543,6 +543,7 @@ static void hns_roce_do_bond(struct hns_roce_bond_group *bond_grp)

bool is_bond_slave_in_reset(struct hns_roce_bond_group *bond_grp)
{
	const struct hnae3_ae_ops *ops;
	struct hnae3_handle *handle;
	struct net_device *net_dev;
	int i;
@@ -550,9 +551,11 @@ bool is_bond_slave_in_reset(struct hns_roce_bond_group *bond_grp)
	for (i = 0; i < ROCE_BOND_FUNC_MAX; i++) {
		net_dev = bond_grp->bond_func_info[i].net_dev;
		handle = bond_grp->bond_func_info[i].handle;
		if (net_dev && handle &&
		    handle->rinfo.reset_state != HNS_ROCE_STATE_NON_RST &&
		    handle->rinfo.reset_state != HNS_ROCE_STATE_RST_INITED)
		if (!net_dev || !handle)
			continue;
		ops = handle->ae_algo->ops;
		if (ops->ae_dev_resetting(handle) ||
		    ops->get_hw_reset_stat(handle))
			return true;
	}