Re: Question about tcp hash function tcp_hashfn()

Brian F. G. Bidulock
2006-05-31T18:30:12Z

Evgeniy,

On Wed, 31 May 2006, Evgeniy Polyakov wrote:
> > > > 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.

> > > > h ^= h >> 16;
> > > > h ^= h >> 8;

This does not remove high order bits in either function.
Your comparison results are simply invalid with these two lines in place.

--brian