From: Martin KaFai Lau Date: Mon, 20 Oct 2014 20:42:44 +0000 (-0700) Subject: ipv6: Avoid redoing fib6_lookup() for RTF_CACHE hit case X-Git-Tag: firefly_0821_release~176^2~2717^2~356^2~1 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=94c77bb41d871deb848e5011aacb5d7c24358ddd;p=firefly-linux-kernel-4.4.55.git ipv6: Avoid redoing fib6_lookup() for RTF_CACHE hit case When there is a RTF_CACHE hit, no need to redo fib6_lookup() with reachable=0. Cc: David Miller Cc: Hannes Frederic Sowa Signed-off-by: Martin KaFai Lau Signed-off-by: David S. Miller --- diff --git a/net/ipv6/route.c b/net/ipv6/route.c index f1ab2f4f4529..98c523f4a3c3 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -944,12 +944,12 @@ redo_rt6_select: goto out; } - if (rt->rt6i_flags & RTF_CACHE) - goto out; - dst_hold(&rt->dst); read_unlock_bh(&table->tb6_lock); + if (rt->rt6i_flags & RTF_CACHE) + goto out2; + if (!(rt->rt6i_flags & (RTF_NONEXTHOP | RTF_GATEWAY))) nrt = rt6_alloc_cow(rt, &fl6->daddr, &fl6->saddr); else if (!(rt->dst.flags & DST_HOST))