netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Timo Teräs" <timo.teras@iki.fi>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, kuznet@ms2.inr.ac.ru
Subject: Re: [PATCH] gre: strict physical device binding
Date: Thu, 22 Jan 2009 07:34:18 +0200	[thread overview]
Message-ID: <4978055A.7060102@iki.fi> (raw)
In-Reply-To: <20090121.135452.57299499.davem@davemloft.net>

David Miller wrote:
> From: David Miller <davem@davemloft.net>
> Date: Mon, 19 Jan 2009 17:22:24 -0800 (PST)
> 
>> From: Timo Teras <timo.teras@iki.fi>
>> Date: Mon, 19 Jan 2009 12:50:05 +0200
>>
>>> Check the device on receive path and allow otherwise identical devices
>>> as long as the physical device differs.
>>>
>>> This is useful for NBMA tunnels, where you want to use different gre IP
>>> for each public IP available via different physical devices.
>>>
>>> Signed-off-by: Timo Teras <timo.teras@iki.fi>
>> Seems reasonable, applied.
>>
>> Thanks Timo.
> 
> BTW, isn't it much more efficient to implement this priority scoring
> using a simple integer instead of this big honking 4 entry array of
> pointers on the stack (one entry of which isn't even _used_)?
> 
> Something like:
> 
> 	int score = 4;
> 
> 	...
> 	for_each_hash_chain() {
> 		if (!match)
> 			continue;
> 		if (exact_match)
> 			return this_entry;
> 		this_score = 0;
> 		if (condition1)
> 			this_score |= 2;
> 		if (condition2)
> 			this_score |= 1;
> 		if (this_score < score) {
> 			score = this_score;
> 			cand = this_entry;
> 		}
> 	}
> 	...
> 	return cand;

I guess so, well send updated patch.

- Timo


  reply	other threads:[~2009-01-22  5:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-19 10:50 [PATCH] gre: strict physical device binding Timo Teras
2009-01-20  1:22 ` David Miller
2009-01-21 21:54   ` David Miller
2009-01-22  5:34     ` Timo Teräs [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-01-22  7:24 Timo Teras
2009-01-22 22:11 ` 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=4978055A.7060102@iki.fi \
    --to=timo.teras@iki.fi \
    --cc=davem@davemloft.net \
    --cc=kuznet@ms2.inr.ac.ru \
    --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).