aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2013-11-07 11:37:28 -0500
committerDavid S. Miller <davem@davemloft.net>2013-11-08 13:30:02 -0500
commit3797d3e8462efdaadb64164ca540626b55fe8336 (patch)
tree34f7b159f88933738c73e3c8f39d38b1715dd103 /net/core
parentcdc4ead09d3ee0ce48054b81ac31bc8179182dae (diff)
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 <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/flow_dissector.c6
1 files changed, 3 insertions, 3 deletions
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:
68 iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph); 68 iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph);
69 if (!iph || iph->ihl < 5) 69 if (!iph || iph->ihl < 5)
70 return false; 70 return false;
71 nhoff += iph->ihl * 4;
71 72
73 ip_proto = iph->protocol;
72 if (ip_is_fragment(iph)) 74 if (ip_is_fragment(iph))
73 ip_proto = 0; 75 ip_proto = 0;
74 else 76
75 ip_proto = iph->protocol;
76 iph_to_flow_copy_addrs(flow, iph); 77 iph_to_flow_copy_addrs(flow, iph);
77 nhoff += iph->ihl * 4;
78 break; 78 break;
79 } 79 }
80 case __constant_htons(ETH_P_IPV6): { 80 case __constant_htons(ETH_P_IPV6): {