diff options
author | David S. Miller <davem@davemloft.net> | 2012-07-26 11:14:38 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-26 15:50:39 -0700 |
commit | c6cffba4ffa26a8ffacd0bb9f3144e34f20da7de (patch) | |
tree | b67532a74343d42bcf8784b8e32d7cf6d69313db /include/net | |
parent | 4487e64de63b8e42efe5a5543871c42c5a5859d9 (diff) | |
download | linux-c6cffba4ffa26a8ffacd0bb9f3144e34f20da7de.tar.gz linux-c6cffba4ffa26a8ffacd0bb9f3144e34f20da7de.tar.bz2 linux-c6cffba4ffa26a8ffacd0bb9f3144e34f20da7de.zip |
ipv4: Fix input route performance regression.
With the routing cache removal we lost the "noref" code paths on
input, and this can kill some routing workloads.
Reinstate the noref path when we hit a cached route in the FIB
nexthops.
With help from Eric Dumazet.
Reported-by: Alexander Duyck <alexander.duyck@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/route.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/include/net/route.h b/include/net/route.h index c29ef2733f2d..8c52bc6f1c90 100644 --- a/include/net/route.h +++ b/include/net/route.h @@ -30,6 +30,7 @@ #include <net/inet_sock.h> #include <linux/in_route.h> #include <linux/rtnetlink.h> +#include <linux/rcupdate.h> #include <linux/route.h> #include <linux/ip.h> #include <linux/cache.h> @@ -157,8 +158,22 @@ static inline struct rtable *ip_route_output_gre(struct net *net, struct flowi4 return ip_route_output_key(net, fl4); } -extern int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src, - u8 tos, struct net_device *devin); +extern int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 src, + u8 tos, struct net_device *devin); + +static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src, + u8 tos, struct net_device *devin) +{ + int err; + + rcu_read_lock(); + err = ip_route_input_noref(skb, dst, src, tos, devin); + if (!err) + skb_dst_force(skb); + rcu_read_unlock(); + + return err; +} extern void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu, int oif, u32 mark, u8 protocol, int flow_flags); |