[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1337243968.3403.3.camel@edumazet-glaptop>
Date: Thu, 17 May 2012 10:39:28 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: David Laight <David.Laight@...LAB.COM>
Cc: pablo@...filter.org, netfilter-devel@...r.kernel.org,
davem@...emloft.net, netdev@...r.kernel.org
Subject: RE: [PATCH 3/7] netfilter: xt_HMARK: modulus is expensive for hash
calculation
On Thu, 2012-05-17 at 09:16 +0100, David Laight wrote:
> > From: Pablo Neira Ayuso <pablo@...filter.org>
> >
> > Use:
> >
> > ((u64)(HASH_VAL * HASH_SIZE)) >> 32
> >
> > as suggested by David S. Miller.
>
> That (u64) cast is very unlikely to have any effect.
> If you want a 64 bit result from the product of two
> 32 bit values, you have to cast one of the 32 bit values
> prior to the multiply - as in the patch below.
Hey, Changelog is a bit wrong (for several reasons) but code is correct.
return (((u64)hash * info->hmodulus) >> 32) + info->hoffset;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists