[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <504DEE89.8030606@gmail.com>
Date: Mon, 10 Sep 2012 21:43:37 +0800
From: Shan Wei <shanwei88@...il.com>
To: Cong Wang <amwang@...hat.com>
CC: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH 2/3] ipv6, route: remove BACKTRACK() macro
Cong Wang said, at 2012/9/10 20:48:
> It doesn't save any code, nor it helps readability.
>
> Signed-off-by: Cong Wang <amwang@...hat.com>
this macro, don't reduce showing lines?
with it, more readability on terminal, right?
P.S. when doing backport work, some bored patches influence me.
this patch and [PATCH 3/3] are typical. :-)
> ---
> net/ipv6/route.c | 48 ++++++++++++++++++++++++++++--------------------
> 1 files changed, 28 insertions(+), 20 deletions(-)
>
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index b130bf2..71267e9 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -675,24 +675,6 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
> }
> #endif
>
> -#define BACKTRACK(__net, saddr) \
> -do { \
> - if (rt == __net->ipv6.ip6_null_entry) { \
> - struct fib6_node *pn; \
> - while (1) { \
> - if (fn->fn_flags & RTN_TL_ROOT) \
> - goto out; \
> - pn = fn->parent; \
> - if (FIB6_SUBTREE(pn) && FIB6_SUBTREE(pn) != fn) \
> - fn = fib6_lookup(FIB6_SUBTREE(pn), NULL, saddr); \
> - else \
> - fn = pn; \
> - if (fn->fn_flags & RTN_RTINFO) \
> - goto restart; \
> - } \
> - } \
> -} while (0)
> -
> static struct rt6_info *ip6_pol_route_lookup(struct net *net,
> struct fib6_table *table,
> struct flowi6 *fl6, int flags)
> @@ -705,7 +687,20 @@ static struct rt6_info *ip6_pol_route_lookup(struct net *net,
> restart:
> rt = fn->leaf;
> rt = rt6_device_match(net, rt, &fl6->saddr, fl6->flowi6_oif, flags);
> - BACKTRACK(net, &fl6->saddr);
> + if (rt == net->ipv6.ip6_null_entry) {
> + struct fib6_node *pn;
> + while (1) {
> + if (fn->fn_flags & RTN_TL_ROOT)
> + goto out;
> + pn = fn->parent;
> + if (FIB6_SUBTREE(pn) && FIB6_SUBTREE(pn) != fn)
> + fn = fib6_lookup(FIB6_SUBTREE(pn), NULL, &fl6->saddr);
> + else
> + fn = pn;
> + if (fn->fn_flags & RTN_RTINFO)
> + goto restart;
> + }
> + }
> out:
> dst_use(&rt->dst, jiffies);
> read_unlock_bh(&table->tb6_lock);
> @@ -867,7 +862,20 @@ restart_2:
> restart:
> rt = rt6_select(fn, oif, strict | reachable);
>
> - BACKTRACK(net, &fl6->saddr);
> + if (rt == net->ipv6.ip6_null_entry) {
> + struct fib6_node *pn;
> + while (1) {
> + if (fn->fn_flags & RTN_TL_ROOT)
> + goto out;
> + pn = fn->parent;
> + if (FIB6_SUBTREE(pn) && FIB6_SUBTREE(pn) != fn)
> + fn = fib6_lookup(FIB6_SUBTREE(pn), NULL, &fl6->saddr);
> + else
> + fn = pn;
> + if (fn->fn_flags & RTN_RTINFO)
> + goto restart;
> + }
> + }
> if (rt == net->ipv6.ip6_null_entry ||
> rt->rt6i_flags & RTF_CACHE)
> goto out;
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists