Commit 38e375b7 authored by Yangyang Li's avatar Yangyang Li Committed by Jason Gunthorpe

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.comSigned-off-by: default avatarYangyang Li <liyangyang20@huawei.com>
Signed-off-by: default avatarWeihang Li <liweihang@huawei.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 1bc530c7
...@@ -63,15 +63,13 @@ int hns_roce_bitmap_alloc(struct hns_roce_bitmap *bitmap, unsigned long *obj) ...@@ -63,15 +63,13 @@ int hns_roce_bitmap_alloc(struct hns_roce_bitmap *bitmap, unsigned long *obj)
return ret; return ret;
} }
void hns_roce_bitmap_free(struct hns_roce_bitmap *bitmap, unsigned long obj, void hns_roce_bitmap_free(struct hns_roce_bitmap *bitmap, unsigned long obj)
int rr)
{ {
obj &= bitmap->max + bitmap->reserved_top - 1; obj &= bitmap->max + bitmap->reserved_top - 1;
spin_lock(&bitmap->lock); spin_lock(&bitmap->lock);
clear_bit(obj, bitmap->table); clear_bit(obj, bitmap->table);
if (!rr)
bitmap->last = min(bitmap->last, obj); bitmap->last = min(bitmap->last, obj);
bitmap->top = (bitmap->top + bitmap->max + bitmap->reserved_top) bitmap->top = (bitmap->top + bitmap->max + bitmap->reserved_top)
& bitmap->mask; & bitmap->mask;
......
...@@ -95,9 +95,6 @@ ...@@ -95,9 +95,6 @@
#define HNS_ROCE_HOP_NUM_0 0xff #define HNS_ROCE_HOP_NUM_0 0xff
#define BITMAP_NO_RR 0
#define BITMAP_RR 1
#define MR_TYPE_MR 0x00 #define MR_TYPE_MR 0x00
#define MR_TYPE_FRMR 0x01 #define MR_TYPE_FRMR 0x01
#define MR_TYPE_DMA 0x03 #define MR_TYPE_DMA 0x03
...@@ -1156,8 +1153,7 @@ void hns_roce_cleanup_srq_table(struct hns_roce_dev *hr_dev); ...@@ -1156,8 +1153,7 @@ void hns_roce_cleanup_srq_table(struct hns_roce_dev *hr_dev);
void hns_roce_cleanup_xrcd_table(struct hns_roce_dev *hr_dev); void hns_roce_cleanup_xrcd_table(struct hns_roce_dev *hr_dev);
int hns_roce_bitmap_alloc(struct hns_roce_bitmap *bitmap, unsigned long *obj); int hns_roce_bitmap_alloc(struct hns_roce_bitmap *bitmap, unsigned long *obj);
void hns_roce_bitmap_free(struct hns_roce_bitmap *bitmap, unsigned long obj, void hns_roce_bitmap_free(struct hns_roce_bitmap *bitmap, unsigned long obj);
int rr);
int hns_roce_bitmap_init(struct hns_roce_bitmap *bitmap, u32 num, u32 mask, int hns_roce_bitmap_init(struct hns_roce_bitmap *bitmap, u32 num, u32 mask,
u32 reserved_bot, u32 resetrved_top); u32 reserved_bot, u32 resetrved_top);
void hns_roce_bitmap_cleanup(struct hns_roce_bitmap *bitmap); void hns_roce_bitmap_cleanup(struct hns_roce_bitmap *bitmap);
......
...@@ -1199,7 +1199,7 @@ static int hns_roce_v1_dereg_mr(struct hns_roce_dev *hr_dev, ...@@ -1199,7 +1199,7 @@ static int hns_roce_v1_dereg_mr(struct hns_roce_dev *hr_dev,
mr->key, jiffies_to_usecs(jiffies) - jiffies_to_usecs(start)); mr->key, jiffies_to_usecs(jiffies) - jiffies_to_usecs(start));
hns_roce_bitmap_free(&hr_dev->mr_table.mtpt_bitmap, hns_roce_bitmap_free(&hr_dev->mr_table.mtpt_bitmap,
key_to_hw_index(mr->key), 0); key_to_hw_index(mr->key));
hns_roce_mtr_destroy(hr_dev, &mr->pbl_mtr); hns_roce_mtr_destroy(hr_dev, &mr->pbl_mtr);
kfree(mr); kfree(mr);
......
...@@ -91,7 +91,7 @@ static int alloc_mr_key(struct hns_roce_dev *hr_dev, struct hns_roce_mr *mr) ...@@ -91,7 +91,7 @@ static int alloc_mr_key(struct hns_roce_dev *hr_dev, struct hns_roce_mr *mr)
return 0; return 0;
err_free_bitmap: err_free_bitmap:
hns_roce_bitmap_free(&hr_dev->mr_table.mtpt_bitmap, obj, BITMAP_NO_RR); hns_roce_bitmap_free(&hr_dev->mr_table.mtpt_bitmap, obj);
return err; return err;
} }
...@@ -100,7 +100,7 @@ static void free_mr_key(struct hns_roce_dev *hr_dev, struct hns_roce_mr *mr) ...@@ -100,7 +100,7 @@ static void free_mr_key(struct hns_roce_dev *hr_dev, struct hns_roce_mr *mr)
unsigned long obj = key_to_hw_index(mr->key); unsigned long obj = key_to_hw_index(mr->key);
hns_roce_table_put(hr_dev, &hr_dev->mr_table.mtpt_table, obj); hns_roce_table_put(hr_dev, &hr_dev->mr_table.mtpt_table, obj);
hns_roce_bitmap_free(&hr_dev->mr_table.mtpt_bitmap, obj, BITMAP_NO_RR); hns_roce_bitmap_free(&hr_dev->mr_table.mtpt_bitmap, obj);
} }
static int alloc_mr_pbl(struct hns_roce_dev *hr_dev, struct hns_roce_mr *mr, static int alloc_mr_pbl(struct hns_roce_dev *hr_dev, struct hns_roce_mr *mr,
...@@ -504,7 +504,7 @@ static void hns_roce_mw_free(struct hns_roce_dev *hr_dev, ...@@ -504,7 +504,7 @@ static void hns_roce_mw_free(struct hns_roce_dev *hr_dev,
} }
hns_roce_bitmap_free(&hr_dev->mr_table.mtpt_bitmap, hns_roce_bitmap_free(&hr_dev->mr_table.mtpt_bitmap,
key_to_hw_index(mw->rkey), BITMAP_NO_RR); key_to_hw_index(mw->rkey));
} }
static int hns_roce_mw_enable(struct hns_roce_dev *hr_dev, static int hns_roce_mw_enable(struct hns_roce_dev *hr_dev,
......
...@@ -41,7 +41,7 @@ static int hns_roce_pd_alloc(struct hns_roce_dev *hr_dev, unsigned long *pdn) ...@@ -41,7 +41,7 @@ static int hns_roce_pd_alloc(struct hns_roce_dev *hr_dev, unsigned long *pdn)
static void hns_roce_pd_free(struct hns_roce_dev *hr_dev, unsigned long pdn) static void hns_roce_pd_free(struct hns_roce_dev *hr_dev, unsigned long pdn)
{ {
hns_roce_bitmap_free(&hr_dev->pd_bitmap, pdn, BITMAP_NO_RR); hns_roce_bitmap_free(&hr_dev->pd_bitmap, pdn);
} }
int hns_roce_init_pd_table(struct hns_roce_dev *hr_dev) int hns_roce_init_pd_table(struct hns_roce_dev *hr_dev)
...@@ -121,8 +121,7 @@ int hns_roce_uar_alloc(struct hns_roce_dev *hr_dev, struct hns_roce_uar *uar) ...@@ -121,8 +121,7 @@ int hns_roce_uar_alloc(struct hns_roce_dev *hr_dev, struct hns_roce_uar *uar)
void hns_roce_uar_free(struct hns_roce_dev *hr_dev, struct hns_roce_uar *uar) void hns_roce_uar_free(struct hns_roce_dev *hr_dev, struct hns_roce_uar *uar)
{ {
hns_roce_bitmap_free(&hr_dev->uar_table.bitmap, uar->logic_idx, hns_roce_bitmap_free(&hr_dev->uar_table.bitmap, uar->logic_idx);
BITMAP_NO_RR);
} }
int hns_roce_init_uar_table(struct hns_roce_dev *hr_dev) int hns_roce_init_uar_table(struct hns_roce_dev *hr_dev)
...@@ -155,7 +154,7 @@ static int hns_roce_xrcd_alloc(struct hns_roce_dev *hr_dev, u32 *xrcdn) ...@@ -155,7 +154,7 @@ static int hns_roce_xrcd_alloc(struct hns_roce_dev *hr_dev, u32 *xrcdn)
static void hns_roce_xrcd_free(struct hns_roce_dev *hr_dev, static void hns_roce_xrcd_free(struct hns_roce_dev *hr_dev,
u32 xrcdn) u32 xrcdn)
{ {
hns_roce_bitmap_free(&hr_dev->xrcd_bitmap, xrcdn, BITMAP_NO_RR); hns_roce_bitmap_free(&hr_dev->xrcd_bitmap, xrcdn);
} }
int hns_roce_init_xrcd_table(struct hns_roce_dev *hr_dev) int hns_roce_init_xrcd_table(struct hns_roce_dev *hr_dev)
......
...@@ -132,7 +132,7 @@ static int alloc_srqc(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq) ...@@ -132,7 +132,7 @@ static int alloc_srqc(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq)
err_put: err_put:
hns_roce_table_put(hr_dev, &srq_table->table, srq->srqn); hns_roce_table_put(hr_dev, &srq_table->table, srq->srqn);
err_out: err_out:
hns_roce_bitmap_free(&srq_table->bitmap, srq->srqn, BITMAP_NO_RR); hns_roce_bitmap_free(&srq_table->bitmap, srq->srqn);
return ret; return ret;
} }
...@@ -154,7 +154,7 @@ static void free_srqc(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq) ...@@ -154,7 +154,7 @@ static void free_srqc(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq)
wait_for_completion(&srq->free); wait_for_completion(&srq->free);
hns_roce_table_put(hr_dev, &srq_table->table, srq->srqn); hns_roce_table_put(hr_dev, &srq_table->table, srq->srqn);
hns_roce_bitmap_free(&srq_table->bitmap, srq->srqn, BITMAP_NO_RR); hns_roce_bitmap_free(&srq_table->bitmap, srq->srqn);
} }
static int alloc_srq_idx(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq, static int alloc_srq_idx(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment