Lines Matching refs:rth
203 static int rt_intern_hash(unsigned hash, struct rtable *rth,
336 static __inline__ int rt_fast_clean(struct rtable *rth) in rt_fast_clean() argument
340 return (rth->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) && in rt_fast_clean()
341 rth->key.iif && rth->u.rt_next; in rt_fast_clean()
344 static __inline__ int rt_valuable(struct rtable *rth) in rt_valuable() argument
346 return (rth->rt_flags & (RTCF_REDIRECTED | RTCF_NOTIFY)) || in rt_valuable()
347 rth->u.dst.expires; in rt_valuable()
350 static __inline__ int rt_may_expire(struct rtable *rth, unsigned long tmo1, unsigned long tmo2) in rt_may_expire() argument
355 if (atomic_read(&rth->u.dst.__refcnt)) in rt_may_expire()
359 if (rth->u.dst.expires && in rt_may_expire()
360 time_after_eq(jiffies, rth->u.dst.expires)) in rt_may_expire()
363 age = jiffies - rth->u.dst.lastuse; in rt_may_expire()
365 if ((age <= tmo1 && !rt_fast_clean(rth)) || in rt_may_expire()
366 (age <= tmo2 && rt_valuable(rth))) in rt_may_expire()
398 struct rtable *rth, **rthp; in SMP_TIMER_NAME() local
409 while ((rth = *rthp) != NULL) { in SMP_TIMER_NAME()
410 if (rth->u.dst.expires) { in SMP_TIMER_NAME()
412 if (time_before_eq(now, rth->u.dst.expires)) { in SMP_TIMER_NAME()
414 rthp = &rth->u.rt_next; in SMP_TIMER_NAME()
417 } else if (!rt_may_expire(rth, tmo, ip_rt_gc_timeout)) { in SMP_TIMER_NAME()
419 rthp = &rth->u.rt_next; in SMP_TIMER_NAME()
424 *rthp = rth->u.rt_next; in SMP_TIMER_NAME()
425 rt_free(rth); in SMP_TIMER_NAME()
445 struct rtable *rth, *next; in SMP_TIMER_NAME() local
453 rth = rt_hash_table[i].chain; in SMP_TIMER_NAME()
454 if (rth) in SMP_TIMER_NAME()
458 for (; rth; rth = next) { in SMP_TIMER_NAME()
459 next = rth->u.rt_next; in SMP_TIMER_NAME()
460 rt_free(rth); in SMP_TIMER_NAME()
536 struct rtable *rth, **rthp; in rt_garbage_collect() local
589 while ((rth = *rthp) != NULL) { in rt_garbage_collect()
590 if (!rt_may_expire(rth, tmo, expire)) { in rt_garbage_collect()
592 rthp = &rth->u.rt_next; in rt_garbage_collect()
595 *rthp = rth->u.rt_next; in rt_garbage_collect()
596 rt_free(rth); in rt_garbage_collect()
653 struct rtable *rth, **rthp; in rt_intern_hash() local
670 while ((rth = *rthp) != NULL) { in rt_intern_hash()
671 if (memcmp(&rth->key, &rt->key, sizeof(rt->key)) == 0) { in rt_intern_hash()
673 *rthp = rth->u.rt_next; in rt_intern_hash()
674 rth->u.rt_next = rt_hash_table[hash].chain; in rt_intern_hash()
675 rt_hash_table[hash].chain = rth; in rt_intern_hash()
677 rth->u.dst.__use++; in rt_intern_hash()
678 dst_hold(&rth->u.dst); in rt_intern_hash()
679 rth->u.dst.lastuse = now; in rt_intern_hash()
683 *rp = rth; in rt_intern_hash()
687 if (!atomic_read(&rth->u.dst.__refcnt)) { in rt_intern_hash()
688 u32 score = rt_score(rth); in rt_intern_hash()
691 cand = rth; in rt_intern_hash()
699 rthp = &rth->u.rt_next; in rt_intern_hash()
846 struct rtable *rth, **rthp; in ip_rt_redirect() local
878 while ((rth = *rthp) != NULL) { in ip_rt_redirect()
881 if (rth->key.dst != daddr || in ip_rt_redirect()
882 rth->key.src != skeys[i] || in ip_rt_redirect()
883 rth->key.tos != tos || in ip_rt_redirect()
884 rth->key.oif != ikeys[k] || in ip_rt_redirect()
885 rth->key.iif != 0) { in ip_rt_redirect()
886 rthp = &rth->u.rt_next; in ip_rt_redirect()
890 if (rth->rt_dst != daddr || in ip_rt_redirect()
891 rth->rt_src != saddr || in ip_rt_redirect()
892 rth->u.dst.error || in ip_rt_redirect()
893 rth->rt_gateway != old_gw || in ip_rt_redirect()
894 rth->u.dst.dev != dev) in ip_rt_redirect()
897 dst_hold(&rth->u.dst); in ip_rt_redirect()
902 ip_rt_put(rth); in ip_rt_redirect()
908 *rt = *rth; in ip_rt_redirect()
924 dst_confirm(&rth->u.dst); in ip_rt_redirect()
934 ip_rt_put(rth); in ip_rt_redirect()
939 rt_del(hash, rth); in ip_rt_redirect()
1113 struct rtable *rth; in ip_rt_frag_needed() local
1126 for (rth = rt_hash_table[hash].chain; rth; in ip_rt_frag_needed()
1127 rth = rth->u.rt_next) { in ip_rt_frag_needed()
1128 if (rth->key.dst == daddr && in ip_rt_frag_needed()
1129 rth->key.src == skeys[i] && in ip_rt_frag_needed()
1130 rth->rt_dst == daddr && in ip_rt_frag_needed()
1131 rth->rt_src == iph->saddr && in ip_rt_frag_needed()
1132 rth->key.tos == tos && in ip_rt_frag_needed()
1133 rth->key.iif == 0 && in ip_rt_frag_needed()
1134 !(rth->u.dst.mxlock & (1 << RTAX_MTU))) { in ip_rt_frag_needed()
1141 old_mtu >= rth->u.dst.pmtu && in ip_rt_frag_needed()
1147 if (mtu <= rth->u.dst.pmtu) { in ip_rt_frag_needed()
1148 if (mtu < rth->u.dst.pmtu) { in ip_rt_frag_needed()
1149 dst_confirm(&rth->u.dst); in ip_rt_frag_needed()
1152 rth->u.dst.mxlock |= in ip_rt_frag_needed()
1155 rth->u.dst.pmtu = mtu; in ip_rt_frag_needed()
1156 dst_set_expires(&rth->u.dst, in ip_rt_frag_needed()
1309 struct rtable *rth; in ip_route_input_mc() local
1331 rth = dst_alloc(&ipv4_dst_ops); in ip_route_input_mc()
1332 if (!rth) in ip_route_input_mc()
1335 rth->u.dst.output= ip_rt_bug; in ip_route_input_mc()
1337 atomic_set(&rth->u.dst.__refcnt, 1); in ip_route_input_mc()
1338 rth->u.dst.flags= DST_HOST; in ip_route_input_mc()
1339 rth->key.dst = daddr; in ip_route_input_mc()
1340 rth->rt_dst = daddr; in ip_route_input_mc()
1341 rth->key.tos = tos; in ip_route_input_mc()
1343 rth->key.fwmark = skb->nfmark; in ip_route_input_mc()
1345 rth->key.src = saddr; in ip_route_input_mc()
1346 rth->rt_src = saddr; in ip_route_input_mc()
1348 rth->rt_dst_map = daddr; in ip_route_input_mc()
1349 rth->rt_src_map = saddr; in ip_route_input_mc()
1352 rth->u.dst.tclassid = itag; in ip_route_input_mc()
1354 rth->rt_iif = in ip_route_input_mc()
1355 rth->key.iif = dev->ifindex; in ip_route_input_mc()
1356 rth->u.dst.dev = &loopback_dev; in ip_route_input_mc()
1357 dev_hold(rth->u.dst.dev); in ip_route_input_mc()
1358 rth->key.oif = 0; in ip_route_input_mc()
1359 rth->rt_gateway = daddr; in ip_route_input_mc()
1360 rth->rt_spec_dst= spec_dst; in ip_route_input_mc()
1361 rth->rt_type = RTN_MULTICAST; in ip_route_input_mc()
1362 rth->rt_flags = RTCF_MULTICAST; in ip_route_input_mc()
1364 rth->u.dst.input= ip_local_deliver; in ip_route_input_mc()
1365 rth->rt_flags |= RTCF_LOCAL; in ip_route_input_mc()
1370 rth->u.dst.input = ip_mr_input; in ip_route_input_mc()
1376 return rt_intern_hash(hash, rth, (struct rtable**) &skb->dst); in ip_route_input_mc()
1406 struct rtable * rth; in ip_route_input_slow() local
1539 rth = dst_alloc(&ipv4_dst_ops); in ip_route_input_slow()
1540 if (!rth) in ip_route_input_slow()
1543 atomic_set(&rth->u.dst.__refcnt, 1); in ip_route_input_slow()
1544 rth->u.dst.flags= DST_HOST; in ip_route_input_slow()
1545 rth->key.dst = daddr; in ip_route_input_slow()
1546 rth->rt_dst = daddr; in ip_route_input_slow()
1547 rth->key.tos = tos; in ip_route_input_slow()
1549 rth->key.fwmark = skb->nfmark; in ip_route_input_slow()
1551 rth->key.src = saddr; in ip_route_input_slow()
1552 rth->rt_src = saddr; in ip_route_input_slow()
1553 rth->rt_gateway = daddr; in ip_route_input_slow()
1555 rth->rt_src_map = key.src; in ip_route_input_slow()
1556 rth->rt_dst_map = key.dst; in ip_route_input_slow()
1558 rth->rt_gateway = key.dst; in ip_route_input_slow()
1560 rth->rt_iif = in ip_route_input_slow()
1561 rth->key.iif = dev->ifindex; in ip_route_input_slow()
1562 rth->u.dst.dev = out_dev->dev; in ip_route_input_slow()
1563 dev_hold(rth->u.dst.dev); in ip_route_input_slow()
1564 rth->key.oif = 0; in ip_route_input_slow()
1565 rth->rt_spec_dst= spec_dst; in ip_route_input_slow()
1567 rth->u.dst.input = ip_forward; in ip_route_input_slow()
1568 rth->u.dst.output = ip_output; in ip_route_input_slow()
1570 rt_set_nexthop(rth, &res, itag); in ip_route_input_slow()
1572 rth->rt_flags = flags; in ip_route_input_slow()
1576 struct net_device *odev = rth->u.dst.dev; in ip_route_input_slow()
1580 dev->accept_fastpath(dev, &rth->u.dst) == 0) in ip_route_input_slow()
1581 rth->rt_flags |= RTCF_FAST; in ip_route_input_slow()
1586 err = rt_intern_hash(hash, rth, (struct rtable**)&skb->dst); in ip_route_input_slow()
1614 rth = dst_alloc(&ipv4_dst_ops); in ip_route_input_slow()
1615 if (!rth) in ip_route_input_slow()
1618 rth->u.dst.output= ip_rt_bug; in ip_route_input_slow()
1620 atomic_set(&rth->u.dst.__refcnt, 1); in ip_route_input_slow()
1621 rth->u.dst.flags= DST_HOST; in ip_route_input_slow()
1622 rth->key.dst = daddr; in ip_route_input_slow()
1623 rth->rt_dst = daddr; in ip_route_input_slow()
1624 rth->key.tos = tos; in ip_route_input_slow()
1626 rth->key.fwmark = skb->nfmark; in ip_route_input_slow()
1628 rth->key.src = saddr; in ip_route_input_slow()
1629 rth->rt_src = saddr; in ip_route_input_slow()
1631 rth->rt_dst_map = key.dst; in ip_route_input_slow()
1632 rth->rt_src_map = key.src; in ip_route_input_slow()
1635 rth->u.dst.tclassid = itag; in ip_route_input_slow()
1637 rth->rt_iif = in ip_route_input_slow()
1638 rth->key.iif = dev->ifindex; in ip_route_input_slow()
1639 rth->u.dst.dev = &loopback_dev; in ip_route_input_slow()
1640 dev_hold(rth->u.dst.dev); in ip_route_input_slow()
1641 rth->key.oif = 0; in ip_route_input_slow()
1642 rth->rt_gateway = daddr; in ip_route_input_slow()
1643 rth->rt_spec_dst= spec_dst; in ip_route_input_slow()
1644 rth->u.dst.input= ip_local_deliver; in ip_route_input_slow()
1645 rth->rt_flags = flags|RTCF_LOCAL; in ip_route_input_slow()
1647 rth->u.dst.input= ip_error; in ip_route_input_slow()
1648 rth->u.dst.error= -err; in ip_route_input_slow()
1649 rth->rt_flags &= ~RTCF_LOCAL; in ip_route_input_slow()
1651 rth->rt_type = res.type; in ip_route_input_slow()
1710 struct rtable * rth; in ip_route_input() local
1718 for (rth = rt_hash_table[hash].chain; rth; rth = rth->u.rt_next) { in ip_route_input()
1719 if (rth->key.dst == daddr && in ip_route_input()
1720 rth->key.src == saddr && in ip_route_input()
1721 rth->key.iif == iif && in ip_route_input()
1722 rth->key.oif == 0 && in ip_route_input()
1724 rth->key.fwmark == skb->nfmark && in ip_route_input()
1726 rth->key.tos == tos) { in ip_route_input()
1727 rth->u.dst.lastuse = jiffies; in ip_route_input()
1728 dst_hold(&rth->u.dst); in ip_route_input()
1729 rth->u.dst.__use++; in ip_route_input()
1732 skb->dst = (struct dst_entry*)rth; in ip_route_input()
1781 struct rtable *rth; in ip_route_output_slow() local
1994 rth = dst_alloc(&ipv4_dst_ops); in ip_route_output_slow()
1995 if (!rth) in ip_route_output_slow()
1998 atomic_set(&rth->u.dst.__refcnt, 1); in ip_route_output_slow()
1999 rth->u.dst.flags= DST_HOST; in ip_route_output_slow()
2000 rth->key.dst = oldkey->dst; in ip_route_output_slow()
2001 rth->key.tos = tos; in ip_route_output_slow()
2002 rth->key.src = oldkey->src; in ip_route_output_slow()
2003 rth->key.iif = 0; in ip_route_output_slow()
2004 rth->key.oif = oldkey->oif; in ip_route_output_slow()
2006 rth->key.fwmark = oldkey->fwmark; in ip_route_output_slow()
2008 rth->rt_dst = key.dst; in ip_route_output_slow()
2009 rth->rt_src = key.src; in ip_route_output_slow()
2011 rth->rt_dst_map = key.dst; in ip_route_output_slow()
2012 rth->rt_src_map = key.src; in ip_route_output_slow()
2014 rth->rt_iif = oldkey->oif ? : dev_out->ifindex; in ip_route_output_slow()
2015 rth->u.dst.dev = dev_out; in ip_route_output_slow()
2017 rth->rt_gateway = key.dst; in ip_route_output_slow()
2018 rth->rt_spec_dst= key.src; in ip_route_output_slow()
2020 rth->u.dst.output=ip_output; in ip_route_output_slow()
2025 rth->u.dst.input = ip_local_deliver; in ip_route_output_slow()
2026 rth->rt_spec_dst = key.dst; in ip_route_output_slow()
2029 rth->rt_spec_dst = key.src; in ip_route_output_slow()
2031 rth->u.dst.output = ip_mc_output; in ip_route_output_slow()
2040 rth->u.dst.input = ip_mr_input; in ip_route_output_slow()
2041 rth->u.dst.output = ip_mc_output; in ip_route_output_slow()
2049 rt_set_nexthop(rth, &res, 0); in ip_route_output_slow()
2051 rth->rt_flags = flags; in ip_route_output_slow()
2054 err = rt_intern_hash(hash, rth, rp); in ip_route_output_slow()
2073 struct rtable *rth; in ip_route_output_key() local
2078 for (rth = rt_hash_table[hash].chain; rth; rth = rth->u.rt_next) { in ip_route_output_key()
2079 if (rth->key.dst == key->dst && in ip_route_output_key()
2080 rth->key.src == key->src && in ip_route_output_key()
2081 rth->key.iif == 0 && in ip_route_output_key()
2082 rth->key.oif == key->oif && in ip_route_output_key()
2084 rth->key.fwmark == key->fwmark && in ip_route_output_key()
2086 !((rth->key.tos ^ key->tos) & in ip_route_output_key()
2088 rth->u.dst.lastuse = jiffies; in ip_route_output_key()
2089 dst_hold(&rth->u.dst); in ip_route_output_key()
2090 rth->u.dst.__use++; in ip_route_output_key()
2093 *rp = rth; in ip_route_output_key()