Lines Matching +full:2 +full:- +full:layered
3 * Copyright (C) 2003-2014 Chelsio Communications. All rights reserved.
23 unsigned int clipt_size_half = c->clipt_size / 2; in ipv4_clip_hash()
30 unsigned int clipt_size_half = d->clipt_size / 2; in ipv6_clip_hash()
31 u32 xor = key[0] ^ key[1] ^ key[2] ^ key[3]; in ipv6_clip_hash()
54 *(__be64 *)&c.ip_hi = *(__be64 *)(lip->s6_addr); in clip6_get_mbox()
55 *(__be64 *)&c.ip_lo = *(__be64 *)(lip->s6_addr + 8); in clip6_get_mbox()
56 return t4_wr_mbox_meat(adap, adap->mbox, &c, sizeof(c), &c, false); in clip6_get_mbox()
69 *(__be64 *)&c.ip_hi = *(__be64 *)(lip->s6_addr); in clip6_release_mbox()
70 *(__be64 *)&c.ip_lo = *(__be64 *)(lip->s6_addr + 8); in clip6_release_mbox()
71 return t4_wr_mbox_meat(adap, adap->mbox, &c, sizeof(c), &c, false); in clip6_release_mbox()
77 struct clip_tbl *ctbl = adap->clipt; in cxgb4_clip_get()
81 int ret = -1; 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()
90 if (cte->addr6.sin6_family == AF_INET6 && v6) in cxgb4_clip_get()
91 ret = memcmp(lip, cte->addr6.sin6_addr.s6_addr, in cxgb4_clip_get()
93 else if (cte->addr.sin_family == AF_INET && !v6) in cxgb4_clip_get()
94 ret = memcmp(lip, (char *)(&cte->addr.sin_addr), in cxgb4_clip_get()
98 read_unlock_bh(&ctbl->lock); in cxgb4_clip_get()
99 refcount_inc(&ce->refcnt); 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()
109 list_del_init(&ce->list); in cxgb4_clip_get()
110 spin_lock_init(&ce->lock); in cxgb4_clip_get()
111 refcount_set(&ce->refcnt, 0); 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()
115 ce->addr6.sin6_family = AF_INET6; in cxgb4_clip_get()
116 memcpy(ce->addr6.sin6_addr.s6_addr, in cxgb4_clip_get()
120 write_unlock_bh(&ctbl->lock); in cxgb4_clip_get()
121 dev_err(adap->pdev_dev, in cxgb4_clip_get()
125 ret, ce->addr6.sin6_addr.s6_addr); in cxgb4_clip_get()
129 ce->addr.sin_family = AF_INET; in cxgb4_clip_get()
130 memcpy((char *)(&ce->addr.sin_addr), lip, in cxgb4_clip_get()
134 write_unlock_bh(&ctbl->lock); in cxgb4_clip_get()
135 dev_info(adap->pdev_dev, "CLIP table overflow, " in cxgb4_clip_get()
138 return -ENOMEM; in cxgb4_clip_get()
140 write_unlock_bh(&ctbl->lock); in cxgb4_clip_get()
141 refcount_set(&ce->refcnt, 1); in cxgb4_clip_get()
149 struct clip_tbl *ctbl = adap->clipt; in cxgb4_clip_release()
153 int ret = -1; 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()
162 if (cte->addr6.sin6_family == AF_INET6 && v6) in cxgb4_clip_release()
163 ret = memcmp(lip, cte->addr6.sin6_addr.s6_addr, in cxgb4_clip_release()
165 else if (cte->addr.sin_family == AF_INET && !v6) in cxgb4_clip_release()
166 ret = memcmp(lip, (char *)(&cte->addr.sin_addr), 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()
179 spin_lock_bh(&ce->lock); in cxgb4_clip_release()
180 if (refcount_dec_and_test(&ce->refcnt)) { in cxgb4_clip_release()
181 list_del_init(&ce->list); 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()
187 spin_unlock_bh(&ce->lock); in cxgb4_clip_release()
188 write_unlock_bh(&ctbl->lock); in cxgb4_clip_release()
207 read_lock_bh(&idev->lock); in cxgb4_update_dev_clip()
208 list_for_each_entry(ifa, &idev->addr_list, if_list) { in cxgb4_update_dev_clip()
209 ret = cxgb4_clip_get(dev, (const u32 *)ifa->addr.s6_addr, 1); in cxgb4_update_dev_clip()
213 read_unlock_bh(&idev->lock); in cxgb4_update_dev_clip()
228 /* Parse all bond and vlan devices layered on top of the physical dev */ in cxgb4_update_root_dev_clip()
252 struct adapter *adapter = seq->private; in clip_tbl_show()
253 struct clip_tbl *ctbl = adapter->clipt; in clip_tbl_show()
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()
264 sprintf(ip, "%pISc", &ce->addr); in clip_tbl_show()
265 seq_printf(seq, "%-25s %u\n", ip, in clip_tbl_show()
266 refcount_read(&ce->refcnt)); 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()
286 clipt_size = clipt_end - clipt_start + 1; 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()
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()
321 struct clip_tbl *ctbl = adap->clipt; in t4_cleanup_clip_tbl()
324 kvfree(ctbl->cl_list); in t4_cleanup_clip_tbl()