RDMA/hns: Fix base address table allocation
authorChengchang Tang <tangchengchang@huawei.com>
Fri, 12 May 2023 09:22:44 +0000 (17:22 +0800)
committerJason Gunthorpe <jgg@nvidia.com>
Wed, 17 May 2023 19:05:00 +0000 (16:05 -0300)
commit7f3969b14f356dd65fa95b3528eb05c32e68bc06
tree937a501e4194d5119bc637229bbe4fd38bd36787
parent58caa2a51ad4fd21763696cc6c4defc9fc1b4b4f
RDMA/hns: Fix base address table allocation

For hns, the specification of an entry like resource (E.g. WQE/CQE/EQE)
depends on BT page size, buf page size and hopnum. For user mode, the buf
page size depends on UMEM. Therefore, the actual specification is
controlled by BT page size and hopnum.

The current BT page size and hopnum are obtained from firmware. This makes
the driver inflexible and introduces unnecessary constraints.  Resource
allocation failures occur in many scenarios.

This patch will calculate whether the BT page size set by firmware is
sufficient before allocating BT, and increase the BT page size if it is
insufficient.

Fixes: 1133401412a9 ("RDMA/hns: Optimize base address table config flow for qp buffer")
Link: https://lore.kernel.org/r/20230512092245.344442-3-huangjunxian6@hisilicon.com
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/hns/hns_roce_mr.c