Lines Matching refs:entry
37 in_cache_entry *entry; in in_cache_get() local
40 entry = client->in_cache; in in_cache_get()
41 while (entry != NULL) { in in_cache_get()
42 if (entry->ctrl_info.in_dst_ip == dst_ip) { in in_cache_get()
43 atomic_inc(&entry->use); in in_cache_get()
45 return entry; in in_cache_get()
47 entry = entry->next; in in_cache_get()
58 in_cache_entry *entry; in in_cache_get_with_mask() local
61 entry = client->in_cache; in in_cache_get_with_mask()
62 while (entry != NULL) { in in_cache_get_with_mask()
63 if ((entry->ctrl_info.in_dst_ip & mask) == (dst_ip & mask)) { in in_cache_get_with_mask()
64 atomic_inc(&entry->use); in in_cache_get_with_mask()
66 return entry; in in_cache_get_with_mask()
68 entry = entry->next; in in_cache_get_with_mask()
79 in_cache_entry *entry; in in_cache_get_by_vcc() local
82 entry = client->in_cache; in in_cache_get_by_vcc()
83 while (entry != NULL) { in in_cache_get_by_vcc()
84 if (entry->shortcut == vcc) { in in_cache_get_by_vcc()
85 atomic_inc(&entry->use); in in_cache_get_by_vcc()
87 return entry; in in_cache_get_by_vcc()
89 entry = entry->next; in in_cache_get_by_vcc()
99 in_cache_entry *entry = kzalloc(sizeof(in_cache_entry), GFP_KERNEL); in in_cache_add_entry() local
101 if (entry == NULL) { in in_cache_add_entry()
108 atomic_set(&entry->use, 1); in in_cache_add_entry()
111 entry->next = client->in_cache; in in_cache_add_entry()
112 entry->prev = NULL; in in_cache_add_entry()
114 client->in_cache->prev = entry; in in_cache_add_entry()
115 client->in_cache = entry; in in_cache_add_entry()
117 memcpy(entry->MPS_ctrl_ATM_addr, client->mps_ctrl_addr, ATM_ESA_LEN); in in_cache_add_entry()
118 entry->ctrl_info.in_dst_ip = dst_ip; in in_cache_add_entry()
119 do_gettimeofday(&(entry->tv)); in in_cache_add_entry()
120 entry->retry_time = client->parameters.mpc_p4; in in_cache_add_entry()
121 entry->count = 1; in in_cache_add_entry()
122 entry->entry_state = INGRESS_INVALID; in in_cache_add_entry()
123 entry->ctrl_info.holding_time = HOLDING_TIME_DEFAULT; in in_cache_add_entry()
124 atomic_inc(&entry->use); in in_cache_add_entry()
129 return entry; in in_cache_add_entry()
132 static int cache_hit(in_cache_entry *entry, struct mpoa_client *mpc) in cache_hit() argument
137 entry->count++; in cache_hit()
138 if (entry->entry_state == INGRESS_RESOLVED && entry->shortcut != NULL) in cache_hit()
141 if (entry->entry_state == INGRESS_REFRESHING) { in cache_hit()
142 if (entry->count > mpc->parameters.mpc_p1) { in cache_hit()
144 msg.content.in_info = entry->ctrl_info; in cache_hit()
146 qos = atm_mpoa_search_qos(entry->ctrl_info.in_dst_ip); in cache_hit()
150 do_gettimeofday(&(entry->reply_wait)); in cache_hit()
151 entry->entry_state = INGRESS_RESOLVING; in cache_hit()
153 if (entry->shortcut != NULL) in cache_hit()
158 if (entry->entry_state == INGRESS_RESOLVING && entry->shortcut != NULL) in cache_hit()
161 if (entry->count > mpc->parameters.mpc_p1 && in cache_hit()
162 entry->entry_state == INGRESS_INVALID) { in cache_hit()
164 mpc->dev->name, &entry->ctrl_info.in_dst_ip); in cache_hit()
165 entry->entry_state = INGRESS_RESOLVING; in cache_hit()
168 msg.content.in_info = entry->ctrl_info; in cache_hit()
169 qos = atm_mpoa_search_qos(entry->ctrl_info.in_dst_ip); in cache_hit()
173 do_gettimeofday(&(entry->reply_wait)); in cache_hit()
179 static void in_cache_put(in_cache_entry *entry) in in_cache_put() argument
181 if (atomic_dec_and_test(&entry->use)) { in in_cache_put()
182 memset(entry, 0, sizeof(in_cache_entry)); in in_cache_put()
183 kfree(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()
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.tv_sec - entry->tv.tv_sec) in clear_count_and_expired()
239 > 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()
264 if ((now.tv_sec - entry->hold_down.tv_sec) < in check_resolving_entries()
266 entry = entry->next; /* Entry in hold down */ in check_resolving_entries()
269 if ((now.tv_sec - entry->reply_wait.tv_sec) > in check_resolving_entries()
270 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 do_gettimeofday(&(entry->hold_down)); 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(struct timeval)); 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 do_gettimeofday(&(entry->reply_wait)); 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.tv_sec - entry->reply_wait.tv_sec) > 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 atomic_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 atomic_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 atomic_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 atomic_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 (atomic_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 atomic_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 do_gettimeofday(&(entry->tv)); 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 atomic_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 do_gettimeofday(&(entry->tv)); 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.tv_sec - entry->tv.tv_sec) in clear_expired()
515 > entry->ctrl_info.holding_time) { in clear_expired()
517 msg.content.eg_info = entry->ctrl_info; in clear_expired()
519 ntohl(entry->ctrl_info.cache_id)); in clear_expired()
521 client->eg_ops->remove_entry(entry, client); in clear_expired()
523 entry = next_entry; in clear_expired()