netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shan Wei <shanwei88@gmail.com>
To: Cong Wang <amwang@redhat.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH 2/3] ipv6, route: remove BACKTRACK() macro
Date: Mon, 10 Sep 2012 21:43:37 +0800	[thread overview]
Message-ID: <504DEE89.8030606@gmail.com> (raw)
In-Reply-To: <1347281326-26890-2-git-send-email-amwang@redhat.com>

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@redhat.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;
> 

  reply	other threads:[~2012-09-10 13:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-10 12:48 [PATCH 1/3] ipv6: remove some useless RCU read lock Cong Wang
2012-09-10 12:48 ` [PATCH 2/3] ipv6, route: remove BACKTRACK() macro Cong Wang
2012-09-10 13:43   ` Shan Wei [this message]
2012-09-11  1:22     ` Cong Wang
2012-09-10 13:54   ` David Laight
2012-09-11  1:07     ` Cong Wang
2012-09-10 20:32   ` David Miller
2012-09-11  1:19     ` Cong Wang
2012-09-11  1:42       ` David Miller
2012-09-11  8:39         ` Cong Wang
2012-09-10 12:48 ` [PATCH 3/3] fib6: remove some useless empty lines and comments Cong Wang
2012-09-10 20:33   ` David Miller
2012-09-11  1:09     ` Cong Wang
2012-09-10 20:31 ` [PATCH 1/3] ipv6: remove some useless RCU read lock David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=504DEE89.8030606@gmail.com \
    --to=shanwei88@gmail.com \
    --cc=amwang@redhat.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).