Skip to content

Commit

Permalink
RDMA/hns: Correct the value of srq_desc_size
Browse files Browse the repository at this point in the history
srq_desc_size should be rounded up to pow of two before used, or related
calculation may cause allocating wrong size of memory for srq buffer.

Fixes: c7bcb13 ("RDMA/hns: Add SRQ support for hip08 kernel mode")
Link: https://lore.kernel.org/r/1572575610-52530-3-git-send-email-liweihang@hisilicon.com
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Weihang Li <liweihang@hisilicon.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
  • Loading branch information
Wenpeng Liang authored and Jason Gunthorpe committed Nov 6, 2019
1 parent 531eb45 commit 411c1e6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/hns/hns_roce_srq.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ int hns_roce_create_srq(struct ib_srq *ib_srq,
srq->max = roundup_pow_of_two(srq_init_attr->attr.max_wr + 1);
srq->max_gs = srq_init_attr->attr.max_sge;

srq_desc_size = max(16, 16 * srq->max_gs);
srq_desc_size = roundup_pow_of_two(max(16, 16 * srq->max_gs));

srq->wqe_shift = ilog2(srq_desc_size);

Expand Down

0 comments on commit 411c1e6

Please sign in to comment.