From 199b2f78ff9eeeb25acc78f9da495ae58877807a Mon Sep 17 00:00:00 2001
From: Chengchang Tang <tangchengchang@huawei.com>
Date: Tue, 30 Jan 2024 21:28:44 +0800
Subject: [PATCH 46/46] libhns: fix missing new IO support for DCA

driver inclusion
category: bugfix
bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/IBSL67

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

New IO related support has been missed for DCA.

Fixes: 9ab7600d832b ("libhns: Add support for attaching QP's WQE buffer")
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Xinghai Cen <cenxinghai@h-partners.com>
---
 providers/hns/hns_roce_u_hw_v2.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c
index aadea7a..3137111 100644
--- a/providers/hns/hns_roce_u_hw_v2.c
+++ b/providers/hns/hns_roce_u_hw_v2.c
@@ -2191,6 +2191,8 @@ static int wc_start_poll_cq(struct ibv_cq_ex *current,
 	}
 
 	err = hns_roce_poll_one(ctx, &qp, cq, NULL);
+	if (qp && check_dca_detach_enable(qp))
+		dca_detach_qp_buf(ctx, qp);
 
 start_poll_done:
 	if (err != V2_CQ_OK)
@@ -2210,6 +2212,8 @@ static int wc_next_poll_cq(struct ibv_cq_ex *current)
 		return hns_roce_poll_one_swc(cq, NULL);
 
 	err = hns_roce_poll_one(ctx, &qp, cq, NULL);
+	if (qp && check_dca_detach_enable(qp))
+		dca_detach_qp_buf(ctx, qp);
 	if (err != V2_CQ_OK)
 		return err;
 
@@ -2408,6 +2412,9 @@ init_rc_wqe(struct hns_roce_qp *qp, uint64_t wr_id, unsigned int opcode)
 	hr_reg_write_bool(wqe, RCWQE_SE, send_flags & IBV_SEND_SOLICITED);
 	hr_reg_clear(wqe, RCWQE_INLINE);
 
+	if (check_qp_dca_enable(qp))
+		fill_rc_dca_fields(qp->verbs_qp.qp.qp_num, wqe);
+
 	qp->sq.wrid[wqe_idx] = wr_id;
 	qp->cur_wqe = wqe;
 
-- 
2.33.0

