Lines Matching refs:fnhe
575 static void fnhe_flush_routes(struct fib_nh_exception *fnhe)
579 rt = rcu_dereference(fnhe->fnhe_rth_input);
581 RCU_INIT_POINTER(fnhe->fnhe_rth_input, NULL);
585 rt = rcu_dereference(fnhe->fnhe_rth_output);
587 RCU_INIT_POINTER(fnhe->fnhe_rth_output, NULL);
596 struct fib_nh_exception *fnhe, *oldest = NULL;
598 for (fnhe_p = &hash->chain; ; fnhe_p = &fnhe->fnhe_next) {
599 fnhe = rcu_dereference_protected(*fnhe_p,
601 if (!fnhe)
604 time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp)) {
605 oldest = fnhe;
624 static void fill_route_from_fnhe(struct rtable *rt, struct fib_nh_exception *fnhe)
626 rt->rt_pmtu = fnhe->fnhe_pmtu;
627 rt->rt_mtu_locked = fnhe->fnhe_mtu_locked;
628 rt->dst.expires = fnhe->fnhe_expires;
630 if (fnhe->fnhe_gw) {
634 rt->rt_gw4 = fnhe->fnhe_gw;
643 struct fib_nh_exception *fnhe;
665 for (fnhe = rcu_dereference(hash->chain); fnhe;
666 fnhe = rcu_dereference(fnhe->fnhe_next)) {
667 if (fnhe->fnhe_daddr == daddr)
672 if (fnhe) {
673 if (fnhe->fnhe_genid != genid)
674 fnhe->fnhe_genid = genid;
676 fnhe->fnhe_gw = gw;
678 fnhe->fnhe_pmtu = pmtu;
679 fnhe->fnhe_mtu_locked = lock;
681 fnhe->fnhe_expires = max(1UL, expires);
683 rt = rcu_dereference(fnhe->fnhe_rth_input);
685 fill_route_from_fnhe(rt, fnhe);
686 rt = rcu_dereference(fnhe->fnhe_rth_output);
688 fill_route_from_fnhe(rt, fnhe);
699 fnhe = kzalloc(sizeof(*fnhe), GFP_ATOMIC);
700 if (!fnhe)
703 fnhe->fnhe_next = hash->chain;
705 fnhe->fnhe_genid = genid;
706 fnhe->fnhe_daddr = daddr;
707 fnhe->fnhe_gw = gw;
708 fnhe->fnhe_pmtu = pmtu;
709 fnhe->fnhe_mtu_locked = lock;
710 fnhe->fnhe_expires = max(1UL, expires);
712 rcu_assign_pointer(hash->chain, fnhe);
732 fnhe->fnhe_stamp = jiffies;
1333 struct fib_nh_exception *fnhe, __rcu **fnhe_p;
1343 fnhe = rcu_dereference_protected(*fnhe_p, lockdep_is_held(&fnhe_lock));
1344 while (fnhe) {
1345 if (fnhe->fnhe_daddr == daddr) {
1347 fnhe->fnhe_next, lockdep_is_held(&fnhe_lock)));
1351 fnhe->fnhe_daddr = 0;
1352 fnhe_flush_routes(fnhe);
1353 kfree_rcu(fnhe, rcu);
1356 fnhe_p = &fnhe->fnhe_next;
1357 fnhe = rcu_dereference_protected(fnhe->fnhe_next,
1368 struct fib_nh_exception *fnhe;
1376 for (fnhe = rcu_dereference(hash[hval].chain); fnhe;
1377 fnhe = rcu_dereference(fnhe->fnhe_next)) {
1378 if (fnhe->fnhe_daddr == daddr) {
1379 if (fnhe->fnhe_expires &&
1380 time_after(jiffies, fnhe->fnhe_expires)) {
1384 return fnhe;
1408 struct fib_nh_exception *fnhe;
1410 fnhe = find_exception(nhc, daddr);
1411 if (fnhe && !time_after_eq(jiffies, fnhe->fnhe_expires))
1412 mtu = fnhe->fnhe_pmtu;
1421 static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe,
1428 if (daddr == fnhe->fnhe_daddr) {
1434 porig = &fnhe->fnhe_rth_input;
1436 porig = &fnhe->fnhe_rth_output;
1439 if (fnhe->fnhe_genid != genid) {
1440 fnhe->fnhe_genid = genid;
1441 fnhe->fnhe_gw = 0;
1442 fnhe->fnhe_pmtu = 0;
1443 fnhe->fnhe_expires = 0;
1444 fnhe->fnhe_mtu_locked = false;
1445 fnhe_flush_routes(fnhe);
1448 fill_route_from_fnhe(rt, fnhe);
1464 fnhe->fnhe_stamp = jiffies;
1572 struct fib_nh_exception *fnhe,
1602 if (unlikely(fnhe))
1603 cached = rt_bind_exception(rt, fnhe, daddr, do_cache);
1797 struct fib_nh_exception *fnhe;
1849 fnhe = find_exception(nhc, daddr);
1851 if (fnhe)
1852 rth = rcu_dereference(fnhe->fnhe_rth_input);
1873 rt_set_nexthop(rth, daddr, res, fnhe, res->fi, res->type, itag,
2509 struct fib_nh_exception *fnhe;
2566 fnhe = NULL;
2572 fnhe = find_exception(nhc, fl4->daddr);
2575 if (fnhe) {
2576 prth = &fnhe->fnhe_rth_output;
2619 rt_set_nexthop(rth, fl4->daddr, res, fnhe, fi, type, 0, do_cache);
3082 struct fib_nh_exception *fnhe;
3084 for (fnhe = rcu_dereference(bucket[i].chain); fnhe;
3085 fnhe = rcu_dereference(fnhe->fnhe_next)) {
3092 if (fnhe->fnhe_genid != genid)
3095 if (fnhe->fnhe_expires &&
3096 time_after(jiffies, fnhe->fnhe_expires))
3099 rt = rcu_dereference(fnhe->fnhe_rth_input);
3101 rt = rcu_dereference(fnhe->fnhe_rth_output);
3105 err = rt_fill_info(net, fnhe->fnhe_daddr, 0, rt,