Skip to content

Commit

Permalink
libhns: Fix the owner bit error of sq in new io
Browse files Browse the repository at this point in the history
[ Upstream commit c292b78 ]

Currently, the update of the head position of an SQ precedes the setting
of owner bit of WQEs in new io. It may cause HW to mistakenly assume that
the SQ has been flipped while it hasn't, further leading to failure to
obtain WQEs.

This patch sets the onwer bit before the update of the head position of
an SQ.

Fixes: 36446a5 ("libhns: Extended QP supports the new post send mechanism")
Signed-off-by: Luoyouming <[email protected]>
Signed-off-by: Junxian Huang <[email protected]>
Signed-off-by: Nicolas Morey <[email protected]>
  • Loading branch information
Luoyouming authored and nmorey committed Jul 4, 2023
1 parent 0859992 commit a5b6e81
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions providers/hns/hns_roce_u_hw_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1963,6 +1963,9 @@ init_rc_wqe(struct hns_roce_qp *qp, uint64_t wr_id, unsigned int opcode)

qp->sq.wrid[wqe_idx] = wr_id;
qp->cur_wqe = wqe;

enable_wqe(qp, wqe, qp->sq.head);

qp->sq.head++;

return wqe;
Expand All @@ -1984,9 +1987,6 @@ static void wr_set_sge_rc(struct ibv_qp_ex *ibv_qp, uint32_t lkey,
wqe->msg_len = htole32(length);
hr_reg_write(wqe, RCWQE_LEN0, length);
hr_reg_write(wqe, RCWQE_SGE_NUM, !!length);
/* ignore ex sge start index */

enable_wqe(qp, wqe, qp->sq.head);
}

static void set_sgl_rc(struct hns_roce_v2_wqe_data_seg *dseg,
Expand Down Expand Up @@ -2289,6 +2289,9 @@ init_ud_wqe(struct hns_roce_qp *qp, uint64_t wr_id, unsigned int opcode)

qp->sq.wrid[wqe_idx] = wr_id;
qp->cur_wqe = wqe;

enable_wqe(qp, wqe, qp->sq.head);

qp->sq.head++;

return wqe;
Expand Down Expand Up @@ -2358,7 +2361,6 @@ static void wr_set_sge_ud(struct ibv_qp_ex *ibv_qp, uint32_t lkey,
dseg->len = htole32(length);

qp->sge_info.start_idx++;
enable_wqe(qp, wqe, qp->sq.head);
}

static void wr_set_sge_list_ud(struct ibv_qp_ex *ibv_qp, size_t num_sge,
Expand Down

0 comments on commit a5b6e81

Please sign in to comment.