Lines Matching refs:fnhe

588 static void fnhe_flush_routes(struct fib_nh_exception *fnhe)  in fnhe_flush_routes()  argument
592 rt = rcu_dereference(fnhe->fnhe_rth_input); in fnhe_flush_routes()
594 RCU_INIT_POINTER(fnhe->fnhe_rth_input, NULL); in fnhe_flush_routes()
598 rt = rcu_dereference(fnhe->fnhe_rth_output); in fnhe_flush_routes()
600 RCU_INIT_POINTER(fnhe->fnhe_rth_output, NULL); in fnhe_flush_routes()
608 struct fib_nh_exception *fnhe, *oldest; in fnhe_oldest() local
611 for (fnhe = rcu_dereference(oldest->fnhe_next); fnhe; in fnhe_oldest()
612 fnhe = rcu_dereference(fnhe->fnhe_next)) { in fnhe_oldest()
613 if (time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp)) in fnhe_oldest()
614 oldest = fnhe; in fnhe_oldest()
630 static void fill_route_from_fnhe(struct rtable *rt, struct fib_nh_exception *fnhe) in fill_route_from_fnhe() argument
632 rt->rt_pmtu = fnhe->fnhe_pmtu; in fill_route_from_fnhe()
633 rt->rt_mtu_locked = fnhe->fnhe_mtu_locked; in fill_route_from_fnhe()
634 rt->dst.expires = fnhe->fnhe_expires; in fill_route_from_fnhe()
636 if (fnhe->fnhe_gw) { in fill_route_from_fnhe()
640 rt->rt_gw4 = fnhe->fnhe_gw; in fill_route_from_fnhe()
649 struct fib_nh_exception *fnhe; in update_or_create_fnhe() local
671 for (fnhe = rcu_dereference(hash->chain); fnhe; in update_or_create_fnhe()
672 fnhe = rcu_dereference(fnhe->fnhe_next)) { in update_or_create_fnhe()
673 if (fnhe->fnhe_daddr == daddr) in update_or_create_fnhe()
678 if (fnhe) { in update_or_create_fnhe()
679 if (fnhe->fnhe_genid != genid) in update_or_create_fnhe()
680 fnhe->fnhe_genid = genid; in update_or_create_fnhe()
682 fnhe->fnhe_gw = gw; in update_or_create_fnhe()
684 fnhe->fnhe_pmtu = pmtu; in update_or_create_fnhe()
685 fnhe->fnhe_mtu_locked = lock; in update_or_create_fnhe()
687 fnhe->fnhe_expires = max(1UL, expires); in update_or_create_fnhe()
689 rt = rcu_dereference(fnhe->fnhe_rth_input); in update_or_create_fnhe()
691 fill_route_from_fnhe(rt, fnhe); in update_or_create_fnhe()
692 rt = rcu_dereference(fnhe->fnhe_rth_output); in update_or_create_fnhe()
694 fill_route_from_fnhe(rt, fnhe); in update_or_create_fnhe()
697 fnhe = fnhe_oldest(hash); in update_or_create_fnhe()
699 fnhe = kzalloc(sizeof(*fnhe), GFP_ATOMIC); in update_or_create_fnhe()
700 if (!fnhe) in update_or_create_fnhe()
703 fnhe->fnhe_next = hash->chain; in update_or_create_fnhe()
704 rcu_assign_pointer(hash->chain, fnhe); in update_or_create_fnhe()
706 fnhe->fnhe_genid = genid; in update_or_create_fnhe()
707 fnhe->fnhe_daddr = daddr; in update_or_create_fnhe()
708 fnhe->fnhe_gw = gw; in update_or_create_fnhe()
709 fnhe->fnhe_pmtu = pmtu; in update_or_create_fnhe()
710 fnhe->fnhe_mtu_locked = lock; in update_or_create_fnhe()
711 fnhe->fnhe_expires = max(1UL, expires); in update_or_create_fnhe()
730 fnhe->fnhe_stamp = jiffies; in update_or_create_fnhe()
1328 struct fib_nh_exception *fnhe, __rcu **fnhe_p; in ip_del_fnhe() local
1338 fnhe = rcu_dereference_protected(*fnhe_p, lockdep_is_held(&fnhe_lock)); in ip_del_fnhe()
1339 while (fnhe) { in ip_del_fnhe()
1340 if (fnhe->fnhe_daddr == daddr) { in ip_del_fnhe()
1342 fnhe->fnhe_next, lockdep_is_held(&fnhe_lock))); in ip_del_fnhe()
1346 fnhe->fnhe_daddr = 0; in ip_del_fnhe()
1347 fnhe_flush_routes(fnhe); in ip_del_fnhe()
1348 kfree_rcu(fnhe, rcu); in ip_del_fnhe()
1351 fnhe_p = &fnhe->fnhe_next; in ip_del_fnhe()
1352 fnhe = rcu_dereference_protected(fnhe->fnhe_next, in ip_del_fnhe()
1363 struct fib_nh_exception *fnhe; in find_exception() local
1371 for (fnhe = rcu_dereference(hash[hval].chain); fnhe; in find_exception()
1372 fnhe = rcu_dereference(fnhe->fnhe_next)) { in find_exception()
1373 if (fnhe->fnhe_daddr == daddr) { in find_exception()
1374 if (fnhe->fnhe_expires && in find_exception()
1375 time_after(jiffies, fnhe->fnhe_expires)) { in find_exception()
1379 return fnhe; in find_exception()
1403 struct fib_nh_exception *fnhe; in ip_mtu_from_fib_result() local
1405 fnhe = find_exception(nhc, daddr); in ip_mtu_from_fib_result()
1406 if (fnhe && !time_after_eq(jiffies, fnhe->fnhe_expires)) in ip_mtu_from_fib_result()
1407 mtu = fnhe->fnhe_pmtu; in ip_mtu_from_fib_result()
1416 static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe, in rt_bind_exception() argument
1423 if (daddr == fnhe->fnhe_daddr) { in rt_bind_exception()
1429 porig = &fnhe->fnhe_rth_input; in rt_bind_exception()
1431 porig = &fnhe->fnhe_rth_output; in rt_bind_exception()
1434 if (fnhe->fnhe_genid != genid) { in rt_bind_exception()
1435 fnhe->fnhe_genid = genid; in rt_bind_exception()
1436 fnhe->fnhe_gw = 0; in rt_bind_exception()
1437 fnhe->fnhe_pmtu = 0; in rt_bind_exception()
1438 fnhe->fnhe_expires = 0; in rt_bind_exception()
1439 fnhe->fnhe_mtu_locked = false; in rt_bind_exception()
1440 fnhe_flush_routes(fnhe); in rt_bind_exception()
1443 fill_route_from_fnhe(rt, fnhe); in rt_bind_exception()
1459 fnhe->fnhe_stamp = jiffies; in rt_bind_exception()
1562 struct fib_nh_exception *fnhe, in rt_set_nexthop() argument
1592 if (unlikely(fnhe)) in rt_set_nexthop()
1593 cached = rt_bind_exception(rt, fnhe, daddr, do_cache); in rt_set_nexthop()
1788 struct fib_nh_exception *fnhe; in __mkroute_input() local
1837 fnhe = find_exception(nhc, daddr); in __mkroute_input()
1839 if (fnhe) in __mkroute_input()
1840 rth = rcu_dereference(fnhe->fnhe_rth_input); in __mkroute_input()
1862 rt_set_nexthop(rth, daddr, res, fnhe, res->fi, res->type, itag, in __mkroute_input()
2318 struct fib_nh_exception *fnhe; in __mkroute_output() local
2375 fnhe = NULL; in __mkroute_output()
2381 fnhe = find_exception(nhc, fl4->daddr); in __mkroute_output()
2384 if (fnhe) { in __mkroute_output()
2385 prth = &fnhe->fnhe_rth_output; in __mkroute_output()
2430 rt_set_nexthop(rth, fl4->daddr, res, fnhe, fi, type, 0, do_cache); in __mkroute_output()
2877 struct fib_nh_exception *fnhe; in fnhe_dump_bucket() local
2879 for (fnhe = rcu_dereference(bucket[i].chain); fnhe; in fnhe_dump_bucket()
2880 fnhe = rcu_dereference(fnhe->fnhe_next)) { in fnhe_dump_bucket()
2887 if (fnhe->fnhe_genid != genid) in fnhe_dump_bucket()
2890 if (fnhe->fnhe_expires && in fnhe_dump_bucket()
2891 time_after(jiffies, fnhe->fnhe_expires)) in fnhe_dump_bucket()
2894 rt = rcu_dereference(fnhe->fnhe_rth_input); in fnhe_dump_bucket()
2896 rt = rcu_dereference(fnhe->fnhe_rth_output); in fnhe_dump_bucket()
2900 err = rt_fill_info(net, fnhe->fnhe_daddr, 0, rt, in fnhe_dump_bucket()