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@xxxxxxxxxx> >> >> It is better to return a linux error code than define a private constant. >> >> Signed-off-by: Yixian Liu <liuyixian@xxxxxxxxxx> >> Signed-off-by: Wenpeng Liang <liangwenpeng@xxxxxxxxxx> >> Signed-off-by: Weihang Li <liweihang@xxxxxxxxxxxxx> >> --- >> 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. 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/ Thanks, Weihang