ipv4: Avoid overhead when no custom FIB rules are installed.
If the user hasn't actually installed any custom rules, or fiddled with the default ones, don't go through the whole FIB rules layer. It's just pure overhead. Instead do what we do with CONFIG_IP_MULTIPLE_TABLES disabled, check the individual tables by hand, one by one. Also, move fib_num_tclassid_users into the ipv4 network namespace. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -166,7 +166,7 @@ void free_fib_info(struct fib_info *fi)
|
||||
#ifdef CONFIG_IP_ROUTE_CLASSID
|
||||
change_nexthops(fi) {
|
||||
if (nexthop_nh->nh_tclassid)
|
||||
fib_num_tclassid_users--;
|
||||
fi->fib_net->ipv4.fib_num_tclassid_users--;
|
||||
} endfor_nexthops(fi);
|
||||
#endif
|
||||
call_rcu(&fi->rcu, free_fib_info_rcu);
|
||||
@@ -428,7 +428,7 @@ static int fib_get_nhs(struct fib_info *fi, struct rtnexthop *rtnh,
|
||||
nla = nla_find(attrs, attrlen, RTA_FLOW);
|
||||
nexthop_nh->nh_tclassid = nla ? nla_get_u32(nla) : 0;
|
||||
if (nexthop_nh->nh_tclassid)
|
||||
fib_num_tclassid_users++;
|
||||
fi->fib_net->ipv4.fib_num_tclassid_users++;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -824,7 +824,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
|
||||
#ifdef CONFIG_IP_ROUTE_CLASSID
|
||||
nh->nh_tclassid = cfg->fc_flow;
|
||||
if (nh->nh_tclassid)
|
||||
fib_num_tclassid_users++;
|
||||
fi->fib_net->ipv4.fib_num_tclassid_users++;
|
||||
#endif
|
||||
#ifdef CONFIG_IP_ROUTE_MULTIPATH
|
||||
nh->nh_weight = 1;
|
||||
|
Reference in New Issue
Block a user