Skip to content

Commit

Permalink
libhns: Fix missing fields for SRQ WC
Browse files Browse the repository at this point in the history
[ Upstream commit 65a7ce9 ]

The sl and src_qpn fields in recv-WC are not filled when the QP is UD
and has an SRQ. Here fix it.

In addition, UD QP does not support RQ INLINE and CQE INLINE features.
Reorder the related if-else statements to reduce the number of
conditional checks in IO path.

Fixes: 061f7e1 ("libhns: Refactor the poll one interface")
Signed-off-by: wenglianfa <wenglianfa@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Signed-off-by: Nicolas Morey <nmorey@suse.com>
  • Loading branch information
wenglianfa authored and nmorey committed Jan 20, 2025
1 parent d25bf07 commit a338298
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions providers/hns/hns_roce_u_hw_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,10 +495,14 @@ static void parse_for_ud_qp(struct hns_roce_v2_cqe *cqe, struct ibv_wc *wc)
}

static void parse_cqe_for_srq(struct hns_roce_v2_cqe *cqe, struct ibv_wc *wc,
struct hns_roce_srq *srq)
struct hns_roce_srq *srq,
struct hns_roce_qp *hr_qp)
{
uint32_t wqe_idx;

if (hr_qp->verbs_qp.qp.qp_type == IBV_QPT_UD)
parse_for_ud_qp(cqe, wc);

wqe_idx = hr_reg_read(cqe, CQE_WQE_IDX);
wc->wr_id = srq->wrid[wqe_idx & (srq->wqe_cnt - 1)];
hns_roce_free_srq_wqe(srq, wqe_idx);
Expand All @@ -516,13 +520,13 @@ static void parse_cqe_for_resp(struct hns_roce_v2_cqe *cqe, struct ibv_wc *wc,
wc->wr_id = wq->wrid[wq->tail & (wq->wqe_cnt - 1)];
++wq->tail;

if (hr_qp->verbs_qp.qp.qp_type == IBV_QPT_UD)
parse_for_ud_qp(cqe, wc);

if (hr_reg_read(cqe, CQE_CQE_INLINE))
handle_recv_cqe_inl_from_rq(cqe, hr_qp);
else if (hr_reg_read(cqe, CQE_RQ_INLINE))
handle_recv_rq_inl(cqe, hr_qp);
else if (hr_qp->verbs_qp.qp.qp_type == IBV_QPT_UD)
parse_for_ud_qp(cqe, wc);

}

static void parse_cqe_for_req(struct hns_roce_v2_cqe *cqe, struct ibv_wc *wc,
Expand Down Expand Up @@ -654,7 +658,7 @@ static int parse_cqe_for_cq(struct hns_roce_context *ctx, struct hns_roce_cq *cq
return V2_CQ_POLL_ERR;

if (srq)
parse_cqe_for_srq(cqe, wc, srq);
parse_cqe_for_srq(cqe, wc, srq, cur_qp);
else
parse_cqe_for_resp(cqe, wc, cur_qp);
}
Expand Down

0 comments on commit a338298

Please sign in to comment.