netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
To: David Miller <davem@davemloft.net>,
	draghuram@rocketmail.com, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org
Cc: "Brian F. G. Bidulock" <bidulock@openss7.org>
Subject: Re: Question about tcp hash function tcp_hashfn()
Date: Wed, 31 May 2006 17:06:15 +0400	[thread overview]
Message-ID: <20060531130615.GA32362@2ka.mipt.ru> (raw)
In-Reply-To: <20060531110459.GA20551@2ka.mipt.ru>

On Wed, May 31, 2006 at 03:04:59PM +0400, Evgeniy Polyakov (johnpol@2ka.mipt.ru) wrote:
> On Wed, May 31, 2006 at 02:58:18PM +0400, Evgeniy Polyakov (johnpol@2ka.mipt.ru) wrote:
> > On Wed, May 31, 2006 at 03:51:24AM -0600, Brian F. G. Bidulock (bidulock@openss7.org) wrote:
> > > Evgeniy,
> > > 
> > > On Wed, 31 May 2006, Evgeniy Polyakov wrote:
> > > > 2. Compared Jenkins hash with XOR hash used in TCP socket selection code.
> > > > http://tservice.net.ru/~s0mbre/blog/2006/05/14#2006_05_14
> > > 
> > > Two problems with the comparison:
> > > 
> > >   Port numbers can be collected into a 32 bit register in network
> > >   byte order directly from the TCP packet without taking two 16 bit
> > >   values and shifting and or'ing them.
> > 
> > They are.
> > 
> > u32 ports;
> > 
> > ports = lport;
> > ports <<= 16;
> > ports |= fport;
> 
> Using network or host byte order does not affect hash distribution,
> that shifting was coded to simulate other types of mixing ports,
> which actually never showed different results.
> 
> > >   Worse: he folded the jenkins algorith result with
> > > 
> > >    h ^= h >> 16;
> > >    h ^= h >> 8;
> > > 
> > >   Destroying the coverage of the function.
> > 
> > It was done to simulate socket code which uses the same folding.
> > Leaving 32bit space is just wrong, consider hash table size with that
> > index.

Btw, that probably requires some clarification.
Since hash table size is definitely less than returned hash value, so
higher bits are removed, for that case above folding is done both in
XOR hash and my test case. 
It is possible to just remove higher bits, but fairly ditributed parts
being xored produce still fairly distributed value.

-- 
	Evgeniy Polyakov

  reply	other threads:[~2006-05-31 13:06 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20060531042908.10463.qmail@web51410.mail.yahoo.com>
     [not found] ` <20060530235525.A30563@openss7.org>
2006-05-31  7:10   ` Question about tcp hash function tcp_hashfn() David Miller
2006-05-31  7:45     ` Brian F. G. Bidulock
2006-05-31  7:49       ` David Miller
2006-05-31  8:00         ` Brian F. G. Bidulock
2006-05-31  9:03           ` Evgeniy Polyakov
2006-05-31  9:12             ` David Miller
2006-05-31  9:44               ` Evgeniy Polyakov
2006-05-31  9:51             ` Brian F. G. Bidulock
2006-05-31 10:58               ` Evgeniy Polyakov
2006-05-31 11:04                 ` Evgeniy Polyakov
2006-05-31 13:06                   ` Evgeniy Polyakov [this message]
2006-05-31 18:29                     ` Brian F. G. Bidulock
2006-06-01  6:12                       ` Evgeniy Polyakov
2006-06-01  6:18                         ` David Miller
2006-06-01  6:22                           ` Brian F. G. Bidulock
2006-06-01  6:24                             ` David Miller
2006-05-31 18:41                 ` David Miller
2006-06-01  6:04                   ` Evgeniy Polyakov
2006-06-01  6:18                     ` Brian F. G. Bidulock
2006-06-01  6:30                       ` Evgeniy Polyakov
2006-06-01  6:46                         ` Brian F. G. Bidulock
2006-06-01  7:01                           ` Evgeniy Polyakov
2006-06-01  7:11                             ` Brian F. G. Bidulock
2006-06-01  8:38                               ` Evgeniy Polyakov
2006-06-01 10:24                                 ` Brian F. G. Bidulock
2006-06-01 11:06                                   ` Evgeniy Polyakov
2006-06-01 18:40                                     ` Brian F. G. Bidulock
2006-06-01 20:21                                       ` David Miller
2006-06-02  7:01                                       ` Evgeniy Polyakov
2006-06-02  5:40                     ` Florian Weimer
2006-06-02  7:48                       ` Evgeniy Polyakov
2006-06-02 15:10                         ` Brian F. G. Bidulock
2006-06-02 17:26                         ` Florian Weimer
2006-06-02 17:37                           ` Brian F. G. Bidulock
2006-05-31  9:52             ` Brian F. G. Bidulock
2006-05-31  8:49         ` Brian F. G. Bidulock
2006-05-31  9:02           ` David Miller
2006-05-31  9:39             ` Brian F. G. Bidulock

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=20060531130615.GA32362@2ka.mipt.ru \
    --to=johnpol@2ka.mipt.ru \
    --cc=bidulock@openss7.org \
    --cc=davem@davemloft.net \
    --cc=draghuram@rocketmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --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).