Skip to content

Conversation

@hginjgerx
Copy link

This PR contains some recent cleanup and bugfixes for libhns.

Junxian Huang and others added 3 commits March 13, 2025 19:03
Clean up mixed signed/unsigned type issues. Fix a wrong format
character as well.

Fixes: cf6d914 ("libhns: Introduce hns direct verbs")
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
When cap.max_inline_data is 0, it will be modified to 1 since
roundup_pow_of_two(0) == 1, which violates users' expectations.
Here fix it.

Fixes: 2aff0d5 ("libhns: Fix the problem of sge nums")
Signed-off-by: wenglianfa <wenglianfa@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
The spin_unlock order should be the reverse of spin_lock order.

Fixes: 179f015 ("libhns: Add support for lock-free QP")
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
attr->cap.max_send_sge);

if (ctx->config & HNS_ROCE_RSP_EXSGE_FLAGS) {
attr->cap.max_inline_data = min_t(uint32_t, roundup_pow_of_two(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just use min3() instead.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just use min3() instead.

Sorry I don't get it. Only two values ​​are compared here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

min3(attr->cap.max_inline_data, roundup_pow_of_two(attr->cap.max_inline_data), ctx->max_inline_data)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

min3(attr->cap.max_inline_data, roundup_pow_of_two(attr->cap.max_inline_data), ctx->max_inline_data)

This is wrong when attr->cap.max_inline_data is not power of 2

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try it

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried, but the result was really not what we expected, since roundup_pow_of_two(attr->cap.max_inline_data) will never be smaller than attr->cap.max_inline_data. What we want is the roundup_pow_of_two() value.

attr->cap.max_inline_data = 3
roundup_pow_of_two(attr->cap.max_inline_data) = 4
ctx->max_inline_data = 1024
min3 result = 3

@rleon rleon merged commit 4c2e07f into linux-rdma:master Apr 10, 2025
14 checks passed
@hginjgerx hginjgerx deleted the fix branch May 26, 2025 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants