Commit 6c966b51 authored by wenglianfa's avatar wenglianfa Committed by Chengchang Tang
Browse files

RDMA/hns: Fix long waiting cmd event when reset

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



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

During the reset, the cmd event cannot be reported. As a result,
Thread waiting for cmd event for a long time. To fix it, notify
cmd not to wait for cmd event when reset starts.

Fixes: 9a443537 ("IB/hns: Add driver files for hns RoCE driver")
Signed-off-by: default avatarwenglianfa <wenglianfa@huawei.com>
Signed-off-by: default avatarXinghai Cen <cenxinghai@h-partners.com>
parent 3e9a458b
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -8013,6 +8013,20 @@ static void hns_roce_v2_reset_notify_user(struct hns_roce_dev *hr_dev)
	mutex_unlock(&hr_dev->uctx_list_mutex);
}

static void hns_roce_v2_reset_notify_cmd(struct hns_roce_dev *hr_dev)
{
	struct hns_roce_cmdq *hr_cmd = &hr_dev->cmd;
	int i;

	if (!hr_dev->cmd_mod)
		return;

	for (i = 0; i < hr_cmd->max_cmds; i++) {
		hr_cmd->context[i].result = -EBUSY;
		complete(&hr_cmd->context[i].done);
	}
}

static int hns_roce_hw_v2_reset_notify_down(struct hnae3_handle *handle)
{
	struct hns_roce_dev *hr_dev;
@@ -8036,6 +8050,9 @@ static int hns_roce_hw_v2_reset_notify_down(struct hnae3_handle *handle)

	hr_dev->state = HNS_ROCE_DEVICE_STATE_RST_DOWN;

	/* Complete the CMDQ event in advance during the reset. */
	hns_roce_v2_reset_notify_cmd(hr_dev);

	return 0;
}