Lines Matching refs:pool

29 qdf_flex_mem_seg_alloc(struct qdf_flex_mem_pool *pool)  in qdf_flex_mem_seg_alloc()  argument
33 pool->item_size * QDF_FM_BITMAP_BITS; in qdf_flex_mem_seg_alloc()
35 seg = qdf_talloc(pool, total_size); in qdf_flex_mem_seg_alloc()
42 qdf_list_insert_back(&pool->seg_list, &seg->node); in qdf_flex_mem_seg_alloc()
47 void qdf_flex_mem_init(struct qdf_flex_mem_pool *pool) in qdf_flex_mem_init() argument
51 qdf_spinlock_create(&pool->lock); in qdf_flex_mem_init()
53 for (i = 0; i < pool->reduction_limit; i++) in qdf_flex_mem_init()
54 qdf_flex_mem_seg_alloc(pool); in qdf_flex_mem_init()
58 void qdf_flex_mem_deinit(struct qdf_flex_mem_pool *pool) in qdf_flex_mem_deinit() argument
62 qdf_spinlock_destroy(&pool->lock); in qdf_flex_mem_deinit()
64 qdf_list_for_each_del(&pool->seg_list, seg, next, node) { in qdf_flex_mem_deinit()
69 qdf_list_remove_node(&pool->seg_list, &seg->node); in qdf_flex_mem_deinit()
76 static void *__qdf_flex_mem_alloc(struct qdf_flex_mem_pool *pool) in __qdf_flex_mem_alloc() argument
80 qdf_list_for_each(&pool->seg_list, seg, node) { in __qdf_flex_mem_alloc()
91 ptr = &seg->bytes[index * pool->item_size]; in __qdf_flex_mem_alloc()
92 qdf_mem_zero(ptr, pool->item_size); in __qdf_flex_mem_alloc()
97 seg = qdf_flex_mem_seg_alloc(pool); in __qdf_flex_mem_alloc()
106 void *qdf_flex_mem_alloc(struct qdf_flex_mem_pool *pool) in qdf_flex_mem_alloc() argument
110 QDF_BUG(pool); in qdf_flex_mem_alloc()
111 if (!pool) in qdf_flex_mem_alloc()
114 qdf_spin_lock_bh(&pool->lock); in qdf_flex_mem_alloc()
115 ptr = __qdf_flex_mem_alloc(pool); in qdf_flex_mem_alloc()
116 qdf_spin_unlock_bh(&pool->lock); in qdf_flex_mem_alloc()
122 static void qdf_flex_mem_seg_free(struct qdf_flex_mem_pool *pool, in qdf_flex_mem_seg_free() argument
128 if (qdf_list_size(&pool->seg_list) <= pool->reduction_limit) in qdf_flex_mem_seg_free()
131 qdf_list_remove_node(&pool->seg_list, &seg->node); in qdf_flex_mem_seg_free()
135 static void __qdf_flex_mem_free(struct qdf_flex_mem_pool *pool, void *ptr) in __qdf_flex_mem_free() argument
142 qdf_list_for_each(&pool->seg_list, seg, node) { in __qdf_flex_mem_free()
144 high_addr = low_addr + pool->item_size * QDF_FM_BITMAP_BITS; in __qdf_flex_mem_free()
149 index = (ptr - low_addr) / pool->item_size; in __qdf_flex_mem_free()
154 qdf_flex_mem_seg_free(pool, seg); in __qdf_flex_mem_free()
162 void qdf_flex_mem_free(struct qdf_flex_mem_pool *pool, void *ptr) in qdf_flex_mem_free() argument
164 QDF_BUG(pool); in qdf_flex_mem_free()
165 if (!pool) in qdf_flex_mem_free()
172 qdf_spin_lock_bh(&pool->lock); in qdf_flex_mem_free()
173 __qdf_flex_mem_free(pool, ptr); in qdf_flex_mem_free()
174 qdf_spin_unlock_bh(&pool->lock); in qdf_flex_mem_free()