From: Leon Romanovsky <leon@kernel.org>
To: Junxian Huang <huangjunxian6@hisilicon.com>
Cc: jgg@ziepe.ca, linux-rdma@vger.kernel.org,
tangchengchang@huawei.com, linuxarm@huawei.com
Subject: Re: [PATCH for-next 1/2] RDMA/hns: Limit gmv_entry_num to avoid memory waste
Date: Sun, 6 Sep 2026 12:12:33 +0300 [thread overview]
Message-ID: <20260906091233.GC13683@unreal> (raw)
In-Reply-To: <20260904093837.1633748-2-huangjunxian6@hisilicon.com>
On Fri, Sep 04, 2026 at 05:38:36PM +0800, Junxian Huang wrote:
> 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>
> ---
> drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 3 +--
> 1 file changed, 1 insertion(+), 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 27cc7df55ee7..3edceadbca76 100644
> --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
> +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
> @@ -2416,8 +2416,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 = (u32)caps->gid_table_len[0];
Please fix the declaration of gid_table_len first. It should be u32 in the
first place.
Thanks
> } else {
> u32 func_num = max_t(u32, 1, hr_dev->func_num);
>
> --
> 2.33.0
>
next prev parent reply other threads:[~2026-09-06 9:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 9:38 [PATCH for-next 0/2] RDMA/hns: Fix GMV entry management Junxian Huang
2026-09-04 9:38 ` [PATCH for-next 1/2] RDMA/hns: Limit gmv_entry_num to avoid memory waste Junxian Huang
2026-09-06 9:12 ` Leon Romanovsky [this message]
2026-09-07 2:21 ` Junxian Huang
2026-09-04 9:38 ` [PATCH for-next 2/2] RDMA/hns: Fix GID capacity loss in 64K system Junxian Huang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260906091233.GC13683@unreal \
--to=leon@kernel.org \
--cc=huangjunxian6@hisilicon.com \
--cc=jgg@ziepe.ca \
--cc=linux-rdma@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=tangchengchang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox