Lines Matching refs:rt
149 struct dn_route *rt = (struct dn_route *) dst; in dn_dst_destroy() local
151 if (rt->n) in dn_dst_destroy()
152 neigh_release(rt->n); in dn_dst_destroy()
159 struct dn_route *rt = (struct dn_route *) dst; in dn_dst_ifdown() local
160 struct neighbour *n = rt->n; in dn_dst_ifdown()
182 struct dn_route *rt; in dn_dst_check_expire() local
191 while ((rt = rcu_dereference_protected(*rtp, in dn_dst_check_expire()
193 if (atomic_read(&rt->dst.__refcnt) > 1 || in dn_dst_check_expire()
194 (now - rt->dst.lastuse) < expire) { in dn_dst_check_expire()
195 rtp = &rt->dn_next; in dn_dst_check_expire()
198 *rtp = rt->dn_next; in dn_dst_check_expire()
199 rt->dn_next = NULL; in dn_dst_check_expire()
200 dst_dev_put(&rt->dst); in dn_dst_check_expire()
201 dst_release(&rt->dst); in dn_dst_check_expire()
214 struct dn_route *rt; in dn_dst_gc() local
225 while ((rt = rcu_dereference_protected(*rtp, in dn_dst_gc()
227 if (atomic_read(&rt->dst.__refcnt) > 1 || in dn_dst_gc()
228 (now - rt->dst.lastuse) < expire) { in dn_dst_gc()
229 rtp = &rt->dn_next; in dn_dst_gc()
232 *rtp = rt->dn_next; in dn_dst_gc()
233 rt->dn_next = NULL; in dn_dst_gc()
234 dst_dev_put(&rt->dst); in dn_dst_gc()
235 dst_release(&rt->dst); in dn_dst_gc()
258 struct dn_route *rt = (struct dn_route *) dst; in dn_dst_update_pmtu() local
259 struct neighbour *n = rt->n; in dn_dst_update_pmtu()
317 static int dn_insert_route(struct dn_route *rt, unsigned int hash, struct dn_route **rp) in dn_insert_route() argument
328 if (compare_keys(&rth->fld, &rt->fld)) { in dn_insert_route()
338 dst_release_immediate(&rt->dst); in dn_insert_route()
345 rcu_assign_pointer(rt->dn_next, dn_rt_hash_table[hash].chain); in dn_insert_route()
346 rcu_assign_pointer(dn_rt_hash_table[hash].chain, rt); in dn_insert_route()
348 dst_hold_and_use(&rt->dst, now); in dn_insert_route()
350 *rp = rt; in dn_insert_route()
357 struct dn_route *rt, *next; in dn_run_flush() local
362 if ((rt = xchg((struct dn_route **)&dn_rt_hash_table[i].chain, NULL)) == NULL) in dn_run_flush()
365 for(; rt; rt = next) { in dn_run_flush()
366 next = rcu_dereference_raw(rt->dn_next); in dn_run_flush()
367 RCU_INIT_POINTER(rt->dn_next, NULL); in dn_run_flush()
368 dst_dev_put(&rt->dst); in dn_run_flush()
369 dst_release(&rt->dst); in dn_run_flush()
738 struct dn_route *rt = (struct dn_route *)dst; in dn_output() local
744 if (rt->n == NULL) in dn_output()
749 cb->src = rt->rt_saddr; in dn_output()
750 cb->dst = rt->rt_daddr; in dn_output()
778 struct dn_route *rt; in dn_forward() local
786 rt = (struct dn_route *)skb_dst(skb); in dn_forward()
788 if (skb_cow(skb, LL_RESERVED_SPACE(rt->dst.dev)+header_len)) in dn_forward()
797 skb->dev = rt->dst.dev; in dn_forward()
805 if (rt->rt_flags & RTCF_DOREDIRECT) in dn_forward()
864 static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res) in dn_rt_set_next_hop() argument
867 struct net_device *dev = rt->dst.dev; in dn_rt_set_next_hop()
874 rt->rt_gateway = DN_FIB_RES_GW(*res); in dn_rt_set_next_hop()
875 dst_init_metrics(&rt->dst, fi->fib_metrics, true); in dn_rt_set_next_hop()
877 rt->rt_type = res->type; in dn_rt_set_next_hop()
879 if (dev != NULL && rt->n == NULL) { in dn_rt_set_next_hop()
880 n = __neigh_lookup_errno(&dn_neigh_table, &rt->rt_gateway, dev); in dn_rt_set_next_hop()
883 rt->n = n; in dn_rt_set_next_hop()
886 if (dst_metric(&rt->dst, RTAX_MTU) > rt->dst.dev->mtu) in dn_rt_set_next_hop()
887 dst_metric_set(&rt->dst, RTAX_MTU, rt->dst.dev->mtu); in dn_rt_set_next_hop()
888 mss_metric = dst_metric_raw(&rt->dst, RTAX_ADVMSS); in dn_rt_set_next_hop()
890 unsigned int mss = dn_mss_from_pmtu(dev, dst_mtu(&rt->dst)); in dn_rt_set_next_hop()
892 dst_metric_set(&rt->dst, RTAX_ADVMSS, mss); in dn_rt_set_next_hop()
959 struct dn_route *rt = NULL; in dn_route_output_slow() local
1178 rt = dst_alloc(&dn_dst_ops, dev_out, 0, DST_OBSOLETE_NONE, 0); in dn_route_output_slow()
1179 if (rt == NULL) in dn_route_output_slow()
1182 rt->dn_next = NULL; in dn_route_output_slow()
1183 memset(&rt->fld, 0, sizeof(rt->fld)); in dn_route_output_slow()
1184 rt->fld.saddr = oldflp->saddr; in dn_route_output_slow()
1185 rt->fld.daddr = oldflp->daddr; in dn_route_output_slow()
1186 rt->fld.flowidn_oif = oldflp->flowidn_oif; in dn_route_output_slow()
1187 rt->fld.flowidn_iif = 0; in dn_route_output_slow()
1188 rt->fld.flowidn_mark = oldflp->flowidn_mark; in dn_route_output_slow()
1190 rt->rt_saddr = fld.saddr; in dn_route_output_slow()
1191 rt->rt_daddr = fld.daddr; in dn_route_output_slow()
1192 rt->rt_gateway = gateway ? gateway : fld.daddr; in dn_route_output_slow()
1193 rt->rt_local_src = fld.saddr; in dn_route_output_slow()
1195 rt->rt_dst_map = fld.daddr; in dn_route_output_slow()
1196 rt->rt_src_map = fld.saddr; in dn_route_output_slow()
1198 rt->n = neigh; in dn_route_output_slow()
1201 rt->dst.lastuse = jiffies; in dn_route_output_slow()
1202 rt->dst.output = dn_output; in dn_route_output_slow()
1203 rt->dst.input = dn_rt_bug; in dn_route_output_slow()
1204 rt->rt_flags = flags; in dn_route_output_slow()
1206 rt->dst.input = dn_nsp_rx; in dn_route_output_slow()
1208 err = dn_rt_set_next_hop(rt, &res); in dn_route_output_slow()
1212 hash = dn_hash(rt->fld.saddr, rt->fld.daddr); in dn_route_output_slow()
1214 dn_insert_route(rt, hash, (struct dn_route **)pprt); in dn_route_output_slow()
1236 dst_release_immediate(&rt->dst); in dn_route_output_slow()
1247 struct dn_route *rt = NULL; in __dn_route_output_key() local
1251 for (rt = rcu_dereference_bh(dn_rt_hash_table[hash].chain); rt; in __dn_route_output_key()
1252 rt = rcu_dereference_bh(rt->dn_next)) { in __dn_route_output_key()
1253 if ((flp->daddr == rt->fld.daddr) && in __dn_route_output_key()
1254 (flp->saddr == rt->fld.saddr) && in __dn_route_output_key()
1255 (flp->flowidn_mark == rt->fld.flowidn_mark) && in __dn_route_output_key()
1256 dn_is_output_route(rt) && in __dn_route_output_key()
1257 (rt->fld.flowidn_oif == flp->flowidn_oif)) { in __dn_route_output_key()
1258 dst_hold_and_use(&rt->dst, jiffies); in __dn_route_output_key()
1260 *pprt = &rt->dst; in __dn_route_output_key()
1304 struct dn_route *rt = NULL; in dn_route_input_slow() local
1444 rt = dst_alloc(&dn_dst_ops, out_dev, 1, DST_OBSOLETE_NONE, 0); in dn_route_input_slow()
1445 if (rt == NULL) in dn_route_input_slow()
1448 rt->dn_next = NULL; in dn_route_input_slow()
1449 memset(&rt->fld, 0, sizeof(rt->fld)); in dn_route_input_slow()
1450 rt->rt_saddr = fld.saddr; in dn_route_input_slow()
1451 rt->rt_daddr = fld.daddr; in dn_route_input_slow()
1452 rt->rt_gateway = fld.daddr; in dn_route_input_slow()
1454 rt->rt_gateway = gateway; in dn_route_input_slow()
1455 rt->rt_local_src = local_src ? local_src : rt->rt_saddr; in dn_route_input_slow()
1457 rt->rt_dst_map = fld.daddr; in dn_route_input_slow()
1458 rt->rt_src_map = fld.saddr; in dn_route_input_slow()
1460 rt->fld.saddr = cb->src; in dn_route_input_slow()
1461 rt->fld.daddr = cb->dst; in dn_route_input_slow()
1462 rt->fld.flowidn_oif = 0; in dn_route_input_slow()
1463 rt->fld.flowidn_iif = in_dev->ifindex; in dn_route_input_slow()
1464 rt->fld.flowidn_mark = fld.flowidn_mark; in dn_route_input_slow()
1466 rt->n = neigh; in dn_route_input_slow()
1467 rt->dst.lastuse = jiffies; in dn_route_input_slow()
1468 rt->dst.output = dn_rt_bug_out; in dn_route_input_slow()
1471 rt->dst.input = dn_forward; in dn_route_input_slow()
1474 rt->dst.output = dn_output; in dn_route_input_slow()
1475 rt->dst.input = dn_nsp_rx; in dn_route_input_slow()
1476 rt->dst.dev = in_dev; in dn_route_input_slow()
1482 rt->dst.input = dst_discard; in dn_route_input_slow()
1484 rt->rt_flags = flags; in dn_route_input_slow()
1486 err = dn_rt_set_next_hop(rt, &res); in dn_route_input_slow()
1490 hash = dn_hash(rt->fld.saddr, rt->fld.daddr); in dn_route_input_slow()
1492 dn_insert_route(rt, hash, &rt); in dn_route_input_slow()
1493 skb_dst_set(skb, &rt->dst); in dn_route_input_slow()
1515 dst_release_immediate(&rt->dst); in dn_route_input_slow()
1521 struct dn_route *rt; in dn_route_input() local
1529 for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt != NULL; in dn_route_input()
1530 rt = rcu_dereference(rt->dn_next)) { in dn_route_input()
1531 if ((rt->fld.saddr == cb->src) && in dn_route_input()
1532 (rt->fld.daddr == cb->dst) && in dn_route_input()
1533 (rt->fld.flowidn_oif == 0) && in dn_route_input()
1534 (rt->fld.flowidn_mark == skb->mark) && in dn_route_input()
1535 (rt->fld.flowidn_iif == cb->iif)) { in dn_route_input()
1536 dst_hold_and_use(&rt->dst, jiffies); in dn_route_input()
1538 skb_dst_set(skb, (struct dst_entry *)rt); in dn_route_input()
1550 struct dn_route *rt = (struct dn_route *)skb_dst(skb); in dn_rt_fill_info() local
1565 r->rtm_type = rt->rt_type; in dn_rt_fill_info()
1566 r->rtm_flags = (rt->rt_flags & ~0xFFFF) | RTM_F_CLONED; in dn_rt_fill_info()
1570 if (rt->rt_flags & RTCF_NOTIFY) in dn_rt_fill_info()
1574 nla_put_le16(skb, RTA_DST, rt->rt_daddr) < 0) in dn_rt_fill_info()
1577 if (rt->fld.saddr) { in dn_rt_fill_info()
1579 if (nla_put_le16(skb, RTA_SRC, rt->fld.saddr) < 0) in dn_rt_fill_info()
1582 if (rt->dst.dev && in dn_rt_fill_info()
1583 nla_put_u32(skb, RTA_OIF, rt->dst.dev->ifindex) < 0) in dn_rt_fill_info()
1591 if (nla_put_le16(skb, RTA_PREFSRC, rt->rt_local_src) < 0) in dn_rt_fill_info()
1594 if (rt->rt_daddr != rt->rt_gateway && in dn_rt_fill_info()
1595 nla_put_le16(skb, RTA_GATEWAY, rt->rt_gateway) < 0) in dn_rt_fill_info()
1598 if (rtnetlink_put_metrics(skb, dst_metrics_ptr(&rt->dst)) < 0) in dn_rt_fill_info()
1601 expires = rt->dst.expires ? rt->dst.expires - jiffies : 0; in dn_rt_fill_info()
1602 if (rtnl_put_cacheinfo(skb, &rt->dst, 0, expires, in dn_rt_fill_info()
1603 rt->dst.error) < 0) in dn_rt_fill_info()
1606 if (dn_is_input_route(rt) && in dn_rt_fill_info()
1607 nla_put_u32(skb, RTA_IIF, rt->fld.flowidn_iif) < 0) in dn_rt_fill_info()
1640 struct dn_route *rt = NULL; in dn_cache_getroute() local
1688 rt = (struct dn_route *)skb_dst(skb); in dn_cache_getroute()
1689 if (!err && -rt->dst.error) in dn_cache_getroute()
1690 err = rt->dst.error; in dn_cache_getroute()
1695 err = dn_route_output_key((struct dst_entry **)&rt, &fld, 0); in dn_cache_getroute()
1701 skb_dst_set(skb, &rt->dst); in dn_cache_getroute()
1703 rt->rt_flags |= RTCF_NOTIFY; in dn_cache_getroute()
1725 struct dn_route *rt; in dn_cache_dump() local
1748 for(rt = rcu_dereference_bh(dn_rt_hash_table[h].chain), idx = 0; in dn_cache_dump()
1749 rt; in dn_cache_dump()
1750 rt = rcu_dereference_bh(rt->dn_next), idx++) { in dn_cache_dump()
1753 skb_dst_set(skb, dst_clone(&rt->dst)); in dn_cache_dump()
1779 struct dn_route *rt = NULL; in dn_rt_cache_get_first() local
1784 rt = rcu_dereference_bh(dn_rt_hash_table[s->bucket].chain); in dn_rt_cache_get_first()
1785 if (rt) in dn_rt_cache_get_first()
1789 return rt; in dn_rt_cache_get_first()
1792 static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_route *rt) in dn_rt_cache_get_next() argument
1796 rt = rcu_dereference_bh(rt->dn_next); in dn_rt_cache_get_next()
1797 while (!rt) { in dn_rt_cache_get_next()
1802 rt = rcu_dereference_bh(dn_rt_hash_table[s->bucket].chain); in dn_rt_cache_get_next()
1804 return rt; in dn_rt_cache_get_next()
1809 struct dn_route *rt = dn_rt_cache_get_first(seq); in dn_rt_cache_seq_start() local
1811 if (rt) { in dn_rt_cache_seq_start()
1812 while(*pos && (rt = dn_rt_cache_get_next(seq, rt))) in dn_rt_cache_seq_start()
1815 return *pos ? NULL : rt; in dn_rt_cache_seq_start()
1820 struct dn_route *rt = dn_rt_cache_get_next(seq, v); in dn_rt_cache_seq_next() local
1822 return rt; in dn_rt_cache_seq_next()
1833 struct dn_route *rt = v; in dn_rt_cache_seq_show() local
1837 rt->dst.dev ? rt->dst.dev->name : "*", in dn_rt_cache_seq_show()
1838 dn_addr2asc(le16_to_cpu(rt->rt_daddr), buf1), in dn_rt_cache_seq_show()
1839 dn_addr2asc(le16_to_cpu(rt->rt_saddr), buf2), in dn_rt_cache_seq_show()
1840 atomic_read(&rt->dst.__refcnt), in dn_rt_cache_seq_show()
1841 rt->dst.__use, 0); in dn_rt_cache_seq_show()