diff options
author | David S. Miller <davem@davemloft.net> | 2011-03-09 23:42:07 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-09 23:42:07 -0500 |
commit | 67e28ffd864eebbaf48b404d0a8cb4edd2bdc924 (patch) | |
tree | acd2328f3d45db16b45841e796c23815570748f6 /net/ipv4/route.c | |
parent | 2f4e1b3970973bbb57cc3a3b9d67e67c1c648c37 (diff) |
ipv4: Optimize flow initialization in input route lookup.
Like in commit 44713b67db10c774f14280c129b0d5fd13c70cf2
("ipv4: Optimize flow initialization in output route lookup."
we can optimize the on-stack flow setup to only initialize
the members which are actually used.
Otherwise we bzero the entire structure, then initialize
explicitly the first half of it.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r-- | net/ipv4/route.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 92a24ea34c1b..ac32d8f3d68f 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -2081,12 +2081,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2081 | { | 2081 | { |
2082 | struct fib_result res; | 2082 | struct fib_result res; |
2083 | struct in_device *in_dev = __in_dev_get_rcu(dev); | 2083 | struct in_device *in_dev = __in_dev_get_rcu(dev); |
2084 | struct flowi fl = { .fl4_dst = daddr, | 2084 | struct flowi fl; |
2085 | .fl4_src = saddr, | ||
2086 | .fl4_tos = tos, | ||
2087 | .fl4_scope = RT_SCOPE_UNIVERSE, | ||
2088 | .mark = skb->mark, | ||
2089 | .iif = dev->ifindex }; | ||
2090 | unsigned flags = 0; | 2085 | unsigned flags = 0; |
2091 | u32 itag = 0; | 2086 | u32 itag = 0; |
2092 | struct rtable * rth; | 2087 | struct rtable * rth; |
@@ -2123,6 +2118,13 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2123 | /* | 2118 | /* |
2124 | * Now we are ready to route packet. | 2119 | * Now we are ready to route packet. |
2125 | */ | 2120 | */ |
2121 | fl.oif = 0; | ||
2122 | fl.iif = dev->ifindex; | ||
2123 | fl.mark = skb->mark; | ||
2124 | fl.fl4_dst = daddr; | ||
2125 | fl.fl4_src = saddr; | ||
2126 | fl.fl4_tos = tos; | ||
2127 | fl.fl4_scope = RT_SCOPE_UNIVERSE; | ||
2126 | err = fib_lookup(net, &fl, &res); | 2128 | err = fib_lookup(net, &fl, &res); |
2127 | if (err != 0) { | 2129 | if (err != 0) { |
2128 | if (!IN_DEV_FORWARD(in_dev)) | 2130 | if (!IN_DEV_FORWARD(in_dev)) |