Subject: Re: Endianness problem with u32 classifier hash masks

From: Jarek Poplawski <[email-masked]>
Date: Mon, 5 Nov 2007 15:35:36 +0100

On Mon, Nov 05, 2007 at 08:47:06AM -0500, jamal wrote:
> On Mon, 2007-05-11 at 10:12 +0100, Jarek Poplawski wrote:
> 
> > BTW: when looking around this I think, maybe, in u32_change():
> > 
> > 1) if (--divisor > 0x100) should be probably ">=", 
> 
> Does it really matter? Divisor can be max of 0xff.

But, according to this max is 0x100... It doesn't really matter,
but we have to wonder which one check is correct if they differ.

> 
> > but is it really needed to check this 2 times (including tc)?
> 
> I dont mind letting users shoot themselves in the foot by sending crap.
> If it can be avoided with simplicity, then better.
> 
> > 2) this while() loop for n->fshift could be replaced with ffs()?
> 
> I think so. Can you please send a patch (after some testing of course
> maybe using Radu's test data)?

Since this would be cosmetics here, I think it could wait for this
main patch. But, since testing isn't my best side, maybe I'd ask
Radu for including this "btw"... I mean only something like this:

  {
  	u8 i = 0;
  	u32 mask = s->hmask;
  	if (mask) {
- 		while (!(mask & 1)) {
- 			i++;
- 			mask>>=1;
- 		}
		i = ffs(mask) + 1;
  	}
  	n->fshift = i;
  }

Thanks,
Jarek P.