Lines Matching refs:fnhe
570 static void fnhe_flush_routes(struct fib_nh_exception *fnhe) in fnhe_flush_routes() argument
574 rt = rcu_dereference(fnhe->fnhe_rth_input); in fnhe_flush_routes()
576 RCU_INIT_POINTER(fnhe->fnhe_rth_input, NULL); in fnhe_flush_routes()
579 rt = rcu_dereference(fnhe->fnhe_rth_output); in fnhe_flush_routes()
581 RCU_INIT_POINTER(fnhe->fnhe_rth_output, NULL); in fnhe_flush_routes()
588 struct fib_nh_exception *fnhe, *oldest; in fnhe_oldest() local
591 for (fnhe = rcu_dereference(oldest->fnhe_next); fnhe; in fnhe_oldest()
592 fnhe = rcu_dereference(fnhe->fnhe_next)) { in fnhe_oldest()
593 if (time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp)) in fnhe_oldest()
594 oldest = fnhe; in fnhe_oldest()
610 static void fill_route_from_fnhe(struct rtable *rt, struct fib_nh_exception *fnhe) in fill_route_from_fnhe() argument
612 rt->rt_pmtu = fnhe->fnhe_pmtu; in fill_route_from_fnhe()
613 rt->dst.expires = fnhe->fnhe_expires; in fill_route_from_fnhe()
615 if (fnhe->fnhe_gw) { in fill_route_from_fnhe()
617 rt->rt_gateway = fnhe->fnhe_gw; in fill_route_from_fnhe()
626 struct fib_nh_exception *fnhe; in update_or_create_fnhe() local
648 for (fnhe = rcu_dereference(hash->chain); fnhe; in update_or_create_fnhe()
649 fnhe = rcu_dereference(fnhe->fnhe_next)) { in update_or_create_fnhe()
650 if (fnhe->fnhe_daddr == daddr) in update_or_create_fnhe()
655 if (fnhe) { in update_or_create_fnhe()
656 if (fnhe->fnhe_genid != genid) in update_or_create_fnhe()
657 fnhe->fnhe_genid = genid; in update_or_create_fnhe()
659 fnhe->fnhe_gw = gw; in update_or_create_fnhe()
661 fnhe->fnhe_pmtu = pmtu; in update_or_create_fnhe()
662 fnhe->fnhe_expires = max(1UL, expires); in update_or_create_fnhe()
664 rt = rcu_dereference(fnhe->fnhe_rth_input); in update_or_create_fnhe()
666 fill_route_from_fnhe(rt, fnhe); in update_or_create_fnhe()
667 rt = rcu_dereference(fnhe->fnhe_rth_output); in update_or_create_fnhe()
669 fill_route_from_fnhe(rt, fnhe); in update_or_create_fnhe()
672 fnhe = fnhe_oldest(hash); in update_or_create_fnhe()
674 fnhe = kzalloc(sizeof(*fnhe), GFP_ATOMIC); in update_or_create_fnhe()
675 if (!fnhe) in update_or_create_fnhe()
678 fnhe->fnhe_next = hash->chain; in update_or_create_fnhe()
679 rcu_assign_pointer(hash->chain, fnhe); in update_or_create_fnhe()
681 fnhe->fnhe_genid = genid; in update_or_create_fnhe()
682 fnhe->fnhe_daddr = daddr; in update_or_create_fnhe()
683 fnhe->fnhe_gw = gw; in update_or_create_fnhe()
684 fnhe->fnhe_pmtu = pmtu; in update_or_create_fnhe()
685 fnhe->fnhe_expires = expires; in update_or_create_fnhe()
704 fnhe->fnhe_stamp = jiffies; in update_or_create_fnhe()
1260 struct fib_nh_exception *fnhe; in find_exception() local
1268 for (fnhe = rcu_dereference(hash[hval].chain); fnhe; in find_exception()
1269 fnhe = rcu_dereference(fnhe->fnhe_next)) { in find_exception()
1270 if (fnhe->fnhe_daddr == daddr) in find_exception()
1271 return fnhe; in find_exception()
1276 static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe, in rt_bind_exception() argument
1283 if (daddr == fnhe->fnhe_daddr) { in rt_bind_exception()
1289 porig = &fnhe->fnhe_rth_input; in rt_bind_exception()
1291 porig = &fnhe->fnhe_rth_output; in rt_bind_exception()
1294 if (fnhe->fnhe_genid != genid) { in rt_bind_exception()
1295 fnhe->fnhe_genid = genid; in rt_bind_exception()
1296 fnhe->fnhe_gw = 0; in rt_bind_exception()
1297 fnhe->fnhe_pmtu = 0; in rt_bind_exception()
1298 fnhe->fnhe_expires = 0; in rt_bind_exception()
1299 fnhe_flush_routes(fnhe); in rt_bind_exception()
1302 fill_route_from_fnhe(rt, fnhe); in rt_bind_exception()
1313 fnhe->fnhe_stamp = jiffies; in rt_bind_exception()
1390 struct fib_nh_exception *fnhe, in rt_set_nexthop() argument
1406 if (unlikely(fnhe)) in rt_set_nexthop()
1407 cached = rt_bind_exception(rt, fnhe, daddr); in rt_set_nexthop()
1545 struct fib_nh_exception *fnhe; in __mkroute_input() local
1591 fnhe = find_exception(&FIB_RES_NH(*res), daddr); in __mkroute_input()
1593 if (fnhe != NULL) in __mkroute_input()
1594 rth = rcu_dereference(fnhe->fnhe_rth_input); in __mkroute_input()
1626 rt_set_nexthop(rth, daddr, res, fnhe, res->fi, res->type, itag); in __mkroute_input()
1897 struct fib_nh_exception *fnhe; in __mkroute_output() local
1952 fnhe = NULL; in __mkroute_output()
1958 fnhe = find_exception(nh, fl4->daddr); in __mkroute_output()
1959 if (fnhe) in __mkroute_output()
1960 prth = &fnhe->fnhe_rth_output; in __mkroute_output()
2019 rt_set_nexthop(rth, fl4->daddr, res, fnhe, fi, type, 0); in __mkroute_output()