Lines Matching refs:tbl
56 struct pvrdma_id_table *tbl = &dev->uar_table.tbl; in pvrdma_uar_table_init() local
61 tbl->last = 0; in pvrdma_uar_table_init()
62 tbl->top = 0; in pvrdma_uar_table_init()
63 tbl->max = num; in pvrdma_uar_table_init()
64 tbl->mask = mask; in pvrdma_uar_table_init()
65 spin_lock_init(&tbl->lock); in pvrdma_uar_table_init()
66 tbl->table = bitmap_zalloc(num, GFP_KERNEL); in pvrdma_uar_table_init()
67 if (!tbl->table) in pvrdma_uar_table_init()
71 __set_bit(0, tbl->table); in pvrdma_uar_table_init()
78 struct pvrdma_id_table *tbl = &dev->uar_table.tbl; in pvrdma_uar_table_cleanup() local
80 bitmap_free(tbl->table); in pvrdma_uar_table_cleanup()
85 struct pvrdma_id_table *tbl; in pvrdma_uar_alloc() local
89 tbl = &dev->uar_table.tbl; in pvrdma_uar_alloc()
91 spin_lock_irqsave(&tbl->lock, flags); in pvrdma_uar_alloc()
92 obj = find_next_zero_bit(tbl->table, tbl->max, tbl->last); in pvrdma_uar_alloc()
93 if (obj >= tbl->max) { in pvrdma_uar_alloc()
94 tbl->top = (tbl->top + tbl->max) & tbl->mask; in pvrdma_uar_alloc()
95 obj = find_first_zero_bit(tbl->table, tbl->max); in pvrdma_uar_alloc()
98 if (obj >= tbl->max) { in pvrdma_uar_alloc()
99 spin_unlock_irqrestore(&tbl->lock, flags); in pvrdma_uar_alloc()
103 __set_bit(obj, tbl->table); in pvrdma_uar_alloc()
104 obj |= tbl->top; in pvrdma_uar_alloc()
106 spin_unlock_irqrestore(&tbl->lock, flags); in pvrdma_uar_alloc()
117 struct pvrdma_id_table *tbl = &dev->uar_table.tbl; in pvrdma_uar_free() local
121 obj = uar->index & (tbl->max - 1); in pvrdma_uar_free()
122 spin_lock_irqsave(&tbl->lock, flags); in pvrdma_uar_free()
123 __clear_bit(obj, tbl->table); in pvrdma_uar_free()
124 tbl->last = min(tbl->last, obj); in pvrdma_uar_free()
125 tbl->top = (tbl->top + tbl->max) & tbl->mask; in pvrdma_uar_free()
126 spin_unlock_irqrestore(&tbl->lock, flags); in pvrdma_uar_free()