libhns: Fix wrong WQE data when QP wraps around
[ Upstream commit 15adbcf23df2821e8e5a211a7f527fd2a649fb3e ]
DirectWQE fields are not assigned or cleared explicitly when
DirectWQE not used. When QP wraps around, data in these fields
from the previous use at the same position still remains and
are issued to HW by mistake. Clear these fields before issuing
doorbell to HW.
Fixes: 159933c37450 ("libhns: Add support for direct wqe")
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Signed-off-by: Nicolas Morey <nmorey@suse.com>
diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c
index 384f53f..58f688b 100644
--- a/providers/hns/hns_roce_u_hw_v2.c
+++ b/providers/hns/hns_roce_u_hw_v2.c
@@ -1308,6 +1308,9 @@
wqe = get_send_wqe(qp, wqe_idx);
qp->sq.wrid[wqe_idx] = wr->wr_id;
+ /* RC and UD share the same DirectWQE field layout */
+ ((struct hns_roce_rc_sq_wqe *)wqe)->byte_4 = 0;
+
switch (ibvqp->qp_type) {
case IBV_QPT_XRC_SEND:
hr_reg_write(wqe, RCWQE_XRC_SRQN,