Skip to content

Commit f0a6419

Browse files
l00436852jgunthorpe
authored andcommitted
RDMA/hns: Delete unused hns bitmap interface
The resources that use the hns bitmap interface: qp, cq, mr, pd, xrcd, uar, srq, have been changed to IDA interfaces, and the unused hns' own bitmap interfaces need to be deleted. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Yangyang Li <[email protected]> Signed-off-by: Wenpeng Liang <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent c4f11b3 commit f0a6419

File tree

2 files changed

+0
-75
lines changed

2 files changed

+0
-75
lines changed

drivers/infiniband/hw/hns/hns_roce_alloc.c

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -36,76 +36,6 @@
3636
#include "hns_roce_device.h"
3737
#include <rdma/ib_umem.h>
3838

39-
int hns_roce_bitmap_alloc(struct hns_roce_bitmap *bitmap, unsigned long *obj)
40-
{
41-
int ret = 0;
42-
43-
spin_lock(&bitmap->lock);
44-
*obj = find_next_zero_bit(bitmap->table, bitmap->max, bitmap->last);
45-
if (*obj >= bitmap->max) {
46-
bitmap->top = (bitmap->top + bitmap->max + bitmap->reserved_top)
47-
& bitmap->mask;
48-
*obj = find_first_zero_bit(bitmap->table, bitmap->max);
49-
}
50-
51-
if (*obj < bitmap->max) {
52-
set_bit(*obj, bitmap->table);
53-
bitmap->last = (*obj + 1);
54-
if (bitmap->last == bitmap->max)
55-
bitmap->last = 0;
56-
*obj |= bitmap->top;
57-
} else {
58-
ret = -EINVAL;
59-
}
60-
61-
spin_unlock(&bitmap->lock);
62-
63-
return ret;
64-
}
65-
66-
void hns_roce_bitmap_free(struct hns_roce_bitmap *bitmap, unsigned long obj)
67-
{
68-
obj &= bitmap->max + bitmap->reserved_top - 1;
69-
70-
spin_lock(&bitmap->lock);
71-
clear_bit(obj, bitmap->table);
72-
73-
bitmap->last = min(bitmap->last, obj);
74-
bitmap->top = (bitmap->top + bitmap->max + bitmap->reserved_top)
75-
& bitmap->mask;
76-
spin_unlock(&bitmap->lock);
77-
}
78-
79-
int hns_roce_bitmap_init(struct hns_roce_bitmap *bitmap, u32 num, u32 mask,
80-
u32 reserved_bot, u32 reserved_top)
81-
{
82-
u32 i;
83-
84-
if (num != roundup_pow_of_two(num))
85-
return -EINVAL;
86-
87-
bitmap->last = 0;
88-
bitmap->top = 0;
89-
bitmap->max = num - reserved_top;
90-
bitmap->mask = mask;
91-
bitmap->reserved_top = reserved_top;
92-
spin_lock_init(&bitmap->lock);
93-
bitmap->table = kcalloc(BITS_TO_LONGS(bitmap->max), sizeof(long),
94-
GFP_KERNEL);
95-
if (!bitmap->table)
96-
return -ENOMEM;
97-
98-
for (i = 0; i < reserved_bot; ++i)
99-
set_bit(i, bitmap->table);
100-
101-
return 0;
102-
}
103-
104-
void hns_roce_bitmap_cleanup(struct hns_roce_bitmap *bitmap)
105-
{
106-
kfree(bitmap->table);
107-
}
108-
10939
void hns_roce_buf_free(struct hns_roce_dev *hr_dev, struct hns_roce_buf *buf)
11040
{
11141
struct hns_roce_buf_list *trunks;

drivers/infiniband/hw/hns/hns_roce_device.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,11 +1152,6 @@ void hns_roce_cleanup_eq_table(struct hns_roce_dev *hr_dev);
11521152
void hns_roce_cleanup_cq_table(struct hns_roce_dev *hr_dev);
11531153
void hns_roce_cleanup_qp_table(struct hns_roce_dev *hr_dev);
11541154

1155-
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 hns_roce_bitmap_init(struct hns_roce_bitmap *bitmap, u32 num, u32 mask,
1158-
u32 reserved_bot, u32 resetrved_top);
1159-
void hns_roce_bitmap_cleanup(struct hns_roce_bitmap *bitmap);
11601155
void hns_roce_cleanup_bitmap(struct hns_roce_dev *hr_dev);
11611156

11621157
int hns_roce_create_ah(struct ib_ah *ah, struct rdma_ah_init_attr *init_attr,

0 commit comments

Comments
 (0)