Skip to content

Commit

Permalink
libhns: Fix owner bit when SQ wraps around in new IO
Browse files Browse the repository at this point in the history
Commit c292b78 ("libhns: Fix the owner bit error of sq in new io")
fixed a bug that the SQ head was updated before the owner bit was filled
in WQE, but only when using ibv_wr_set_sge(). Actually this bug still
exists in other ibv_wr_set_*().

For example, in the flow below, the driver will fill the owner bit in
ibv_wr_rdma_write(), but mistakenly overwrite it again in
ibv_wr_set_sge_list() or ibv_wr_set_inline_data_list().

```c
ibv_wr_start();
ibv_wr_rdma_write();
if (inline)
    ibv_wr_set_inline_data_list();
else
    ibv_wr_set_sge_list();
ibv_wr_complete();
```

When the SQ wraps around, the overwritten value will be incorrect.
Remove all the incorrect owner bit filling in ibv_wr_set_*().

Fixes: 36446a5 ("libhns: Extended QP supports the new post send mechanism")
Fixes: c292b78 ("libhns: Fix the owner bit error of sq in new io")
Signed-off-by: Chengchang Tang <[email protected]>
Signed-off-by: Junxian Huang <[email protected]>
  • Loading branch information
Chengchang Tang authored and Junxian Huang committed Apr 18, 2024
1 parent 2af6b0f commit 0067aad
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions providers/hns/hns_roce_u_hw_v2.c
Expand Up @@ -2104,8 +2104,6 @@ static void wr_set_sge_list_rc(struct ibv_qp_ex *ibv_qp, size_t num_sge,

wqe->msg_len = htole32(qp->sge_info.total_len);
hr_reg_write(wqe, RCWQE_SGE_NUM, qp->sge_info.valid_num);

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

static void wr_send_rc(struct ibv_qp_ex *ibv_qp)
Expand Down Expand Up @@ -2297,7 +2295,6 @@ static void wr_set_inline_data_rc(struct ibv_qp_ex *ibv_qp, void *addr,

qp->sge_info.total_len = length;
set_inline_data_list_rc(qp, wqe, 1, &buff);
enable_wqe(qp, wqe, qp->sq.head);
}

static void wr_set_inline_data_list_rc(struct ibv_qp_ex *ibv_qp, size_t num_buf,
Expand All @@ -2315,7 +2312,6 @@ static void wr_set_inline_data_list_rc(struct ibv_qp_ex *ibv_qp, size_t num_buf,
qp->sge_info.total_len += buf_list[i].length;

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

static struct hns_roce_ud_sq_wqe *
Expand Down Expand Up @@ -2452,7 +2448,6 @@ static void wr_set_sge_list_ud(struct ibv_qp_ex *ibv_qp, size_t num_sge,
hr_reg_write(wqe, UDWQE_SGE_NUM, cnt);

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

static void set_inline_data_list_ud(struct hns_roce_qp *qp,
Expand Down Expand Up @@ -2518,7 +2513,6 @@ static void wr_set_inline_data_ud(struct ibv_qp_ex *ibv_qp, void *addr,

qp->sge_info.total_len = length;
set_inline_data_list_ud(qp, wqe, 1, &buff);
enable_wqe(qp, wqe, qp->sq.head);
}

static void wr_set_inline_data_list_ud(struct ibv_qp_ex *ibv_qp, size_t num_buf,
Expand All @@ -2536,7 +2530,6 @@ static void wr_set_inline_data_list_ud(struct ibv_qp_ex *ibv_qp, size_t num_buf,
qp->sge_info.total_len += buf_list[i].length;

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

static void wr_start(struct ibv_qp_ex *ibv_qp)
Expand Down

0 comments on commit 0067aad

Please sign in to comment.