Re: [PATCH v2 for-next 8/9] RDMA/hns: Fix non-standard error codes

Weihang Li
2019-11-08T08:11:27Z

On 2019/11/6 23:43, Leon Romanovsky wrote:
> On Wed, Nov 06, 2019 at 06:44:06PM +0800, Weihang Li wrote:
>>
>>
>> On 2019/11/6 1:00, Leon Romanovsky wrote:
>>> On Tue, Nov 05, 2019 at 07:08:01PM +0800, Weihang Li wrote:
>>>> From: Yixian Liu <liuyixian@huawei.com>
>>>>
>>>> It is better to return a linux error code than define a private constant.
>>>>
>>>> Signed-off-by: Yixian Liu <liuyixian@huawei.com>
>>>> Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
>>>> Signed-off-by: Weihang Li <liweihang@hisilicon.com>
>>>> ---
>>>> drivers/infiniband/hw/hns/hns_roce_alloc.c | 4 ++--
>>>> drivers/infiniband/hw/hns/hns_roce_cq.c | 4 ++--
>>>> drivers/infiniband/hw/hns/hns_roce_mr.c | 15 ++++++++-------
>>>> drivers/infiniband/hw/hns/hns_roce_pd.c | 2 +-
>>>> drivers/infiniband/hw/hns/hns_roce_srq.c | 2 +-
>>>> 5 files changed, 14 insertions(+), 13 deletions(-)
>>>>
>>>> diff --git a/drivers/infiniband/hw/hns/hns_roce_alloc.c b/drivers/infiniband/hw/hns/hns_roce_alloc.c
>>>> index 8c063c5..da574c2 100644
>>>> --- a/drivers/infiniband/hw/hns/hns_roce_alloc.c
>>>> +++ b/drivers/infiniband/hw/hns/hns_roce_alloc.c
>>>> @@ -55,7 +55,7 @@ int hns_roce_bitmap_alloc(struct hns_roce_bitmap *bitmap, unsigned long *obj)
>>>
>>> Why do HNS driver have custom bitmap functions instead of include/linux/bitmap.h?
>>>
>>> Thanks
>>>
>>> .
>>>
>>
>> Hi Leon,
>>
>> These custom functions achieved the bitmap working in round-robin fashion.
>> When using CM to establish connections, if we allocate a new QP after destroying
>> one, we will get the same QP number which will be rejected by IB core.
>
> QP number is controlled by HW (or at least should) and not by this bitmap.

Hi Leon,

Sorry for the late reply. QP number is allocated by SW in hip08, so we have to use this round-robin bitmap.

>
>>
>> I found related patches about this issue:
>> https://git.congatec.com/android/qmx6_kernel/commit/f4ec9e9531ac79ee2521faf7ad3d98978f747e42
>> https://patchwork.kernel.org/patch/3306941/
>> https://patchwork.kernel.org/patch/9444173/
>
> Irrelevant, those patches try to create and manage object numbers in SW.
>
> Thanks
>
>>
>> Thanks,
>> Weihang
>>
>
> .
>