Skip to content

Commit 0b8e658

Browse files
Chengchang Tangrleon
authored andcommitted
RDMA/hns: Fix insufficient extend DB for VFs.
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: 6b63597 ("RDMA/hns: Add TSQ link table support") Signed-off-by: Chengchang Tang <[email protected]> Signed-off-by: Junxian Huang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 36397b9 commit 0b8e658

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/infiniband/hw/hns/hns_roce_hw_v2.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2463,14 +2463,16 @@ static int set_llm_cfg_to_hw(struct hns_roce_dev *hr_dev,
24632463
static struct hns_roce_link_table *
24642464
alloc_link_table_buf(struct hns_roce_dev *hr_dev)
24652465
{
2466+
u16 total_sl = hr_dev->caps.sl_num * hr_dev->func_num;
24662467
struct hns_roce_v2_priv *priv = hr_dev->priv;
24672468
struct hns_roce_link_table *link_tbl;
24682469
u32 pg_shift, size, min_size;
24692470

24702471
link_tbl = &priv->ext_llm;
24712472
pg_shift = hr_dev->caps.llm_buf_pg_sz + PAGE_SHIFT;
2472-
size = hr_dev->caps.num_qps * HNS_ROCE_V2_EXT_LLM_ENTRY_SZ;
2473-
min_size = HNS_ROCE_EXT_LLM_MIN_PAGES(hr_dev->caps.sl_num) << pg_shift;
2473+
size = hr_dev->caps.num_qps * hr_dev->func_num *
2474+
HNS_ROCE_V2_EXT_LLM_ENTRY_SZ;
2475+
min_size = HNS_ROCE_EXT_LLM_MIN_PAGES(total_sl) << pg_shift;
24742476

24752477
/* Alloc data table */
24762478
size = max(size, min_size);

0 commit comments

Comments
 (0)