Lines Matching refs:fnhe

604 static void fnhe_flush_routes(struct fib_nh_exception *fnhe)  in fnhe_flush_routes()  argument
608 rt = rcu_dereference(fnhe->fnhe_rth_input); in fnhe_flush_routes()
610 RCU_INIT_POINTER(fnhe->fnhe_rth_input, NULL); in fnhe_flush_routes()
614 rt = rcu_dereference(fnhe->fnhe_rth_output); in fnhe_flush_routes()
616 RCU_INIT_POINTER(fnhe->fnhe_rth_output, NULL); in fnhe_flush_routes()
625 struct fib_nh_exception *fnhe, *oldest = NULL; in fnhe_remove_oldest() local
627 for (fnhe_p = &hash->chain; ; fnhe_p = &fnhe->fnhe_next) { in fnhe_remove_oldest()
628 fnhe = rcu_dereference_protected(*fnhe_p, in fnhe_remove_oldest()
630 if (!fnhe) in fnhe_remove_oldest()
633 time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp)) { in fnhe_remove_oldest()
634 oldest = fnhe; in fnhe_remove_oldest()
653 static void fill_route_from_fnhe(struct rtable *rt, struct fib_nh_exception *fnhe) in fill_route_from_fnhe() argument
655 rt->rt_pmtu = fnhe->fnhe_pmtu; in fill_route_from_fnhe()
656 rt->rt_mtu_locked = fnhe->fnhe_mtu_locked; in fill_route_from_fnhe()
657 rt->dst.expires = fnhe->fnhe_expires; in fill_route_from_fnhe()
659 if (fnhe->fnhe_gw) { in fill_route_from_fnhe()
663 rt->rt_gw4 = fnhe->fnhe_gw; in fill_route_from_fnhe()
672 struct fib_nh_exception *fnhe; in update_or_create_fnhe() local
694 for (fnhe = rcu_dereference(hash->chain); fnhe; in update_or_create_fnhe()
695 fnhe = rcu_dereference(fnhe->fnhe_next)) { in update_or_create_fnhe()
696 if (fnhe->fnhe_daddr == daddr) in update_or_create_fnhe()
701 if (fnhe) { in update_or_create_fnhe()
702 if (fnhe->fnhe_genid != genid) in update_or_create_fnhe()
703 fnhe->fnhe_genid = genid; in update_or_create_fnhe()
705 fnhe->fnhe_gw = gw; in update_or_create_fnhe()
707 fnhe->fnhe_pmtu = pmtu; in update_or_create_fnhe()
708 fnhe->fnhe_mtu_locked = lock; in update_or_create_fnhe()
710 fnhe->fnhe_expires = max(1UL, expires); in update_or_create_fnhe()
712 rt = rcu_dereference(fnhe->fnhe_rth_input); in update_or_create_fnhe()
714 fill_route_from_fnhe(rt, fnhe); in update_or_create_fnhe()
715 rt = rcu_dereference(fnhe->fnhe_rth_output); in update_or_create_fnhe()
717 fill_route_from_fnhe(rt, fnhe); in update_or_create_fnhe()
728 fnhe = kzalloc(sizeof(*fnhe), GFP_ATOMIC); in update_or_create_fnhe()
729 if (!fnhe) in update_or_create_fnhe()
732 fnhe->fnhe_next = hash->chain; in update_or_create_fnhe()
734 fnhe->fnhe_genid = genid; in update_or_create_fnhe()
735 fnhe->fnhe_daddr = daddr; in update_or_create_fnhe()
736 fnhe->fnhe_gw = gw; in update_or_create_fnhe()
737 fnhe->fnhe_pmtu = pmtu; in update_or_create_fnhe()
738 fnhe->fnhe_mtu_locked = lock; in update_or_create_fnhe()
739 fnhe->fnhe_expires = max(1UL, expires); in update_or_create_fnhe()
741 rcu_assign_pointer(hash->chain, fnhe); in update_or_create_fnhe()
760 fnhe->fnhe_stamp = jiffies; in update_or_create_fnhe()
1375 struct fib_nh_exception *fnhe, __rcu **fnhe_p; in ip_del_fnhe() local
1385 fnhe = rcu_dereference_protected(*fnhe_p, lockdep_is_held(&fnhe_lock)); in ip_del_fnhe()
1386 while (fnhe) { in ip_del_fnhe()
1387 if (fnhe->fnhe_daddr == daddr) { in ip_del_fnhe()
1389 fnhe->fnhe_next, lockdep_is_held(&fnhe_lock))); in ip_del_fnhe()
1393 fnhe->fnhe_daddr = 0; in ip_del_fnhe()
1394 fnhe_flush_routes(fnhe); in ip_del_fnhe()
1395 kfree_rcu(fnhe, rcu); in ip_del_fnhe()
1398 fnhe_p = &fnhe->fnhe_next; in ip_del_fnhe()
1399 fnhe = rcu_dereference_protected(fnhe->fnhe_next, in ip_del_fnhe()
1410 struct fib_nh_exception *fnhe; in find_exception() local
1418 for (fnhe = rcu_dereference(hash[hval].chain); fnhe; in find_exception()
1419 fnhe = rcu_dereference(fnhe->fnhe_next)) { in find_exception()
1420 if (fnhe->fnhe_daddr == daddr) { in find_exception()
1421 if (fnhe->fnhe_expires && in find_exception()
1422 time_after(jiffies, fnhe->fnhe_expires)) { in find_exception()
1426 return fnhe; in find_exception()
1450 struct fib_nh_exception *fnhe; in ip_mtu_from_fib_result() local
1452 fnhe = find_exception(nhc, daddr); in ip_mtu_from_fib_result()
1453 if (fnhe && !time_after_eq(jiffies, fnhe->fnhe_expires)) in ip_mtu_from_fib_result()
1454 mtu = fnhe->fnhe_pmtu; in ip_mtu_from_fib_result()
1463 static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe, in rt_bind_exception() argument
1470 if (daddr == fnhe->fnhe_daddr) { in rt_bind_exception()
1476 porig = &fnhe->fnhe_rth_input; in rt_bind_exception()
1478 porig = &fnhe->fnhe_rth_output; in rt_bind_exception()
1481 if (fnhe->fnhe_genid != genid) { in rt_bind_exception()
1482 fnhe->fnhe_genid = genid; in rt_bind_exception()
1483 fnhe->fnhe_gw = 0; in rt_bind_exception()
1484 fnhe->fnhe_pmtu = 0; in rt_bind_exception()
1485 fnhe->fnhe_expires = 0; in rt_bind_exception()
1486 fnhe->fnhe_mtu_locked = false; in rt_bind_exception()
1487 fnhe_flush_routes(fnhe); in rt_bind_exception()
1490 fill_route_from_fnhe(rt, fnhe); in rt_bind_exception()
1506 fnhe->fnhe_stamp = jiffies; in rt_bind_exception()
1609 struct fib_nh_exception *fnhe, in rt_set_nexthop() argument
1639 if (unlikely(fnhe)) in rt_set_nexthop()
1640 cached = rt_bind_exception(rt, fnhe, daddr, do_cache); in rt_set_nexthop()
1834 struct fib_nh_exception *fnhe; in __mkroute_input() local
1883 fnhe = find_exception(nhc, daddr); in __mkroute_input()
1885 if (fnhe) in __mkroute_input()
1886 rth = rcu_dereference(fnhe->fnhe_rth_input); in __mkroute_input()
1908 rt_set_nexthop(rth, daddr, res, fnhe, res->fi, res->type, itag, in __mkroute_input()
2417 struct fib_nh_exception *fnhe; in __mkroute_output() local
2474 fnhe = NULL; in __mkroute_output()
2480 fnhe = find_exception(nhc, fl4->daddr); in __mkroute_output()
2483 if (fnhe) { in __mkroute_output()
2484 prth = &fnhe->fnhe_rth_output; in __mkroute_output()
2528 rt_set_nexthop(rth, fl4->daddr, res, fnhe, fi, type, 0, do_cache); in __mkroute_output()
2992 struct fib_nh_exception *fnhe; in fnhe_dump_bucket() local
2994 for (fnhe = rcu_dereference(bucket[i].chain); fnhe; in fnhe_dump_bucket()
2995 fnhe = rcu_dereference(fnhe->fnhe_next)) { in fnhe_dump_bucket()
3002 if (fnhe->fnhe_genid != genid) in fnhe_dump_bucket()
3005 if (fnhe->fnhe_expires && in fnhe_dump_bucket()
3006 time_after(jiffies, fnhe->fnhe_expires)) in fnhe_dump_bucket()
3009 rt = rcu_dereference(fnhe->fnhe_rth_input); in fnhe_dump_bucket()
3011 rt = rcu_dereference(fnhe->fnhe_rth_output); in fnhe_dump_bucket()
3015 err = rt_fill_info(net, fnhe->fnhe_daddr, 0, rt, in fnhe_dump_bucket()