diff options
| author | Junxian Huang <huangjunxian6@hisilicon.com> | 2026-09-07 16:49:00 +0800 |
|---|---|---|
| committer | Leon Romanovsky <leon@kernel.org> | 2026-09-10 07:55:03 -0400 |
| commit | bb464eeadd301c3a53e9f92a2a472b73c42b74c4 (patch) | |
| tree | b669e38af1662d68511087d62549d3a42ebee59c | |
| parent | 593fd6c48861364b445f1181a7818370b8280c13 (diff) | |
| download | linux-next-bb464eeadd301c3a53e9f92a2a472b73c42b74c4.tar.gz linux-next-bb464eeadd301c3a53e9f92a2a472b73c42b74c4.zip | |
RDMA/hns: Limit gmv_entry_num to avoid memory waste
The GMV entry is a HW object corresponding to a GID. Since gid_table_len
is already limited to a maximum of 256, there is no need to allocate
memory for those extra GMV entries as they will never be touched.
Fixes: 7243396aaf12 ("RDMA/hns: Add a max length of gid table")
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Link: https://patch.msgid.link/20260907084901.2420703-3-huangjunxian6@hisilicon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
| -rw-r--r-- | drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index 47e8b4c8bd83..56358600c42d 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -2421,8 +2421,7 @@ static void apply_func_caps(struct hns_roce_dev *hr_dev) caps->gmv_bt_num * (HNS_HW_PAGE_SIZE / caps->gmv_entry_sz)); - caps->gmv_entry_num = caps->gmv_bt_num * (HNS_HW_PAGE_SIZE / - caps->gmv_entry_sz); + caps->gmv_entry_num = caps->gid_table_len[0]; } else { u32 func_num = max_t(u32, 1, hr_dev->func_num); |
