Home | History | Annotate | Download | only in netinet6

Lines Matching defs:ip6f

117 #define	IP6FLOW_INSERT(hashidx, ip6f) \
119 (ip6f)->ip6f_hashidx = (hashidx); \
120 TAILQ_INSERT_HEAD(&ip6flowtable[(hashidx)], (ip6f), ip6f_hash); \
121 TAILQ_INSERT_HEAD(&ip6flowlist, (ip6f), ip6f_list); \
127 #define IP6FLOW_REMOVE(hashidx, ip6f) \
129 TAILQ_REMOVE(&ip6flowtable[(hashidx)], (ip6f), ip6f_hash); \
130 TAILQ_REMOVE(&ip6flowlist, (ip6f), ip6f_list); \
170 struct ip6flow *ip6f;
176 TAILQ_FOREACH(ip6f, &ip6flowtable[hash], ip6f_hash) {
177 if (IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, &ip6f->ip6f_dst)
178 && IN6_ARE_ADDR_EQUAL(&ip6->ip6_src, &ip6f->ip6f_src)
179 && ip6f->ip6f_flow == ip6->ip6_flow) {
181 return ip6f;
257 struct ip6flow *ip6f;
312 if ((ip6f = ip6flow_lookup(ip6)) == NULL) {
320 if ((rt = rtcache_validate(&ip6f->ip6f_ro)) == NULL ||
347 dst = rtcache_getdst(&ip6f->ip6f_ro);
349 PRT_SLOW_ARM(ip6f->ip6f_timer, IP6FLOW_TIMER);
351 ip6f->ip6f_uses++;
358 TAILQ_REMOVE(&ip6flowlist, ip6f, ip6f_list);
359 TAILQ_INSERT_HEAD(&ip6flowlist, ip6f, ip6f_list);
364 ip6f->ip6f_dropped++;
366 ip6f->ip6f_forwarded++;
370 rtcache_unref(rt, &ip6f->ip6f_ro);
380 ip6flow_addstats_rt(struct rtentry *rt, struct ip6flow *ip6f)
385 rt->rt_use += ip6f->ip6f_uses;
388 _NET_STATADD_REF(ip6s, IP6_STAT_CANTFORWARD, ip6f->ip6f_dropped);
389 _NET_STATADD_REF(ip6s, IP6_STAT_ODROPPED, ip6f->ip6f_dropped);
390 _NET_STATADD_REF(ip6s, IP6_STAT_TOTAL, ip6f->ip6f_uses);
391 _NET_STATADD_REF(ip6s, IP6_STAT_FORWARD, ip6f->ip6f_forwarded);
392 _NET_STATADD_REF(ip6s, IP6_STAT_FASTFORWARD, ip6f->ip6f_forwarded);
397 ip6flow_addstats(struct ip6flow *ip6f)
401 rt = rtcache_validate(&ip6f->ip6f_ro);
402 ip6flow_addstats_rt(rt, ip6f);
403 rtcache_unref(rt, &ip6f->ip6f_ro);
410 ip6flow_free(struct ip6flow *ip6f)
420 IP6FLOW_REMOVE(ip6f->ip6f_hashidx, ip6f);
423 ip6flow_addstats(ip6f);
424 rtcache_free(&ip6f->ip6f_ro);
425 pool_put(&ip6flow_pool, ip6f);
431 struct ip6flow *ip6f;
440 ip6f = TAILQ_LAST(&ip6flowlist, ip6flowhead);
441 KASSERT(ip6f != NULL);
443 IP6FLOW_REMOVE(ip6f->ip6f_hashidx, ip6f);
445 ip6flow_addstats(ip6f);
446 rtcache_free(&ip6f->ip6f_ro);
447 return ip6f;
458 TAILQ_FOREACH(ip6f, &ip6flowlist, ip6f_list) {
464 if ((rt = rtcache_validate(&ip6f->ip6f_ro)) == NULL)
466 rtcache_unref(rt, &ip6f->ip6f_ro);
472 if (ip6f->ip6f_timer < maybe_ip6f->ip6f_timer
473 || ((ip6f->ip6f_timer == maybe_ip6f->ip6f_timer)
474 && (ip6f->ip6f_last_uses + ip6f->ip6f_uses
476 maybe_ip6f = ip6f;
478 ip6f = maybe_ip6f;
483 IP6FLOW_REMOVE(ip6f->ip6f_hashidx, ip6f);
485 rtcache_free(&ip6f->ip6f_ro);
487 ip6flow_addstats(ip6f);
488 pool_put(&ip6flow_pool, ip6f);
500 struct ip6flow *ip6f;
503 ip6f = ip6flow_reap_locked(just_one);
505 return ip6f;
513 struct ip6flow *ip6f, *next_ip6f;
521 for (ip6f = TAILQ_FIRST(&ip6flowlist); ip6f != NULL; ip6f = next_ip6f) {
523 next_ip6f = TAILQ_NEXT(ip6f, ip6f_list);
524 if (PRT_SLOW_ISEXPIRED(ip6f->ip6f_timer) ||
525 (rt = rtcache_validate(&ip6f->ip6f_ro)) == NULL) {
526 ip6flow_free(ip6f);
528 ip6f->ip6f_last_uses = ip6f->ip6f_uses;
529 ip6flow_addstats_rt(rt, ip6f);
530 ip6f->ip6f_uses = 0;
531 ip6f->ip6f_dropped = 0;
532 ip6f->ip6f_forwarded = 0;
534 rtcache_unref(rt, &ip6f->ip6f_ro);
560 struct ip6flow *ip6f;
588 ip6f = ip6flow_lookup(ip6);
589 if (ip6f == NULL) {
591 ip6f = ip6flow_reap_locked(1);
593 ip6f = pool_get(&ip6flow_pool, PR_NOWAIT);
594 if (ip6f == NULL)
598 memset(ip6f, 0, sizeof(*ip6f));
600 IP6FLOW_REMOVE(ip6f->ip6f_hashidx, ip6f);
602 ip6flow_addstats(ip6f);
603 rtcache_free(&ip6f->ip6f_ro);
604 ip6f->ip6f_uses = 0;
605 ip6f->ip6f_last_uses = 0;
606 ip6f->ip6f_dropped = 0;
607 ip6f->ip6f_forwarded = 0;
613 rtcache_copy(&ip6f->ip6f_ro, ro);
614 ip6f->ip6f_dst = ip6->ip6_dst;
615 ip6f->ip6f_src = ip6->ip6_src;
616 ip6f->ip6f_flow = ip6->ip6_flow;
617 PRT_SLOW_ARM(ip6f->ip6f_timer, IP6FLOW_TIMER);
623 IP6FLOW_INSERT(hash, ip6f);
637 struct ip6flow *ip6f, *next_ip6f;
644 for (ip6f = TAILQ_FIRST(&ip6flowlist); ip6f != NULL; ip6f = next_ip6f) {
645 next_ip6f = TAILQ_NEXT(ip6f
646 ip6flow_free(ip6f);