Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libhns: Bugfixes and cleanups #1450

Merged
merged 6 commits into from
May 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
libhns: Fix owner bit when SQ wraps around in new IO
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
commit 0067aad0a3a9a46d6c150e089b30bc9246dfe663
7 changes: 0 additions & 7 deletions providers/hns/hns_roce_u_hw_v2.c
Original file line number Diff line number Diff line change
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