Skip to content

Commit 771addf

Browse files
matanb10dledford
authored andcommitted
IB/core: Refactor idr to be per uverbs_file
The current code creates an idr per type. Since types are currently common for all drivers and known in advance, this was good enough. However, the proposed ioctl based infrastructure allows each driver to declare only some of the common types and declare its own specific types. Thus, we decided to implement idr to be per uverbs_file. Signed-off-by: Matan Barak <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Haggai Eran <[email protected]> Reviewed-by: Sean Hefty <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent 97da385 commit 771addf

File tree

4 files changed

+95
-127
lines changed

4 files changed

+95
-127
lines changed

drivers/infiniband/core/uverbs.h

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ struct ib_uverbs_file {
123123
struct ib_uverbs_event_file *async_file;
124124
struct list_head list;
125125
int is_closed;
126+
127+
struct idr idr;
128+
/* spinlock protects write access to idr */
129+
spinlock_t idr_lock;
126130
};
127131

128132
struct ib_uverbs_event {
@@ -176,20 +180,7 @@ struct ib_ucq_object {
176180
u32 async_events_reported;
177181
};
178182

179-
extern spinlock_t ib_uverbs_idr_lock;
180-
extern struct idr ib_uverbs_pd_idr;
181-
extern struct idr ib_uverbs_mr_idr;
182-
extern struct idr ib_uverbs_mw_idr;
183-
extern struct idr ib_uverbs_ah_idr;
184-
extern struct idr ib_uverbs_cq_idr;
185-
extern struct idr ib_uverbs_qp_idr;
186-
extern struct idr ib_uverbs_srq_idr;
187-
extern struct idr ib_uverbs_xrcd_idr;
188-
extern struct idr ib_uverbs_rule_idr;
189-
extern struct idr ib_uverbs_wq_idr;
190-
extern struct idr ib_uverbs_rwq_ind_tbl_idr;
191-
192-
void idr_remove_uobj(struct idr *idp, struct ib_uobject *uobj);
183+
void idr_remove_uobj(struct ib_uobject *uobj);
193184

194185
struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file,
195186
struct ib_device *ib_dev,

0 commit comments

Comments
 (0)