[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241110142836.GB50588@unreal>
Date: Sun, 10 Nov 2024 16:28:36 +0200
From: Leon Romanovsky <leon@...nel.org>
To: Junxian Huang <huangjunxian6@...ilicon.com>
Cc: jgg@...pe.ca, linux-rdma@...r.kernel.org, linuxarm@...wei.com,
linux-kernel@...r.kernel.org, tangchengchang@...wei.com
Subject: Re: [PATCH v2 for-next] RDMA/hns: Fix different dgids mapping to the
same dip_idx
On Thu, Nov 07, 2024 at 02:11:48PM +0800, Junxian Huang wrote:
> From: Feng Fang <fangfeng4@...wei.com>
>
> DIP algorithm requires a one-to-one mapping between dgid and dip_idx.
> Currently a queue 'spare_idx' is used to store QPN of QPs that use
> DIP algorithm. For a new dgid, use a QPN from spare_idx as dip_idx.
> This method lacks a mechanism for deduplicating QPN, which may result
> in different dgids sharing the same dip_idx and break the one-to-one
> mapping requirement.
>
> This patch replaces spare_idx with xarray and introduces a refcnt of
> a dip_idx to indicate the number of QPs that using this dip_idx.
>
> The state machine for dip_idx management is implemented as:
>
> * The entry at an index in xarray is empty -- This indicates that the
> corresponding dip_idx hasn't been created.
>
> * The entry at an index in xarray is not empty but with 0 refcnt --
> This indicates that the corresponding dip_idx has been created but
> not used as dip_idx yet.
>
> * The entry at an index in xarray is not empty and with non-0 refcnt --
> This indicates that the corresponding dip_idx is being used by refcnt
> number of DIP QPs.
>
> Fixes: eb653eda1e91 ("RDMA/hns: Bugfix for incorrect association between dip_idx and dgid")
> Fixes: f91696f2f053 ("RDMA/hns: Support congestion control type selection according to the FW")
> Signed-off-by: Feng Fang <fangfeng4@...wei.com>
> Signed-off-by: Junxian Huang <huangjunxian6@...ilicon.com>
> ---
> v1 -> v2:
> * Use xarray instead of bitmaps as Leon suggested.
> * v1: https://lore.kernel.org/all/20240906093444.3571619-10-huangjunxian6@hisilicon.com/
> ---
> drivers/infiniband/hw/hns/hns_roce_device.h | 11 +--
> drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 96 +++++++++++++++------
> drivers/infiniband/hw/hns/hns_roce_hw_v2.h | 2 +-
> drivers/infiniband/hw/hns/hns_roce_main.c | 2 -
> drivers/infiniband/hw/hns/hns_roce_qp.c | 7 +-
> 5 files changed, 74 insertions(+), 44 deletions(-)
>
> diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h
> index 9b51d5a1533f..560a1d9de408 100644
> --- a/drivers/infiniband/hw/hns/hns_roce_device.h
> +++ b/drivers/infiniband/hw/hns/hns_roce_device.h
> @@ -489,12 +489,6 @@ struct hns_roce_bank {
> u32 next; /* Next ID to allocate. */
> };
>
> -struct hns_roce_idx_table {
> - u32 *spare_idx;
> - u32 head;
> - u32 tail;
> -};
> -
> struct hns_roce_qp_table {
> struct hns_roce_hem_table qp_table;
> struct hns_roce_hem_table irrl_table;
> @@ -503,7 +497,7 @@ struct hns_roce_qp_table {
> struct mutex scc_mutex;
> struct hns_roce_bank bank[HNS_ROCE_QP_BANK_NUM];
> struct mutex bank_mutex;
> - struct hns_roce_idx_table idx_table;
> + struct xarray dip_xa;
I don't see xa_destroy() for this xarray, why?
Thanks
Powered by blists - more mailing lists