* [PATCH] ipv4: some rt_iif -> rt_route_iif conversions
@ 2011-08-09 14:01 Julian Anastasov
2011-08-11 13:01 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Julian Anastasov @ 2011-08-09 14:01 UTC (permalink / raw)
To: David Miller; +Cc: netdev
As rt_iif represents input device even for packets
coming from loopback with output route, it is not an unique
key specific to input routes. Now rt_route_iif has such role,
it was fl.iif in 2.6.38, so better to change the checks at
some places to save CPU cycles and to restore 2.6.38 semantics.
compare_keys:
- input routes: only rt_route_iif matters, rt_iif is same
- output routes: only rt_oif matters, rt_iif is not
used for matching in __ip_route_output_key
- now we are back to 2.6.38 state
ip_route_input_common:
- matching rt_route_iif implies input route
- compared to 2.6.38 we eliminated one rth->fl.oif check
because it was not needed even for 2.6.38
compare_hash_inputs:
Only the change here is not an optimization, it has
effect only for output routes. I assume I'm restoring
the original intention to ignore oif, it was using fl.iif
- now we are back to 2.6.38 state
Signed-off-by: Julian Anastasov <ja@ssi.bg>
---
diff -urp linux/net/ipv4/route.c linux/net/ipv4/route.c
--- linux/net/ipv4/route.c 2011-08-09 12:40:43.000000000 +0300
+++ linux/net/ipv4/route.c 2011-08-09 12:46:16.880358197 +0300
@@ -716,7 +716,7 @@ static inline bool compare_hash_inputs(c
{
return ((((__force u32)rt1->rt_key_dst ^ (__force u32)rt2->rt_key_dst) |
((__force u32)rt1->rt_key_src ^ (__force u32)rt2->rt_key_src) |
- (rt1->rt_iif ^ rt2->rt_iif)) == 0);
+ (rt1->rt_route_iif ^ rt2->rt_route_iif)) == 0);
}
static inline int compare_keys(struct rtable *rt1, struct rtable *rt2)
@@ -726,8 +726,7 @@ static inline int compare_keys(struct rt
(rt1->rt_mark ^ rt2->rt_mark) |
(rt1->rt_key_tos ^ rt2->rt_key_tos) |
(rt1->rt_route_iif ^ rt2->rt_route_iif) |
- (rt1->rt_oif ^ rt2->rt_oif) |
- (rt1->rt_iif ^ rt2->rt_iif)) == 0;
+ (rt1->rt_oif ^ rt2->rt_oif)) == 0;
}
static inline int compare_netns(struct rtable *rt1, struct rtable *rt2)
@@ -2281,9 +2280,8 @@ int ip_route_input_common(struct sk_buff
rth = rcu_dereference(rth->dst.rt_next)) {
if ((((__force u32)rth->rt_key_dst ^ (__force u32)daddr) |
((__force u32)rth->rt_key_src ^ (__force u32)saddr) |
- (rth->rt_iif ^ iif) |
+ (rth->rt_route_iif ^ iif) |
(rth->rt_key_tos ^ tos)) == 0 &&
- rt_is_input_route(rth) &&
rth->rt_mark == skb->mark &&
net_eq(dev_net(rth->dst.dev), net) &&
!rt_is_expired(rth)) {
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ipv4: some rt_iif -> rt_route_iif conversions
2011-08-09 14:01 [PATCH] ipv4: some rt_iif -> rt_route_iif conversions Julian Anastasov
@ 2011-08-11 13:01 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-08-11 13:01 UTC (permalink / raw)
To: ja; +Cc: netdev
From: Julian Anastasov <ja@ssi.bg>
Date: Tue, 9 Aug 2011 17:01:16 +0300 (EEST)
>
> As rt_iif represents input device even for packets
> coming from loopback with output route, it is not an unique
> key specific to input routes. Now rt_route_iif has such role,
> it was fl.iif in 2.6.38, so better to change the checks at
> some places to save CPU cycles and to restore 2.6.38 semantics.
>
> compare_keys:
> - input routes: only rt_route_iif matters, rt_iif is same
> - output routes: only rt_oif matters, rt_iif is not
> used for matching in __ip_route_output_key
> - now we are back to 2.6.38 state
>
> ip_route_input_common:
> - matching rt_route_iif implies input route
> - compared to 2.6.38 we eliminated one rth->fl.oif check
> because it was not needed even for 2.6.38
>
> compare_hash_inputs:
> Only the change here is not an optimization, it has
> effect only for output routes. I assume I'm restoring
> the original intention to ignore oif, it was using fl.iif
> - now we are back to 2.6.38 state
>
> Signed-off-by: Julian Anastasov <ja@ssi.bg>
Applied, thanks a lot for doing these audits.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-08-11 13:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-09 14:01 [PATCH] ipv4: some rt_iif -> rt_route_iif conversions Julian Anastasov
2011-08-11 13:01 ` 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).