Lines Matching refs: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()
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 memset(entry, 0, sizeof(in_cache_entry)); in in_cache_put()
184 kfree(entry); in in_cache_put()
191 static void in_cache_remove_entry(in_cache_entry *entry, in in_cache_remove_entry() argument
197 vcc = entry->shortcut; in in_cache_remove_entry()
199 &entry->ctrl_info.in_dst_ip); in in_cache_remove_entry()
201 if (entry->prev != NULL) in in_cache_remove_entry()
202 entry->prev->next = entry->next; in in_cache_remove_entry()
204 client->in_cache = entry->next; in in_cache_remove_entry()
205 if (entry->next != NULL) in in_cache_remove_entry()
206 entry->next->prev = entry->prev; in in_cache_remove_entry()
207 client->in_ops->put(entry); in in_cache_remove_entry()
229 in_cache_entry *entry, *next_entry; in clear_count_and_expired() local
235 entry = client->in_cache; in clear_count_and_expired()
236 while (entry != NULL) { in clear_count_and_expired()
237 entry->count = 0; in clear_count_and_expired()
238 next_entry = entry->next; in clear_count_and_expired()
239 if ((now - entry->time) > entry->ctrl_info.holding_time) { in clear_count_and_expired()
241 &entry->ctrl_info.in_dst_ip); in clear_count_and_expired()
242 client->in_ops->remove_entry(entry, client); in clear_count_and_expired()
244 entry = next_entry; in clear_count_and_expired()
254 in_cache_entry *entry; in check_resolving_entries() local
261 entry = client->in_cache; in check_resolving_entries()
262 while (entry != NULL) { in check_resolving_entries()
263 if (entry->entry_state == INGRESS_RESOLVING) { in check_resolving_entries()
265 if ((now - entry->hold_down) in check_resolving_entries()
267 entry = entry->next; /* Entry in hold down */ in check_resolving_entries()
270 if ((now - entry->reply_wait) > entry->retry_time) { in check_resolving_entries()
271 entry->retry_time = MPC_C1 * (entry->retry_time); in check_resolving_entries()
276 if (entry->retry_time > client->parameters.mpc_p5) { in check_resolving_entries()
277 entry->hold_down = ktime_get_seconds(); in check_resolving_entries()
278 entry->retry_time = client->parameters.mpc_p4; in check_resolving_entries()
279 entry = entry->next; in check_resolving_entries()
283 memset(&entry->hold_down, 0, sizeof(time64_t)); in check_resolving_entries()
286 msg.content.in_info = entry->ctrl_info; in check_resolving_entries()
287 qos = atm_mpoa_search_qos(entry->ctrl_info.in_dst_ip); in check_resolving_entries()
291 entry->reply_wait = ktime_get_seconds(); in check_resolving_entries()
294 entry = entry->next; in check_resolving_entries()
303 struct in_cache_entry *entry = client->in_cache; in refresh_entries() local
309 while (entry != NULL) { in refresh_entries()
310 if (entry->entry_state == INGRESS_RESOLVED) { in refresh_entries()
311 if (!(entry->refresh_time)) in refresh_entries()
312 entry->refresh_time = (2 * (entry->ctrl_info.holding_time))/3; in refresh_entries()
313 if ((now - entry->reply_wait) > in refresh_entries()
314 entry->refresh_time) { in refresh_entries()
316 entry->entry_state = INGRESS_REFRESHING; in refresh_entries()
320 entry = entry->next; in refresh_entries()
336 eg_cache_entry *entry; in eg_cache_get_by_cache_id() local
339 entry = mpc->eg_cache; in eg_cache_get_by_cache_id()
340 while (entry != NULL) { in eg_cache_get_by_cache_id()
341 if (entry->ctrl_info.cache_id == cache_id) { in eg_cache_get_by_cache_id()
342 refcount_inc(&entry->use); in eg_cache_get_by_cache_id()
344 return entry; in eg_cache_get_by_cache_id()
346 entry = entry->next; in eg_cache_get_by_cache_id()
357 eg_cache_entry *entry; in eg_cache_get_by_tag() local
360 entry = mpc->eg_cache; in eg_cache_get_by_tag()
361 while (entry != NULL) { in eg_cache_get_by_tag()
362 if (entry->ctrl_info.tag == tag) { in eg_cache_get_by_tag()
363 refcount_inc(&entry->use); in eg_cache_get_by_tag()
365 return entry; in eg_cache_get_by_tag()
367 entry = entry->next; in eg_cache_get_by_tag()
379 eg_cache_entry *entry; in eg_cache_get_by_vcc() local
382 entry = mpc->eg_cache; in eg_cache_get_by_vcc()
383 while (entry != NULL) { in eg_cache_get_by_vcc()
384 if (entry->shortcut == vcc) { in eg_cache_get_by_vcc()
385 refcount_inc(&entry->use); in eg_cache_get_by_vcc()
387 return entry; in eg_cache_get_by_vcc()
389 entry = entry->next; in eg_cache_get_by_vcc()
399 eg_cache_entry *entry; in eg_cache_get_by_src_ip() local
402 entry = mpc->eg_cache; in eg_cache_get_by_src_ip()
403 while (entry != NULL) { in eg_cache_get_by_src_ip()
404 if (entry->latest_ip_addr == ipaddr) { in eg_cache_get_by_src_ip()
405 refcount_inc(&entry->use); in eg_cache_get_by_src_ip()
407 return entry; in eg_cache_get_by_src_ip()
409 entry = entry->next; in eg_cache_get_by_src_ip()
416 static void eg_cache_put(eg_cache_entry *entry) in eg_cache_put() argument
418 if (refcount_dec_and_test(&entry->use)) { in eg_cache_put()
419 memset(entry, 0, sizeof(eg_cache_entry)); in eg_cache_put()
420 kfree(entry); in eg_cache_put()
427 static void eg_cache_remove_entry(eg_cache_entry *entry, in eg_cache_remove_entry() argument
433 vcc = entry->shortcut; in eg_cache_remove_entry()
435 if (entry->prev != NULL) in eg_cache_remove_entry()
436 entry->prev->next = entry->next; in eg_cache_remove_entry()
438 client->eg_cache = entry->next; in eg_cache_remove_entry()
439 if (entry->next != NULL) in eg_cache_remove_entry()
440 entry->next->prev = entry->prev; in eg_cache_remove_entry()
441 client->eg_ops->put(entry); in eg_cache_remove_entry()
461 eg_cache_entry *entry = kzalloc(sizeof(eg_cache_entry), GFP_KERNEL); in eg_cache_add_entry() local
463 if (entry == NULL) { in eg_cache_add_entry()
471 refcount_set(&entry->use, 1); in eg_cache_add_entry()
474 entry->next = client->eg_cache; in eg_cache_add_entry()
475 entry->prev = NULL; in eg_cache_add_entry()
477 client->eg_cache->prev = entry; in eg_cache_add_entry()
478 client->eg_cache = entry; in eg_cache_add_entry()
480 memcpy(entry->MPS_ctrl_ATM_addr, client->mps_ctrl_addr, ATM_ESA_LEN); in eg_cache_add_entry()
481 entry->ctrl_info = msg->content.eg_info; in eg_cache_add_entry()
482 entry->time = ktime_get_seconds(); in eg_cache_add_entry()
483 entry->entry_state = EGRESS_RESOLVED; in eg_cache_add_entry()
485 ntohl(entry->ctrl_info.cache_id)); in eg_cache_add_entry()
486 dprintk("mps_ip = %pI4\n", &entry->ctrl_info.mps_ip); in eg_cache_add_entry()
487 refcount_inc(&entry->use); in eg_cache_add_entry()
492 return entry; in eg_cache_add_entry()
495 static void update_eg_cache_entry(eg_cache_entry *entry, uint16_t holding_time) in update_eg_cache_entry() argument
497 entry->time = ktime_get_seconds(); in update_eg_cache_entry()
498 entry->entry_state = EGRESS_RESOLVED; in update_eg_cache_entry()
499 entry->ctrl_info.holding_time = holding_time; in update_eg_cache_entry()
504 eg_cache_entry *entry, *next_entry; in clear_expired() local
511 entry = client->eg_cache; in clear_expired()
512 while (entry != NULL) { in clear_expired()
513 next_entry = entry->next; in clear_expired()
514 if ((now - entry->time) > entry->ctrl_info.holding_time) { in clear_expired()
516 msg.content.eg_info = entry->ctrl_info; in clear_expired()
518 ntohl(entry->ctrl_info.cache_id)); in clear_expired()
520 client->eg_ops->remove_entry(entry, client); in clear_expired()
522 entry = next_entry; in clear_expired()