RDMA/hns: Use ida to manage index of some resources
Subsystems (2)
cover RDMA/hns: Use ida to manage index of some resources
Index of some resources is managed by bitmap in driver, we first do some cleanups on the bitmap functions, than replace them with ida interfaces.
Yangyang Li (6):
RDMA/hns: Remove the unused hns_roce_bitmap_alloc_range function RDMA/hns: Remove the unused hns_roce_bitmap_free_range function RDMA/hns: Remove unused RR mechanism
RDMA/hns: Use IDA interface to manage mtpt index RDMA/hns: Use IDA interface to manage pd index RDMA/hns: Use IDA interface to manage xrcd index
drivers/infiniband/hw/hns/hns_roce_alloc.c | 63 ++----------------- drivers/infiniband/hw/hns/hns_roce_device.h | 32 ++++------ drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 3 +- drivers/infiniband/hw/hns/hns_roce_main.c | 32 +++------- drivers/infiniband/hw/hns/hns_roce_mr.c | 66 ++++++++++---------- drivers/infiniband/hw/hns/hns_roce_pd.c | 94 ++++++++++++----------------- drivers/infiniband/hw/hns/hns_roce_srq.c | 4 +- 7 files changed, 100 insertions(+), 194 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/6 RDMA/hns: Remove the unused hns_roce_bitmap_alloc_range function
From: Yangyang Li <[email protected]>
The function is no longer used.
--- drivers/infiniband/hw/hns/hns_roce_alloc.c | 39 ----------------------------- drivers/infiniband/hw/hns/hns_roce_device.h | 2 -- 2 files changed, 41 deletions(-)
drivers/infiniband/hw/hns/hns_roce_alloc.c +0 -39
@@ -69,45 +69,6 @@ void hns_roce_bitmap_free(struct hns_roce_bitmap *bitmap, unsigned long obj,hns_roce_bitmap_free_range (bitmap, obj,1 , rr); } -int hns_roce_bitmap_alloc_range (struct hns_roce_bitmap *bitmap,int cnt, -int align,unsigned long *obj) -{ -int ret =0 ; -int i; - -if (likely (cnt ==1 && align ==1 )) -return hns_roce_bitmap_alloc (bitmap, obj); - -spin_lock (&bitmap->lock); - - *obj =bitmap_find_next_zero_area (bitmap->table, bitmap->max, - bitmap->last, cnt, align -1 ); -if (*obj >= bitmap->max) { - bitmap->top = (bitmap->top + bitmap->max + bitmap->reserved_top) - & bitmap->mask; - *obj =bitmap_find_next_zero_area (bitmap->table, bitmap->max,0 , - cnt, align -1 ); - } - -if (*obj < bitmap->max) { -for (i =0 ; i < cnt; i++) -set_bit (*obj + i, bitmap->table); - -if (*obj == bitmap->last) { - bitmap->last = (*obj + cnt); -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_range (struct hns_roce_bitmap *bitmap,unsigned long obj,int cnt,int rr)
drivers/infiniband/hw/hns/hns_roce_device.h +0 -2
@@ -1163,8 +1163,6 @@ 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_bitmap_alloc_range (struct hns_roce_bitmap *bitmap,int cnt, -int align,unsigned long *obj);void hns_roce_bitmap_free_range (struct hns_roce_bitmap *bitmap,unsigned long obj,int cnt,int rr);
Signature · 1 line
2.7.4
PATCH 2/6 RDMA/hns: Remove the unused hns_roce_bitmap_free_range function
In reply to Weihang LiFrom: Yangyang Li <[email protected]>
hns_roce_bitmap_free_range() is only called inside hns_roce_bitmap_free(), and the input parameter "cnt" is set to a constant 1. In addition, the driver does not use alloc_range scenarios, so free_range does not need to exist.
--- drivers/infiniband/hw/hns/hns_roce_alloc.c | 12 +----------- drivers/infiniband/hw/hns/hns_roce_device.h | 3 --- 2 files changed, 1 insertion(+), 14 deletions(-)
drivers/infiniband/hw/hns/hns_roce_alloc.c +1 -11
@@ -66,20 +66,10 @@ 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 rr) { -hns_roce_bitmap_free_range (bitmap, obj,1 , rr); -} - -void hns_roce_bitmap_free_range (struct hns_roce_bitmap *bitmap, -unsigned long obj,int cnt, -int rr) -{ -int i; - obj &= bitmap->max + bitmap->reserved_top -1 ;spin_lock (&bitmap->lock); -for (i =0 ; i < cnt; i++) -clear_bit (obj + i, bitmap->table); +clear_bit (obj, bitmap->table);if (!rr) bitmap->last =min (bitmap->last, obj);
drivers/infiniband/hw/hns/hns_roce_device.h +0 -3
@@ -1163,9 +1163,6 @@ 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); -void hns_roce_bitmap_free_range (struct hns_roce_bitmap *bitmap, -unsigned long obj,int cnt, -int rr);int hns_roce_create_ah (struct ib_ah *ah,struct rdma_ah_init_attr *init_attr,struct ib_udata *udata);
Signature · 1 line
2.7.4
PATCH 3/6 RDMA/hns: Remove unused RR mechanism
In reply to Weihang LiFrom: Yangyang Li <[email protected]>
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.
--- drivers/infiniband/hw/hns/hns_roce_alloc.c | 6 ++---- drivers/infiniband/hw/hns/hns_roce_device.h | 6 +----- drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 2 +- drivers/infiniband/hw/hns/hns_roce_mr.c | 6 +++--- drivers/infiniband/hw/hns/hns_roce_pd.c | 7 +++---- drivers/infiniband/hw/hns/hns_roce_srq.c | 4 ++-- 6 files changed, 12 insertions(+), 19 deletions(-)
drivers/infiniband/hw/hns/hns_roce_alloc.c +2 -4
@@ -63,16 +63,14 @@ int hns_roce_bitmap_alloc(struct hns_roce_bitmap *bitmap, unsigned long *obj)return ret; } -void hns_roce_bitmap_free (struct hns_roce_bitmap *bitmap,unsigned long obj, -int rr) +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); -if (!rr) - bitmap->last =min (bitmap->last, obj); + bitmap->last =min (bitmap->last, obj); bitmap->top = (bitmap->top + bitmap->max + bitmap->reserved_top) & bitmap->mask;spin_unlock (&bitmap->lock);
drivers/infiniband/hw/hns/hns_roce_device.h +1 -5
@@ -95,9 +95,6 @@#define HNS_ROCE_HOP_NUM_0 0xff -#define BITMAP_NO_RR 0 -#define BITMAP_RR 1 -#define MR_TYPE_MR 0x00#define MR_TYPE_FRMR 0x01#define MR_TYPE_DMA 0x03
@@ -1157,8 +1154,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);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 rr); +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);
drivers/infiniband/hw/hns/hns_roce_hw_v1.c +1 -1
@@ -1200,7 +1200,7 @@ static int hns_roce_v1_dereg_mr(struct hns_roce_dev *hr_dev, mr->key, jiffies_to_usecs(jiffies) - jiffies_to_usecs(start));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);kfree (mr);
drivers/infiniband/hw/hns/hns_roce_mr.c +3 -3
@@ -91,7 +91,7 @@ static int alloc_mr_key(struct hns_roce_dev *hr_dev, struct hns_roce_mr *mr)return 0 ; 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; }
@@ -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);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,
@@ -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, -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,
drivers/infiniband/hw/hns/hns_roce_pd.c +3 -4
@@ -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) { -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)
@@ -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) { -hns_roce_bitmap_free (&hr_dev->uar_table.bitmap, uar->logic_idx, -BITMAP_NO_RR ); +hns_roce_bitmap_free (&hr_dev->uar_table.bitmap, uar->logic_idx); }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)static void hns_roce_xrcd_free (struct hns_roce_dev *hr_dev,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)
drivers/infiniband/hw/hns/hns_roce_srq.c +2 -2
@@ -132,7 +132,7 @@ static int alloc_srqc(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq) err_put:hns_roce_table_put (hr_dev, &srq_table->table, srq->srqn); 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; }
@@ -154,7 +154,7 @@ static void free_srqc(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq)wait_for_completion (&srq->free);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,
Signature · 1 line
2.7.4
PATCH 4/6 RDMA/hns: Use IDA interface to manage mtpt index
In reply to Weihang LiFrom: Yangyang Li <[email protected]>
Switch mtpt index allocation and release from hns own bitmap interface to IDA interface.
--- drivers/infiniband/hw/hns/hns_roce_alloc.c | 2 +- drivers/infiniband/hw/hns/hns_roce_device.h | 11 +++-- drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 3 +- drivers/infiniband/hw/hns/hns_roce_main.c | 9 +--- drivers/infiniband/hw/hns/hns_roce_mr.c | 66 ++++++++++++++--------------- 5 files changed, 43 insertions(+), 48 deletions(-)
drivers/infiniband/hw/hns/hns_roce_alloc.c +1 -1
@@ -251,7 +251,7 @@ void hns_roce_cleanup_bitmap(struct hns_roce_dev *hr_dev)hns_roce_cleanup_srq_table (hr_dev);hns_roce_cleanup_qp_table (hr_dev);hns_roce_cleanup_cq_table (hr_dev); -hns_roce_cleanup_mr_table (hr_dev); +ida_destroy (&hr_dev->mr_table.mtpt_ida.ida);hns_roce_cleanup_pd_table (hr_dev);hns_roce_cleanup_uar_table (hr_dev); }
drivers/infiniband/hw/hns/hns_roce_device.h +8 -3
@@ -253,6 +253,12 @@ struct hns_roce_bitmap {unsigned long *table; }; +struct hns_roce_ida { +struct ida ida; +u32 min;/* Lowest ID to allocate. */ +u32 max;/* Highest ID to allocate. */ +}; +/* For Hardware Entry Memory */ struct hns_roce_hem_table {/* HEM type: 0 = qpc, 1 = mtt, 2 = cqc, 3 = srq, 4 = other */
@@ -347,7 +353,7 @@ struct hns_roce_mr { };struct hns_roce_mr_table { -struct hns_roce_bitmap mtpt_bitmap; +struct hns_roce_ida mtpt_ida;struct hns_roce_hem_table mtpt_table; };
@@ -1139,14 +1145,13 @@ int hns_roce_mtr_map(struct hns_roce_dev *hr_dev, struct hns_roce_mtr *mtr, dma_addr_t *pages, unsigned int page_cnt);int hns_roce_init_pd_table (struct hns_roce_dev *hr_dev); -int hns_roce_init_mr_table (struct hns_roce_dev *hr_dev); +void hns_roce_init_mr_table (struct hns_roce_dev *hr_dev);void hns_roce_init_cq_table (struct hns_roce_dev *hr_dev);int hns_roce_init_qp_table (struct hns_roce_dev *hr_dev);int hns_roce_init_srq_table (struct hns_roce_dev *hr_dev);int hns_roce_init_xrcd_table (struct hns_roce_dev *hr_dev);void hns_roce_cleanup_pd_table (struct hns_roce_dev *hr_dev); -void hns_roce_cleanup_mr_table (struct hns_roce_dev *hr_dev);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);
drivers/infiniband/hw/hns/hns_roce_hw_v1.c +1 -2
@@ -1199,8 +1199,7 @@ static int hns_roce_v1_dereg_mr(struct hns_roce_dev *hr_dev,dev_dbg (dev,"Free mr 0x%x use 0x%x us.\n" , mr->key,jiffies_to_usecs (jiffies) -jiffies_to_usecs (start)); -hns_roce_bitmap_free (&hr_dev->mr_table.mtpt_bitmap, -key_to_hw_index (mr->key)); +ida_free (&hr_dev->mr_table.mtpt_ida.ida, (int )key_to_hw_index (mr->key));hns_roce_mtr_destroy (hr_dev, &mr->pbl_mtr);kfree (mr);
drivers/infiniband/hw/hns/hns_roce_main.c +2 -7
@@ -763,11 +763,7 @@ static int hns_roce_setup_hca(struct hns_roce_dev *hr_dev) } } - ret =hns_roce_init_mr_table (hr_dev); -if (ret) { -dev_err (dev,"Failed to init memory region table.\n" ); - goto err_xrcd_table_free; - } +hns_roce_init_mr_table (hr_dev);hns_roce_init_cq_table (hr_dev);
@@ -793,9 +789,8 @@ static int hns_roce_setup_hca(struct hns_roce_dev *hr_dev) err_cq_table_free:hns_roce_cleanup_cq_table (hr_dev); -hns_roce_cleanup_mr_table (hr_dev); +ida_destroy (&hr_dev->mr_table.mtpt_ida.ida); -err_xrcd_table_free:if (hr_dev->caps.flags &HNS_ROCE_CAP_FLAG_XRC )hns_roce_cleanup_xrcd_table (hr_dev);
drivers/infiniband/hw/hns/hns_roce_mr.c +31 -35
123 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 5/6 RDMA/hns: Use IDA interface to manage pd index
In reply to Weihang LiFrom: Yangyang Li <[email protected]>
Switch pd index allocation and release from hns own bitmap interface to IDA interface.
--- drivers/infiniband/hw/hns/hns_roce_alloc.c | 2 +- drivers/infiniband/hw/hns/hns_roce_device.h | 5 ++-- drivers/infiniband/hw/hns/hns_roce_main.c | 10 ++----- drivers/infiniband/hw/hns/hns_roce_pd.c | 45 +++++++++++++---------------- 4 files changed, 25 insertions(+), 37 deletions(-)
drivers/infiniband/hw/hns/hns_roce_alloc.c +1 -1
@@ -252,6 +252,6 @@ void hns_roce_cleanup_bitmap(struct hns_roce_dev *hr_dev)hns_roce_cleanup_qp_table (hr_dev);hns_roce_cleanup_cq_table (hr_dev);ida_destroy (&hr_dev->mr_table.mtpt_ida.ida); -hns_roce_cleanup_pd_table (hr_dev); +ida_destroy (&hr_dev->pd_ida.ida);hns_roce_cleanup_uar_table (hr_dev); }
drivers/infiniband/hw/hns/hns_roce_device.h +2 -3
@@ -962,7 +962,7 @@ struct hns_roce_dev {void __iomem *priv_addr;struct hns_roce_cmdq cmd; -struct hns_roce_bitmap pd_bitmap; +struct hns_roce_ida pd_ida;struct hns_roce_bitmap xrcd_bitmap;struct hns_roce_uar_table uar_table;struct hns_roce_mr_table mr_table;
@@ -1144,14 +1144,13 @@ void hns_roce_mtr_destroy(struct hns_roce_dev *hr_dev,int hns_roce_mtr_map (struct hns_roce_dev *hr_dev,struct hns_roce_mtr *mtr,dma_addr_t *pages,unsigned int page_cnt); -int hns_roce_init_pd_table (struct hns_roce_dev *hr_dev); +void hns_roce_init_pd_table (struct hns_roce_dev *hr_dev);void hns_roce_init_mr_table (struct hns_roce_dev *hr_dev);void hns_roce_init_cq_table (struct hns_roce_dev *hr_dev);int hns_roce_init_qp_table (struct hns_roce_dev *hr_dev);int hns_roce_init_srq_table (struct hns_roce_dev *hr_dev);int hns_roce_init_xrcd_table (struct hns_roce_dev *hr_dev); -void hns_roce_cleanup_pd_table (struct hns_roce_dev *hr_dev);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);
drivers/infiniband/hw/hns/hns_roce_main.c +2 -8
@@ -748,11 +748,7 @@ static int hns_roce_setup_hca(struct hns_roce_dev *hr_dev) goto err_uar_table_free; } - ret =hns_roce_init_pd_table (hr_dev); -if (ret) { -dev_err (dev,"Failed to init protected domain table.\n" ); - goto err_uar_alloc_free; - } +hns_roce_init_pd_table (hr_dev);if (hr_dev->caps.flags &HNS_ROCE_CAP_FLAG_XRC ) { ret =hns_roce_init_xrcd_table (hr_dev);
@@ -795,9 +791,7 @@ static int hns_roce_setup_hca(struct hns_roce_dev *hr_dev)hns_roce_cleanup_xrcd_table (hr_dev); err_pd_table_free: -hns_roce_cleanup_pd_table (hr_dev); - -err_uar_alloc_free: +ida_destroy (&hr_dev->pd_ida.ida);hns_roce_uar_free (hr_dev, &hr_dev->priv_uar); err_uar_table_free:
drivers/infiniband/hw/hns/hns_roce_pd.c +20 -25
73 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 6/6 RDMA/hns: Use IDA interface to manage xrcd index
In reply to Weihang LiFrom: Yangyang Li <[email protected]>
Switch xrcd index allocation and release from hns own bitmap interface to IDA interface.
--- drivers/infiniband/hw/hns/hns_roce_alloc.c | 2 +- drivers/infiniband/hw/hns/hns_roce_device.h | 5 ++-- drivers/infiniband/hw/hns/hns_roce_main.c | 13 ++------ drivers/infiniband/hw/hns/hns_roce_pd.c | 46 ++++++++++++----------------- 4 files changed, 25 insertions(+), 41 deletions(-)
drivers/infiniband/hw/hns/hns_roce_alloc.c +1 -1
@@ -245,7 +245,7 @@ int hns_roce_get_umem_bufs(struct hns_roce_dev *hr_dev, dma_addr_t *bufs,void hns_roce_cleanup_bitmap (struct hns_roce_dev *hr_dev) {if (hr_dev->caps.flags &HNS_ROCE_CAP_FLAG_XRC ) -hns_roce_cleanup_xrcd_table (hr_dev); +ida_destroy (&hr_dev->xrcd_ida.ida);if (hr_dev->caps.flags &HNS_ROCE_CAP_FLAG_SRQ )hns_roce_cleanup_srq_table (hr_dev);
drivers/infiniband/hw/hns/hns_roce_device.h +2 -3
@@ -963,7 +963,7 @@ struct hns_roce_dev {struct hns_roce_cmdq cmd;struct hns_roce_ida pd_ida; -struct hns_roce_bitmap xrcd_bitmap; +struct hns_roce_ida xrcd_ida;struct hns_roce_uar_table uar_table;struct hns_roce_mr_table mr_table;struct hns_roce_cq_table cq_table;
@@ -1149,13 +1149,12 @@ void hns_roce_init_mr_table(struct hns_roce_dev *hr_dev);void hns_roce_init_cq_table (struct hns_roce_dev *hr_dev);int hns_roce_init_qp_table (struct hns_roce_dev *hr_dev);int hns_roce_init_srq_table (struct hns_roce_dev *hr_dev); -int hns_roce_init_xrcd_table (struct hns_roce_dev *hr_dev); +void hns_roce_init_xrcd_table (struct hns_roce_dev *hr_dev);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);void hns_roce_cleanup_srq_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);void hns_roce_bitmap_free (struct hns_roce_bitmap *bitmap,unsigned long obj);
drivers/infiniband/hw/hns/hns_roce_main.c +3 -10
@@ -750,14 +750,8 @@ static int hns_roce_setup_hca(struct hns_roce_dev *hr_dev)hns_roce_init_pd_table (hr_dev); -if (hr_dev->caps.flags &HNS_ROCE_CAP_FLAG_XRC ) { - ret =hns_roce_init_xrcd_table (hr_dev); -if (ret) { -dev_err (dev,"failed to init xrcd table, ret = %d.\n" , - ret); - goto err_pd_table_free; - } - } +if (hr_dev->caps.flags &HNS_ROCE_CAP_FLAG_XRC ) +hns_roce_init_xrcd_table (hr_dev);hns_roce_init_mr_table (hr_dev);
@@ -788,9 +782,8 @@ static int hns_roce_setup_hca(struct hns_roce_dev *hr_dev)ida_destroy (&hr_dev->mr_table.mtpt_ida.ida);if (hr_dev->caps.flags &HNS_ROCE_CAP_FLAG_XRC ) -hns_roce_cleanup_xrcd_table (hr_dev); +ida_destroy (&hr_dev->xrcd_ida.ida); -err_pd_table_free:ida_destroy (&hr_dev->pd_ida.ida);hns_roce_uar_free (hr_dev, &hr_dev->priv_uar);
drivers/infiniband/hw/hns/hns_roce_pd.c +19 -27
72 lines not on this page · raw message
Signature · 1 line
2.7.4
Quoted 10 lines · Weihang Li
Index of some resources is managed by bitmap in driver, we first do some cleanups on the bitmap functions, than replace them with ida interfaces.
Yangyang Li (6):
RDMA/hns: Remove the unusedhns_roce_bitmap_alloc_rangefunction RDMA/hns: Remove the unusedhns_roce_bitmap_free_rangefunction RDMA/hns: Remove unused RR mechanism
RDMA/hns: Use IDA interface to manage mtpt index RDMA/hns: Use IDA interface to manage pd index RDMA/hns: Use IDA interface to manage xrcd index
Applied to for-next, thanks
Jason