Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

RDMA/hns: Remove unused RR mechanism

Round-robin (RR) is no longer used in the allocation of the bitmap table,
and all the function input parameters that use this mechanism are
BITMAP_NO_RR. The code that defines and uses the RR needs to be deleted.

Link: https://lore.kernel.org/r/1623325814-55737-4-git-send-email-liweihang@huawei.com
Signed-off-by: Yangyang Li <liyangyang20@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

authored by

Yangyang Li and committed by
Jason Gunthorpe
38e375b7 1bc530c7

+12 -19
+2 -4
drivers/infiniband/hw/hns/hns_roce_alloc.c
··· 63 63 return ret; 64 64 } 65 65 66 - void hns_roce_bitmap_free(struct hns_roce_bitmap *bitmap, unsigned long obj, 67 - int rr) 66 + void hns_roce_bitmap_free(struct hns_roce_bitmap *bitmap, unsigned long obj) 68 67 { 69 68 obj &= bitmap->max + bitmap->reserved_top - 1; 70 69 71 70 spin_lock(&bitmap->lock); 72 71 clear_bit(obj, bitmap->table); 73 72 74 - if (!rr) 75 - bitmap->last = min(bitmap->last, obj); 73 + bitmap->last = min(bitmap->last, obj); 76 74 bitmap->top = (bitmap->top + bitmap->max + bitmap->reserved_top) 77 75 & bitmap->mask; 78 76 spin_unlock(&bitmap->lock);
+1 -5
drivers/infiniband/hw/hns/hns_roce_device.h
··· 95 95 96 96 #define HNS_ROCE_HOP_NUM_0 0xff 97 97 98 - #define BITMAP_NO_RR 0 99 - #define BITMAP_RR 1 100 - 101 98 #define MR_TYPE_MR 0x00 102 99 #define MR_TYPE_FRMR 0x01 103 100 #define MR_TYPE_DMA 0x03 ··· 1153 1156 void hns_roce_cleanup_xrcd_table(struct hns_roce_dev *hr_dev); 1154 1157 1155 1158 int hns_roce_bitmap_alloc(struct hns_roce_bitmap *bitmap, unsigned long *obj); 1156 - void hns_roce_bitmap_free(struct hns_roce_bitmap *bitmap, unsigned long obj, 1157 - int rr); 1159 + void hns_roce_bitmap_free(struct hns_roce_bitmap *bitmap, unsigned long obj); 1158 1160 int hns_roce_bitmap_init(struct hns_roce_bitmap *bitmap, u32 num, u32 mask, 1159 1161 u32 reserved_bot, u32 resetrved_top); 1160 1162 void hns_roce_bitmap_cleanup(struct hns_roce_bitmap *bitmap);
+1 -1
drivers/infiniband/hw/hns/hns_roce_hw_v1.c
··· 1199 1199 mr->key, jiffies_to_usecs(jiffies) - jiffies_to_usecs(start)); 1200 1200 1201 1201 hns_roce_bitmap_free(&hr_dev->mr_table.mtpt_bitmap, 1202 - key_to_hw_index(mr->key), 0); 1202 + key_to_hw_index(mr->key)); 1203 1203 hns_roce_mtr_destroy(hr_dev, &mr->pbl_mtr); 1204 1204 kfree(mr); 1205 1205
+3 -3
drivers/infiniband/hw/hns/hns_roce_mr.c
··· 91 91 92 92 return 0; 93 93 err_free_bitmap: 94 - hns_roce_bitmap_free(&hr_dev->mr_table.mtpt_bitmap, obj, BITMAP_NO_RR); 94 + hns_roce_bitmap_free(&hr_dev->mr_table.mtpt_bitmap, obj); 95 95 return err; 96 96 } 97 97 ··· 100 100 unsigned long obj = key_to_hw_index(mr->key); 101 101 102 102 hns_roce_table_put(hr_dev, &hr_dev->mr_table.mtpt_table, obj); 103 - hns_roce_bitmap_free(&hr_dev->mr_table.mtpt_bitmap, obj, BITMAP_NO_RR); 103 + hns_roce_bitmap_free(&hr_dev->mr_table.mtpt_bitmap, obj); 104 104 } 105 105 106 106 static int alloc_mr_pbl(struct hns_roce_dev *hr_dev, struct hns_roce_mr *mr, ··· 504 504 } 505 505 506 506 hns_roce_bitmap_free(&hr_dev->mr_table.mtpt_bitmap, 507 - key_to_hw_index(mw->rkey), BITMAP_NO_RR); 507 + key_to_hw_index(mw->rkey)); 508 508 } 509 509 510 510 static int hns_roce_mw_enable(struct hns_roce_dev *hr_dev,
+3 -4
drivers/infiniband/hw/hns/hns_roce_pd.c
··· 41 41 42 42 static void hns_roce_pd_free(struct hns_roce_dev *hr_dev, unsigned long pdn) 43 43 { 44 - hns_roce_bitmap_free(&hr_dev->pd_bitmap, pdn, BITMAP_NO_RR); 44 + hns_roce_bitmap_free(&hr_dev->pd_bitmap, pdn); 45 45 } 46 46 47 47 int hns_roce_init_pd_table(struct hns_roce_dev *hr_dev) ··· 121 121 122 122 void hns_roce_uar_free(struct hns_roce_dev *hr_dev, struct hns_roce_uar *uar) 123 123 { 124 - hns_roce_bitmap_free(&hr_dev->uar_table.bitmap, uar->logic_idx, 125 - BITMAP_NO_RR); 124 + hns_roce_bitmap_free(&hr_dev->uar_table.bitmap, uar->logic_idx); 126 125 } 127 126 128 127 int hns_roce_init_uar_table(struct hns_roce_dev *hr_dev) ··· 154 155 static void hns_roce_xrcd_free(struct hns_roce_dev *hr_dev, 155 156 u32 xrcdn) 156 157 { 157 - hns_roce_bitmap_free(&hr_dev->xrcd_bitmap, xrcdn, BITMAP_NO_RR); 158 + hns_roce_bitmap_free(&hr_dev->xrcd_bitmap, xrcdn); 158 159 } 159 160 160 161 int hns_roce_init_xrcd_table(struct hns_roce_dev *hr_dev)
+2 -2
drivers/infiniband/hw/hns/hns_roce_srq.c
··· 132 132 err_put: 133 133 hns_roce_table_put(hr_dev, &srq_table->table, srq->srqn); 134 134 err_out: 135 - hns_roce_bitmap_free(&srq_table->bitmap, srq->srqn, BITMAP_NO_RR); 135 + hns_roce_bitmap_free(&srq_table->bitmap, srq->srqn); 136 136 137 137 return ret; 138 138 } ··· 154 154 wait_for_completion(&srq->free); 155 155 156 156 hns_roce_table_put(hr_dev, &srq_table->table, srq->srqn); 157 - hns_roce_bitmap_free(&srq_table->bitmap, srq->srqn, BITMAP_NO_RR); 157 + hns_roce_bitmap_free(&srq_table->bitmap, srq->srqn); 158 158 } 159 159 160 160 static int alloc_srq_idx(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq,