Commit a6254864 authored by Duan Jiong's avatar Duan Jiong Committed by David S. Miller

ipv4: fix counter in_slow_tot

since commit 89aef892("ipv4: Delete routing cache."), the counter
in_slow_tot can't work correctly.

The counter in_slow_tot increase by one when fib_lookup() return successfully
in ip_route_input_slow(), but actually the dst struct maybe not be created and
cached, so we can increase in_slow_tot after the dst struct is created.
Signed-off-by: default avatarDuan Jiong <duanj.fnst@cn.fujitsu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3eca5299
...@@ -1597,6 +1597,7 @@ static int __mkroute_input(struct sk_buff *skb, ...@@ -1597,6 +1597,7 @@ static int __mkroute_input(struct sk_buff *skb,
rth->rt_gateway = 0; rth->rt_gateway = 0;
rth->rt_uses_gateway = 0; rth->rt_uses_gateway = 0;
INIT_LIST_HEAD(&rth->rt_uncached); INIT_LIST_HEAD(&rth->rt_uncached);
RT_CACHE_STAT_INC(in_slow_tot);
rth->dst.input = ip_forward; rth->dst.input = ip_forward;
rth->dst.output = ip_output; rth->dst.output = ip_output;
...@@ -1701,8 +1702,6 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, ...@@ -1701,8 +1702,6 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
goto no_route; goto no_route;
} }
RT_CACHE_STAT_INC(in_slow_tot);
if (res.type == RTN_BROADCAST) if (res.type == RTN_BROADCAST)
goto brd_input; goto brd_input;
...@@ -1773,6 +1772,7 @@ out: return err; ...@@ -1773,6 +1772,7 @@ out: return err;
rth->rt_gateway = 0; rth->rt_gateway = 0;
rth->rt_uses_gateway = 0; rth->rt_uses_gateway = 0;
INIT_LIST_HEAD(&rth->rt_uncached); INIT_LIST_HEAD(&rth->rt_uncached);
RT_CACHE_STAT_INC(in_slow_tot);
if (res.type == RTN_UNREACHABLE) { if (res.type == RTN_UNREACHABLE) {
rth->dst.input= ip_error; rth->dst.input= ip_error;
rth->dst.error= -err; rth->dst.error= -err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment