Lines Matching refs:rt
156 struct dn_route *rt = (struct dn_route *) dst; in dn_dst_destroy() local
158 if (rt->n) in dn_dst_destroy()
159 neigh_release(rt->n); in dn_dst_destroy()
166 struct dn_route *rt = (struct dn_route *) dst; in dn_dst_ifdown() local
167 struct neighbour *n = rt->n; in dn_dst_ifdown()
186 static inline void dnrt_free(struct dn_route *rt) in dnrt_free() argument
188 call_rcu_bh(&rt->dst.rcu_head, dst_rcu_free); in dnrt_free()
191 static inline void dnrt_drop(struct dn_route *rt) in dnrt_drop() argument
193 dst_release(&rt->dst); in dnrt_drop()
194 call_rcu_bh(&rt->dst.rcu_head, dst_rcu_free); in dnrt_drop()
200 struct dn_route *rt; in dn_dst_check_expire() local
209 while ((rt = rcu_dereference_protected(*rtp, in dn_dst_check_expire()
211 if (atomic_read(&rt->dst.__refcnt) || in dn_dst_check_expire()
212 (now - rt->dst.lastuse) < expire) { in dn_dst_check_expire()
213 rtp = &rt->dst.dn_next; in dn_dst_check_expire()
216 *rtp = rt->dst.dn_next; in dn_dst_check_expire()
217 rt->dst.dn_next = NULL; in dn_dst_check_expire()
218 dnrt_free(rt); in dn_dst_check_expire()
231 struct dn_route *rt; in dn_dst_gc() local
242 while ((rt = rcu_dereference_protected(*rtp, in dn_dst_gc()
244 if (atomic_read(&rt->dst.__refcnt) || in dn_dst_gc()
245 (now - rt->dst.lastuse) < expire) { in dn_dst_gc()
246 rtp = &rt->dst.dn_next; in dn_dst_gc()
249 *rtp = rt->dst.dn_next; in dn_dst_gc()
250 rt->dst.dn_next = NULL; in dn_dst_gc()
251 dnrt_drop(rt); in dn_dst_gc()
273 struct dn_route *rt = (struct dn_route *) dst; in dn_dst_update_pmtu() local
274 struct neighbour *n = rt->n; in dn_dst_update_pmtu()
332 static int dn_insert_route(struct dn_route *rt, unsigned int hash, struct dn_route **rp) in dn_insert_route() argument
343 if (compare_keys(&rth->fld, &rt->fld)) { in dn_insert_route()
353 dnrt_drop(rt); in dn_insert_route()
360 rcu_assign_pointer(rt->dst.dn_next, dn_rt_hash_table[hash].chain); in dn_insert_route()
361 rcu_assign_pointer(dn_rt_hash_table[hash].chain, rt); in dn_insert_route()
363 dst_use(&rt->dst, now); in dn_insert_route()
365 *rp = rt; in dn_insert_route()
372 struct dn_route *rt, *next; in dn_run_flush() local
377 if ((rt = xchg((struct dn_route **)&dn_rt_hash_table[i].chain, NULL)) == NULL) in dn_run_flush()
380 for(; rt; rt = next) { in dn_run_flush()
381 next = rcu_dereference_raw(rt->dst.dn_next); in dn_run_flush()
382 RCU_INIT_POINTER(rt->dst.dn_next, NULL); in dn_run_flush()
383 dst_free((struct dst_entry *)rt); in dn_run_flush()
750 struct dn_route *rt = (struct dn_route *)dst; in dn_output() local
756 if (rt->n == NULL) in dn_output()
761 cb->src = rt->rt_saddr; in dn_output()
762 cb->dst = rt->rt_daddr; in dn_output()
790 struct dn_route *rt; in dn_forward() local
800 rt = (struct dn_route *)skb_dst(skb); in dn_forward()
802 if (skb_cow(skb, LL_RESERVED_SPACE(rt->dst.dev)+header_len)) in dn_forward()
811 skb->dev = rt->dst.dev; in dn_forward()
819 if (rt->rt_flags & RTCF_DOREDIRECT) in dn_forward()
878 static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res) in dn_rt_set_next_hop() argument
881 struct net_device *dev = rt->dst.dev; in dn_rt_set_next_hop()
888 rt->rt_gateway = DN_FIB_RES_GW(*res); in dn_rt_set_next_hop()
889 dst_init_metrics(&rt->dst, fi->fib_metrics, true); in dn_rt_set_next_hop()
891 rt->rt_type = res->type; in dn_rt_set_next_hop()
893 if (dev != NULL && rt->n == NULL) { in dn_rt_set_next_hop()
894 n = __neigh_lookup_errno(&dn_neigh_table, &rt->rt_gateway, dev); in dn_rt_set_next_hop()
897 rt->n = n; in dn_rt_set_next_hop()
900 if (dst_metric(&rt->dst, RTAX_MTU) > rt->dst.dev->mtu) in dn_rt_set_next_hop()
901 dst_metric_set(&rt->dst, RTAX_MTU, rt->dst.dev->mtu); in dn_rt_set_next_hop()
902 mss_metric = dst_metric_raw(&rt->dst, RTAX_ADVMSS); in dn_rt_set_next_hop()
904 unsigned int mss = dn_mss_from_pmtu(dev, dst_mtu(&rt->dst)); in dn_rt_set_next_hop()
906 dst_metric_set(&rt->dst, RTAX_ADVMSS, mss); in dn_rt_set_next_hop()
973 struct dn_route *rt = NULL; in dn_route_output_slow() local
1185 rt = dst_alloc(&dn_dst_ops, dev_out, 1, DST_OBSOLETE_NONE, DST_HOST); in dn_route_output_slow()
1186 if (rt == NULL) in dn_route_output_slow()
1189 memset(&rt->fld, 0, sizeof(rt->fld)); in dn_route_output_slow()
1190 rt->fld.saddr = oldflp->saddr; in dn_route_output_slow()
1191 rt->fld.daddr = oldflp->daddr; in dn_route_output_slow()
1192 rt->fld.flowidn_oif = oldflp->flowidn_oif; in dn_route_output_slow()
1193 rt->fld.flowidn_iif = 0; in dn_route_output_slow()
1194 rt->fld.flowidn_mark = oldflp->flowidn_mark; in dn_route_output_slow()
1196 rt->rt_saddr = fld.saddr; in dn_route_output_slow()
1197 rt->rt_daddr = fld.daddr; in dn_route_output_slow()
1198 rt->rt_gateway = gateway ? gateway : fld.daddr; in dn_route_output_slow()
1199 rt->rt_local_src = fld.saddr; in dn_route_output_slow()
1201 rt->rt_dst_map = fld.daddr; in dn_route_output_slow()
1202 rt->rt_src_map = fld.saddr; in dn_route_output_slow()
1204 rt->n = neigh; in dn_route_output_slow()
1207 rt->dst.lastuse = jiffies; in dn_route_output_slow()
1208 rt->dst.output = dn_output; in dn_route_output_slow()
1209 rt->dst.input = dn_rt_bug; in dn_route_output_slow()
1210 rt->rt_flags = flags; in dn_route_output_slow()
1212 rt->dst.input = dn_nsp_rx; in dn_route_output_slow()
1214 err = dn_rt_set_next_hop(rt, &res); in dn_route_output_slow()
1218 hash = dn_hash(rt->fld.saddr, rt->fld.daddr); in dn_route_output_slow()
1219 dn_insert_route(rt, hash, (struct dn_route **)pprt); in dn_route_output_slow()
1241 dst_free(&rt->dst); in dn_route_output_slow()
1252 struct dn_route *rt = NULL; in __dn_route_output_key() local
1256 for (rt = rcu_dereference_bh(dn_rt_hash_table[hash].chain); rt; in __dn_route_output_key()
1257 rt = rcu_dereference_bh(rt->dst.dn_next)) { in __dn_route_output_key()
1258 if ((flp->daddr == rt->fld.daddr) && in __dn_route_output_key()
1259 (flp->saddr == rt->fld.saddr) && in __dn_route_output_key()
1260 (flp->flowidn_mark == rt->fld.flowidn_mark) && in __dn_route_output_key()
1261 dn_is_output_route(rt) && in __dn_route_output_key()
1262 (rt->fld.flowidn_oif == flp->flowidn_oif)) { in __dn_route_output_key()
1263 dst_use(&rt->dst, jiffies); in __dn_route_output_key()
1265 *pprt = &rt->dst; in __dn_route_output_key()
1309 struct dn_route *rt = NULL; in dn_route_input_slow() local
1449 rt = dst_alloc(&dn_dst_ops, out_dev, 0, DST_OBSOLETE_NONE, DST_HOST); in dn_route_input_slow()
1450 if (rt == NULL) in dn_route_input_slow()
1453 memset(&rt->fld, 0, sizeof(rt->fld)); in dn_route_input_slow()
1454 rt->rt_saddr = fld.saddr; in dn_route_input_slow()
1455 rt->rt_daddr = fld.daddr; in dn_route_input_slow()
1456 rt->rt_gateway = fld.daddr; in dn_route_input_slow()
1458 rt->rt_gateway = gateway; in dn_route_input_slow()
1459 rt->rt_local_src = local_src ? local_src : rt->rt_saddr; in dn_route_input_slow()
1461 rt->rt_dst_map = fld.daddr; in dn_route_input_slow()
1462 rt->rt_src_map = fld.saddr; in dn_route_input_slow()
1464 rt->fld.saddr = cb->src; in dn_route_input_slow()
1465 rt->fld.daddr = cb->dst; in dn_route_input_slow()
1466 rt->fld.flowidn_oif = 0; in dn_route_input_slow()
1467 rt->fld.flowidn_iif = in_dev->ifindex; in dn_route_input_slow()
1468 rt->fld.flowidn_mark = fld.flowidn_mark; in dn_route_input_slow()
1470 rt->n = neigh; in dn_route_input_slow()
1471 rt->dst.lastuse = jiffies; in dn_route_input_slow()
1472 rt->dst.output = dn_rt_bug_sk; in dn_route_input_slow()
1475 rt->dst.input = dn_forward; in dn_route_input_slow()
1478 rt->dst.output = dn_output; in dn_route_input_slow()
1479 rt->dst.input = dn_nsp_rx; in dn_route_input_slow()
1480 rt->dst.dev = in_dev; in dn_route_input_slow()
1486 rt->dst.input = dst_discard; in dn_route_input_slow()
1488 rt->rt_flags = flags; in dn_route_input_slow()
1490 err = dn_rt_set_next_hop(rt, &res); in dn_route_input_slow()
1494 hash = dn_hash(rt->fld.saddr, rt->fld.daddr); in dn_route_input_slow()
1495 dn_insert_route(rt, hash, &rt); in dn_route_input_slow()
1496 skb_dst_set(skb, &rt->dst); in dn_route_input_slow()
1518 dst_free(&rt->dst); in dn_route_input_slow()
1524 struct dn_route *rt; in dn_route_input() local
1532 for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt != NULL; in dn_route_input()
1533 rt = rcu_dereference(rt->dst.dn_next)) { in dn_route_input()
1534 if ((rt->fld.saddr == cb->src) && in dn_route_input()
1535 (rt->fld.daddr == cb->dst) && in dn_route_input()
1536 (rt->fld.flowidn_oif == 0) && in dn_route_input()
1537 (rt->fld.flowidn_mark == skb->mark) && in dn_route_input()
1538 (rt->fld.flowidn_iif == cb->iif)) { in dn_route_input()
1539 dst_use(&rt->dst, jiffies); in dn_route_input()
1541 skb_dst_set(skb, (struct dst_entry *)rt); in dn_route_input()
1553 struct dn_route *rt = (struct dn_route *)skb_dst(skb); in dn_rt_fill_info() local
1568 r->rtm_type = rt->rt_type; in dn_rt_fill_info()
1569 r->rtm_flags = (rt->rt_flags & ~0xFFFF) | RTM_F_CLONED; in dn_rt_fill_info()
1573 if (rt->rt_flags & RTCF_NOTIFY) in dn_rt_fill_info()
1577 nla_put_le16(skb, RTA_DST, rt->rt_daddr) < 0) in dn_rt_fill_info()
1580 if (rt->fld.saddr) { in dn_rt_fill_info()
1582 if (nla_put_le16(skb, RTA_SRC, rt->fld.saddr) < 0) in dn_rt_fill_info()
1585 if (rt->dst.dev && in dn_rt_fill_info()
1586 nla_put_u32(skb, RTA_OIF, rt->dst.dev->ifindex) < 0) in dn_rt_fill_info()
1594 if (nla_put_le16(skb, RTA_PREFSRC, rt->rt_local_src) < 0) in dn_rt_fill_info()
1597 if (rt->rt_daddr != rt->rt_gateway && in dn_rt_fill_info()
1598 nla_put_le16(skb, RTA_GATEWAY, rt->rt_gateway) < 0) in dn_rt_fill_info()
1601 if (rtnetlink_put_metrics(skb, dst_metrics_ptr(&rt->dst)) < 0) in dn_rt_fill_info()
1604 expires = rt->dst.expires ? rt->dst.expires - jiffies : 0; in dn_rt_fill_info()
1605 if (rtnl_put_cacheinfo(skb, &rt->dst, 0, expires, in dn_rt_fill_info()
1606 rt->dst.error) < 0) in dn_rt_fill_info()
1609 if (dn_is_input_route(rt) && in dn_rt_fill_info()
1610 nla_put_u32(skb, RTA_IIF, rt->fld.flowidn_iif) < 0) in dn_rt_fill_info()
1642 struct dn_route *rt = NULL; in dn_cache_getroute() local
1689 rt = (struct dn_route *)skb_dst(skb); in dn_cache_getroute()
1690 if (!err && -rt->dst.error) in dn_cache_getroute()
1691 err = rt->dst.error; in dn_cache_getroute()
1696 err = dn_route_output_key((struct dst_entry **)&rt, &fld, 0); in dn_cache_getroute()
1702 skb_dst_set(skb, &rt->dst); in dn_cache_getroute()
1704 rt->rt_flags |= RTCF_NOTIFY; in dn_cache_getroute()
1726 struct dn_route *rt; in dn_cache_dump() local
1749 for(rt = rcu_dereference_bh(dn_rt_hash_table[h].chain), idx = 0; in dn_cache_dump()
1750 rt; in dn_cache_dump()
1751 rt = rcu_dereference_bh(rt->dst.dn_next), idx++) { in dn_cache_dump()
1754 skb_dst_set(skb, dst_clone(&rt->dst)); in dn_cache_dump()
1780 struct dn_route *rt = NULL; in dn_rt_cache_get_first() local
1785 rt = rcu_dereference_bh(dn_rt_hash_table[s->bucket].chain); in dn_rt_cache_get_first()
1786 if (rt) in dn_rt_cache_get_first()
1790 return rt; in dn_rt_cache_get_first()
1793 static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_route *rt) in dn_rt_cache_get_next() argument
1797 rt = rcu_dereference_bh(rt->dst.dn_next); in dn_rt_cache_get_next()
1798 while (!rt) { in dn_rt_cache_get_next()
1803 rt = rcu_dereference_bh(dn_rt_hash_table[s->bucket].chain); in dn_rt_cache_get_next()
1805 return rt; in dn_rt_cache_get_next()
1810 struct dn_route *rt = dn_rt_cache_get_first(seq); in dn_rt_cache_seq_start() local
1812 if (rt) { in dn_rt_cache_seq_start()
1813 while(*pos && (rt = dn_rt_cache_get_next(seq, rt))) in dn_rt_cache_seq_start()
1816 return *pos ? NULL : rt; in dn_rt_cache_seq_start()
1821 struct dn_route *rt = dn_rt_cache_get_next(seq, v); in dn_rt_cache_seq_next() local
1823 return rt; in dn_rt_cache_seq_next()
1834 struct dn_route *rt = v; in dn_rt_cache_seq_show() local
1838 rt->dst.dev ? rt->dst.dev->name : "*", in dn_rt_cache_seq_show()
1839 dn_addr2asc(le16_to_cpu(rt->rt_daddr), buf1), in dn_rt_cache_seq_show()
1840 dn_addr2asc(le16_to_cpu(rt->rt_saddr), buf2), in dn_rt_cache_seq_show()
1841 atomic_read(&rt->dst.__refcnt), in dn_rt_cache_seq_show()
1842 rt->dst.__use, 0); in dn_rt_cache_seq_show()