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()
112 atomic_dec(&ctbl->nfree); in cxgb4_clip_get()
113 list_add_tail(&ce->list, &ctbl->hash_list[hash]); in cxgb4_clip_get()
120 write_unlock_bh(&ctbl->lock); in cxgb4_clip_get()
134 write_unlock_bh(&ctbl->lock); in cxgb4_clip_get()
140 write_unlock_bh(&ctbl->lock); in cxgb4_clip_get()
149 struct clip_tbl *ctbl = adap->clipt; in cxgb4_clip_release() local
155 if (!ctbl) in cxgb4_clip_release()
158 hash = clip_addr_hash(ctbl, addr, v6); in cxgb4_clip_release()
160 read_lock_bh(&ctbl->lock); in cxgb4_clip_release()
161 list_for_each_entry(cte, &ctbl->hash_list[hash], list) { in cxgb4_clip_release()
170 read_unlock_bh(&ctbl->lock); in cxgb4_clip_release()
174 read_unlock_bh(&ctbl->lock); in cxgb4_clip_release()
178 write_lock_bh(&ctbl->lock); in cxgb4_clip_release()
182 list_add_tail(&ce->list, &ctbl->ce_free_head); in cxgb4_clip_release()
183 atomic_inc(&ctbl->nfree); in cxgb4_clip_release()
188 write_unlock_bh(&ctbl->lock); in cxgb4_clip_release()
253 struct clip_tbl *ctbl = adapter->clipt; in clip_tbl_show() local
258 read_lock_bh(&ctbl->lock); in clip_tbl_show()
261 for (i = 0 ; i < ctbl->clipt_size; ++i) { in clip_tbl_show()
262 list_for_each_entry(ce, &ctbl->hash_list[i], list) { in clip_tbl_show()
269 seq_printf(seq, "Free clip entries : %d\n", atomic_read(&ctbl->nfree)); in clip_tbl_show()
271 read_unlock_bh(&ctbl->lock); in clip_tbl_show()
280 struct clip_tbl *ctbl; in t4_init_clip_tbl() local
290 ctbl = kvzalloc(struct_size(ctbl, hash_list, clipt_size), GFP_KERNEL); in t4_init_clip_tbl()
291 if (!ctbl) in t4_init_clip_tbl()
294 ctbl->clipt_start = clipt_start; in t4_init_clip_tbl()
295 ctbl->clipt_size = clipt_size; in t4_init_clip_tbl()
296 INIT_LIST_HEAD(&ctbl->ce_free_head); in t4_init_clip_tbl()
298 atomic_set(&ctbl->nfree, clipt_size); in t4_init_clip_tbl()
299 rwlock_init(&ctbl->lock); in t4_init_clip_tbl()
301 for (i = 0; i < ctbl->clipt_size; ++i) in t4_init_clip_tbl()
302 INIT_LIST_HEAD(&ctbl->hash_list[i]); in t4_init_clip_tbl()
306 kvfree(ctbl); in t4_init_clip_tbl()
309 ctbl->cl_list = (void *)cl_list; in t4_init_clip_tbl()
313 list_add_tail(&cl_list[i].list, &ctbl->ce_free_head); in t4_init_clip_tbl()
316 return ctbl; in t4_init_clip_tbl()
321 struct clip_tbl *ctbl = adap->clipt; in t4_cleanup_clip_tbl() local
323 if (ctbl) { in t4_cleanup_clip_tbl()
324 kvfree(ctbl->cl_list); in t4_cleanup_clip_tbl()
325 kvfree(ctbl); in t4_cleanup_clip_tbl()