From: Eric Dumazet Date: Thu, 7 Nov 2013 16:37:28 +0000 (-0800) Subject: net: flow_dissector: small optimizations in IPv4 dissect X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3797d3e8462efdaadb64164ca540626b55fe8336;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git net: flow_dissector: small optimizations in IPv4 dissect By moving code around, we avoid : 1) A reload of iph->ihl (bit field, so needs a mask) 2) A conditional test (replaced by a conditional mov on x86) Fast path loads iph->protocol anyway. Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller --- diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 0242035192f1..d6ef17322500 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -68,13 +68,13 @@ ip: iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph); if (!iph || iph->ihl < 5) return false; + nhoff += iph->ihl * 4; + ip_proto = iph->protocol; if (ip_is_fragment(iph)) ip_proto = 0; - else - ip_proto = iph->protocol; + iph_to_flow_copy_addrs(flow, iph); - nhoff += iph->ihl * 4; break; } case __constant_htons(ETH_P_IPV6): {