-
Notifications
You must be signed in to change notification settings - Fork 726
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: Cleanup and Bugfixes #1579
base: master
Are you sure you want to change the base?
Conversation
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>
@@ -1307,9 +1317,7 @@ static void set_ext_sge_param(struct hns_roce_context *ctx, | |||
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( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just use min3() instead.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try it
There was a problem hiding this comment.
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
This PR contains some recent cleanup and bugfixes for libhns.