diff options
author | Thomas Graf <tgraf@suug.ch> | 2005-08-20 20:26:30 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2005-08-29 19:03:03 -0400 |
commit | 3e192beaf5ef260a31e84a12c0a04eff2eec02ab (patch) | |
tree | f3a0e434a460a8abf50329ed4b99eea037fe65e0 /net/ipv4 | |
parent | d245407e758b14c464c609b632873f85709360c7 (diff) |
[IPV4]: Avoid common branch mispredictions in ip_rcv_finish()
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/ip_input.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index 48e4ddc1e337..7e78095baef1 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c | |||
@@ -333,16 +333,16 @@ drop: | |||
333 | 333 | ||
334 | static inline int ip_rcv_finish(struct sk_buff *skb) | 334 | static inline int ip_rcv_finish(struct sk_buff *skb) |
335 | { | 335 | { |
336 | struct net_device *dev = skb->dev; | ||
337 | struct iphdr *iph = skb->nh.iph; | 336 | struct iphdr *iph = skb->nh.iph; |
338 | int err; | ||
339 | 337 | ||
340 | /* | 338 | /* |
341 | * Initialise the virtual path cache for the packet. It describes | 339 | * Initialise the virtual path cache for the packet. It describes |
342 | * how the packet travels inside Linux networking. | 340 | * how the packet travels inside Linux networking. |
343 | */ | 341 | */ |
344 | if (skb->dst == NULL) { | 342 | if (likely(skb->dst == NULL)) { |
345 | if ((err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, dev))) { | 343 | int err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, |
344 | skb->dev); | ||
345 | if (unlikely(err)) { | ||
346 | if (err == -EHOSTUNREACH) | 346 | if (err == -EHOSTUNREACH) |
347 | IP_INC_STATS_BH(IPSTATS_MIB_INADDRERRORS); | 347 | IP_INC_STATS_BH(IPSTATS_MIB_INADDRERRORS); |
348 | goto drop; | 348 | goto drop; |
@@ -350,7 +350,7 @@ static inline int ip_rcv_finish(struct sk_buff *skb) | |||
350 | } | 350 | } |
351 | 351 | ||
352 | #ifdef CONFIG_NET_CLS_ROUTE | 352 | #ifdef CONFIG_NET_CLS_ROUTE |
353 | if (skb->dst->tclassid) { | 353 | if (unlikely(skb->dst->tclassid)) { |
354 | struct ip_rt_acct *st = ip_rt_acct + 256*smp_processor_id(); | 354 | struct ip_rt_acct *st = ip_rt_acct + 256*smp_processor_id(); |
355 | u32 idx = skb->dst->tclassid; | 355 | u32 idx = skb->dst->tclassid; |
356 | st[idx&0xFF].o_packets++; | 356 | st[idx&0xFF].o_packets++; |