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

libhns: Bugfixes and cleanups #1450

merged 6 commits into from May 8, 2024

Conversation

hginjgerx
Copy link

This PR contains serveral bugfixes and cleanups.

Junxian Huang and others added 6 commits April 18, 2024 13:57
parse_cqe_for_resp() will never fail and always returns 0. Remove the
unused return value.

Fixes: 061f7e1 ("libhns: Refactor the poll one interface")
Signed-off-by: Junxian Huang <[email protected]>
Fix several context lock issue:

1. db_list_mutex is used without init currently. Add its init to
   hns_roce_alloc_context().

2. pthread_mutex_init()/pthread_spin_init() may return error value.
   Check the return value in hns_roce_alloc_context().

3. Add destruction for these context locks.

4. Encapsulate init and destruction functions for these context locks.

Fixes: 13eae88 ("libhns: Support rq record doorbell")
Fixes: 887b78c ("libhns: Add initial main frame")
Signed-off-by: Junxian Huang <[email protected]>
The driver should call pthread_spin_destroy() to destroy spin locks
before exiting.

Signed-off-by: Junxian Huang <[email protected]>
Clear the doorbell when getting it to avoid clearing it in each
function that uses hns_roce_alloc_db()

Signed-off-by: Chengchang Tang <[email protected]>
Signed-off-by: Junxian Huang <[email protected]>
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]>
Clean up signed-unsigned mix with relational issue.

Fixes: 36446a5 ("libhns: Extended QP supports the new post send mechanism")
Signed-off-by: Junxian Huang <[email protected]>
@rleon rleon merged commit c6ff77b into linux-rdma:master May 8, 2024
14 checks passed
@rleon
Copy link
Member

rleon commented May 8, 2024

Sorry for delay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants