* [PATCH net-next] net: flow_dissector: small optimizations in IPv4 dissect
@ 2013-11-07 16:37 Eric Dumazet
2013-11-08 18:30 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2013-11-07 16:37 UTC (permalink / raw)
To: David Miller; +Cc: netdev
From: Eric Dumazet <edumazet@google.com>
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>
---
net/core/flow_dissector.c | 6 +++---
1 file 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:
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): {
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] net: flow_dissector: small optimizations in IPv4 dissect
2013-11-07 16:37 [PATCH net-next] net: flow_dissector: small optimizations in IPv4 dissect Eric Dumazet
@ 2013-11-08 18:30 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-11-08 18:30 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 07 Nov 2013 08:37:28 -0800
> From: Eric Dumazet <edumazet@google.com>
>
> 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>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-11-08 18:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-07 16:37 [PATCH net-next] net: flow_dissector: small optimizations in IPv4 dissect Eric Dumazet
2013-11-08 18:30 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).