• Home
  • Raw
  • Download

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()
736 struct dn_route *rt = (struct dn_route *)dst; in dn_output() local
742 if (rt->n == NULL) in dn_output()
747 cb->src = rt->rt_saddr; in dn_output()
748 cb->dst = rt->rt_daddr; in dn_output()
776 struct dn_route *rt; in dn_forward() local
784 rt = (struct dn_route *)skb_dst(skb); in dn_forward()
786 if (skb_cow(skb, LL_RESERVED_SPACE(rt->dst.dev)+header_len)) in dn_forward()
795 skb->dev = rt->dst.dev; in dn_forward()
803 if (rt->rt_flags & RTCF_DOREDIRECT) in dn_forward()
862 static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res) in dn_rt_set_next_hop() argument
865 struct net_device *dev = rt->dst.dev; in dn_rt_set_next_hop()
872 rt->rt_gateway = DN_FIB_RES_GW(*res); in dn_rt_set_next_hop()
873 dst_init_metrics(&rt->dst, fi->fib_metrics, true); in dn_rt_set_next_hop()
875 rt->rt_type = res->type; in dn_rt_set_next_hop()
877 if (dev != NULL && rt->n == NULL) { in dn_rt_set_next_hop()
878 n = __neigh_lookup_errno(&dn_neigh_table, &rt->rt_gateway, dev); in dn_rt_set_next_hop()
881 rt->n = n; in dn_rt_set_next_hop()
884 if (dst_metric(&rt->dst, RTAX_MTU) > rt->dst.dev->mtu) in dn_rt_set_next_hop()
885 dst_metric_set(&rt->dst, RTAX_MTU, rt->dst.dev->mtu); in dn_rt_set_next_hop()
886 mss_metric = dst_metric_raw(&rt->dst, RTAX_ADVMSS); in dn_rt_set_next_hop()
888 unsigned int mss = dn_mss_from_pmtu(dev, dst_mtu(&rt->dst)); in dn_rt_set_next_hop()
890 dst_metric_set(&rt->dst, RTAX_ADVMSS, mss); in dn_rt_set_next_hop()
957 struct dn_route *rt = NULL; in dn_route_output_slow() local
1176 rt = dst_alloc(&dn_dst_ops, dev_out, 0, DST_OBSOLETE_NONE, DST_HOST); in dn_route_output_slow()
1177 if (rt == NULL) in dn_route_output_slow()
1180 rt->dn_next = NULL; in dn_route_output_slow()
1181 memset(&rt->fld, 0, sizeof(rt->fld)); in dn_route_output_slow()
1182 rt->fld.saddr = oldflp->saddr; in dn_route_output_slow()
1183 rt->fld.daddr = oldflp->daddr; in dn_route_output_slow()
1184 rt->fld.flowidn_oif = oldflp->flowidn_oif; in dn_route_output_slow()
1185 rt->fld.flowidn_iif = 0; in dn_route_output_slow()
1186 rt->fld.flowidn_mark = oldflp->flowidn_mark; in dn_route_output_slow()
1188 rt->rt_saddr = fld.saddr; in dn_route_output_slow()
1189 rt->rt_daddr = fld.daddr; in dn_route_output_slow()
1190 rt->rt_gateway = gateway ? gateway : fld.daddr; in dn_route_output_slow()
1191 rt->rt_local_src = fld.saddr; in dn_route_output_slow()
1193 rt->rt_dst_map = fld.daddr; in dn_route_output_slow()
1194 rt->rt_src_map = fld.saddr; in dn_route_output_slow()
1196 rt->n = neigh; in dn_route_output_slow()
1199 rt->dst.lastuse = jiffies; in dn_route_output_slow()
1200 rt->dst.output = dn_output; in dn_route_output_slow()
1201 rt->dst.input = dn_rt_bug; in dn_route_output_slow()
1202 rt->rt_flags = flags; in dn_route_output_slow()
1204 rt->dst.input = dn_nsp_rx; in dn_route_output_slow()
1206 err = dn_rt_set_next_hop(rt, &res); in dn_route_output_slow()
1210 hash = dn_hash(rt->fld.saddr, rt->fld.daddr); in dn_route_output_slow()
1212 dn_insert_route(rt, hash, (struct dn_route **)pprt); in dn_route_output_slow()
1234 dst_release_immediate(&rt->dst); in dn_route_output_slow()
1245 struct dn_route *rt = NULL; in __dn_route_output_key() local
1249 for (rt = rcu_dereference_bh(dn_rt_hash_table[hash].chain); rt; in __dn_route_output_key()
1250 rt = rcu_dereference_bh(rt->dn_next)) { in __dn_route_output_key()
1251 if ((flp->daddr == rt->fld.daddr) && in __dn_route_output_key()
1252 (flp->saddr == rt->fld.saddr) && in __dn_route_output_key()
1253 (flp->flowidn_mark == rt->fld.flowidn_mark) && in __dn_route_output_key()
1254 dn_is_output_route(rt) && in __dn_route_output_key()
1255 (rt->fld.flowidn_oif == flp->flowidn_oif)) { in __dn_route_output_key()
1256 dst_hold_and_use(&rt->dst, jiffies); in __dn_route_output_key()
1258 *pprt = &rt->dst; in __dn_route_output_key()
1302 struct dn_route *rt = NULL; in dn_route_input_slow() local
1442 rt = dst_alloc(&dn_dst_ops, out_dev, 1, DST_OBSOLETE_NONE, DST_HOST); in dn_route_input_slow()
1443 if (rt == NULL) in dn_route_input_slow()
1446 rt->dn_next = NULL; in dn_route_input_slow()
1447 memset(&rt->fld, 0, sizeof(rt->fld)); in dn_route_input_slow()
1448 rt->rt_saddr = fld.saddr; in dn_route_input_slow()
1449 rt->rt_daddr = fld.daddr; in dn_route_input_slow()
1450 rt->rt_gateway = fld.daddr; in dn_route_input_slow()
1452 rt->rt_gateway = gateway; in dn_route_input_slow()
1453 rt->rt_local_src = local_src ? local_src : rt->rt_saddr; in dn_route_input_slow()
1455 rt->rt_dst_map = fld.daddr; in dn_route_input_slow()
1456 rt->rt_src_map = fld.saddr; in dn_route_input_slow()
1458 rt->fld.saddr = cb->src; in dn_route_input_slow()
1459 rt->fld.daddr = cb->dst; in dn_route_input_slow()
1460 rt->fld.flowidn_oif = 0; in dn_route_input_slow()
1461 rt->fld.flowidn_iif = in_dev->ifindex; in dn_route_input_slow()
1462 rt->fld.flowidn_mark = fld.flowidn_mark; in dn_route_input_slow()
1464 rt->n = neigh; in dn_route_input_slow()
1465 rt->dst.lastuse = jiffies; in dn_route_input_slow()
1466 rt->dst.output = dn_rt_bug_out; in dn_route_input_slow()
1469 rt->dst.input = dn_forward; in dn_route_input_slow()
1472 rt->dst.output = dn_output; in dn_route_input_slow()
1473 rt->dst.input = dn_nsp_rx; in dn_route_input_slow()
1474 rt->dst.dev = in_dev; in dn_route_input_slow()
1480 rt->dst.input = dst_discard; in dn_route_input_slow()
1482 rt->rt_flags = flags; in dn_route_input_slow()
1484 err = dn_rt_set_next_hop(rt, &res); in dn_route_input_slow()
1488 hash = dn_hash(rt->fld.saddr, rt->fld.daddr); in dn_route_input_slow()
1490 dn_insert_route(rt, hash, &rt); in dn_route_input_slow()
1491 skb_dst_set(skb, &rt->dst); in dn_route_input_slow()
1513 dst_release_immediate(&rt->dst); in dn_route_input_slow()
1519 struct dn_route *rt; in dn_route_input() local
1527 for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt != NULL; in dn_route_input()
1528 rt = rcu_dereference(rt->dn_next)) { in dn_route_input()
1529 if ((rt->fld.saddr == cb->src) && in dn_route_input()
1530 (rt->fld.daddr == cb->dst) && in dn_route_input()
1531 (rt->fld.flowidn_oif == 0) && in dn_route_input()
1532 (rt->fld.flowidn_mark == skb->mark) && in dn_route_input()
1533 (rt->fld.flowidn_iif == cb->iif)) { in dn_route_input()
1534 dst_hold_and_use(&rt->dst, jiffies); in dn_route_input()
1536 skb_dst_set(skb, (struct dst_entry *)rt); in dn_route_input()
1548 struct dn_route *rt = (struct dn_route *)skb_dst(skb); in dn_rt_fill_info() local
1563 r->rtm_type = rt->rt_type; in dn_rt_fill_info()
1564 r->rtm_flags = (rt->rt_flags & ~0xFFFF) | RTM_F_CLONED; in dn_rt_fill_info()
1568 if (rt->rt_flags & RTCF_NOTIFY) in dn_rt_fill_info()
1572 nla_put_le16(skb, RTA_DST, rt->rt_daddr) < 0) in dn_rt_fill_info()
1575 if (rt->fld.saddr) { in dn_rt_fill_info()
1577 if (nla_put_le16(skb, RTA_SRC, rt->fld.saddr) < 0) in dn_rt_fill_info()
1580 if (rt->dst.dev && in dn_rt_fill_info()
1581 nla_put_u32(skb, RTA_OIF, rt->dst.dev->ifindex) < 0) in dn_rt_fill_info()
1589 if (nla_put_le16(skb, RTA_PREFSRC, rt->rt_local_src) < 0) in dn_rt_fill_info()
1592 if (rt->rt_daddr != rt->rt_gateway && in dn_rt_fill_info()
1593 nla_put_le16(skb, RTA_GATEWAY, rt->rt_gateway) < 0) in dn_rt_fill_info()
1596 if (rtnetlink_put_metrics(skb, dst_metrics_ptr(&rt->dst)) < 0) in dn_rt_fill_info()
1599 expires = rt->dst.expires ? rt->dst.expires - jiffies : 0; in dn_rt_fill_info()
1600 if (rtnl_put_cacheinfo(skb, &rt->dst, 0, expires, in dn_rt_fill_info()
1601 rt->dst.error) < 0) in dn_rt_fill_info()
1604 if (dn_is_input_route(rt) && in dn_rt_fill_info()
1605 nla_put_u32(skb, RTA_IIF, rt->fld.flowidn_iif) < 0) in dn_rt_fill_info()
1638 struct dn_route *rt = NULL; in dn_cache_getroute() local
1686 rt = (struct dn_route *)skb_dst(skb); in dn_cache_getroute()
1687 if (!err && -rt->dst.error) in dn_cache_getroute()
1688 err = rt->dst.error; in dn_cache_getroute()
1693 err = dn_route_output_key((struct dst_entry **)&rt, &fld, 0); in dn_cache_getroute()
1699 skb_dst_set(skb, &rt->dst); in dn_cache_getroute()
1701 rt->rt_flags |= RTCF_NOTIFY; in dn_cache_getroute()
1723 struct dn_route *rt; in dn_cache_dump() local
1746 for(rt = rcu_dereference_bh(dn_rt_hash_table[h].chain), idx = 0; in dn_cache_dump()
1747 rt; in dn_cache_dump()
1748 rt = rcu_dereference_bh(rt->dn_next), idx++) { in dn_cache_dump()
1751 skb_dst_set(skb, dst_clone(&rt->dst)); in dn_cache_dump()
1777 struct dn_route *rt = NULL; in dn_rt_cache_get_first() local
1782 rt = rcu_dereference_bh(dn_rt_hash_table[s->bucket].chain); in dn_rt_cache_get_first()
1783 if (rt) in dn_rt_cache_get_first()
1787 return rt; in dn_rt_cache_get_first()
1790 static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_route *rt) in dn_rt_cache_get_next() argument
1794 rt = rcu_dereference_bh(rt->dn_next); in dn_rt_cache_get_next()
1795 while (!rt) { in dn_rt_cache_get_next()
1800 rt = rcu_dereference_bh(dn_rt_hash_table[s->bucket].chain); in dn_rt_cache_get_next()
1802 return rt; in dn_rt_cache_get_next()
1807 struct dn_route *rt = dn_rt_cache_get_first(seq); in dn_rt_cache_seq_start() local
1809 if (rt) { in dn_rt_cache_seq_start()
1810 while(*pos && (rt = dn_rt_cache_get_next(seq, rt))) in dn_rt_cache_seq_start()
1813 return *pos ? NULL : rt; in dn_rt_cache_seq_start()
1818 struct dn_route *rt = dn_rt_cache_get_next(seq, v); in dn_rt_cache_seq_next() local
1820 return rt; in dn_rt_cache_seq_next()
1831 struct dn_route *rt = v; in dn_rt_cache_seq_show() local
1835 rt->dst.dev ? rt->dst.dev->name : "*", in dn_rt_cache_seq_show()
1836 dn_addr2asc(le16_to_cpu(rt->rt_daddr), buf1), in dn_rt_cache_seq_show()
1837 dn_addr2asc(le16_to_cpu(rt->rt_saddr), buf2), in dn_rt_cache_seq_show()
1838 atomic_read(&rt->dst.__refcnt), in dn_rt_cache_seq_show()
1839 rt->dst.__use, 0); in dn_rt_cache_seq_show()