RDMA/hns: Fix insufficient extend DB for VFs.

[ Upstream commit 0b8e658f70 ]

VFs and its PF will share the memory of the extend DB. Currently,
the number of extend DB allocated by driver is only enough for PF.
This leads to a probability of DB loss and some other problems in
scenarios where both PF and VFs use a large number of QPs.

Fixes: 6b63597d35 ("RDMA/hns: Add TSQ link table support")
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Link: https://lore.kernel.org/r/20240710133705.896445-8-huangjunxian6@hisilicon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Chengchang Tang 2024-07-10 21:37:04 +08:00 committed by Greg Kroah-Hartman
parent 7bf1e00d95
commit e22ea60d2c

View File

@ -2448,14 +2448,16 @@ static int set_llm_cfg_to_hw(struct hns_roce_dev *hr_dev,
static struct hns_roce_link_table * static struct hns_roce_link_table *
alloc_link_table_buf(struct hns_roce_dev *hr_dev) alloc_link_table_buf(struct hns_roce_dev *hr_dev)
{ {
u16 total_sl = hr_dev->caps.sl_num * hr_dev->func_num;
struct hns_roce_v2_priv *priv = hr_dev->priv; struct hns_roce_v2_priv *priv = hr_dev->priv;
struct hns_roce_link_table *link_tbl; struct hns_roce_link_table *link_tbl;
u32 pg_shift, size, min_size; u32 pg_shift, size, min_size;
link_tbl = &priv->ext_llm; link_tbl = &priv->ext_llm;
pg_shift = hr_dev->caps.llm_buf_pg_sz + PAGE_SHIFT; pg_shift = hr_dev->caps.llm_buf_pg_sz + PAGE_SHIFT;
size = hr_dev->caps.num_qps * HNS_ROCE_V2_EXT_LLM_ENTRY_SZ; size = hr_dev->caps.num_qps * hr_dev->func_num *
min_size = HNS_ROCE_EXT_LLM_MIN_PAGES(hr_dev->caps.sl_num) << pg_shift; HNS_ROCE_V2_EXT_LLM_ENTRY_SZ;
min_size = HNS_ROCE_EXT_LLM_MIN_PAGES(total_sl) << pg_shift;
/* Alloc data table */ /* Alloc data table */
size = max(size, min_size); size = max(size, min_size);