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()
102 read_unlock_bh(&ctbl->lock); in cxgb4_clip_get()
104 write_lock_bh(&ctbl->lock); in cxgb4_clip_get()
105 if (!list_empty(&ctbl->ce_free_head)) { in cxgb4_clip_get()
106 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()
129 write_unlock_bh(&ctbl->lock); in cxgb4_clip_get()
132 write_unlock_bh(&ctbl->lock); in cxgb4_clip_get()
143 struct clip_tbl *ctbl = adap->clipt; in cxgb4_clip_release() local
149 hash = clip_addr_hash(ctbl, addr, v6); in cxgb4_clip_release()
151 read_lock_bh(&ctbl->lock); in cxgb4_clip_release()
152 list_for_each_entry(cte, &ctbl->hash_list[hash], list) { in cxgb4_clip_release()
161 read_unlock_bh(&ctbl->lock); in cxgb4_clip_release()
165 read_unlock_bh(&ctbl->lock); in cxgb4_clip_release()
169 write_lock_bh(&ctbl->lock); in cxgb4_clip_release()
174 list_add_tail(&ce->list, &ctbl->ce_free_head); in cxgb4_clip_release()
175 atomic_inc(&ctbl->nfree); in cxgb4_clip_release()
180 write_unlock_bh(&ctbl->lock); in cxgb4_clip_release()
245 struct clip_tbl *ctbl = adapter->clipt; in clip_tbl_show() local
250 read_lock_bh(&ctbl->lock); in clip_tbl_show()
253 for (i = 0 ; i < ctbl->clipt_size; ++i) { in clip_tbl_show()
254 list_for_each_entry(ce, &ctbl->hash_list[i], list) { in clip_tbl_show()
261 seq_printf(seq, "Free clip entries : %d\n", atomic_read(&ctbl->nfree)); in clip_tbl_show()
263 read_unlock_bh(&ctbl->lock); in clip_tbl_show()
272 struct clip_tbl *ctbl; in t4_init_clip_tbl() local
282 ctbl = t4_alloc_mem(sizeof(*ctbl) + in t4_init_clip_tbl()
284 if (!ctbl) in t4_init_clip_tbl()
287 ctbl->clipt_start = clipt_start; in t4_init_clip_tbl()
288 ctbl->clipt_size = clipt_size; in t4_init_clip_tbl()
289 INIT_LIST_HEAD(&ctbl->ce_free_head); in t4_init_clip_tbl()
291 atomic_set(&ctbl->nfree, clipt_size); in t4_init_clip_tbl()
292 rwlock_init(&ctbl->lock); in t4_init_clip_tbl()
294 for (i = 0; i < ctbl->clipt_size; ++i) in t4_init_clip_tbl()
295 INIT_LIST_HEAD(&ctbl->hash_list[i]); in t4_init_clip_tbl()
299 t4_free_mem(ctbl); in t4_init_clip_tbl()
302 ctbl->cl_list = (void *)cl_list; in t4_init_clip_tbl()
306 list_add_tail(&cl_list[i].list, &ctbl->ce_free_head); in t4_init_clip_tbl()
309 return ctbl; in t4_init_clip_tbl()
314 struct clip_tbl *ctbl = adap->clipt; in t4_cleanup_clip_tbl() local
316 if (ctbl) { in t4_cleanup_clip_tbl()
317 if (ctbl->cl_list) in t4_cleanup_clip_tbl()
318 t4_free_mem(ctbl->cl_list); in t4_cleanup_clip_tbl()
319 t4_free_mem(ctbl); in t4_cleanup_clip_tbl()