mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Martin Wilck <Martin.Wilck@Fujitsu-Siemens.com>
To: Harald Welte <laforge@gnumonks.org>
Cc: Netfilter Mailing List <netfilter-devel@lists.netfilter.org>,
	Linux Kernel mailing list <linux-kernel@vger.kernel.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Patrick Schaaf <bof@bof.de>, Andreas Kleen <ak@suse.de>
Subject: Re: ip_conntrack_hash() problem
Date: 04 Sep 2002 15:40:51 +0200	[thread overview]
Message-ID: <1031146851.3314.139.camel@biker.pdb.fsc.net> (raw)
In-Reply-To: <20020904125628.GB1720@naboo.lincon.Uni-Koeln.DE>

Just to make my previous statement clearer:

I think there's nothing wrong with a power-of-2 hashsize, as long as the
hash function contains no implicit or explicit multipliers that are also
powers of two. In general, multipliers should not have a greatest common
divisor (GCD) larger than 1 with the hash size. Unfortunately, in the
current implementation, ntohl() creates an implicit multiplier of 2^16
for the port numbers (on little-endian machines).

Martin

PS: For the sake of that, the patch also changed the multiplier for the
source port from 2 to 7, assuming that it's relatively unlikely to have
a hash size that is a multiple of 7, and knowing that  multiplying by 7
is cheap. Instead of 7, 31 or 127 also seem good candidates that are
even more unlikely to be divisors of the hash size.

I recommend to printk() a warning if the hash size turns out to have a
GCD >1 with multiple of any multiplier in the hash function.

-- 
Martin Wilck                Phone: +49 5251 8 15113
Fujitsu Siemens Computers   Fax:   +49 5251 8 20409
Heinz-Nixdorf-Ring 1	    mailto:Martin.Wilck@Fujitsu-Siemens.com
D-33106 Paderborn           http://www.fujitsu-siemens.com/primergy






      parent reply	other threads:[~2002-09-04 13:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-04 12:33 Martin Wilck
2002-09-04 12:56 ` Harald Welte
2002-09-04 13:24   ` Martin Wilck
2002-09-04 13:26     ` Andi Kleen
2002-09-05  0:39       ` Rusty Russell
2002-09-05  6:21         ` Patrick Schaaf
2002-09-05  6:24           ` David S. Miller
2002-09-05  6:33             ` Patrick Schaaf
2002-09-05  6:32               ` David S. Miller
2002-09-05  6:39                 ` Patrick Schaaf
2002-09-05  6:40                   ` David S. Miller
2002-09-05 13:37                   ` Rik van Riel
2002-09-05 11:14           ` Rusty Russell
2002-09-05  6:51         ` Patrick Schaaf
2002-09-05  7:19         ` Martin Wilck
2002-09-05 11:15           ` Rusty Russell
2002-09-05 11:54             ` Andi Kleen
2002-09-05 17:55               ` Patrick Schaaf
2002-09-05 18:24                 ` Martin Wilck
2002-09-05  8:19       ` Harald Welte
2002-09-04 13:40   ` Martin Wilck [this message]

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=1031146851.3314.139.camel@biker.pdb.fsc.net \
    --to=martin.wilck@fujitsu-siemens.com \
    --cc=ak@suse.de \
    --cc=bof@bof.de \
    --cc=laforge@gnumonks.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netfilter-devel@lists.netfilter.org \
    --cc=rusty@rustcorp.com.au \
    /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

all inboxes | Powered by JetHome®