Two hns bugfixes in post_send flow
Chengchang Tang (1): libhns: Fix reference to uninitialized cq pointer
Junxian Huang (1): libhns: Fix out-of-order issue of requester when setting FENCE
providers/hns/hns_roce_u_hw_v2.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
-- 2.33.0
From: Chengchang Tang tangchengchang@huawei.com
For QPs which do not have an SQ, such as XRC TGT,the send_cq pointer will not be initailized. Since the supported max_gs will be 0 in this case, check it and return before referencing the send_cq pointer.
Fixes: cbdf5e32a855 ("libhns: Reimplement verbs of post_send and post_recv for hip08 RoCE") Signed-off-by: Chengchang Tang tangchengchang@huawei.com Signed-off-by: Junxian Huang huangjunxian6@hisilicon.com --- providers/hns/hns_roce_u_hw_v2.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c index 88bf55fd1..9a5076200 100644 --- a/providers/hns/hns_roce_u_hw_v2.c +++ b/providers/hns/hns_roce_u_hw_v2.c @@ -1288,15 +1288,15 @@ int hns_roce_u_v2_post_send(struct ibv_qp *ibvqp, struct ibv_send_wr *wr, sge_info.start_idx = qp->next_sge; /* start index of extend sge */
for (nreq = 0; wr; ++nreq, wr = wr->next) { - if (hns_roce_v2_wq_overflow(&qp->sq, nreq, - to_hr_cq(qp->verbs_qp.qp.send_cq))) { - ret = ENOMEM; + if (wr->num_sge > (int)qp->sq.max_gs) { + ret = qp->sq.max_gs > 0 ? EINVAL : EOPNOTSUPP; *bad_wr = wr; goto out; }
- if (wr->num_sge > qp->sq.max_gs) { - ret = EINVAL; + if (hns_roce_v2_wq_overflow(&qp->sq, nreq, + to_hr_cq(qp->verbs_qp.qp.send_cq))) { + ret = ENOMEM; *bad_wr = wr; goto out; }
The FENCE indicator in hns WQE doesn't ensure that response data from a previous Read/Atomic operation has been written to the requester's memory before the subsequent Send/Write operation is processed. This may result in the subsequent Send/Write operation accessing the original data in memory instead of the expected response data.
Unlike FENCE, the SO (Strong Order) indicator blocks the subsequent operation until the previous response data is written to memory and a bresp is returned. Set the SO indicator instead of FENCE to maintain strict order.
Fixes: cbdf5e32a855 ("libhns: Reimplement verbs of post_send and post_recv for hip08 RoCE") Signed-off-by: Junxian Huang huangjunxian6@hisilicon.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 9a5076200..07d30ad15 100644 --- a/providers/hns/hns_roce_u_hw_v2.c +++ b/providers/hns/hns_roce_u_hw_v2.c @@ -1223,7 +1223,7 @@ static int set_rc_wqe(void *wqe, struct hns_roce_qp *qp, struct ibv_send_wr *wr,
hr_reg_write_bool(wqe, RCWQE_CQE, !!(wr->send_flags & IBV_SEND_SIGNALED)); - hr_reg_write_bool(wqe, RCWQE_FENCE, + hr_reg_write_bool(wqe, RCWQE_SO, !!(wr->send_flags & IBV_SEND_FENCE)); hr_reg_write_bool(wqe, RCWQE_SE, !!(wr->send_flags & IBV_SEND_SOLICITED));
high-performance-network@openeuler.org