Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Junxian Huang <huangjunxian6@hisilicon.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: <jgg@ziepe.ca>, <linux-rdma@vger.kernel.org>,
	<linuxarm@huawei.com>, <linux-kernel@vger.kernel.org>,
	<tangchengchang@huawei.com>
Subject: Re: [PATCH v2 for-next] RDMA/hns: Fix different dgids mapping to the same dip_idx
Date: Mon, 11 Nov 2024 16:47:04 +0800	[thread overview]
Message-ID: <e8230a57-4614-a2df-12fe-80e764d4df27@hisilicon.com> (raw)
In-Reply-To: <20241110142836.GB50588@unreal>



On 2024/11/10 22:28, Leon Romanovsky wrote:
> On Thu, Nov 07, 2024 at 02:11:48PM +0800, Junxian Huang wrote:
>> From: Feng Fang <fangfeng4@huawei.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@huawei.com>
>> Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.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?
> 

Will add in v3, thanks.

Junxian

> Thanks

      reply	other threads:[~2024-11-11  8:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-07  6:11 [PATCH v2 for-next] RDMA/hns: Fix different dgids mapping to the same dip_idx Junxian Huang
2024-11-08  7:11 ` Zhu Yanjun
2024-11-08  7:33   ` Junxian Huang
2024-11-10 14:28 ` Leon Romanovsky
2024-11-11  8:47   ` Junxian Huang [this message]

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=e8230a57-4614-a2df-12fe-80e764d4df27@hisilicon.com \
    --to=huangjunxian6@hisilicon.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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