Lines Matching full:rt
148 struct dn_route *rt = (struct dn_route *) dst; in dn_dst_destroy() local
150 if (rt->n) in dn_dst_destroy()
151 neigh_release(rt->n); in dn_dst_destroy()
158 struct dn_route *rt = (struct dn_route *) dst; in dn_dst_ifdown() local
159 struct neighbour *n = rt->n; in dn_dst_ifdown()
181 struct dn_route *rt; in dn_dst_check_expire() local
190 while ((rt = rcu_dereference_protected(*rtp, in dn_dst_check_expire()
192 if (atomic_read(&rt->dst.__refcnt) > 1 || in dn_dst_check_expire()
193 (now - rt->dst.lastuse) < expire) { in dn_dst_check_expire()
194 rtp = &rt->dn_next; in dn_dst_check_expire()
197 *rtp = rt->dn_next; in dn_dst_check_expire()
198 rt->dn_next = NULL; in dn_dst_check_expire()
199 dst_dev_put(&rt->dst); in dn_dst_check_expire()
200 dst_release(&rt->dst); in dn_dst_check_expire()
213 struct dn_route *rt; in dn_dst_gc() local
224 while ((rt = rcu_dereference_protected(*rtp, in dn_dst_gc()
226 if (atomic_read(&rt->dst.__refcnt) > 1 || in dn_dst_gc()
227 (now - rt->dst.lastuse) < expire) { in dn_dst_gc()
228 rtp = &rt->dn_next; in dn_dst_gc()
231 *rtp = rt->dn_next; in dn_dst_gc()
232 rt->dn_next = NULL; in dn_dst_gc()
233 dst_dev_put(&rt->dst); in dn_dst_gc()
234 dst_release(&rt->dst); in dn_dst_gc()
256 struct dn_route *rt = (struct dn_route *) dst; in dn_dst_update_pmtu() local
257 struct neighbour *n = rt->n; in dn_dst_update_pmtu()
315 static int dn_insert_route(struct dn_route *rt, unsigned int hash, struct dn_route **rp) in dn_insert_route() argument
326 if (compare_keys(&rth->fld, &rt->fld)) { in dn_insert_route()
336 dst_release_immediate(&rt->dst); in dn_insert_route()
343 rcu_assign_pointer(rt->dn_next, dn_rt_hash_table[hash].chain); in dn_insert_route()
344 rcu_assign_pointer(dn_rt_hash_table[hash].chain, rt); in dn_insert_route()
346 dst_hold_and_use(&rt->dst, now); in dn_insert_route()
348 *rp = rt; in dn_insert_route()
355 struct dn_route *rt, *next; in dn_run_flush() local
360 if ((rt = xchg((struct dn_route **)&dn_rt_hash_table[i].chain, NULL)) == NULL) in dn_run_flush()
363 for(; rt; rt = next) { in dn_run_flush()
364 next = rcu_dereference_raw(rt->dn_next); in dn_run_flush()
365 RCU_INIT_POINTER(rt->dn_next, NULL); in dn_run_flush()
366 dst_dev_put(&rt->dst); in dn_run_flush()
367 dst_release(&rt->dst); in dn_run_flush()
734 struct dn_route *rt = (struct dn_route *)dst; in dn_output() local
740 if (rt->n == NULL) in dn_output()
745 cb->src = rt->rt_saddr; in dn_output()
746 cb->dst = rt->rt_daddr; in dn_output()
774 struct dn_route *rt; in dn_forward() local
782 rt = (struct dn_route *)skb_dst(skb); in dn_forward()
784 if (skb_cow(skb, LL_RESERVED_SPACE(rt->dst.dev)+header_len)) in dn_forward()
793 skb->dev = rt->dst.dev; in dn_forward()
801 if (rt->rt_flags & RTCF_DOREDIRECT) in dn_forward()
860 static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res) in dn_rt_set_next_hop() argument
863 struct net_device *dev = rt->dst.dev; in dn_rt_set_next_hop()
870 rt->rt_gateway = DN_FIB_RES_GW(*res); in dn_rt_set_next_hop()
871 dst_init_metrics(&rt->dst, fi->fib_metrics, true); in dn_rt_set_next_hop()
873 rt->rt_type = res->type; in dn_rt_set_next_hop()
875 if (dev != NULL && rt->n == NULL) { in dn_rt_set_next_hop()
876 n = __neigh_lookup_errno(&dn_neigh_table, &rt->rt_gateway, dev); in dn_rt_set_next_hop()
879 rt->n = n; in dn_rt_set_next_hop()
882 if (dst_metric(&rt->dst, RTAX_MTU) > rt->dst.dev->mtu) in dn_rt_set_next_hop()
883 dst_metric_set(&rt->dst, RTAX_MTU, rt->dst.dev->mtu); in dn_rt_set_next_hop()
884 mss_metric = dst_metric_raw(&rt->dst, RTAX_ADVMSS); in dn_rt_set_next_hop()
886 unsigned int mss = dn_mss_from_pmtu(dev, dst_mtu(&rt->dst)); in dn_rt_set_next_hop()
888 dst_metric_set(&rt->dst, RTAX_ADVMSS, mss); in dn_rt_set_next_hop()
955 struct dn_route *rt = NULL; in dn_route_output_slow() local
1174 rt = dst_alloc(&dn_dst_ops, dev_out, 0, DST_OBSOLETE_NONE, DST_HOST); in dn_route_output_slow()
1175 if (rt == NULL) in dn_route_output_slow()
1178 rt->dn_next = NULL; in dn_route_output_slow()
1179 memset(&rt->fld, 0, sizeof(rt->fld)); in dn_route_output_slow()
1180 rt->fld.saddr = oldflp->saddr; in dn_route_output_slow()
1181 rt->fld.daddr = oldflp->daddr; in dn_route_output_slow()
1182 rt->fld.flowidn_oif = oldflp->flowidn_oif; in dn_route_output_slow()
1183 rt->fld.flowidn_iif = 0; in dn_route_output_slow()
1184 rt->fld.flowidn_mark = oldflp->flowidn_mark; in dn_route_output_slow()
1186 rt->rt_saddr = fld.saddr; in dn_route_output_slow()
1187 rt->rt_daddr = fld.daddr; in dn_route_output_slow()
1188 rt->rt_gateway = gateway ? gateway : fld.daddr; in dn_route_output_slow()
1189 rt->rt_local_src = fld.saddr; in dn_route_output_slow()
1191 rt->rt_dst_map = fld.daddr; in dn_route_output_slow()
1192 rt->rt_src_map = fld.saddr; in dn_route_output_slow()
1194 rt->n = neigh; in dn_route_output_slow()
1197 rt->dst.lastuse = jiffies; in dn_route_output_slow()
1198 rt->dst.output = dn_output; in dn_route_output_slow()
1199 rt->dst.input = dn_rt_bug; in dn_route_output_slow()
1200 rt->rt_flags = flags; in dn_route_output_slow()
1202 rt->dst.input = dn_nsp_rx; in dn_route_output_slow()
1204 err = dn_rt_set_next_hop(rt, &res); in dn_route_output_slow()
1208 hash = dn_hash(rt->fld.saddr, rt->fld.daddr); in dn_route_output_slow()
1210 dn_insert_route(rt, hash, (struct dn_route **)pprt); in dn_route_output_slow()
1232 dst_release_immediate(&rt->dst); in dn_route_output_slow()
1243 struct dn_route *rt = NULL; in __dn_route_output_key() local
1247 for (rt = rcu_dereference_bh(dn_rt_hash_table[hash].chain); rt; in __dn_route_output_key()
1248 rt = rcu_dereference_bh(rt->dn_next)) { in __dn_route_output_key()
1249 if ((flp->daddr == rt->fld.daddr) && in __dn_route_output_key()
1250 (flp->saddr == rt->fld.saddr) && in __dn_route_output_key()
1251 (flp->flowidn_mark == rt->fld.flowidn_mark) && in __dn_route_output_key()
1252 dn_is_output_route(rt) && in __dn_route_output_key()
1253 (rt->fld.flowidn_oif == flp->flowidn_oif)) { in __dn_route_output_key()
1254 dst_hold_and_use(&rt->dst, jiffies); in __dn_route_output_key()
1256 *pprt = &rt->dst; in __dn_route_output_key()
1300 struct dn_route *rt = NULL; in dn_route_input_slow() local
1440 rt = dst_alloc(&dn_dst_ops, out_dev, 1, DST_OBSOLETE_NONE, DST_HOST); in dn_route_input_slow()
1441 if (rt == NULL) in dn_route_input_slow()
1444 rt->dn_next = NULL; in dn_route_input_slow()
1445 memset(&rt->fld, 0, sizeof(rt->fld)); in dn_route_input_slow()
1446 rt->rt_saddr = fld.saddr; in dn_route_input_slow()
1447 rt->rt_daddr = fld.daddr; in dn_route_input_slow()
1448 rt->rt_gateway = fld.daddr; in dn_route_input_slow()
1450 rt->rt_gateway = gateway; in dn_route_input_slow()
1451 rt->rt_local_src = local_src ? local_src : rt->rt_saddr; in dn_route_input_slow()
1453 rt->rt_dst_map = fld.daddr; in dn_route_input_slow()
1454 rt->rt_src_map = fld.saddr; in dn_route_input_slow()
1456 rt->fld.saddr = cb->src; in dn_route_input_slow()
1457 rt->fld.daddr = cb->dst; in dn_route_input_slow()
1458 rt->fld.flowidn_oif = 0; in dn_route_input_slow()
1459 rt->fld.flowidn_iif = in_dev->ifindex; in dn_route_input_slow()
1460 rt->fld.flowidn_mark = fld.flowidn_mark; in dn_route_input_slow()
1462 rt->n = neigh; in dn_route_input_slow()
1463 rt->dst.lastuse = jiffies; in dn_route_input_slow()
1464 rt->dst.output = dn_rt_bug_out; in dn_route_input_slow()
1467 rt->dst.input = dn_forward; in dn_route_input_slow()
1470 rt->dst.output = dn_output; in dn_route_input_slow()
1471 rt->dst.input = dn_nsp_rx; in dn_route_input_slow()
1472 rt->dst.dev = in_dev; in dn_route_input_slow()
1478 rt->dst.input = dst_discard; in dn_route_input_slow()
1480 rt->rt_flags = flags; in dn_route_input_slow()
1482 err = dn_rt_set_next_hop(rt, &res); in dn_route_input_slow()
1486 hash = dn_hash(rt->fld.saddr, rt->fld.daddr); in dn_route_input_slow()
1488 dn_insert_route(rt, hash, &rt); in dn_route_input_slow()
1489 skb_dst_set(skb, &rt->dst); in dn_route_input_slow()
1511 dst_release_immediate(&rt->dst); in dn_route_input_slow()
1517 struct dn_route *rt; in dn_route_input() local
1525 for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt != NULL; in dn_route_input()
1526 rt = rcu_dereference(rt->dn_next)) { in dn_route_input()
1527 if ((rt->fld.saddr == cb->src) && in dn_route_input()
1528 (rt->fld.daddr == cb->dst) && in dn_route_input()
1529 (rt->fld.flowidn_oif == 0) && in dn_route_input()
1530 (rt->fld.flowidn_mark == skb->mark) && in dn_route_input()
1531 (rt->fld.flowidn_iif == cb->iif)) { in dn_route_input()
1532 dst_hold_and_use(&rt->dst, jiffies); in dn_route_input()
1534 skb_dst_set(skb, (struct dst_entry *)rt); in dn_route_input()
1546 struct dn_route *rt = (struct dn_route *)skb_dst(skb); in dn_rt_fill_info() local
1561 r->rtm_type = rt->rt_type; in dn_rt_fill_info()
1562 r->rtm_flags = (rt->rt_flags & ~0xFFFF) | RTM_F_CLONED; in dn_rt_fill_info()
1566 if (rt->rt_flags & RTCF_NOTIFY) in dn_rt_fill_info()
1570 nla_put_le16(skb, RTA_DST, rt->rt_daddr) < 0) in dn_rt_fill_info()
1573 if (rt->fld.saddr) { in dn_rt_fill_info()
1575 if (nla_put_le16(skb, RTA_SRC, rt->fld.saddr) < 0) in dn_rt_fill_info()
1578 if (rt->dst.dev && in dn_rt_fill_info()
1579 nla_put_u32(skb, RTA_OIF, rt->dst.dev->ifindex) < 0) in dn_rt_fill_info()
1587 if (nla_put_le16(skb, RTA_PREFSRC, rt->rt_local_src) < 0) in dn_rt_fill_info()
1590 if (rt->rt_daddr != rt->rt_gateway && in dn_rt_fill_info()
1591 nla_put_le16(skb, RTA_GATEWAY, rt->rt_gateway) < 0) in dn_rt_fill_info()
1594 if (rtnetlink_put_metrics(skb, dst_metrics_ptr(&rt->dst)) < 0) in dn_rt_fill_info()
1597 expires = rt->dst.expires ? rt->dst.expires - jiffies : 0; in dn_rt_fill_info()
1598 if (rtnl_put_cacheinfo(skb, &rt->dst, 0, expires, in dn_rt_fill_info()
1599 rt->dst.error) < 0) in dn_rt_fill_info()
1602 if (dn_is_input_route(rt) && in dn_rt_fill_info()
1603 nla_put_u32(skb, RTA_IIF, rt->fld.flowidn_iif) < 0) in dn_rt_fill_info()
1636 struct dn_route *rt = NULL; in dn_cache_getroute() local
1684 rt = (struct dn_route *)skb_dst(skb); in dn_cache_getroute()
1685 if (!err && -rt->dst.error) in dn_cache_getroute()
1686 err = rt->dst.error; in dn_cache_getroute()
1691 err = dn_route_output_key((struct dst_entry **)&rt, &fld, 0); in dn_cache_getroute()
1697 skb_dst_set(skb, &rt->dst); in dn_cache_getroute()
1699 rt->rt_flags |= RTCF_NOTIFY; in dn_cache_getroute()
1721 struct dn_route *rt; in dn_cache_dump() local
1744 for(rt = rcu_dereference_bh(dn_rt_hash_table[h].chain), idx = 0; in dn_cache_dump()
1745 rt; in dn_cache_dump()
1746 rt = rcu_dereference_bh(rt->dn_next), idx++) { in dn_cache_dump()
1749 skb_dst_set(skb, dst_clone(&rt->dst)); in dn_cache_dump()
1775 struct dn_route *rt = NULL; in dn_rt_cache_get_first() local
1780 rt = rcu_dereference_bh(dn_rt_hash_table[s->bucket].chain); in dn_rt_cache_get_first()
1781 if (rt) in dn_rt_cache_get_first()
1785 return rt; in dn_rt_cache_get_first()
1788 static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_route *rt) in dn_rt_cache_get_next() argument
1792 rt = rcu_dereference_bh(rt->dn_next); in dn_rt_cache_get_next()
1793 while (!rt) { in dn_rt_cache_get_next()
1798 rt = rcu_dereference_bh(dn_rt_hash_table[s->bucket].chain); in dn_rt_cache_get_next()
1800 return rt; in dn_rt_cache_get_next()
1805 struct dn_route *rt = dn_rt_cache_get_first(seq); in dn_rt_cache_seq_start() local
1807 if (rt) { in dn_rt_cache_seq_start()
1808 while(*pos && (rt = dn_rt_cache_get_next(seq, rt))) in dn_rt_cache_seq_start()
1811 return *pos ? NULL : rt; in dn_rt_cache_seq_start()
1816 struct dn_route *rt = dn_rt_cache_get_next(seq, v); in dn_rt_cache_seq_next() local
1818 return rt; in dn_rt_cache_seq_next()
1829 struct dn_route *rt = v; in dn_rt_cache_seq_show() local
1833 rt->dst.dev ? rt->dst.dev->name : "*", in dn_rt_cache_seq_show()
1834 dn_addr2asc(le16_to_cpu(rt->rt_daddr), buf1), in dn_rt_cache_seq_show()
1835 dn_addr2asc(le16_to_cpu(rt->rt_saddr), buf2), in dn_rt_cache_seq_show()
1836 atomic_read(&rt->dst.__refcnt), in dn_rt_cache_seq_show()
1837 rt->dst.__use, 0); in dn_rt_cache_seq_show()