Lines Matching full:entry

38 	in_cache_entry *entry;  in in_cache_get()  local
41 entry = client->in_cache; in in_cache_get()
42 while (entry != NULL) { in in_cache_get()
43 if (entry->ctrl_info.in_dst_ip == dst_ip) { in in_cache_get()
44 refcount_inc(&entry->use); in in_cache_get()
46 return entry; in in_cache_get()
48 entry = entry->next; in in_cache_get()
59 in_cache_entry *entry; in in_cache_get_with_mask() local
62 entry = client->in_cache; in in_cache_get_with_mask()
63 while (entry != NULL) { in in_cache_get_with_mask()
64 if ((entry->ctrl_info.in_dst_ip & mask) == (dst_ip & mask)) { in in_cache_get_with_mask()
65 refcount_inc(&entry->use); in in_cache_get_with_mask()
67 return entry; in in_cache_get_with_mask()
69 entry = entry->next; in in_cache_get_with_mask()
80 in_cache_entry *entry; in in_cache_get_by_vcc() local
83 entry = client->in_cache; in in_cache_get_by_vcc()
84 while (entry != NULL) { in in_cache_get_by_vcc()
85 if (entry->shortcut == vcc) { in in_cache_get_by_vcc()
86 refcount_inc(&entry->use); in in_cache_get_by_vcc()
88 return entry; in in_cache_get_by_vcc()
90 entry = entry->next; in in_cache_get_by_vcc()
100 in_cache_entry *entry = kzalloc(sizeof(in_cache_entry), GFP_KERNEL); in in_cache_add_entry() local
102 if (entry == NULL) { in in_cache_add_entry()
107 dprintk("adding an ingress entry, ip = %pI4\n", &dst_ip); in in_cache_add_entry()
109 refcount_set(&entry->use, 1); in in_cache_add_entry()
112 entry->next = client->in_cache; in in_cache_add_entry()
113 entry->prev = NULL; in in_cache_add_entry()
115 client->in_cache->prev = entry; in in_cache_add_entry()
116 client->in_cache = entry; in in_cache_add_entry()
118 memcpy(entry->MPS_ctrl_ATM_addr, client->mps_ctrl_addr, ATM_ESA_LEN); in in_cache_add_entry()
119 entry->ctrl_info.in_dst_ip = dst_ip; in in_cache_add_entry()
120 entry->time = ktime_get_seconds(); in in_cache_add_entry()
121 entry->retry_time = client->parameters.mpc_p4; in in_cache_add_entry()
122 entry->count = 1; in in_cache_add_entry()
123 entry->entry_state = INGRESS_INVALID; in in_cache_add_entry()
124 entry->ctrl_info.holding_time = HOLDING_TIME_DEFAULT; in in_cache_add_entry()
125 refcount_inc(&entry->use); in in_cache_add_entry()
130 return entry; in in_cache_add_entry()
133 static int cache_hit(in_cache_entry *entry, struct mpoa_client *mpc) in cache_hit() argument
138 entry->count++; in cache_hit()
139 if (entry->entry_state == INGRESS_RESOLVED && entry->shortcut != NULL) in cache_hit()
142 if (entry->entry_state == INGRESS_REFRESHING) { in cache_hit()
143 if (entry->count > mpc->parameters.mpc_p1) { in cache_hit()
145 msg.content.in_info = entry->ctrl_info; in cache_hit()
147 qos = atm_mpoa_search_qos(entry->ctrl_info.in_dst_ip); in cache_hit()
151 entry->reply_wait = ktime_get_seconds(); in cache_hit()
152 entry->entry_state = INGRESS_RESOLVING; in cache_hit()
154 if (entry->shortcut != NULL) in cache_hit()
159 if (entry->entry_state == INGRESS_RESOLVING && entry->shortcut != NULL) in cache_hit()
162 if (entry->count > mpc->parameters.mpc_p1 && in cache_hit()
163 entry->entry_state == INGRESS_INVALID) { in cache_hit()
165 mpc->dev->name, &entry->ctrl_info.in_dst_ip); in cache_hit()
166 entry->entry_state = INGRESS_RESOLVING; in cache_hit()
169 msg.content.in_info = entry->ctrl_info; in cache_hit()
170 qos = atm_mpoa_search_qos(entry->ctrl_info.in_dst_ip); in cache_hit()
174 entry->reply_wait = ktime_get_seconds(); in cache_hit()
180 static void in_cache_put(in_cache_entry *entry) in in_cache_put() argument
182 if (refcount_dec_and_test(&entry->use)) { in in_cache_put()
183 kfree_sensitive(entry); in in_cache_put()
190 static void in_cache_remove_entry(in_cache_entry *entry, in in_cache_remove_entry() argument
196 vcc = entry->shortcut; in in_cache_remove_entry()
197 dprintk("removing an ingress entry, ip = %pI4\n", in in_cache_remove_entry()
198 &entry->ctrl_info.in_dst_ip); in in_cache_remove_entry()
200 if (entry->prev != NULL) in in_cache_remove_entry()
201 entry->prev->next = entry->next; in in_cache_remove_entry()
203 client->in_cache = entry->next; in in_cache_remove_entry()
204 if (entry->next != NULL) in in_cache_remove_entry()
205 entry->next->prev = entry->prev; in in_cache_remove_entry()
206 client->in_ops->put(entry); in in_cache_remove_entry()
228 in_cache_entry *entry, *next_entry; in clear_count_and_expired() local
234 entry = client->in_cache; in clear_count_and_expired()
235 while (entry != NULL) { in clear_count_and_expired()
236 entry->count = 0; in clear_count_and_expired()
237 next_entry = entry->next; in clear_count_and_expired()
238 if ((now - entry->time) > entry->ctrl_info.holding_time) { in clear_count_and_expired()
240 &entry->ctrl_info.in_dst_ip); in clear_count_and_expired()
241 client->in_ops->remove_entry(entry, client); in clear_count_and_expired()
243 entry = next_entry; in clear_count_and_expired()
253 in_cache_entry *entry; in check_resolving_entries() local
260 entry = client->in_cache; in check_resolving_entries()
261 while (entry != NULL) { in check_resolving_entries()
262 if (entry->entry_state == INGRESS_RESOLVING) { in check_resolving_entries()
264 if ((now - entry->hold_down) in check_resolving_entries()
266 entry = entry->next; /* Entry in hold down */ in check_resolving_entries()
269 if ((now - entry->reply_wait) > entry->retry_time) { in check_resolving_entries()
270 entry->retry_time = MPC_C1 * (entry->retry_time); in check_resolving_entries()
273 * put entry in hold down. in check_resolving_entries()
275 if (entry->retry_time > client->parameters.mpc_p5) { in check_resolving_entries()
276 entry->hold_down = ktime_get_seconds(); in check_resolving_entries()
277 entry->retry_time = client->parameters.mpc_p4; in check_resolving_entries()
278 entry = entry->next; in check_resolving_entries()
282 memset(&entry->hold_down, 0, sizeof(time64_t)); in check_resolving_entries()
285 msg.content.in_info = entry->ctrl_info; in check_resolving_entries()
286 qos = atm_mpoa_search_qos(entry->ctrl_info.in_dst_ip); in check_resolving_entries()
290 entry->reply_wait = ktime_get_seconds(); in check_resolving_entries()
293 entry = entry->next; in check_resolving_entries()
302 struct in_cache_entry *entry = client->in_cache; in refresh_entries() local
308 while (entry != NULL) { in refresh_entries()
309 if (entry->entry_state == INGRESS_RESOLVED) { in refresh_entries()
310 if (!(entry->refresh_time)) in refresh_entries()
311 entry->refresh_time = (2 * (entry->ctrl_info.holding_time))/3; in refresh_entries()
312 if ((now - entry->reply_wait) > in refresh_entries()
313 entry->refresh_time) { in refresh_entries()
314 dprintk("refreshing an entry.\n"); in refresh_entries()
315 entry->entry_state = INGRESS_REFRESHING; in refresh_entries()
319 entry = entry->next; in refresh_entries()
335 eg_cache_entry *entry; in eg_cache_get_by_cache_id() local
338 entry = mpc->eg_cache; in eg_cache_get_by_cache_id()
339 while (entry != NULL) { in eg_cache_get_by_cache_id()
340 if (entry->ctrl_info.cache_id == cache_id) { in eg_cache_get_by_cache_id()
341 refcount_inc(&entry->use); in eg_cache_get_by_cache_id()
343 return entry; in eg_cache_get_by_cache_id()
345 entry = entry->next; in eg_cache_get_by_cache_id()
356 eg_cache_entry *entry; in eg_cache_get_by_tag() local
359 entry = mpc->eg_cache; in eg_cache_get_by_tag()
360 while (entry != NULL) { in eg_cache_get_by_tag()
361 if (entry->ctrl_info.tag == tag) { in eg_cache_get_by_tag()
362 refcount_inc(&entry->use); in eg_cache_get_by_tag()
364 return entry; in eg_cache_get_by_tag()
366 entry = entry->next; in eg_cache_get_by_tag()
378 eg_cache_entry *entry; in eg_cache_get_by_vcc() local
381 entry = mpc->eg_cache; in eg_cache_get_by_vcc()
382 while (entry != NULL) { in eg_cache_get_by_vcc()
383 if (entry->shortcut == vcc) { in eg_cache_get_by_vcc()
384 refcount_inc(&entry->use); in eg_cache_get_by_vcc()
386 return entry; in eg_cache_get_by_vcc()
388 entry = entry->next; in eg_cache_get_by_vcc()
398 eg_cache_entry *entry; in eg_cache_get_by_src_ip() local
401 entry = mpc->eg_cache; in eg_cache_get_by_src_ip()
402 while (entry != NULL) { in eg_cache_get_by_src_ip()
403 if (entry->latest_ip_addr == ipaddr) { in eg_cache_get_by_src_ip()
404 refcount_inc(&entry->use); in eg_cache_get_by_src_ip()
406 return entry; in eg_cache_get_by_src_ip()
408 entry = entry->next; in eg_cache_get_by_src_ip()
415 static void eg_cache_put(eg_cache_entry *entry) in eg_cache_put() argument
417 if (refcount_dec_and_test(&entry->use)) { in eg_cache_put()
418 kfree_sensitive(entry); in eg_cache_put()
425 static void eg_cache_remove_entry(eg_cache_entry *entry, in eg_cache_remove_entry() argument
431 vcc = entry->shortcut; in eg_cache_remove_entry()
432 dprintk("removing an egress entry.\n"); in eg_cache_remove_entry()
433 if (entry->prev != NULL) in eg_cache_remove_entry()
434 entry->prev->next = entry->next; in eg_cache_remove_entry()
436 client->eg_cache = entry->next; in eg_cache_remove_entry()
437 if (entry->next != NULL) in eg_cache_remove_entry()
438 entry->next->prev = entry->prev; in eg_cache_remove_entry()
439 client->eg_ops->put(entry); in eg_cache_remove_entry()
459 eg_cache_entry *entry = kzalloc(sizeof(eg_cache_entry), GFP_KERNEL); in eg_cache_add_entry() local
461 if (entry == NULL) { in eg_cache_add_entry()
466 dprintk("adding an egress entry, ip = %pI4, this should be our IP\n", in eg_cache_add_entry()
469 refcount_set(&entry->use, 1); in eg_cache_add_entry()
472 entry->next = client->eg_cache; in eg_cache_add_entry()
473 entry->prev = NULL; in eg_cache_add_entry()
475 client->eg_cache->prev = entry; in eg_cache_add_entry()
476 client->eg_cache = entry; in eg_cache_add_entry()
478 memcpy(entry->MPS_ctrl_ATM_addr, client->mps_ctrl_addr, ATM_ESA_LEN); in eg_cache_add_entry()
479 entry->ctrl_info = msg->content.eg_info; in eg_cache_add_entry()
480 entry->time = ktime_get_seconds(); in eg_cache_add_entry()
481 entry->entry_state = EGRESS_RESOLVED; in eg_cache_add_entry()
483 ntohl(entry->ctrl_info.cache_id)); in eg_cache_add_entry()
484 dprintk("mps_ip = %pI4\n", &entry->ctrl_info.mps_ip); in eg_cache_add_entry()
485 refcount_inc(&entry->use); in eg_cache_add_entry()
490 return entry; in eg_cache_add_entry()
493 static void update_eg_cache_entry(eg_cache_entry *entry, uint16_t holding_time) in update_eg_cache_entry() argument
495 entry->time = ktime_get_seconds(); in update_eg_cache_entry()
496 entry->entry_state = EGRESS_RESOLVED; in update_eg_cache_entry()
497 entry->ctrl_info.holding_time = holding_time; in update_eg_cache_entry()
502 eg_cache_entry *entry, *next_entry; in clear_expired() local
509 entry = client->eg_cache; in clear_expired()
510 while (entry != NULL) { in clear_expired()
511 next_entry = entry->next; in clear_expired()
512 if ((now - entry->time) > entry->ctrl_info.holding_time) { in clear_expired()
514 msg.content.eg_info = entry->ctrl_info; in clear_expired()
516 ntohl(entry->ctrl_info.cache_id)); in clear_expired()
518 client->eg_ops->remove_entry(entry, client); in clear_expired()
520 entry = next_entry; in clear_expired()