Commit e791a511 authored by Junxian Huang's avatar Junxian Huang
Browse files

RDMA/hns: Reorder uctx deallocation

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



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

Reorder hns_roce_dealloc_ucontext() to fit with the reverse order
of allocation.

Fixes: 640cb088 ("RDMA/hns: Add debugfs support for DCA")
Fixes: 5b469415 ("RDMA/hns: Use one CQ bank per context")
Signed-off-by: default avatarJunxian Huang <huangjunxian6@hisilicon.com>
Signed-off-by: default avatarXinghai Cen <cenxinghai@h-partners.com>
parent 159da200
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -632,21 +632,20 @@ static void hns_roce_dealloc_ucontext(struct ib_ucontext *ibcontext)
	struct hns_roce_ucontext *context = to_hr_ucontext(ibcontext);
	struct hns_roce_dev *hr_dev = to_hr_dev(ibcontext->device);

	hns_roce_put_cq_bankid_for_uctx(context);
	hns_roce_unregister_uctx_debugfs(context);

	mutex_lock(&hr_dev->uctx_list_mutex);
	list_del(&context->list);
	mutex_unlock(&hr_dev->uctx_list_mutex);

	hns_roce_unregister_udca(hr_dev, context);
	hns_roce_dealloc_reset_entry(context);
	if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_CQ_RECORD_DB ||
	    hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_QP_RECORD_DB)
		mutex_destroy(&context->page_mutex);

	hns_roce_put_cq_bankid_for_uctx(context);
	hns_roce_unregister_uctx_debugfs(context);

	hns_roce_unregister_udca(hr_dev, context);

	hns_roce_dealloc_uar_entry(context);
	hns_roce_dealloc_reset_entry(context);

	ida_free(&hr_dev->uar_ida.ida, (int)context->uar.logic_idx);
}