Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] ipv4: Avoid overhead when no custom FIB rules are installed.
Date: Fri, 06 Jul 2012 07:41:22 +0200	[thread overview]
Message-ID: <1341553282.3265.49.camel@edumazet-glaptop> (raw)
In-Reply-To: <20120705.223142.2236039770560842377.davem@davemloft.net>

On Thu, 2012-07-05 at 22:31 -0700, David Miller wrote:
> 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>

> +static inline int fib_lookup(struct net *net, struct flowi4 *flp,
> +			     struct fib_result *res)
> +{
> +	if (!net->ipv4.fib_has_custom_rules) {
> +		if (net->ipv4.fib_local &&
> +		    !fib_table_lookup(net->ipv4.fib_local, flp, res,
> +				      FIB_LOOKUP_NOREF))
> +			return 0;
> +		if (net->ipv4.fib_main &&
> +		    !fib_table_lookup(net->ipv4.fib_main, flp, res,
> +				      FIB_LOOKUP_NOREF))
> +			return 0;
> +		if (net->ipv4.fib_default &&
> +		    !fib_table_lookup(net->ipv4.fib_default, flp, res,
> +				      FIB_LOOKUP_NOREF))
> +			return 0;
> +		return -ENETUNREACH;
> +	}
> +	return __fib_lookup(net, flp, res);
> +}
> +

Hmm, this seems quite big to be inlined ?

  reply	other threads:[~2012-07-06  5:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-06  5:31 [PATCH] ipv4: Avoid overhead when no custom FIB rules are installed David Miller
2012-07-06  5:41 ` Eric Dumazet [this message]
2012-07-06  6:39   ` David Miller
2012-07-06 17:19 ` Ben Hutchings
2012-07-06 18:53   ` 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=1341553282.3265.49.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.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