[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 8 Aug 2017 08:46:23 -0600
From: David Ahern <dsahern@...il.com>
To: Vincent Bernat <vincent@...nat.im>,
"David S. Miller" <davem@...emloft.net>,
Alexey Kuznetsov <kuznet@....inr.ac.ru>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Jiri Pirko <jiri@...lanox.com>, netdev@...r.kernel.org
Subject: Re: [net-next v1] net: ipv6: avoid overhead when no custom FIB rules
are installed
On 8/8/17 5:51 AM, Vincent Bernat wrote:
> diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
> index 2f29e4e33bd3..693c27ede40e 100644
> --- a/net/ipv6/fib6_rules.c
> +++ b/net/ipv6/fib6_rules.c
> @@ -63,19 +63,32 @@ unsigned int fib6_rules_seq_read(struct net *net)
> struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6,
> int flags, pol_lookup_t lookup)
> {
> - struct fib_lookup_arg arg = {
> - .lookup_ptr = lookup,
> - .flags = FIB_LOOKUP_NOREF,
> - };
> -
> /* update flow if oif or iif point to device enslaved to l3mdev */
> l3mdev_update_flow(net, flowi6_to_flowi(fl6));
The l3mdev_update_flow can be moved to the has_custom_rules block.
l3mdev requires FIB rules for the lookups to work, so no rules means no
l3mdev configured.
Rest looks good to me.
>
> - fib_rules_lookup(net->ipv6.fib6_rules_ops,
> - flowi6_to_flowi(fl6), flags, &arg);
> -
> - if (arg.result)
> - return arg.result;
> + if (net->ipv6.fib6_has_custom_rules) {
> + struct fib_lookup_arg arg = {
> + .lookup_ptr = lookup,
> + .flags = FIB_LOOKUP_NOREF,
> + };
> +
> + fib_rules_lookup(net->ipv6.fib6_rules_ops,
> + flowi6_to_flowi(fl6), flags, &arg);
> +
> + if (arg.result)
> + return arg.result;
> + } else {
> + struct rt6_info *rt;
> +
> + rt = lookup(net, net->ipv6.fib6_local_tbl, fl6, flags);
> + if (rt != net->ipv6.ip6_null_entry && rt->dst.error != -EAGAIN)
> + return &rt->dst;
> + ip6_rt_put(rt);
> + rt = lookup(net, net->ipv6.fib6_main_tbl, fl6, flags);
> + if (rt->dst.error != -EAGAIN)
> + return &rt->dst;
> + ip6_rt_put(rt);
> + }
>
> dst_hold(&net->ipv6.ip6_null_entry->dst);
> return &net->ipv6.ip6_null_entry->dst;
Powered by blists - more mailing lists