OSDN Git Service

RDMA/hns: Delete unused hns bitmap interface
authorYangyang Li <liyangyang20@huawei.com>
Thu, 19 Aug 2021 01:36:20 +0000 (09:36 +0800)
committerJason Gunthorpe <jgg@nvidia.com>
Tue, 24 Aug 2021 12:15:17 +0000 (09:15 -0300)
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/1629336980-17499-4-git-send-email-liangwenpeng@huawei.com
Signed-off-by: Yangyang Li <liyangyang20@huawei.com>
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/hns/hns_roce_alloc.c
drivers/infiniband/hw/hns/hns_roce_device.h

index 1dc35dd..d4fa0fd 100644 (file)
 #include "hns_roce_device.h"
 #include <rdma/ib_umem.h>
 
-int hns_roce_bitmap_alloc(struct hns_roce_bitmap *bitmap, unsigned long *obj)
-{
-       int ret = 0;
-
-       spin_lock(&bitmap->lock);
-       *obj = find_next_zero_bit(bitmap->table, bitmap->max, bitmap->last);
-       if (*obj >= bitmap->max) {
-               bitmap->top = (bitmap->top + bitmap->max + bitmap->reserved_top)
-                              & bitmap->mask;
-               *obj = find_first_zero_bit(bitmap->table, bitmap->max);
-       }
-
-       if (*obj < bitmap->max) {
-               set_bit(*obj, bitmap->table);
-               bitmap->last = (*obj + 1);
-               if (bitmap->last == bitmap->max)
-                       bitmap->last = 0;
-               *obj |= bitmap->top;
-       } else {
-               ret = -EINVAL;
-       }
-
-       spin_unlock(&bitmap->lock);
-
-       return ret;
-}
-
-void hns_roce_bitmap_free(struct hns_roce_bitmap *bitmap, unsigned long obj)
-{
-       obj &= bitmap->max + bitmap->reserved_top - 1;
-
-       spin_lock(&bitmap->lock);
-       clear_bit(obj, bitmap->table);
-
-       bitmap->last = min(bitmap->last, obj);
-       bitmap->top = (bitmap->top + bitmap->max + bitmap->reserved_top)
-                      & bitmap->mask;
-       spin_unlock(&bitmap->lock);
-}
-
-int hns_roce_bitmap_init(struct hns_roce_bitmap *bitmap, u32 num, u32 mask,
-                        u32 reserved_bot, u32 reserved_top)
-{
-       u32 i;
-
-       if (num != roundup_pow_of_two(num))
-               return -EINVAL;
-
-       bitmap->last = 0;
-       bitmap->top = 0;
-       bitmap->max = num - reserved_top;
-       bitmap->mask = mask;
-       bitmap->reserved_top = reserved_top;
-       spin_lock_init(&bitmap->lock);
-       bitmap->table = kcalloc(BITS_TO_LONGS(bitmap->max), sizeof(long),
-                               GFP_KERNEL);
-       if (!bitmap->table)
-               return -ENOMEM;
-
-       for (i = 0; i < reserved_bot; ++i)
-               set_bit(i, bitmap->table);
-
-       return 0;
-}
-
-void hns_roce_bitmap_cleanup(struct hns_roce_bitmap *bitmap)
-{
-       kfree(bitmap->table);
-}
-
 void hns_roce_buf_free(struct hns_roce_dev *hr_dev, struct hns_roce_buf *buf)
 {
        struct hns_roce_buf_list *trunks;
index 4b6c3c0..2129da3 100644 (file)
@@ -1152,11 +1152,6 @@ void hns_roce_cleanup_eq_table(struct hns_roce_dev *hr_dev);
 void hns_roce_cleanup_cq_table(struct hns_roce_dev *hr_dev);
 void hns_roce_cleanup_qp_table(struct hns_roce_dev *hr_dev);
 
-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);
-int hns_roce_bitmap_init(struct hns_roce_bitmap *bitmap, u32 num, u32 mask,
-                        u32 reserved_bot, u32 resetrved_top);
-void hns_roce_bitmap_cleanup(struct hns_roce_bitmap *bitmap);
 void hns_roce_cleanup_bitmap(struct hns_roce_dev *hr_dev);
 
 int hns_roce_create_ah(struct ib_ah *ah, struct rdma_ah_init_attr *init_attr,