Lines Matching refs:fnhe
580 static void fnhe_flush_routes(struct fib_nh_exception *fnhe) in fnhe_flush_routes() argument
584 rt = rcu_dereference(fnhe->fnhe_rth_input); in fnhe_flush_routes()
586 RCU_INIT_POINTER(fnhe->fnhe_rth_input, NULL); in fnhe_flush_routes()
590 rt = rcu_dereference(fnhe->fnhe_rth_output); in fnhe_flush_routes()
592 RCU_INIT_POINTER(fnhe->fnhe_rth_output, NULL); in fnhe_flush_routes()
600 struct fib_nh_exception *fnhe, *oldest; in fnhe_oldest() local
603 for (fnhe = rcu_dereference(oldest->fnhe_next); fnhe; in fnhe_oldest()
604 fnhe = rcu_dereference(fnhe->fnhe_next)) { in fnhe_oldest()
605 if (time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp)) in fnhe_oldest()
606 oldest = fnhe; in fnhe_oldest()
622 static void fill_route_from_fnhe(struct rtable *rt, struct fib_nh_exception *fnhe) in fill_route_from_fnhe() argument
624 rt->rt_pmtu = fnhe->fnhe_pmtu; in fill_route_from_fnhe()
625 rt->rt_mtu_locked = fnhe->fnhe_mtu_locked; in fill_route_from_fnhe()
626 rt->dst.expires = fnhe->fnhe_expires; in fill_route_from_fnhe()
628 if (fnhe->fnhe_gw) { in fill_route_from_fnhe()
630 rt->rt_gateway = fnhe->fnhe_gw; in fill_route_from_fnhe()
639 struct fib_nh_exception *fnhe; in update_or_create_fnhe() local
661 for (fnhe = rcu_dereference(hash->chain); fnhe; in update_or_create_fnhe()
662 fnhe = rcu_dereference(fnhe->fnhe_next)) { in update_or_create_fnhe()
663 if (fnhe->fnhe_daddr == daddr) in update_or_create_fnhe()
668 if (fnhe) { in update_or_create_fnhe()
669 if (fnhe->fnhe_genid != genid) in update_or_create_fnhe()
670 fnhe->fnhe_genid = genid; in update_or_create_fnhe()
672 fnhe->fnhe_gw = gw; in update_or_create_fnhe()
674 fnhe->fnhe_pmtu = pmtu; in update_or_create_fnhe()
675 fnhe->fnhe_mtu_locked = lock; in update_or_create_fnhe()
677 fnhe->fnhe_expires = max(1UL, expires); in update_or_create_fnhe()
679 rt = rcu_dereference(fnhe->fnhe_rth_input); in update_or_create_fnhe()
681 fill_route_from_fnhe(rt, fnhe); in update_or_create_fnhe()
682 rt = rcu_dereference(fnhe->fnhe_rth_output); in update_or_create_fnhe()
684 fill_route_from_fnhe(rt, fnhe); in update_or_create_fnhe()
687 fnhe = fnhe_oldest(hash); in update_or_create_fnhe()
689 fnhe = kzalloc(sizeof(*fnhe), GFP_ATOMIC); in update_or_create_fnhe()
690 if (!fnhe) in update_or_create_fnhe()
693 fnhe->fnhe_next = hash->chain; in update_or_create_fnhe()
694 rcu_assign_pointer(hash->chain, fnhe); in update_or_create_fnhe()
696 fnhe->fnhe_genid = genid; in update_or_create_fnhe()
697 fnhe->fnhe_daddr = daddr; in update_or_create_fnhe()
698 fnhe->fnhe_gw = gw; in update_or_create_fnhe()
699 fnhe->fnhe_pmtu = pmtu; in update_or_create_fnhe()
700 fnhe->fnhe_mtu_locked = lock; in update_or_create_fnhe()
701 fnhe->fnhe_expires = max(1UL, expires); in update_or_create_fnhe()
720 fnhe->fnhe_stamp = jiffies; in update_or_create_fnhe()
1293 struct fib_nh_exception *fnhe, __rcu **fnhe_p; in ip_del_fnhe() local
1303 fnhe = rcu_dereference_protected(*fnhe_p, lockdep_is_held(&fnhe_lock)); in ip_del_fnhe()
1304 while (fnhe) { in ip_del_fnhe()
1305 if (fnhe->fnhe_daddr == daddr) { in ip_del_fnhe()
1307 fnhe->fnhe_next, lockdep_is_held(&fnhe_lock))); in ip_del_fnhe()
1308 fnhe_flush_routes(fnhe); in ip_del_fnhe()
1309 kfree_rcu(fnhe, rcu); in ip_del_fnhe()
1312 fnhe_p = &fnhe->fnhe_next; in ip_del_fnhe()
1313 fnhe = rcu_dereference_protected(fnhe->fnhe_next, in ip_del_fnhe()
1323 struct fib_nh_exception *fnhe; in find_exception() local
1331 for (fnhe = rcu_dereference(hash[hval].chain); fnhe; in find_exception()
1332 fnhe = rcu_dereference(fnhe->fnhe_next)) { in find_exception()
1333 if (fnhe->fnhe_daddr == daddr) { in find_exception()
1334 if (fnhe->fnhe_expires && in find_exception()
1335 time_after(jiffies, fnhe->fnhe_expires)) { in find_exception()
1339 return fnhe; in find_exception()
1363 struct fib_nh_exception *fnhe; in ip_mtu_from_fib_result() local
1365 fnhe = find_exception(nh, daddr); in ip_mtu_from_fib_result()
1366 if (fnhe && !time_after_eq(jiffies, fnhe->fnhe_expires)) in ip_mtu_from_fib_result()
1367 mtu = fnhe->fnhe_pmtu; in ip_mtu_from_fib_result()
1376 static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe, in rt_bind_exception() argument
1383 if (daddr == fnhe->fnhe_daddr) { in rt_bind_exception()
1389 porig = &fnhe->fnhe_rth_input; in rt_bind_exception()
1391 porig = &fnhe->fnhe_rth_output; in rt_bind_exception()
1394 if (fnhe->fnhe_genid != genid) { in rt_bind_exception()
1395 fnhe->fnhe_genid = genid; in rt_bind_exception()
1396 fnhe->fnhe_gw = 0; in rt_bind_exception()
1397 fnhe->fnhe_pmtu = 0; in rt_bind_exception()
1398 fnhe->fnhe_expires = 0; in rt_bind_exception()
1399 fnhe->fnhe_mtu_locked = false; in rt_bind_exception()
1400 fnhe_flush_routes(fnhe); in rt_bind_exception()
1403 fill_route_from_fnhe(rt, fnhe); in rt_bind_exception()
1417 fnhe->fnhe_stamp = jiffies; in rt_bind_exception()
1524 struct fib_nh_exception *fnhe, in rt_set_nexthop() argument
1546 if (unlikely(fnhe)) in rt_set_nexthop()
1547 cached = rt_bind_exception(rt, fnhe, daddr, do_cache); in rt_set_nexthop()
1703 struct fib_nh_exception *fnhe; in __mkroute_input() local
1748 fnhe = find_exception(&FIB_RES_NH(*res), daddr); in __mkroute_input()
1750 if (fnhe) in __mkroute_input()
1751 rth = rcu_dereference(fnhe->fnhe_rth_input); in __mkroute_input()
1773 rt_set_nexthop(rth, daddr, res, fnhe, res->fi, res->type, itag, in __mkroute_input()
2192 struct fib_nh_exception *fnhe; in __mkroute_output() local
2249 fnhe = NULL; in __mkroute_output()
2255 fnhe = find_exception(nh, fl4->daddr); in __mkroute_output()
2258 if (fnhe) { in __mkroute_output()
2259 prth = &fnhe->fnhe_rth_output; in __mkroute_output()
2304 rt_set_nexthop(rth, fl4->daddr, res, fnhe, fi, type, 0, do_cache); in __mkroute_output()