Lines Matching refs:ctbl

37 static unsigned int clip_addr_hash(struct clip_tbl *ctbl, const u32 *addr,  in clip_addr_hash()  argument
40 return v6 ? ipv6_clip_hash(ctbl, addr) : in clip_addr_hash()
41 ipv4_clip_hash(ctbl, addr); in clip_addr_hash()
77 struct clip_tbl *ctbl = adap->clipt; in cxgb4_clip_get() local
83 if (!ctbl) in cxgb4_clip_get()
86 hash = clip_addr_hash(ctbl, addr, v6); in cxgb4_clip_get()
88 read_lock_bh(&ctbl->lock); in cxgb4_clip_get()
89 list_for_each_entry(cte, &ctbl->hash_list[hash], list) { in cxgb4_clip_get()
98 read_unlock_bh(&ctbl->lock); in cxgb4_clip_get()
103 read_unlock_bh(&ctbl->lock); in cxgb4_clip_get()
105 write_lock_bh(&ctbl->lock); in cxgb4_clip_get()
106 if (!list_empty(&ctbl->ce_free_head)) { in cxgb4_clip_get()
107 ce = list_first_entry(&ctbl->ce_free_head, in cxgb4_clip_get()
113 atomic_dec(&ctbl->nfree); in cxgb4_clip_get()
114 list_add_tail(&ce->list, &ctbl->hash_list[hash]); in cxgb4_clip_get()
121 write_unlock_bh(&ctbl->lock); in cxgb4_clip_get()
135 write_unlock_bh(&ctbl->lock); in cxgb4_clip_get()
141 write_unlock_bh(&ctbl->lock); in cxgb4_clip_get()
150 struct clip_tbl *ctbl = adap->clipt; in cxgb4_clip_release() local
156 if (!ctbl) in cxgb4_clip_release()
159 hash = clip_addr_hash(ctbl, addr, v6); in cxgb4_clip_release()
161 read_lock_bh(&ctbl->lock); in cxgb4_clip_release()
162 list_for_each_entry(cte, &ctbl->hash_list[hash], list) { in cxgb4_clip_release()
171 read_unlock_bh(&ctbl->lock); in cxgb4_clip_release()
175 read_unlock_bh(&ctbl->lock); in cxgb4_clip_release()
179 write_lock_bh(&ctbl->lock); in cxgb4_clip_release()
184 list_add_tail(&ce->list, &ctbl->ce_free_head); in cxgb4_clip_release()
185 atomic_inc(&ctbl->nfree); in cxgb4_clip_release()
190 write_unlock_bh(&ctbl->lock); in cxgb4_clip_release()
255 struct clip_tbl *ctbl = adapter->clipt; in clip_tbl_show() local
260 read_lock_bh(&ctbl->lock); in clip_tbl_show()
263 for (i = 0 ; i < ctbl->clipt_size; ++i) { in clip_tbl_show()
264 list_for_each_entry(ce, &ctbl->hash_list[i], list) { in clip_tbl_show()
271 seq_printf(seq, "Free clip entries : %d\n", atomic_read(&ctbl->nfree)); in clip_tbl_show()
273 read_unlock_bh(&ctbl->lock); in clip_tbl_show()
282 struct clip_tbl *ctbl; in t4_init_clip_tbl() local
292 ctbl = kvzalloc(sizeof(*ctbl) + in t4_init_clip_tbl()
294 if (!ctbl) in t4_init_clip_tbl()
297 ctbl->clipt_start = clipt_start; in t4_init_clip_tbl()
298 ctbl->clipt_size = clipt_size; in t4_init_clip_tbl()
299 INIT_LIST_HEAD(&ctbl->ce_free_head); in t4_init_clip_tbl()
301 atomic_set(&ctbl->nfree, clipt_size); in t4_init_clip_tbl()
302 rwlock_init(&ctbl->lock); in t4_init_clip_tbl()
304 for (i = 0; i < ctbl->clipt_size; ++i) in t4_init_clip_tbl()
305 INIT_LIST_HEAD(&ctbl->hash_list[i]); in t4_init_clip_tbl()
309 kvfree(ctbl); in t4_init_clip_tbl()
312 ctbl->cl_list = (void *)cl_list; in t4_init_clip_tbl()
316 list_add_tail(&cl_list[i].list, &ctbl->ce_free_head); in t4_init_clip_tbl()
319 return ctbl; in t4_init_clip_tbl()
324 struct clip_tbl *ctbl = adap->clipt; in t4_cleanup_clip_tbl() local
326 if (ctbl) { in t4_cleanup_clip_tbl()
327 if (ctbl->cl_list) in t4_cleanup_clip_tbl()
328 kvfree(ctbl->cl_list); in t4_cleanup_clip_tbl()
329 kvfree(ctbl); in t4_cleanup_clip_tbl()