Lines Matching refs:fnhe

567 static void fnhe_flush_routes(struct fib_nh_exception *fnhe)  in fnhe_flush_routes()  argument
571 rt = rcu_dereference(fnhe->fnhe_rth_input); in fnhe_flush_routes()
573 RCU_INIT_POINTER(fnhe->fnhe_rth_input, NULL); in fnhe_flush_routes()
576 rt = rcu_dereference(fnhe->fnhe_rth_output); in fnhe_flush_routes()
578 RCU_INIT_POINTER(fnhe->fnhe_rth_output, NULL); in fnhe_flush_routes()
585 struct fib_nh_exception *fnhe, *oldest; in fnhe_oldest() local
588 for (fnhe = rcu_dereference(oldest->fnhe_next); fnhe; in fnhe_oldest()
589 fnhe = rcu_dereference(fnhe->fnhe_next)) { in fnhe_oldest()
590 if (time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp)) in fnhe_oldest()
591 oldest = fnhe; in fnhe_oldest()
607 static void fill_route_from_fnhe(struct rtable *rt, struct fib_nh_exception *fnhe) in fill_route_from_fnhe() argument
609 rt->rt_pmtu = fnhe->fnhe_pmtu; in fill_route_from_fnhe()
610 rt->dst.expires = fnhe->fnhe_expires; in fill_route_from_fnhe()
612 if (fnhe->fnhe_gw) { in fill_route_from_fnhe()
614 rt->rt_gateway = fnhe->fnhe_gw; in fill_route_from_fnhe()
623 struct fib_nh_exception *fnhe; in update_or_create_fnhe() local
642 for (fnhe = rcu_dereference(hash->chain); fnhe; in update_or_create_fnhe()
643 fnhe = rcu_dereference(fnhe->fnhe_next)) { in update_or_create_fnhe()
644 if (fnhe->fnhe_daddr == daddr) in update_or_create_fnhe()
649 if (fnhe) { in update_or_create_fnhe()
651 fnhe->fnhe_gw = gw; in update_or_create_fnhe()
653 fnhe->fnhe_pmtu = pmtu; in update_or_create_fnhe()
654 fnhe->fnhe_expires = max(1UL, expires); in update_or_create_fnhe()
657 rt = rcu_dereference(fnhe->fnhe_rth_input); in update_or_create_fnhe()
659 fill_route_from_fnhe(rt, fnhe); in update_or_create_fnhe()
660 rt = rcu_dereference(fnhe->fnhe_rth_output); in update_or_create_fnhe()
662 fill_route_from_fnhe(rt, fnhe); in update_or_create_fnhe()
665 fnhe = fnhe_oldest(hash); in update_or_create_fnhe()
667 fnhe = kzalloc(sizeof(*fnhe), GFP_ATOMIC); in update_or_create_fnhe()
668 if (!fnhe) in update_or_create_fnhe()
671 fnhe->fnhe_next = hash->chain; in update_or_create_fnhe()
672 rcu_assign_pointer(hash->chain, fnhe); in update_or_create_fnhe()
674 fnhe->fnhe_genid = fnhe_genid(dev_net(nh->nh_dev)); in update_or_create_fnhe()
675 fnhe->fnhe_daddr = daddr; in update_or_create_fnhe()
676 fnhe->fnhe_gw = gw; in update_or_create_fnhe()
677 fnhe->fnhe_pmtu = pmtu; in update_or_create_fnhe()
678 fnhe->fnhe_expires = expires; in update_or_create_fnhe()
697 fnhe->fnhe_stamp = jiffies; in update_or_create_fnhe()
1250 struct fib_nh_exception *fnhe; in find_exception() local
1258 for (fnhe = rcu_dereference(hash[hval].chain); fnhe; in find_exception()
1259 fnhe = rcu_dereference(fnhe->fnhe_next)) { in find_exception()
1260 if (fnhe->fnhe_daddr == daddr) in find_exception()
1261 return fnhe; in find_exception()
1266 static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe, in rt_bind_exception() argument
1273 if (daddr == fnhe->fnhe_daddr) { in rt_bind_exception()
1279 porig = &fnhe->fnhe_rth_input; in rt_bind_exception()
1281 porig = &fnhe->fnhe_rth_output; in rt_bind_exception()
1284 if (fnhe->fnhe_genid != genid) { in rt_bind_exception()
1285 fnhe->fnhe_genid = genid; in rt_bind_exception()
1286 fnhe->fnhe_gw = 0; in rt_bind_exception()
1287 fnhe->fnhe_pmtu = 0; in rt_bind_exception()
1288 fnhe->fnhe_expires = 0; in rt_bind_exception()
1289 fnhe_flush_routes(fnhe); in rt_bind_exception()
1292 fill_route_from_fnhe(rt, fnhe); in rt_bind_exception()
1303 fnhe->fnhe_stamp = jiffies; in rt_bind_exception()
1393 struct fib_nh_exception *fnhe, in rt_set_nexthop() argument
1409 if (unlikely(fnhe)) in rt_set_nexthop()
1410 cached = rt_bind_exception(rt, fnhe, daddr); in rt_set_nexthop()
1545 struct fib_nh_exception *fnhe, __rcu **fnhe_p; in ip_del_fnhe() local
1555 fnhe = rcu_dereference_protected(*fnhe_p, lockdep_is_held(&fnhe_lock)); in ip_del_fnhe()
1556 while (fnhe) { in ip_del_fnhe()
1557 if (fnhe->fnhe_daddr == daddr) { in ip_del_fnhe()
1559 fnhe->fnhe_next, lockdep_is_held(&fnhe_lock))); in ip_del_fnhe()
1560 fnhe_flush_routes(fnhe); in ip_del_fnhe()
1561 kfree_rcu(fnhe, rcu); in ip_del_fnhe()
1564 fnhe_p = &fnhe->fnhe_next; in ip_del_fnhe()
1565 fnhe = rcu_dereference_protected(fnhe->fnhe_next, in ip_del_fnhe()
1578 struct fib_nh_exception *fnhe; in __mkroute_input() local
1624 fnhe = find_exception(&FIB_RES_NH(*res), daddr); in __mkroute_input()
1626 if (fnhe) { in __mkroute_input()
1627 rth = rcu_dereference(fnhe->fnhe_rth_input); in __mkroute_input()
1631 fnhe = NULL; in __mkroute_input()
1668 rt_set_nexthop(rth, daddr, res, fnhe, res->fi, res->type, itag); in __mkroute_input()
1938 struct fib_nh_exception *fnhe; in __mkroute_output() local
1981 fnhe = NULL; in __mkroute_output()
1987 fnhe = find_exception(nh, fl4->daddr); in __mkroute_output()
1988 if (fnhe) { in __mkroute_output()
1989 prth = &fnhe->fnhe_rth_output; in __mkroute_output()
1994 fnhe = NULL; in __mkroute_output()
2058 rt_set_nexthop(rth, fl4->daddr, res, fnhe, fi, type, 0); in __mkroute_output()