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: Cleanup and Bugfixes #1579

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions providers/hns/hns_roce_u_verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,16 @@ static unsigned int get_sge_num_from_max_inl_data(bool is_ud,
return inline_sge;
}

static uint32_t get_max_inline_data(struct hns_roce_context *ctx,
struct ibv_qp_cap *cap)
{
if (cap->max_inline_data)
return min_t(uint32_t, roundup_pow_of_two(cap->max_inline_data),
ctx->max_inline_data);

return 0;
}

static void set_ext_sge_param(struct hns_roce_context *ctx,
struct ibv_qp_init_attr_ex *attr,
struct hns_roce_qp *qp, unsigned int wr_cnt)
Expand All @@ -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(
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

attr->cap.max_inline_data),
ctx->max_inline_data);
attr->cap.max_inline_data = get_max_inline_data(ctx, &attr->cap);

inline_ext_sge = max(ext_wqe_sge_cnt,
get_sge_num_from_max_inl_data(is_ud,
Expand Down