From a6c6fdce822c80977b04ad87021ef157f5a7ee81 Mon Sep 17 00:00:00 2001 From: ZhouJuan Date: Mon, 7 Aug 2023 11:50:52 +0800 Subject: [PATCH] Revert "RDMA/hns: Fix base address table allocation" driver inclusion category: cleanup bugzilla: https://gitee.com/openeuler/kernel/issues/I7RKQ1 --------------------------------------------------------------------------- This reverts commit cae22979a85c3634b201e3d00b8c17f229027294. Signed-off-by: Juan Zhou --- drivers/infiniband/hw/hns/hns_roce_mr.c | 43 ------------------------- 1 file changed, 43 deletions(-) diff --git a/drivers/infiniband/hw/hns/hns_roce_mr.c b/drivers/infiniband/hw/hns/hns_roce_mr.c index e6af8cd520f1..ec4834592725 100644 --- a/drivers/infiniband/hw/hns/hns_roce_mr.c +++ b/drivers/infiniband/hw/hns/hns_roce_mr.c @@ -34,7 +34,6 @@ #include #include #include -#include #include "hns_roce_device.h" #include "hns_roce_cmd.h" #include "hns_roce_hem.h" @@ -1071,44 +1070,6 @@ static int mtr_init_buf_cfg(struct hns_roce_dev *hr_dev, return 0; } -static u64 cal_pages_per_l1ba(unsigned int ba_per_bt, unsigned int hopnum) -{ - return int_pow(ba_per_bt, hopnum - 1); -} - -static unsigned int cal_best_bt_pg_sz(struct hns_roce_dev *hr_dev, - struct hns_roce_mtr *mtr, - unsigned int pg_shift) -{ - unsigned long cap = hr_dev->caps.page_size_cap; - struct hns_roce_buf_region *re; - unsigned int pgs_per_l1ba; - unsigned int ba_per_bt; - unsigned int ba_num; - int i; - - for_each_set_bit_from(pg_shift, &cap, sizeof(cap) * BITS_PER_BYTE) { - if (!(BIT(pg_shift) & cap)) - continue; - - ba_per_bt = BIT(pg_shift) / BA_BYTE_LEN; - ba_num = 0; - for (i = 0; i < mtr->hem_cfg.region_count; i++) { - re = &mtr->hem_cfg.region[i]; - if (re->hopnum == 0) - continue; - - pgs_per_l1ba = cal_pages_per_l1ba(ba_per_bt, re->hopnum); - ba_num += DIV_ROUND_UP(re->count, pgs_per_l1ba); - } - - if (ba_num <= ba_per_bt) - return pg_shift; - } - - return 0; -} - static int mtr_alloc_mtt(struct hns_roce_dev *hr_dev, struct hns_roce_mtr *mtr, unsigned int ba_page_shift) { @@ -1117,10 +1078,6 @@ static int mtr_alloc_mtt(struct hns_roce_dev *hr_dev, struct hns_roce_mtr *mtr, hns_roce_hem_list_init(&mtr->hem_list); if (!cfg->is_direct) { - ba_page_shift = cal_best_bt_pg_sz(hr_dev, mtr, ba_page_shift); - if (!ba_page_shift) - return -ERANGE; - ret = hns_roce_hem_list_request(hr_dev, &mtr->hem_list, cfg->region, cfg->region_count, ba_page_shift); -- GitLab