driver inclusion category: bugfix bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/I8J2Y5?from=project-issue
--------------------------------------------------------------------------
If sq is not enabled, it should not detach dca mem. Moreover, under the current code logic, if detach dca mem, its sq index will be a random value because it is not initialized.
Signed-off-by: Chengchang Tang tangchengchang@huawei.com --- providers/hns/hns_roce_u_hw_v2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c index fc938de..2fb738d 100644 --- a/providers/hns/hns_roce_u_hw_v2.c +++ b/providers/hns/hns_roce_u_hw_v2.c @@ -696,7 +696,7 @@ static void dca_detach_qp_buf(struct hns_roce_context *ctx, hns_roce_spin_unlock(&qp->rq.hr_lock); hns_roce_spin_unlock(&qp->sq.hr_lock);
- if (is_empty) + if (is_empty && qp->sq.wqe_cnt > 0) hns_roce_detach_dca_mem(ctx, qp->verbs_qp.qp.handle, &attr); }
-- 2.30.0